JavedA commited on
Commit
2e2cacf
1 Parent(s): 6b7a84b

unable to cross ref for quarto bug V_1

Browse files
Files changed (30) hide show
  1. .gitignore +1 -1
  2. _extensions/dialoa/first-line-indent/_extension.yml +6 -0
  3. _extensions/dialoa/first-line-indent/first-line-indent.lua +595 -0
  4. _extensions/quarto-ext/lightbox/_extension.yml +7 -0
  5. _extensions/quarto-ext/lightbox/lightbox.css +9 -0
  6. _extensions/quarto-ext/lightbox/lightbox.lua +251 -0
  7. _extensions/quarto-ext/lightbox/resources/css/glightbox.min.css +1 -0
  8. _extensions/quarto-ext/lightbox/resources/js/glightbox.min.js +1 -0
  9. _extensions/schochastics/social-share/_extension.yml +6 -0
  10. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/_extension.yml +6 -0
  11. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/css/all.css +0 -0
  12. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/css/latex-fontsize.css +30 -0
  13. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-brands-400.ttf +0 -0
  14. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-brands-400.woff2 +0 -0
  15. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-regular-400.ttf +0 -0
  16. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-regular-400.woff2 +0 -0
  17. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-solid-900.ttf +0 -0
  18. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-solid-900.woff2 +0 -0
  19. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-v4compatibility.ttf +0 -0
  20. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-v4compatibility.woff2 +0 -0
  21. _extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/fontawesome.lua +77 -0
  22. _extensions/schochastics/social-share/social-share.css +99 -0
  23. _extensions/schochastics/social-share/social-share.lua +50 -0
  24. _extensions/shafayetShafee/downloadthis/_extension.yml +8 -0
  25. _extensions/shafayetShafee/downloadthis/downloadthis.lua +121 -0
  26. _extensions/shafayetShafee/downloadthis/resources/css/downloadthis.css +13 -0
  27. _extensions/shafayetShafee/downloadthis/resources/lua/base64.lua +201 -0
  28. _extensions/shafayetShafee/downloadthis/resources/lua/puremagic.lua +735 -0
  29. _extensions/toc_lof/_extension.yml +8 -0
  30. _extensions/toc_lof/toc_lof.lua +6 -0
.gitignore CHANGED
@@ -1,7 +1,7 @@
1
  _book/
2
  .quarto/
3
  .vscode/
4
- _extensions/
5
  /.quarto/
6
  _.site/
7
 
 
1
  _book/
2
  .quarto/
3
  .vscode/
4
+ # _extensions/
5
  /.quarto/
6
  _.site/
7
 
