@arbetsformedlingen/yrkesvaljaren 2.0.12 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -21
- package/dist/cjs/{af-validation-message-Cy89nVEv.js → af-validation-message-BdR9X_qh.js} +1 -1
- package/dist/cjs/core-selector.cjs.entry.js +342 -23
- package/dist/cjs/digi-service-job-selector.cjs.entry.js +352 -61
- package/dist/cjs/{index-hZgOvC17.js → index-DMQDFAL7.js} +0 -22
- package/dist/cjs/index.cjs.js +4 -7
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/{esm/fuse-BPnhMTul.js → cjs/types-DdzCbiye.js} +965 -1
- package/dist/cjs/yrkesvaljaren.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +0 -1
- package/dist/collection/components/core-selector/core-selector.css +70 -49
- package/dist/collection/components/core-selector/core-selector.js +309 -14
- package/dist/collection/components/design-compat/af-icon.js +8 -7
- package/dist/collection/components/job-selector/job-selector-controller.js +13 -3
- package/dist/collection/components/job-selector/job-selector.css +188 -34
- package/dist/collection/components/job-selector/job-selector.js +199 -10
- package/dist/components/core-selector2.js +1 -1
- package/dist/components/digi-service-job-selector.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/types.js +1 -1
- package/dist/esm/{af-validation-message-BgoGzzBf.js → af-validation-message-DMoOu-0k.js} +1 -1
- package/dist/esm/core-selector.entry.js +342 -23
- package/dist/esm/digi-service-job-selector.entry.js +310 -19
- package/dist/esm/{index-HNd02eQb.js → index-vJ-tamti.js} +1 -22
- package/dist/esm/index.js +2 -4
- package/dist/esm/loader.js +3 -3
- package/dist/{cjs/fuse-BTLNKxuL.js → esm/types-DVos4HHS.js} +948 -2
- package/dist/esm/yrkesvaljaren.js +3 -3
- package/dist/types/components/core-selector/core-selector.d.ts +68 -0
- package/dist/types/components/job-selector/job-selector-controller.d.ts +5 -0
- package/dist/types/components/job-selector/job-selector.d.ts +21 -3
- package/dist/types/components/job-selector/types.d.ts +12 -0
- package/dist/types/components.d.ts +20 -99
- package/dist/types/index.d.ts +1 -1
- package/dist/vendor/taxonomy-core/af-data-layer.d.ts +16 -0
- package/dist/vendor/taxonomy-core/af-data-layer.js +24 -0
- package/dist/vendor/taxonomy-core/index.d.ts +1 -1
- package/dist/vendor/taxonomy-core/index.js +1 -1
- package/dist/vendor/taxonomy-core/pii-sanitizer.d.ts +25 -0
- package/dist/vendor/taxonomy-core/pii-sanitizer.js +137 -0
- package/dist/vendor/taxonomy-core/selector-navigation.d.ts +9 -1
- package/dist/vendor/taxonomy-core/selector-navigation.js +28 -1
- package/dist/vendor/taxonomy-core/selector-types.d.ts +12 -0
- package/dist/yrkesvaljaren/index.esm.js +1 -1
- package/dist/yrkesvaljaren/p-0f19a308.entry.js +1 -0
- package/dist/yrkesvaljaren/{p-BUviBbwX.js → p-DHK95AvZ.js} +1 -1
- package/dist/yrkesvaljaren/p-DVos4HHS.js +1 -0
- package/dist/yrkesvaljaren/p-b81496c8.entry.js +1 -0
- package/dist/yrkesvaljaren/p-vJ-tamti.js +3 -0
- package/dist/yrkesvaljaren/yrkesvaljaren.esm.js +1 -1
- package/package.json +12 -10
- package/dist/cjs/geo-valjaren.cjs.entry.js +0 -14910
- package/dist/cjs/job-selector-demo.cjs.entry.js +0 -690
- package/dist/cjs/neobrutal-search.cjs.entry.js +0 -171
- package/dist/cjs/search.engine-D4cpbVzd.js +0 -504
- package/dist/cjs/taxonomy-registry-Dzt0SPzT.js +0 -454
- package/dist/cjs/types-CtHBl6Ra.js +0 -14
- package/dist/collection/components/geovaljaren/geovaljaren.css +0 -21
- package/dist/collection/components/geovaljaren/geovaljaren.js +0 -304
- package/dist/collection/components/geovaljaren/logic/adapter.utils.js +0 -20
- package/dist/collection/components/geovaljaren/logic/data.utils.js +0 -12
- package/dist/collection/components/geovaljaren/logic/history-service.js +0 -25
- package/dist/collection/components/geovaljaren/logic/search.engine.js +0 -28
- package/dist/collection/verkstad/verkstad.js +0 -408
- package/dist/components/fuse.js +0 -1
- package/dist/components/geo-valjaren.d.ts +0 -11
- package/dist/components/geo-valjaren.js +0 -1
- package/dist/components/job-selector-demo.d.ts +0 -11
- package/dist/components/job-selector-demo.js +0 -1
- package/dist/components/job-selector.js +0 -1
- package/dist/components/neobrutal-search.d.ts +0 -11
- package/dist/components/neobrutal-search.js +0 -1
- package/dist/components/search.engine.js +0 -1
- package/dist/esm/geo-valjaren.entry.js +0 -14908
- package/dist/esm/job-selector-demo.entry.js +0 -688
- package/dist/esm/neobrutal-search.entry.js +0 -169
- package/dist/esm/search.engine-BaWUTc3r.js +0 -493
- package/dist/esm/taxonomy-registry-C-pSh51L.js +0 -449
- package/dist/esm/types-DHUftoZJ.js +0 -12
- package/dist/types/components/geovaljaren/geovaljaren.d.ts +0 -24
- package/dist/types/components/geovaljaren/logic/adapter.utils.d.ts +0 -7
- package/dist/types/components/geovaljaren/logic/data.utils.d.ts +0 -7
- package/dist/types/components/geovaljaren/logic/history-service.d.ts +0 -6
- package/dist/types/components/geovaljaren/logic/search.engine.d.ts +0 -7
- package/dist/types/components/job-selector-demo/job-selector-demo.d.ts +0 -65
- package/dist/types/components/neobrutal-search/neobrutal-search.d.ts +0 -18
- package/dist/types/verkstad/verkstad.d.ts +0 -1
- package/dist/types/vitest-globals.d.ts +0 -1
- package/dist/yrkesvaljaren/p-5c3a5308.entry.js +0 -1
- package/dist/yrkesvaljaren/p-9ecd5177.entry.js +0 -1
- package/dist/yrkesvaljaren/p-BPnhMTul.js +0 -1
- package/dist/yrkesvaljaren/p-C-pSh51L.js +0 -1
- package/dist/yrkesvaljaren/p-CjMoDiZD.js +0 -1
- package/dist/yrkesvaljaren/p-DHUftoZJ.js +0 -1
- package/dist/yrkesvaljaren/p-HNd02eQb.js +0 -3
- package/dist/yrkesvaljaren/p-b6130085.entry.js +0 -1
- package/dist/yrkesvaljaren/p-dbbea724.entry.js +0 -1
- package/dist/yrkesvaljaren/p-df3fa43b.entry.js +0 -1
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import { TaxonomySearchEngine, registerTaxonomy } from "/build/index.esm.js";
|
|
3
|
-
const LATEST_TAXONOMY_URL = 'https://d3hng02m5bee8m.cloudfront.net/yrkesvaljaren/latest.json';
|
|
4
|
-
let taxonomyPromise;
|
|
5
|
-
async function loadLatestTaxonomy() {
|
|
6
|
-
taxonomyPromise ||= fetch(LATEST_TAXONOMY_URL).then(async (response) => {
|
|
7
|
-
if (!response.ok)
|
|
8
|
-
throw new Error(`Kunde inte ladda yrkesdata: ${response.status}`);
|
|
9
|
-
return response.json();
|
|
10
|
-
});
|
|
11
|
-
return taxonomyPromise;
|
|
12
|
-
}
|
|
13
|
-
async function initVerkstad() {
|
|
14
|
-
try {
|
|
15
|
-
const data = await loadLatestTaxonomy();
|
|
16
|
-
registerTaxonomy(data);
|
|
17
|
-
console.log('[Verkstad] Taxonomy registered');
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
console.error('[Verkstad] Failed to register taxonomy', e);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
initVerkstad();
|
|
24
|
-
let nbEngine = null;
|
|
25
|
-
let nbFlipped = false;
|
|
26
|
-
// Gör dessa tillgängliga globalt för event handlers
|
|
27
|
-
window.toggleFlip = toggleFlip;
|
|
28
|
-
window.toggleOutputFlip = toggleOutputFlip;
|
|
29
|
-
// HJÄLPFUNKTION FÖR ATT RENDERA ETT FLIP-KORT FÖR OUTPUT
|
|
30
|
-
function renderOutputCard(containerId, data, title, type = 'standard') {
|
|
31
|
-
const container = document.getElementById(containerId);
|
|
32
|
-
if (!container)
|
|
33
|
-
return;
|
|
34
|
-
const cardId = `card-${containerId}`;
|
|
35
|
-
const prettyJson = JSON.stringify(data, null, 2);
|
|
36
|
-
let visualization = '';
|
|
37
|
-
if (type === 'art-deco' && data.metadata?.destinations) {
|
|
38
|
-
// ART DECO TICKET STUB VISUALIZATION
|
|
39
|
-
const destinations = data.metadata.destinations.slice(0, 4);
|
|
40
|
-
visualization = `
|
|
41
|
-
<div class="ticket-stub">
|
|
42
|
-
<h3>Resehandling</h3>
|
|
43
|
-
<div style="font-size: 0.8rem; text-align: center; margin-bottom: 15px;">KUNGLIGA PENDLINGSVERKET</div>
|
|
44
|
-
|
|
45
|
-
<div class="ticket-row">
|
|
46
|
-
<span>FRÅN:</span>
|
|
47
|
-
<strong>${data.label.toUpperCase()}</strong>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<div style="margin: 15px 0; border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 10px 0;">
|
|
51
|
-
<div style="font-weight: bold; text-align: center; margin-bottom: 5px;">POPULÄRA RESMÅL</div>
|
|
52
|
-
${destinations.map(d => `
|
|
53
|
-
<div style="display: flex; justify-content: space-between; font-size: 0.9rem;">
|
|
54
|
-
<span>${d.preferred_label}</span>
|
|
55
|
-
<span>${d.commuters} st</span>
|
|
56
|
-
</div>
|
|
57
|
-
`).join('')}
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<div style="font-size: 0.7rem; text-align: center; margin-top: 10px;">
|
|
61
|
-
VALID FOR TRAVEL • CLASS I<br>
|
|
62
|
-
${new Date().toLocaleDateString()}
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
`;
|
|
66
|
-
}
|
|
67
|
-
else if (data.metadata?.destinations) {
|
|
68
|
-
// STANDARD LIST VISUALIZATION (Officiell)
|
|
69
|
-
const topDest = data.metadata.destinations.slice(0, 5);
|
|
70
|
-
visualization = `
|
|
71
|
-
<div style="margin-top: 10px; border-top: 1px solid #eee; padding-top: 10px; width: 100%;">
|
|
72
|
-
<div style="font-weight: bold; font-size: 0.9rem; color: #005ed9; margin-bottom: 8px;">TOPP-DESTINATIONER:</div>
|
|
73
|
-
<table style="width: 100%; font-family: sans-serif; font-size: 0.9rem; border-collapse: collapse;">
|
|
74
|
-
${topDest.map(d => `
|
|
75
|
-
<tr style="border-bottom: 1px solid #f0f0f0;">
|
|
76
|
-
<td style="padding: 6px 0;">🚶 ${d.preferred_label}</td>
|
|
77
|
-
<td style="padding: 6px 0; text-align: right; font-weight: bold;">${d.commuters.toLocaleString('sv-SE')} st</td>
|
|
78
|
-
</tr>
|
|
79
|
-
`).join('')}
|
|
80
|
-
</table>
|
|
81
|
-
</div>
|
|
82
|
-
`;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
// GENERIC / FALLBACK VISUALIZATION (Bättre parsing)
|
|
86
|
-
// Filtrera bort metadata och komplexa objekt för en ren lista
|
|
87
|
-
const props = Object.entries(data)
|
|
88
|
-
.filter(([key, val]) => key !== 'metadata' &&
|
|
89
|
-
typeof val !== 'object' &&
|
|
90
|
-
val !== null);
|
|
91
|
-
visualization = `
|
|
92
|
-
<div style="margin-top: 15px;">
|
|
93
|
-
<table style="width: 100%; border-collapse: collapse; font-size: 0.9rem; font-family: sans-serif;">
|
|
94
|
-
${props.map(([key, val]) => `
|
|
95
|
-
<tr style="border-bottom: 1px solid #eee;">
|
|
96
|
-
<td style="padding: 8px 0; color: #666; font-weight: bold; text-transform: uppercase; font-size: 0.75rem;">${key}</td>
|
|
97
|
-
<td style="padding: 8px 0; text-align: right; color: #000;">${val}</td>
|
|
98
|
-
</tr>
|
|
99
|
-
`).join('')}
|
|
100
|
-
</table>
|
|
101
|
-
${data.metadata ? `<div style="margin-top:10px; font-size: 0.8rem; color: #999; font-style: italic;">+ Metadata dold (se Rådata)</div>` : ''}
|
|
102
|
-
</div>
|
|
103
|
-
`;
|
|
104
|
-
}
|
|
105
|
-
container.innerHTML = `
|
|
106
|
-
<div id="${cardId}" class="output-card">
|
|
107
|
-
<div class="output-flipper">
|
|
108
|
-
<!-- SNYGG FRONT (Active by default) -->
|
|
109
|
-
<div class="output-front">
|
|
110
|
-
<div class="output-header" style="margin-bottom: 5px;">
|
|
111
|
-
<span class="output-label">${type === 'art-deco' ? '🛎️ CONCIERGE' : '✨ RESULTAT'}</span>
|
|
112
|
-
<button class="toggle-btn" onclick="toggleOutputFlip('${cardId}')">RÅDATA 🔄</button>
|
|
113
|
-
</div>
|
|
114
|
-
<div style="font-size: 1rem; color: #5d4037; ${type === 'standard' ? 'margin-bottom: 5px;' : ''}">
|
|
115
|
-
<strong>VAL:</strong> ${data.label || data.displayLabel || data.preferred_label || data.name || 'Inget valt'}
|
|
116
|
-
</div>
|
|
117
|
-
${visualization}
|
|
118
|
-
</div>
|
|
119
|
-
<!-- RÅ BACK (Hidden until flipped) -->
|
|
120
|
-
<div class="output-back">
|
|
121
|
-
<div class="output-header">
|
|
122
|
-
<span class="output-label">📋 Rå JSON</span>
|
|
123
|
-
<button class="toggle-btn" onclick="toggleOutputFlip('${cardId}')">TILLBAKA 🔙</button>
|
|
124
|
-
</div>
|
|
125
|
-
<pre class="raw-output">${prettyJson}</pre>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
</div>
|
|
129
|
-
`;
|
|
130
|
-
}
|
|
131
|
-
function toggleOutputFlip(cardId) {
|
|
132
|
-
const card = document.getElementById(cardId);
|
|
133
|
-
if (!card)
|
|
134
|
-
return;
|
|
135
|
-
card.classList.toggle('flipped');
|
|
136
|
-
// HACK: Hantera höjden för 3D-flippen.
|
|
137
|
-
// Vi byter "position: relative" mellan fram- och baksida beroende på vad som visas.
|
|
138
|
-
// Detta gör att containern växer med innehållet.
|
|
139
|
-
const isFlipped = card.classList.contains('flipped');
|
|
140
|
-
const flipper = card.querySelector('.output-flipper');
|
|
141
|
-
const front = card.querySelector('.output-front');
|
|
142
|
-
const back = card.querySelector('.output-back');
|
|
143
|
-
if (isFlipped) {
|
|
144
|
-
front.style.position = 'absolute';
|
|
145
|
-
front.style.visibility = 'hidden'; // Hide to prevent interaction
|
|
146
|
-
back.style.position = 'relative';
|
|
147
|
-
back.style.visibility = 'visible';
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
front.style.position = 'relative';
|
|
151
|
-
front.style.visibility = 'visible';
|
|
152
|
-
back.style.position = 'absolute';
|
|
153
|
-
back.style.visibility = 'hidden';
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// LYSSNA PÅ DEN OFFICIELLA VALJAREN
|
|
157
|
-
setTimeout(() => {
|
|
158
|
-
const geoOfficial = document.getElementById('geo-official');
|
|
159
|
-
if (geoOfficial) {
|
|
160
|
-
console.log('[Verkstad] Lyssnar på geo-official (afGeoSelected)...');
|
|
161
|
-
geoOfficial.addEventListener('afGeoSelected', (e) => {
|
|
162
|
-
console.log('[Verkstad] Geo vald:', e.detail);
|
|
163
|
-
renderOutputCard('geo-official-output', e.detail, 'OFFICIELL', 'standard');
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}, 1000);
|
|
167
|
-
// ART DECO CONCIERGE (HEADLESS DEMO)
|
|
168
|
-
let commuteData = [];
|
|
169
|
-
async function initCrazyCommute() {
|
|
170
|
-
try {
|
|
171
|
-
const response = await fetch('pendlingskommuner.json');
|
|
172
|
-
const raw = await response.json();
|
|
173
|
-
// Omvandla objekt-struktur till sökbar array
|
|
174
|
-
commuteData = Object.entries(raw.data).map(([id, item]) => ({
|
|
175
|
-
id: id,
|
|
176
|
-
label: item.preferred_label,
|
|
177
|
-
metadata: { destinations: item.destinations }
|
|
178
|
-
}));
|
|
179
|
-
console.log('[CrazyCommute] Data laddad och omvandlad.');
|
|
180
|
-
}
|
|
181
|
-
catch (e) {
|
|
182
|
-
console.error('[CrazyCommute] Fel vid laddning:', e);
|
|
183
|
-
}
|
|
184
|
-
const crazyInput = document.getElementById('art-deco-input');
|
|
185
|
-
if (crazyInput) {
|
|
186
|
-
crazyInput.addEventListener('input', (e) => {
|
|
187
|
-
const q = e.target.value.trim().toLowerCase();
|
|
188
|
-
const resDiv = document.getElementById('art-deco-results');
|
|
189
|
-
resDiv.innerHTML = '';
|
|
190
|
-
if (q.length < 1 || !commuteData.length) {
|
|
191
|
-
resDiv.style.display = 'none';
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
resDiv.style.display = 'block';
|
|
195
|
-
const matches = commuteData.filter(item => item.label && item.label.toLowerCase().includes(q)).slice(0, 4);
|
|
196
|
-
matches.forEach(m => {
|
|
197
|
-
const d = document.createElement('div');
|
|
198
|
-
d.className = 'art-deco-item';
|
|
199
|
-
d.innerHTML = `${m.label.toUpperCase()}`;
|
|
200
|
-
d.onclick = () => {
|
|
201
|
-
crazyInput.value = m.label;
|
|
202
|
-
resDiv.innerHTML = '';
|
|
203
|
-
renderOutputCard('art-deco-output', m, 'CONCIERGE', 'art-deco');
|
|
204
|
-
};
|
|
205
|
-
resDiv.appendChild(d);
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
async function initNeobrutal() {
|
|
211
|
-
const input = document.getElementById('neobrutal-input');
|
|
212
|
-
try {
|
|
213
|
-
console.log('[Neobrutal] Gör oss redo...');
|
|
214
|
-
if (input)
|
|
215
|
-
input.placeholder = 'Laddar uppfinningen...';
|
|
216
|
-
// 1. Hämta senaste publicerade datan och registrera den
|
|
217
|
-
const data = await loadLatestTaxonomy();
|
|
218
|
-
registerTaxonomy(data);
|
|
219
|
-
console.log('[Neobrutal] Data hämtad och registrerad!');
|
|
220
|
-
// 2. Trigga komponenter att läsa in den nya datan
|
|
221
|
-
document.querySelectorAll('digi-service-job-selector').forEach(el => {
|
|
222
|
-
if (el.updateData) {
|
|
223
|
-
console.log('[Verkstad] Uppdaterar data för:', el.id);
|
|
224
|
-
el.updateData();
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
// 3. Initiera sök-policyn (samma som i webkomponenten)
|
|
228
|
-
if (typeof TaxonomySearchEngine !== 'function') {
|
|
229
|
-
throw new Error('TaxonomySearchEngine är inte laddad korrekt från /build/index.esm.js');
|
|
230
|
-
}
|
|
231
|
-
nbEngine = new TaxonomySearchEngine(data.data);
|
|
232
|
-
console.log('[Neobrutal] Motorn är redo.');
|
|
233
|
-
if (input)
|
|
234
|
-
input.placeholder = 'VAD SKA DU BLI?';
|
|
235
|
-
}
|
|
236
|
-
catch (e) {
|
|
237
|
-
console.error('[Neobrutal] Oj! Något gick fel vid start:', e);
|
|
238
|
-
if (input) {
|
|
239
|
-
input.placeholder = 'KUNDE INTE LADDA MOTORN 404';
|
|
240
|
-
input.style.backgroundColor = '#ffcdd2';
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function selectNbItem(item) {
|
|
245
|
-
console.log('[Neobrutal] Item selected:', item);
|
|
246
|
-
document.getElementById('neobrutal-results').innerHTML = '';
|
|
247
|
-
document.getElementById('neobrutal-input').value = item.label || item.preferred_label;
|
|
248
|
-
// Använd det enhetliga flipp-kortet istället för rå text
|
|
249
|
-
renderOutputCard('neobrutal-output-root', item, 'SÖKMASKIN');
|
|
250
|
-
}
|
|
251
|
-
async function toggleFlip() {
|
|
252
|
-
nbFlipped = !nbFlipped;
|
|
253
|
-
document.getElementById('neobrutal-root').classList.toggle('flipped', nbFlipped);
|
|
254
|
-
if (nbFlipped) {
|
|
255
|
-
console.log('[Neobrutal] Flipped to source. Highlighting...');
|
|
256
|
-
try {
|
|
257
|
-
const response = await fetch('verkstad.js');
|
|
258
|
-
const sourceText = await response.text();
|
|
259
|
-
const jsDisplay = document.getElementById('display-js');
|
|
260
|
-
if (jsDisplay) {
|
|
261
|
-
jsDisplay.textContent = sourceText;
|
|
262
|
-
if (window.hljs) {
|
|
263
|
-
jsDisplay.removeAttribute('data-highlighted');
|
|
264
|
-
window.hljs.highlightElement(jsDisplay);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
catch (e) {
|
|
269
|
-
console.error("Failed to fetch source", e);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
const neobrutalInput = document.getElementById('neobrutal-input');
|
|
274
|
-
if (neobrutalInput) {
|
|
275
|
-
neobrutalInput.addEventListener('input', (e) => {
|
|
276
|
-
const query = e.target.value.trim();
|
|
277
|
-
const resDiv = document.getElementById('neobrutal-results');
|
|
278
|
-
resDiv.innerHTML = '';
|
|
279
|
-
if (query.length < 1)
|
|
280
|
-
return;
|
|
281
|
-
if (!nbEngine) {
|
|
282
|
-
console.warn('[Neobrutal] Search engine not ready yet.');
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
// 3. Använd sök-policyn för att få resultat
|
|
286
|
-
const searchResults = nbEngine.search(query, 3);
|
|
287
|
-
console.log(`[Neobrutal] Query: "${query}", Results:`, searchResults.length);
|
|
288
|
-
searchResults.forEach((result) => {
|
|
289
|
-
const score = result.score?.toFixed(2) || "N/A";
|
|
290
|
-
const typeCode = (result.type === 'JobTitle' || result.type === 'job-title') ? 'YRK' : 'GRP';
|
|
291
|
-
const label = result.label || result.preferred_label;
|
|
292
|
-
const c = document.createElement('div');
|
|
293
|
-
c.className = 'result-card';
|
|
294
|
-
c.innerHTML = `
|
|
295
|
-
<div class="card-header">
|
|
296
|
-
<span class="type-badge">${typeCode}</span>
|
|
297
|
-
<span class="score-badge">SCR: ${score}</span>
|
|
298
|
-
</div>
|
|
299
|
-
<div class="card-body">
|
|
300
|
-
<div class="label">${label}</div>
|
|
301
|
-
</div>
|
|
302
|
-
`;
|
|
303
|
-
c.onclick = () => selectNbItem(result);
|
|
304
|
-
resDiv.appendChild(c);
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
// INGA SIMULERINGAR HÄR INTE! KODEN BORTTAGEN ENLIGT ORDER.
|
|
309
|
-
async function initCareerExplorer() {
|
|
310
|
-
const valjare = document.getElementById('breddning-valjare');
|
|
311
|
-
const resultsContainer = document.getElementById('breddning-results-container');
|
|
312
|
-
const resultsBox = document.getElementById('breddning-results');
|
|
313
|
-
let relatedMap = {};
|
|
314
|
-
try {
|
|
315
|
-
console.log('[CareerExplorer] Ingen lokal likhetsdata laddas; väljaren använder senaste CDN-data.');
|
|
316
|
-
}
|
|
317
|
-
catch (e) {
|
|
318
|
-
console.error('[CareerExplorer] Failed to load data:', e);
|
|
319
|
-
}
|
|
320
|
-
if (!valjare)
|
|
321
|
-
return;
|
|
322
|
-
// Lyssna på valet från komponenten
|
|
323
|
-
valjare.addEventListener('afJobSelected', (e) => {
|
|
324
|
-
console.log('[CareerExplorer] afJobSelected:', e.detail);
|
|
325
|
-
const selection = Array.isArray(e.detail) ? e.detail[0] : e.detail;
|
|
326
|
-
if (!selection || !selection.conceptId) {
|
|
327
|
-
resultsContainer.style.display = 'none';
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
showRelated(selection.conceptId);
|
|
331
|
-
});
|
|
332
|
-
function showRelated(conceptId) {
|
|
333
|
-
resultsContainer.style.display = 'block';
|
|
334
|
-
resultsBox.innerHTML = '';
|
|
335
|
-
const data = relatedMap[conceptId];
|
|
336
|
-
if (!data || !data.related || data.related.length === 0) {
|
|
337
|
-
resultsBox.innerHTML = '<div style="grid-column: 1/-1;">Inga direkta matchningar hittades i denna datamängd. Prova "Butikssäljare" eller "Lagerarbetare".</div>';
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
data.related.slice(0, 6).forEach(rel => {
|
|
341
|
-
const card = document.createElement('div');
|
|
342
|
-
// Standard styling
|
|
343
|
-
card.style.background = '#fff';
|
|
344
|
-
card.style.border = '1px solid #e0e0e0';
|
|
345
|
-
card.style.borderRadius = '8px';
|
|
346
|
-
card.style.padding = '15px';
|
|
347
|
-
card.style.boxShadow = '0 2px 4px rgba(0,0,0,0.05)';
|
|
348
|
-
card.style.transition = 'transform 0.2s';
|
|
349
|
-
// Hover-effekt
|
|
350
|
-
card.onmouseover = () => { card.style.transform = 'translateY(-2px)'; card.style.boxShadow = '0 4px 8px rgba(0,0,0,0.1)'; };
|
|
351
|
-
card.onmouseout = () => { card.style.transform = 'translateY(0)'; card.style.boxShadow = '0 2px 4px rgba(0,0,0,0.05)'; };
|
|
352
|
-
card.innerHTML = `
|
|
353
|
-
<div style="font-weight:bold; color:#000; font-size: 1.1rem; margin-bottom: 5px;">${rel.label}</div>
|
|
354
|
-
<div style="font-size:0.8rem; margin-bottom: 5px; color:#666; text-transform: uppercase; letter-spacing: 0.05em;">Kandidat</div>
|
|
355
|
-
`;
|
|
356
|
-
resultsBox.appendChild(card);
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
initCareerExplorer();
|
|
361
|
-
initNeobrutal();
|
|
362
|
-
initCrazyCommute();
|
|
363
|
-
// INITIERA KOMPETENSVÄLJAREN DEMO (NIVÅ 2)
|
|
364
|
-
function initKompetensvaljarenDemo() {
|
|
365
|
-
const yrkesValjare = document.getElementById('demo-ssyk-valjare');
|
|
366
|
-
const kompValjare = document.getElementById('demo-komp-valjare');
|
|
367
|
-
const outputDiv = document.getElementById('komp-output');
|
|
368
|
-
if (!yrkesValjare || !outputDiv)
|
|
369
|
-
return;
|
|
370
|
-
// Lyssna på när användaren väljer ett yrke!
|
|
371
|
-
yrkesValjare.addEventListener('afJobSelected', (e) => {
|
|
372
|
-
console.log('[KompetensDemo] afJobSelected:', e.detail);
|
|
373
|
-
const item = Array.isArray(e.detail) ? e.detail[0] : e.detail;
|
|
374
|
-
if (item && kompValjare) {
|
|
375
|
-
// Robust extraction of ID for v2
|
|
376
|
-
const idToUse = item.occupation_name?.id || item.conceptId || item.ssyk_code_2012 || item.ssyk || '';
|
|
377
|
-
console.log('[KompetensDemo] Sätter af-ssyk på komp-valjare:', idToUse);
|
|
378
|
-
kompValjare.setAttribute('af-ssyk', idToUse);
|
|
379
|
-
}
|
|
380
|
-
else {
|
|
381
|
-
outputDiv.innerHTML = 'Inget yrke valt. Prioritering är avstängd.';
|
|
382
|
-
outputDiv.style.color = '#666';
|
|
383
|
-
if (kompValjare)
|
|
384
|
-
kompValjare.setAttribute('af-ssyk', '');
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
// GENERIC: Lyssna på ALLA kompetensväljare på sidan (inklusive förvals-demot)
|
|
388
|
-
document.addEventListener('afKompetensSelected', (e) => {
|
|
389
|
-
console.log('[KompetensDemo] Event från:', e.target.id || 'anonym kv', e.detail);
|
|
390
|
-
const items = e.detail;
|
|
391
|
-
if (items && items.length > 0) {
|
|
392
|
-
const labels = items.map(i => `<strong>${i.label}</strong> (Id: ${i.id}, Pri: ${i.ssykRank})`).join('<br>');
|
|
393
|
-
outputDiv.innerHTML = `✅ Valda i ${e.target.getAttribute('af-label') || 'komponent'}:<br>${labels}`;
|
|
394
|
-
outputDiv.style.color = '#00695c';
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
outputDiv.innerHTML = 'Inga kompetenser valda i den senaste komponenten.';
|
|
398
|
-
outputDiv.style.color = '#666';
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
const preselectedKompValjare = document.getElementById('preselected-komp-valjare');
|
|
402
|
-
if (preselectedKompValjare) {
|
|
403
|
-
preselectedKompValjare.componentOnReady().then(() => {
|
|
404
|
-
preselectedKompValjare.value = ["Gt5f_wdi_FSJ", "D7Ns_RG6_hD2"];
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
initKompetensvaljarenDemo();
|
package/dist/components/fuse.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function t(t){return Array.isArray?Array.isArray(t):"[object Array]"===o(t)}function e(t){return null==t?"":function(t){if("string"==typeof t)return t;if("bigint"==typeof t)return t.toString();const e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}function i(t){return"string"==typeof t}function n(t){return"number"==typeof t}function s(t){return"object"==typeof t}function r(t){return null!=t}function u(t){return!t.trim().length}function o(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const c="Invalid doc index: must be a non-negative integer within the bounds of the docs array",h=Object.prototype.hasOwnProperty;var a=class{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{const i=l(t);this._keys.push(i),this._keyMap[i.id]=i,e+=i.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function l(e){let n=null,s=null,r=null,u=1,o=null;if(i(e)||t(e))r=e,n=f(e),s=d(e);else{if(!h.call(e,"name"))throw new Error("Missing name property in key");const t=e.name;if(r=t,h.call(e,"weight")&&void 0!==e.weight&&(u=e.weight,u<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(d(t)));n=f(t),s=d(t),o=e.getFn??null}return{path:n,id:s,weight:u,src:r,getFn:o}}function f(e){return t(e)?e:e.split(".")}function d(e){return t(e)?e.join("."):e}const A=Object.freeze({isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:function(u,c){const h=[];let a=!1;const l=(u,c,f,d)=>{if(r(u))if(c[f]){const A=u[c[f]];if(!r(A))return;if(f===c.length-1&&(i(A)||n(A)||function(t){return!0===t||!1===t||function(t){return s(t)&&null!==t}(t)&&"[object Boolean]"==o(t)}(A)||"bigint"==typeof A))h.push(void 0!==d?{v:e(A),i:d}:e(A));else if(t(A)){a=!0;for(let t=0,e=A.length;t<e;t+=1)l(A[t],c,f+1,t)}else c.length&&l(A,c,f+1,d)}else h.push(void 0!==d?{v:u,i:d}:u)};return l(u,i(c)?c.split("."):c,0),a?h:h[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1});var g=class{constructor({getFn:t=A.getFn,fieldNormWeight:e=A.fieldNormWeight}={}){this.norm=function(t=1,e=3){const i=new Map,n=Math.pow(10,e);return{get(e){let s=0,r=!1;for(let t=0;t<e.length;t++)(u=e.charCodeAt(t))>=9&&u<=13||32===u||160===u?r=!1:r||(s++,r=!0);var u;if(0===s&&(s=1),i.has(s))return i.get(s);const o=Math.round(n/Math.pow(s,.5*t))/n;return i.set(s,o),o},clear(){i.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;const t=this.docs.length;this.records=new Array(t);let e=0;if(i(this.docs[0]))for(let i=0;i<t;i++){const t=this._createStringRecord(this.docs[i],i);t&&(this.records[e++]=t)}else for(let i=0;i<t;i++)this.records[e++]=this._createObjectRecord(this.docs[i],i);this.records.length=e,this.norm.clear()}add(t,e){if(!Number.isInteger(e)||e<0)throw new Error(c);if(i(t)){const i=this._createStringRecord(t,e);return i&&this.records.push(i),i}const n=this._createObjectRecord(t,e);return this.records.push(n),n}removeAt(t){if(!Number.isInteger(t)||t<0)throw new Error(c);for(let e=0,i=this.records.length;e<i;e+=1)if(this.records[e].i===t){this.records.splice(e,1);break}for(let e=0,i=this.records.length;e<i;e+=1)this.records[e].i>t&&(this.records[e].i-=1)}removeAll(t){const e=new Set;for(const i of t)Number.isInteger(i)&&i>=0&&e.add(i);if(0===e.size)return;this.records=this.records.filter((t=>!e.has(t.i)));const i=Array.from(e).sort(((t,e)=>t-e));for(const t of this.records){let e=0,n=i.length;for(;e<n;){const s=e+n>>>1;i[s]<t.i?e=s+1:n=s}t.i-=e}}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_createStringRecord(t,e){return!r(t)||u(t)?null:{v:t,i:e,n:this.norm.get(t)}}_createObjectRecord(n,s){const o={i:s,$:{}};for(let s=0,c=this.keys.length;s<c;s++){const c=this.keys[s],h=c.getFn?c.getFn(n):this.getFn(n,c.path);if(r(h))if(t(h)){const t=[];for(let n=0,s=h.length;n<s;n+=1){const s=h[n];if(r(s))if(i(s)){if(!u(s)){const e={v:s,i:n,n:this.norm.get(s)};t.push(e)}}else if(r(s.v)){const n=i(s.v)?s.v:e(s.v);if(!u(n)){const e={v:n,i:s.i,n:this.norm.get(n)};t.push(e)}}}o.$[s]=t}else if(i(h)&&!u(h)){const t={v:h,n:this.norm.get(h)};o.$[s]=t}}return o}toJSON(){return{keys:this.keys.map((({getFn:t,...e})=>e)),records:this.records}}};function C(t,e,{getFn:i=A.getFn,fieldNormWeight:n=A.fieldNormWeight}={}){const s=new g({getFn:i,fieldNormWeight:n});return s.setKeys(t.map(l)),s.setSources(e),s.create(),s}function F(t){const e={};for(let i=0,n=t.length;i<n;i+=1){const s=t.charAt(i);e[s]=(e[s]||0)|1<<n-i-1}return e}function D(t){if(t.length<=1)return t;t.sort(((t,e)=>t[0]-e[0]||t[1]-e[1]));const e=[t[0]];for(let i=1,n=t.length;i<n;i+=1){const n=e[e.length-1],s=t[i];s[0]<=n[1]+1?n[1]=Math.max(n[1],s[1]):e.push(s)}return e}const B={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},M=new RegExp("["+Object.keys(B).join("")+"]","g"),m="function"==typeof String.prototype.normalize?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(M,(t=>B[t])):t=>t;var E=class{constructor(t,{location:e=A.location,threshold:i=A.threshold,distance:n=A.distance,includeMatches:s=A.includeMatches,findAllMatches:r=A.findAllMatches,minMatchCharLength:u=A.minMatchCharLength,isCaseSensitive:o=A.isCaseSensitive,ignoreDiacritics:c=A.ignoreDiacritics,ignoreLocation:h=A.ignoreLocation}={}){if(this.options={location:e,threshold:i,distance:n,includeMatches:s,findAllMatches:r,minMatchCharLength:u,isCaseSensitive:o,ignoreDiacritics:c,ignoreLocation:h},t=o?t:t.toLowerCase(),t=c?m(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const a=(t,e)=>{this.chunks.push({pattern:t,alphabet:F(t),startIndex:e})},l=this.pattern.length;if(l>32){let t=0;const e=l%32,i=l-e;for(;t<i;)a(this.pattern.substr(t,32),t),t+=32;if(e){const t=l-32;a(this.pattern.substr(t),t)}}else a(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,ignoreDiacritics:i,includeMatches:n}=this.options;if(t=e?t:t.toLowerCase(),t=i?m(t):t,this.pattern===t){if(t.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};const e={isMatch:!0,score:0};return n&&(e.indices=[[0,t.length-1]]),e}const{location:s,distance:r,threshold:u,findAllMatches:o,minMatchCharLength:c,ignoreLocation:h}=this.options,a=[];let l=0,f=!1;this.chunks.forEach((({pattern:e,alphabet:i,startIndex:d})=>{const{isMatch:g,score:C,indices:F}=function(t,e,i,{location:n=A.location,distance:s=A.distance,threshold:r=A.threshold,findAllMatches:u=A.findAllMatches,minMatchCharLength:o=A.minMatchCharLength,includeMatches:c=A.includeMatches,ignoreLocation:h=A.ignoreLocation}={}){if(e.length>32)throw new Error("Pattern length exceeds max of 32.");const a=e.length,l=t.length,f=Math.max(0,Math.min(n,l));let d=r,g=f;const C=(t,e)=>{const i=t/a;if(h)return i;const n=Math.abs(f-e);return s?i+n/s:n?1:i},F=o>1||c,D=F?Array(l):[];let B;for(;(B=t.indexOf(e,g))>-1;){const t=C(0,B);if(d=Math.min(t,d),g=B+a,F){let t=0;for(;t<a;)D[B+t]=1,t+=1}}g=-1;let M=[],m=1,E=0,v=a+l;const p=1<<a-1;for(let e=0;e<a;e+=1){let n=0,s=v;for(;n<s;)C(e,f+s)<=d?n=s:v=s,s=Math.floor((v-n)/2+n);v=s;let r=Math.max(1,f-s+1);const o=u?l:Math.min(f+s,l)+a,c=Array(o+2);c[o+1]=(1<<e)-1;for(let n=o;n>=r;n-=1){const s=n-1;if(c[n]=(c[n+1]<<1|1)&i[t[s]],e&&(c[n]|=(M[n+1]|M[n])<<1|1|M[n+1]),c[n]&p&&(m=C(e,s),m<=d)){if(d=m,g=s,E=e,g<=f)break;r=Math.max(1,2*f-g)}}if(C(e+1,f)>d)break;M=c}if(F&&g>=0){const e=Math.min(l-1,g+a-1+E);for(let n=g;n<=e;n+=1)i[t[n]]&&(D[n]=1)}const y={isMatch:g>=0,score:Math.max(.001,m)};if(F){const t=function(t=[],e=A.minMatchCharLength){const i=[];let n=-1,s=-1,r=0;for(let u=t.length;r<u;r+=1){const u=t[r];u&&-1===n?n=r:u||-1===n||(s=r-1,s-n+1>=e&&i.push([n,s]),n=-1)}return t[r-1]&&r-n>=e&&i.push([n,r-1]),i}(D,o);t.length?c&&(y.indices=t):y.isMatch=!1}return y}(t,e,i,{location:s+d,distance:r,threshold:u,findAllMatches:o,minMatchCharLength:c,includeMatches:n,ignoreLocation:h});g&&(f=!0),l+=C,g&&F&&a.push(...F)}));const d={isMatch:f,score:f?l/this.chunks.length:1};return f&&n&&(d.indices=D(a)),d}};const v=new Set(["fuzzy","include"]),p=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:t=>({type:"exact",search(e){const i=e===t;return{isMatch:i,score:i?0:1,indices:[0,t.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:t=>({type:"include",search(e){let i,n=0;const s=[],r=t.length;for(;(i=e.indexOf(t,n))>-1;)n=i+r,s.push([i,n-1]);const u=!!s.length;return{isMatch:u,score:u?0:1,indices:s}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:t=>({type:"prefix-exact",search(e){const i=e.startsWith(t);return{isMatch:i,score:i?0:1,indices:[0,t.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:t=>({type:"inverse-prefix-exact",search(e){const i=!e.startsWith(t);return{isMatch:i,score:i?0:1,indices:[0,e.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:t=>({type:"inverse-suffix-exact",search(e){const i=!e.endsWith(t);return{isMatch:i,score:i?0:1,indices:[0,e.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:t=>({type:"suffix-exact",search(e){const i=e.endsWith(t);return{isMatch:i,score:i?0:1,indices:[e.length-t.length,e.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:t=>({type:"inverse-exact",search(e){const i=-1===e.indexOf(t);return{isMatch:i,score:i?0:1,indices:[0,e.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(t,e={})=>{const i=new E(t,{location:e.location??A.location,threshold:e.threshold??A.threshold,distance:e.distance??A.distance,includeMatches:e.includeMatches??A.includeMatches,findAllMatches:e.findAllMatches??A.findAllMatches,minMatchCharLength:e.minMatchCharLength??A.minMatchCharLength,isCaseSensitive:e.isCaseSensitive??A.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics??A.ignoreDiacritics,ignoreLocation:e.ignoreLocation??A.ignoreLocation});return{type:"fuzzy",search:t=>i.searchIn(t)}}}],y=p.length;function x(t,e){const i=t.match(e);return i?i[1]:null}const w=[];function k(...t){w.push(...t)}function b(t,e){for(let i=0,n=w.length;i<n;i+=1){const n=w[i];if(n.condition(t,e))return new n(t,e)}return new E(t,e)}const S="$and",$="$path",N=t=>!(!t[S]&&!t.$or),L=t=>({[S]:Object.keys(t).map((e=>({[e]:t[e]})))});function R(e,n,{auto:r=!0}={}){const u=e=>{if(i(e)){const t={keyId:null,pattern:e};return r&&(t.searcher=b(e,n)),t}const o=Object.keys(e),c=(t=>!!t[$])(e);if(!c&&o.length>1&&!N(e))return u(L(e));if((e=>!t(e)&&s(e)&&!N(e))(e)){const t=c?e[$]:o[0],s=c?e.$val:e[t];if(!i(s))throw new Error((t=>`Invalid value for key ${t}`)(t));const u={keyId:d(t),pattern:s};return r&&(u.searcher=b(s,n)),u}const h={children:[],operator:o[0]};return o.forEach((i=>{const n=e[i];t(n)&&n.forEach((t=>{h.children.push(u(t))}))})),h};return N(e)||(e=L(e)),u(e)}function I(t,{ignoreFieldNorm:e=A.ignoreFieldNorm}){let i=1;return t.forEach((({key:t,norm:n,score:s})=>{const r=t?t.weight:null;i*=Math.pow(0===s&&r?Number.EPSILON:s,(r||1)*(e?1:n))})),i}var z=class{constructor(t,e){this.limit=t,this.heap=[],this.comparator=e}get size(){return this.heap.length}insert(t){this.size<this.limit?(this.heap.push(t),this._bubbleUp(this.size-1)):this.comparator(t,this.heap[0])<0&&(this.heap[0]=t,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(t){const e=this.heap;for(;t>0;){const i=t-1>>1;if(this.comparator(e[t],e[i])<=0)break;const n=e[t];e[t]=e[i],e[i]=n,t=i}}_sinkDown(t){const e=this.heap,i=e.length;let n=t;do{const s=2*(t=n)+1,r=2*t+2;if(s<i&&this.comparator(e[s],e[n])>0&&(n=s),r<i&&this.comparator(e[r],e[n])>0&&(n=r),n!==t){const i=e[t];e[t]=e[n],e[n]=i}}while(n!==t)}};const _=/[\p{L}\p{M}\p{N}_]+/gu,j=new WeakSet;function O({isCaseSensitive:t=!1,ignoreDiacritics:e=!1,tokenize:i}={}){const n=function(t){if("function"==typeof t){let e=!1;return i=>{const n=t(i);if(!e&&(e=!0,!Array.isArray(n)||n.some((t=>"string"!=typeof t))))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(n)?"array containing non-strings":typeof n}.`);return n}}return t instanceof RegExp?(t.global||j.has(e=t)||(j.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`)),e=>e.match(t)||[]):t=>t.match(_)||[];var e}(i);return{tokenize:i=>(t||(i=i.toLowerCase()),e&&(i=m(i)),n(i))}}function W(t,e,i,n){const s=n.tokenize(e);if(!s.length)return;t.fieldCount++,t.docFieldCount.set(i,(t.docFieldCount.get(i)||0)+1);const r=new Set(s);let u=t.docTermFieldHits.get(i);u||(u=new Map,t.docTermFieldHits.set(i,u));for(const e of r)u.set(e,(u.get(e)||0)+1),t.df.set(e,(t.df.get(e)||0)+1)}function T(t,e,i,n){const{i:s,v:r,$:u}=e;if(void 0===r){if(u)for(let e=0;e<i;e++){const i=u[e];if(i)if(Array.isArray(i))for(const e of i)W(t,e.v,s,n);else W(t,i.v,s,n)}}else W(t,r,s,n)}function J(t,e){const i=t.docFieldCount.get(e);if(void 0===i)return;t.fieldCount-=i,t.docFieldCount.delete(e);const n=t.docTermFieldHits.get(e);if(n){for(const[e,i]of n){const n=(t.df.get(e)||0)-i;n<=0?t.df.delete(e):t.df.set(e,n)}t.docTermFieldHits.delete(e)}}function K(t,e){if(0===e.length)return;const i=Array.from(new Set(e)).sort(((t,e)=>t-e));for(const e of i)J(t,e);const n=t=>{let e=0,n=i.length;for(;e<n;){const s=e+n>>>1;i[s]<t?e=s+1:n=s}return t-e},s=i[0],r=new Map;for(const[e,i]of t.docFieldCount)r.set(e>s?n(e):e,i);t.docFieldCount=r;const u=new Map;for(const[e,i]of t.docTermFieldHits)u.set(e>s?n(e):e,i);t.docTermFieldHits=u}var U=class{constructor(t,e,i){this.options={...A,...e},this._keyStore=new a(this.options.keys),this._docs=t,this._myIndex=null,this._invertedIndex=null,this.setCollection(t,i),this._lastQuery=null,this._lastSearcher=null}_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=b(t,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=t,this._lastSearcher=e,e}setCollection(t,e){if(this._docs=t,e&&!(e instanceof g))throw new Error("Incorrect 'index' type");if(this._myIndex=e||C(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const t=O({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=function(t,e,i){const n={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(const s of t)T(n,s,e,i);return n}(this._myIndex.records,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}add(t){if(!r(t))return;this._docs.push(t);const e=this._myIndex.add(t,this._docs.length-1);if(this._invertedIndex&&e){const t=O({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});!function(t,e,i,n){T(t,e,i,n)}(this._invertedIndex,e,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}remove(t=()=>!1){const e=[],i=[];for(let n=0,s=this._docs.length;n<s;n+=1)t(this._docs[n],n)&&(e.push(this._docs[n]),i.push(n));if(i.length){this._invertedIndex&&K(this._invertedIndex,i);const t=new Set(i);this._docs=this._docs.filter(((e,i)=>!t.has(i))),this._myIndex.removeAll(i),this._invalidateSearcherCache()}return e}removeAt(t){if(!Number.isInteger(t)||t<0||t>=this._docs.length)throw new Error(c);this._invertedIndex&&K(this._invertedIndex,[t]);const e=this._docs.splice(t,1)[0];return this._myIndex.removeAt(t),this._invalidateSearcherCache(),e}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map((t=>this._keyStore.get(t.id)||t))}search(t,e){const{limit:s=-1}=e||{},{includeMatches:u,includeScore:o,shouldSort:c,sortFn:h,ignoreFieldNorm:a}=this.options;if(i(t)&&!t.trim()){let t=this._docs.map(((t,e)=>({item:t,refIndex:e})));return n(s)&&s>-1&&(t=t.slice(0,s)),t}const l=c&&n(s)&&s>0&&i(t),f=h,d=(t,e)=>f(t,e)||t.idx-e.idx;let g;if(l){const e=new z(s,d);i(this._docs[0])?this._searchStringList(t,{heap:e,ignoreFieldNorm:a}):this._searchObjectList(t,{heap:e,ignoreFieldNorm:a}),g=e.extractSorted()}else g=i(t)?i(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),function(t,{ignoreFieldNorm:e=A.ignoreFieldNorm}){t.forEach((t=>{t.score=I(t.matches,{ignoreFieldNorm:e})}))}(g,{ignoreFieldNorm:a}),c&&g.sort(i(t)?d:f),n(s)&&s>-1&&(g=g.slice(0,s));return function(t,e,{includeMatches:i=A.includeMatches,includeScore:n=A.includeScore}={}){return t.map((t=>{const{idx:s}=t,u={item:e[s],refIndex:s};return i&&(u.matches=function(t){const e=[];return t.matches.forEach((t=>{if(!r(t.indices)||!t.indices.length)return;const i={indices:t.indices,value:t.value};t.key&&(i.key=t.key.id),t.idx>-1&&(i.refIndex=t.idx),e.push(i)})),e}(t)),n&&(u.score=t.score),u}))}(g,this._docs,{includeMatches:u,includeScore:o})}_searchStringList(t,{heap:e,ignoreFieldNorm:i}={}){const n=this._getSearcher(t),s=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:u}=this._myIndex,o=e?null:[];return u.forEach((({v:t,i:u,n:c})=>{if(!r(t))return;const h=n.searchIn(t);if(h.isMatch){const n={score:h.score,value:t,norm:c,indices:h.indices};s&&(n.matchedMask=h.matchedMask,n.matchedTerms=h.matchedTerms,n.termCount=h.termCount);const r=[n];if(!s||this._coversAllTokens(r)){const n={item:t,idx:u,matches:r};e?(n.score=I(n.matches,{ignoreFieldNorm:i}),e.insert(n)):o.push(n)}}})),o}_searchLogical(t){const e=R(t,this.options),i=this._normalizedKeys(),n=(t,e,s)=>{if(!("children"in t)){const{keyId:n,searcher:r}=t;let u;return null===n?(u=[],i.forEach(((t,i)=>{u.push(...this._findMatches({key:t,value:e[i],searcher:r}))}))):u=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(e,n),searcher:r}),u&&u.length?[{idx:s,item:e,matches:u}]:[]}const{children:r,operator:u}=t,o=[];for(let t=0,i=r.length;t<i;t+=1){const i=n(r[t],e,s);if(i.length)o.push(...i);else if(u===S)return[]}return o},s=this._myIndex.records,u=new Map,o=[];return s.forEach((({$:t,i})=>{if(r(t)){const s=n(e,t,i);s.length&&(u.has(i)||(u.set(i,{idx:i,item:t,matches:[]}),o.push(u.get(i))),s.forEach((({matches:t})=>{u.get(i).matches.push(...t)})))}})),o}_searchObjectList(t,{heap:e,ignoreFieldNorm:i}={}){const n=this._getSearcher(t),s=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:u}=this._myIndex,o=this._normalizedKeys(),c=e?null:[];return u.forEach((({$:t,i:u})=>{if(!r(t))return;const h=[];let a=!1,l=!1;if(o.forEach(((e,i)=>{const s=this._findMatches({key:e,value:t[i],searcher:n});s.length?(h.push(...s),s[0].hasInverse&&(l=!0)):a=!0})),(!l||!a)&&h.length&&(!s||this._coversAllTokens(h))){const n={idx:u,item:t,matches:h};e?(n.score=I(n.matches,{ignoreFieldNorm:i}),e.insert(n)):c.push(n)}})),c}_findMatches({key:e,value:i,searcher:n}){if(!r(i))return[];const s=[];if(t(i))i.forEach((({v:t,i,n:u})=>{if(!r(t))return;const o=n.searchIn(t);if(o.isMatch){const n={score:o.score,key:e,value:t,idx:i,norm:u,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),s.push(n)}}));else{const{v:t,n:r}=i,u=n.searchIn(t);if(u.isMatch){const i={score:u.score,key:e,value:t,norm:r,indices:u.indices,hasInverse:u.hasInverse};void 0!==u.termCount&&(i.matchedMask=u.matchedMask,i.matchedTerms=u.matchedTerms,i.termCount=u.termCount),s.push(i)}}return s}_coversAllTokens(t){const e=t.length?t[0].termCount:void 0;if(void 0===e)return!0;if(e<=31){let i=0;for(let e=0;e<t.length;e++)i|=t[e].matchedMask||0;return i===2**e-1}const i=new Set;for(let e=0;e<t.length;e++){const n=t[e].matchedTerms;if(n)for(const t of n)i.add(t)}return i.size===e}};U.version="7.5.0",U.createIndex=C,U.parseIndex=function(t,{getFn:e=A.getFn,fieldNormWeight:i=A.fieldNormWeight}={}){const{keys:n,records:s}=t,r=new g({getFn:e,fieldNormWeight:i});return r.setKeys(n),r.setIndexRecords(s),r},U.config=A,U.match=function(t,e,i){if(i&&i.useTokenSearch)throw new Error("Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.");return b(t,{...A,...i}).searchIn(e)},U.parseQuery=R,k(class{constructor(t,{isCaseSensitive:e=A.isCaseSensitive,ignoreDiacritics:i=A.ignoreDiacritics,includeMatches:n=A.includeMatches,minMatchCharLength:s=A.minMatchCharLength,ignoreLocation:r=A.ignoreLocation,findAllMatches:u=A.findAllMatches,location:o=A.location,threshold:c=A.threshold,distance:h=A.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:i,includeMatches:n,minMatchCharLength:s,findAllMatches:u,ignoreLocation:r,location:o,threshold:c,distance:h},t=e?t:t.toLowerCase(),t=i?m(t):t,this.pattern=t,this.query=function(t,e={}){return t.replace(/\\\|/g,"\0").split("|").map((t=>{const i=function(t){const e=[],i=t.length;let n=0;for(;n<i;){for(;n<i&&" "===t[n];)n++;if(n>=i)break;let s=n;for(;s<i&&" "!==t[s]&&'"'!==t[s];)s++;if(s<i&&'"'===t[s]){for(s++;s<i;){if('"'===t[s]){const e=s+1;if(e>=i||" "===t[e]){s++;break}if("$"===t[e]&&(e+1>=i||" "===t[e+1])){s+=2;break}}s++}e.push(t.substring(n,s)),n=s}else{for(;s<i&&" "!==t[s];)s++;e.push(t.substring(n,s)),n=s}}return e}(t.replace(/\u0000/g,"|").trim()).filter((t=>t&&!!t.trim())),n=[];for(let t=0,s=i.length;t<s;t+=1){const s=i[t];let r=!1,u=-1;for(;!r&&++u<y;){const t=p[u],i=x(s,t.multiRegex);i&&(n.push(t.create(i,e)),r=!0)}if(!r)for(u=-1;++u<y;){const t=p[u],i=x(s,t.singleRegex);if(i){n.push(t.create(i,e));break}}}return n}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:i,isCaseSensitive:n,ignoreDiacritics:s}=this.options;t=n?t:t.toLowerCase(),t=s?m(t):t;let r=0;const u=[];let o=0,c=!1;for(let n=0,s=e.length;n<s;n+=1){const s=e[n];u.length=0,r=0,c=!1;for(let e=0,n=s.length;e<n;e+=1){const n=s[e],{isMatch:h,indices:a,score:l}=n.search(t);if(!h){o=0,r=0,u.length=0,c=!1;break}r+=1,o+=l,n.type.startsWith("inverse")&&(c=!0),i&&(v.has(n.type)?u.push(...a):u.push(a))}if(r){const t={isMatch:!0,score:o/r};return c&&(t.hasInverse=!0),i&&(t.indices=D(u)),t}}return{isMatch:!1,score:1}}}),k(class{static condition(t,e){return e.useTokenSearch}constructor(t,e){this.options=e,this.analyzer=O({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,tokenize:e.tokenize});const i=this.analyzer.tokenize(t),{df:n,fieldCount:s}=e._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(const t of i){this.termSearchers.push(new E(t,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));const i=n.get(t)||0,r=Math.log(1+(s-i+.5)/(i+.5));this.idfWeights.push(r)}this.combineAll="all"===e.tokenMatch,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(t){if(!this.termSearchers.length)return{isMatch:!1,score:1};const e=[];let i=0,n=0,s=0,r=0;const u=this.combineAll&&!this.useMask?new Set:null;for(let o=0;o<this.termSearchers.length;o++){const c=this.termSearchers[o].searchIn(t),h=this.idfWeights[o];n+=h,c.isMatch&&(s++,i+=h*(1-c.score),c.indices&&e.push(...c.indices),this.combineAll&&(this.useMask?r|=1<<o:u.add(o)))}if(0===s)return{isMatch:!1,score:1};const o={isMatch:!0,score:Math.max(.001,n>0?1-i/n:0)};return this.options.includeMatches&&e.length&&(o.indices=D(e)),this.combineAll&&(this.useMask?o.matchedMask=r:o.matchedTerms=u,o.termCount=this.numTerms),o}}),U.use=function(...t){t.forEach((t=>k(t)))};var H=U;export{H as e}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface GeoValjaren extends Components.GeoValjaren, HTMLElement {}
|
|
4
|
-
export const GeoValjaren: {
|
|
5
|
-
prototype: GeoValjaren;
|
|
6
|
-
new (): GeoValjaren;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|