svelte-typeahead 4.4.2 → 5.0.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/lib/index.mjs DELETED
@@ -1,2018 +0,0 @@
1
- function noop() { }
2
- function assign(tar, src) {
3
- // @ts-ignore
4
- for (const k in src)
5
- tar[k] = src[k];
6
- return tar;
7
- }
8
- function run(fn) {
9
- return fn();
10
- }
11
- function blank_object() {
12
- return Object.create(null);
13
- }
14
- function run_all(fns) {
15
- fns.forEach(run);
16
- }
17
- function is_function(thing) {
18
- return typeof thing === 'function';
19
- }
20
- function safe_not_equal(a, b) {
21
- return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
22
- }
23
- function is_empty(obj) {
24
- return Object.keys(obj).length === 0;
25
- }
26
- function create_slot(definition, ctx, $$scope, fn) {
27
- if (definition) {
28
- const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
29
- return definition[0](slot_ctx);
30
- }
31
- }
32
- function get_slot_context(definition, ctx, $$scope, fn) {
33
- return definition[1] && fn
34
- ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))
35
- : $$scope.ctx;
36
- }
37
- function get_slot_changes(definition, $$scope, dirty, fn) {
38
- if (definition[2] && fn) {
39
- const lets = definition[2](fn(dirty));
40
- if ($$scope.dirty === undefined) {
41
- return lets;
42
- }
43
- if (typeof lets === 'object') {
44
- const merged = [];
45
- const len = Math.max($$scope.dirty.length, lets.length);
46
- for (let i = 0; i < len; i += 1) {
47
- merged[i] = $$scope.dirty[i] | lets[i];
48
- }
49
- return merged;
50
- }
51
- return $$scope.dirty | lets;
52
- }
53
- return $$scope.dirty;
54
- }
55
- function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {
56
- if (slot_changes) {
57
- const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
58
- slot.p(slot_context, slot_changes);
59
- }
60
- }
61
- function get_all_dirty_from_scope($$scope) {
62
- if ($$scope.ctx.length > 32) {
63
- const dirty = [];
64
- const length = $$scope.ctx.length / 32;
65
- for (let i = 0; i < length; i++) {
66
- dirty[i] = -1;
67
- }
68
- return dirty;
69
- }
70
- return -1;
71
- }
72
- function exclude_internal_props(props) {
73
- const result = {};
74
- for (const k in props)
75
- if (k[0] !== '$')
76
- result[k] = props[k];
77
- return result;
78
- }
79
- function compute_rest_props(props, keys) {
80
- const rest = {};
81
- keys = new Set(keys);
82
- for (const k in props)
83
- if (!keys.has(k) && k[0] !== '$')
84
- rest[k] = props[k];
85
- return rest;
86
- }
87
- function compute_slots(slots) {
88
- const result = {};
89
- for (const key in slots) {
90
- result[key] = true;
91
- }
92
- return result;
93
- }
94
- function append(target, node) {
95
- target.appendChild(node);
96
- }
97
- function append_styles(target, style_sheet_id, styles) {
98
- const append_styles_to = get_root_for_style(target);
99
- if (!append_styles_to.getElementById(style_sheet_id)) {
100
- const style = element('style');
101
- style.id = style_sheet_id;
102
- style.textContent = styles;
103
- append_stylesheet(append_styles_to, style);
104
- }
105
- }
106
- function get_root_for_style(node) {
107
- if (!node)
108
- return document;
109
- const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
110
- if (root && root.host) {
111
- return root;
112
- }
113
- return node.ownerDocument;
114
- }
115
- function append_stylesheet(node, style) {
116
- append(node.head || node, style);
117
- return style.sheet;
118
- }
119
- function insert(target, node, anchor) {
120
- target.insertBefore(node, anchor || null);
121
- }
122
- function detach(node) {
123
- if (node.parentNode) {
124
- node.parentNode.removeChild(node);
125
- }
126
- }
127
- function destroy_each(iterations, detaching) {
128
- for (let i = 0; i < iterations.length; i += 1) {
129
- if (iterations[i])
130
- iterations[i].d(detaching);
131
- }
132
- }
133
- function element(name) {
134
- return document.createElement(name);
135
- }
136
- function svg_element(name) {
137
- return document.createElementNS('http://www.w3.org/2000/svg', name);
138
- }
139
- function text(data) {
140
- return document.createTextNode(data);
141
- }
142
- function space() {
143
- return text(' ');
144
- }
145
- function empty() {
146
- return text('');
147
- }
148
- function listen(node, event, handler, options) {
149
- node.addEventListener(event, handler, options);
150
- return () => node.removeEventListener(event, handler, options);
151
- }
152
- function prevent_default(fn) {
153
- return function (event) {
154
- event.preventDefault();
155
- // @ts-ignore
156
- return fn.call(this, event);
157
- };
158
- }
159
- function attr(node, attribute, value) {
160
- if (value == null)
161
- node.removeAttribute(attribute);
162
- else if (node.getAttribute(attribute) !== value)
163
- node.setAttribute(attribute, value);
164
- }
165
- /**
166
- * List of attributes that should always be set through the attr method,
167
- * because updating them through the property setter doesn't work reliably.
168
- * In the example of `width`/`height`, the problem is that the setter only
169
- * accepts numeric values, but the attribute can also be set to a string like `50%`.
170
- * If this list becomes too big, rethink this approach.
171
- */
172
- const always_set_through_set_attribute = ['width', 'height'];
173
- function set_attributes(node, attributes) {
174
- // @ts-ignore
175
- const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);
176
- for (const key in attributes) {
177
- if (attributes[key] == null) {
178
- node.removeAttribute(key);
179
- }
180
- else if (key === 'style') {
181
- node.style.cssText = attributes[key];
182
- }
183
- else if (key === '__value') {
184
- node.value = node[key] = attributes[key];
185
- }
186
- else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {
187
- node[key] = attributes[key];
188
- }
189
- else {
190
- attr(node, key, attributes[key]);
191
- }
192
- }
193
- }
194
- function children(element) {
195
- return Array.from(element.childNodes);
196
- }
197
- function set_data(text, data) {
198
- data = '' + data;
199
- if (text.data === data)
200
- return;
201
- text.data = data;
202
- }
203
- function set_input_value(input, value) {
204
- input.value = value == null ? '' : value;
205
- }
206
- function toggle_class(element, name, toggle) {
207
- element.classList[toggle ? 'add' : 'remove'](name);
208
- }
209
- function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
210
- const e = document.createEvent('CustomEvent');
211
- e.initCustomEvent(type, bubbles, cancelable, detail);
212
- return e;
213
- }
214
- class HtmlTag {
215
- constructor(is_svg = false) {
216
- this.is_svg = false;
217
- this.is_svg = is_svg;
218
- this.e = this.n = null;
219
- }
220
- c(html) {
221
- this.h(html);
222
- }
223
- m(html, target, anchor = null) {
224
- if (!this.e) {
225
- if (this.is_svg)
226
- this.e = svg_element(target.nodeName);
227
- /** #7364 target for <template> may be provided as #document-fragment(11) */
228
- else
229
- this.e = element((target.nodeType === 11 ? 'TEMPLATE' : target.nodeName));
230
- this.t = target.tagName !== 'TEMPLATE' ? target : target.content;
231
- this.c(html);
232
- }
233
- this.i(anchor);
234
- }
235
- h(html) {
236
- this.e.innerHTML = html;
237
- this.n = Array.from(this.e.nodeName === 'TEMPLATE' ? this.e.content.childNodes : this.e.childNodes);
238
- }
239
- i(anchor) {
240
- for (let i = 0; i < this.n.length; i += 1) {
241
- insert(this.t, this.n[i], anchor);
242
- }
243
- }
244
- p(html) {
245
- this.d();
246
- this.h(html);
247
- this.i(this.a);
248
- }
249
- d() {
250
- this.n.forEach(detach);
251
- }
252
- }
253
-
254
- let current_component;
255
- function set_current_component(component) {
256
- current_component = component;
257
- }
258
- function get_current_component() {
259
- if (!current_component)
260
- throw new Error('Function called outside component initialization');
261
- return current_component;
262
- }
263
- /**
264
- * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.
265
- * It must be called during the component's initialisation (but doesn't need to live *inside* the component;
266
- * it can be called from an external module).
267
- *
268
- * `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).
269
- *
270
- * https://svelte.dev/docs#run-time-svelte-onmount
271
- */
272
- function onMount(fn) {
273
- get_current_component().$$.on_mount.push(fn);
274
- }
275
- /**
276
- * Schedules a callback to run immediately after the component has been updated.
277
- *
278
- * The first time the callback runs will be after the initial `onMount`
279
- */
280
- function afterUpdate(fn) {
281
- get_current_component().$$.after_update.push(fn);
282
- }
283
- /**
284
- * Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).
285
- * Event dispatchers are functions that can take two arguments: `name` and `detail`.
286
- *
287
- * Component events created with `createEventDispatcher` create a
288
- * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).
289
- * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).
290
- * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)
291
- * property and can contain any type of data.
292
- *
293
- * https://svelte.dev/docs#run-time-svelte-createeventdispatcher
294
- */
295
- function createEventDispatcher() {
296
- const component = get_current_component();
297
- return (type, detail, { cancelable = false } = {}) => {
298
- const callbacks = component.$$.callbacks[type];
299
- if (callbacks) {
300
- // TODO are there situations where events could be dispatched
301
- // in a server (non-DOM) environment?
302
- const event = custom_event(type, detail, { cancelable });
303
- callbacks.slice().forEach(fn => {
304
- fn.call(component, event);
305
- });
306
- return !event.defaultPrevented;
307
- }
308
- return true;
309
- };
310
- }
311
- // TODO figure out if we still want to support
312
- // shorthand events, or if we want to implement
313
- // a real bubbling mechanism
314
- function bubble(component, event) {
315
- const callbacks = component.$$.callbacks[event.type];
316
- if (callbacks) {
317
- // @ts-ignore
318
- callbacks.slice().forEach(fn => fn.call(this, event));
319
- }
320
- }
321
-
322
- const dirty_components = [];
323
- const binding_callbacks = [];
324
- let render_callbacks = [];
325
- const flush_callbacks = [];
326
- const resolved_promise = /* @__PURE__ */ Promise.resolve();
327
- let update_scheduled = false;
328
- function schedule_update() {
329
- if (!update_scheduled) {
330
- update_scheduled = true;
331
- resolved_promise.then(flush);
332
- }
333
- }
334
- function tick() {
335
- schedule_update();
336
- return resolved_promise;
337
- }
338
- function add_render_callback(fn) {
339
- render_callbacks.push(fn);
340
- }
341
- function add_flush_callback(fn) {
342
- flush_callbacks.push(fn);
343
- }
344
- // flush() calls callbacks in this order:
345
- // 1. All beforeUpdate callbacks, in order: parents before children
346
- // 2. All bind:this callbacks, in reverse order: children before parents.
347
- // 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
348
- // for afterUpdates called during the initial onMount, which are called in
349
- // reverse order: children before parents.
350
- // Since callbacks might update component values, which could trigger another
351
- // call to flush(), the following steps guard against this:
352
- // 1. During beforeUpdate, any updated components will be added to the
353
- // dirty_components array and will cause a reentrant call to flush(). Because
354
- // the flush index is kept outside the function, the reentrant call will pick
355
- // up where the earlier call left off and go through all dirty components. The
356
- // current_component value is saved and restored so that the reentrant call will
357
- // not interfere with the "parent" flush() call.
358
- // 2. bind:this callbacks cannot trigger new flush() calls.
359
- // 3. During afterUpdate, any updated components will NOT have their afterUpdate
360
- // callback called a second time; the seen_callbacks set, outside the flush()
361
- // function, guarantees this behavior.
362
- const seen_callbacks = new Set();
363
- let flushidx = 0; // Do *not* move this inside the flush() function
364
- function flush() {
365
- // Do not reenter flush while dirty components are updated, as this can
366
- // result in an infinite loop. Instead, let the inner flush handle it.
367
- // Reentrancy is ok afterwards for bindings etc.
368
- if (flushidx !== 0) {
369
- return;
370
- }
371
- const saved_component = current_component;
372
- do {
373
- // first, call beforeUpdate functions
374
- // and update components
375
- try {
376
- while (flushidx < dirty_components.length) {
377
- const component = dirty_components[flushidx];
378
- flushidx++;
379
- set_current_component(component);
380
- update(component.$$);
381
- }
382
- }
383
- catch (e) {
384
- // reset dirty state to not end up in a deadlocked state and then rethrow
385
- dirty_components.length = 0;
386
- flushidx = 0;
387
- throw e;
388
- }
389
- set_current_component(null);
390
- dirty_components.length = 0;
391
- flushidx = 0;
392
- while (binding_callbacks.length)
393
- binding_callbacks.pop()();
394
- // then, once components are updated, call
395
- // afterUpdate functions. This may cause
396
- // subsequent updates...
397
- for (let i = 0; i < render_callbacks.length; i += 1) {
398
- const callback = render_callbacks[i];
399
- if (!seen_callbacks.has(callback)) {
400
- // ...so guard against infinite loops
401
- seen_callbacks.add(callback);
402
- callback();
403
- }
404
- }
405
- render_callbacks.length = 0;
406
- } while (dirty_components.length);
407
- while (flush_callbacks.length) {
408
- flush_callbacks.pop()();
409
- }
410
- update_scheduled = false;
411
- seen_callbacks.clear();
412
- set_current_component(saved_component);
413
- }
414
- function update($$) {
415
- if ($$.fragment !== null) {
416
- $$.update();
417
- run_all($$.before_update);
418
- const dirty = $$.dirty;
419
- $$.dirty = [-1];
420
- $$.fragment && $$.fragment.p($$.ctx, dirty);
421
- $$.after_update.forEach(add_render_callback);
422
- }
423
- }
424
- /**
425
- * Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
426
- */
427
- function flush_render_callbacks(fns) {
428
- const filtered = [];
429
- const targets = [];
430
- render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
431
- targets.forEach((c) => c());
432
- render_callbacks = filtered;
433
- }
434
- const outroing = new Set();
435
- let outros;
436
- function group_outros() {
437
- outros = {
438
- r: 0,
439
- c: [],
440
- p: outros // parent group
441
- };
442
- }
443
- function check_outros() {
444
- if (!outros.r) {
445
- run_all(outros.c);
446
- }
447
- outros = outros.p;
448
- }
449
- function transition_in(block, local) {
450
- if (block && block.i) {
451
- outroing.delete(block);
452
- block.i(local);
453
- }
454
- }
455
- function transition_out(block, local, detach, callback) {
456
- if (block && block.o) {
457
- if (outroing.has(block))
458
- return;
459
- outroing.add(block);
460
- outros.c.push(() => {
461
- outroing.delete(block);
462
- if (callback) {
463
- if (detach)
464
- block.d(1);
465
- callback();
466
- }
467
- });
468
- block.o(local);
469
- }
470
- else if (callback) {
471
- callback();
472
- }
473
- }
474
-
475
- function get_spread_update(levels, updates) {
476
- const update = {};
477
- const to_null_out = {};
478
- const accounted_for = { $$scope: 1 };
479
- let i = levels.length;
480
- while (i--) {
481
- const o = levels[i];
482
- const n = updates[i];
483
- if (n) {
484
- for (const key in o) {
485
- if (!(key in n))
486
- to_null_out[key] = 1;
487
- }
488
- for (const key in n) {
489
- if (!accounted_for[key]) {
490
- update[key] = n[key];
491
- accounted_for[key] = 1;
492
- }
493
- }
494
- levels[i] = n;
495
- }
496
- else {
497
- for (const key in o) {
498
- accounted_for[key] = 1;
499
- }
500
- }
501
- }
502
- for (const key in to_null_out) {
503
- if (!(key in update))
504
- update[key] = undefined;
505
- }
506
- return update;
507
- }
508
- function get_spread_object(spread_props) {
509
- return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};
510
- }
511
-
512
- function bind(component, name, callback) {
513
- const index = component.$$.props[name];
514
- if (index !== undefined) {
515
- component.$$.bound[index] = callback;
516
- callback(component.$$.ctx[index]);
517
- }
518
- }
519
- function create_component(block) {
520
- block && block.c();
521
- }
522
- function mount_component(component, target, anchor, customElement) {
523
- const { fragment, after_update } = component.$$;
524
- fragment && fragment.m(target, anchor);
525
- if (!customElement) {
526
- // onMount happens before the initial afterUpdate
527
- add_render_callback(() => {
528
- const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
529
- // if the component was destroyed immediately
530
- // it will update the `$$.on_destroy` reference to `null`.
531
- // the destructured on_destroy may still reference to the old array
532
- if (component.$$.on_destroy) {
533
- component.$$.on_destroy.push(...new_on_destroy);
534
- }
535
- else {
536
- // Edge case - component was destroyed immediately,
537
- // most likely as a result of a binding initialising
538
- run_all(new_on_destroy);
539
- }
540
- component.$$.on_mount = [];
541
- });
542
- }
543
- after_update.forEach(add_render_callback);
544
- }
545
- function destroy_component(component, detaching) {
546
- const $$ = component.$$;
547
- if ($$.fragment !== null) {
548
- flush_render_callbacks($$.after_update);
549
- run_all($$.on_destroy);
550
- $$.fragment && $$.fragment.d(detaching);
551
- // TODO null out other refs, including component.$$ (but need to
552
- // preserve final state?)
553
- $$.on_destroy = $$.fragment = null;
554
- $$.ctx = [];
555
- }
556
- }
557
- function make_dirty(component, i) {
558
- if (component.$$.dirty[0] === -1) {
559
- dirty_components.push(component);
560
- schedule_update();
561
- component.$$.dirty.fill(0);
562
- }
563
- component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
564
- }
565
- function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
566
- const parent_component = current_component;
567
- set_current_component(component);
568
- const $$ = component.$$ = {
569
- fragment: null,
570
- ctx: [],
571
- // state
572
- props,
573
- update: noop,
574
- not_equal,
575
- bound: blank_object(),
576
- // lifecycle
577
- on_mount: [],
578
- on_destroy: [],
579
- on_disconnect: [],
580
- before_update: [],
581
- after_update: [],
582
- context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
583
- // everything else
584
- callbacks: blank_object(),
585
- dirty,
586
- skip_bound: false,
587
- root: options.target || parent_component.$$.root
588
- };
589
- append_styles && append_styles($$.root);
590
- let ready = false;
591
- $$.ctx = instance
592
- ? instance(component, options.props || {}, (i, ret, ...rest) => {
593
- const value = rest.length ? rest[0] : ret;
594
- if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
595
- if (!$$.skip_bound && $$.bound[i])
596
- $$.bound[i](value);
597
- if (ready)
598
- make_dirty(component, i);
599
- }
600
- return ret;
601
- })
602
- : [];
603
- $$.update();
604
- ready = true;
605
- run_all($$.before_update);
606
- // `false` as a special case of no DOM component
607
- $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
608
- if (options.target) {
609
- if (options.hydrate) {
610
- const nodes = children(options.target);
611
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
612
- $$.fragment && $$.fragment.l(nodes);
613
- nodes.forEach(detach);
614
- }
615
- else {
616
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
617
- $$.fragment && $$.fragment.c();
618
- }
619
- if (options.intro)
620
- transition_in(component.$$.fragment);
621
- mount_component(component, options.target, options.anchor, options.customElement);
622
- flush();
623
- }
624
- set_current_component(parent_component);
625
- }
626
- /**
627
- * Base class for Svelte components. Used when dev=false.
628
- */
629
- class SvelteComponent {
630
- $destroy() {
631
- destroy_component(this, 1);
632
- this.$destroy = noop;
633
- }
634
- $on(type, callback) {
635
- if (!is_function(callback)) {
636
- return noop;
637
- }
638
- const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
639
- callbacks.push(callback);
640
- return () => {
641
- const index = callbacks.indexOf(callback);
642
- if (index !== -1)
643
- callbacks.splice(index, 1);
644
- };
645
- }
646
- $set($$props) {
647
- if (this.$$set && !is_empty($$props)) {
648
- this.$$.skip_bound = true;
649
- this.$$set($$props);
650
- this.$$.skip_bound = false;
651
- }
652
- }
653
- }
654
-
655
- var fuzzy$1 = {exports: {}};
656
-
657
- /*
658
- * Fuzzy
659
- * https://github.com/myork/fuzzy
660
- *
661
- * Copyright (c) 2012 Matt York
662
- * Licensed under the MIT license.
663
- */
664
-
665
- (function (module, exports) {
666
- (function() {
667
-
668
- var fuzzy = {};
669
-
670
- // Use in node or in browser
671
- {
672
- module.exports = fuzzy;
673
- }
674
-
675
- // Return all elements of `array` that have a fuzzy
676
- // match against `pattern`.
677
- fuzzy.simpleFilter = function(pattern, array) {
678
- return array.filter(function(str) {
679
- return fuzzy.test(pattern, str);
680
- });
681
- };
682
-
683
- // Does `pattern` fuzzy match `str`?
684
- fuzzy.test = function(pattern, str) {
685
- return fuzzy.match(pattern, str) !== null;
686
- };
687
-
688
- // If `pattern` matches `str`, wrap each matching character
689
- // in `opts.pre` and `opts.post`. If no match, return null
690
- fuzzy.match = function(pattern, str, opts) {
691
- opts = opts || {};
692
- var patternIdx = 0
693
- , result = []
694
- , len = str.length
695
- , totalScore = 0
696
- , currScore = 0
697
- // prefix
698
- , pre = opts.pre || ''
699
- // suffix
700
- , post = opts.post || ''
701
- // String to compare against. This might be a lowercase version of the
702
- // raw string
703
- , compareString = opts.caseSensitive && str || str.toLowerCase()
704
- , ch;
705
-
706
- pattern = opts.caseSensitive && pattern || pattern.toLowerCase();
707
-
708
- // For each character in the string, either add it to the result
709
- // or wrap in template if it's the next string in the pattern
710
- for(var idx = 0; idx < len; idx++) {
711
- ch = str[idx];
712
- if(compareString[idx] === pattern[patternIdx]) {
713
- ch = pre + ch + post;
714
- patternIdx += 1;
715
-
716
- // consecutive characters should increase the score more than linearly
717
- currScore += 1 + currScore;
718
- } else {
719
- currScore = 0;
720
- }
721
- totalScore += currScore;
722
- result[result.length] = ch;
723
- }
724
-
725
- // return rendered string if we have a match for every char
726
- if(patternIdx === pattern.length) {
727
- // if the string is an exact match with pattern, totalScore should be maxed
728
- totalScore = (compareString === pattern) ? Infinity : totalScore;
729
- return {rendered: result.join(''), score: totalScore};
730
- }
731
-
732
- return null;
733
- };
734
-
735
- // The normal entry point. Filters `arr` for matches against `pattern`.
736
- // It returns an array with matching values of the type:
737
- //
738
- // [{
739
- // string: '<b>lah' // The rendered string
740
- // , index: 2 // The index of the element in `arr`
741
- // , original: 'blah' // The original element in `arr`
742
- // }]
743
- //
744
- // `opts` is an optional argument bag. Details:
745
- //
746
- // opts = {
747
- // // string to put before a matching character
748
- // pre: '<b>'
749
- //
750
- // // string to put after matching character
751
- // , post: '</b>'
752
- //
753
- // // Optional function. Input is an entry in the given arr`,
754
- // // output should be the string to test `pattern` against.
755
- // // In this example, if `arr = [{crying: 'koala'}]` we would return
756
- // // 'koala'.
757
- // , extract: function(arg) { return arg.crying; }
758
- // }
759
- fuzzy.filter = function(pattern, arr, opts) {
760
- if(!arr || arr.length === 0) {
761
- return [];
762
- }
763
- if (typeof pattern !== 'string') {
764
- return arr;
765
- }
766
- opts = opts || {};
767
- return arr
768
- .reduce(function(prev, element, idx, arr) {
769
- var str = element;
770
- if(opts.extract) {
771
- str = opts.extract(element);
772
- }
773
- var rendered = fuzzy.match(pattern, str, opts);
774
- if(rendered != null) {
775
- prev[prev.length] = {
776
- string: rendered.rendered
777
- , score: rendered.score
778
- , index: idx
779
- , original: element
780
- };
781
- }
782
- return prev;
783
- }, [])
784
-
785
- // Sort by score. Browsers are inconsistent wrt stable/unstable
786
- // sorting, so force stable by using the index in the case of tie.
787
- // See http://ofb.net/~sethml/is-sort-stable.html
788
- .sort(function(a,b) {
789
- var compare = b.score - a.score;
790
- if(compare) return compare;
791
- return a.index - b.index;
792
- });
793
- };
794
-
795
-
796
- }());
797
- }(fuzzy$1));
798
-
799
- var fuzzy = fuzzy$1.exports;
800
-
801
- /* node_modules/svelte-search/src/Search.svelte generated by Svelte v3.59.2 */
802
- const get_label_slot_changes = dirty => ({});
803
- const get_label_slot_context = ctx => ({});
804
-
805
- // (94:23) {label}
806
- function fallback_block$1(ctx) {
807
- let t;
808
-
809
- return {
810
- c() {
811
- t = text(/*label*/ ctx[2]);
812
- },
813
- m(target, anchor) {
814
- insert(target, t, anchor);
815
- },
816
- p(ctx, dirty) {
817
- if (dirty & /*label*/ 4) set_data(t, /*label*/ ctx[2]);
818
- },
819
- d(detaching) {
820
- if (detaching) detach(t);
821
- }
822
- };
823
- }
824
-
825
- function create_fragment$1(ctx) {
826
- let form;
827
- let label_1;
828
- let label_1_id_value;
829
- let label_1_style_value;
830
- let t;
831
- let input;
832
- let form_role_value;
833
- let form_aria_labelledby_value;
834
- let current;
835
- let mounted;
836
- let dispose;
837
- const label_slot_template = /*#slots*/ ctx[10].label;
838
- const label_slot = create_slot(label_slot_template, ctx, /*$$scope*/ ctx[9], get_label_slot_context);
839
- const label_slot_or_fallback = label_slot || fallback_block$1(ctx);
840
-
841
- let input_levels = [
842
- { name: "search" },
843
- { type: "search" },
844
- { placeholder: "Search..." },
845
- { autocomplete: "off" },
846
- { spellcheck: "false" },
847
- /*$$restProps*/ ctx[6],
848
- { id: /*id*/ ctx[4] }
849
- ];
850
-
851
- let input_data = {};
852
-
853
- for (let i = 0; i < input_levels.length; i += 1) {
854
- input_data = assign(input_data, input_levels[i]);
855
- }
856
-
857
- return {
858
- c() {
859
- form = element("form");
860
- label_1 = element("label");
861
- if (label_slot_or_fallback) label_slot_or_fallback.c();
862
- t = space();
863
- input = element("input");
864
- attr(label_1, "id", label_1_id_value = "" + (/*id*/ ctx[4] + "-label"));
865
- attr(label_1, "for", /*id*/ ctx[4]);
866
- attr(label_1, "style", label_1_style_value = /*hideLabel*/ ctx[3] && "position: absolute;height: 1px;width: 1px;overflow: hidden;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);white-space: nowrap;");
867
- set_attributes(input, input_data);
868
- attr(form, "data-svelte-search", "");
869
- attr(form, "role", form_role_value = /*removeFormAriaAttributes*/ ctx[5] ? null : "search");
870
-
871
- attr(form, "aria-labelledby", form_aria_labelledby_value = /*removeFormAriaAttributes*/ ctx[5]
872
- ? null
873
- : /*id*/ ctx[4]);
874
-
875
- attr(form, "action", "");
876
- },
877
- m(target, anchor) {
878
- insert(target, form, anchor);
879
- append(form, label_1);
880
-
881
- if (label_slot_or_fallback) {
882
- label_slot_or_fallback.m(label_1, null);
883
- }
884
-
885
- append(form, t);
886
- append(form, input);
887
- if (input.autofocus) input.focus();
888
- /*input_binding*/ ctx[17](input);
889
- set_input_value(input, /*value*/ ctx[0]);
890
- current = true;
891
-
892
- if (!mounted) {
893
- dispose = [
894
- listen(input, "input", /*input_input_handler*/ ctx[18]),
895
- listen(input, "input", /*input_handler*/ ctx[12]),
896
- listen(input, "change", /*change_handler*/ ctx[13]),
897
- listen(input, "focus", /*focus_handler*/ ctx[14]),
898
- listen(input, "blur", /*blur_handler*/ ctx[15]),
899
- listen(input, "keydown", /*keydown_handler*/ ctx[16]),
900
- listen(form, "submit", prevent_default(/*submit_handler*/ ctx[11]))
901
- ];
902
-
903
- mounted = true;
904
- }
905
- },
906
- p(ctx, [dirty]) {
907
- if (label_slot) {
908
- if (label_slot.p && (!current || dirty & /*$$scope*/ 512)) {
909
- update_slot_base(
910
- label_slot,
911
- label_slot_template,
912
- ctx,
913
- /*$$scope*/ ctx[9],
914
- !current
915
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[9])
916
- : get_slot_changes(label_slot_template, /*$$scope*/ ctx[9], dirty, get_label_slot_changes),
917
- get_label_slot_context
918
- );
919
- }
920
- } else {
921
- if (label_slot_or_fallback && label_slot_or_fallback.p && (!current || dirty & /*label*/ 4)) {
922
- label_slot_or_fallback.p(ctx, !current ? -1 : dirty);
923
- }
924
- }
925
-
926
- if (!current || dirty & /*id*/ 16 && label_1_id_value !== (label_1_id_value = "" + (/*id*/ ctx[4] + "-label"))) {
927
- attr(label_1, "id", label_1_id_value);
928
- }
929
-
930
- if (!current || dirty & /*id*/ 16) {
931
- attr(label_1, "for", /*id*/ ctx[4]);
932
- }
933
-
934
- if (!current || dirty & /*hideLabel*/ 8 && label_1_style_value !== (label_1_style_value = /*hideLabel*/ ctx[3] && "position: absolute;height: 1px;width: 1px;overflow: hidden;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);white-space: nowrap;")) {
935
- attr(label_1, "style", label_1_style_value);
936
- }
937
-
938
- set_attributes(input, input_data = get_spread_update(input_levels, [
939
- { name: "search" },
940
- { type: "search" },
941
- { placeholder: "Search..." },
942
- { autocomplete: "off" },
943
- { spellcheck: "false" },
944
- dirty & /*$$restProps*/ 64 && /*$$restProps*/ ctx[6],
945
- (!current || dirty & /*id*/ 16) && { id: /*id*/ ctx[4] }
946
- ]));
947
-
948
- if (dirty & /*value*/ 1 && input.value !== /*value*/ ctx[0]) {
949
- set_input_value(input, /*value*/ ctx[0]);
950
- }
951
-
952
- if (!current || dirty & /*removeFormAriaAttributes*/ 32 && form_role_value !== (form_role_value = /*removeFormAriaAttributes*/ ctx[5] ? null : "search")) {
953
- attr(form, "role", form_role_value);
954
- }
955
-
956
- if (!current || dirty & /*removeFormAriaAttributes, id*/ 48 && form_aria_labelledby_value !== (form_aria_labelledby_value = /*removeFormAriaAttributes*/ ctx[5]
957
- ? null
958
- : /*id*/ ctx[4])) {
959
- attr(form, "aria-labelledby", form_aria_labelledby_value);
960
- }
961
- },
962
- i(local) {
963
- if (current) return;
964
- transition_in(label_slot_or_fallback, local);
965
- current = true;
966
- },
967
- o(local) {
968
- transition_out(label_slot_or_fallback, local);
969
- current = false;
970
- },
971
- d(detaching) {
972
- if (detaching) detach(form);
973
- if (label_slot_or_fallback) label_slot_or_fallback.d(detaching);
974
- /*input_binding*/ ctx[17](null);
975
- mounted = false;
976
- run_all(dispose);
977
- }
978
- };
979
- }
980
-
981
- function instance$1($$self, $$props, $$invalidate) {
982
- const omit_props_names = [
983
- "value","autofocus","debounce","label","hideLabel","id","ref","removeFormAriaAttributes"
984
- ];
985
-
986
- let $$restProps = compute_rest_props($$props, omit_props_names);
987
- let { $$slots: slots = {}, $$scope } = $$props;
988
- let { value = "" } = $$props;
989
- let { autofocus = false } = $$props;
990
- let { debounce = 0 } = $$props;
991
- let { label = "Label" } = $$props;
992
- let { hideLabel = false } = $$props;
993
- let { id = "search" + Math.random().toString(36) } = $$props;
994
- let { ref = null } = $$props;
995
- let { removeFormAriaAttributes = false } = $$props;
996
- const dispatch = createEventDispatcher();
997
- let prevValue = value;
998
- let timeout = undefined;
999
- let calling = false;
1000
-
1001
- /** @type {() => any;} */
1002
- function debounceFn(fn) {
1003
- if (calling) return;
1004
- calling = true;
1005
-
1006
- timeout = setTimeout(
1007
- () => {
1008
- fn();
1009
- calling = false;
1010
- },
1011
- debounce
1012
- );
1013
- }
1014
-
1015
- onMount(() => {
1016
- if (autofocus) window.requestAnimationFrame(() => ref.focus());
1017
- return () => clearTimeout(timeout);
1018
- });
1019
-
1020
- afterUpdate(() => {
1021
- if (value.length > 0 && value !== prevValue) {
1022
- if (debounce > 0) {
1023
- debounceFn(() => dispatch("type", value));
1024
- } else {
1025
- dispatch("type", value);
1026
- }
1027
- }
1028
-
1029
- if (value.length === 0 && prevValue.length > 0) dispatch("clear");
1030
- prevValue = value;
1031
- });
1032
-
1033
- function submit_handler(event) {
1034
- bubble.call(this, $$self, event);
1035
- }
1036
-
1037
- function input_handler(event) {
1038
- bubble.call(this, $$self, event);
1039
- }
1040
-
1041
- function change_handler(event) {
1042
- bubble.call(this, $$self, event);
1043
- }
1044
-
1045
- function focus_handler(event) {
1046
- bubble.call(this, $$self, event);
1047
- }
1048
-
1049
- function blur_handler(event) {
1050
- bubble.call(this, $$self, event);
1051
- }
1052
-
1053
- function keydown_handler(event) {
1054
- bubble.call(this, $$self, event);
1055
- }
1056
-
1057
- function input_binding($$value) {
1058
- binding_callbacks[$$value ? 'unshift' : 'push'](() => {
1059
- ref = $$value;
1060
- $$invalidate(1, ref);
1061
- });
1062
- }
1063
-
1064
- function input_input_handler() {
1065
- value = this.value;
1066
- $$invalidate(0, value);
1067
- }
1068
-
1069
- $$self.$$set = $$new_props => {
1070
- $$props = assign(assign({}, $$props), exclude_internal_props($$new_props));
1071
- $$invalidate(6, $$restProps = compute_rest_props($$props, omit_props_names));
1072
- if ('value' in $$new_props) $$invalidate(0, value = $$new_props.value);
1073
- if ('autofocus' in $$new_props) $$invalidate(7, autofocus = $$new_props.autofocus);
1074
- if ('debounce' in $$new_props) $$invalidate(8, debounce = $$new_props.debounce);
1075
- if ('label' in $$new_props) $$invalidate(2, label = $$new_props.label);
1076
- if ('hideLabel' in $$new_props) $$invalidate(3, hideLabel = $$new_props.hideLabel);
1077
- if ('id' in $$new_props) $$invalidate(4, id = $$new_props.id);
1078
- if ('ref' in $$new_props) $$invalidate(1, ref = $$new_props.ref);
1079
- if ('removeFormAriaAttributes' in $$new_props) $$invalidate(5, removeFormAriaAttributes = $$new_props.removeFormAriaAttributes);
1080
- if ('$$scope' in $$new_props) $$invalidate(9, $$scope = $$new_props.$$scope);
1081
- };
1082
-
1083
- return [
1084
- value,
1085
- ref,
1086
- label,
1087
- hideLabel,
1088
- id,
1089
- removeFormAriaAttributes,
1090
- $$restProps,
1091
- autofocus,
1092
- debounce,
1093
- $$scope,
1094
- slots,
1095
- submit_handler,
1096
- input_handler,
1097
- change_handler,
1098
- focus_handler,
1099
- blur_handler,
1100
- keydown_handler,
1101
- input_binding,
1102
- input_input_handler
1103
- ];
1104
- }
1105
-
1106
- class Search extends SvelteComponent {
1107
- constructor(options) {
1108
- super();
1109
-
1110
- init(this, options, instance$1, create_fragment$1, safe_not_equal, {
1111
- value: 0,
1112
- autofocus: 7,
1113
- debounce: 8,
1114
- label: 2,
1115
- hideLabel: 3,
1116
- id: 4,
1117
- ref: 1,
1118
- removeFormAriaAttributes: 5
1119
- });
1120
- }
1121
- }
1122
-
1123
- /* src/Typeahead.svelte generated by Svelte v3.59.2 */
1124
-
1125
- function add_css(target) {
1126
- append_styles(target, "svelte-1t4elht", "[data-svelte-typeahead].svelte-1t4elht.svelte-1t4elht{position:relative;background-color:#fff}ul.svelte-1t4elht.svelte-1t4elht{position:absolute;top:100%;left:0;width:100%;margin:0;padding:0;list-style:none;background-color:inherit;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1)}[aria-expanded=\"true\"].svelte-1t4elht ul.svelte-1t4elht{z-index:1}li.svelte-1t4elht.svelte-1t4elht,.no-results.svelte-1t4elht.svelte-1t4elht{padding:0.25rem 1rem}li.svelte-1t4elht.svelte-1t4elht{cursor:pointer}li.svelte-1t4elht.svelte-1t4elht:not(:last-of-type){border-bottom:1px solid #e0e0e0}li.svelte-1t4elht.svelte-1t4elht:hover{background-color:#e5e5e5}.selected.svelte-1t4elht.svelte-1t4elht{background-color:#e5e5e5}.selected.svelte-1t4elht.svelte-1t4elht:hover{background-color:#cacaca}.disabled.svelte-1t4elht.svelte-1t4elht{opacity:0.4;cursor:not-allowed}[data-svelte-search] label{margin-bottom:0.25rem;display:inline-flex;font-size:0.875rem}[data-svelte-search] input{width:100%;padding:0.5rem 0.75rem;background:none;font-size:1rem;border:0;border-radius:0;border:1px solid #e5e5e5}[data-svelte-search] input:focus{outline-color:#0f62fe;outline-offset:2px;outline-width:1px}");
1127
- }
1128
-
1129
- const get_no_results_slot_changes = dirty => ({
1130
- value: dirty[0] & /*value*/ 1,
1131
- result: dirty[0] & /*results*/ 2
1132
- });
1133
-
1134
- const get_no_results_slot_context = ctx => ({
1135
- value: /*value*/ ctx[0],
1136
- result: /*result*/ ctx[47],
1137
- index: /*index*/ ctx[49]
1138
- });
1139
-
1140
- function get_each_context(ctx, list, i) {
1141
- const child_ctx = ctx.slice();
1142
- child_ctx[47] = list[i];
1143
- child_ctx[49] = i;
1144
- return child_ctx;
1145
- }
1146
-
1147
- const get_default_slot_changes = dirty => ({
1148
- result: dirty[0] & /*results*/ 2,
1149
- value: dirty[0] & /*value*/ 1
1150
- });
1151
-
1152
- const get_default_slot_context = ctx => ({
1153
- result: /*result*/ ctx[47],
1154
- index: /*index*/ ctx[49],
1155
- value: /*value*/ ctx[0]
1156
- });
1157
-
1158
- // (247:4) {#if showResults}
1159
- function create_if_block_1(ctx) {
1160
- let each_1_anchor;
1161
- let current;
1162
- let each_value = /*results*/ ctx[1];
1163
- let each_blocks = [];
1164
-
1165
- for (let i = 0; i < each_value.length; i += 1) {
1166
- each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
1167
- }
1168
-
1169
- const out = i => transition_out(each_blocks[i], 1, 1, () => {
1170
- each_blocks[i] = null;
1171
- });
1172
-
1173
- return {
1174
- c() {
1175
- for (let i = 0; i < each_blocks.length; i += 1) {
1176
- each_blocks[i].c();
1177
- }
1178
-
1179
- each_1_anchor = empty();
1180
- },
1181
- m(target, anchor) {
1182
- for (let i = 0; i < each_blocks.length; i += 1) {
1183
- if (each_blocks[i]) {
1184
- each_blocks[i].m(target, anchor);
1185
- }
1186
- }
1187
-
1188
- insert(target, each_1_anchor, anchor);
1189
- current = true;
1190
- },
1191
- p(ctx, dirty) {
1192
- if (dirty[0] & /*id, selectedIndex, results, select, $$scope, value*/ 67111943) {
1193
- each_value = /*results*/ ctx[1];
1194
- let i;
1195
-
1196
- for (i = 0; i < each_value.length; i += 1) {
1197
- const child_ctx = get_each_context(ctx, each_value, i);
1198
-
1199
- if (each_blocks[i]) {
1200
- each_blocks[i].p(child_ctx, dirty);
1201
- transition_in(each_blocks[i], 1);
1202
- } else {
1203
- each_blocks[i] = create_each_block(child_ctx);
1204
- each_blocks[i].c();
1205
- transition_in(each_blocks[i], 1);
1206
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
1207
- }
1208
- }
1209
-
1210
- group_outros();
1211
-
1212
- for (i = each_value.length; i < each_blocks.length; i += 1) {
1213
- out(i);
1214
- }
1215
-
1216
- check_outros();
1217
- }
1218
- },
1219
- i(local) {
1220
- if (current) return;
1221
-
1222
- for (let i = 0; i < each_value.length; i += 1) {
1223
- transition_in(each_blocks[i]);
1224
- }
1225
-
1226
- current = true;
1227
- },
1228
- o(local) {
1229
- each_blocks = each_blocks.filter(Boolean);
1230
-
1231
- for (let i = 0; i < each_blocks.length; i += 1) {
1232
- transition_out(each_blocks[i]);
1233
- }
1234
-
1235
- current = false;
1236
- },
1237
- d(detaching) {
1238
- destroy_each(each_blocks, detaching);
1239
- if (detaching) detach(each_1_anchor);
1240
- }
1241
- };
1242
- }
1243
-
1244
- // (266:41)
1245
- function fallback_block(ctx) {
1246
- let html_tag;
1247
- let raw_value = /*result*/ ctx[47].string + "";
1248
- let html_anchor;
1249
-
1250
- return {
1251
- c() {
1252
- html_tag = new HtmlTag(false);
1253
- html_anchor = empty();
1254
- html_tag.a = html_anchor;
1255
- },
1256
- m(target, anchor) {
1257
- html_tag.m(raw_value, target, anchor);
1258
- insert(target, html_anchor, anchor);
1259
- },
1260
- p(ctx, dirty) {
1261
- if (dirty[0] & /*results*/ 2 && raw_value !== (raw_value = /*result*/ ctx[47].string + "")) html_tag.p(raw_value);
1262
- },
1263
- d(detaching) {
1264
- if (detaching) detach(html_anchor);
1265
- if (detaching) html_tag.d();
1266
- }
1267
- };
1268
- }
1269
-
1270
- // (248:6) {#each results as result, index}
1271
- function create_each_block(ctx) {
1272
- let li;
1273
- let t;
1274
- let li_id_value;
1275
- let li_aria_selected_value;
1276
- let current;
1277
- let mounted;
1278
- let dispose;
1279
- const default_slot_template = /*#slots*/ ctx[27].default;
1280
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[26], get_default_slot_context);
1281
- const default_slot_or_fallback = default_slot || fallback_block(ctx);
1282
-
1283
- function click_handler_1() {
1284
- return /*click_handler_1*/ ctx[40](/*result*/ ctx[47], /*index*/ ctx[49]);
1285
- }
1286
-
1287
- function mouseenter_handler() {
1288
- return /*mouseenter_handler*/ ctx[41](/*result*/ ctx[47], /*index*/ ctx[49]);
1289
- }
1290
-
1291
- return {
1292
- c() {
1293
- li = element("li");
1294
- if (default_slot_or_fallback) default_slot_or_fallback.c();
1295
- t = space();
1296
- attr(li, "role", "option");
1297
- attr(li, "id", li_id_value = "" + (/*id*/ ctx[2] + "-result-" + /*index*/ ctx[49]));
1298
- attr(li, "aria-selected", li_aria_selected_value = /*selectedIndex*/ ctx[10] === /*index*/ ctx[49]);
1299
- attr(li, "class", "svelte-1t4elht");
1300
- toggle_class(li, "selected", /*selectedIndex*/ ctx[10] === /*index*/ ctx[49]);
1301
- toggle_class(li, "disabled", /*result*/ ctx[47].disabled);
1302
- },
1303
- m(target, anchor) {
1304
- insert(target, li, anchor);
1305
-
1306
- if (default_slot_or_fallback) {
1307
- default_slot_or_fallback.m(li, null);
1308
- }
1309
-
1310
- append(li, t);
1311
- current = true;
1312
-
1313
- if (!mounted) {
1314
- dispose = [
1315
- listen(li, "click", click_handler_1),
1316
- listen(li, "mouseenter", mouseenter_handler)
1317
- ];
1318
-
1319
- mounted = true;
1320
- }
1321
- },
1322
- p(new_ctx, dirty) {
1323
- ctx = new_ctx;
1324
-
1325
- if (default_slot) {
1326
- if (default_slot.p && (!current || dirty[0] & /*$$scope, results, value*/ 67108867)) {
1327
- update_slot_base(
1328
- default_slot,
1329
- default_slot_template,
1330
- ctx,
1331
- /*$$scope*/ ctx[26],
1332
- !current
1333
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[26])
1334
- : get_slot_changes(default_slot_template, /*$$scope*/ ctx[26], dirty, get_default_slot_changes),
1335
- get_default_slot_context
1336
- );
1337
- }
1338
- } else {
1339
- if (default_slot_or_fallback && default_slot_or_fallback.p && (!current || dirty[0] & /*results*/ 2)) {
1340
- default_slot_or_fallback.p(ctx, !current ? [-1, -1] : dirty);
1341
- }
1342
- }
1343
-
1344
- if (!current || dirty[0] & /*id*/ 4 && li_id_value !== (li_id_value = "" + (/*id*/ ctx[2] + "-result-" + /*index*/ ctx[49]))) {
1345
- attr(li, "id", li_id_value);
1346
- }
1347
-
1348
- if (!current || dirty[0] & /*selectedIndex*/ 1024 && li_aria_selected_value !== (li_aria_selected_value = /*selectedIndex*/ ctx[10] === /*index*/ ctx[49])) {
1349
- attr(li, "aria-selected", li_aria_selected_value);
1350
- }
1351
-
1352
- if (!current || dirty[0] & /*selectedIndex*/ 1024) {
1353
- toggle_class(li, "selected", /*selectedIndex*/ ctx[10] === /*index*/ ctx[49]);
1354
- }
1355
-
1356
- if (!current || dirty[0] & /*results*/ 2) {
1357
- toggle_class(li, "disabled", /*result*/ ctx[47].disabled);
1358
- }
1359
- },
1360
- i(local) {
1361
- if (current) return;
1362
- transition_in(default_slot_or_fallback, local);
1363
- current = true;
1364
- },
1365
- o(local) {
1366
- transition_out(default_slot_or_fallback, local);
1367
- current = false;
1368
- },
1369
- d(detaching) {
1370
- if (detaching) detach(li);
1371
- if (default_slot_or_fallback) default_slot_or_fallback.d(detaching);
1372
- mounted = false;
1373
- run_all(dispose);
1374
- }
1375
- };
1376
- }
1377
-
1378
- // (272:4) {#if $$slots["no-results"] && !hideDropdown && value.length > 0 && results.length === 0}
1379
- function create_if_block(ctx) {
1380
- let div;
1381
- let current;
1382
- const no_results_slot_template = /*#slots*/ ctx[27]["no-results"];
1383
- const no_results_slot = create_slot(no_results_slot_template, ctx, /*$$scope*/ ctx[26], get_no_results_slot_context);
1384
-
1385
- return {
1386
- c() {
1387
- div = element("div");
1388
- if (no_results_slot) no_results_slot.c();
1389
- attr(div, "class", "svelte-1t4elht");
1390
- toggle_class(div, "no-results", true);
1391
- },
1392
- m(target, anchor) {
1393
- insert(target, div, anchor);
1394
-
1395
- if (no_results_slot) {
1396
- no_results_slot.m(div, null);
1397
- }
1398
-
1399
- current = true;
1400
- },
1401
- p(ctx, dirty) {
1402
- if (no_results_slot) {
1403
- if (no_results_slot.p && (!current || dirty[0] & /*$$scope, value, results*/ 67108867)) {
1404
- update_slot_base(
1405
- no_results_slot,
1406
- no_results_slot_template,
1407
- ctx,
1408
- /*$$scope*/ ctx[26],
1409
- !current
1410
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[26])
1411
- : get_slot_changes(no_results_slot_template, /*$$scope*/ ctx[26], dirty, get_no_results_slot_changes),
1412
- get_no_results_slot_context
1413
- );
1414
- }
1415
- }
1416
- },
1417
- i(local) {
1418
- if (current) return;
1419
- transition_in(no_results_slot, local);
1420
- current = true;
1421
- },
1422
- o(local) {
1423
- transition_out(no_results_slot, local);
1424
- current = false;
1425
- },
1426
- d(detaching) {
1427
- if (detaching) detach(div);
1428
- if (no_results_slot) no_results_slot.d(detaching);
1429
- }
1430
- };
1431
- }
1432
-
1433
- function create_fragment(ctx) {
1434
- let div;
1435
- let search;
1436
- let updating_ref;
1437
- let updating_value;
1438
- let t0;
1439
- let ul;
1440
- let t1;
1441
- let ul_aria_labelledby_value;
1442
- let ul_id_value;
1443
- let div_aria_controls_value;
1444
- let div_id_value;
1445
- let current;
1446
- let mounted;
1447
- let dispose;
1448
-
1449
- const search_spread_levels = [
1450
- { id: /*id*/ ctx[2] },
1451
- { removeFormAriaAttributes: true },
1452
- /*$$restProps*/ ctx[16],
1453
- { "aria-autocomplete": "list" },
1454
- {
1455
- "aria-controls": "" + (/*id*/ ctx[2] + "-listbox")
1456
- },
1457
- {
1458
- "aria-labelledby": "" + (/*id*/ ctx[2] + "-label")
1459
- },
1460
- {
1461
- "aria-activedescendant": /*selectedIndex*/ ctx[10] >= 0 && !/*hideDropdown*/ ctx[5] && /*results*/ ctx[1].length > 0
1462
- ? `${/*id*/ ctx[2]}-result-${/*selectedIndex*/ ctx[10]}`
1463
- : null
1464
- }
1465
- ];
1466
-
1467
- function search_ref_binding(value) {
1468
- /*search_ref_binding*/ ctx[29](value);
1469
- }
1470
-
1471
- function search_value_binding(value) {
1472
- /*search_value_binding*/ ctx[30](value);
1473
- }
1474
-
1475
- let search_props = {};
1476
-
1477
- for (let i = 0; i < search_spread_levels.length; i += 1) {
1478
- search_props = assign(search_props, search_spread_levels[i]);
1479
- }
1480
-
1481
- if (/*searchRef*/ ctx[9] !== void 0) {
1482
- search_props.ref = /*searchRef*/ ctx[9];
1483
- }
1484
-
1485
- if (/*value*/ ctx[0] !== void 0) {
1486
- search_props.value = /*value*/ ctx[0];
1487
- }
1488
-
1489
- search = new Search({ props: search_props });
1490
- binding_callbacks.push(() => bind(search, 'ref', search_ref_binding));
1491
- binding_callbacks.push(() => bind(search, 'value', search_value_binding));
1492
- search.$on("type", /*type_handler*/ ctx[31]);
1493
- search.$on("input", /*input_handler*/ ctx[32]);
1494
- search.$on("change", /*change_handler*/ ctx[33]);
1495
- search.$on("focus", /*focus_handler*/ ctx[34]);
1496
- search.$on("focus", /*focus_handler_1*/ ctx[35]);
1497
- search.$on("clear", /*clear_handler*/ ctx[36]);
1498
- search.$on("clear", /*open*/ ctx[13]);
1499
- search.$on("blur", /*blur_handler*/ ctx[37]);
1500
- search.$on("keydown", /*keydown_handler*/ ctx[38]);
1501
- search.$on("keydown", /*keydown_handler_1*/ ctx[39]);
1502
- let if_block0 = /*showResults*/ ctx[7] && create_if_block_1(ctx);
1503
- let if_block1 = /*$$slots*/ ctx[15]["no-results"] && !/*hideDropdown*/ ctx[5] && /*value*/ ctx[0].length > 0 && /*results*/ ctx[1].length === 0 && create_if_block(ctx);
1504
-
1505
- return {
1506
- c() {
1507
- div = element("div");
1508
- create_component(search.$$.fragment);
1509
- t0 = space();
1510
- ul = element("ul");
1511
- if (if_block0) if_block0.c();
1512
- t1 = space();
1513
- if (if_block1) if_block1.c();
1514
- attr(ul, "role", "listbox");
1515
- attr(ul, "aria-labelledby", ul_aria_labelledby_value = "" + (/*id*/ ctx[2] + "-label"));
1516
- attr(ul, "id", ul_id_value = "" + (/*id*/ ctx[2] + "-listbox"));
1517
- attr(ul, "class", "svelte-1t4elht");
1518
- toggle_class(ul, "svelte-typeahead-list", true);
1519
- attr(div, "data-svelte-typeahead", "");
1520
- attr(div, "role", "combobox");
1521
- attr(div, "aria-haspopup", "listbox");
1522
- attr(div, "aria-controls", div_aria_controls_value = "" + (/*id*/ ctx[2] + "-listbox"));
1523
- attr(div, "aria-expanded", /*showResults*/ ctx[7]);
1524
- attr(div, "id", div_id_value = "" + (/*id*/ ctx[2] + "-typeahead"));
1525
- attr(div, "class", "svelte-1t4elht");
1526
- toggle_class(div, "dropdown", /*results*/ ctx[1].length > 0);
1527
- },
1528
- m(target, anchor) {
1529
- insert(target, div, anchor);
1530
- mount_component(search, div, null);
1531
- append(div, t0);
1532
- append(div, ul);
1533
- if (if_block0) if_block0.m(ul, null);
1534
- append(ul, t1);
1535
- if (if_block1) if_block1.m(ul, null);
1536
- /*div_binding*/ ctx[42](div);
1537
- current = true;
1538
-
1539
- if (!mounted) {
1540
- dispose = listen(window, "click", /*click_handler*/ ctx[28]);
1541
- mounted = true;
1542
- }
1543
- },
1544
- p(ctx, dirty) {
1545
- const search_changes = (dirty[0] & /*id, $$restProps, selectedIndex, hideDropdown, results*/ 66598)
1546
- ? get_spread_update(search_spread_levels, [
1547
- dirty[0] & /*id*/ 4 && { id: /*id*/ ctx[2] },
1548
- search_spread_levels[1],
1549
- dirty[0] & /*$$restProps*/ 65536 && get_spread_object(/*$$restProps*/ ctx[16]),
1550
- search_spread_levels[3],
1551
- dirty[0] & /*id*/ 4 && {
1552
- "aria-controls": "" + (/*id*/ ctx[2] + "-listbox")
1553
- },
1554
- dirty[0] & /*id*/ 4 && {
1555
- "aria-labelledby": "" + (/*id*/ ctx[2] + "-label")
1556
- },
1557
- dirty[0] & /*selectedIndex, hideDropdown, results, id*/ 1062 && {
1558
- "aria-activedescendant": /*selectedIndex*/ ctx[10] >= 0 && !/*hideDropdown*/ ctx[5] && /*results*/ ctx[1].length > 0
1559
- ? `${/*id*/ ctx[2]}-result-${/*selectedIndex*/ ctx[10]}`
1560
- : null
1561
- }
1562
- ])
1563
- : {};
1564
-
1565
- if (!updating_ref && dirty[0] & /*searchRef*/ 512) {
1566
- updating_ref = true;
1567
- search_changes.ref = /*searchRef*/ ctx[9];
1568
- add_flush_callback(() => updating_ref = false);
1569
- }
1570
-
1571
- if (!updating_value && dirty[0] & /*value*/ 1) {
1572
- updating_value = true;
1573
- search_changes.value = /*value*/ ctx[0];
1574
- add_flush_callback(() => updating_value = false);
1575
- }
1576
-
1577
- search.$set(search_changes);
1578
-
1579
- if (/*showResults*/ ctx[7]) {
1580
- if (if_block0) {
1581
- if_block0.p(ctx, dirty);
1582
-
1583
- if (dirty[0] & /*showResults*/ 128) {
1584
- transition_in(if_block0, 1);
1585
- }
1586
- } else {
1587
- if_block0 = create_if_block_1(ctx);
1588
- if_block0.c();
1589
- transition_in(if_block0, 1);
1590
- if_block0.m(ul, t1);
1591
- }
1592
- } else if (if_block0) {
1593
- group_outros();
1594
-
1595
- transition_out(if_block0, 1, 1, () => {
1596
- if_block0 = null;
1597
- });
1598
-
1599
- check_outros();
1600
- }
1601
-
1602
- if (/*$$slots*/ ctx[15]["no-results"] && !/*hideDropdown*/ ctx[5] && /*value*/ ctx[0].length > 0 && /*results*/ ctx[1].length === 0) {
1603
- if (if_block1) {
1604
- if_block1.p(ctx, dirty);
1605
-
1606
- if (dirty[0] & /*$$slots, hideDropdown, value, results*/ 32803) {
1607
- transition_in(if_block1, 1);
1608
- }
1609
- } else {
1610
- if_block1 = create_if_block(ctx);
1611
- if_block1.c();
1612
- transition_in(if_block1, 1);
1613
- if_block1.m(ul, null);
1614
- }
1615
- } else if (if_block1) {
1616
- group_outros();
1617
-
1618
- transition_out(if_block1, 1, 1, () => {
1619
- if_block1 = null;
1620
- });
1621
-
1622
- check_outros();
1623
- }
1624
-
1625
- if (!current || dirty[0] & /*id*/ 4 && ul_aria_labelledby_value !== (ul_aria_labelledby_value = "" + (/*id*/ ctx[2] + "-label"))) {
1626
- attr(ul, "aria-labelledby", ul_aria_labelledby_value);
1627
- }
1628
-
1629
- if (!current || dirty[0] & /*id*/ 4 && ul_id_value !== (ul_id_value = "" + (/*id*/ ctx[2] + "-listbox"))) {
1630
- attr(ul, "id", ul_id_value);
1631
- }
1632
-
1633
- if (!current || dirty[0] & /*id*/ 4 && div_aria_controls_value !== (div_aria_controls_value = "" + (/*id*/ ctx[2] + "-listbox"))) {
1634
- attr(div, "aria-controls", div_aria_controls_value);
1635
- }
1636
-
1637
- if (!current || dirty[0] & /*showResults*/ 128) {
1638
- attr(div, "aria-expanded", /*showResults*/ ctx[7]);
1639
- }
1640
-
1641
- if (!current || dirty[0] & /*id*/ 4 && div_id_value !== (div_id_value = "" + (/*id*/ ctx[2] + "-typeahead"))) {
1642
- attr(div, "id", div_id_value);
1643
- }
1644
-
1645
- if (!current || dirty[0] & /*results*/ 2) {
1646
- toggle_class(div, "dropdown", /*results*/ ctx[1].length > 0);
1647
- }
1648
- },
1649
- i(local) {
1650
- if (current) return;
1651
- transition_in(search.$$.fragment, local);
1652
- transition_in(if_block0);
1653
- transition_in(if_block1);
1654
- current = true;
1655
- },
1656
- o(local) {
1657
- transition_out(search.$$.fragment, local);
1658
- transition_out(if_block0);
1659
- transition_out(if_block1);
1660
- current = false;
1661
- },
1662
- d(detaching) {
1663
- if (detaching) detach(div);
1664
- destroy_component(search);
1665
- if (if_block0) if_block0.d();
1666
- if (if_block1) if_block1.d();
1667
- /*div_binding*/ ctx[42](null);
1668
- mounted = false;
1669
- dispose();
1670
- }
1671
- };
1672
- }
1673
-
1674
- function instance($$self, $$props, $$invalidate) {
1675
- let options;
1676
- let resultsId;
1677
- let showResults;
1678
-
1679
- const omit_props_names = [
1680
- "id","value","data","extract","disable","filter","autoselect","inputAfterSelect","results","focusAfterSelect","showDropdownOnFocus","showAllResultsOnFocus","limit"
1681
- ];
1682
-
1683
- let $$restProps = compute_rest_props($$props, omit_props_names);
1684
- let { $$slots: slots = {}, $$scope } = $$props;
1685
- const $$slots = compute_slots(slots);
1686
- let { id = "typeahead-" + Math.random().toString(36) } = $$props;
1687
- let { value = "" } = $$props;
1688
- let { data = [] } = $$props;
1689
- let { extract = item => item } = $$props;
1690
- let { disable = item => false } = $$props;
1691
- let { filter = item => false } = $$props;
1692
- let { autoselect = true } = $$props;
1693
- let { inputAfterSelect = "update" } = $$props;
1694
- let { results = [] } = $$props;
1695
- let { focusAfterSelect = false } = $$props;
1696
- let { showDropdownOnFocus = false } = $$props;
1697
- let { showAllResultsOnFocus = false } = $$props;
1698
- let { limit = Infinity } = $$props;
1699
- const dispatch = createEventDispatcher();
1700
- let comboboxRef = null;
1701
- let searchRef = null;
1702
- let hideDropdown = false;
1703
- let selectedIndex = -1;
1704
- let prevResults = "";
1705
- let isFocused = false;
1706
-
1707
- afterUpdate(() => {
1708
- if (prevResults !== resultsId && autoselect) {
1709
- $$invalidate(10, selectedIndex = getNextNonDisabledIndex());
1710
- }
1711
-
1712
- if (prevResults !== resultsId && !$$slots["no-results"]) {
1713
- $$invalidate(5, hideDropdown = results.length === 0);
1714
- }
1715
-
1716
- prevResults = resultsId;
1717
- });
1718
-
1719
- async function select() {
1720
- const result = results[selectedIndex];
1721
- if (result.disabled) return;
1722
- const selectedValue = extract(result.original);
1723
- const searchedValue = value;
1724
- if (inputAfterSelect == "clear") $$invalidate(0, value = "");
1725
- if (inputAfterSelect == "update") $$invalidate(0, value = selectedValue);
1726
-
1727
- dispatch("select", {
1728
- selectedIndex,
1729
- searched: searchedValue,
1730
- selected: selectedValue,
1731
- original: result.original,
1732
- originalIndex: result.index
1733
- });
1734
-
1735
- await tick();
1736
- if (focusAfterSelect) searchRef.focus();
1737
- close();
1738
- }
1739
-
1740
- /** @type {() => number} */
1741
- function getNextNonDisabledIndex() {
1742
- let index = 0;
1743
- let disabled = results[index]?.disabled ?? false;
1744
-
1745
- while (disabled) {
1746
- if (index === results.length) {
1747
- index = 0;
1748
- } else {
1749
- index += 1;
1750
- }
1751
-
1752
- disabled = results[index]?.disabled ?? false;
1753
- }
1754
-
1755
- return index;
1756
- }
1757
-
1758
- /** @type {(direction: -1 | 1) => void} */
1759
- function change(direction) {
1760
- let index = direction === 1 && selectedIndex === results.length - 1
1761
- ? 0
1762
- : selectedIndex + direction;
1763
-
1764
- if (index < 0) index = results.length - 1;
1765
- let disabled = results[index].disabled;
1766
-
1767
- while (disabled) {
1768
- if (index === results.length) {
1769
- index = 0;
1770
- } else {
1771
- index += direction;
1772
- }
1773
-
1774
- disabled = results[index].disabled;
1775
- }
1776
-
1777
- $$invalidate(10, selectedIndex = index);
1778
- }
1779
-
1780
- const open = () => $$invalidate(5, hideDropdown = false);
1781
-
1782
- const close = () => {
1783
- $$invalidate(5, hideDropdown = true);
1784
- $$invalidate(6, isFocused = false);
1785
- };
1786
-
1787
- const click_handler = ({ target }) => {
1788
- if (!hideDropdown && !comboboxRef?.contains(target)) {
1789
- close();
1790
- }
1791
- };
1792
-
1793
- function search_ref_binding(value) {
1794
- searchRef = value;
1795
- $$invalidate(9, searchRef);
1796
- }
1797
-
1798
- function search_value_binding(value$1) {
1799
- value = value$1;
1800
- $$invalidate(0, value);
1801
- }
1802
-
1803
- function type_handler(event) {
1804
- bubble.call(this, $$self, event);
1805
- }
1806
-
1807
- function input_handler(event) {
1808
- bubble.call(this, $$self, event);
1809
- }
1810
-
1811
- function change_handler(event) {
1812
- bubble.call(this, $$self, event);
1813
- }
1814
-
1815
- function focus_handler(event) {
1816
- bubble.call(this, $$self, event);
1817
- }
1818
-
1819
- const focus_handler_1 = () => {
1820
- open();
1821
-
1822
- if (showDropdownOnFocus || showAllResultsOnFocus) {
1823
- $$invalidate(7, showResults = true);
1824
- $$invalidate(6, isFocused = true);
1825
- }
1826
- };
1827
-
1828
- function clear_handler(event) {
1829
- bubble.call(this, $$self, event);
1830
- }
1831
-
1832
- function blur_handler(event) {
1833
- bubble.call(this, $$self, event);
1834
- }
1835
-
1836
- function keydown_handler(event) {
1837
- bubble.call(this, $$self, event);
1838
- }
1839
-
1840
- const keydown_handler_1 = e => {
1841
- if (results.length === 0) return;
1842
-
1843
- switch (e.key) {
1844
- case "Enter":
1845
- select();
1846
- break;
1847
- case "ArrowDown":
1848
- e.preventDefault();
1849
- change(1);
1850
- break;
1851
- case "ArrowUp":
1852
- e.preventDefault();
1853
- change(-1);
1854
- break;
1855
- case "Escape":
1856
- e.preventDefault();
1857
- $$invalidate(0, value = "");
1858
- searchRef?.focus();
1859
- close();
1860
- break;
1861
- }
1862
- };
1863
-
1864
- const click_handler_1 = (result, index) => {
1865
- if (result.disabled) return;
1866
- $$invalidate(10, selectedIndex = index);
1867
- select();
1868
- };
1869
-
1870
- const mouseenter_handler = (result, index) => {
1871
- if (result.disabled) return;
1872
- $$invalidate(10, selectedIndex = index);
1873
- };
1874
-
1875
- function div_binding($$value) {
1876
- binding_callbacks[$$value ? 'unshift' : 'push'](() => {
1877
- comboboxRef = $$value;
1878
- $$invalidate(8, comboboxRef);
1879
- });
1880
- }
1881
-
1882
- $$self.$$set = $$new_props => {
1883
- $$props = assign(assign({}, $$props), exclude_internal_props($$new_props));
1884
- $$invalidate(16, $$restProps = compute_rest_props($$props, omit_props_names));
1885
- if ('id' in $$new_props) $$invalidate(2, id = $$new_props.id);
1886
- if ('value' in $$new_props) $$invalidate(0, value = $$new_props.value);
1887
- if ('data' in $$new_props) $$invalidate(17, data = $$new_props.data);
1888
- if ('extract' in $$new_props) $$invalidate(18, extract = $$new_props.extract);
1889
- if ('disable' in $$new_props) $$invalidate(19, disable = $$new_props.disable);
1890
- if ('filter' in $$new_props) $$invalidate(20, filter = $$new_props.filter);
1891
- if ('autoselect' in $$new_props) $$invalidate(21, autoselect = $$new_props.autoselect);
1892
- if ('inputAfterSelect' in $$new_props) $$invalidate(22, inputAfterSelect = $$new_props.inputAfterSelect);
1893
- if ('results' in $$new_props) $$invalidate(1, results = $$new_props.results);
1894
- if ('focusAfterSelect' in $$new_props) $$invalidate(23, focusAfterSelect = $$new_props.focusAfterSelect);
1895
- if ('showDropdownOnFocus' in $$new_props) $$invalidate(3, showDropdownOnFocus = $$new_props.showDropdownOnFocus);
1896
- if ('showAllResultsOnFocus' in $$new_props) $$invalidate(4, showAllResultsOnFocus = $$new_props.showAllResultsOnFocus);
1897
- if ('limit' in $$new_props) $$invalidate(24, limit = $$new_props.limit);
1898
- if ('$$scope' in $$new_props) $$invalidate(26, $$scope = $$new_props.$$scope);
1899
- };
1900
-
1901
- $$self.$$.update = () => {
1902
- if ($$self.$$.dirty[0] & /*extract*/ 262144) {
1903
- $$invalidate(25, options = { pre: "<mark>", post: "</mark>", extract });
1904
- }
1905
-
1906
- if ($$self.$$.dirty[0] & /*value, data, options, limit, filter, disable*/ 52035585) {
1907
- $$invalidate(1, results = fuzzy.filter(value, data, options).filter(({ score }) => score > 0).slice(0, limit).filter(result => !filter(result.original)).map(result => ({
1908
- ...result,
1909
- disabled: disable(result.original)
1910
- })));
1911
- }
1912
-
1913
- if ($$self.$$.dirty[0] & /*isFocused, showAllResultsOnFocus, value, data, filter, disable, extract*/ 1966161) {
1914
- if (isFocused && showAllResultsOnFocus && value.length === 0) {
1915
- $$invalidate(1, results = data.filter(datum => !filter(datum)).map((original, index) => ({
1916
- disabled: disable(original),
1917
- index,
1918
- original,
1919
- score: 0,
1920
- string: extract(original)
1921
- })));
1922
- }
1923
- }
1924
-
1925
- if ($$self.$$.dirty[0] & /*results, extract*/ 262146) {
1926
- resultsId = results.map(result => extract(result.original)).join("");
1927
- }
1928
-
1929
- if ($$self.$$.dirty[0] & /*hideDropdown, results*/ 34) {
1930
- $$invalidate(7, showResults = !hideDropdown && results.length > 0);
1931
- }
1932
-
1933
- if ($$self.$$.dirty[0] & /*showDropdownOnFocus, showResults, isFocused*/ 200) {
1934
- if (showDropdownOnFocus) {
1935
- $$invalidate(7, showResults = showResults && isFocused);
1936
- }
1937
- }
1938
- };
1939
-
1940
- return [
1941
- value,
1942
- results,
1943
- id,
1944
- showDropdownOnFocus,
1945
- showAllResultsOnFocus,
1946
- hideDropdown,
1947
- isFocused,
1948
- showResults,
1949
- comboboxRef,
1950
- searchRef,
1951
- selectedIndex,
1952
- select,
1953
- change,
1954
- open,
1955
- close,
1956
- $$slots,
1957
- $$restProps,
1958
- data,
1959
- extract,
1960
- disable,
1961
- filter,
1962
- autoselect,
1963
- inputAfterSelect,
1964
- focusAfterSelect,
1965
- limit,
1966
- options,
1967
- $$scope,
1968
- slots,
1969
- click_handler,
1970
- search_ref_binding,
1971
- search_value_binding,
1972
- type_handler,
1973
- input_handler,
1974
- change_handler,
1975
- focus_handler,
1976
- focus_handler_1,
1977
- clear_handler,
1978
- blur_handler,
1979
- keydown_handler,
1980
- keydown_handler_1,
1981
- click_handler_1,
1982
- mouseenter_handler,
1983
- div_binding
1984
- ];
1985
- }
1986
-
1987
- class Typeahead extends SvelteComponent {
1988
- constructor(options) {
1989
- super();
1990
-
1991
- init(
1992
- this,
1993
- options,
1994
- instance,
1995
- create_fragment,
1996
- safe_not_equal,
1997
- {
1998
- id: 2,
1999
- value: 0,
2000
- data: 17,
2001
- extract: 18,
2002
- disable: 19,
2003
- filter: 20,
2004
- autoselect: 21,
2005
- inputAfterSelect: 22,
2006
- results: 1,
2007
- focusAfterSelect: 23,
2008
- showDropdownOnFocus: 3,
2009
- showAllResultsOnFocus: 4,
2010
- limit: 24
2011
- },
2012
- add_css,
2013
- [-1, -1]
2014
- );
2015
- }
2016
- }
2017
-
2018
- export { Typeahead as default };