_extensions/dialoa/first-line-indent/_extension.yml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ name: first-line-indent
2
+ author: Julien Dutant
3
+ version: 1.0.0
4
+ contributes:
5
+ filters:
6
+ - first-line-indent.lua
_extensions/dialoa/first-line-indent/first-line-indent.lua ADDED
@@ -0,0 +1,595 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --[[# first-line-indent.lua – First line indentation filter
2
+
3
+ Copyright: © 2021–2023 Contributors
4
+ License: MIT – see LICENSE for details
5
+
6
+ @TODO latex_quote should use options.size (or better, a specific option)
7
+ @TODO option for leaving indents after headings (French style)
8
+ @TODO smart setting of the post-heading style based on `lang`
9
+ @TODO option to leave indent at the beginning of the document
10
+
11
+ ]]
12
+
13
+ PANDOC_VERSION:must_be_at_least '2.17'
14
+ stringify = pandoc.utils.stringify
15
+ equals = pandoc.utils.equals
16
+ pandoctype = pandoc.utils.type
17
+
18
+ -- # Options
19
+
20
+ ---@class Options Options map with default values.
21
+ ---@field format string|nil output format (currently: 'html' or 'latex')
22
+ ---@field indent boolean whether to use first line indentation globally
23
+ ---@field set_metadata_variable boolean whether to set the `indent`
24
+ -- metadata variable.
25
+ ---@field set_header_includes boolean whether to provide formatting code in
26
+ -- header-includes.
27
+ ---@field auto_remove_indents boolean whether to automatically remove
28
+ -- indents after specific block types.
29
+ ---@field remove_after table list of strings, Pandoc AST block types
30
+ -- after which first-line indents should be automatically removed.
31
+ ---@field remove_after_class table list of strings, classes of elements
32
+ -- after which first-line indents should be automatically removed.
33
+ ---@field dont_remove_after_class table list of strings, classes of elements
34
+ -- after which first-line indents should not be removed. Prevails
35
+ -- over remove_after.
36
+ ---@field size string|nil a CSS / LaTeX specification of the first line
37
+ -- indent length
38
+ ---@field recursive table<string, options> Pandoc Block types to
39
+ --- which the filter is recursively applied, with options map.
40
+ --- The option `dont_indent_first` controls whether indentation
41
+ --- is removed on the first paragraph.
42
+ local Options = {
43
+ format = nil,
44
+ indent = true,
45
+ set_metadata_variable = true,
46
+ set_header_includes = true,
47
+ auto_remove = true,
48
+ remove_after = pandoc.List({
49
+ 'BlockQuote',
50
+ 'BulletList',
51
+ 'CodeBlock',
52
+ 'DefinitionList',
53
+ 'HorizontalRule',
54
+ 'OrderedList',
55
+ }),
56
+ remove_after_class = pandoc.List({
57
+ 'statement',
58
+ }),
59
+ dont_remove_after_class = pandoc.List:new(),
60
+ size = nil, -- default let LaTeX decide
61
+ size_default = '1.5em', -- default value for HTML
62
+ recursive = {
63
+ Div = {dont_indent_first = false},
64
+ BlockQuote = {dont_indent_first = true},
65
+ }
66
+ }
67
+
68
+ -- # Filter global variables
69
+
70
+ ---@class code map pandoc objects for indent/noindent Raw code.
71
+ local code = {
72
+ tex = {
73
+ indent = pandoc.RawInline('tex', '\\indent '),
74
+ noindent = pandoc.RawInline('tex', '\\noindent '),
75
+ },
76
+ latex = {
77
+ indent = pandoc.RawInline('latex', '\\indent '),
78
+ noindent = pandoc.RawInline('latex', '\\noindent '),
79
+ },
80
+ html = {
81
+ indent = pandoc.RawBlock('html',
82
+ '<div class="first-line-indent-after"></div>'),
83
+ noindent = pandoc.RawBlock('html',
84
+ '<div class="no-first-line-indent-after"></div>'),
85
+ }
86
+ }
87
+
88
+
89
+ ---LATEX_QUOTE_ENV: LaTeX's definition of the quote environement
90
+ ---used to define HeaderIncludes.
91
+ ---a \setlength{\parindent}{<size>} will be appended
92
+ ---@type string
93
+ local LATEX_QUOTE_ENV = [[\makeatletter
94
+ \renewenvironment{quote}
95
+ {\list{}{\listparindent 1.5em%
96
+ \itemindent \listparindent
97
+ \rightmargin \leftmargin
98
+ \parsep \z@ \@plus \p@}%
99
+ \item\noindent\relax}
100
+ {\endlist}
101
+ \makeatother
102
+ ]]
103
+
104
+ ---@class HeaderIncludes map of functions to produce
105
+ ---header-includes code given a size parameter (string|nil),
106
+ --- either for global or for local indentation markup.
107
+ --- optionally wrap the constructed global header markup (e.g. <style> tags).
108
+ --- glob = {html : function, latex: function}
109
+ --- wrap = {html : function, latex: function}
110
+ --- loc = {html : function, latex: function}
111
+ HeaderIncludes = {
112
+ glob = {
113
+ html = function(size)
114
+ size = size or Options.size_default
115
+ local code = [[ p {
116
+ text-indent: SIZE;
117
+
118
+ -- Javed
119
+ -- here you can define th margin to be zero or do not touch it
120
+ -- margin: 0;
121
+ }
122
+ header p {
123
+ text-indent: 0;
124
+ margin: 1em 0;
125
+ }
126
+ :is(h1, h2, h3, h4, h5, h6) + p {
127
+ text-indent: 0;
128
+ }
129
+ li > p, li > div p {
130
+ text-indent: 0;
131
+ margin-bottom: 1rem;
132
+ }
133
+ ]]
134
+ return code:gsub("SIZE", size)
135
+ end,
136
+ latex = function(size)
137
+ local size_code = size and '\\setlength{\\parindent}{'..size..'}\n'
138
+ or ''
139
+ return LATEX_QUOTE_ENV .. size_code
140
+ end,
141
+ },
142
+ wrap = {
143
+ html = function(header_str)
144
+ return "<style>\n/* first-line indent styles */\n" .. header_str
145
+ .. "/* end of first-line indent styles */\n</style>"
146
+ end,
147
+ latex = function(str) return str end,
148
+ },
149
+ loc = {
150
+ html = function(size)
151
+ size = size or Options.size_default
152
+ local code = [[ div.no-first-line-indent-after + p {
153
+ text-indent: 0;
154
+ }
155
+ div.first-line-indent-after + p {
156
+ text-indent: SIZE;
157
+ }
158
+ ]]
159
+ return code:gsub("SIZE", size)
160
+ end,
161
+ latex = function(_) return '' end,
162
+ }
163
+ }
164
+
165
+ -- # encapsulate Quarto/Pandoc variants
166
+
167
+ ---format_match: whether format matches a string pattern
168
+ ---ex: format_match('html5'), format_match('html*')
169
+ ---in Quarto we try removing non-alphabetical chars
170
+ ---@param pattern string
171
+ ---@return boolean
172
+ local function format_match(pattern)
173
+ return quarto and (quarto.doc.is_format(pattern)
174
+ or quarto.doc.is_format(pattern:gsub('%A',''))
175
+ )
176
+ or FORMAT:match(pattern)
177
+ end
178
+
179
+ ---add_header_includes: add a block to the document's header-includes
180
+ ---meta-data field.
181
+ ---@param meta pandoc.Meta the document's metadata block
182
+ ---@param blocks pandoc.Blocks list of Pandoc block elements (e.g. RawBlock or Para)
183
+ --- to be added to the header-includes of meta
184
+ ---@return pandoc.Meta meta the modified metadata block
185
+ local function add_header_includes(meta, blocks)
186
+
187
+ -- Pandoc
188
+ local function pandoc_add_headinc(meta,blocks)
189
+
190
+ local header_includes = pandoc.MetaList( { pandoc.MetaBlocks(blocks) })
191
+
192
+ -- add any exisiting meta['header-includes']
193
+ -- it can be MetaInlines, MetaBlocks or MetaList
194
+ if meta['header-includes'] then
195
+ if pandoctype(meta['header-includes']) == 'List' then
196
+ header_includes:extend(meta['header-includes'])
197
+ else
198
+ header_includes:insert(meta['header-includes'])
199
+ end
200
+ end
201
+
202
+ meta['header-includes'] = header_includes
203
+
204
+ return meta
205
+
206
+ end
207
+
208
+ -- Quarto
209
+ local function quarto_add_headinc(blocks)
210
+ quarto.doc.include_text('in-header', stringify(blocks))
211
+ end
212
+
213
+ return quarto and quarto_add_headinc(blocks)
214
+ or pandoc_add_headinc(meta,blocks)
215
+
216
+ end
217
+
218
+
219
+ -- # Helper functions
220
+
221
+ -- ensure_list: turns Inlines and Blocks meta values into list
222
+ local function ensure_list(elem)
223
+ if elem and (pandoctype(elem) == 'Inlines'
224
+ or pandoctype(elem) == 'Blocks') then
225
+ elem = pandoc.List:new(elem)
226
+ end
227
+ return elem
228
+ end
229
+
230
+
231
+ --- classes_include: check if one of an element's class is in a given
232
+ -- list. Returns true if match, nil if no match or the element doesn't
233
+ -- have classes.
234
+ ---@param elem table pandoc AST element
235
+ ---@param classes table pandoc List of strings
236
+ local function classes_include(elem,classes)
237
+
238
+ if elem.classes then
239
+
240
+ for _,class in ipairs(classes) do
241
+ if elem.classes:includes(class) then return true end
242
+ end
243
+
244
+ end
245
+
246
+ end
247
+
248
+ --- is_indent_cmd: check if an element is a LaTeX indent command
249
+ ---@param elem pandoc.Inline
250
+ ---@return string|nil 'indent', 'noindent' or nil
251
+ -- local function is_indent_cmd(elem)
252
+ -- return (equals(elem, code.latex.indent)
253
+ -- or equals(elem, code.tex.indent)) and 'indent'
254
+ -- or (equals(elem, code.latex.noindent)
255
+ -- or equals(elem, code.tex.noindent)) and 'noindent'
256
+ -- or nil
257
+ -- end
258
+ local function is_indent_cmd(elem)
259
+ return elem.text and (
260
+ elem.text:match('^%s*\\indent%s*$') and 'indent'
261
+ or elem.text:match('^%s*\\noindent%s*$') and 'noindent'
262
+ )
263
+ or nil
264
+ end
265
+
266
+ -- # Filter functions
267
+
268
+ --- Add format-specific explicit indent markup to a paragraph.
269
+ --- Returns a list of blocks containing a single paragraph
270
+ --- or a rawblock followed by a paragraph, depending on format.
271
+ ---@param type string 'indent' or 'noindent', type of markup to add
272
+ ---@param elem pandoc.Para
273
+ ---@return pandoc.Blocks
274
+ local function indent_markup(type, elem)
275
+ local result = pandoc.List:new()
276
+
277
+ if not (type == 'indent' or type == 'noindent') then
278
+
279
+ result:insert(elem)
280
+
281
+ elseif format_match('latex') then
282
+
283
+ -- in LaTeX, replace any `\indent` or `\noindent`
284
+ -- at the beginning of the paragraph with
285
+ -- with the one corresponding to `type`
286
+
287
+ if elem.content[1] and is_indent_cmd(elem.content[1]) then
288
+ elem.content[1] = code.tex[type]
289
+ else
290
+ elem.content:insert(1, code.tex[type])
291
+ end
292
+ result:insert(elem)
293
+
294
+
295
+ elseif format_match('html') then
296
+
297
+ result:extend({ code.html[type], elem })
298
+
299
+ end
300
+
301
+ return result
302
+
303
+ end
304
+
305
+ --- process_blocks: process indentations in a list of blocks.
306
+ -- Adds output code for explicitly specified first-line indents,
307
+ -- automatically removes first-line indents after blocks of the
308
+ -- designed types unless otherwise specified.
309
+ ---@param blocks pandoc.Blocks element (list of blocks)
310
+ ---@param dont_indent_first boolean whether to indent the first paragraph
311
+ local function process_blocks(blocks, dont_indent_first)
312
+ dont_indent_first = dont_indent_first or false
313
+ -- tag for the first element
314
+ local is_first_block = true -- tags the doc's first element
315
+ -- tag to trigger indentation auto-removal on the next element
316
+ local dont_indent_next_block = false
317
+ local result = pandoc.List:new()
318
+
319
+ for _,elem in pairs(blocks) do
320
+
321
+ -- Paragraphs: if they have explicit LaTeX indent markup
322
+ -- reproduce it in the output format, otherwise
323
+ -- remove indentation if needed, provided `auto_remove` is on.
324
+ if elem.t == "Para" then
325
+
326
+ if elem.content[1] and is_indent_cmd(elem.content[1]) then
327
+
328
+ -- 'indent' or 'noindent' ?
329
+ local type = is_indent_cmd(elem.content[1])
330
+
331
+ result:extend(indent_markup(type, elem))
332
+
333
+ elseif is_first_block and dont_indent_first then
334
+
335
+ result:extend(indent_markup('noindent', elem))
336
+
337
+ elseif dont_indent_next_block and Options.auto_remove then
338
+
339
+ result:extend(indent_markup('noindent', elem))
340
+
341
+ else
342
+
343
+ result:insert(elem)
344
+
345
+ end
346
+
347
+ dont_indent_next_block = false
348
+
349
+ -- Non-Paragraphs: check first whether it's an element after
350
+ -- which indentation must be removed. Next insert it, applying
351
+ -- this function recursively within the element if needed.
352
+ else
353
+
354
+ if Options.auto_remove then
355
+
356
+ if Options.remove_after:includes(elem.t) and
357
+ not classes_include(elem, Options.dont_remove_after_class) then
358
+
359
+ dont_indent_next_block = true
360
+
361
+ elseif elem.classes and
362
+ classes_include(elem, Options.remove_after_class) then
363
+
364
+ dont_indent_next_block = true
365
+
366
+ else
367
+
368
+ dont_indent_next_block = false
369
+
370
+ end
371
+
372
+ end
373
+
374
+ -- recursively process the element if needed
375
+ if Options.recursive[elem.t] then
376
+
377
+ local dif = Options.recursive[elem.t].dont_indent_first
378
+ elem.content = process_blocks(elem.content, dif)
379
+
380
+ end
381
+
382
+ -- insert
383
+ result:insert(elem)
384
+
385
+ end
386
+
387
+ -- ensure `is_first_block` turns to false
388
+ -- even if the first block wasn't a paragraph
389
+ -- or if it had explicit indent marking
390
+ is_first_block = false
391
+
392
+ end
393
+
394
+ return result
395
+
396
+ end
397
+
398
+ --- process_doc: Process indents in the document's body text.
399
+ -- Adds output code for explicitly specified first-line indents,
400
+ -- automatically removes first-line indents after blocks of the
401
+ -- designed types unless otherwise specified.
402
+ local function process_doc(doc)
403
+ local dont_indent_first = false
404
+
405
+ -- if no output format, do nothing
406
+ if not Options.format then return end
407
+
408
+ -- if the doc has a title, do not indent first paragraph
409
+ if doc.meta.title then
410
+ dont_indent_first = true
411
+ end
412
+
413
+ doc.blocks = process_blocks(doc.blocks, dont_indent_first)
414
+
415
+ return doc
416
+
417
+ end
418
+
419
+
420
+ --- read_user_options: read user options from meta element.
421
+ -- in Quarto options may be under format/pdf or format/html
422
+ -- the latter override root ones.
423
+ local function read_user_options(meta)
424
+ local user_options = {}
425
+
426
+ if meta.indent == false then
427
+ Options.indent = false
428
+ end
429
+
430
+ if meta['first-line-indent'] then
431
+ user_options = meta['first-line-indent']
432
+ end
433
+
434
+ local formats = {'pdf', 'html', 'latex'}
435
+ if meta.format then
436
+ for format in ipairs(formats) do
437
+ if format_match(format) and meta.format[format] then
438
+ for k,v in meta.format[format] do
439
+ user_options[k] = v
440
+ end
441
+ end
442
+ end
443
+ end
444
+
445
+ if user_options['set-metadata-variable'] == false then
446
+ Options.set_metadata_variable = false
447
+ end
448
+
449
+ if user_options['set-header-includes'] == false then
450
+ Options.set_header_includes = false
451
+ end
452
+
453
+ -- size
454
+ -- @todo using stringify means that LaTeX commands in
455
+ -- size are erased. But it ensures that the filter gets
456
+ -- a string. Improvement: check that we have a string
457
+ -- and throw a warning otherwise
458
+ if user_options.size and pandoctype(user_options.size == 'Inlines') then
459
+
460
+ Options.size = stringify(user_options.size)
461
+
462
+ end
463
+
464
+ if user_options['auto-remove'] == false then
465
+ Options.auto_remove = false
466
+ end
467
+
468
+ -- autoremove elements and classes
469
+ -- for elements we only need a whitelist, remove_after
470
+ -- for classes we need both a whitelist (remove_after_class)
471
+ -- and a blacklist (dont_remove_after_class).
472
+
473
+ -- first insert user values in `remove_after`, `remove_after_class`
474
+ -- and `dont_remove_after_class`.
475
+ for optname, metakey in pairs({
476
+ remove_after = 'remove-after',
477
+ remove_after_class = 'remove-after-class',
478
+ dont_remove_after_class = 'dont-remove-after-class',
479
+ }) do
480
+
481
+ local user_value = ensure_list(user_options[metakey])
482
+
483
+ if user_value and pandoctype(user_value) == 'List' then
484
+
485
+ for _,item in ipairs(user_value) do
486
+
487
+ Options[optname]:insert(stringify(item))
488
+
489
+ end
490
+
491
+ end
492
+
493
+ end
494
+
495
+ -- then remove blacklisted entries from `remove_after`
496
+ -- and `remove_after_class`.
497
+ for optname, metakey in pairs({
498
+ remove_after = 'dont-remove-after',
499
+ remove_after_class = 'dont-remove-after-class'
500
+ }) do
501
+
502
+ local user_value = ensure_list(user_options[metakey])
503
+
504
+ if user_value and pandoctype(user_value) == 'List' then
505
+
506
+ -- stringify the list
507
+ for i,v in ipairs(user_value) do
508
+ user_value[i] = stringify(v)
509
+ end
510
+
511
+ -- filter to that returns true iff an item isn't blacklisted
512
+ local predicate = function (str)
513
+ return not(user_value:includes(str))
514
+ end
515
+
516
+ -- apply the filter to the whitelist
517
+ Options[optname] = Options[optname]:filter(predicate)
518
+
519
+ end
520
+
521
+ end
522
+
523
+ end
524
+
525
+ --- set_meta: insert options in doc's meta
526
+ --- Sets `indent` and extends `header-includes` if needed.
527
+ ---@param meta pandoc.Meta
528
+ ---@return pandoc.Meta|nil meta nil if no changes
529
+ local function set_meta(meta)
530
+ local changes = false -- only return if changes are made
531
+ local header_code = nil
532
+ local format = Options.format
533
+
534
+ -- set the `indent` metadata variable unless otherwise specified or
535
+ -- already set to false
536
+ if Options.set_metadata_variable and not(meta.indent == false) then
537
+ meta.indent = true
538
+ changes = true
539
+ end
540
+
541
+ -- set the `header-includes` metadata variable
542
+ if Options.set_header_includes and Options.indent then
543
+
544
+ -- do we apply first line indentation globally?
545
+ if Options.indent then
546
+ header_code = HeaderIncludes.glob[format](Options.size)
547
+ end
548
+ -- provide local explicit indentation styles
549
+ header_code = header_code .. HeaderIncludes.loc[format](Options.size)
550
+ -- wrap the header if needed
551
+ header_code = HeaderIncludes.wrap[format](header_code)
552
+
553
+ -- insert if not empty
554
+ if header_code ~= '' then
555
+ add_header_includes(meta, { pandoc.RawBlock(format, header_code)})
556
+ changes = true
557
+ end
558
+
559
+ end
560
+
561
+ return changes and meta or nil
562
+
563
+ end
564
+
565
+ --- process_metadata: process user options.
566
+ -- read user options, set the `indent` metadata variable,
567
+ -- add formatting code to `header-includes`.
568
+ local function process_metadata(meta)
569
+ local changes = false -- only return if changes are made
570
+ local header_code = nil
571
+ local format = format_match('html') and 'html'
572
+ or (format_match('latex') and 'latex')
573
+
574
+ if not format then
575
+ return nil
576
+ else
577
+ Options.format = format
578
+ end
579
+
580
+ read_user_options(meta) -- places values in global `options`
581
+
582
+ return set_meta(meta)
583
+
584
+ end
585
+
586
+ --- Main code
587
+ -- Returns the filters in the desired order of execution
588
+ return {
589
+ {
590
+ Meta = process_metadata
591
+ },
592
+ {
593
+ Pandoc = process_doc
594
+ }
595
+ }
_extensions/quarto-ext/lightbox/_extension.yml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ title: Lightbox
2
+ author: RStudio, PBC
3
+ version: 0.1.6
4
+ quarto-required: ">=1.2.198"
5
+ contributes:
6
+ filters:
7
+ - lightbox.lua
_extensions/quarto-ext/lightbox/lightbox.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+ div.gslide div.gslide-description,
5
+ div.gslide-description .gslide-title,
6
+ div.gslide-description .gslide-desc {
7
+ color: var(--quarto-body-color);
8
+ background-color: var(--quarto-body-bg);
9
+ }
_extensions/quarto-ext/lightbox/lightbox.lua ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- whether we're automatically lightboxing
2
+ local auto = false
3
+
4
+ -- whether we need lightbox dependencies added
5
+ local needsLightbox = false
6
+
7
+ -- a counter used to ensure each image is in its own gallery
8
+ local imgCount = 0
9
+
10
+ -- attributes to forward from the image to the newly created link
11
+ local kDescription = "description"
12
+ local kForwardedAttr = {
13
+ "title", kDescription, "desc-position",
14
+ "type", "effect", "zoomable", "draggable"
15
+ }
16
+
17
+ local kLightboxClass = "lightbox"
18
+ local kNoLightboxClass = "nolightbox"
19
+ local kGalleryPrefix = "quarto-lightbox-gallery-"
20
+
21
+ -- A list of images already within links that we can use to filter
22
+ local imagesWithinLinks = pandoc.List({})
23
+
24
+ local function readAttrValue(el, attrName)
25
+ if attrName == kDescription then
26
+ local doc = pandoc.read(el.attr.attributes[attrName])
27
+ local attrInlines = doc.blocks[1].content
28
+ return pandoc.write(pandoc.Pandoc(attrInlines), "html")
29
+ else
30
+ return el[attrName]
31
+ end
32
+
33
+ end
34
+
35
+ return {
36
+ {
37
+ Meta = function(meta)
38
+
39
+ -- If the mode is auto, we need go ahead and
40
+ -- run if there are any images (ideally we would)
41
+ -- filter to images in the body, but that can be
42
+ -- left for future me to deal with
43
+ -- supports:
44
+ -- lightbox: auto
45
+ -- or
46
+ -- lightbox:
47
+ -- match: auto
48
+ local lbMeta = meta.lightbox
49
+ if lbMeta ~= nil and type(lbMeta) == 'table' then
50
+ if lbMeta[1] ~= nil then
51
+ if lbMeta[1].text == "auto" then
52
+ auto = true
53
+ end
54
+ elseif lbMeta.match ~= nil and pandoc.utils.stringify(lbMeta.match) == 'auto' then
55
+ auto = true
56
+ elseif lbMeta == true then
57
+ auto = true
58
+ end
59
+ end
60
+ end,
61
+ -- Find images that are already within links
62
+ -- we'll use this to filter out these images if
63
+ -- the most is auto
64
+ Link = function(linkEl)
65
+ pandoc.walk_inline(linkEl, {
66
+ Image = function(imageEl)
67
+ imagesWithinLinks[#imagesWithinLinks + 1] = imageEl
68
+ end
69
+ })
70
+ end
71
+ },{
72
+ Div = function(div)
73
+ if div.classes:includes("cell") and div.attributes["lightbox"] ~= nil then
74
+ meta = quarto.json.decode(div.attributes["lightbox"])
75
+ local imgCount=0
76
+ div = div:walk({
77
+ Image = function(imgEl)
78
+ imgCount = imgCount + 1
79
+ if (type(meta) == "table" and meta[kNoLightboxClass] == true) or meta == false then
80
+ imgEl.classes:insert(kNoLightboxClass)
81
+ else
82
+ if not auto and ((type(meta) == "table" and not meta[kNoLightboxClass]) or meta == true) then
83
+ imgEl.classes:insert(kLightboxClass)
84
+ end
85
+ if (type(meta) == "table") then
86
+ if meta.group then
87
+ imgEl.attr.attributes.group = meta.group or imgEl.attr.attributes.group
88
+ end
89
+ for _, v in next, kForwardedAttr do
90
+ if type(meta[v]) == "table" and #meta[v] > 1 then
91
+ -- if list attributes it should be one per plot
92
+ if imgCount > #meta[v] then
93
+ quarto.log.warning("More plots than '" .. v .. "' passed in YAML chunk options.")
94
+ else
95
+ attrLb = meta[v][imgCount]
96
+ end
97
+ else
98
+ -- Otherwise reuse the single attributes
99
+ attrLb = meta[v]
100
+ end
101
+ imgEl.attr.attributes[v] = attrLb or imgEl.attr.attributes[v]
102
+ end
103
+ end
104
+ end
105
+ return imgEl
106
+ end
107
+ })
108
+ div.attributes["lightbox"] = nil
109
+ end
110
+ return div
111
+ end
112
+ },
113
+ {
114
+ Image = function(imgEl)
115
+ if quarto.doc.is_format("html:js") then
116
+ local isAlreadyLinked = imagesWithinLinks:includes(imgEl)
117
+ if (not isAlreadyLinked and auto and not imgEl.classes:includes(kNoLightboxClass))
118
+ or imgEl.classes:includes('lightbox') then
119
+ -- note that we need to include the dependency for lightbox
120
+ needsLightbox = true
121
+ imgCount = imgCount + 1
122
+
123
+ -- remove the class from the image
124
+ imgEl.attr.classes = imgEl.attr.classes:filter(function(clz)
125
+ return clz ~= kLightboxClass
126
+ end)
127
+
128
+ -- attributes for the link
129
+ local linkAttributes = {}
130
+
131
+ -- mark this image as a lightbox target
132
+ linkAttributes.class = kLightboxClass
133
+
134
+ -- get the alt text from image and use that as title
135
+ local title = nil
136
+ if imgEl.caption ~= nil and #imgEl.caption > 0 then
137
+ linkAttributes.title = pandoc.utils.stringify(imgEl.caption)
138
+ elseif imgEl.attributes['fig-alt'] ~= nil and #imgEl.attributes['fig-alt'] > 0 then
139
+ linkAttributes.title = pandoc.utils.stringify(imgEl.attributes['fig-alt'])
140
+ end
141
+
142
+ -- move a group attribute to the link, if present
143
+ if imgEl.attr.attributes.group ~= nil then
144
+ linkAttributes.gallery = imgEl.attr.attributes.group
145
+ imgEl.attr.attributes.group = nil
146
+ else
147
+ linkAttributes.gallery = kGalleryPrefix .. imgCount
148
+ end
149
+
150
+ -- forward any other known attributes
151
+ for i, v in ipairs(kForwardedAttr) do
152
+ if imgEl.attr.attributes[v] ~= nil then
153
+ -- forward the attribute
154
+ linkAttributes[v] = readAttrValue(imgEl, v)
155
+
156
+ -- clear the attribute
157
+ imgEl.attr.attributes[v] = nil
158
+ end
159
+
160
+ -- clear the title
161
+ if (imgEl.title == 'fig:') then
162
+ imgEl.title = ""
163
+ end
164
+
165
+ end
166
+
167
+ -- wrap decorated images in a link with appropriate attrs
168
+ local link = pandoc.Link({imgEl}, imgEl.src, nil, linkAttributes)
169
+ return link
170
+ end
171
+ end
172
+ end,
173
+ Meta = function(meta)
174
+ -- If we discovered lightbox-able images
175
+ -- we need to include the dependencies
176
+ if needsLightbox then
177
+ -- add the dependency
178
+ quarto.doc.add_html_dependency({
179
+ name = 'glightbox',
180
+ scripts = {'resources/js/glightbox.min.js'},
181
+ stylesheets = {'resources/css/glightbox.min.css', 'lightbox.css'}
182
+ })
183
+
184
+ -- read lightbox options
185
+ local lbMeta = meta.lightbox
186
+ local lbOptions = {}
187
+ local readEffect = function(el)
188
+ local val = pandoc.utils.stringify(el)
189
+ if val == "fade" or val == "zoom" or val == "none" then
190
+ return val
191
+ else
192
+ error("Invalid effect " + val)
193
+ end
194
+ end
195
+
196
+ -- permitted options include:
197
+ -- lightbox:
198
+ -- effect: zoom | fade | none
199
+ -- desc-position: top | bottom | left |right
200
+ -- loop: true | false
201
+ -- class: <class-name>
202
+ local effect = "zoom"
203
+ local descPosition = "bottom"
204
+ local loop = true
205
+ local skin = nil
206
+
207
+ -- The selector controls which elements are targeted.
208
+ -- currently, it always targets .lightbox elements
209
+ -- and there is no way for the user to change this
210
+ local selector = "." .. kLightboxClass
211
+
212
+ if lbMeta ~= nil and type(lbMeta) == 'table' then
213
+ if lbMeta.effect ~= nil then
214
+ effect = readEffect(lbMeta.effect)
215
+ end
216
+
217
+ if lbMeta['desc-position'] ~= nil then
218
+ descPosition = pandoc.utils.stringify(lbMeta['desc-position'])
219
+ end
220
+
221
+ if lbMeta['css-class'] ~= nil then
222
+ skin = pandoc.utils.stringify(lbMeta['css-class'])
223
+ end
224
+
225
+ if lbMeta.loop ~= nil then
226
+ loop = lbMeta.loop
227
+ end
228
+ end
229
+
230
+ -- Generate the options to configure lightbox
231
+ local options = {
232
+ selector = selector,
233
+ closeEffect = effect,
234
+ openEffect = effect,
235
+ descPosition = descPosition,
236
+ loop = loop,
237
+ }
238
+ if skin ~= nil then
239
+ options.skin = skin
240
+ end
241
+ local optionsJson = quarto.json.encode(options)
242
+
243
+ -- generate the initialization script with the correct options
244
+ local scriptTag = "<script>var lightboxQuarto = GLightbox(" .. optionsJson .. ");</script>"
245
+
246
+ -- inject the rendering code
247
+ quarto.doc.include_text("after-body", scriptTag)
248
+
249
+ end
250
+ end
251
+ }}
_extensions/quarto-ext/lightbox/resources/css/glightbox.min.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .glightbox-container{width:100%;height:100%;position:fixed;top:0;left:0;z-index:999999!important;overflow:hidden;-ms-touch-action:none;touch-action:none;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;-ms-text-size-adjust:100%;text-size-adjust:100%;-webkit-backface-visibility:hidden;backface-visibility:hidden;outline:0}.glightbox-container.inactive{display:none}.glightbox-container .gcontainer{position:relative;width:100%;height:100%;z-index:9999;overflow:hidden}.glightbox-container .gslider{-webkit-transition:-webkit-transform .4s ease;transition:-webkit-transform .4s ease;transition:transform .4s ease;transition:transform .4s ease,-webkit-transform .4s ease;height:100%;left:0;top:0;width:100%;position:relative;overflow:hidden;display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.glightbox-container .gslide{width:100%;position:absolute;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;opacity:0}.glightbox-container .gslide.current{opacity:1;z-index:99999;position:relative}.glightbox-container .gslide.prev{opacity:1;z-index:9999}.glightbox-container .gslide-inner-content{width:100%}.glightbox-container .ginner-container{position:relative;width:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;max-width:100%;margin:auto;height:100vh}.glightbox-container .ginner-container.gvideo-container{width:100%}.glightbox-container .ginner-container.desc-bottom,.glightbox-container .ginner-container.desc-top{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.glightbox-container .ginner-container.desc-left,.glightbox-container .ginner-container.desc-right{max-width:100%!important}.gslide iframe,.gslide video{outline:0!important;border:none;min-height:165px;-webkit-overflow-scrolling:touch;-ms-touch-action:auto;touch-action:auto}.gslide:not(.current){pointer-events:none}.gslide-image{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.gslide-image img{max-height:100vh;display:block;padding:0;float:none;outline:0;border:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-width:100vw;width:auto;height:auto;-o-object-fit:cover;object-fit:cover;-ms-touch-action:none;touch-action:none;margin:auto;min-width:200px}.desc-bottom .gslide-image img,.desc-top .gslide-image img{width:auto}.desc-left .gslide-image img,.desc-right .gslide-image img{width:auto;max-width:100%}.gslide-image img.zoomable{position:relative}.gslide-image img.dragging{cursor:-webkit-grabbing!important;cursor:grabbing!important;-webkit-transition:none;transition:none}.gslide-video{position:relative;max-width:100vh;width:100%!important}.gslide-video .plyr__poster-enabled.plyr--loading .plyr__poster{display:none}.gslide-video .gvideo-wrapper{width:100%;margin:auto}.gslide-video::before{content:'';position:absolute;width:100%;height:100%;background:rgba(255,0,0,.34);display:none}.gslide-video.playing::before{display:none}.gslide-video.fullscreen{max-width:100%!important;min-width:100%;height:75vh}.gslide-video.fullscreen video{max-width:100%!important;width:100%!important}.gslide-inline{background:#fff;text-align:left;max-height:calc(100vh - 40px);overflow:auto;max-width:100%;margin:auto}.gslide-inline .ginlined-content{padding:20px;width:100%}.gslide-inline .dragging{cursor:-webkit-grabbing!important;cursor:grabbing!important;-webkit-transition:none;transition:none}.ginlined-content{overflow:auto;display:block!important;opacity:1}.gslide-external{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;min-width:100%;background:#fff;padding:0;overflow:auto;max-height:75vh;height:100%}.gslide-media{display:-webkit-box;display:-ms-flexbox;display:flex;width:auto}.zoomed .gslide-media{-webkit-box-shadow:none!important;box-shadow:none!important}.desc-bottom .gslide-media,.desc-top .gslide-media{margin:0 auto;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.gslide-description{position:relative;-webkit-box-flex:1;-ms-flex:1 0 100%;flex:1 0 100%}.gslide-description.description-left,.gslide-description.description-right{max-width:100%}.gslide-description.description-bottom,.gslide-description.description-top{margin:0 auto;width:100%}.gslide-description p{margin-bottom:12px}.gslide-description p:last-child{margin-bottom:0}.zoomed .gslide-description{display:none}.glightbox-button-hidden{display:none}.glightbox-mobile .glightbox-container .gslide-description{height:auto!important;width:100%;position:absolute;bottom:0;padding:19px 11px;max-width:100vw!important;-webkit-box-ordinal-group:3!important;-ms-flex-order:2!important;order:2!important;max-height:78vh;overflow:auto!important;background:-webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,0)),to(rgba(0,0,0,.75)));background:linear-gradient(to bottom,rgba(0,0,0,0) 0,rgba(0,0,0,.75) 100%);-webkit-transition:opacity .3s linear;transition:opacity .3s linear;padding-bottom:50px}.glightbox-mobile .glightbox-container .gslide-title{color:#fff;font-size:1em}.glightbox-mobile .glightbox-container .gslide-desc{color:#a1a1a1}.glightbox-mobile .glightbox-container .gslide-desc a{color:#fff;font-weight:700}.glightbox-mobile .glightbox-container .gslide-desc *{color:inherit}.glightbox-mobile .glightbox-container .gslide-desc .desc-more{color:#fff;opacity:.4}.gdesc-open .gslide-media{-webkit-transition:opacity .5s ease;transition:opacity .5s ease;opacity:.4}.gdesc-open .gdesc-inner{padding-bottom:30px}.gdesc-closed .gslide-media{-webkit-transition:opacity .5s ease;transition:opacity .5s ease;opacity:1}.greset{-webkit-transition:all .3s ease;transition:all .3s ease}.gabsolute{position:absolute}.grelative{position:relative}.glightbox-desc{display:none!important}.glightbox-open{overflow:hidden}.gloader{height:25px;width:25px;-webkit-animation:lightboxLoader .8s infinite linear;animation:lightboxLoader .8s infinite linear;border:2px solid #fff;border-right-color:transparent;border-radius:50%;position:absolute;display:block;z-index:9999;left:0;right:0;margin:0 auto;top:47%}.goverlay{width:100%;height:calc(100vh + 1px);position:fixed;top:-1px;left:0;background:#000;will-change:opacity}.glightbox-mobile .goverlay{background:#000}.gclose,.gnext,.gprev{z-index:99999;cursor:pointer;width:26px;height:44px;border:none;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.gclose svg,.gnext svg,.gprev svg{display:block;width:25px;height:auto;margin:0;padding:0}.gclose.disabled,.gnext.disabled,.gprev.disabled{opacity:.1}.gclose .garrow,.gnext .garrow,.gprev .garrow{stroke:#fff}.gbtn.focused{outline:2px solid #0f3d81}iframe.wait-autoplay{opacity:0}.glightbox-closing .gclose,.glightbox-closing .gnext,.glightbox-closing .gprev{opacity:0!important}.glightbox-clean .gslide-description{background:#fff}.glightbox-clean .gdesc-inner{padding:22px 20px}.glightbox-clean .gslide-title{font-size:1em;font-weight:400;font-family:arial;color:#000;margin-bottom:19px;line-height:1.4em}.glightbox-clean .gslide-desc{font-size:.86em;margin-bottom:0;font-family:arial;line-height:1.4em}.glightbox-clean .gslide-video{background:#000}.glightbox-clean .gclose,.glightbox-clean .gnext,.glightbox-clean .gprev{background-color:rgba(0,0,0,.75);border-radius:4px}.glightbox-clean .gclose path,.glightbox-clean .gnext path,.glightbox-clean .gprev path{fill:#fff}.glightbox-clean .gprev{position:absolute;top:-100%;left:30px;width:40px;height:50px}.glightbox-clean .gnext{position:absolute;top:-100%;right:30px;width:40px;height:50px}.glightbox-clean .gclose{width:35px;height:35px;top:15px;right:10px;position:absolute}.glightbox-clean .gclose svg{width:18px;height:auto}.glightbox-clean .gclose:hover{opacity:1}.gfadeIn{-webkit-animation:gfadeIn .5s ease;animation:gfadeIn .5s ease}.gfadeOut{-webkit-animation:gfadeOut .5s ease;animation:gfadeOut .5s ease}.gslideOutLeft{-webkit-animation:gslideOutLeft .3s ease;animation:gslideOutLeft .3s ease}.gslideInLeft{-webkit-animation:gslideInLeft .3s ease;animation:gslideInLeft .3s ease}.gslideOutRight{-webkit-animation:gslideOutRight .3s ease;animation:gslideOutRight .3s ease}.gslideInRight{-webkit-animation:gslideInRight .3s ease;animation:gslideInRight .3s ease}.gzoomIn{-webkit-animation:gzoomIn .5s ease;animation:gzoomIn .5s ease}.gzoomOut{-webkit-animation:gzoomOut .5s ease;animation:gzoomOut .5s ease}@-webkit-keyframes lightboxLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes lightboxLoader{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes gfadeIn{from{opacity:0}to{opacity:1}}@keyframes gfadeIn{from{opacity:0}to{opacity:1}}@-webkit-keyframes gfadeOut{from{opacity:1}to{opacity:0}}@keyframes gfadeOut{from{opacity:1}to{opacity:0}}@-webkit-keyframes gslideInLeft{from{opacity:0;-webkit-transform:translate3d(-60%,0,0);transform:translate3d(-60%,0,0)}to{visibility:visible;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}}@keyframes gslideInLeft{from{opacity:0;-webkit-transform:translate3d(-60%,0,0);transform:translate3d(-60%,0,0)}to{visibility:visible;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}}@-webkit-keyframes gslideOutLeft{from{opacity:1;visibility:visible;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(-60%,0,0);transform:translate3d(-60%,0,0);opacity:0;visibility:hidden}}@keyframes gslideOutLeft{from{opacity:1;visibility:visible;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(-60%,0,0);transform:translate3d(-60%,0,0);opacity:0;visibility:hidden}}@-webkit-keyframes gslideInRight{from{opacity:0;visibility:visible;-webkit-transform:translate3d(60%,0,0);transform:translate3d(60%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}}@keyframes gslideInRight{from{opacity:0;visibility:visible;-webkit-transform:translate3d(60%,0,0);transform:translate3d(60%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}}@-webkit-keyframes gslideOutRight{from{opacity:1;visibility:visible;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(60%,0,0);transform:translate3d(60%,0,0);opacity:0}}@keyframes gslideOutRight{from{opacity:1;visibility:visible;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(60%,0,0);transform:translate3d(60%,0,0);opacity:0}}@-webkit-keyframes gzoomIn{from{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}to{opacity:1}}@keyframes gzoomIn{from{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}to{opacity:1}}@-webkit-keyframes gzoomOut{from{opacity:1}50%{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}to{opacity:0}}@keyframes gzoomOut{from{opacity:1}50%{opacity:0;-webkit-transform:scale3d(.3,.3,.3);transform:scale3d(.3,.3,.3)}to{opacity:0}}@media (min-width:769px){.glightbox-container .ginner-container{width:auto;height:auto;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.glightbox-container .ginner-container.desc-top .gslide-description{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.glightbox-container .ginner-container.desc-top .gslide-image,.glightbox-container .ginner-container.desc-top .gslide-image img{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.glightbox-container .ginner-container.desc-left .gslide-description{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.glightbox-container .ginner-container.desc-left .gslide-image{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.gslide-image img{max-height:97vh;max-width:100%}.gslide-image img.zoomable{cursor:-webkit-zoom-in;cursor:zoom-in}.zoomed .gslide-image img.zoomable{cursor:-webkit-grab;cursor:grab}.gslide-inline{max-height:95vh}.gslide-external{max-height:100vh}.gslide-description.description-left,.gslide-description.description-right{max-width:275px}.glightbox-open{height:auto}.goverlay{background:rgba(0,0,0,.92)}.glightbox-clean .gslide-media{-webkit-box-shadow:1px 2px 9px 0 rgba(0,0,0,.65);box-shadow:1px 2px 9px 0 rgba(0,0,0,.65)}.glightbox-clean .description-left .gdesc-inner,.glightbox-clean .description-right .gdesc-inner{position:absolute;height:100%;overflow-y:auto}.glightbox-clean .gclose,.glightbox-clean .gnext,.glightbox-clean .gprev{background-color:rgba(0,0,0,.32)}.glightbox-clean .gclose:hover,.glightbox-clean .gnext:hover,.glightbox-clean .gprev:hover{background-color:rgba(0,0,0,.7)}.glightbox-clean .gprev{top:45%}.glightbox-clean .gnext{top:45%}}@media (min-width:992px){.glightbox-clean .gclose{opacity:.7;right:20px}}@media screen and (max-height:420px){.goverlay{background:#000}}
_extensions/quarto-ext/lightbox/resources/js/glightbox.min.js ADDED
@@ -0,0 +1 @@
 
 
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).GLightbox=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}var s=Date.now();function l(){var e={},t=!0,i=0,n=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],i++);for(var s=function(i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t&&"[object Object]"===Object.prototype.toString.call(i[n])?e[n]=l(!0,e[n],i[n]):e[n]=i[n])};i<n;i++){var o=arguments[i];s(o)}return e}function o(e,t){if((k(e)||e===window||e===document)&&(e=[e]),A(e)||L(e)||(e=[e]),0!=P(e))if(A(e)&&!L(e))for(var i=e.length,n=0;n<i&&!1!==t.call(e[n],e[n],n,e);n++);else if(L(e))for(var s in e)if(O(e,s)&&!1===t.call(e[s],e[s],s,e))break}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=e[s]=e[s]||[],l={all:n,evt:null,found:null};return t&&i&&P(n)>0&&o(n,(function(e,n){if(e.eventName==t&&e.fn.toString()==i.toString())return l.found=!0,l.evt=n,!1})),l}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.onElement,n=t.withCallback,s=t.avoidDuplicate,l=void 0===s||s,a=t.once,h=void 0!==a&&a,d=t.useCapture,c=void 0!==d&&d,u=arguments.length>2?arguments[2]:void 0,g=i||[];function v(e){T(n)&&n.call(u,e,this),h&&v.destroy()}return C(g)&&(g=document.querySelectorAll(g)),v.destroy=function(){o(g,(function(t){var i=r(t,e,v);i.found&&i.all.splice(i.evt,1),t.removeEventListener&&t.removeEventListener(e,v,c)}))},o(g,(function(t){var i=r(t,e,v);(t.addEventListener&&l&&!i.found||!l)&&(t.addEventListener(e,v,c),i.all.push({eventName:e,fn:v}))})),v}function h(e,t){o(t.split(" "),(function(t){return e.classList.add(t)}))}function d(e,t){o(t.split(" "),(function(t){return e.classList.remove(t)}))}function c(e,t){return e.classList.contains(t)}function u(e,t){for(;e!==document.body;){if(!(e=e.parentElement))return!1;if("function"==typeof e.matches?e.matches(t):e.msMatchesSelector(t))return e}}function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||""===t)return!1;if("none"===t)return T(i)&&i(),!1;var n=x(),s=t.split(" ");o(s,(function(t){h(e,"g"+t)})),a(n,{onElement:e,avoidDuplicate:!1,once:!0,withCallback:function(e,t){o(s,(function(e){d(t,"g"+e)})),T(i)&&i()}})}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(""===t)return e.style.webkitTransform="",e.style.MozTransform="",e.style.msTransform="",e.style.OTransform="",e.style.transform="",!1;e.style.webkitTransform=t,e.style.MozTransform=t,e.style.msTransform=t,e.style.OTransform=t,e.style.transform=t}function f(e){e.style.display="block"}function p(e){e.style.display="none"}function m(e){var t=document.createDocumentFragment(),i=document.createElement("div");for(i.innerHTML=e;i.firstChild;)t.appendChild(i.firstChild);return t}function y(){return{width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}}function x(){var e,t=document.createElement("fakeelement"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}function b(e,t,i,n){if(e())t();else{var s;i||(i=100);var l=setInterval((function(){e()&&(clearInterval(l),s&&clearTimeout(s),t())}),i);n&&(s=setTimeout((function(){clearInterval(l)}),n))}}function S(e,t,i){if(I(e))console.error("Inject assets error");else if(T(t)&&(i=t,t=!1),C(t)&&t in window)T(i)&&i();else{var n;if(-1!==e.indexOf(".css")){if((n=document.querySelectorAll('link[href="'+e+'"]'))&&n.length>0)return void(T(i)&&i());var s=document.getElementsByTagName("head")[0],l=s.querySelectorAll('link[rel="stylesheet"]'),o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",o.href=e,o.media="all",l?s.insertBefore(o,l[0]):s.appendChild(o),void(T(i)&&i())}if((n=document.querySelectorAll('script[src="'+e+'"]'))&&n.length>0){if(T(i)){if(C(t))return b((function(){return void 0!==window[t]}),(function(){i()})),!1;i()}}else{var r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=function(){if(T(i)){if(C(t))return b((function(){return void 0!==window[t]}),(function(){i()})),!1;i()}},document.body.appendChild(r)}}}function w(){return"navigator"in window&&window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i)}function T(e){return"function"==typeof e}function C(e){return"string"==typeof e}function k(e){return!(!e||!e.nodeType||1!=e.nodeType)}function E(e){return Array.isArray(e)}function A(e){return e&&e.length&&isFinite(e.length)}function L(t){return"object"===e(t)&&null!=t&&!T(t)&&!E(t)}function I(e){return null==e}function O(e,t){return null!==e&&hasOwnProperty.call(e,t)}function P(e){if(L(e)){if(e.keys)return e.keys().length;var t=0;for(var i in e)O(e,i)&&t++;return t}return e.length}function M(e){return!isNaN(parseFloat(e))&&isFinite(e)}function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=document.querySelectorAll(".gbtn[data-taborder]:not(.disabled)");if(!t.length)return!1;if(1==t.length)return t[0];"string"==typeof e&&(e=parseInt(e));var i=[];o(t,(function(e){i.push(e.getAttribute("data-taborder"))}));var n=Math.max.apply(Math,i.map((function(e){return parseInt(e)}))),s=e<0?1:e+1;s>n&&(s="1");var l=i.filter((function(e){return e>=parseInt(s)})),r=l.sort()[0];return document.querySelector('.gbtn[data-taborder="'.concat(r,'"]'))}function X(e){if(e.events.hasOwnProperty("keyboard"))return!1;e.events.keyboard=a("keydown",{onElement:window,withCallback:function(t,i){var n=(t=t||window.event).keyCode;if(9==n){var s=document.querySelector(".gbtn.focused");if(!s){var l=!(!document.activeElement||!document.activeElement.nodeName)&&document.activeElement.nodeName.toLocaleLowerCase();if("input"==l||"textarea"==l||"button"==l)return}t.preventDefault();var o=document.querySelectorAll(".gbtn[data-taborder]");if(!o||o.length<=0)return;if(!s){var r=z();return void(r&&(r.focus(),h(r,"focused")))}var a=z(s.getAttribute("data-taborder"));d(s,"focused"),a&&(a.focus(),h(a,"focused"))}39==n&&e.nextSlide(),37==n&&e.prevSlide(),27==n&&e.close()}})}function Y(e){return Math.sqrt(e.x*e.x+e.y*e.y)}function q(e,t){var i=function(e,t){var i=Y(e)*Y(t);if(0===i)return 0;var n=function(e,t){return e.x*t.x+e.y*t.y}(e,t)/i;return n>1&&(n=1),Math.acos(n)}(e,t);return function(e,t){return e.x*t.y-t.x*e.y}(e,t)>0&&(i*=-1),180*i/Math.PI}var N=function(){function e(i){t(this,e),this.handlers=[],this.el=i}return n(e,[{key:"add",value:function(e){this.handlers.push(e)}},{key:"del",value:function(e){e||(this.handlers=[]);for(var t=this.handlers.length;t>=0;t--)this.handlers[t]===e&&this.handlers.splice(t,1)}},{key:"dispatch",value:function(){for(var e=0,t=this.handlers.length;e<t;e++){var i=this.handlers[e];"function"==typeof i&&i.apply(this.el,arguments)}}}]),e}();function D(e,t){var i=new N(e);return i.add(t),i}var _=function(){function e(i,n){t(this,e),this.element="string"==typeof i?document.querySelector(i):i,this.start=this.start.bind(this),this.move=this.move.bind(this),this.end=this.end.bind(this),this.cancel=this.cancel.bind(this),this.element.addEventListener("touchstart",this.start,!1),this.element.addEventListener("touchmove",this.move,!1),this.element.addEventListener("touchend",this.end,!1),this.element.addEventListener("touchcancel",this.cancel,!1),this.preV={x:null,y:null},this.pinchStartLen=null,this.zoom=1,this.isDoubleTap=!1;var s=function(){};this.rotate=D(this.element,n.rotate||s),this.touchStart=D(this.element,n.touchStart||s),this.multipointStart=D(this.element,n.multipointStart||s),this.multipointEnd=D(this.element,n.multipointEnd||s),this.pinch=D(this.element,n.pinch||s),this.swipe=D(this.element,n.swipe||s),this.tap=D(this.element,n.tap||s),this.doubleTap=D(this.element,n.doubleTap||s),this.longTap=D(this.element,n.longTap||s),this.singleTap=D(this.element,n.singleTap||s),this.pressMove=D(this.element,n.pressMove||s),this.twoFingerPressMove=D(this.element,n.twoFingerPressMove||s),this.touchMove=D(this.element,n.touchMove||s),this.touchEnd=D(this.element,n.touchEnd||s),this.touchCancel=D(this.element,n.touchCancel||s),this.translateContainer=this.element,this._cancelAllHandler=this.cancelAll.bind(this),window.addEventListener("scroll",this._cancelAllHandler),this.delta=null,this.last=null,this.now=null,this.tapTimeout=null,this.singleTapTimeout=null,this.longTapTimeout=null,this.swipeTimeout=null,this.x1=this.x2=this.y1=this.y2=null,this.preTapPosition={x:null,y:null}}return n(e,[{key:"start",value:function(e){if(e.touches){if(e.target&&e.target.nodeName&&["a","button","input"].indexOf(e.target.nodeName.toLowerCase())>=0)console.log("ignore drag for this touched element",e.target.nodeName.toLowerCase());else{this.now=Date.now(),this.x1=e.touches[0].pageX,this.y1=e.touches[0].pageY,this.delta=this.now-(this.last||this.now),this.touchStart.dispatch(e,this.element),null!==this.preTapPosition.x&&(this.isDoubleTap=this.delta>0&&this.delta<=250&&Math.abs(this.preTapPosition.x-this.x1)<30&&Math.abs(this.preTapPosition.y-this.y1)<30,this.isDoubleTap&&clearTimeout(this.singleTapTimeout)),this.preTapPosition.x=this.x1,this.preTapPosition.y=this.y1,this.last=this.now;var t=this.preV;if(e.touches.length>1){this._cancelLongTap(),this._cancelSingleTap();var i={x:e.touches[1].pageX-this.x1,y:e.touches[1].pageY-this.y1};t.x=i.x,t.y=i.y,this.pinchStartLen=Y(t),this.multipointStart.dispatch(e,this.element)}this._preventTap=!1,this.longTapTimeout=setTimeout(function(){this.longTap.dispatch(e,this.element),this._preventTap=!0}.bind(this),750)}}}},{key:"move",value:function(e){if(e.touches){var t=this.preV,i=e.touches.length,n=e.touches[0].pageX,s=e.touches[0].pageY;if(this.isDoubleTap=!1,i>1){var l=e.touches[1].pageX,o=e.touches[1].pageY,r={x:e.touches[1].pageX-n,y:e.touches[1].pageY-s};null!==t.x&&(this.pinchStartLen>0&&(e.zoom=Y(r)/this.pinchStartLen,this.pinch.dispatch(e,this.element)),e.angle=q(r,t),this.rotate.dispatch(e,this.element)),t.x=r.x,t.y=r.y,null!==this.x2&&null!==this.sx2?(e.deltaX=(n-this.x2+l-this.sx2)/2,e.deltaY=(s-this.y2+o-this.sy2)/2):(e.deltaX=0,e.deltaY=0),this.twoFingerPressMove.dispatch(e,this.element),this.sx2=l,this.sy2=o}else{if(null!==this.x2){e.deltaX=n-this.x2,e.deltaY=s-this.y2;var a=Math.abs(this.x1-this.x2),h=Math.abs(this.y1-this.y2);(a>10||h>10)&&(this._preventTap=!0)}else e.deltaX=0,e.deltaY=0;this.pressMove.dispatch(e,this.element)}this.touchMove.dispatch(e,this.element),this._cancelLongTap(),this.x2=n,this.y2=s,i>1&&e.preventDefault()}}},{key:"end",value:function(e){if(e.changedTouches){this._cancelLongTap();var t=this;e.touches.length<2&&(this.multipointEnd.dispatch(e,this.element),this.sx2=this.sy2=null),this.x2&&Math.abs(this.x1-this.x2)>30||this.y2&&Math.abs(this.y1-this.y2)>30?(e.direction=this._swipeDirection(this.x1,this.x2,this.y1,this.y2),this.swipeTimeout=setTimeout((function(){t.swipe.dispatch(e,t.element)}),0)):(this.tapTimeout=setTimeout((function(){t._preventTap||t.tap.dispatch(e,t.element),t.isDoubleTap&&(t.doubleTap.dispatch(e,t.element),t.isDoubleTap=!1)}),0),t.isDoubleTap||(t.singleTapTimeout=setTimeout((function(){t.singleTap.dispatch(e,t.element)}),250))),this.touchEnd.dispatch(e,this.element),this.preV.x=0,this.preV.y=0,this.zoom=1,this.pinchStartLen=null,this.x1=this.x2=this.y1=this.y2=null}}},{key:"cancelAll",value:function(){this._preventTap=!0,clearTimeout(this.singleTapTimeout),clearTimeout(this.tapTimeout),clearTimeout(this.longTapTimeout),clearTimeout(this.swipeTimeout)}},{key:"cancel",value:function(e){this.cancelAll(),this.touchCancel.dispatch(e,this.element)}},{key:"_cancelLongTap",value:function(){clearTimeout(this.longTapTimeout)}},{key:"_cancelSingleTap",value:function(){clearTimeout(this.singleTapTimeout)}},{key:"_swipeDirection",value:function(e,t,i,n){return Math.abs(e-t)>=Math.abs(i-n)?e-t>0?"Left":"Right":i-n>0?"Up":"Down"}},{key:"on",value:function(e,t){this[e]&&this[e].add(t)}},{key:"off",value:function(e,t){this[e]&&this[e].del(t)}},{key:"destroy",value:function(){return this.singleTapTimeout&&clearTimeout(this.singleTapTimeout),this.tapTimeout&&clearTimeout(this.tapTimeout),this.longTapTimeout&&clearTimeout(this.longTapTimeout),this.swipeTimeout&&clearTimeout(this.swipeTimeout),this.element.removeEventListener("touchstart",this.start),this.element.removeEventListener("touchmove",this.move),this.element.removeEventListener("touchend",this.end),this.element.removeEventListener("touchcancel",this.cancel),this.rotate.del(),this.touchStart.del(),this.multipointStart.del(),this.multipointEnd.del(),this.pinch.del(),this.swipe.del(),this.tap.del(),this.doubleTap.del(),this.longTap.del(),this.singleTap.del(),this.pressMove.del(),this.twoFingerPressMove.del(),this.touchMove.del(),this.touchEnd.del(),this.touchCancel.del(),this.preV=this.pinchStartLen=this.zoom=this.isDoubleTap=this.delta=this.last=this.now=this.tapTimeout=this.singleTapTimeout=this.longTapTimeout=this.swipeTimeout=this.x1=this.x2=this.y1=this.y2=this.preTapPosition=this.rotate=this.touchStart=this.multipointStart=this.multipointEnd=this.pinch=this.swipe=this.tap=this.doubleTap=this.longTap=this.singleTap=this.pressMove=this.touchMove=this.touchEnd=this.touchCancel=this.twoFingerPressMove=null,window.removeEventListener("scroll",this._cancelAllHandler),null}}]),e}();function W(e){var t=function(){var e,t=document.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}(),i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=c(e,"gslide-media")?e:e.querySelector(".gslide-media"),s=u(n,".ginner-container"),l=e.querySelector(".gslide-description");i>769&&(n=s),h(n,"greset"),v(n,"translate3d(0, 0, 0)"),a(t,{onElement:n,once:!0,withCallback:function(e,t){d(n,"greset")}}),n.style.opacity="",l&&(l.style.opacity="")}function B(e){if(e.events.hasOwnProperty("touch"))return!1;var t,i,n,s=y(),l=s.width,o=s.height,r=!1,a=null,g=null,f=null,p=!1,m=1,x=1,b=!1,S=!1,w=null,T=null,C=null,k=null,E=0,A=0,L=!1,I=!1,O={},P={},M=0,z=0,X=document.getElementById("glightbox-slider"),Y=document.querySelector(".goverlay"),q=new _(X,{touchStart:function(t){if(r=!0,(c(t.targetTouches[0].target,"ginner-container")||u(t.targetTouches[0].target,".gslide-desc")||"a"==t.targetTouches[0].target.nodeName.toLowerCase())&&(r=!1),u(t.targetTouches[0].target,".gslide-inline")&&!c(t.targetTouches[0].target.parentNode,"gslide-inline")&&(r=!1),r){if(P=t.targetTouches[0],O.pageX=t.targetTouches[0].pageX,O.pageY=t.targetTouches[0].pageY,M=t.targetTouches[0].clientX,z=t.targetTouches[0].clientY,a=e.activeSlide,g=a.querySelector(".gslide-media"),n=a.querySelector(".gslide-inline"),f=null,c(g,"gslide-image")&&(f=g.querySelector("img")),(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)>769&&(g=a.querySelector(".ginner-container")),d(Y,"greset"),t.pageX>20&&t.pageX<window.innerWidth-20)return;t.preventDefault()}},touchMove:function(s){if(r&&(P=s.targetTouches[0],!b&&!S)){if(n&&n.offsetHeight>o){var a=O.pageX-P.pageX;if(Math.abs(a)<=13)return!1}p=!0;var h,d=s.targetTouches[0].clientX,c=s.targetTouches[0].clientY,u=M-d,m=z-c;if(Math.abs(u)>Math.abs(m)?(L=!1,I=!0):(I=!1,L=!0),t=P.pageX-O.pageX,E=100*t/l,i=P.pageY-O.pageY,A=100*i/o,L&&f&&(h=1-Math.abs(i)/o,Y.style.opacity=h,e.settings.touchFollowAxis&&(E=0)),I&&(h=1-Math.abs(t)/l,g.style.opacity=h,e.settings.touchFollowAxis&&(A=0)),!f)return v(g,"translate3d(".concat(E,"%, 0, 0)"));v(g,"translate3d(".concat(E,"%, ").concat(A,"%, 0)"))}},touchEnd:function(){if(r){if(p=!1,S||b)return C=w,void(k=T);var t=Math.abs(parseInt(A)),i=Math.abs(parseInt(E));if(!(t>29&&f))return t<29&&i<25?(h(Y,"greset"),Y.style.opacity=1,W(g)):void 0;e.close()}},multipointEnd:function(){setTimeout((function(){b=!1}),50)},multipointStart:function(){b=!0,m=x||1},pinch:function(e){if(!f||p)return!1;b=!0,f.scaleX=f.scaleY=m*e.zoom;var t=m*e.zoom;if(S=!0,t<=1)return S=!1,t=1,k=null,C=null,w=null,T=null,void f.setAttribute("style","");t>4.5&&(t=4.5),f.style.transform="scale3d(".concat(t,", ").concat(t,", 1)"),x=t},pressMove:function(e){if(S&&!b){var t=P.pageX-O.pageX,i=P.pageY-O.pageY;C&&(t+=C),k&&(i+=k),w=t,T=i;var n="translate3d(".concat(t,"px, ").concat(i,"px, 0)");x&&(n+=" scale3d(".concat(x,", ").concat(x,", 1)")),v(f,n)}},swipe:function(t){if(!S)if(b)b=!1;else{if("Left"==t.direction){if(e.index==e.elements.length-1)return W(g);e.nextSlide()}if("Right"==t.direction){if(0==e.index)return W(g);e.prevSlide()}}}});e.events.touch=q}var H=function(){function e(i,n){var s=this,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t(this,e),this.img=i,this.slide=n,this.onclose=l,this.img.setZoomEvents)return!1;this.active=!1,this.zoomedIn=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.img.addEventListener("mousedown",(function(e){return s.dragStart(e)}),!1),this.img.addEventListener("mouseup",(function(e){return s.dragEnd(e)}),!1),this.img.addEventListener("mousemove",(function(e){return s.drag(e)}),!1),this.img.addEventListener("click",(function(e){return s.slide.classList.contains("dragging-nav")?(s.zoomOut(),!1):s.zoomedIn?void(s.zoomedIn&&!s.dragging&&s.zoomOut()):s.zoomIn()}),!1),this.img.setZoomEvents=!0}return n(e,[{key:"zoomIn",value:function(){var e=this.widowWidth();if(!(this.zoomedIn||e<=768)){var t=this.img;if(t.setAttribute("data-style",t.getAttribute("style")),t.style.maxWidth=t.naturalWidth+"px",t.style.maxHeight=t.naturalHeight+"px",t.naturalWidth>e){var i=e/2-t.naturalWidth/2;this.setTranslate(this.img.parentNode,i,0)}this.slide.classList.add("zoomed"),this.zoomedIn=!0}}},{key:"zoomOut",value:function(){this.img.parentNode.setAttribute("style",""),this.img.setAttribute("style",this.img.getAttribute("data-style")),this.slide.classList.remove("zoomed"),this.zoomedIn=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.onclose&&"function"==typeof this.onclose&&this.onclose()}},{key:"dragStart",value:function(e){e.preventDefault(),this.zoomedIn?("touchstart"===e.type?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset),e.target===this.img&&(this.active=!0,this.img.classList.add("dragging"))):this.active=!1}},{key:"dragEnd",value:function(e){var t=this;e.preventDefault(),this.initialX=this.currentX,this.initialY=this.currentY,this.active=!1,setTimeout((function(){t.dragging=!1,t.img.isDragging=!1,t.img.classList.remove("dragging")}),100)}},{key:"drag",value:function(e){this.active&&(e.preventDefault(),"touchmove"===e.type?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.img.isDragging=!0,this.dragging=!0,this.setTranslate(this.img,this.currentX,this.currentY))}},{key:"onMove",value:function(e){if(this.zoomedIn){var t=e.clientX-this.img.naturalWidth/2,i=e.clientY-this.img.naturalHeight/2;this.setTranslate(this.img,t,i)}}},{key:"setTranslate",value:function(e,t,i){e.style.transform="translate3d("+t+"px, "+i+"px, 0)"}},{key:"widowWidth",value:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}}]),e}(),V=function(){function e(){var i=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e);var s=n.dragEl,l=n.toleranceX,o=void 0===l?40:l,r=n.toleranceY,a=void 0===r?65:r,h=n.slide,d=void 0===h?null:h,c=n.instance,u=void 0===c?null:c;this.el=s,this.active=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.direction=null,this.lastDirection=null,this.toleranceX=o,this.toleranceY=a,this.toleranceReached=!1,this.dragContainer=this.el,this.slide=d,this.instance=u,this.el.addEventListener("mousedown",(function(e){return i.dragStart(e)}),!1),this.el.addEventListener("mouseup",(function(e){return i.dragEnd(e)}),!1),this.el.addEventListener("mousemove",(function(e){return i.drag(e)}),!1)}return n(e,[{key:"dragStart",value:function(e){if(this.slide.classList.contains("zoomed"))this.active=!1;else{"touchstart"===e.type?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset);var t=e.target.nodeName.toLowerCase();e.target.classList.contains("nodrag")||u(e.target,".nodrag")||-1!==["input","select","textarea","button","a"].indexOf(t)?this.active=!1:(e.preventDefault(),(e.target===this.el||"img"!==t&&u(e.target,".gslide-inline"))&&(this.active=!0,this.el.classList.add("dragging"),this.dragContainer=u(e.target,".ginner-container")))}}},{key:"dragEnd",value:function(e){var t=this;e&&e.preventDefault(),this.initialX=0,this.initialY=0,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.active=!1,this.doSlideChange&&(this.instance.preventOutsideClick=!0,"right"==this.doSlideChange&&this.instance.prevSlide(),"left"==this.doSlideChange&&this.instance.nextSlide()),this.doSlideClose&&this.instance.close(),this.toleranceReached||this.setTranslate(this.dragContainer,0,0,!0),setTimeout((function(){t.instance.preventOutsideClick=!1,t.toleranceReached=!1,t.lastDirection=null,t.dragging=!1,t.el.isDragging=!1,t.el.classList.remove("dragging"),t.slide.classList.remove("dragging-nav"),t.dragContainer.style.transform="",t.dragContainer.style.transition=""}),100)}},{key:"drag",value:function(e){if(this.active){e.preventDefault(),this.slide.classList.add("dragging-nav"),"touchmove"===e.type?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.el.isDragging=!0,this.dragging=!0,this.doSlideChange=!1,this.doSlideClose=!1;var t=Math.abs(this.currentX),i=Math.abs(this.currentY);if(t>0&&t>=Math.abs(this.currentY)&&(!this.lastDirection||"x"==this.lastDirection)){this.yOffset=0,this.lastDirection="x",this.setTranslate(this.dragContainer,this.currentX,0);var n=this.shouldChange();if(!this.instance.settings.dragAutoSnap&&n&&(this.doSlideChange=n),this.instance.settings.dragAutoSnap&&n)return this.instance.preventOutsideClick=!0,this.toleranceReached=!0,this.active=!1,this.instance.preventOutsideClick=!0,this.dragEnd(null),"right"==n&&this.instance.prevSlide(),void("left"==n&&this.instance.nextSlide())}if(this.toleranceY>0&&i>0&&i>=t&&(!this.lastDirection||"y"==this.lastDirection)){this.xOffset=0,this.lastDirection="y",this.setTranslate(this.dragContainer,0,this.currentY);var s=this.shouldClose();return!this.instance.settings.dragAutoSnap&&s&&(this.doSlideClose=!0),void(this.instance.settings.dragAutoSnap&&s&&this.instance.close())}}}},{key:"shouldChange",value:function(){var e=!1;if(Math.abs(this.currentX)>=this.toleranceX){var t=this.currentX>0?"right":"left";("left"==t&&this.slide!==this.slide.parentNode.lastChild||"right"==t&&this.slide!==this.slide.parentNode.firstChild)&&(e=t)}return e}},{key:"shouldClose",value:function(){var e=!1;return Math.abs(this.currentY)>=this.toleranceY&&(e=!0),e}},{key:"setTranslate",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.style.transition=n?"all .2s ease":"",e.style.transform="translate3d(".concat(t,"px, ").concat(i,"px, 0)")}}]),e}();function j(e,t,i,n){var s=e.querySelector(".gslide-media"),l=new Image,o="gSlideTitle_"+i,r="gSlideDesc_"+i;l.addEventListener("load",(function(){T(n)&&n()}),!1),l.src=t.href,""!=t.sizes&&""!=t.srcset&&(l.sizes=t.sizes,l.srcset=t.srcset),l.alt="",I(t.alt)||""===t.alt||(l.alt=t.alt),""!==t.title&&l.setAttribute("aria-labelledby",o),""!==t.description&&l.setAttribute("aria-describedby",r),t.hasOwnProperty("_hasCustomWidth")&&t._hasCustomWidth&&(l.style.width=t.width),t.hasOwnProperty("_hasCustomHeight")&&t._hasCustomHeight&&(l.style.height=t.height),s.insertBefore(l,s.firstChild)}function F(e,t,i,n){var s=this,l=e.querySelector(".ginner-container"),o="gvideo"+i,r=e.querySelector(".gslide-media"),a=this.getAllPlayers();h(l,"gvideo-container"),r.insertBefore(m('<div class="gvideo-wrapper"></div>'),r.firstChild);var d=e.querySelector(".gvideo-wrapper");S(this.settings.plyr.css,"Plyr");var c=t.href,u=null==t?void 0:t.videoProvider,g=!1;r.style.maxWidth=t.width,S(this.settings.plyr.js,"Plyr",(function(){if(!u&&c.match(/vimeo\.com\/([0-9]*)/)&&(u="vimeo"),!u&&(c.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||c.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||c.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/))&&(u="youtube"),"local"===u||!u){u="local";var l='<video id="'+o+'" ';l+='style="background:#000; max-width: '.concat(t.width,';" '),l+='preload="metadata" ',l+='x-webkit-airplay="allow" ',l+="playsinline ",l+="controls ",l+='class="gvideo-local">',l+='<source src="'.concat(c,'">'),g=m(l+="</video>")}var r=g||m('<div id="'.concat(o,'" data-plyr-provider="').concat(u,'" data-plyr-embed-id="').concat(c,'"></div>'));h(d,"".concat(u,"-video gvideo")),d.appendChild(r),d.setAttribute("data-id",o),d.setAttribute("data-index",i);var v=O(s.settings.plyr,"config")?s.settings.plyr.config:{},f=new Plyr("#"+o,v);f.on("ready",(function(e){a[o]=e.detail.plyr,T(n)&&n()})),b((function(){return e.querySelector("iframe")&&"true"==e.querySelector("iframe").dataset.ready}),(function(){s.resize(e)})),f.on("enterfullscreen",R),f.on("exitfullscreen",R)}))}function R(e){var t=u(e.target,".gslide-media");"enterfullscreen"===e.type&&h(t,"fullscreen"),"exitfullscreen"===e.type&&d(t,"fullscreen")}function G(e,t,i,n){var s,l=this,o=e.querySelector(".gslide-media"),r=!(!O(t,"href")||!t.href)&&t.href.split("#").pop().trim(),d=!(!O(t,"content")||!t.content)&&t.content;if(d&&(C(d)&&(s=m('<div class="ginlined-content">'.concat(d,"</div>"))),k(d))){"none"==d.style.display&&(d.style.display="block");var c=document.createElement("div");c.className="ginlined-content",c.appendChild(d),s=c}if(r){var u=document.getElementById(r);if(!u)return!1;var g=u.cloneNode(!0);g.style.height=t.height,g.style.maxWidth=t.width,h(g,"ginlined-content"),s=g}if(!s)return console.error("Unable to append inline slide content",t),!1;o.style.height=t.height,o.style.width=t.width,o.appendChild(s),this.events["inlineclose"+r]=a("click",{onElement:o.querySelectorAll(".gtrigger-close"),withCallback:function(e){e.preventDefault(),l.close()}}),T(n)&&n()}function Z(e,t,i,n){var s=e.querySelector(".gslide-media"),l=function(e){var t=e.url,i=e.allow,n=e.callback,s=e.appendTo,l=document.createElement("iframe");return l.className="vimeo-video gvideo",l.src=t,l.style.width="100%",l.style.height="100%",i&&l.setAttribute("allow",i),l.onload=function(){l.onload=null,h(l,"node-ready"),T(n)&&n()},s&&s.appendChild(l),l}({url:t.href,callback:n});s.parentNode.style.maxWidth=t.width,s.parentNode.style.height=t.height,s.appendChild(l)}var U=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),this.defaults={href:"",sizes:"",srcset:"",title:"",type:"",videoProvider:"",description:"",alt:"",descPosition:"bottom",effect:"",width:"",height:"",content:!1,zoomable:!0,draggable:!0},L(i)&&(this.defaults=l(this.defaults,i))}return n(e,[{key:"sourceType",value:function(e){var t=e;if(null!==(e=e.toLowerCase()).match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/))return"image";if(e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/))return"video";if(e.match(/vimeo\.com\/([0-9]*)/))return"video";if(null!==e.match(/\.(mp4|ogg|webm|mov)/))return"video";if(null!==e.match(/\.(mp3|wav|wma|aac|ogg)/))return"audio";if(e.indexOf("#")>-1&&""!==t.split("#").pop().trim())return"inline";return e.indexOf("goajax=true")>-1?"ajax":"external"}},{key:"parseConfig",value:function(e,t){var i=this,n=l({descPosition:t.descPosition},this.defaults);if(L(e)&&!k(e)){O(e,"type")||(O(e,"content")&&e.content?e.type="inline":O(e,"href")&&(e.type=this.sourceType(e.href)));var s=l(n,e);return this.setSize(s,t),s}var r="",a=e.getAttribute("data-glightbox"),h=e.nodeName.toLowerCase();if("a"===h&&(r=e.href),"img"===h&&(r=e.src,n.alt=e.alt),n.href=r,o(n,(function(s,l){O(t,l)&&"width"!==l&&(n[l]=t[l]);var o=e.dataset[l];I(o)||(n[l]=i.sanitizeValue(o))})),n.content&&(n.type="inline"),!n.type&&r&&(n.type=this.sourceType(r)),I(a)){if(!n.title&&"a"==h){var d=e.title;I(d)||""===d||(n.title=d)}if(!n.title&&"img"==h){var c=e.alt;I(c)||""===c||(n.title=c)}}else{var u=[];o(n,(function(e,t){u.push(";\\s?"+t)})),u=u.join("\\s?:|"),""!==a.trim()&&o(n,(function(e,t){var s=a,l=new RegExp("s?"+t+"s?:s?(.*?)("+u+"s?:|$)"),o=s.match(l);if(o&&o.length&&o[1]){var r=o[1].trim().replace(/;\s*$/,"");n[t]=i.sanitizeValue(r)}}))}if(n.description&&"."===n.description.substring(0,1)){var g;try{g=document.querySelector(n.description).innerHTML}catch(e){if(!(e instanceof DOMException))throw e}g&&(n.description=g)}if(!n.description){var v=e.querySelector(".glightbox-desc");v&&(n.description=v.innerHTML)}return this.setSize(n,t,e),this.slideConfig=n,n}},{key:"setSize",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n="video"==e.type?this.checkSize(t.videosWidth):this.checkSize(t.width),s=this.checkSize(t.height);return e.width=O(e,"width")&&""!==e.width?this.checkSize(e.width):n,e.height=O(e,"height")&&""!==e.height?this.checkSize(e.height):s,i&&"image"==e.type&&(e._hasCustomWidth=!!i.dataset.width,e._hasCustomHeight=!!i.dataset.height),e}},{key:"checkSize",value:function(e){return M(e)?"".concat(e,"px"):e}},{key:"sanitizeValue",value:function(e){return"true"!==e&&"false"!==e?e:"true"===e}}]),e}(),$=function(){function e(i,n,s){t(this,e),this.element=i,this.instance=n,this.index=s}return n(e,[{key:"setContent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(c(t,"loaded"))return!1;var n=this.instance.settings,s=this.slideConfig,l=w();T(n.beforeSlideLoad)&&n.beforeSlideLoad({index:this.index,slide:t,player:!1});var o=s.type,r=s.descPosition,a=t.querySelector(".gslide-media"),d=t.querySelector(".gslide-title"),u=t.querySelector(".gslide-desc"),g=t.querySelector(".gdesc-inner"),v=i,f="gSlideTitle_"+this.index,p="gSlideDesc_"+this.index;if(T(n.afterSlideLoad)&&(v=function(){T(i)&&i(),n.afterSlideLoad({index:e.index,slide:t,player:e.instance.getSlidePlayerInstance(e.index)})}),""==s.title&&""==s.description?g&&g.parentNode.parentNode.removeChild(g.parentNode):(d&&""!==s.title?(d.id=f,d.innerHTML=s.title):d.parentNode.removeChild(d),u&&""!==s.description?(u.id=p,l&&n.moreLength>0?(s.smallDescription=this.slideShortDesc(s.description,n.moreLength,n.moreText),u.innerHTML=s.smallDescription,this.descriptionEvents(u,s)):u.innerHTML=s.description):u.parentNode.removeChild(u),h(a.parentNode,"desc-".concat(r)),h(g.parentNode,"description-".concat(r))),h(a,"gslide-".concat(o)),h(t,"loaded"),"video"!==o){if("external"!==o)return"inline"===o?(G.apply(this.instance,[t,s,this.index,v]),void(s.draggable&&new V({dragEl:t.querySelector(".gslide-inline"),toleranceX:n.dragToleranceX,toleranceY:n.dragToleranceY,slide:t,instance:this.instance}))):void("image"!==o?T(v)&&v():j(t,s,this.index,(function(){var i=t.querySelector("img");s.draggable&&new V({dragEl:i,toleranceX:n.dragToleranceX,toleranceY:n.dragToleranceY,slide:t,instance:e.instance}),s.zoomable&&i.naturalWidth>i.offsetWidth&&(h(i,"zoomable"),new H(i,t,(function(){e.instance.resize()}))),T(v)&&v()})));Z.apply(this,[t,s,this.index,v])}else F.apply(this.instance,[t,s,this.index,v])}},{key:"slideShortDesc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("div");n.innerHTML=e;var s=n.innerText,l=i;if((e=s.trim()).length<=t)return e;var o=e.substr(0,t-1);return l?(n=null,o+'... <a href="#" class="desc-more">'+i+"</a>"):o}},{key:"descriptionEvents",value:function(e,t){var i=this,n=e.querySelector(".desc-more");if(!n)return!1;a("click",{onElement:n,withCallback:function(e,n){e.preventDefault();var s=document.body,l=u(n,".gslide-desc");if(!l)return!1;l.innerHTML=t.description,h(s,"gdesc-open");var o=a("click",{onElement:[s,u(l,".gslide-description")],withCallback:function(e,n){"a"!==e.target.nodeName.toLowerCase()&&(d(s,"gdesc-open"),h(s,"gdesc-closed"),l.innerHTML=t.smallDescription,i.descriptionEvents(l,t),setTimeout((function(){d(s,"gdesc-closed")}),400),o.destroy())}})}})}},{key:"create",value:function(){return m(this.instance.settings.slideHTML)}},{key:"getConfig",value:function(){k(this.element)||this.element.hasOwnProperty("draggable")||(this.element.draggable=this.instance.settings.draggable);var e=new U(this.instance.settings.slideExtraAttributes);return this.slideConfig=e.parseConfig(this.element,this.instance.settings),this.slideConfig}}]),e}(),J=w(),K=null!==w()||void 0!==document.createTouch||"ontouchstart"in window||"onmsgesturechange"in window||navigator.msMaxTouchPoints,Q=document.getElementsByTagName("html")[0],ee={selector:".glightbox",elements:null,skin:"clean",theme:"clean",closeButton:!0,startAt:null,autoplayVideos:!0,autofocusVideos:!0,descPosition:"bottom",width:"900px",height:"506px",videosWidth:"960px",beforeSlideChange:null,afterSlideChange:null,beforeSlideLoad:null,afterSlideLoad:null,slideInserted:null,slideRemoved:null,slideExtraAttributes:null,onOpen:null,onClose:null,loop:!1,zoomable:!0,draggable:!0,dragAutoSnap:!1,dragToleranceX:40,dragToleranceY:65,preload:!0,oneSlidePerOpen:!1,touchNavigation:!0,touchFollowAxis:!0,keyboardNavigation:!0,closeOnOutsideClick:!0,plugins:!1,plyr:{css:"https://cdn.plyr.io/3.6.12/plyr.css",js:"https://cdn.plyr.io/3.6.12/plyr.js",config:{ratio:"16:9",fullscreen:{enabled:!0,iosNative:!0},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3},vimeo:{byline:!1,portrait:!1,title:!1,transparent:!1}}},openEffect:"zoom",closeEffect:"zoom",slideEffect:"slide",moreText:"See more",moreLength:60,cssEfects:{fade:{in:"fadeIn",out:"fadeOut"},zoom:{in:"zoomIn",out:"zoomOut"},slide:{in:"slideInRight",out:"slideOutLeft"},slideBack:{in:"slideInLeft",out:"slideOutRight"},none:{in:"none",out:"none"}},svg:{close:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"><g><g><path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306C514.019,27.23,514.019,14.135,505.943,6.058z"/></g></g><g><g><path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/></g></g></svg>',next:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"> <g><path d="M360.731,229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1,0s-5.3,13.8,0,19.1l215.5,215.5l-215.5,215.5c-5.3,5.3-5.3,13.8,0,19.1c2.6,2.6,6.1,4,9.5,4c3.4,0,6.9-1.3,9.5-4l225.1-225.1C365.931,242.875,365.931,234.275,360.731,229.075z"/></g></svg>',prev:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"><g><path d="M145.188,238.575l215.5-215.5c5.3-5.3,5.3-13.8,0-19.1s-13.8-5.3-19.1,0l-225.1,225.1c-5.3,5.3-5.3,13.8,0,19.1l225.1,225c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4c5.3-5.3,5.3-13.8,0-19.1L145.188,238.575z"/></g></svg>'},slideHTML:'<div class="gslide">\n <div class="gslide-inner-content">\n <div class="ginner-container">\n <div class="gslide-media">\n </div>\n <div class="gslide-description">\n <div class="gdesc-inner">\n <h4 class="gslide-title"></h4>\n <div class="gslide-desc"></div>\n </div>\n </div>\n </div>\n </div>\n</div>',lightboxHTML:'<div id="glightbox-body" class="glightbox-container" tabindex="-1" role="dialog" aria-hidden="false">\n <div class="gloader visible"></div>\n <div class="goverlay"></div>\n <div class="gcontainer">\n <div id="glightbox-slider" class="gslider"></div>\n <button class="gclose gbtn" aria-label="Close" data-taborder="3">{closeSVG}</button>\n <button class="gprev gbtn" aria-label="Previous" data-taborder="2">{prevSVG}</button>\n <button class="gnext gbtn" aria-label="Next" data-taborder="1">{nextSVG}</button>\n</div>\n</div>'},te=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),this.customOptions=i,this.settings=l(ee,i),this.effectsClasses=this.getAnimationClasses(),this.videoPlayers={},this.apiEvents=[],this.fullElementsList=!1}return n(e,[{key:"init",value:function(){var e=this,t=this.getSelector();t&&(this.baseEvents=a("click",{onElement:t,withCallback:function(t,i){t.preventDefault(),e.open(i)}})),this.elements=this.getElements()}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(0===this.elements.length)return!1;this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null;var i=M(t)?t:this.settings.startAt;if(k(e)){var n=e.getAttribute("data-gallery");n&&(this.fullElementsList=this.elements,this.elements=this.getGalleryElements(this.elements,n)),I(i)&&(i=this.getElementIndex(e))<0&&(i=0)}M(i)||(i=0),this.build(),g(this.overlay,"none"===this.settings.openEffect?"none":this.settings.cssEfects.fade.in);var s=document.body,l=window.innerWidth-document.documentElement.clientWidth;if(l>0){var o=document.createElement("style");o.type="text/css",o.className="gcss-styles",o.innerText=".gscrollbar-fixer {margin-right: ".concat(l,"px}"),document.head.appendChild(o),h(s,"gscrollbar-fixer")}h(s,"glightbox-open"),h(Q,"glightbox-open"),J&&(h(document.body,"glightbox-mobile"),this.settings.slideEffect="slide"),this.showSlide(i,!0),1===this.elements.length?(h(this.prevButton,"glightbox-button-hidden"),h(this.nextButton,"glightbox-button-hidden")):(d(this.prevButton,"glightbox-button-hidden"),d(this.nextButton,"glightbox-button-hidden")),this.lightboxOpen=!0,this.trigger("open"),T(this.settings.onOpen)&&this.settings.onOpen(),K&&this.settings.touchNavigation&&B(this),this.settings.keyboardNavigation&&X(this)}},{key:"openAt",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.open(null,e)}},{key:"showSlide",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];f(this.loader),this.index=parseInt(t);var n=this.slidesContainer.querySelector(".current");n&&d(n,"current"),this.slideAnimateOut();var s=this.slidesContainer.querySelectorAll(".gslide")[t];if(c(s,"loaded"))this.slideAnimateIn(s,i),p(this.loader);else{f(this.loader);var l=this.elements[t],o={index:this.index,slide:s,slideNode:s,slideConfig:l.slideConfig,slideIndex:this.index,trigger:l.node,player:null};this.trigger("slide_before_load",o),l.instance.setContent(s,(function(){p(e.loader),e.resize(),e.slideAnimateIn(s,i),e.trigger("slide_after_load",o)}))}this.slideDescription=s.querySelector(".gslide-description"),this.slideDescriptionContained=this.slideDescription&&c(this.slideDescription.parentNode,"gslide-media"),this.settings.preload&&(this.preloadSlide(t+1),this.preloadSlide(t-1)),this.updateNavigationClasses(),this.activeSlide=s}},{key:"preloadSlide",value:function(e){var t=this;if(e<0||e>this.elements.length-1)return!1;if(I(this.elements[e]))return!1;var i=this.slidesContainer.querySelectorAll(".gslide")[e];if(c(i,"loaded"))return!1;var n=this.elements[e],s=n.type,l={index:e,slide:i,slideNode:i,slideConfig:n.slideConfig,slideIndex:e,trigger:n.node,player:null};this.trigger("slide_before_load",l),"video"===s||"external"===s?setTimeout((function(){n.instance.setContent(i,(function(){t.trigger("slide_after_load",l)}))}),200):n.instance.setContent(i,(function(){t.trigger("slide_after_load",l)}))}},{key:"prevSlide",value:function(){this.goToSlide(this.index-1)}},{key:"nextSlide",value:function(){this.goToSlide(this.index+1)}},{key:"goToSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.prevActiveSlide=this.activeSlide,this.prevActiveSlideIndex=this.index,!this.loop()&&(e<0||e>this.elements.length-1))return!1;e<0?e=this.elements.length-1:e>=this.elements.length&&(e=0),this.showSlide(e)}},{key:"insertSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;t<0&&(t=this.elements.length);var i=new $(e,this,t),n=i.getConfig(),s=l({},n),o=i.create(),r=this.elements.length-1;s.index=t,s.node=!1,s.instance=i,s.slideConfig=n,this.elements.splice(t,0,s);var a=null,h=null;if(this.slidesContainer){if(t>r)this.slidesContainer.appendChild(o);else{var d=this.slidesContainer.querySelectorAll(".gslide")[t];this.slidesContainer.insertBefore(o,d)}(this.settings.preload&&0==this.index&&0==t||this.index-1==t||this.index+1==t)&&this.preloadSlide(t),0===this.index&&0===t&&(this.index=1),this.updateNavigationClasses(),a=this.slidesContainer.querySelectorAll(".gslide")[t],h=this.getSlidePlayerInstance(t),s.slideNode=a}this.trigger("slide_inserted",{index:t,slide:a,slideNode:a,slideConfig:n,slideIndex:t,trigger:null,player:h}),T(this.settings.slideInserted)&&this.settings.slideInserted({index:t,slide:a,player:h})}},{key:"removeSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(e<0||e>this.elements.length-1)return!1;var t=this.slidesContainer&&this.slidesContainer.querySelectorAll(".gslide")[e];t&&(this.getActiveSlideIndex()==e&&(e==this.elements.length-1?this.prevSlide():this.nextSlide()),t.parentNode.removeChild(t)),this.elements.splice(e,1),this.trigger("slide_removed",e),T(this.settings.slideRemoved)&&this.settings.slideRemoved(e)}},{key:"slideAnimateIn",value:function(e,t){var i=this,n=e.querySelector(".gslide-media"),s=e.querySelector(".gslide-description"),l={index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlide,slideConfig:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},o={index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideConfig:this.elements[this.index].slideConfig,slideIndex:this.index,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)};if(n.offsetWidth>0&&s&&(p(s),s.style.display=""),d(e,this.effectsClasses),t)g(e,this.settings.cssEfects[this.settings.openEffect].in,(function(){i.settings.autoplayVideos&&i.slidePlayerPlay(e),i.trigger("slide_changed",{prev:l,current:o}),T(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,o])}));else{var r=this.settings.slideEffect,a="none"!==r?this.settings.cssEfects[r].in:r;this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(a=this.settings.cssEfects.slideBack.in),g(e,a,(function(){i.settings.autoplayVideos&&i.slidePlayerPlay(e),i.trigger("slide_changed",{prev:l,current:o}),T(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,o])}))}setTimeout((function(){i.resize(e)}),100),h(e,"current")}},{key:"slideAnimateOut",value:function(){if(!this.prevActiveSlide)return!1;var e=this.prevActiveSlide;d(e,this.effectsClasses),h(e,"prev");var t=this.settings.slideEffect,i="none"!==t?this.settings.cssEfects[t].out:t;this.slidePlayerPause(e),this.trigger("slide_before_change",{prev:{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlideIndex,slideConfig:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},current:{index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideIndex:this.index,slideConfig:this.elements[this.index].slideConfig,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)}}),T(this.settings.beforeSlideChange)&&this.settings.beforeSlideChange.apply(this,[{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},{index:this.index,slide:this.activeSlide,player:this.getSlidePlayerInstance(this.index)}]),this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(i=this.settings.cssEfects.slideBack.out),g(e,i,(function(){var t=e.querySelector(".ginner-container"),i=e.querySelector(".gslide-media"),n=e.querySelector(".gslide-description");t.style.transform="",i.style.transform="",d(i,"greset"),i.style.opacity="",n&&(n.style.opacity=""),d(e,"prev")}))}},{key:"getAllPlayers",value:function(){return this.videoPlayers}},{key:"getSlidePlayerInstance",value:function(e){var t="gvideo"+e,i=this.getAllPlayers();return!(!O(i,t)||!i[t])&&i[t]}},{key:"stopSlideVideo",value:function(e){if(k(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}console.log("stopSlideVideo is deprecated, use slidePlayerPause");var i=this.getSlidePlayerInstance(e);i&&i.playing&&i.pause()}},{key:"slidePlayerPause",value:function(e){if(k(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}var i=this.getSlidePlayerInstance(e);i&&i.playing&&i.pause()}},{key:"playSlideVideo",value:function(e){if(k(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}console.log("playSlideVideo is deprecated, use slidePlayerPlay");var i=this.getSlidePlayerInstance(e);i&&!i.playing&&i.play()}},{key:"slidePlayerPlay",value:function(e){var t;if(!J||null!==(t=this.settings.plyr.config)&&void 0!==t&&t.muted){if(k(e)){var i=e.querySelector(".gvideo-wrapper");i&&(e=i.getAttribute("data-index"))}var n=this.getSlidePlayerInstance(e);n&&!n.playing&&(n.play(),this.settings.autofocusVideos&&n.elements.container.focus())}}},{key:"setElements",value:function(e){var t=this;this.settings.elements=!1;var i=[];e&&e.length&&o(e,(function(e,n){var s=new $(e,t,n),o=s.getConfig(),r=l({},o);r.slideConfig=o,r.instance=s,r.index=n,i.push(r)})),this.elements=i,this.lightboxOpen&&(this.slidesContainer.innerHTML="",this.elements.length&&(o(this.elements,(function(){var e=m(t.settings.slideHTML);t.slidesContainer.appendChild(e)})),this.showSlide(0,!0)))}},{key:"getElementIndex",value:function(e){var t=!1;return o(this.elements,(function(i,n){if(O(i,"node")&&i.node==e)return t=n,!0})),t}},{key:"getElements",value:function(){var e=this,t=[];this.elements=this.elements?this.elements:[],!I(this.settings.elements)&&E(this.settings.elements)&&this.settings.elements.length&&o(this.settings.elements,(function(i,n){var s=new $(i,e,n),o=s.getConfig(),r=l({},o);r.node=!1,r.index=n,r.instance=s,r.slideConfig=o,t.push(r)}));var i=!1;return this.getSelector()&&(i=document.querySelectorAll(this.getSelector())),i?(o(i,(function(i,n){var s=new $(i,e,n),o=s.getConfig(),r=l({},o);r.node=i,r.index=n,r.instance=s,r.slideConfig=o,r.gallery=i.getAttribute("data-gallery"),t.push(r)})),t):t}},{key:"getGalleryElements",value:function(e,t){return e.filter((function(e){return e.gallery==t}))}},{key:"getSelector",value:function(){return!this.settings.elements&&(this.settings.selector&&"data-"==this.settings.selector.substring(0,5)?"*[".concat(this.settings.selector,"]"):this.settings.selector)}},{key:"getActiveSlide",value:function(){return this.slidesContainer.querySelectorAll(".gslide")[this.index]}},{key:"getActiveSlideIndex",value:function(){return this.index}},{key:"getAnimationClasses",value:function(){var e=[];for(var t in this.settings.cssEfects)if(this.settings.cssEfects.hasOwnProperty(t)){var i=this.settings.cssEfects[t];e.push("g".concat(i.in)),e.push("g".concat(i.out))}return e.join(" ")}},{key:"build",value:function(){var e=this;if(this.built)return!1;var t=document.body.childNodes,i=[];o(t,(function(e){e.parentNode==document.body&&"#"!==e.nodeName.charAt(0)&&e.hasAttribute&&!e.hasAttribute("aria-hidden")&&(i.push(e),e.setAttribute("aria-hidden","true"))}));var n=O(this.settings.svg,"next")?this.settings.svg.next:"",s=O(this.settings.svg,"prev")?this.settings.svg.prev:"",l=O(this.settings.svg,"close")?this.settings.svg.close:"",r=this.settings.lightboxHTML;r=m(r=(r=(r=r.replace(/{nextSVG}/g,n)).replace(/{prevSVG}/g,s)).replace(/{closeSVG}/g,l)),document.body.appendChild(r);var d=document.getElementById("glightbox-body");this.modal=d;var g=d.querySelector(".gclose");this.prevButton=d.querySelector(".gprev"),this.nextButton=d.querySelector(".gnext"),this.overlay=d.querySelector(".goverlay"),this.loader=d.querySelector(".gloader"),this.slidesContainer=document.getElementById("glightbox-slider"),this.bodyHiddenChildElms=i,this.events={},h(this.modal,"glightbox-"+this.settings.skin),this.settings.closeButton&&g&&(this.events.close=a("click",{onElement:g,withCallback:function(t,i){t.preventDefault(),e.close()}})),g&&!this.settings.closeButton&&g.parentNode.removeChild(g),this.nextButton&&(this.events.next=a("click",{onElement:this.nextButton,withCallback:function(t,i){t.preventDefault(),e.nextSlide()}})),this.prevButton&&(this.events.prev=a("click",{onElement:this.prevButton,withCallback:function(t,i){t.preventDefault(),e.prevSlide()}})),this.settings.closeOnOutsideClick&&(this.events.outClose=a("click",{onElement:d,withCallback:function(t,i){e.preventOutsideClick||c(document.body,"glightbox-mobile")||u(t.target,".ginner-container")||u(t.target,".gbtn")||c(t.target,"gnext")||c(t.target,"gprev")||e.close()}})),o(this.elements,(function(t,i){e.slidesContainer.appendChild(t.instance.create()),t.slideNode=e.slidesContainer.querySelectorAll(".gslide")[i]})),K&&h(document.body,"glightbox-touch"),this.events.resize=a("resize",{onElement:window,withCallback:function(){e.resize()}}),this.built=!0}},{key:"resize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if((e=e||this.activeSlide)&&!c(e,"zoomed")){var t=y(),i=e.querySelector(".gvideo-wrapper"),n=e.querySelector(".gslide-image"),s=this.slideDescription,l=t.width,o=t.height;if(l<=768?h(document.body,"glightbox-mobile"):d(document.body,"glightbox-mobile"),i||n){var r=!1;if(s&&(c(s,"description-bottom")||c(s,"description-top"))&&!c(s,"gabsolute")&&(r=!0),n)if(l<=768)n.querySelector("img");else if(r){var a=s.offsetHeight,u=n.querySelector("img");u.setAttribute("style","max-height: calc(100vh - ".concat(a,"px)")),s.setAttribute("style","max-width: ".concat(u.offsetWidth,"px;"))}if(i){var g=O(this.settings.plyr.config,"ratio")?this.settings.plyr.config.ratio:"";if(!g){var v=i.clientWidth,f=i.clientHeight,p=v/f;g="".concat(v/p,":").concat(f/p)}var m=g.split(":"),x=this.settings.videosWidth,b=this.settings.videosWidth,S=(b=M(x)||-1!==x.indexOf("px")?parseInt(x):-1!==x.indexOf("vw")?l*parseInt(x)/100:-1!==x.indexOf("vh")?o*parseInt(x)/100:-1!==x.indexOf("%")?l*parseInt(x)/100:parseInt(i.clientWidth))/(parseInt(m[0])/parseInt(m[1]));if(S=Math.floor(S),r&&(o-=s.offsetHeight),b>l||S>o||o<S&&l>b){var w=i.offsetWidth,T=i.offsetHeight,C=o/T,k={width:w*C,height:T*C};i.parentNode.setAttribute("style","max-width: ".concat(k.width,"px")),r&&s.setAttribute("style","max-width: ".concat(k.width,"px;"))}else i.parentNode.style.maxWidth="".concat(x),r&&s.setAttribute("style","max-width: ".concat(x,";"))}}}}},{key:"reload",value:function(){this.init()}},{key:"updateNavigationClasses",value:function(){var e=this.loop();d(this.nextButton,"disabled"),d(this.prevButton,"disabled"),0==this.index&&this.elements.length-1==0?(h(this.prevButton,"disabled"),h(this.nextButton,"disabled")):0!==this.index||e?this.index!==this.elements.length-1||e||h(this.nextButton,"disabled"):h(this.prevButton,"disabled")}},{key:"loop",value:function(){var e=O(this.settings,"loopAtEnd")?this.settings.loopAtEnd:null;return e=O(this.settings,"loop")?this.settings.loop:e,e}},{key:"close",value:function(){var e=this;if(!this.lightboxOpen){if(this.events){for(var t in this.events)this.events.hasOwnProperty(t)&&this.events[t].destroy();this.events=null}return!1}if(this.closing)return!1;this.closing=!0,this.slidePlayerPause(this.activeSlide),this.fullElementsList&&(this.elements=this.fullElementsList),this.bodyHiddenChildElms.length&&o(this.bodyHiddenChildElms,(function(e){e.removeAttribute("aria-hidden")})),h(this.modal,"glightbox-closing"),g(this.overlay,"none"==this.settings.openEffect?"none":this.settings.cssEfects.fade.out),g(this.activeSlide,this.settings.cssEfects[this.settings.closeEffect].out,(function(){if(e.activeSlide=null,e.prevActiveSlideIndex=null,e.prevActiveSlide=null,e.built=!1,e.events){for(var t in e.events)e.events.hasOwnProperty(t)&&e.events[t].destroy();e.events=null}var i=document.body;d(Q,"glightbox-open"),d(i,"glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer"),e.modal.parentNode.removeChild(e.modal),e.trigger("close"),T(e.settings.onClose)&&e.settings.onClose();var n=document.querySelector(".gcss-styles");n&&n.parentNode.removeChild(n),e.lightboxOpen=!1,e.closing=null}))}},{key:"destroy",value:function(){this.close(),this.clearAllEvents(),this.baseEvents&&this.baseEvents.destroy()}},{key:"on",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||!T(t))throw new TypeError("Event name and callback must be defined");this.apiEvents.push({evt:e,once:i,callback:t})}},{key:"once",value:function(e,t){this.on(e,t,!0)}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=[];o(this.apiEvents,(function(t,s){var l=t.evt,o=t.once,r=t.callback;l==e&&(r(i),o&&n.push(s))})),n.length&&o(n,(function(e){return t.apiEvents.splice(e,1)}))}},{key:"clearAllEvents",value:function(){this.apiEvents.splice(0,this.apiEvents.length)}},{key:"version",value:function(){return"3.1.0"}}]),e}();return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new te(e);return t.init(),t}}));
_extensions/schochastics/social-share/_extension.yml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ title: Share Post on Social Media
2
+ author: David Schoch
3
+ version: 0.1.0
4
+ contributes:
5
+ filters:
6
+ - social-share.lua
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/_extension.yml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ title: Font Awesome support
2
+ author: Carlos Scheidegger
3
+ version: 0.0.1
4
+ contributes:
5
+ shortcodes:
6
+ - fontawesome.lua
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/css/all.css ADDED
The diff for this file is too large to render. See raw diff
 
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/css/latex-fontsize.css ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .fa-tiny {
2
+ font-size: 0.5em;
3
+ }
4
+ .fa-scriptsize {
5
+ font-size: 0.7em;
6
+ }
7
+ .fa-footnotesize {
8
+ font-size: 0.8em;
9
+ }
10
+ .fa-small {
11
+ font-size: 0.9em;
12
+ }
13
+ .fa-normalsize {
14
+ font-size: 1em;
15
+ }
16
+ .fa-large {
17
+ font-size: 1.2em;
18
+ }
19
+ .fa-Large {
20
+ font-size: 1.5em;
21
+ }
22
+ .fa-LARGE {
23
+ font-size: 1.75em;
24
+ }
25
+ .fa-huge {
26
+ font-size: 2em;
27
+ }
28
+ .fa-Huge {
29
+ font-size: 2.5em;
30
+ }
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-brands-400.ttf ADDED
Binary file (182 kB). View file
 
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-brands-400.woff2 ADDED
Binary file (106 kB). View file
 
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-regular-400.ttf ADDED
Binary file (60.5 kB). View file
 
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-regular-400.woff2 ADDED
Binary file (23.9 kB). View file
 
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-solid-900.ttf ADDED
Binary file (388 kB). View file
 
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-solid-900.woff2 ADDED
Binary file (154 kB). View file
 
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-v4compatibility.ttf ADDED
Binary file (10.6 kB). View file
 
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/assets/webfonts/fa-v4compatibility.woff2 ADDED
Binary file (4.96 kB). View file
 
_extensions/schochastics/social-share/_extensions/quarto-ext/fontawesome/fontawesome.lua ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ local function ensureLatexDeps()
2
+ quarto.doc.useLatexPackage("fontawesome5")
3
+ end
4
+
5
+ local function ensureHtmlDeps()
6
+ quarto.doc.addHtmlDependency({
7
+ name = 'fontawesome6',
8
+ version = '0.1.0',
9
+ stylesheets = {'assets/css/all.css', 'assets/css/latex-fontsize.css'}
10
+ })
11
+ end
12
+
13
+ local function isEmpty(s)
14
+ return s == nil or s == ''
15
+ end
16
+
17
+ local function isValidSize(size)
18
+ local validSizes = {
19
+ "tiny",
20
+ "scriptsize",
21
+ "footnotesize",
22
+ "small",
23
+ "normalsize",
24
+ "large",
25
+ "Large",
26
+ "LARGE",
27
+ "huge",
28
+ "Huge"
29
+ }
30
+ for _, v in ipairs(validSizes) do
31
+ if v == size then
32
+ return size
33
+ end
34
+ end
35
+ return ""
36
+ end
37
+
38
+ return {
39
+ ["fa"] = function(args, kwargs)
40
+
41
+ local group = "solid"
42
+ local icon = pandoc.utils.stringify(args[1])
43
+ if #args > 1 then
44
+ group = icon
45
+ icon = pandoc.utils.stringify(args[2])
46
+ end
47
+
48
+ local title = pandoc.utils.stringify(kwargs["title"])
49
+ if not isEmpty(title) then
50
+ title = " title=\"" .. title .. "\""
51
+ end
52
+
53
+ local size = pandoc.utils.stringify(kwargs["size"])
54
+
55
+ -- detect html (excluding epub which won't handle fa)
56
+ if quarto.doc.isFormat("html:js") then
57
+ ensureHtmlDeps()
58
+ if not isEmpty(size) then
59
+ size = " fa-" .. size
60
+ end
61
+ return pandoc.RawInline(
62
+ 'html',
63
+ "<i class=\"fa-" .. group .. " fa-" .. icon .. size .. "\"" .. title .. " aria-hidden=\"true\"></i>"
64
+ )
65
+ -- detect pdf / beamer / latex / etc
66
+ elseif quarto.doc.isFormat("pdf") then
67
+ ensureLatexDeps()
68
+ if isEmpty(isValidSize(size)) then
69
+ return pandoc.RawInline('tex', "\\faIcon{" .. icon .. "}")
70
+ else
71
+ return pandoc.RawInline('tex', "{\\" .. size .. "\\faIcon{" .. icon .. "}}")
72
+ end
73
+ else
74
+ return pandoc.Null()
75
+ end
76
+ end
77
+ }
_extensions/schochastics/social-share/social-share.css ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*adapted from: https://www.remysheppard.com/blog/hugo-share-buttons/*/
2
+ .social-share {
3
+ display: flex;
4
+ flex-direction: row;
5
+ justify-content: space-evenly;
6
+ flex-wrap: wrap;
7
+ }
8
+
9
+ .social-share a {
10
+ border-radius: 25px;
11
+ padding: 0.25rem 0.5rem;
12
+ background: white;
13
+ border: 1px solid transparent;
14
+ transition: background ease 0.3s, color ease 0.3s;
15
+ margin-bottom: 1em;
16
+ text-decoration: none;
17
+ }
18
+
19
+ .social-share a:before {
20
+ display: none;
21
+ }
22
+
23
+ .social-share a.facebook {
24
+ border-color: #4267B2;
25
+ color: #4267B2;
26
+ }
27
+
28
+ .social-share a.facebook:hover {
29
+ background: #4267B2;
30
+ color: white;
31
+ }
32
+
33
+ .social-share a.twitter {
34
+ border-color: #1DA1F2;
35
+ color: #1DA1F2;
36
+ }
37
+
38
+ .social-share a.twitter:hover {
39
+ background: #1DA1F2;
40
+ color: white;
41
+ }
42
+
43
+ .social-share a.reddit {
44
+ border-color: #FF4500;
45
+ color: #FF4500;
46
+ }
47
+ .social-share a.reddit:hover {
48
+ background: #FF4500;
49
+ color: white;
50
+ }
51
+
52
+ .social-share a.stumbleupon {
53
+ border-color: #EB471D;
54
+ color: #EB471D;
55
+ }
56
+
57
+ .social-share a.stumbleupon:hover {
58
+ background: #EB471D;
59
+ color: white;
60
+ }
61
+
62
+ .social-share a.tumblr {
63
+ border-color: #35465C;
64
+ color: #35465C;
65
+ }
66
+ .social-share a.tumblr:hover {
67
+ background: #35465C;
68
+ color: white;
69
+ }
70
+
71
+ .social-share a.linkedin {
72
+ border-color: #2867B2;
73
+ color: #2867B2;
74
+ }
75
+
76
+ .social-share a.linkedin:hover {
77
+ background: #2867B2;
78
+ color: white;
79
+ }
80
+
81
+ .social-share a.email {
82
+ border-color: #00A4EF;
83
+ color: #00A4EF;
84
+ }
85
+
86
+ .social-share a.email:hover {
87
+ background: #00A4EF;
88
+ color: white;
89
+ }
90
+
91
+ .social-share a.mastodon {
92
+ border-color: #6364FF;
93
+ color: #6364FF;
94
+ }
95
+
96
+ .social-share a.mastodon:hover {
97
+ background: #6364FF;
98
+ color: white;
99
+ }
_extensions/schochastics/social-share/social-share.lua ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ local function ensureHtmlDeps()
2
+ quarto.doc.addHtmlDependency({
3
+ name = 'social-share',
4
+ version = '0.1.0',
5
+ stylesheets = {
6
+ 'social-share.css',
7
+ '_extensions/quarto-ext/fontawesome/assets/css/all.css'
8
+ }
9
+ })
10
+ end
11
+
12
+ function Meta(m)
13
+ ensureHtmlDeps()
14
+ local share_start = '<div class= "page-columns page-rows-contents page-layout-article"><div class="social-share">'
15
+ local share_end = '</div></div>'
16
+ local share_text = share_start
17
+
18
+ local share_url = pandoc.utils.stringify(m.share.permalink)
19
+ if m.share.description~=nil then
20
+ post_title = pandoc.utils.stringify(m.share.description)
21
+ else
22
+ post_title = pandoc.utils.stringify(m.title)
23
+ end
24
+ if m.share.twitter then
25
+ share_text = share_text .. '<a href="https://twitter.com/share?url='.. share_url .. '&text='.. post_title ..'" target="_blank" class="twitter"><i class="fab fa-twitter fa-fw fa-lg"></i></a>'
26
+ end
27
+ if m.share.linkedin then
28
+ share_text = share_text .. '<a href="https://www.linkedin.com/shareArticle?url='.. share_url ..'&title='.. post_title ..'" target="_blank" class="linkedin"><i class="fa-brands fa-linkedin-in fa-fw fa-lg"></i></a>'
29
+ end
30
+ if m.share.email then
31
+ share_text = share_text .. ' <a href="mailto:?subject='.. post_title ..'&body=Check out this link:'.. share_url ..'" target="_blank" class="email"><i class="fa-solid fa-envelope fa-fw fa-lg"></i></a>'
32
+ end
33
+ if m.share.facebook then
34
+ share_text = share_text .. '<a href="https://www.facebook.com/sharer.php?u='.. share_url ..'" target="_blank" class="facebook"><i class="fab fa-facebook-f fa-fw fa-lg"></i></a>'
35
+ end
36
+ if m.share.reddit then
37
+ share_text = share_text .. '<a href="https://reddit.com/submit?url='.. share_url ..'&title='.. post_title ..'" target="_blank" class="reddit"> <i class="fa-brands fa-reddit-alien fa-fw fa-lg"></i></a>'
38
+ end
39
+ if m.share.stumble then
40
+ share_text = share_text .. '<a href="https://www.stumbleupon.com/submit?url='.. share_url ..'&title='.. post_title ..'" target="_blank" class="stumbleupon"><i class="fa-brands fa-stumbleupon fa-fw fa-lg"></i></a>'
41
+ end
42
+ if m.share.tumblr then
43
+ share_text = share_text .. '<a href="https://www.tumblr.com/share/link?url='.. share_url ..'&name='.. post_title ..'" target="_blank" class="tumblr"><i class="fa-brands fa-tumblr fa-fw fa-lg"></i></a>'
44
+ end
45
+ if m.share.mastodon then
46
+ share_text = share_text .. '<a href="javascript:void(0);" onclick="var mastodon_instance=prompt(\'Mastodon Instance / Server Name?\'); if(typeof mastodon_instance===\'string\' &amp;&amp; mastodon_instance.length){this.href=\'https://\'+mastodon_instance+\'/share?text=' .. post_title..' '.. share_url ..'\'}else{return false;}" target="_blank" class="mastodon"><i class="fa-brands fa-mastodon fa-fw fa-lg"></i></a>'
47
+ end
48
+ share_text = share_text .. share_end
49
+ quarto.doc.includeText("after-body", share_text)
50
+ end
_extensions/shafayetShafee/downloadthis/_extension.yml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ title: Downloadthis
2
+ author: Shafayet Khan Shafee
3
+ version: 1.0.0
4
+ quarto-required: ">=1.2.0"
5
+ contributes:
6
+ shortcodes:
7
+ - downloadthis.lua
8
+
_extensions/shafayetShafee/downloadthis/downloadthis.lua ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --[[
2
+ MIT License
3
+
4
+ Copyright (c) 2023 Shafayet Khan Shafee
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+ ]]--
24
+
25
+
26
+
27
+ local str = pandoc.utils.stringify
28
+ --local p = quarto.log.output
29
+
30
+ local function ensureHtmlDeps()
31
+ quarto.doc.add_html_dependency({
32
+ name = "downloadthis",
33
+ version = "1.9.1",
34
+ stylesheets = {"resources/css/downloadthis.css"}
35
+ })
36
+ end
37
+
38
+ local function optional(arg, default)
39
+ if arg == nil or arg == ""
40
+ then
41
+ return default
42
+ else
43
+ return arg
44
+ end
45
+ end
46
+
47
+ function import(script)
48
+ local path = PANDOC_SCRIPT_FILE:match("(.*[/\\])") .. "resources/lua/"
49
+ package.path = path .. script .. ";" .. package.path
50
+ return require(script)
51
+ end
52
+
53
+ local b64 = import('base64.lua')
54
+ local puremagic = import('puremagic.lua')
55
+
56
+ return {
57
+ ['downloadthis'] = function(args, kwargs, meta)
58
+
59
+ -- args and kwargs
60
+ local file_path = str(args[1])
61
+ local extension = "." .. file_path:match("[^.]+$")
62
+ local dname = optional(str(kwargs["dname"]), "file")
63
+ local dfilename = dname .. extension
64
+ local btn_label = " " .. optional(str(kwargs["label"]), "Download") .. " "
65
+ local btn_type = optional(str(kwargs["type"]), "default")
66
+ local icon = optional(str(kwargs["icon"]), "download")
67
+ local class = " " .. optional(str(kwargs["class"]), "")
68
+ local rand = "dnldts" .. str(math.random(1, 65000))
69
+ local id = optional(str(kwargs["id"]), rand)
70
+ -- reading files
71
+ local fh = io.open(file_path, "rb")
72
+ if not fh then
73
+ io.stderr:write("Cannot open file " ..
74
+ file_path ..
75
+ " | Skipping adding buttons\n")
76
+ return pandoc.Null()
77
+ else
78
+ local contents = fh:read("*all")
79
+ fh:close()
80
+
81
+ -- creating dataURI object
82
+ local b64_encoded = b64.encode(contents)
83
+ local mimetype = puremagic.via_path(file_path)
84
+ local data_uri = 'data:' .. mimetype .. ";base64," .. b64_encoded
85
+
86
+ -- js code taken from
87
+ -- https://github.com/fmmattioni/downloadthis/blob/master/R/utils.R#L59
88
+ local js = [[fetch('%s').then(res => res.blob()).then(blob => {
89
+ const downloadURL = window.URL.createObjectURL(blob);
90
+ const a = document.createElement('a');
91
+ document.body.appendChild(a);
92
+ a.href = downloadURL;
93
+ a.download = '%s'; a.click();
94
+ window.URL.revokeObjectURL(downloadURL);
95
+ document.body.removeChild(a);
96
+ });]]
97
+
98
+ local clicked = js:format(data_uri, dfilename)
99
+
100
+ -- creating button
101
+ local button =
102
+ "<button class=\"btn btn-" .. btn_type .. " downloadthis " ..
103
+ class .. "\"" ..
104
+ " id=\"" .. id .. "\"" ..
105
+ "><i class=\"bi bi-" .. icon .. "\"" .. "></i>" ..
106
+ btn_label ..
107
+ "</button>"
108
+ if quarto.doc.is_format("html:js") and quarto.doc.has_bootstrap()
109
+ then
110
+ ensureHtmlDeps()
111
+ return pandoc.RawInline('html',
112
+ "<a href=\"#" .. id .. "\"" ..
113
+ " onclick=\"" .. clicked .. "\">" .. button .. "</a>"
114
+ )
115
+ else
116
+ return pandoc.Null()
117
+ end
118
+ end
119
+ end
120
+ }
121
+
_extensions/shafayetShafee/downloadthis/resources/css/downloadthis.css ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .downloadthis:focus,
2
+ .downloadthis:active {
3
+ box-shadow: none !important;
4
+ }
5
+
6
+ .downloadthis:hover {
7
+ transition: 0.2s;
8
+ filter: brightness(0.90);
9
+ }
10
+
11
+ .downloadthis:active {
12
+ filter: brightness(0.80);
13
+ }
_extensions/shafayetShafee/downloadthis/resources/lua/base64.lua ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --[[
2
+
3
+ base64 -- v1.5.3 public domain Lua base64 encoder/decoder
4
+ no warranty implied; use at your own risk
5
+
6
+ Needs bit32.extract function. If not present it's implemented using BitOp
7
+ or Lua 5.3 native bit operators. For Lua 5.1 fallbacks to pure Lua
8
+ implementation inspired by Rici Lake's post:
9
+ http://ricilake.blogspot.co.uk/2007/10/iterating-bits-in-lua.html
10
+
11
+ author: Ilya Kolbin (iskolbin@gmail.com)
12
+ url: github.com/iskolbin/lbase64
13
+
14
+ COMPATIBILITY
15
+
16
+ Lua 5.1+, LuaJIT
17
+
18
+ LICENSE
19
+
20
+ See end of file for license information.
21
+
22
+ --]]
23
+
24
+
25
+ local base64 = {}
26
+
27
+ local extract = _G.bit32 and _G.bit32.extract -- Lua 5.2/Lua 5.3 in compatibility mode
28
+ if not extract then
29
+ if _G.bit then -- LuaJIT
30
+ local shl, shr, band = _G.bit.lshift, _G.bit.rshift, _G.bit.band
31
+ extract = function( v, from, width )
32
+ return band( shr( v, from ), shl( 1, width ) - 1 )
33
+ end
34
+ elseif _G._VERSION == "Lua 5.1" then
35
+ extract = function( v, from, width )
36
+ local w = 0
37
+ local flag = 2^from
38
+ for i = 0, width-1 do
39
+ local flag2 = flag + flag
40
+ if v % flag2 >= flag then
41
+ w = w + 2^i
42
+ end
43
+ flag = flag2
44
+ end
45
+ return w
46
+ end
47
+ else -- Lua 5.3+
48
+ extract = load[[return function( v, from, width )
49
+ return ( v >> from ) & ((1 << width) - 1)
50
+ end]]()
51
+ end
52
+ end
53
+
54
+
55
+ function base64.makeencoder( s62, s63, spad )
56
+ local encoder = {}
57
+ for b64code, char in pairs{[0]='A','B','C','D','E','F','G','H','I','J',
58
+ 'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y',
59
+ 'Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n',
60
+ 'o','p','q','r','s','t','u','v','w','x','y','z','0','1','2',
61
+ '3','4','5','6','7','8','9',s62 or '+',s63 or'/',spad or'='} do
62
+ encoder[b64code] = char:byte()
63
+ end
64
+ return encoder
65
+ end
66
+
67
+ function base64.makedecoder( s62, s63, spad )
68
+ local decoder = {}
69
+ for b64code, charcode in pairs( base64.makeencoder( s62, s63, spad )) do
70
+ decoder[charcode] = b64code
71
+ end
72
+ return decoder
73
+ end
74
+
75
+ local DEFAULT_ENCODER = base64.makeencoder()
76
+ local DEFAULT_DECODER = base64.makedecoder()
77
+
78
+ local char, concat = string.char, table.concat
79
+
80
+ function base64.encode( str, encoder, usecaching )
81
+ encoder = encoder or DEFAULT_ENCODER
82
+ local t, k, n = {}, 1, #str
83
+ local lastn = n % 3
84
+ local cache = {}
85
+ for i = 1, n-lastn, 3 do
86
+ local a, b, c = str:byte( i, i+2 )
87
+ local v = a*0x10000 + b*0x100 + c
88
+ local s
89
+ if usecaching then
90
+ s = cache[v]
91
+ if not s then
92
+ s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
93
+ cache[v] = s
94
+ end
95
+ else
96
+ s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
97
+ end
98
+ t[k] = s
99
+ k = k + 1
100
+ end
101
+ if lastn == 2 then
102
+ local a, b = str:byte( n-1, n )
103
+ local v = a*0x10000 + b*0x100
104
+ t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[64])
105
+ elseif lastn == 1 then
106
+ local v = str:byte( n )*0x10000
107
+ t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[64], encoder[64])
108
+ end
109
+ return concat( t )
110
+ end
111
+
112
+ function base64.decode( b64, decoder, usecaching )
113
+ decoder = decoder or DEFAULT_DECODER
114
+ local pattern = '[^%w%+%/%=]'
115
+ if decoder then
116
+ local s62, s63
117
+ for charcode, b64code in pairs( decoder ) do
118
+ if b64code == 62 then s62 = charcode
119
+ elseif b64code == 63 then s63 = charcode
120
+ end
121
+ end
122
+ pattern = ('[^%%w%%%s%%%s%%=]'):format( char(s62), char(s63) )
123
+ end
124
+ b64 = b64:gsub( pattern, '' )
125
+ local cache = usecaching and {}
126
+ local t, k = {}, 1
127
+ local n = #b64
128
+ local padding = b64:sub(-2) == '==' and 2 or b64:sub(-1) == '=' and 1 or 0
129
+ for i = 1, padding > 0 and n-4 or n, 4 do
130
+ local a, b, c, d = b64:byte( i, i+3 )
131
+ local s
132
+ if usecaching then
133
+ local v0 = a*0x1000000 + b*0x10000 + c*0x100 + d
134
+ s = cache[v0]
135
+ if not s then
136
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
137
+ s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
138
+ cache[v0] = s
139
+ end
140
+ else
141
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
142
+ s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
143
+ end
144
+ t[k] = s
145
+ k = k + 1
146
+ end
147
+ if padding == 1 then
148
+ local a, b, c = b64:byte( n-3, n-1 )
149
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40
150
+ t[k] = char( extract(v,16,8), extract(v,8,8))
151
+ elseif padding == 2 then
152
+ local a, b = b64:byte( n-3, n-2 )
153
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000
154
+ t[k] = char( extract(v,16,8))
155
+ end
156
+ return concat( t )
157
+ end
158
+
159
+ return base64
160
+
161
+ --[[
162
+ ------------------------------------------------------------------------------
163
+ This software is available under 2 licenses -- choose whichever you prefer.
164
+ ------------------------------------------------------------------------------
165
+ ALTERNATIVE A - MIT License
166
+ Copyright (c) 2018 Ilya Kolbin
167
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
168
+ this software and associated documentation files (the "Software"), to deal in
169
+ the Software without restriction, including without limitation the rights to
170
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
171
+ of the Software, and to permit persons to whom the Software is furnished to do
172
+ so, subject to the following conditions:
173
+ The above copyright notice and this permission notice shall be included in all
174
+ copies or substantial portions of the Software.
175
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
176
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
177
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
178
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
179
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
180
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
181
+ SOFTWARE.
182
+ ------------------------------------------------------------------------------
183
+ ALTERNATIVE B - Public Domain (www.unlicense.org)
184
+ This is free and unencumbered software released into the public domain.
185
+ Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
186
+ software, either in source code form or as a compiled binary, for any purpose,
187
+ commercial or non-commercial, and by any means.
188
+ In jurisdictions that recognize copyright laws, the author or authors of this
189
+ software dedicate any and all copyright interest in the software to the public
190
+ domain. We make this dedication for the benefit of the public at large and to
191
+ the detriment of our heirs and successors. We intend this dedication to be an
192
+ overt act of relinquishment in perpetuity of all present and future rights to
193
+ this software under copyright law.
194
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
195
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
196
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
197
+ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
198
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
199
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
200
+ ------------------------------------------------------------------------------
201
+ --]]
_extensions/shafayetShafee/downloadthis/resources/lua/puremagic.lua ADDED
@@ -0,0 +1,735 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- puremagic 1.0.1
2
+ -- Copyright (c) 2014 Will Bond <will@wbond.net>
3
+ -- Licensed under the MIT license.
4
+
5
+
6
+ function basename(path)
7
+ local basename_match = path:match('[/\\]([^/\\]+)$')
8
+ if basename_match then
9
+ return basename_match, nil
10
+ end
11
+
12
+ return path, nil
13
+ end
14
+
15
+
16
+ function extension(path)
17
+ path = path:lower()
18
+ local tar_match = path:match('%.(tar%.[^.]+)$')
19
+ if tar_match then
20
+ return tar_match
21
+ end
22
+ if path:sub(#path - 11, #path) == '.numbers.zip' then
23
+ return 'numbers.zip'
24
+ end
25
+ if path:sub(#path - 9, #path) == '.pages.zip' then
26
+ return 'pages.zip'
27
+ end
28
+ if path:sub(#path - 7, #path) == '.key.zip' then
29
+ return 'key.zip'
30
+ end
31
+ return path:match('%.([^.]+)$')
32
+ end
33
+
34
+
35
+ function in_table(value, list)
36
+ for i=1, #list do
37
+ if list[i] == value then
38
+ return true
39
+ end
40
+ end
41
+ return false
42
+ end
43
+
44
+
45
+ function string_to_bit_table(chars)
46
+ local output = {}
47
+ for char in chars:gmatch('.') do
48
+ local num = string.byte(char)
49
+ local bits = {0, 0, 0, 0, 0, 0, 0, 0}
50
+ for bit=8, 1, -1 do
51
+ if num > 0 then
52
+ bits[bit] = math.fmod(num, 2)
53
+ num = (num - bits[bit]) / 2
54
+ end
55
+ end
56
+ table.insert(output, bits)
57
+ end
58
+ return output
59
+ end
60
+
61
+
62
+ function bit_table_to_string(bits)
63
+ local output = {}
64
+ for i = 1, #bits do
65
+ local num = tonumber(table.concat(bits[i]), 2)
66
+ table.insert(output, string.format('%c', num))
67
+ end
68
+ return table.concat(output)
69
+ end
70
+
71
+
72
+ function bitwise_and(a, b)
73
+ local a_bytes = string_to_bit_table(a)
74
+ local b_bytes = string_to_bit_table(b)
75
+
76
+ local output = {}
77
+ for i = 1, #a_bytes do
78
+ local bits = {0, 0, 0, 0, 0, 0, 0, 0}
79
+ for j = 1, 8 do
80
+ if a_bytes[i][j] == 1 and b_bytes[i][j] == 1 then
81
+ bits[j] = 1
82
+ else
83
+ bits[j] = 0
84
+ end
85
+ end
86
+ table.insert(output, bits)
87
+ end
88
+
89
+ return bit_table_to_string(output)
90
+ end
91
+
92
+
93
+ -- Unpack a little endian byte string into an integer
94
+ function unpack_le(chars)
95
+ local bit_table = string_to_bit_table(chars)
96
+ -- Merge the bits into a string of 1s and 0s
97
+ local result = {}
98
+ for i=1, #bit_table do
99
+ result[#chars + 1 - i] = table.concat(bit_table[i])
100
+ end
101
+ return tonumber(table.concat(result), 2)
102
+ end
103
+
104
+
105
+ -- Unpack a big endian byte string into an integer
106
+ function unpack_be(chars)
107
+ local bit_table = string_to_bit_table(chars)
108
+ -- Merge the bits into a string of 1s and 0s
109
+ for i=1, #bit_table do
110
+ bit_table[i] = table.concat(bit_table[i])
111
+ end
112
+ return tonumber(table.concat(bit_table), 2)
113
+ end
114
+
115
+
116
+ -- Takes the first 4-8k of an EBML file and identifies if it is matroska or webm
117
+ -- and it it contains just video or just audio.
118
+ function ebml_parse(content)
119
+ local position = 1
120
+ local length = #content
121
+
122
+ local header_token, header_value, used_bytes = ebml_parse_section(content)
123
+ position = position + used_bytes
124
+
125
+
126
+ if header_token ~= '\x1AE\xDF\xA3' then
127
+ return nil, 'Unable to find EBML ID'
128
+ end
129
+
130
+ -- The matroska spec sets the default doctype to be 'matroska', however
131
+ -- many file specify this anyway. The other option is 'webm'.
132
+ local doctype = 'matroska'
133
+ if header_value['B\x82'] then
134
+ doctype = header_value['B\x82']
135
+ end
136
+
137
+ if doctype ~= 'matroska' and doctype ~= 'webm' then
138
+ return nil, 'Unknown EBML doctype'
139
+ end
140
+
141
+ local segment_position = nil
142
+ local track_position = nil
143
+ local has_video = false
144
+ local found_tracks = false
145
+
146
+ while position <= length do
147
+ local ebml_id, ebml_value, used_bytes = ebml_parse_section(content:sub(position, length))
148
+ position = position + used_bytes
149
+
150
+ -- Segment
151
+ if ebml_id == '\x18S\x80g' then
152
+ segment_position = position
153
+ end
154
+
155
+ -- Meta seek information
156
+ if ebml_id == '\x11M\x9Bt' then
157
+ -- Look for the seek info about the tracks token
158
+ for i, child in ipairs(ebml_value['M\xBB']) do
159
+ if child['S\xAB'] == '\x16T\xAEk' then
160
+ track_position = segment_position + unpack_be(child['S\xAC'])
161
+ position = track_position
162
+ break
163
+ end
164
+ end
165
+ end
166
+
167
+ -- Track
168
+ if ebml_id == '\x16T\xAEk' then
169
+ found_tracks = true
170
+ -- Scan through each track looking for video
171
+ for i, child in ipairs(ebml_value['\xAE']) do
172
+ -- Look to see if the track type is video
173
+ if unpack_be(child['\x83']) == 1 then
174
+ has_video = true
175
+ break
176
+ end
177
+ end
178
+ break
179
+ end
180
+ end
181
+
182
+ if found_tracks and not has_video then
183
+ if doctype == 'matroska' then
184
+ return 'audio/x-matroska'
185
+ else
186
+ return 'audio/webm'
187
+ end
188
+ end
189
+
190
+ if doctype == 'matroska' then
191
+ return 'video/x-matroska'
192
+ else
193
+ return 'video/webm'
194
+ end
195
+ end
196
+
197
+
198
+ -- Parses a section of an EBML document, returning the EBML ID at the beginning,
199
+ -- plus the value as a table with child EBML IDs as keys and the number of
200
+ -- bytes from the content that contained the ID and value
201
+ function ebml_parse_section(content)
202
+ local ebml_id, element_length, used_bytes = ebml_id_and_length(content)
203
+
204
+ -- Don't parse the segment since it is the whole file!
205
+ if ebml_id == '\x18\x53\x80\x67' then
206
+ return ebml_id, nil, used_bytes
207
+ end
208
+
209
+ local ebml_value = content:sub(used_bytes + 1, used_bytes + element_length)
210
+ used_bytes = used_bytes + element_length
211
+
212
+ -- We always parse the return value of level 0/1 elements
213
+ local recursive_parse = false
214
+ if #ebml_id == 4 then
215
+ recursive_parse = true
216
+
217
+ -- We need Seek information
218
+ elseif ebml_id == '\x4D\xBB' then
219
+ recursive_parse = true
220
+
221
+ -- We want the top-level of TrackEntry to grab the TrackType
222
+ elseif ebml_id == '\xAE' then
223
+ recursive_parse = true
224
+ end
225
+
226
+ if recursive_parse then
227
+ local buffer = ebml_value
228
+ ebml_value = {}
229
+
230
+ -- Track which child entries have been converted to an array
231
+ local array_children = {}
232
+
233
+ while #buffer > 0 do
234
+ local child_ebml_id, child_ebml_value, child_used_bytes = ebml_parse_section(buffer)
235
+
236
+ if array_children[child_ebml_id] then
237
+ table.insert(ebml_value[child_ebml_id], child_ebml_value)
238
+
239
+ -- Single values are just stores by themselves
240
+ elseif ebml_value[child_ebml_id] == nil then
241
+ -- Force seek info and tracks to be arrays even if there is only one
242
+ if child_ebml_id == 'M\xBB' or child_ebml_id == '\xAE' then
243
+ child_ebml_value = {child_ebml_value}
244
+ array_children[child_ebml_id] = true
245
+ end
246
+ ebml_value[child_ebml_id] = child_ebml_value
247
+
248
+ -- If there is already a value for the ID, turn it into a table
249
+ else
250
+ ebml_value[child_ebml_id] = {ebml_value[child_ebml_id], child_ebml_value}
251
+ array_children[child_ebml_id] = true
252
+ end
253
+
254
+ -- Move past the part we've parsed
255
+ buffer = buffer:sub(child_used_bytes + 1, #buffer)
256
+ end
257
+ end
258
+
259
+ return ebml_id, ebml_value, used_bytes
260
+ end
261
+
262
+
263
+ -- Should accept 12+ bytes, will return the ebml id, the data length and the
264
+ -- number of bytes that were used to hold those values.
265
+ function ebml_id_and_length(chars)
266
+ -- The ID is encoded the same way as the length, however, we don't want
267
+ -- to remove the length bits from the ID value or intepret it as an
268
+ -- unsigned int since all of the documentation online references the IDs in
269
+ -- encoded form.
270
+ local _, id_length = ebml_length(chars:sub(1, 4))
271
+ local ebml_id = chars:sub(1, id_length)
272
+
273
+ local remaining = chars:sub(id_length + 1, id_length + 8)
274
+ local element_length, used_bytes = ebml_length(remaining)
275
+
276
+ return ebml_id, element_length, id_length + used_bytes
277
+ end
278
+
279
+
280
+ -- Should accept 8+ bytes, will return the data length plus the number of bytes
281
+ -- that were used to hold the data length.
282
+ function ebml_length(chars)
283
+ -- We substring chars to ensure we don't build a huge table we don't need
284
+ local bit_tables = string_to_bit_table(chars:sub(1, 8))
285
+
286
+ local value_length = 1
287
+ for i=1, #bit_tables[1] do
288
+ if bit_tables[1][i] == 0 then
289
+ value_length = value_length + 1
290
+ else
291
+ -- Clear the indicator bit so the rest of the byte
292
+ bit_tables[1][i] = 0
293
+ break
294
+ end
295
+ end
296
+
297
+ local bits = {}
298
+ for i=1, value_length do
299
+ table.insert(bits, table.concat(bit_tables[i]))
300
+ end
301
+
302
+ return tonumber(table.concat(bits), 2), value_length
303
+ end
304
+
305
+
306
+ function binary_tests(content, ext)
307
+ local length = #content
308
+ local _1_8 = content:sub(1, 8)
309
+ local _1_7 = content:sub(1, 7)
310
+ local _1_6 = content:sub(1, 6)
311
+ local _1_5 = content:sub(1, 5)
312
+ local _1_4 = content:sub(1, 4)
313
+ local _1_3 = content:sub(1, 3)
314
+ local _1_2 = content:sub(1, 2)
315
+ local _9_12 = content:sub(9, 12)
316
+
317
+
318
+ -- Images
319
+ if _1_4 == '\xC5\xD0\xD3\xC6' then
320
+ -- With a Windows-format EPS, the file starts right after a 30-byte
321
+ -- header, or a 30-byte header followed by two bytes of padding
322
+ if content:sub(33, 42) == '%!PS-Adobe' or content:sub(31, 40) == '%!PS-Adobe' then
323
+ return 'application/postscript'
324
+ end
325
+ end
326
+
327
+ if _1_8 == '%!PS-Ado' and content:sub(9, 10) == 'be' then
328
+ return 'application/postscript'
329
+ end
330
+
331
+ if _1_4 == 'MM\x00*' or _1_4 == 'II*\x00' then
332
+ return 'image/tiff'
333
+ end
334
+
335
+ if _1_8 == '\x89PNG\r\n\x1A\n' then
336
+ return 'image/png'
337
+ end
338
+
339
+ if _1_6 == 'GIF87a' or _1_6 == 'GIF89a' then
340
+ return 'image/gif'
341
+ end
342
+
343
+ if _1_4 == 'RIFF' and _9_12 == 'WEBP' then
344
+ return 'image/webp'
345
+ end
346
+
347
+ if _1_2 == 'BM' and length > 14 and in_table(content:sub(15, 15), {'\x0C', '(', '@', '\x80'}) then
348
+ return 'image/x-ms-bmp'
349
+ end
350
+
351
+ local normal_jpeg = length > 10 and in_table(content:sub(7, 10), {'JFIF', 'Exif'})
352
+ local photoshop_jpeg = length > 24 and _1_4 == '\xFF\xD8\xFF\xED' and content:sub(21, 24) == '8BIM'
353
+ if normal_jpeg or photoshop_jpeg then
354
+ return 'image/jpeg'
355
+ end
356
+
357
+ if _1_4 == '8BPS' then
358
+ return 'image/vnd.adobe.photoshop'
359
+ end
360
+
361
+ if _1_8 == '\x00\x00\x00\x0CjP ' and _9_12 == '\r\n\x87\n' then
362
+ return 'image/jp2'
363
+ end
364
+
365
+ if _1_4 == '\x00\x00\x01\x00' then
366
+ return 'application/vnd.microsoft.icon'
367
+ end
368
+
369
+
370
+ -- Audio/Video
371
+ if _1_4 == '\x1AE\xDF\xA3' and length > 1000 then
372
+ local mimetype, err = ebml_parse(content)
373
+
374
+ if mimetype then
375
+ return mimetype
376
+ end
377
+ end
378
+
379
+ if _1_4 == 'MOVI' then
380
+ if in_table(content:sub(5, 8), {'moov', 'mdat'}) then
381
+ return 'video/quicktime'
382
+ end
383
+ end
384
+
385
+ if length > 8 and content:sub(5, 8) == 'ftyp' then
386
+ local lower_9_12 = _9_12:lower()
387
+
388
+ if in_table(lower_9_12, {'avc1', 'isom', 'iso2', 'mp41', 'mp42', 'mmp4', 'ndsc', 'ndsh', 'ndsm', 'ndsp', 'ndss', 'ndxc', 'ndxh', 'ndxm', 'ndxp', 'ndxs', 'f4v ', 'f4p ', 'm4v '}) then
389
+ return 'video/mp4'
390
+ end
391
+
392
+ if in_table(lower_9_12, {'msnv', 'ndas', 'f4a ', 'f4b ', 'm4a ', 'm4b ', 'm4p '}) then
393
+ return 'audio/mp4'
394
+ end
395
+
396
+ if in_table(lower_9_12, {'3g2a', '3g2b', '3g2c', 'kddi'}) then
397
+ return 'video/3gpp2'
398
+ end
399
+
400
+ if in_table(lower_9_12, {'3ge6', '3ge7', '3gg6', '3gp1', '3gp2', '3gp3', '3gp4', '3gp5', '3gp6', '3gs7'}) then
401
+ return 'video/3gpp'
402
+ end
403
+
404
+ if lower_9_12 == 'mqt ' or lower_9_12 == 'qt ' then
405
+ return 'video/quicktime'
406
+ end
407
+
408
+ if lower_9_12 == 'jp2 ' then
409
+ return 'image/jp2'
410
+ end
411
+ end
412
+
413
+ -- MP3
414
+ if bitwise_and(_1_2, '\xFF\xF6') == '\xFF\xF2' then
415
+ local byte_3 = content:sub(3, 3)
416
+ if bitwise_and(byte_3, '\xF0') ~= '\xF0' and bitwise_and(byte_3, "\x0C") ~= "\x0C" then
417
+ return 'audio/mpeg'
418
+ end
419
+ end
420
+ if _1_3 == 'ID3' then
421
+ return 'audio/mpeg'
422
+ end
423
+
424
+ if _1_4 == 'fLaC' then
425
+ return 'audio/x-flac'
426
+ end
427
+
428
+ if _1_8 == '0&\xB2u\x8Ef\xCF\x11' then
429
+ -- Without writing a full-on ASF parser, we can just scan for the
430
+ -- UTF-16 string "AspectRatio"
431
+ if content:find('\x00A\x00s\x00p\x00e\x00c\x00t\x00R\x00a\x00t\x00i\x00o', 1, true) then
432
+ return 'video/x-ms-wmv'
433
+ end
434
+ return 'audio/x-ms-wma'
435
+ end
436
+
437
+ if _1_4 == 'RIFF' and _9_12 == 'AVI ' then
438
+ return 'video/x-msvideo'
439
+ end
440
+
441
+ if _1_4 == 'RIFF' and _9_12 == 'WAVE' then
442
+ return 'audio/x-wav'
443
+ end
444
+
445
+ if _1_4 == 'FORM' and _9_12 == 'AIFF' then
446
+ return 'audio/x-aiff'
447
+ end
448
+
449
+ if _1_4 == 'OggS' then
450
+ local _29_33 = content:sub(29, 33)
451
+ if _29_33 == '\x01vorb' then
452
+ return 'audio/vorbis'
453
+ end
454
+ if _29_33 == '\x07FLAC' then
455
+ return 'audio/x-flac'
456
+ end
457
+ if _29_33 == 'OpusH' then
458
+ return 'audio/ogg'
459
+ end
460
+ -- Theora and OGM
461
+ if _29_33 == '\x80theo' or _29_33 == 'vide' then
462
+ return 'video/ogg'
463
+ end
464
+ end
465
+
466
+ if _1_3 == 'FWS' or _1_3 == 'CWS' then
467
+ return 'application/x-shockwave-flash'
468
+ end
469
+
470
+ if _1_3 == 'FLV' then
471
+ return 'video/x-flv'
472
+ end
473
+
474
+
475
+ if _1_5 == '%PDF-' then
476
+ return 'application/pdf'
477
+ end
478
+
479
+ if _1_5 == '{\\rtf' then
480
+ return 'text/rtf'
481
+ end
482
+
483
+
484
+ -- Office '97-2003 formats
485
+ if _1_8 == '\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1' then
486
+ if in_table(ext, {'xls', 'csv', 'tab'}) then
487
+ return 'application/vnd.ms-excel'
488
+ end
489
+ if ext == 'ppt' then
490
+ return 'application/vnd.ms-powerpoint'
491
+ end
492
+ -- We default to word since we need something if the extension isn't recognized
493
+ return 'application/msword'
494
+ end
495
+
496
+ if _1_8 == '\x09\x04\x06\x00\x00\x00\x10\x00' then
497
+ return 'application/vnd.ms-excel'
498
+ end
499
+
500
+ if _1_6 == '\xDB\xA5\x2D\x00\x00\x00' or _1_5 == '\x50\x4F\x5E\x51\x60' or _1_4 == '\xFE\x37\x00\x23' or _1_3 == '\x94\xA6\x2E' then
501
+ return 'application/msword'
502
+ end
503
+
504
+ if _1_4 == 'PK\x03\x04' then
505
+ -- Office XML formats
506
+ if ext == 'xlsx' then
507
+ return 'application/vnd.ms-excel'
508
+ end
509
+
510
+ if ext == 'pptx' then
511
+ return 'application/vnd.ms-powerpoint'
512
+ end
513
+
514
+ if ext == 'docx' then
515
+ return 'application/msword'
516
+ end
517
+
518
+ -- Open Office formats
519
+ if ext == 'ods' then
520
+ return 'application/vnd.oasis.opendocument.spreadsheet'
521
+ end
522
+
523
+ if ext == 'odp' then
524
+ return 'application/vnd.oasis.opendocument.presentation'
525
+ end
526
+
527
+ if ext == 'odt' then
528
+ return 'application/vnd.oasis.opendocument.text'
529
+ end
530
+
531
+ -- iWork - some programs like Mac Mail change the filename to
532
+ -- .numbers.zip, etc
533
+ if ext == 'pages' or ext == 'pages.zip' then
534
+ return 'application/vnd.apple.pages'
535
+ end
536
+ if ext == 'key' or ext == 'key.zip' then
537
+ return 'application/vnd.apple.keynote'
538
+ end
539
+ if ext == 'numbers' or ext == 'numbers.zip' then
540
+ return 'application/vnd.apple.numbers'
541
+ end
542
+
543
+ -- Otherwise just a zip
544
+ return 'application/zip'
545
+ end
546
+
547
+
548
+ -- Archives
549
+ if length > 257 then
550
+ if content:sub(258, 263) == 'ustar\x00' then
551
+ return 'application/x-tar'
552
+ end
553
+ if content:sub(258, 265) == 'ustar\x40\x40\x00' then
554
+ return 'application/x-tar'
555
+ end
556
+ end
557
+
558
+ if _1_7 == 'Rar!\x1A\x07\x00' or _1_8 == 'Rar!\x1A\x07\x01\x00' then
559
+ return 'application/x-rar-compressed'
560
+ end
561
+
562
+ if _1_2 == '\x1F\x9D' then
563
+ return 'application/x-compress'
564
+ end
565
+
566
+ if _1_2 == '\x1F\x8B' then
567
+ return 'application/x-gzip'
568
+ end
569
+
570
+ if _1_3 == 'BZh' then
571
+ return 'application/x-bzip2'
572
+ end
573
+
574
+ if _1_6 == '\xFD7zXZ\x00' then
575
+ return 'application/x-xz'
576
+ end
577
+
578
+ if _1_6 == '7z\xBC\xAF\x27\x1C' then
579
+ return 'application/x-7z-compressed'
580
+ end
581
+
582
+ if _1_2 == 'MZ' then
583
+ local pe_header_start = unpack_le(content:sub(61, 64))
584
+ local signature = content:sub(pe_header_start + 1, pe_header_start + 4)
585
+
586
+ if signature == 'PE\x00\x00' then
587
+ local image_file_header_start = pe_header_start + 5
588
+ local characteristics = content:sub(image_file_header_start + 18, image_file_header_start + 19)
589
+ local is_dll = bitwise_and(characteristics, '\x20\x00') == '\x20\x00'
590
+
591
+ if is_dll then
592
+ return 'application/x-msdownload'
593
+ end
594
+
595
+ return 'application/octet-stream'
596
+ end
597
+ end
598
+
599
+ return nil
600
+ end
601
+
602
+
603
+ function text_tests(content)
604
+ local lower_content = content:lower()
605
+
606
+ if content:find('^%%!PS-Adobe') then
607
+ return 'application/postscript'
608
+ end
609
+
610
+ if lower_content:find('<?php', 1, true) or content:find('<?=', 1, true) then
611
+ return 'application/x-httpd-php'
612
+ end
613
+
614
+ if lower_content:find('^%s*<%?xml') then
615
+ if content:find('<svg') then
616
+ return 'image/svg+xml'
617
+ end
618
+ if lower_content:find('<!doctype html') then
619
+ return 'application/xhtml+xml'
620
+ end
621
+ if content:find('<rss') then
622
+ return 'application/rss+xml'
623
+ end
624
+ return 'application/xml'
625
+ end
626
+
627
+ if lower_content:find('^%s*<html') or lower_content:find('^%s*<!doctype') then
628
+ return 'text/html'
629
+ end
630
+
631
+ if lower_content:find('^#![/a-z0-9]+ ?python') then
632
+ return 'application/x-python'
633
+ end
634
+
635
+ if lower_content:find('^#![/a-z0-9]+ ?perl') then
636
+ return 'application/x-perl'
637
+ end
638
+
639
+ if lower_content:find('^#![/a-z0-9]+ ?ruby') then
640
+ return 'application/x-ruby'
641
+ end
642
+
643
+ if lower_content:find('^#![/a-z0-9]+ ?php') then
644
+ return 'application/x-httpd-php'
645
+ end
646
+
647
+ if lower_content:find('^#![/a-z0-9]+ ?bash') then
648
+ return 'text/x-shellscript'
649
+ end
650
+
651
+ return nil
652
+ end
653
+
654
+
655
+ local ext_map = {
656
+ css = 'text/css',
657
+ csv = 'text/csv',
658
+ htm = 'text/html',
659
+ html = 'text/html',
660
+ xhtml = 'text/html',
661
+ ics = 'text/calendar',
662
+ js = 'application/javascript',
663
+ php = 'application/x-httpd-php',
664
+ php3 = 'application/x-httpd-php',
665
+ php4 = 'application/x-httpd-php',
666
+ php5 = 'application/x-httpd-php',
667
+ inc = 'application/x-httpd-php',
668
+ pl = 'application/x-perl',
669
+ cgi = 'application/x-perl',
670
+ py = 'application/x-python',
671
+ rb = 'application/x-ruby',
672
+ rhtml = 'application/x-ruby',
673
+ rss = 'application/rss+xml',
674
+ sh = 'text/x-shellscript',
675
+ tab = 'text/tab-separated-values',
676
+ vcf = 'text/x-vcard',
677
+ xml = 'application/xml'
678
+ }
679
+
680
+ function ext_tests(ext)
681
+ local mimetype = ext_map[ext]
682
+ if mimetype then
683
+ return mimetype
684
+ end
685
+ return 'text/plain'
686
+ end
687
+
688
+
689
+ local _M = {}
690
+
691
+
692
+ function _M.via_path(path, filename)
693
+ local f, err = io.open(path, 'r')
694
+ if not f then
695
+ return nil, err
696
+ end
697
+
698
+ local content = f:read(4096)
699
+ f:close()
700
+
701
+ if not filename then
702
+ filename = basename(path)
703
+ end
704
+
705
+ return _M.via_content(content, filename)
706
+ end
707
+
708
+
709
+ function _M.via_content(content, filename)
710
+ local ext = extension(filename)
711
+
712
+ -- If there are no low ASCII chars and no easily distinguishable tokens,
713
+ -- we need to detect by file extension
714
+
715
+ local mimetype = nil
716
+
717
+ mimetype = binary_tests(content, ext)
718
+ if mimetype then
719
+ return mimetype
720
+ end
721
+
722
+ -- Binary-looking files should have been detected so far
723
+ if content:find('[%z\x01-\x08\x0B\x0C\x0E-\x1F]') then
724
+ return 'application/octet-stream'
725
+ end
726
+
727
+ mimetype = text_tests(content)
728
+ if mimetype then
729
+ return mimetype
730
+ end
731
+
732
+ return ext_tests(ext)
733
+ end
734
+
735
+ return _M
_extensions/toc_lof/_extension.yml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ title: Toc_lof
2
+ author: Javed
3
+ version: 1.0.0
4
+ quarto-required: ">=1.3.0"
5
+ contributes:
6
+ filters:
7
+ - toc_lof.lua
8
+
_extensions/toc_lof/toc_lof.lua ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+
2
+ -- Reformat all heading text
3
+ function Header(el)
4
+ el.content = pandoc.Emph(el.content)
5
+ return el
6
+ end