hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b796ab326efbc761bb6f3d0cd8038b4cd04242ed | 8,715 | js | JavaScript | node_modules/emoji-as-array/index.js | dauzzie/dausie_blog | 20b408fb00a3ddc5e6b39ddcd3b471bee1561879 | [
"MIT"
] | null | null | null | node_modules/emoji-as-array/index.js | dauzzie/dausie_blog | 20b408fb00a3ddc5e6b39ddcd3b471bee1561879 | [
"MIT"
] | 1 | 2020-08-13T13:07:49.000Z | 2020-08-13T13:07:49.000Z | node_modules/emoji-as-array/index.js | dauzzie/dausie_blog | 20b408fb00a3ddc5e6b39ddcd3b471bee1561879 | [
"MIT"
] | null | null | null | module.exports = {
'people': ['๐', '๐ฌ', '๐', '๐', '๐', '๐', '๐
', '๐', '๐', '๐', '๐', '๐',
'๐', 'โบ๏ธ', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐',
'๐ค', '๐ค', '๐', '๐ค', '๐', '๐ถ', '๐', '๐', '๐', '๐', '๐ค', '๐ณ',
'๐', '๐', '๐ ', '๐ก', '๐', '๐', '๐', 'โน๏ธ', '๐ฃ', '๐', '๐ซ', '๐ฉ',
'๐ค', '๐ฎ', '๐ฑ', '๐จ', '๐ฐ', '๐ฏ', '๐ฆ', '๐ง', '๐ข', '๐ฅ', '๐ช', '๐',
'๐ญ', '๐ต', '๐ฒ', '๐ค', '๐ท', '๐ค', '๐ค', '๐ด', '๐ค', '๐ฉ', '๐', '๐ฟ',
'๐น', '๐บ', '๐', '๐ป', '๐ฝ', '๐ค', '๐บ', '๐ธ', '๐น', '๐ป', '๐ผ', '๐ฝ',
'๐', '๐ฟ', '๐พ', '๐', '๐', '๐', '๐', '๐', 'โ', 'โ๏ธ', '๐', 'โ',
'๐ช', '๐', 'โ๏ธ', '๐', '๐', '๐', '๐', '๐', '๐ค', '๐', 'โ๏ธ', '๐
',
'๐', '๐
', '๐', '๐', '๐', '๐', '๐ค', '๐ฃ', '๐ถ', '๐ฆ', '๐ง', '๐จ',
'๐ฉ', '๐ฑ', '๐ด', '๐ต', '๐ฒ', '๐ณ', '๐ฎ', '๐ท', '๐', '๐ต', '๐
', '๐ผ',
'๐ธ', '๐ฐ', '๐ถ', '๐', '๐', '๐ฏ', '๐ซ', '๐ฌ', '๐ญ', '๐', '๐', '๐
',
'๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐ฉโโค๏ธโ๐ฉ', '๐จโโค๏ธโ๐จ', '๐', '๐ฉโโค๏ธโ๐โ๐ฉ',
'๐จโโค๏ธโ๐โ๐จ', '๐ช', '๐จโ๐ฉโ๐ง', '๐จโ๐ฉโ๐งโ๐ฆ', '๐จโ๐ฉโ๐ฆโ๐ฆ', '๐จโ๐ฉโ๐งโ๐ง',
'๐ฉโ๐ฉโ๐ฆ', '๐ฉโ๐ฉโ๐ง', '๐ฉโ๐ฉโ๐งโ๐ฆ', '๐ฉโ๐ฉโ๐ฆโ๐ฆ', '๐ฉโ๐ฉโ๐งโ๐ง', '๐จโ๐จโ๐ฆ',
'๐จโ๐จโ๐ง', '๐จโ๐จโ๐งโ๐ฆ', '๐จโ๐จโ๐ฆโ๐ฆ', '๐จโ๐จโ๐งโ๐ง', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', '๐', '๐', '๐ฃ', '๐ ', '๐ก', '๐ข', '๐', '๐', '๐', '๐ฉ',
'โ', '๐', '๐', '๐', '๐', '๐', '๐', '๐ผ', '๐', '๐ถ', '๐', '๐'],
'nature': ['๐ถ', '๐ฑ', '๐ญ', '๐น', '๐ฐ', '๐ป', '๐ผ', '๐จ', '๐ฏ', '๐ฆ', '๐ฎ', '๐ท',
'๐ฝ', '๐ธ', '๐', '๐ต', '๐', '๐', '๐', '๐', '๐', '๐ง', '๐ฆ', '๐ค',
'๐ฃ', '๐ฅ', '๐บ', '๐', '๐ด', '๐ฆ', '๐', '๐', '๐', '๐', '๐', '๐ท',
'๐ฆ', '๐ฆ', '๐', '๐ข', '๐ ', '๐', '๐ก', '๐ฌ', '๐ณ', '๐', '๐', '๐',
'๐
', '๐', '๐', '๐', '๐ช', '๐ซ', '๐', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', '๐', '๐ฆ', '๐', '๐', '๐ฉ', '๐', '๐', '๐ฟ', '๐พ', '๐',
'๐ฒ', '๐ต', '๐', '๐ฒ', '๐ณ', '๐ด', '๐ฑ', '๐ฟ', 'โ', '๐', '๐', '๐',
'๐', '๐', '๐', '๐พ', '๐บ', '๐ป', '๐น', '๐ท', '๐ผ', '๐ธ', '๐', '๐',
'๐ฐ', '๐', '๐', '๐ธ', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', 'โญ๏ธ', '๐', '๐ซ',
'โจ', 'โ', 'โ๏ธ', '๐ค', 'โ
๏ธ', '๐ฅ', '๐ฆ', 'โ๏ธ', '๐ง', 'โ', '๐ฉ', 'โก๏ธ',
'๐ฅ', '๐ฅ', 'โ๏ธ', '๐จ', '๐ฅ', '๐ฅ', 'โ๏ธ', '๐จ', 'โ๏ธ', 'โ๏ธ', '๐ฌ', '๐จ',
'๐ช', '๐ซ', 'โ๏ธ', 'โ๏ธ', '๐ง', '๐ฆ', '๐'],
'food-and-drink': ['๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', '๐', '๐
', '๐', '๐ถ', '๐ฝ', '๐ ', '๐ฏ', '๐',
'๐ง', '๐', '๐', '๐ค', '๐ณ', '๐', '๐', '๐ญ', '๐', '๐',
'๐ฎ', '๐ฏ', '๐', '๐ฒ', '๐ฅ', '๐ฃ', '๐ฑ', '๐', '๐', '๐',
'๐', '๐ข', '๐ก', '๐ง', '๐จ', '๐ฆ', '๐ฐ', '๐', '๐ฎ', '๐ฌ',
'๐ญ', '๐ซ', '๐ฟ', '๐ฉ', '๐ช', '๐บ', '๐ป', '๐ท', '๐ธ', '๐น',
'๐พ', '๐ถ', '๐ต', 'โ๏ธ', '๐ผ', '๐ด', '๐ฝ'],
'activity': ['โฝ๏ธ', '๐', '๐', 'โพ๏ธ', '๐พ', '๐', '๐', '๐ฑ', 'โณ๏ธ', '๐', '๐', '๐ธ',
'๐', '๐', '๐', '๐ฟ', 'โท', '๐', 'โธ', '๐น', '๐ฃ', '๐ฃ', '๐', '๐',
'๐', 'โน', '๐', '๐ด', '๐ต', '๐', '๐ด', '๐', '๐ฝ', '๐
', '๐', '๐',
'๐ต', '๐ซ', '๐', '๐ญ', '๐จ', '๐ช', '๐ค', '๐ง', '๐ผ', '๐น', '๐ท', '๐บ',
'๐ธ', '๐ป', '๐ฌ', '๐ฎ', '๐พ', '๐ฏ', '๐ฒ', '๐ฐ', '๐ณ'],
'travel-and-places': ['๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', '๐', '๐', '๐ฒ', '๐จ', '๐', '๐', '๐', '๐',
'๐ก', '๐ ', '๐', '๐', '๐', '๐', '๐', '๐
', '๐', '๐',
'๐', '๐', '๐', '๐', '๐', '๐', '๐ฉ', 'โ๏ธ', '๐ซ', '๐ฌ',
'โต๏ธ', '๐ฅ', '๐ค', 'โด', '๐ณ', '๐', '๐ฐ', '๐บ', 'โ๏ธ', '๐ง',
'โฝ๏ธ', '๐', '๐ฆ', '๐ฅ', '๐', '๐ข', '๐ก', '๐ข', '๐ ', '๐',
'๐', '๐ผ', '๐ญ', 'โฒ๏ธ', '๐', 'โฐ', '๐', '๐ป', '๐', '๐พ',
'๐', 'โบ๏ธ', '๐', '๐ฃ', '๐ค', '๐
', '๐', '๐', '๐', '๐',
'๐', '๐', '๐', '๐', '๐', '๐', '๐ ', '๐', '๐', '๐',
'๐', '๐ฐ', '๐ฏ', '๐', '๐ฝ', '๐ ', '๐ก', '๐', '๐ข', '๐ฌ',
'๐ฃ', '๐ค', '๐ฅ', '๐ฆ', '๐จ', '๐ช', '๐ซ', '๐ฉ', '๐', '๐',
'โช๏ธ', '๐', '๐', '๐', 'โฉ'],
'objects': ['โ๏ธ', '๐ฑ', '๐ฒ', '๐ป', 'โจ', '๐ฅ', '๐จ', '๐ฑ', '๐ฒ', '๐น', '๐', '๐ฝ',
'๐พ', '๐ฟ', '๐', '๐ผ', '๐ท', '๐ธ', '๐น', '๐ฅ', '๐ฝ', '๐', '๐', 'โ๏ธ',
'๐', '๐ ', '๐บ', '๐ป', '๐', '๐', '๐', 'โฑ', 'โฒ', 'โฐ', '๐ฐ', 'โณ',
'โ๏ธ', '๐ก', '๐', '๐', '๐ก', '๐ฆ', '๐ฏ', '๐', '๐ข', '๐ธ', '๐ต', '๐ด',
'๐ถ', '๐ท', '๐ฐ', '๐ณ', '๐', 'โ', '๐ง', '๐จ', 'โ', '๐ ', 'โ', '๐ฉ',
'โ', 'โ', '๐ซ', '๐ฃ', '๐ช', '๐ก', 'โ', '๐ก', '๐ฌ', 'โ ', 'โฐ', 'โฑ',
'๐บ', '๐ฎ', '๐ฟ', '๐', 'โ', '๐ญ', '๐ฌ', '๐ณ', '๐', '๐', '๐ก', '๐ท',
'๐', '๐ฝ', '๐ฟ', '๐', '๐', '๐', '๐', '๐', '๐', '๐ช', '๐', '๐ผ',
'๐บ', 'โฑ', '๐ฟ', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐',
'๐', '๐ฎ', 'โ๏ธ', '๐ฉ', '๐จ', '๐ง', '๐', '๐ฎ', '๐ช', '๐ซ', '๐ฌ', '๐ญ',
'๐ฆ', '๐ฏ', '๐ฅ', '๐ค', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐
',
'๐', '๐', '๐', '๐', '๐ณ', '๐', '๐', '๐', '๐', '๐', '๐', '๐',
'๐ฐ', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐',
'๐', 'โ๏ธ', '๐', '๐', '๐', '๐', '๐ฉ', '๐ณ', '๐ด', '๐', '๐', '๐',
'๐', '๐', '๐', '๐', 'โ๏ธ', '๐', 'โ๏ธ', '๐', '๐', '๐', '๐'],
'symbols': ['โค๏ธ', '๐', '๐', '๐', '๐', 'โฃ๏ธ', '๐', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', 'โฎ', 'โ๏ธ', 'โช', '๐', 'โธ', 'โก๏ธ', '๐ฏ', '๐', 'โฏ๏ธ', 'โฆ', '๐',
'โ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ',
'โ๏ธ', '๐', 'โ', '๐ณ', '๐น', 'โข', 'โฃ', '๐ด', '๐ณ', '๐ถ', '๐๏ธ', '๐ธ',
'๐บ', '๐ท๏ธ', 'โด๏ธ', '๐', '๐', '๐ฎ', '๐', 'ใ๏ธ', 'ใ๏ธ', '๐ด', '๐ต', '๐ฒ',
'๐
ฐ๏ธ', '๐
ฑ๏ธ', '๐', '๐', '๐
พ๏ธ', '๐', 'โ๏ธ', '๐', '๐ซ', 'โ', 'โญ๏ธ', '๐ข',
'โจ๏ธ', '๐ท', '๐ฏ', '๐ณ', '๐ฑ', '๐', '๐ต', 'โ๏ธ', 'โ', 'โ', 'โ', 'โผ๏ธ',
'โ๏ธ', '๐ฏ', '๐
', '๐', '๐ฑ', 'โ', 'ใฝ๏ธ', 'โ ๏ธ', '๐ธ', '๐ฐ', 'โป๏ธ', '๐ฏ๏ธ',
'๐น', 'โ๏ธ', 'โณ๏ธ', 'โ', 'โ
', '๐ ', '๐', 'โฟ', '๐', 'โ๏ธ', '๐ง', '๐๏ธ',
'๐', '๐', '๐', '๐
', 'โฟ๏ธ', '๐ญ', '๐พ', '๐
ฟ๏ธ', '๐ฐ', '๐น', '๐บ', '๐ผ',
'๐ป', '๐ฎ', '๐ฆ', '๐ถ', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '0๏ธโฃ',
'1๏ธโฃ', '2๏ธโฃ', '3๏ธโฃ', '4๏ธโฃ', '5๏ธโฃ', '6๏ธโฃ', '7๏ธโฃ', '8๏ธโฃ', '9๏ธโฃ', '๐',
'๐ข', 'โถ๏ธ', 'โธ', 'โฏ', 'โน', 'โบ', 'โญ', 'โฎ', 'โฉ', 'โช', '๐', '๐',
'๐', 'โ๏ธ', '๐ผ', '๐ฝ', 'โซ', 'โฌ', 'โก๏ธ', 'โฌ
๏ธ', 'โฌ๏ธ', 'โฌ๏ธ', 'โ๏ธ', 'โ๏ธ',
'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', '๐', 'โช๏ธ', 'โฉ๏ธ', 'โคด๏ธ', 'โคต๏ธ', '#๏ธโฃ', '*๏ธโฃ', 'โน๏ธ',
'๐ค', '๐ก', '๐ ', '๐ฃ', '๐ต', '๐ถ', 'ใฐ๏ธ', 'โฐ', 'โ๏ธ', '๐', 'โ', 'โ',
'โ', 'โ๏ธ', '๐ฒ', '๐ฑ', 'ยฉ๏ธ', 'ยฎ๏ธ', 'โข๏ธ', '๐', '๐', '๐', '๐', '๐',
'โ๏ธ', '๐', 'โช๏ธ', 'โซ๏ธ', '๐ด', '๐ต', '๐ธ', '๐น', '๐ถ', '๐ท', '๐บ', 'โช๏ธ',
'โซ๏ธ', 'โฌ๏ธ', 'โฌ๏ธ', '๐ป', 'โผ๏ธ', 'โป๏ธ', 'โพ๏ธ', 'โฝ๏ธ', '๐ฒ', '๐ณ', '๐', '๐',
'๐', '๐', '๐ฃ', '๐ข', '๐', '๐', '๐', '๐๏ธ', 'โ ๏ธ', 'โฃ๏ธ', 'โฅ๏ธ', 'โฆ๏ธ',
'๐ด', '๐โ๐จ', '๐ญ', '๐ฏ', '๐ฌ', '๐', '๐', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐ ', '๐ก', '๐ข',
'๐ฃ', '๐ค', '๐ฅ', '๐ฆ', '๐ง'],
'flags': ['๐ฆ๐ซ', '๐ฆ๐ฝ', '๐ฆ๐ฑ', '๐ฉ๐ฟ', '๐ฆ๐ธ', '๐ฆ๐ฉ', '๐ฆ๐ด', '๐ฆ๐ฎ', '๐ฆ๐ถ',
'๐ฆ๐ฌ', '๐ฆ๐ท', '๐ฆ๐ฒ', '๐ฆ๐ผ', '๐ฆ๐บ', '๐ฆ๐น', '๐ฆ๐ฟ', '๐ง๐ธ', '๐ง๐ญ',
'๐ง๐ฉ', '๐ง๐ง', '๐ง๐พ', '๐ง๐ช', '๐ง๐ฟ', '๐ง๐ฏ', '๐ง๐ฒ', '๐ง๐น', '๐ง๐ด',
'๐ง๐ถ', '๐ง๐ฆ', '๐ง๐ผ', '๐ง๐ท', '๐ฎ๐ด', '๐ป๐ฌ', '๐ง๐ณ', '๐ง๐ฌ', '๐ง๐ซ',
'๐ง๐ฎ', '๐จ๐ป', '๐ฐ๐ญ', '๐จ๐ฒ', '๐จ๐ฆ', '๐ฎ๐จ', '๐ฐ๐พ', '๐จ๐ซ', '๐น๐ฉ',
'๐จ๐ฑ', '๐จ๐ณ', '๐จ๐ฝ', '๐จ๐จ', '๐จ๐ด', '๐ฐ๐ฒ', '๐จ๐ฌ', '๐จ๐ฉ', '๐จ๐ฐ',
'๐จ๐ท', '๐ญ๐ท', '๐จ๐บ', '๐จ๐ผ', '๐จ๐พ', '๐จ๐ฟ', '๐ฉ๐ฐ', '๐ฉ๐ฏ', '๐ฉ๐ฒ',
'๐ฉ๐ด', '๐ช๐จ', '๐ช๐ฌ', '๐ธ๐ป', '๐ฌ๐ถ', '๐ช๐ท', '๐ช๐ช', '๐ช๐น', '๐ช๐บ',
'๐ซ๐ฐ', '๐ซ๐ด', '๐ซ๐ฏ', '๐ซ๐ฎ', '๐ซ๐ท', '๐ฌ๐ซ', '๐ต๐ซ', '๐น๐ซ', '๐ฌ๐ฆ',
'๐ฌ๐ฒ', '๐ฌ๐ช', '๐ฉ๐ช', '๐ฌ๐ญ', '๐ฌ๐ฎ', '๐ฌ๐ท', '๐ฌ๐ฑ', '๐ฌ๐ฉ', '๐ฌ๐ต',
'๐ฌ๐บ', '๐ฌ๐น', '๐ฌ๐ฌ', '๐ฌ๐ณ', '๐ฌ๐ผ', '๐ฌ๐พ', '๐ญ๐น', '๐ญ๐ณ', '๐ญ๐ฐ',
'๐ญ๐บ', '๐ฎ๐ธ', '๐ฎ๐ณ', '๐ฎ๐ฉ', '๐ฎ๐ท', '๐ฎ๐ถ', '๐ฎ๐ช', '๐ฎ๐ฒ', '๐ฎ๐ฑ',
'๐ฎ๐น', '๐จ๐ฎ', '๐ฏ๐ฒ', '๐ฏ๐ต', '๐ฏ๐ช', '๐ฏ๐ด', '๐ฐ๐ฟ', '๐ฐ๐ช', '๐ฐ๐ฎ',
'๐ฝ๐ฐ', '๐ฐ๐ผ', '๐ฐ๐ฌ', '๐ฑ๐ฆ', '๐ฑ๐ป', '๐ฑ๐ง', '๐ฑ๐ธ', '๐ฑ๐ท', '๐ฑ๐พ',
'๐ฑ๐ฎ', '๐ฑ๐น', '๐ฑ๐บ', '๐ฒ๐ด', '๐ฒ๐ฐ', '๐ฒ๐ฌ', '๐ฒ๐ผ', '๐ฒ๐พ', '๐ฒ๐ป',
'๐ฒ๐ฑ', '๐ฒ๐น', '๐ฒ๐ญ', '๐ฒ๐ถ', '๐ฒ๐ท', '๐ฒ๐บ', '๐พ๐น', '๐ฒ๐ฝ', '๐ซ๐ฒ',
'๐ฒ๐ฉ', '๐ฒ๐จ', '๐ฒ๐ณ', '๐ฒ๐ช', '๐ฒ๐ธ', '๐ฒ๐ฆ', '๐ฒ๐ฟ', '๐ฒ๐ฒ', '๐ณ๐ฆ',
'๐ณ๐ท', '๐ณ๐ต', '๐ณ๐ฑ', '๐ณ๐จ', '๐ณ๐ฟ', '๐ณ๐ฎ', '๐ณ๐ช', '๐ณ๐ฌ', '๐ณ๐บ',
'๐ณ๐ซ', '๐ฒ๐ต', '๐ฐ๐ต', '๐ณ๐ด', '๐ด๐ฒ', '๐ต๐ฐ', '๐ต๐ผ', '๐ต๐ธ', '๐ต๐ฆ',
'๐ต๐ฌ', '๐ต๐พ', '๐ต๐ช', '๐ต๐ญ', '๐ต๐ณ', '๐ต๐ฑ', '๐ต๐น', '๐ต๐ท', '๐ถ๐ฆ',
'๐ท๐ช', '๐ท๐ด', '๐ท๐บ', '๐ท๐ผ', '๐ง๐ฑ', '๐ธ๐ญ', '๐ฐ๐ณ', '๐ฑ๐จ', '๐ต๐ฒ',
'๐ป๐จ', '๐ผ๐ธ', '๐ธ๐ฒ', '๐ธ๐น', '๐ธ๐ฆ', '๐ธ๐ณ', '๐ท๐ธ', '๐ธ๐จ', '๐ธ๐ฑ',
'๐ธ๐ฌ', '๐ธ๐ฝ', '๐ธ๐ฐ', '๐ธ๐ฎ', '๐ธ๐ง', '๐ธ๐ด', '๐ฟ๐ฆ', '๐ฌ๐ธ', '๐ฐ๐ท',
'๐ธ๐ธ', '๐ช๐ธ', '๐ฑ๐ฐ', '๐ธ๐ฉ', '๐ธ๐ท', '๐ธ๐ฟ', '๐ธ๐ช', '๐จ๐ญ', '๐ธ๐พ',
'๐น๐ผ', '๐น๐ฏ', '๐น๐ฟ', '๐น๐ญ', '๐น๐ฑ', '๐น๐ฌ', '๐น๐ฐ', '๐น๐ด', '๐น๐น',
'๐น๐ณ', '๐น๐ท', '๐น๐ฒ', '๐น๐จ', '๐น๐ป', '๐บ๐ฌ', '๐บ๐ฆ', '๐ฆ๐ช', '๐ฌ๐ง',
'๐บ๐ธ', '๐ป๐ฎ', '๐บ๐พ', '๐บ๐ฟ', '๐ป๐บ', '๐ป๐ฆ', '๐ป๐ช', '๐ป๐ณ', '๐ผ๐ซ',
'๐ช๐ญ', '๐พ๐ช', '๐ฟ๐ฒ', '๐ฟ๐ผ'],
}
| 70.282258 | 86 | 0.010327 |
b7979679776b10ef37b02f5fb6d3c9ee42e8e1c5 | 2,461 | js | JavaScript | resources/assets/js/app.js | spcbeck/adformats | 0ab3c83b9a3f79a5dbcf6f6e686201bf9165b3a7 | [
"MIT"
] | null | null | null | resources/assets/js/app.js | spcbeck/adformats | 0ab3c83b9a3f79a5dbcf6f6e686201bf9165b3a7 | [
"MIT"
] | null | null | null | resources/assets/js/app.js | spcbeck/adformats | 0ab3c83b9a3f79a5dbcf6f6e686201bf9165b3a7 | [
"MIT"
] | null | null | null | import $ from 'jquery'
import {
jarallax
} from 'jarallax';
if ($(window).width() < 768) {
jarallax(document.querySelectorAll('.jarallax'), {
imgPosition: '0 15px',
imgSize: 'contain',
speed: .7
});
}
jarallax(document.querySelectorAll('.jarallax'), {
imgPosition: '48vw -15px',
imgSize: 'scale-down'
});
$('#loginform').prepend('<h2 class="h5">Login Portal</h2><p class="h3">Browse Pixability\'s available video ad inventory and view specifications and requirements.</p>');
$(document).ready(function() {
$('#filter').submit(function(event){
event.preventDefault();
var filter = $('#filter');
$.ajax({
url:filter.attr('action'),
data:filter.serialize(), // form data
type:filter.attr('method'), // POST
beforeSend:function(xhr){
},
success:function(data){
$('#response').html(data); // insert data
$('.adformat-cards').each(function() {
if(!$.trim($(this).html())) {
$(this).prev().hide();
}
});
document.querySelector(".card-flip").classList.toggle("flip");
$('.card-flip').click(function() {
$(this).toggleClass('hover');
});
}
});
return false;
});
$('#filter').submit();
$('.card-flip').click(function() {
$(this).toggleClass('hover');
});
$("a[href^=#]").click(function(e) {
e.preventDefault();
var dest = $(this).attr('href');
$('html,body').animate({ scrollTop: $(dest).offset().top }, 'slow'); });
document.querySelector( "#mobiletoggle" ).addEventListener( "click", function() {
this.classList.toggle( "active" );
});
$("li.menu-item-has-children a").on('click touch', function () {
if(!$(this).hasClass("active")) {
$("li.menu-item-has-children .active").removeClass("active");
$(this).addClass("active");
$(this).next().addClass("active");
} else {
$(this).removeClass("active");
$(this).next().removeClass("active");
}
})
$('#mobiletoggle, #mobileclose').click(function(){
$("#nav.mobile").toggleClass("on");
return false;
});
$('#filter input[type=checkbox]').change(function() {
if(this.checked) {
$(this).prop("checked", true);
$('#filter').submit();
} else {
$(this).prop("checked", false);
$('#filter').submit();
}
});
})
| 27.043956 | 169 | 0.536774 |
b797b60e993a114f840f1fc81018f615adf89899 | 387 | js | JavaScript | lib/changes/removeTable.js | guruhq/slate-edit-table | a384dbd86467b041072b8b8db35d3099c4ba5df5 | [
"Apache-2.0"
] | 1 | 2020-10-08T07:07:25.000Z | 2020-10-08T07:07:25.000Z | lib/changes/removeTable.js | guruhq/slate-edit-table | a384dbd86467b041072b8b8db35d3099c4ba5df5 | [
"Apache-2.0"
] | 4 | 2020-08-24T13:52:27.000Z | 2020-09-23T14:21:46.000Z | lib/changes/removeTable.js | guruhq/slate-edit-table | a384dbd86467b041072b8b8db35d3099c4ba5df5 | [
"Apache-2.0"
] | 1 | 2017-12-05T16:51:31.000Z | 2017-12-05T16:51:31.000Z | // @flow
import { type Change } from "slate";
import type Options from "../options";
import removeTableByKey from "./removeTableByKey";
/**
* Delete the whole table at position
*/
function removeTable(opts: Options, change: Change): Change {
const { value } = change;
const { startKey } = value;
return removeTableByKey(opts, change, startKey);
}
export default removeTable;
| 21.5 | 61 | 0.70801 |
b79800df3e64872679b8b726db15a37513ce88a9 | 53 | js | JavaScript | test/fixtures/foo.js | fmmartins/reqdir | 3ab5672bc9673b155e7d378a088dd0dadb34683e | [
"MIT"
] | 1 | 2020-08-10T11:45:25.000Z | 2020-08-10T11:45:25.000Z | test/fixtures/foo.js | fmmartins/reqdir | 3ab5672bc9673b155e7d378a088dd0dadb34683e | [
"MIT"
] | null | null | null | test/fixtures/foo.js | fmmartins/reqdir | 3ab5672bc9673b155e7d378a088dd0dadb34683e | [
"MIT"
] | null | null | null |
module.exports = function foo(bar) {
return bar;
} | 13.25 | 36 | 0.679245 |
b798c4e6c83422aa1ab92980b62ec795055dab9f | 9,362 | js | JavaScript | src/components/custom/main-form/index.js | olimed/web-component | 2b974ae22b2ce972a7c5846914e23a5cafd6e443 | [
"MIT"
] | null | null | null | src/components/custom/main-form/index.js | olimed/web-component | 2b974ae22b2ce972a7c5846914e23a5cafd6e443 | [
"MIT"
] | null | null | null | src/components/custom/main-form/index.js | olimed/web-component | 2b974ae22b2ce972a7c5846914e23a5cafd6e443 | [
"MIT"
] | null | null | null | import uniqueId from "lodash/uniqueId";
import { TYPES_OF_INSERT, EVENT_NAMES, VIEW_NAMES } from "../../../const/index";
import FormComponent from "../../form/index";
import ButtonComponent from "../../button/index";
import IconComponent from "../../icon/index";
import InputComponent from "../../input/index";
import ResultField from "../field-with-result/index";
import Suggest from "../suggest/index";
import Component from "../../classes/index";
/**
* Multiselect component
*
* @class
*/
export default class MultiSelectComponent extends FormComponent {
static VIEW_CLASS_NAME = "app-multiselect";
constructor(cfg = {}) {
const id =
cfg.attributes && cfg.attributes.id
? cfg.attributes.id
: cfg.id || uniqueId("multiselect:view");
super({
className: `${MultiSelectComponent.VIEW_CLASS_NAME} ${
cfg.className || ""
}`,
attributes: {
...(cfg.attributes || {}),
id,
},
});
this._options = cfg.options || [];
this._parentNode = cfg.parentNode || document.body;
this.renderMultiselect();
}
renderMultiselect() {
this.renderElements();
this.renderComponent(this.parentNode, TYPES_OF_INSERT.APPEND);
this._renderDefaultState();
this.events();
}
renderElements() {
this.elements = [
this.fieldWithSelectedItems,
this.wrapperInputField,
this.selectIconView,
this.clearButtonView,
];
this.setElements();
}
_renderDefaultState() {
const node = this.fieldWithSelectedItems.element;
if (node) {
this.defaultView.renderComponent(node, TYPES_OF_INSERT.APPEND);
}
}
get mainFieldId() {
if (!this._mainFieldId) {
this._mainFieldId = uniqueId("main:selected:field");
}
return this._mainFieldId;
}
get parentNode() {
return this._parentNode;
}
get fieldWithSelectedItems() {
if (!this._fieldWithSelectedItems) {
this._fieldWithSelectedItems = new Component({
className: "selected-item",
attributes: {
id: this.mainFieldId,
},
});
this._fieldWithSelectedItems.createComponent();
}
return this._fieldWithSelectedItems;
}
get wrapperInputId() {
if (!this._wrapperInputId) {
this._wrapperInputId = uniqueId("wrapper:input:div");
}
return this._wrapperInputId;
}
get wrapperInputField() {
if (!this._wrapperInputField) {
this._wrapperInputField = new Component({
className: "wrapper",
attributes: {
id: this.wrapperInputId,
},
});
this._wrapperInputField
.createComponent()
.appendChild(this.searchInputView.element);
}
return this._wrapperInputField;
}
get searchInputId() {
if (!this._searchInputId) {
this._searchInputId = uniqueId("search:input:view");
}
return this._searchInputId;
}
get searchInputView() {
if (!this._searchInputView) {
this._searchInputView = new InputComponent({
className: "suggest-input",
attributes: {
id: this.searchInputId,
placeholder: "Select a data",
autofocus: false,
},
on: {
[EVENT_NAMES.INPUT]: this.onKeyPress.bind(this),
},
});
}
return this._searchInputView;
}
get selectIconId() {
if (!this._selectIconId) {
this._selectIconId = uniqueId("select:icon:view");
}
return this._selectIconId;
}
get selectIconView() {
if (!this._selectIconView) {
this._selectIconView = new IconComponent({
icon: "mdi-menu-down",
className: "pos--fixes",
attributes: {
"area-label": "Open suggest with items",
id: this.selectIconId,
},
on: {
[EVENT_NAMES.CLICK]: this._iconClick.bind(this),
},
});
}
return this._selectIconView;
}
get clearButtonId() {
if (!this._clearButtonId) {
this._clearButtonId = uniqueId("clear:button:view");
}
return this._clearButtonId;
}
get clearButtonView() {
if (!this._clearButtonView) {
this._clearButtonView = new ButtonComponent({
label: "Clear selection",
className: "pos--fixes pos--left",
hidden: true,
attributes: {
id: this.clearButtonId,
type: "button",
},
on: {
[EVENT_NAMES.CLICK]: this.clear.bind(this),
},
});
}
return this._clearButtonView;
}
get suggestId() {
if (!this._suggestId) {
this._suggestId = uniqueId("suggest:view");
}
return this._suggestId;
}
get suggest() {
if (!this._suggest) {
this._suggest = new Suggest({
className: "suggest-items",
attributes: {
id: this.suggestId,
},
options: this._options,
on: {
onItemClick: this.selectItem.bind(this),
},
});
}
return this._suggest;
}
get inputView() {
return this.searchInputView.element;
}
get iconView() {
return this.selectIconView.element;
}
get defaultStateId() {
if (!this._defaultStateId) {
this._defaultStateId = uniqueId("default:state:view");
}
return this._defaultStateId;
}
get defaultView() {
if (!this._defaultView) {
this._defaultView = new ResultField({
className: "selected-item",
id: this.defaultStateId,
icon: false,
innerText: {},
value: "All",
});
}
return this._defaultView;
}
get selectedItems() {
if (!this._selectedItems) {
this._selectedItems = {};
}
return this._selectedItems;
}
onKeyPress() {
this.openSuggest(this.inputView.value);
}
openSuggest(val) {
const iconComponent = this.selectIconView;
this.inputView.parentNode.appendChild(this.suggest.element);
this.suggest.setListWithOptions(val);
iconComponent.changeIcon(val ? "mdi-close" : "mdi-menu-down");
}
closeSuggest(target) {
const iconComponent = this.selectIconView;
this.inputView.value = "";
this.suggest.closeAllLists(target);
iconComponent.changeIcon("mdi-menu-down");
}
_iconClick(e) {
if (this.selectIconView.icon == "mdi-menu-down") {
this.openSuggest(true);
} else {
this.closeSuggest(e.target);
}
}
events() {
this.element.addEventListener("closeSuggest", (e) => {
this.closeSuggest(e.target);
});
document.onclick = (e) => {
const allMultiselects = document.getElementsByClassName(
MultiSelectComponent.VIEW_CLASS_NAME
);
if (allMultiselects.length) {
const multiselect = e.target.closest(
`.${MultiSelectComponent.VIEW_CLASS_NAME}`
);
[...allMultiselects].forEach((elem) => {
if (elem != multiselect) {
elem.dispatchEvent(new Event("closeSuggest"));
}
});
}
};
}
clear() {
Object.keys(this.selectedItems).forEach((key) => {
this.unselectItem(false, key);
});
this.clearButtonView.hide();
this.defaultView.show();
}
selectItem(e, option) {
this.closeSuggest();
if (option.select) {
this.unselectItem(e, option.id);
if (
!Object.keys(this.selectedItems).length &&
!this.clearButtonView.hidden
) {
this.clearButtonView.hide();
this.defaultView.show();
}
return true;
}
this.suggest.changeStateItem(option.id, option.select ? false : true);
const fieldNode = this.fieldWithSelectedItems.element;
if (fieldNode) {
const value = new ResultField({
className: "selected-item",
icon: {
icon: "mdi mdi-close-outline",
attributes: {
"area-label": "Remove item from field and unselect in suggest",
},
on: {
[EVENT_NAMES.CLICK]: this.unselectItem.bind(this, e, option.id),
[EVENT_NAMES.KEY_DOWN]: this.keyDownEvent.bind(
this,
option.id,
VIEW_NAMES.ICON
),
},
},
innerText: {},
value: option.value,
});
value.renderComponent(fieldNode, TYPES_OF_INSERT.APPEND);
this.selectedItems[option.id] = value;
}
if (Object.keys(this.selectedItems).length && this.clearButtonView.hidden) {
this.clearButtonView.show();
this.defaultView.hide();
}
return true;
}
unselectItem(e, optionId) {
this.selectedItems[optionId].removeView();
delete this.selectedItems[optionId];
this.suggest.changeStateItem(optionId);
if (!Object.keys(this.selectedItems).length) {
this.clear();
}
}
keyDownEvent(optionId, viewName, e) {
switch (e.keyCode) {
case 40:
break;
case 38:
break;
case 13:
if (viewName == VIEW_NAMES.ICON) {
this.unselectItem(e, optionId);
}
break;
default:
break;
}
}
}
| 25.579235 | 81 | 0.571993 |
b7994173d598deda00ecd9a10ca885b2fcb727bd | 1,999 | js | JavaScript | src/operations/v1/list-training-data-containing-document.js | ptxyz/wd-utils | 6671c52cc60f783478ffefdb78dfeeb02dbcde28 | [
"Apache-2.0"
] | null | null | null | src/operations/v1/list-training-data-containing-document.js | ptxyz/wd-utils | 6671c52cc60f783478ffefdb78dfeeb02dbcde28 | [
"Apache-2.0"
] | null | null | null | src/operations/v1/list-training-data-containing-document.js | ptxyz/wd-utils | 6671c52cc60f783478ffefdb78dfeeb02dbcde28 | [
"Apache-2.0"
] | null | null | null | const yargs = require('yargs')
const util = require('util')
const core = require('../../lib')
async function main (argv) {
// get connection
const conn = await core.connection.initConnection(argv.connection)
// retrieve training data
const td = (await core.wds.getTrainingData(conn)).data[0]
// identify queries that are affected
const qs = core.helpers.getMatchingQueriesAndExamples(td, argv.document_id, argv.include_segments)
// inspect the matches
console.log(util.inspect(qs, { depth: 8, maxArrayLength: Infinity, colors: true }))
// calculate unique queries and examples affected
const uniqueQueries = qs.map(v => v.query.query_id).filter(core.helpers.onlyUnique)
console.log('')
console.log(`training queries containing document: ${uniqueQueries.length}`)
console.log(`matched examples in training data: ${qs.length}`)
// TODO: merge multiple matches on same query into 1 single entry
if (argv.report && !process.env.DRY_RUN) {
await core.helpers.writeObjectToFile({ matchingExamples: qs }, argv.report)
console.log(`affected queries written to ${argv.report}`)
}
return new core.classes.Result(1, 0, 0, [qs])
}
function getArgs () {
return yargs
.option('document_id', {
alias: 'd',
describe: 'document id to find in training examples'
})
.option('connection', {
alias: 'c',
describe: 'WDS connection info JSON'
})
.option('report', {
alias: 'r',
describe: 'write affected training data to this file'
})
.option('include_segments', {
alias: 's',
describe: 'include document and any associated segments',
type: 'boolean',
default: true
})
.option('dry_run', {
alias: 'z',
describe: 'dry run of operation',
type: 'boolean',
default: false
})
.demandOption(['document_id', 'connection'], 'Requires a document id and WDS connection')
.argv
}
module.exports = () => { core.execution.execute(main, getArgs()) }
| 30.753846 | 100 | 0.665333 |
b79a419eb3510064247cf9b38aebfa3a13c07790 | 1,617 | js | JavaScript | packages/ext-react-kitchensink/src/examples/Calendar/TimezoneSupport/data.js | msgimanila/EXT-React-MSG | 9e78cceedc85204d28584849d64214e638f2b6f6 | [
"Apache-2.0"
] | 94 | 2018-08-29T15:23:23.000Z | 2022-01-30T07:46:28.000Z | packages/ext-react-kitchensink/src/examples/Calendar/TimezoneSupport/data.js | msgimanila/EXT-React-MSG | 9e78cceedc85204d28584849d64214e638f2b6f6 | [
"Apache-2.0"
] | 49 | 2018-08-21T22:44:33.000Z | 2021-08-11T21:08:29.000Z | packages/ext-react-kitchensink/src/examples/Calendar/TimezoneSupport/data.js | msgimanila/EXT-React-MSG | 9e78cceedc85204d28584849d64214e638f2b6f6 | [
"Apache-2.0"
] | 46 | 2018-08-08T17:12:19.000Z | 2021-11-11T10:00:49.000Z | Ext.define('KitchenSink.data.calendar.Timezone', { }, function() {
var U = KitchenSink.data.calendar.Util,
D = Ext.Date,
data = {
work: (function() {
var today = D.clearTime(new Date(), true),
tomorrow = D.add(today, D.DAY, 1),
ret = [];
ret.push({
title: 'Write unit tests',
allDay: true,
startDate: U.setHours(today, 0, 0),
endDate: U.setHours(tomorrow, 0, 0)
}, {
title: 'Paris Client Meeting',
startDate: U.setHours(today, 8, 30),
endDate: U.setHours(today, 9, 30)
}, {
title: 'Sydney Team Meeting',
startDate: U.setHours(today, 21, 0),
endDate: U.setHours(today, 22, 0)
});
return U.generateIds(ret, 0);
})()
};
Ext.ux.ajax.SimManager.register({
'/KitchenSink/CalendarTimezone': {
type: 'json',
data: [{
id: 1,
title: 'Work',
eventStore: {
proxy: {
type: 'ajax',
url: '/KitchenSink/CalendarTimezone/1'
}
}
}]
},
'/KitchenSink/CalendarTimezone/1': {
type: 'json',
data: function(ctx) {
return U.generateOutput(data.work, 1, ctx);
}
}
});
}); | 32.34 | 67 | 0.387755 |
b79b00cc157cdbed46c1fa4a125ca2c0bce80964 | 192 | js | JavaScript | src/constants.js | harsha-iiiv/alan_timer | 2bcd6930a828b698c94ffb1fa57efe78017b191e | [
"Apache-2.0"
] | null | null | null | src/constants.js | harsha-iiiv/alan_timer | 2bcd6930a828b698c94ffb1fa57efe78017b191e | [
"Apache-2.0"
] | 4 | 2020-06-08T09:09:14.000Z | 2022-02-13T14:42:33.000Z | src/constants.js | harsha-iiiv/alan_timer | 2bcd6930a828b698c94ffb1fa57efe78017b191e | [
"Apache-2.0"
] | null | null | null | export const ADD_REMINDER = 'ADD_REMINDER';
export const DELETE_REMINDER = 'DELETE_REMINDER';
export const CLEAR_REMINDER = 'CLEAR_REMINDER';
export const DELETE_LREMINDER = 'DELETE_LREMINDER' | 48 | 50 | 0.822917 |
b79c83b9f2b5c12b2077643b400b99e900380896 | 4,704 | js | JavaScript | app/ui-admin/client/components/info/UsageSection.js | BetaBlocksCo/Rocket.Chat | b00a99ccaa66b47a9fe581fd81de34de547f6bb7 | [
"MIT"
] | 1 | 2020-04-23T00:38:56.000Z | 2020-04-23T00:38:56.000Z | app/ui-admin/client/components/info/UsageSection.js | BetaBlocksCo/Rocket.Chat | b00a99ccaa66b47a9fe581fd81de34de547f6bb7 | [
"MIT"
] | 2 | 2021-08-04T02:10:26.000Z | 2022-01-15T02:30:56.000Z | app/ui-admin/client/components/info/UsageSection.js | BetaBlocksCo/Rocket.Chat | b00a99ccaa66b47a9fe581fd81de34de547f6bb7 | [
"MIT"
] | null | null | null | import { Subtitle, Skeleton } from '@rocket.chat/fuselage';
import React from 'react';
import { useTranslation } from '../../../../../client/contexts/TranslationContext';
import { useFormatMemorySize } from '../../../../ui/client/views/app/components/hooks';
import { DescriptionList } from './DescriptionList';
export function UsageSection({ statistics, isLoading }) {
const s = (fn) => (isLoading ? <Skeleton width='50%' /> : fn());
const formatMemorySize = useFormatMemorySize();
const t = useTranslation();
return <>
<Subtitle data-qa='usage-title'>{t('Usage')}</Subtitle>
<DescriptionList data-qa='usage-list'>
<DescriptionList.Entry label={t('Stats_Total_Users')}>{s(() => statistics.totalUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Active_Users')}>{s(() => statistics.activeUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Active_Guests')}>{s(() => statistics.activeGuests)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_App_Users')}>{s(() => statistics.appUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Non_Active_Users')}>{s(() => statistics.nonActiveUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Connected_Users')}>{s(() => statistics.totalConnectedUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Online_Users')}>{s(() => statistics.onlineUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Away_Users')}>{s(() => statistics.awayUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Offline_Users')}>{s(() => statistics.offlineUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Rooms')}>{s(() => statistics.totalRooms)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Channels')}>{s(() => statistics.totalChannels)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Private_Groups')}>{s(() => statistics.totalPrivateGroups)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Direct_Messages')}>{s(() => statistics.totalDirect)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Livechat_Rooms')}>{s(() => statistics.totalLivechat)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Total_Discussions')}>{s(() => statistics.totalDiscussions)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Total_Threads')}>{s(() => statistics.totalThreads)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Messages')}>{s(() => statistics.totalMessages)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Messages_Channel')}>{s(() => statistics.totalChannelMessages)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Messages_PrivateGroup')}>{s(() => statistics.totalPrivateGroupMessages)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Messages_Direct')}>{s(() => statistics.totalDirectMessages)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Messages_Livechat')}>{s(() => statistics.totalLivechatMessages)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Uploads')}>{s(() => statistics.uploadsTotal)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Uploads_Size')}>{s(() => formatMemorySize(statistics.uploadsTotalSize))}</DescriptionList.Entry>
{statistics && statistics.apps && <>
<DescriptionList.Entry label={t('Stats_Total_Installed_Apps')}>{statistics.apps.totalInstalled}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Active_Apps')}>{statistics.apps.totalActive}</DescriptionList.Entry>
</>}
<DescriptionList.Entry label={t('Stats_Total_Integrations')}>{s(() => statistics.integrations.totalIntegrations)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Incoming_Integrations')}>{s(() => statistics.integrations.totalIncoming)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Active_Incoming_Integrations')}>{s(() => statistics.integrations.totalIncomingActive)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Outgoing_Integrations')}>{s(() => statistics.integrations.totalOutgoing)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Active_Outgoing_Integrations')}>{s(() => statistics.integrations.totalOutgoingActive)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Integrations_With_Script_Enabled')}>{s(() => statistics.integrations.totalWithScriptEnabled)}</DescriptionList.Entry>
</DescriptionList>
</>;
}
| 90.461538 | 165 | 0.753827 |
b79c8aecb260acdf3a55bda660b6ca68d995038e | 12,381 | js | JavaScript | src/components/CohortBuilder/SearchAll/index.js | francisl/kf-portal-ui | 3f03500615e8d9c97b09809827c8cd7212e02602 | [
"Apache-2.0"
] | null | null | null | src/components/CohortBuilder/SearchAll/index.js | francisl/kf-portal-ui | 3f03500615e8d9c97b09809827c8cd7212e02602 | [
"Apache-2.0"
] | null | null | null | src/components/CohortBuilder/SearchAll/index.js | francisl/kf-portal-ui | 3f03500615e8d9c97b09809827c8cd7212e02602 | [
"Apache-2.0"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
import SearchIcon from 'react-icons/lib/fa/search';
import { compose } from 'recompose';
import autobind from 'auto-bind-es5';
import memoizeOne from 'memoize-one';
import debounce from 'lodash/debounce';
import isObject from 'lodash/isObject';
import mapKeys from 'lodash/mapKeys';
import Downshift from 'downshift';
import ExtendedMappingProvider from '@kfarranger/components/dist/utils/ExtendedMappingProvider';
import FaTimesCircleO from 'react-icons/lib/fa/times-circle';
import { SQONdiff } from '../../Utils';
import { withApi } from 'services/api';
import Column from 'uikit/Column';
import LoadingSpinner from 'uikit/LoadingSpinner';
import { arrangerProjectId } from 'common/injectGlobals';
import { ARRANGER_API_PARTICIPANT_INDEX_NAME } from '../common';
import Filter from '../Categories/Filter';
import QueriesResolver from '../QueriesResolver';
import { searchAllQueries } from './queries';
import QueryResults from './QueryResults';
import { trackUserInteraction, TRACKING_EVENTS } from 'services/analyticsTracking';
import { sqonShape } from 'shapes';
import './SearchAll.css';
const trackCohortBuilderAction = ({ action, label, category }) => {
trackUserInteraction({
category: category || TRACKING_EVENTS.categories.cohortBuilder._cohortBuilder,
action,
...(label && { label: isObject(label) ? JSON.stringify(label) : label }),
});
};
const toGqlFieldPath = (fieldPath) => fieldPath.replace(/\./g, '__');
const OP_TO_USE = 'in';
const initializeSelection = (fields, sqon) => {
const initialValues = sqon.content.reduce((acc, op) => {
if (op.op === OP_TO_USE) {
acc[op.content.field] = op.content.value;
}
return acc;
}, {});
return fields.reduce((acc, field) => {
acc[field] = initialValues[field] ? [...initialValues[field]] : [];
return acc;
}, {});
};
const filterFields = (query, detailedFields) =>
detailedFields
.map((field) => {
const matchByDisplayName = field.displayName.toLowerCase().indexOf(query.toLowerCase()) > -1;
const filteredBuckets = field.buckets.filter(
({ key }) => key.toLowerCase().indexOf(query.toLowerCase()) > -1,
);
return {
...field,
matchByDisplayName,
buckets: filteredBuckets,
};
})
.filter((field) => field.matchByDisplayName || field.buckets.length > 0);
const orderFields = memoizeOne((fields, aggFieldsValues) =>
fields.map((fieldName) => aggFieldsValues[toGqlFieldPath(fieldName)]),
);
const getFilteredFields = memoizeOne((query, fields, aggFieldsValues) => {
const orderedFields = orderFields(fields, aggFieldsValues);
return filterFields(query, orderedFields);
});
const DISPLAY_MODE = {
CLOSED: 'CLOSED',
RESULTS: 'RESULTS',
FILTER: 'FILTER',
};
const N_OF_CHARS_BEFORE_SEARCHING = 2;
class SearchAll extends React.Component {
constructor(props) {
super(props);
this.state = {
query: '',
debouncedQuery: '',
fieldName: '',
selections: initializeSelection(props.fields, props.sqon),
displayMode: DISPLAY_MODE.CLOSED,
};
autobind(this);
this.setQueryDebounced = debounce(this.setQueryDebounced, 200);
}
static propTypes = {
title: PropTypes.string,
sqon: sqonShape.isRequired,
onSqonUpdate: PropTypes.func.isRequired,
fields: PropTypes.arrayOf(PropTypes.string).isRequired,
color: PropTypes.string,
api: PropTypes.func.isRequired,
};
static defaultProps = {
color: 'white',
title: 'search',
};
close() {
this.setState({
query: '',
debouncedQuery: '',
fieldName: '',
displayMode: DISPLAY_MODE.CLOSED,
isFilterShown: false,
selections: {},
});
}
setQuery(query) {
const { displayMode } = this.state;
const { fields, sqon } = this.props;
const selections =
displayMode !== DISPLAY_MODE.CLOSED && query.length > 0
? initializeSelection(fields, sqon)
: this.state.selections;
this.setState({
query,
displayMode: query === '' ? DISPLAY_MODE.CLOSED : DISPLAY_MODE.RESULTS,
selections,
});
this.setQueryDebounced({
debouncedQuery: query,
displayMode: query === '' ? DISPLAY_MODE.CLOSED : DISPLAY_MODE.RESULTS,
});
}
setQueryDebounced(state) {
this.setState(state);
trackCohortBuilderAction({
category: `${TRACKING_EVENTS.categories.cohortBuilder.filters._cohortBuilderFilters} - Search All`,
action:
state.debouncedQuery !== ''
? TRACKING_EVENTS.actions.search
: TRACKING_EVENTS.actions.clear,
label: state.debouncedQuery,
});
}
handleQueryChange(evt) {
this.setQuery(evt.currentTarget.value);
}
handleClearQuery() {
const { debouncedQuery } = this.state;
this.close();
trackCohortBuilderAction({
category: `${TRACKING_EVENTS.categories.cohortBuilder.filters._cohortBuilderFilters} - Search All`,
action: TRACKING_EVENTS.actions.clear,
label: debouncedQuery,
});
}
renderSearchResults(isLoading, data, selections) {
const { fields } = this.props;
const { debouncedQuery } = this.state;
// filter both the fields and their buckets
// to keep only the field values matching the query
const canStartSearch = debouncedQuery && debouncedQuery.length >= N_OF_CHARS_BEFORE_SEARCHING;
if (!canStartSearch) {
return null;
}
return (
<QueryResults
query={debouncedQuery}
isLoading={isLoading}
filteredFields={getFilteredFields(debouncedQuery, fields, data[0])}
selections={selections}
onSelectionChange={this.handleSelectionChange}
onApplyFilter={this.handleApplyFilter}
onClearQuery={this.handleClearQuery}
onSearchField={this.handleSearchByField}
/>
);
}
renderFilter() {
const { sqon, onSqonUpdate } = this.props;
const { fieldName } = this.state;
return (
<div className="results-container open">
<Filter
initialSqon={sqon}
onSubmit={(sqon) => {
onSqonUpdate(fieldName, sqon);
this.close();
}}
onBack={() => {
this.close();
}}
onCancel={() => {
this.close();
}}
field={fieldName}
arrangerProjectId={arrangerProjectId}
arrangerProjectIndex={ARRANGER_API_PARTICIPANT_INDEX_NAME}
/>
</div>
);
}
renderOverlay(isLoading, data) {
const { selections, displayMode } = this.state;
switch (displayMode) {
case DISPLAY_MODE.CLOSED:
return null;
case DISPLAY_MODE.RESULTS:
return this.renderSearchResults(isLoading, data, selections);
case DISPLAY_MODE.FILTER:
return this.renderFilter();
default:
console.warn(`[SearchAll] Unhandled display mode ${displayMode}`);
return null;
}
}
handleSelectionChange(evt, field, value) {
const checked = evt.currentTarget.checked;
const oldValues = this.state.selections[field.name];
const index = oldValues.indexOf(value);
let fieldSelection = [];
if (checked && index === -1) {
fieldSelection = oldValues.concat(value);
}
if (!checked && index > -1) {
fieldSelection = fieldSelection.concat(oldValues.slice(0, index), oldValues.slice(index + 1));
}
this.setState({
selections: {
...this.state.selections,
[field.name]: fieldSelection,
},
});
let keyedBuckets = mapKeys(field.buckets, (v) => v.value);
let bucket = field.buckets[Object.keys(keyedBuckets).indexOf(value)];
const { displayName, name } = field;
trackCohortBuilderAction({
category: `${TRACKING_EVENTS.categories.cohortBuilder.filters._cohortBuilderFilters} - Search All`,
action: `${TRACKING_EVENTS.actions.filter} Selected`,
label: {
type: 'filter',
field: {
displayName,
name,
bucket,
},
value,
},
});
}
handleApplyFilter() {
const { sqon, fields, onSqonUpdate } = this.props;
const { selections, fieldName } = this.state;
const newSqonPerField = fields
.filter((field) => selections[field].length > 0)
.reduce(
(acc, field) =>
acc.concat({
op: OP_TO_USE,
content: {
field,
value: [...selections[field]],
},
}),
[],
);
const newSqon = {
op: sqon.op,
content: sqon.content
.filter((op) => op.op !== OP_TO_USE || !selections[op.content.field])
.concat(newSqonPerField),
};
onSqonUpdate(fieldName, newSqon);
this.close();
/**
* tracks both the added SQON and the final result/composite sqon
* after the new filters are applied
*/
trackCohortBuilderAction({
category: `${TRACKING_EVENTS.categories.cohortBuilder.filters._cohortBuilderFilters} - Search All`,
action: `${TRACKING_EVENTS.actions.apply} Selected Filters`,
label: { added_sqon: SQONdiff(newSqon, sqon), result_sqon: newSqon },
});
}
handleSearchByField(fieldName) {
this.setState({
query: '',
debouncedQuery: '',
displayMode: DISPLAY_MODE.FILTER,
fieldName,
isFilterShown: false,
selections: {},
});
}
render() {
const { api, sqon, color, title, fields } = this.props;
const { query, displayMode } = this.state;
return (
// Extract the metadata & data fetching to a component
<ExtendedMappingProvider
api={api}
projectId={arrangerProjectId}
graphqlField={ARRANGER_API_PARTICIPANT_INDEX_NAME}
useCache={true}
>
{({ loading: extendedMappingIsLoading, extendedMapping = [] }) => (
<QueriesResolver
name="GQL_SEARCH_ALL_FACETS"
api={api}
sqon={sqon}
queries={searchAllQueries(sqon, fields, extendedMapping || [])}
>
{({ isLoading, data, error }) => {
if (error) {
console.error('[SearchAll] HTTP error encountered', error);
return null;
}
if (data && data[0] && data[0].errors) {
console.error('[SearchAll] server-side error encountered', data[0].errors);
return null;
}
if (extendedMappingIsLoading || isLoading) {
return <LoadingSpinner color="#a9adc0" size="30px" />;
}
return (
<Downshift
isOpen={displayMode !== DISPLAY_MODE.CLOSED}
onOuterClick={() => this.close()}
>
{({ getRootProps }) => (
<div
className="search-all-filter"
// TODO : REMOVE ref stuff?
{...getRootProps({ refKey: 'ref' }, { suppressRefError: true })}
>
<Column
className="query-container"
style={{ borderTop: `4px solid ${color}` }}
>
<div className="query-content">
<span className={'input-icon icon-left'}>
<SearchIcon />
</span>
<input
type="text"
value={query}
onChange={this.handleQueryChange}
aria-label={title}
placeholder={title}
/>
{query && (
<span className={'input-icon icon-right'}>
<FaTimesCircleO onClick={this.handleClearQuery} />
</span>
)}
</div>
</Column>
{this.renderOverlay(isLoading, data)}
</div>
)}
</Downshift>
);
}}
</QueriesResolver>
)}
</ExtendedMappingProvider>
);
}
}
export default compose(withApi)(SearchAll);
| 29.905797 | 105 | 0.584121 |
b79cc21ed8ee93a537d42e85d6315fbc346928af | 123 | js | JavaScript | test/fixtures/fixture1c.js | codenautas/js-from-html | d9956723ef8faa772ce4b67fb53ea313977fa90a | [
"MIT"
] | null | null | null | test/fixtures/fixture1c.js | codenautas/js-from-html | d9956723ef8faa772ce4b67fb53ea313977fa90a | [
"MIT"
] | 8 | 2016-03-14T15:05:48.000Z | 2016-05-09T13:49:18.000Z | test/fixtures/fixture1c.js | codenautas/html-to-js | d9956723ef8faa772ce4b67fb53ea313977fa90a | [
"MIT"
] | null | null | null | html.div("Complicated text in a DIV, with many symbols like <&>; \"ยกaniรฑรฉ!\" 'ยฟSรญ?', <b>=fake bold, because is text</b>"),
| 61.5 | 122 | 0.626016 |
b79cdb16b41aecfdfc34be4f605cfc5a2a7f9f6f | 170 | js | JavaScript | examples/ModelSociety/theme/SUI/index.js | ejaxon/oak | 8cd397ff3edef47a5e8356cb6b32faaa4e50a9e4 | [
"MIT"
] | null | null | null | examples/ModelSociety/theme/SUI/index.js | ejaxon/oak | 8cd397ff3edef47a5e8356cb6b32faaa4e50a9e4 | [
"MIT"
] | null | null | null | examples/ModelSociety/theme/SUI/index.js | ejaxon/oak | 8cd397ff3edef47a5e8356cb6b32faaa4e50a9e4 | [
"MIT"
] | 1 | 2022-01-15T00:49:17.000Z | 2022-01-15T00:49:17.000Z | // NOTE: manually created index.json file to globalize only some of the components
{
"globalize": true,
"components": [
"Button",
"Menu",
"Toolbar"
]
}
| 17 | 82 | 0.623529 |
b79d47d3d2f20f0187318956cfaa916151d65f11 | 79 | js | JavaScript | tests/dummy/app/controllers/components-examples/flexberry-objectlistview/ember-flexberry-dummy-suggestion-multi-list-edit/new.js | archaim/ember-flexberry | e36cc92511f96622b823db35fd6e58b8822b6c1f | [
"MIT"
] | 13 | 2016-02-05T16:42:24.000Z | 2022-03-10T04:49:06.000Z | tests/dummy/app/controllers/components-examples/flexberry-objectlistview/ember-flexberry-dummy-suggestion-multi-list-edit/new.js | archaim/ember-flexberry | e36cc92511f96622b823db35fd6e58b8822b6c1f | [
"MIT"
] | 299 | 2016-04-22T07:56:27.000Z | 2022-02-25T10:26:06.000Z | tests/dummy/app/controllers/components-examples/flexberry-objectlistview/ember-flexberry-dummy-suggestion-multi-list-edit/new.js | archaim/ember-flexberry | e36cc92511f96622b823db35fd6e58b8822b6c1f | [
"MIT"
] | 26 | 2016-05-18T17:15:57.000Z | 2022-02-01T18:38:45.000Z | export { default } from '../ember-flexberry-dummy-suggestion-multi-list-edit';
| 39.5 | 78 | 0.746835 |
b79d51a5ca6e8a702d817357afab3947c06d394e | 2,341 | js | JavaScript | node_modules/@patternfly/react-core/dist/esm/components/Dropdown/DropdownToggle.js | nikunjdoshi67/Npatternfly | e55a47a56c4b66326f2fee889657e3b34b1c8b32 | [
"MIT"
] | null | null | null | node_modules/@patternfly/react-core/dist/esm/components/Dropdown/DropdownToggle.js | nikunjdoshi67/Npatternfly | e55a47a56c4b66326f2fee889657e3b34b1c8b32 | [
"MIT"
] | null | null | null | node_modules/@patternfly/react-core/dist/esm/components/Dropdown/DropdownToggle.js | nikunjdoshi67/Npatternfly | e55a47a56c4b66326f2fee889657e3b34b1c8b32 | [
"MIT"
] | null | null | null | import { __rest } from "tslib";
import * as React from 'react';
import CaretDownIcon from '@patternfly/react-icons/dist/js/icons/caret-down-icon';
import { Toggle } from './Toggle';
import styles from '@patternfly/react-styles/css/components/Dropdown/dropdown';
import { DropdownContext } from './dropdownConstants';
import { css } from '@patternfly/react-styles';
export const DropdownToggle = (_a) => {
var { id = '', children = null, className = '', isOpen = false, parentRef = null, isFocused = false, isHovered = false, isActive = false, isDisabled = false, isPlain = false, isPrimary = false,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
onToggle = (_isOpen) => undefined, iconComponent: IconComponent = CaretDownIcon, splitButtonItems, splitButtonVariant = 'checkbox', 'aria-haspopup': ariaHasPopup,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ref } = _a, // Types of Ref are different for React.FC vs React.Component
props = __rest(_a, ["id", "children", "className", "isOpen", "parentRef", "isFocused", "isHovered", "isActive", "isDisabled", "isPlain", "isPrimary", "onToggle", "iconComponent", "splitButtonItems", "splitButtonVariant", 'aria-haspopup', "ref"]);
const toggle = (React.createElement(DropdownContext.Consumer, null, ({ toggleTextClass, toggleIconClass }) => (React.createElement(Toggle, Object.assign({}, props, { id: id, className: className, isOpen: isOpen, parentRef: parentRef, isFocused: isFocused, isHovered: isHovered, isActive: isActive, isDisabled: isDisabled, isPlain: isPlain, isPrimary: isPrimary, onToggle: onToggle, "aria-haspopup": ariaHasPopup }, (splitButtonItems && { isSplitButton: true, 'aria-label': props['aria-label'] || 'Select' })),
children && React.createElement("span", { className: IconComponent && css(toggleTextClass) }, children),
IconComponent && React.createElement(IconComponent, { className: css(children && toggleIconClass) })))));
if (splitButtonItems) {
return (React.createElement("div", { className: css(styles.dropdownToggle, styles.modifiers.splitButton, splitButtonVariant === 'action' && styles.modifiers.action, isDisabled && styles.modifiers.disabled) },
splitButtonItems,
toggle));
}
return toggle;
};
//# sourceMappingURL=DropdownToggle.js.map | 93.64 | 513 | 0.715079 |
b79e0d5ec7b91347e04e95d28123c911598285aa | 2,173 | js | JavaScript | webview.js | n0rmand0/byteme-client | d41b7f37fe827f0990151af3a1fe39e847021add | [
"MIT"
] | 1 | 2017-08-09T20:13:17.000Z | 2017-08-09T20:13:17.000Z | webview.js | n0rmand0/byteme-client | d41b7f37fe827f0990151af3a1fe39e847021add | [
"MIT"
] | 7 | 2020-04-30T07:16:59.000Z | 2022-03-25T18:46:08.000Z | webview.js | n0rmand0/byteme-client | d41b7f37fe827f0990151af3a1fe39e847021add | [
"MIT"
] | null | null | null | var webContents = require('electron');
var request = require('request') ;
var $ = require('jquery');
var device = 'Dev Cave/';
var server = 'http://localhost:5005/';
var state = {};
var clips = {};
var playbackState;
document.addEventListener("DOMContentLoaded", function () {
var getState = function() {
request(server+device+'state', function (error, response, body) {
state = JSON.parse(body);
renderController();
})
}
getState();
var getClips = function() {
request(server+'listClips', function (error, response, body) {
clips = JSON.parse(body);
renderClips();
})
}
getClips();
// Render
var renderController = function(){
$('.controller__art').attr('src', state.currentTrack.absoluteAlbumArtUri);
$('.controller__artist').html(state.currentTrack.artist);
$('.controller__title').html(state.currentTrack.title);
if (state.playbackState == "PLAYING") {
$('.controller__play').hide();
$('.controller__pause').show();
} else {
$('.controller__play').show();
$('.controller__pause').hide();
}
}
// Control Functions
var play = function(){
request(server+'play');
renderController();
}
var pause = function(){
request(server+'pause');
renderController();
}
var next = function(){
request(server+'next');
renderController();
}
var previous = function(){
request(server+'previous');
renderController();
}
// Controller Buttons
$('.controller__play').click( function(){
play();
});
$('.controller__pause').click( function(){
pause();
});
$('.controller__next').click( function(){
next();
});
$('.controller__previous').click( function(){
previous();
});
// Clips
var renderClips = function(){
clipCommand = device+'clip/';
Object.entries(clips).map( function(clip){
//map
$('.soundboard').append(
'<button class="soundboard__clip" href="'+clip[1].file+'/'+'">'+clip[0]+'</button>'
);
// click functions
$('.soundboard__clip').click( function(){
var currentClip = $(this).attr("href");
console.log(server+clipCommand+currentClip);
request(server+clipCommand+currentClip);
})
});
}
}); // end DOM Loaded
| 20.12037 | 91 | 0.634146 |
b79e3311fddcf65e12f0b8f9620a2be911ef3123 | 1,385 | js | JavaScript | app/module_apply/services/ApplyService.js | pujjr/pcms-client | 10124381effd621ceabc32161c59105483d413e2 | [
"MIT"
] | null | null | null | app/module_apply/services/ApplyService.js | pujjr/pcms-client | 10124381effd621ceabc32161c59105483d413e2 | [
"MIT"
] | null | null | null | app/module_apply/services/ApplyService.js | pujjr/pcms-client | 10124381effd621ceabc32161c59105483d413e2 | [
"MIT"
] | null | null | null | angular.module('pu.apply.services')
.service("ApplyService",function($window,RestApi,$uibModal,ToolsService){
this.saveApplyInfo = function(item){
return RestApi.all("/apply").post(item);
};
this.queryApplyInfoByAppId = function(appId){
return RestApi.one("/apply",appId).get();
};
this.queryUnCommitApplyInfoList = function(){
return RestApi.all("/apply/unCommit/list").getList();
}
this.commitApplyInfo = function(item){
return RestApi.all("/apply/commit").post(item);
}
this.commitApplyTask = function(item){
return RestApi.all("/apply/commitApplyTask").post(item);
}
this.printApplyInfo = function(appId){
var modalInstance = $uibModal.open({
animation: false,
backdrop: 'static',
size: 'lg',
resolve:{
appId:function(){
return appId;
}
},
templateUrl: 'module_apply/tpl/dialog-apply-print.html',
controller:'ApplyController',
controllerAs:"$ctrl"
});
};
this.checkIdNoHas2MRefuseApply = function(idNo){
return RestApi.one("/apply/checkIdNoHas2MRefuseApply",idNo).get();
}
});
| 36.447368 | 78 | 0.53213 |
b79e4c57ed660dd9ae198db388411dcebb04255c | 2,886 | js | JavaScript | grid-packages/ag-grid-react/lib/agGridColumn.js | jenkins-sigaut/ag-grid | 53059eb7f771d8c7268a4cd7e070694e8a2a34d9 | [
"MIT"
] | null | null | null | grid-packages/ag-grid-react/lib/agGridColumn.js | jenkins-sigaut/ag-grid | 53059eb7f771d8c7268a4cd7e070694e8a2a34d9 | [
"MIT"
] | null | null | null | grid-packages/ag-grid-react/lib/agGridColumn.js | jenkins-sigaut/ag-grid | 53059eb7f771d8c7268a4cd7e070694e8a2a34d9 | [
"MIT"
] | null | null | null | // ag-grid-react v25.0.0
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var react_1 = require("react");
var PropTypes = require("prop-types");
var AgGrid = require("ag-grid-community");
var AgGridColumn = /** @class */ (function (_super) {
__extends(AgGridColumn, _super);
function AgGridColumn(props) {
var _this = _super.call(this, props) || this;
_this.props = props;
return _this;
}
AgGridColumn.prototype.render = function () {
return null;
};
AgGridColumn.mapChildColumnDefs = function (children) {
return React.Children.map(children, function (child) { return AgGridColumn.toColDef(child.props); });
};
AgGridColumn.toColDef = function (columnProps) {
var children = columnProps.children, colDef = __rest(columnProps, ["children"]);
if (AgGridColumn.hasChildColumns(children)) {
colDef.children = AgGridColumn.mapChildColumnDefs(children);
}
return colDef;
};
AgGridColumn.hasChildColumns = function (children) {
return React.Children.count(children) > 0;
};
return AgGridColumn;
}(react_1.Component));
exports.AgGridColumn = AgGridColumn;
addProperties(AgGrid.ColDefUtil.BOOLEAN_PROPERTIES, PropTypes.bool);
addProperties(AgGrid.ColDefUtil.STRING_PROPERTIES, PropTypes.string);
addProperties(AgGrid.ColDefUtil.OBJECT_PROPERTIES, PropTypes.object);
addProperties(AgGrid.ColDefUtil.ARRAY_PROPERTIES, PropTypes.array);
addProperties(AgGrid.ColDefUtil.NUMBER_PROPERTIES, PropTypes.number);
addProperties(AgGrid.ColDefUtil.FUNCTION_PROPERTIES, PropTypes.func);
function addProperties(listOfProps, propType) {
listOfProps.forEach(function (propKey) {
AgGridColumn[propKey] = propType;
});
}
| 41.826087 | 109 | 0.646223 |
b79f1e0fd3294593e94f35132cd37de9022b1f01 | 2,908 | js | JavaScript | public/pages/allUtilisateur/js/script.js | Sebastien-Lechat/projet-CDA-2020-Desktop | a9a3547d15aa039013dad28f094f558ed1bfb90b | [
"CC0-1.0"
] | null | null | null | public/pages/allUtilisateur/js/script.js | Sebastien-Lechat/projet-CDA-2020-Desktop | a9a3547d15aa039013dad28f094f558ed1bfb90b | [
"CC0-1.0"
] | null | null | null | public/pages/allUtilisateur/js/script.js | Sebastien-Lechat/projet-CDA-2020-Desktop | a9a3547d15aa039013dad28f094f558ed1bfb90b | [
"CC0-1.0"
] | null | null | null | const settings = {
"url": "https://obscure-sands-01552.herokuapp.com/user",
"method": "GET",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
}
};
$.ajax(settings).done((response) => { // <>200
if (response === false) {
localStorage.clear()
document.location.href = "./../../../index.html";
} else {
console.log('connecter')
let i = 0
while (i < 20) {
console.log(response.users[i].idUser)
console.log(response.users[i].nom)
id = response.users[i].idUser
nom = response.users[i].nom
prenom = response.users[i].prenom
email = response.users[i].email
pseudo = response.users[i].pseudo
sexe = response.users[i].sexe
avatar = response.users[i].avatar
html = '<div class="d-none d-lg-block d-xl-none d-none d-xl-block card card-perso"><div class="card-body"><div class="row"><div class="col-1"><img src="' + avatar + '" alt="..." class="img-thumbnail"></div><div class="col-7"><small class="nom col-4"> nom : ' + nom + '</small><small class="prenom col-4"> prenom : ' + prenom + '</small><small class="email col-4"> email : ' + email + '</small><br><small class="pseudo col-4"> pseudo : ' + pseudo + '</small><small class="sexe col-3"> sexe : ' + sexe + '</small></div><div class="col-2"><a class="btn btn-primary" onclick="modifier(' + id + ')">Modifier <i class="far fa-edit"></i></a></div><div class="col-1"><a class="btn btn-danger" onclick="supprimer(' + id + ')">Supprimer <i class="fas fa-trash-alt"></i></a></div></div></div></div>'
$('#blockUser').append(html)
i++
}
}
}).catch((err) => { // <> 400
localStorage.clear()
document.location.href = "./../../../index.html";
})
function supprimer(id) {
console.log(id)
id = {
"url": "https://obscure-sands-01552.herokuapp.com/user/" + id,
"method": "DELETE",
"success": function(response) {
window.location.reload()
}
}
$.ajax(id).done((response) => { // <>200
if (response === false) {
console.log('echec')
} else {
console.log('supprimer')
}
}).catch((err) => { // <> 400
console.log('probleme')
})
}
function modifier(id) {
console.log(id)
block = {
"url": "https://obscure-sands-01552.herokuapp.com/user/" + id,
"method": "GET",
"success": function(response) {
localStorage.setItem('id', id);
window.location.href = "../updateUtilisateur/index.html"
}
}
$.ajax(block).done((response) => { // <>200
if (response === false) {
console.log('echec')
} else {
console.log('modifier')
}
}).catch((err) => { // <> 400
console.log('probleme')
})
} | 37.766234 | 800 | 0.526823 |
b79f26268a737a4739a7e764db672916f81f4d15 | 936 | js | JavaScript | src/main/Collector.js | searchhub/search-collector | 79c22085018db7422a94de294c5528662721011e | [
"MIT"
] | 31 | 2018-06-13T09:07:45.000Z | 2021-11-16T10:59:01.000Z | src/main/Collector.js | searchhub/search-collector | 79c22085018db7422a94de294c5528662721011e | [
"MIT"
] | 10 | 2019-02-21T12:25:01.000Z | 2022-03-11T10:23:16.000Z | src/main/Collector.js | searchhub/search-collector | 79c22085018db7422a94de294c5528662721011e | [
"MIT"
] | 1 | 2019-07-04T12:39:15.000Z | 2019-07-04T12:39:15.000Z | const DefaultWriter = require("./writers/DefaultWriter");
const SplitStreamWriter = require("./writers/SplitStreamWriter");
/**
* Default assembly point of collectors and writers.
*/
class Collector {
constructor(options) {
this.options = options;
this.collectors = [];
this.writers = [];
}
add(collector) {
if (this.options.contextResolver && typeof collector.setContext === "function") {
collector.setContext(this.options.contextResolver);
}
this.collectors.push(collector);
}
start() {
var writer = this.writers.length == 0
? new DefaultWriter(this.options)
: new SplitStreamWriter(this.writers);
this.collectors.forEach(function(collector) {
collector.attach(writer);
});
}
setWriters(replacementWriters) {
for (let w of replacementWriters) {
this.writers.push(w);
}
}
}
module.exports = Collector; | 23.4 | 85 | 0.643162 |
b7a08ea43d93492bdd5d7fd6dafc2d713a195c1d | 16,890 | js | JavaScript | js/tests/unit/test_pageguide.js | amit11794/pageguide | adb796cfe4aa7751574d923472a6de20fa011c6d | [
"MIT"
] | 227 | 2015-01-05T19:13:10.000Z | 2022-02-15T03:41:34.000Z | js/tests/unit/test_pageguide.js | epatch86/pageguide | 97faddc2618cc8fa57cee0eab905501bd52b2210 | [
"MIT"
] | 26 | 2015-01-09T23:09:10.000Z | 2021-05-24T12:39:00.000Z | js/tests/unit/test_pageguide.js | epatch86/pageguide | 97faddc2618cc8fa57cee0eab905501bd52b2210 | [
"MIT"
] | 77 | 2015-01-13T15:54:12.000Z | 2022-02-01T21:52:03.000Z | $(function () {
var pg = {}; // reference for pageguide object
module('tl.pg');
test('pageguide exists', function () {
ok(tl.pg, 'tl.pg namespace exists');
});
loadInitAndTest('destroy', function () {
expect(5);
tl.pg.destroy();
equal($('#tlyPageGuideWrapper').length, 0, 'no wrapper');
equal($('#tlyPageGuideOverlay').length, 0, 'no overlay');
equal($('body').hasClass('tlypageguide-open'), false, 'no open class');
equal($('body').hasClass('tlyPageGuideWelcomeOpen'), false, 'no welcome open class');
equal($('.tlypageguide_shadow').length, 0, 'no shadow elements');
});
loadAndTest('isScrolledIntoView', function () {
expect(2);
// NOTE: had to test on a qunit element because the fixture gets offset by defauly
ok(tl.pg.isScrolledIntoView('#qunit-header', 0), 'top element scrolled into view');
equal(tl.pg.isScrolledIntoView('.data-block:last'), false, 'bottom element not scrolled into view');
});
module('DOM: elements exist');
loadAndTest('fixture loaded', function () {
expect(1);
ok($('#exampleContent').length, 'fixture loaded correctly');
});
loadAndTest('default elements exist', function () {
expect(2);
tl.pg.init();
ok($('#tlyPageGuideWrapper').length, 'wrapper exists');
ok($('.tlypageguide_toggle').length, 'toggle exists');
});
loadInitAndTest('welcome exists', function () {
expect(3);
ok($('#tlyPageGuideWrapper .tlyPageGuideWelcome').length, 'welcome inside wrapper');
equal($('#tlyPageGuideOverlay').length, 1, 'only one overlay exists');
ok($('body').hasClass('tlyPageGuideWelcomeOpen'), 'body class');
}, '#examplePlusWelcome');
module('DOM: basic interaction');
loadInitAndTest('open', function () {
expect(6);
$('.tlypageguide_toggle').trigger('click');
testOpen();
});
loadInitAndTest('close from toggle', function () {
testClose(function () {
$('.tlypageguide_toggle').trigger('click');
});
});
loadInitAndTest('close from button', function () {
testClose(function () {
$('.tlypageguide_close').trigger('click');
});
});
loadInitAndTest('arrow nav forward', function () {
var itemLength = $('#tlyPageGuide > li').length;
expect(itemLength);
$('.tlypageguide_toggle').trigger('click');
for (var i=1; i<=itemLength; i++) {
var index = i % 4;
$('.tlypageguide_fwd').trigger('click');
equal($('#tlyPageGuide > li:eq(' + index + ')').text(),
$('.tlypageguide_text').text(), 'caption ' + index + ' displayed');
}
});
loadInitAndTest('arrow nav backward', function () {
var itemLength = $('#tlyPageGuide > li').length;
expect(itemLength);
$('.tlypageguide_toggle').trigger('click');
for (var i=itemLength-1; i>=0; i--) {
$('.tlypageguide_back').trigger('click');
equal($('#tlyPageGuide > li:eq(' + i + ')').text(),
$('.tlypageguide_text').text(), 'caption ' + i + ' displayed');
}
});
loadInitAndTest('bubble click nav', function () {
var itemLength = $('#tlyPageGuide > li').length;
expect(itemLength);
$('.tlypageguide_toggle').trigger('click');
$('.tlyPageGuideStepIndex').each(function (i, el) {
$(el).trigger('click');
equal($('#tlyPageGuide > li:eq(' + i + ')').text(),
$('.tlypageguide_text').text(), 'caption ' + i + ' displayed');
});
});
module('DOM: target changes');
loadInitAndTest('remove target before open', function () {
var originalStepLength = $('#tlyPageGuide > li').length;
expect(originalStepLength + 1);
$('#second_element_to_target').remove();
$('.tlypageguide_toggle').trigger('click');
equal($('.tlypageguide_shadow:visible').length, (originalStepLength - 1),
'correct number of step shadows');
equal($('.tlyPageGuideStepIndex:visible').length, (originalStepLength - 1),
'correct number of step indices');
testSequentialIndices();
});
loadInitAndTest('add target back in after removing and opening', function () {
var originalStepLength = $('#tlyPageGuide > li').length;
expect(originalStepLength + 2);
var secondElementHtml = $('#second_element_to_target').html();
$('#second_element_to_target').remove();
$('.tlypageguide_toggle').trigger('click');
$('.tlypageguide_close').trigger('click');
$('#exampleContent > .wrapper').append(
'<div id="second_element_to_target">' + secondElementHtml + '</div>'
);
$('.tlypageguide_toggle').trigger('click');
equal($('.tlypageguide_shadow:visible').length, originalStepLength,
'correct number of step shadows');
equal($('.tlyPageGuideStepIndex:visible').length, originalStepLength,
'correct number of step indices');
testSequentialIndices();
});
loadInitAndTest('hide target before open', function () {
var originalStepLength = $('#tlyPageGuide > li').length;
expect(originalStepLength + 1);
$('#second_element_to_target').hide();
$('.tlypageguide_toggle').trigger('click');
equal($('.tlypageguide_shadow:visible').length, (originalStepLength - 1),
'# of step shadows reflect missing element');
equal($('.tlyPageGuideStepIndex:visible').length, (originalStepLength - 1),
'# of step indices reflect missing element');
testSequentialIndices();
});
loadInitAndTest('show target after hiding and opening', function () {
var originalStepLength = $('#tlyPageGuide > li').length;
expect(originalStepLength + 2);
$('#second_element_to_target').hide();
$('.tlypageguide_toggle').trigger('click');
$('.tlypageguide_close').trigger('click');
$('#second_element_to_target').show();
$('.tlypageguide_toggle').trigger('click');
equal($('.tlypageguide_shadow:visible').length, originalStepLength,
'correct number of step shadows');
equal($('.tlyPageGuideStepIndex:visible').length, originalStepLength,
'correct number of step indices');
testSequentialIndices();
});
loadInitAndTest('remove target while open', function () {
var originalStepLength = $('#tlyPageGuide > li').length;
expect(originalStepLength + 1);
$('.tlypageguide_toggle').trigger('click');
$('#second_element_to_target').remove();
pg.updateVisible();
equal($('.tlypageguide_shadow:visible').length, (originalStepLength - 1),
'correct number of step shadows');
equal($('.tlyPageGuideStepIndex:visible').length, (originalStepLength - 1),
'correct number of step indices');
testSequentialIndices();
});
loadInitAndTest('hide current targets while open', function () {
var originalStepLength = $('#tlyPageGuide > li').length;
expect((originalStepLength + 1) * originalStepLength);
$('.data-block').each(function (i, el) {
$('.tlypageguide_toggle').trigger('click');
pg.show_message(i);
$(el).hide();
pg.updateVisible();
equal($('.tlypageguide_shadow:visible').length, (originalStepLength - 1),
'correct number of step shadows');
equal($('.tlyPageGuideStepIndex:visible').length, (originalStepLength - 1),
'correct number of step indices');
testSequentialIndices();
$(el).show();
$('.tlypageguide_close').trigger('click');
});
});
loadInitAndTest('show current targets while open', function () {
var originalStepLength = $('#tlyPageGuide > li').length;
expect((originalStepLength + 2) * originalStepLength);
$('.data-block').each(function (i, el) {
$(el).hide();
$('.tlypageguide_toggle').trigger('click');
pg.show_message(i);
$(el).show();
pg.updateVisible();
equal($('.tlypageguide_shadow:visible').length, originalStepLength,
'correct number of step shadows');
equal($('.tlyPageGuideStepIndex:visible').length, originalStepLength,
'correct number of step indices');
testSequentialIndices();
$('.tlypageguide_close').trigger('click');
});
});
module('DOM: welcome message');
loadInitAndTest('welcome start click', function () {
expect(9);
$('.tlypageguide_start').trigger('click');
testOpen();
ok(checkLocalStorageItem(), 'localStorage item exists');
ok($('.tlyPageGuideWelcome').not(':visible'), 'welcome hidden');
ok($('.tlyPageGuideOverlay').not(':visible'), 'overlay hidden');
localStorage.clear();
}, '#examplePlusWelcome');
loadInitAndTest('welcome start and open', function () {
expect(8);
$('.tlypageguide_start').trigger('click');
$('.tlypageguide_close').trigger('click');
$('.tlypageguide_toggle').trigger('click');
ok($('.tlyPageGuideWelcome').not(':visible'), 'welcome hidden');
ok($('#tlyPageGuideOverlay').not(':visible'), 'overlay hidden');
testOpen();
localStorage.clear();
}, '#examplePlusWelcome');
loadInitAndTest('welcome toggle click', function () {
expect(9);
$('.tlypageguide_toggle').trigger('click');
testOpen();
ok(checkLocalStorageItem(), 'localStorage item exists');
ok($('.tlyPageGuideWelcome').not(':visible'), 'welcome hidden');
ok($('#tlyPageGuideOverlay').not(':visible'), 'overlay hidden');
localStorage.clear();
}, '#examplePlusWelcome');
loadInitAndTest('welcome ignore click', function () {
expect(5);
$('.tlypageguide_ignore').trigger('click');
ok($('.tlyPageGuideWelcome').not(':visible'), 'welcome hidden');
ok($('.tlyPageGuideOverlay').not(':visible'), 'overlay hidden');
equal(checkLocalStorageItem(), false, 'no localStorage item yet');
$('.tlypageguide_toggle').trigger('click');
ok($('.tlyPageGuideWelcome').is(':visible'), 'welcome shown again');
ok($('#tlyPageGuideOverlay').is(':visible'), 'overlay shown again');
}, '#examplePlusWelcome');
loadInitAndTest('welcome dismiss click', function () {
expect(11);
$('.tlypageguide_dismiss').trigger('click');
ok($('.tlyPageGuideWelcome').not(':visible'), 'welcome hidden');
ok($('#tlyPageGuideOverlay').not(':visible'), 'overlay hidden');
ok(checkLocalStorageItem(), 'localStorage item exists');
$('.tlypageguide_toggle').trigger('click');
ok($('.tlyPageGuideWelcome').not(':visible'), 'welcome hidden');
ok($('#tlyPageGuideOverlay').not(':visible'), 'overlay hidden');
testOpen();
localStorage.clear();
}, '#examplePlusWelcome');
module('multiple pageguides');
loadInitAndTest('2 pageguides 1 page', function () {
expect(8);
var pg2 = tl.pg.init({
steps_element: '#titlePageGuide',
ready_callback: function () {
equal($('.tlypageguide_toggle').length, 2);
equal($('#tlyPageGuideWrapper').length, 1);
// check first one
$('.tlypageguide_toggle:first').trigger('click');
equal($('#tlyPageGuide > li:eq(0)').text(),
$('.tlypageguide_text').text(), 'first caption for first pg displayed');
var numStepsFirst = $('#tlyPageGuide > li').length;
equal($('.tlypageguide_shadow:visible').length, numStepsFirst, 'all step shadows shown for first pg');
equal($('.tlyPageGuideStepIndex:visible').length, numStepsFirst, 'all step indices shown for first pg');
$('.tlypageguide_toggle:first').trigger('click');
// check second one
$('.tlypageguide_toggle:eq(1)').trigger('click');
equal($('#titlePageGuide > li:eq(0)').text(),
$('.tlypageguide_text').text(), 'first caption for second pg displayed');
var numStepsSecond = $('#tlyPageGuide > li').length;
equal($('.tlypageguide_shadow:visible').length, numStepsSecond, 'all step shadows shown for second pg');
equal($('.tlyPageGuideStepIndex:visible').length, numStepsSecond, 'all step indices shown for second pg');
$('.tlypageguide_toggle:eq(1)').trigger('click');
start();
tl.pg.destroy();
}
});
}, null, true);
// HELPER FUNCTIONS FOR TESTING
/**
* for testing pageguide load in the DOM: load example page HTML into the
* qunit fixture element, then run the callback.
* - title: title of unit being tested
* - cb: callback function containing the body of the test.
* - delayStart: optional boolean indicating whether to defer start() (meaning
* it will be handled within the callback)
* - selector: optional string selector for the area to select within the
* example page
**/
function loadAndTest (title, cb, delayStart, selector) {
var sel = selector || '#exampleContent';
asyncTest(title, function () {
$('#qunit-fixture').load('../../example/index.html '+sel, function () {
cb();
if (!delayStart) {
start();
tl.pg.destroy();
}
});
});
}
/**
* for running a test on pageguide ready. waits until pg.ready() fires to
* run the test. useful for integration-type things (user interactions, etc)
* - title: title of unit being tested
* - cb: callback function containing the body of the test
* - selector: optional string selector for the area to select within the
* example page
**/
function loadInitAndTest (title, cb, selector, delayStart) {
loadAndTest(title, function () {
pg = tl.pg.init({
ready_callback: function () {
cb();
if (!delayStart) {
start();
tl.pg.destroy();
}
}
});
}, true, selector);
}
/**
* test a close interaction. since all close interactions result in the same
* provable assertions, we can reuse them.
* - closeAction: function containing the close interaction to test
**/
function testClose (closeAction) {
expect(3);
$('.tlypageguide_toggle').trigger('click');
closeAction();
ok($('#tlyPageGuideMessages').not(':visible'), 'message area hidden');
equal($('.tlypageguide_shadow:visible').length, 0, 'step shadows hidden');
equal($('.tlyPageGuideStepIndex:visible').length, 0, 'step indices hidden');
}
/**
* test an open interaction. once again, all open interactions result in the same
* state, so we can reuse the assertions.
* NOTE: cannot verify current displayed index, since it is set on a 200ms ('fast')
* animation delay. may fix in future w/css changes
**/
function testOpen () {
ok($('body').hasClass('tlypageguide-open'), 'body class');
ok($('#tlyPageGuideMessages').is(':visible'), 'message area shown');
equal($('.tlypageguide-active').length, 1, 'only one active element');
equal($('#tlyPageGuide > li:eq(0)').text(),
$('.tlypageguide_text').text(), 'first caption displayed');
var numSteps = $('#tlyPageGuide > li').length;
equal($('.tlypageguide_shadow:visible').length, numSteps, 'all step shadows shown');
equal($('.tlyPageGuideStepIndex:visible').length, numSteps, 'all step indices shown');
}
/**
* go through all the visible step indices (number bubbles) and make sure they
* each increase sequentially by 1.
**/
function testSequentialIndices () {
$('.tlyPageGuideStepIndex:visible').each(function (i, el) {
equal(i, (parseFloat($(el).text()) - 1), 'step ' + i + ' has correct number');
});
}
/**
* check for the localstorage item used by default to determine whether to
* display the welcome message
**/
function checkLocalStorageItem () {
return !!localStorage.getItem('tlypageguide_welcome_shown_' + tl.pg.hashUrl());
}
});
| 39.834906 | 122 | 0.583126 |
b7a0a153ccbfbe9696a11bec9fca4637e47b423c | 654 | js | JavaScript | lang/JavaScript/abc-problem-4.js | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | 5 | 2021-01-29T20:08:05.000Z | 2022-03-22T06:16:05.000Z | lang/JavaScript/abc-problem-4.js | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | lang/JavaScript/abc-problem-4.js | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | 1 | 2018-11-09T22:08:40.000Z | 2018-11-09T22:08:40.000Z | let characters = "BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM";
let blocks = characters.split(" ").map(pair => pair.split(""));
function isWordPossible(word) {
var letters = [...word.toUpperCase()];
var length = letters.length;
var copy = new Set(blocks);
for (let letter of letters) {
for (let block of copy) {
let index = block.indexOf(letter);
if (index !== -1) {
length--;
copy.delete(block);
break;
}
}
}
return !length;
}
[
"A",
"BARK",
"BOOK",
"TREAT",
"COMMON",
"SQUAD",
"CONFUSE"
].forEach(word => console.log(`${word}: ${isWordPossible(word)}`));
| 19.818182 | 79 | 0.565749 |
b7a2a70909d6f71549ae7b3f264f3f920e8cdbb1 | 3,367 | js | JavaScript | js/ph.js | kongyujian/Fishackathon2016_Geospatial | 3eba2dd89c82761b7b11d32dc3b5817727ec7d27 | [
"MIT"
] | null | null | null | js/ph.js | kongyujian/Fishackathon2016_Geospatial | 3eba2dd89c82761b7b11d32dc3b5817727ec7d27 | [
"MIT"
] | null | null | null | js/ph.js | kongyujian/Fishackathon2016_Geospatial | 3eba2dd89c82761b7b11d32dc3b5817727ec7d27 | [
"MIT"
] | null | null | null | var weekAverage = 0;
$(function(){
var flowArr = [];
$.ajax({
url: "http://allow-any-origin.appspot.com/http://waterdata.usgs.gov/nwis/uv?format=rdb&period=&begin_date=2016-04-15&end_date=2016-04-24&cb_00055=on&site_no=04119400"
})
.done(function(data){
data = data.split(/\r?\n/);
var lines = [];
for(var i = 0; i < data.length; i++){
if (data[i].charAt(0) != "#"){
var token = data[i].split('\t');
lines.push(token);
}
}
lines.shift();
lines.shift();
for (var i = 0; i < lines.length; i++){
var day = moment(lines[i][2]);
var flowData = lines[i][4];
flowArr.push([day.unix() * 1000, flowData]);
}
var total = 0;
for (var i = 0; i < flowArr.length; i++){
if (flowArr[i][1] != undefined)
total += parseInt(flowArr[i][1]);
}
weekAverage = total / flowArr.length;
$("#avg-motion").html(weekAverage.toFixed(2) + "m/s");
window.phgauge.set(weekAverage);
initializePHGraph(flowArr, flowArr);
})
})
function initializePHGraph(data1, data2){
var phplot = $("#canvas_ph").length && $.plot($("#canvas_ph"), [
{label: "Probe 1", data: data1}//, {label:"Probe 2", data: data2}
], {
series: {
lines: {
show: false,
fill: true
},
splines: {
show: true,
tension: 0.4,
lineWidth: 1,
fill: 0.4
},
points: {
radius: 1,
show: true
},
shadowSize: 2
},
grid: {
verticalLines: true,
hoverable: true,
clickable: true,
tickColor: "#d5d5d5",
borderWidth: 1,
color: '#fff'
},
colors: ["rgba(38, 185, 154, 0.38)", "rgba(3, 88, 106, 0.38)"],
xaxis: {
tickColor: "rgba(51, 51, 51, 0.06)",
mode: "time",
tickSize: [1, "day"],
//tickLength: 10,
axisLabel: "Date",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial',
axisLabelPadding: 10,
mode: "time",
timeformat: "%Y/%m/%d"
},
yaxis: {
ticks: 8,
tickColor: "rgba(51, 51, 51, 0.06)",
},
legend: {
show: true,
labelBoxBorderColor: "rgba(38, 185, 154, 0.38)",
position: "se",
labelFormatter: function(label, series) {
// series is the series object for the label
return '<a href="#' + label + '" style="color:#1ABB9C">' + label + '</a>';
}
//margin: number of pixels or [x margin, y margin]
//backgroundColor: null or color
//backgroundOpacity: number between 0 and 1
//container: null or jQuery object/DOM element/jQuery expression
//sorted: null/false, true, "ascending", "descending", "reverse", or a comparator
},
tooltip: {
show: true,
content: "%s"
}
});
window.phplot = phplot;
}
| 30.609091 | 174 | 0.457083 |
b7a2ab6a1d765bc8302170ef6e600b50960204a1 | 6,376 | js | JavaScript | component/modifiers.js | igaponov/trunx | 6940f6aca637c6f0645d0ac9d38c222ae1b5dcc7 | [
"MIT"
] | null | null | null | component/modifiers.js | igaponov/trunx | 6940f6aca637c6f0645d0ac9d38c222ae1b5dcc7 | [
"MIT"
] | null | null | null | component/modifiers.js | igaponov/trunx | 6940f6aca637c6f0645d0ac9d38c222ae1b5dcc7 | [
"MIT"
] | null | null | null | Object.defineProperty(exports, "__esModule", { value: true });
function alignementPropsToClassnames(props) {
var hasTextCentered = props.hasTextCentered, hasTextJustified = props.hasTextJustified, hasTextLeft = props.hasTextLeft, hasTextRight = props.hasTextRight;
return {
"has-text-centered": hasTextCentered,
"has-text-justified": hasTextJustified,
"has-text-left": hasTextLeft,
"has-text-right": hasTextRight,
};
}
exports.alignementPropsToClassnames = alignementPropsToClassnames;
function backgroundColorHelpersPropsToClassnames(props) {
var hasBackgroundBlack = props.hasBackgroundBlack, hasBackgroundBlackBis = props.hasBackgroundBlackBis, hasBackgroundBlackTer = props.hasBackgroundBlackTer, hasBackgroundDanger = props.hasBackgroundDanger, hasBackgroundDark = props.hasBackgroundDark, hasBackgroundGrey = props.hasBackgroundGrey, hasBackgroundGreyDark = props.hasBackgroundGreyDark, hasBackgroundGreyDarker = props.hasBackgroundGreyDarker, hasBackgroundGreyLight = props.hasBackgroundGreyLight, hasBackgroundGreyLighter = props.hasBackgroundGreyLighter, hasBackgroundInfo = props.hasBackgroundInfo, hasBackgroundLight = props.hasBackgroundLight, hasBackgroundLink = props.hasBackgroundLink, hasBackgroundPrimary = props.hasBackgroundPrimary, hasBackgroundSuccess = props.hasBackgroundSuccess, hasBackgroundWarning = props.hasBackgroundWarning, hasBackgroundWhite = props.hasBackgroundWhite, hasBackgroundWhiteBis = props.hasBackgroundWhiteBis, hasBackgroundWhiteTer = props.hasBackgroundWhiteTer;
return {
"has-background-black": hasBackgroundBlack,
"has-background-black-bis": hasBackgroundBlackBis,
"has-background-black-ter": hasBackgroundBlackTer,
"has-background-danger": hasBackgroundDanger,
"has-background-dark": hasBackgroundDark,
"has-background-grey": hasBackgroundGrey,
"has-background-grey-dark": hasBackgroundGreyDark,
"has-background-grey-darker": hasBackgroundGreyDarker,
"has-background-grey-light": hasBackgroundGreyLight,
"has-background-grey-lighter": hasBackgroundGreyLighter,
"has-background-info": hasBackgroundInfo,
"has-background-light": hasBackgroundLight,
"has-background-link": hasBackgroundLink,
"has-background-primary": hasBackgroundPrimary,
"has-background-success": hasBackgroundSuccess,
"has-background-warning": hasBackgroundWarning,
"has-background-white": hasBackgroundWhite,
"has-background-white-bis": hasBackgroundWhiteBis,
"has-background-white-ter": hasBackgroundWhiteTer,
};
}
exports.backgroundColorHelpersPropsToClassnames = backgroundColorHelpersPropsToClassnames;
function floatHelpersPropsToClassnames(props) {
var isClearfix = props.isClearfix, isPulledLeft = props.isPulledLeft, isPulledRight = props.isPulledRight;
return {
"is-clearfix": isClearfix,
"is-pulled-left": isPulledLeft,
"is-pulled-right": isPulledRight,
};
}
exports.floatHelpersPropsToClassnames = floatHelpersPropsToClassnames;
function helpersPropsToClassnames(props) {
var isInvisible = props.isInvisible, isMarginLess = props.isMarginLess, isPaddingLess = props.isPaddingLess, isSrOnly = props.isSrOnly;
return {
"is-marginless": isMarginLess,
"is-invisible": isInvisible,
"is-paddingless": isPaddingLess,
"is-sr-only": isSrOnly,
};
}
exports.helpersPropsToClassnames = helpersPropsToClassnames;
function mainColorsPropsToClassnames(props) {
var isDanger = props.isDanger, isInfo = props.isInfo, isLink = props.isLink, isPrimary = props.isPrimary, isSuccess = props.isSuccess, isWarning = props.isWarning;
return {
"is-danger": isDanger,
"is-info": isInfo,
"is-link": isLink,
"is-primary": isPrimary,
"is-success": isSuccess,
"is-warning": isWarning,
};
}
exports.mainColorsPropsToClassnames = mainColorsPropsToClassnames;
function shadeColorsPropsToClassnames(props) {
var isBlack = props.isBlack, isDark = props.isDark, isLight = props.isLight, isWhite = props.isWhite;
return {
"is-black": isBlack,
"is-dark": isDark,
"is-light": isLight,
"is-white": isWhite,
};
}
exports.shadeColorsPropsToClassnames = shadeColorsPropsToClassnames;
function sizePropsToClassnames(props) {
var isLarge = props.isLarge, isMedium = props.isMedium, isSmall = props.isSmall;
return {
"is-large": isLarge,
"is-medium": isMedium,
"is-small": isSmall,
};
}
exports.sizePropsToClassnames = sizePropsToClassnames;
function textColorHelpersPropsToClassnames(props) {
var hasTextBlack = props.hasTextBlack, hasTextBlackBis = props.hasTextBlackBis, hasTextBlackTer = props.hasTextBlackTer, hasTextDanger = props.hasTextDanger, hasTextDark = props.hasTextDark, hasTextGrey = props.hasTextGrey, hasTextGreyDark = props.hasTextGreyDark, hasTextGreyDarker = props.hasTextGreyDarker, hasTextGreyLight = props.hasTextGreyLight, hasTextGreyLighter = props.hasTextGreyLighter, hasTextInfo = props.hasTextInfo, hasTextLight = props.hasTextLight, hasTextLink = props.hasTextLink, hasTextPrimary = props.hasTextPrimary, hasTextSuccess = props.hasTextSuccess, hasTextWarning = props.hasTextWarning, hasTextWhite = props.hasTextWhite, hasTextWhiteBis = props.hasTextWhiteBis, hasTextWhiteTer = props.hasTextWhiteTer;
return {
"has-text-black": hasTextBlack,
"has-text-black-bis": hasTextBlackBis,
"has-text-black-ter": hasTextBlackTer,
"has-text-danger": hasTextDanger,
"has-text-dark": hasTextDark,
"has-text-grey": hasTextGrey,
"has-text-grey-dark": hasTextGreyDark,
"has-text-grey-darker": hasTextGreyDarker,
"has-text-grey-light": hasTextGreyLight,
"has-text-grey-lighter": hasTextGreyLighter,
"has-text-info": hasTextInfo,
"has-text-light": hasTextLight,
"has-text-link": hasTextLink,
"has-text-primary": hasTextPrimary,
"has-text-success": hasTextSuccess,
"has-text-warning": hasTextWarning,
"has-text-white": hasTextWhite,
"has-text-white-bis": hasTextWhiteBis,
"has-text-white-ter": hasTextWhiteTer,
};
}
exports.textColorHelpersPropsToClassnames = textColorHelpersPropsToClassnames;
| 56.928571 | 966 | 0.742158 |
0201fd7d6520704672a209a435858dda4d0ab351 | 2,670 | js | JavaScript | source/js/app.js | BBCVisualJournalism/newsspec_8945 | 2df2eb338156134c10ac61b1d618429ff94a35aa | [
"Apache-2.0"
] | 1 | 2015-04-09T14:01:54.000Z | 2015-04-09T14:01:54.000Z | source/js/app.js | BBCVisualJournalism/newsspec_8945 | 2df2eb338156134c10ac61b1d618429ff94a35aa | [
"Apache-2.0"
] | 1 | 2016-07-04T15:19:24.000Z | 2016-07-04T15:19:24.000Z | source/js/app.js | BBCVisualJournalism/newsspec_8945 | 2df2eb338156134c10ac61b1d618429ff94a35aa | [
"Apache-2.0"
] | null | null | null | define([
'lib/news_special/bootstrap',
'mediator/whoForMediator',
'mediator/postcodeFormMediator',
'controller/externalIdController',
'mediator/nationsMediator',
'mediator/weeklyCostsMediator',
'mediator/meansTestQuestionsMediator',
'model/MeansTestCalculator',
'mediator/resultsMediator'
], function (
news,
WhoForMediator,
PostcodeFormMediator,
ExternalIdController,
NationsMediator,
WeeklyCostsMediator,
MeansTestQuestionsMediator,
MeansTestCalculator,
ResultsMediator
) {
'use strict';
/***************************
Additional 'polyfils'
* bind function -- bloomin phantonjs doesn't support bind :s
* date.now method, not supported in certain versions of ie
***************************/
if (typeof Function.prototype.bind !== 'function') {
Function.prototype.bind = function (context) {
var slice = Array.prototype.slice;
var fn = this;
return function () {
var args = slice.call(arguments, 1);
if (args.length) {
return arguments.length ? fn.apply(context, args.concat(slice.call(arguments))) : fn.apply(context, args);
} else {
return arguments.length ? fn.apply(context, arguments) : fn.call(context);
}
};
};
}
/* Switches SVG's for there fallback images if a browser doesn't support SVG */
function switchSvgsForFallbacks() {
var allSvgsWithFallbacks = $('.main').find('[data-fallback]').filter('svg');
allSvgsWithFallbacks.each(function () {
var svgEl = $(this);
svgEl.replaceWith('<img src="' + svgEl.data('fallback') + '" class="questionsIcon" alt="icon" />');
});
}
return {
init: function (storyPageUrl) {
/***************************
mediator store
***************************/
new PostcodeFormMediator();
new ExternalIdController();
new NationsMediator();
new WhoForMediator();
new WeeklyCostsMediator();
new MeansTestQuestionsMediator();
new MeansTestCalculator();
new ResultsMediator();
news.$('.main').show();
news.sendMessageToremoveLoadingImage();
if (!this.isSvgSupported()) {
switchSvgsForFallbacks();
}
},
isSvgSupported: function () {
return document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1');
}
};
});
| 31.411765 | 126 | 0.550562 |
020248782ca976cb6ce64ded9f2b2c930fccabe7 | 693,384 | js | JavaScript | release/biwascheme-0.7.4.js | pulpgrinder/biwascheme | 4ef8924f24834d3d14fc8682dc079e8f30e5d286 | [
"MIT"
] | 523 | 2015-01-05T08:05:10.000Z | 2022-03-27T20:08:06.000Z | release/biwascheme-0.7.4.js | pulpgrinder/biwascheme | 4ef8924f24834d3d14fc8682dc079e8f30e5d286 | [
"MIT"
] | 188 | 2015-01-12T23:45:25.000Z | 2022-02-20T12:45:33.000Z | release/biwascheme-0.7.4.js | pulpgrinder/biwascheme | 4ef8924f24834d3d14fc8682dc079e8f30e5d286 | [
"MIT"
] | 108 | 2015-01-04T14:48:13.000Z | 2022-02-21T08:51:02.000Z | /*
* BiwaScheme 0.7.4 - R6RS/R7RS Scheme in JavaScript
*
* Copyright (c) 2007-2021 Yutaka HARA (http://www.biwascheme.org/)
* Licensed under the MIT license.
*/ /*!
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2021-03-02T17:08Z
*/
(function (global, factory) {
"use strict";
if (typeof module === "object" && typeof module.exports === "object") {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document
? factory(global, true)
: function (w) {
if (!w.document) {
throw new Error("jQuery requires a window with a document");
}
return factory(w);
};
} else {
factory(global);
}
// Pass this if window is not defined yet
})(typeof window !== "undefined" ? window : this, function (window, noGlobal) {
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
// enough that all such attempts are guarded in a try block.
"use strict";
var arr = [];
var getProto = Object.getPrototypeOf;
var slice = arr.slice;
var flat = arr.flat
? function (array) {
return arr.flat.call(array);
}
: function (array) {
return arr.concat.apply([], array);
};
var push = arr.push;
var indexOf = arr.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var fnToString = hasOwn.toString;
var ObjectFunctionString = fnToString.call(Object);
var support = {};
var isFunction = function isFunction(obj) {
// Support: Chrome <=57, Firefox <=52
// In some browsers, typeof returns "function" for HTML <object> elements
// (i.e., `typeof document.createElement( "object" ) === "function"`).
// We don't want to classify *any* DOM node as a function.
// Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
// Plus for old WebKit, typeof returns "function" for HTML collections
// (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
return (
typeof obj === "function" &&
typeof obj.nodeType !== "number" &&
typeof obj.item !== "function"
);
};
var isWindow = function isWindow(obj) {
return obj != null && obj === obj.window;
};
var document = window.document;
var preservedScriptAttributes = {
type: true,
src: true,
nonce: true,
noModule: true,
};
function DOMEval(code, node, doc) {
doc = doc || document;
var i,
val,
script = doc.createElement("script");
script.text = code;
if (node) {
for (i in preservedScriptAttributes) {
// Support: Firefox 64+, Edge 18+
// Some browsers don't support the "nonce" property on scripts.
// On the other hand, just using `getAttribute` is not enough as
// the `nonce` attribute is reset to an empty string whenever it
// becomes browsing-context connected.
// See https://github.com/whatwg/html/issues/2369
// See https://html.spec.whatwg.org/#nonce-attributes
// The `node.getAttribute` check was added for the sake of
// `jQuery.globalEval` so that it can fake a nonce-containing node
// via an object.
val = node[i] || (node.getAttribute && node.getAttribute(i));
if (val) {
script.setAttribute(i, val);
}
}
}
doc.head.appendChild(script).parentNode.removeChild(script);
}
function toType(obj) {
if (obj == null) {
return obj + "";
}
// Support: Android <=2.3 only (functionish RegExp)
return typeof obj === "object" || typeof obj === "function"
? class2type[toString.call(obj)] || "object"
: typeof obj;
}
/* global Symbol */
// Defining this global in .eslintrc.json would create a danger of using the global
// unguarded in another place, it seems safer to define global only for this module
var version = "3.6.0",
// Define a local copy of jQuery
jQuery = function (selector, context) {
// The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init(selector, context);
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: version,
constructor: jQuery,
// The default length of a jQuery object is 0
length: 0,
toArray: function () {
return slice.call(this);
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function (num) {
// Return all the elements in a clean array
if (num == null) {
return slice.call(this);
}
// Return just the one element from the set
return num < 0 ? this[num + this.length] : this[num];
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function (elems) {
// Build a new jQuery matched element set
var ret = jQuery.merge(this.constructor(), elems);
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
each: function (callback) {
return jQuery.each(this, callback);
},
map: function (callback) {
return this.pushStack(
jQuery.map(this, function (elem, i) {
return callback.call(elem, i, elem);
})
);
},
slice: function () {
return this.pushStack(slice.apply(this, arguments));
},
first: function () {
return this.eq(0);
},
last: function () {
return this.eq(-1);
},
even: function () {
return this.pushStack(
jQuery.grep(this, function (_elem, i) {
return (i + 1) % 2;
})
);
},
odd: function () {
return this.pushStack(
jQuery.grep(this, function (_elem, i) {
return i % 2;
})
);
},
eq: function (i) {
var len = this.length,
j = +i + (i < 0 ? len : 0);
return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
},
end: function () {
return this.prevObject || this.constructor();
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: arr.sort,
splice: arr.splice,
};
jQuery.extend = jQuery.fn.extend = function () {
var options,
name,
src,
copy,
copyIsArray,
clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if (typeof target === "boolean") {
deep = target;
// Skip the boolean and the target
target = arguments[i] || {};
i++;
}
// Handle case when target is a string or something (possible in deep copy)
if (typeof target !== "object" && !isFunction(target)) {
target = {};
}
// Extend jQuery itself if only one argument is passed
if (i === length) {
target = this;
i--;
}
for (; i < length; i++) {
// Only deal with non-null/undefined values
if ((options = arguments[i]) != null) {
// Extend the base object
for (name in options) {
copy = options[name];
// Prevent Object.prototype pollution
// Prevent never-ending loop
if (name === "__proto__" || target === copy) {
continue;
}
// Recurse if we're merging plain objects or arrays
if (
deep &&
copy &&
(jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))
) {
src = target[name];
// Ensure proper type for the source value
if (copyIsArray && !Array.isArray(src)) {
clone = [];
} else if (!copyIsArray && !jQuery.isPlainObject(src)) {
clone = {};
} else {
clone = src;
}
copyIsArray = false;
// Never move original objects, clone them
target[name] = jQuery.extend(deep, clone, copy);
// Don't bring in undefined values
} else if (copy !== undefined) {
target[name] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
// Unique for each copy of jQuery on the page
expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
// Assume jQuery is ready without the ready module
isReady: true,
error: function (msg) {
throw new Error(msg);
},
noop: function () {},
isPlainObject: function (obj) {
var proto, Ctor;
// Detect obvious negatives
// Use toString instead of jQuery.type to catch host objects
if (!obj || toString.call(obj) !== "[object Object]") {
return false;
}
proto = getProto(obj);
// Objects with no prototype (e.g., `Object.create( null )`) are plain
if (!proto) {
return true;
}
// Objects with prototype are plain iff they were constructed by a global Object function
Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
return (
typeof Ctor === "function" &&
fnToString.call(Ctor) === ObjectFunctionString
);
},
isEmptyObject: function (obj) {
var name;
for (name in obj) {
return false;
}
return true;
},
// Evaluates a script in a provided context; falls back to the global one
// if not specified.
globalEval: function (code, options, doc) {
DOMEval(code, { nonce: options && options.nonce }, doc);
},
each: function (obj, callback) {
var length,
i = 0;
if (isArrayLike(obj)) {
length = obj.length;
for (; i < length; i++) {
if (callback.call(obj[i], i, obj[i]) === false) {
break;
}
}
} else {
for (i in obj) {
if (callback.call(obj[i], i, obj[i]) === false) {
break;
}
}
}
return obj;
},
// results is for internal usage only
makeArray: function (arr, results) {
var ret = results || [];
if (arr != null) {
if (isArrayLike(Object(arr))) {
jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
} else {
push.call(ret, arr);
}
}
return ret;
},
inArray: function (elem, arr, i) {
return arr == null ? -1 : indexOf.call(arr, elem, i);
},
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
merge: function (first, second) {
var len = +second.length,
j = 0,
i = first.length;
for (; j < len; j++) {
first[i++] = second[j];
}
first.length = i;
return first;
},
grep: function (elems, callback, invert) {
var callbackInverse,
matches = [],
i = 0,
length = elems.length,
callbackExpect = !invert;
// Go through the array, only saving the items
// that pass the validator function
for (; i < length; i++) {
callbackInverse = !callback(elems[i], i);
if (callbackInverse !== callbackExpect) {
matches.push(elems[i]);
}
}
return matches;
},
// arg is for internal usage only
map: function (elems, callback, arg) {
var length,
value,
i = 0,
ret = [];
// Go through the array, translating each of the items to their new values
if (isArrayLike(elems)) {
length = elems.length;
for (; i < length; i++) {
value = callback(elems[i], i, arg);
if (value != null) {
ret.push(value);
}
}
// Go through every key on the object,
} else {
for (i in elems) {
value = callback(elems[i], i, arg);
if (value != null) {
ret.push(value);
}
}
}
// Flatten any nested arrays
return flat(ret);
},
// A global GUID counter for objects
guid: 1,
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
support: support,
});
if (typeof Symbol === "function") {
jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
}
// Populate the class2type map
jQuery.each(
"Boolean Number String Function Array Date RegExp Object Error Symbol".split(
" "
),
function (_i, name) {
class2type["[object " + name + "]"] = name.toLowerCase();
}
);
function isArrayLike(obj) {
// Support: real iOS 8.2 only (not reproducible in simulator)
// `in` check used to prevent JIT error (gh-2145)
// hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE
var length = !!obj && "length" in obj && obj.length,
type = toType(obj);
if (isFunction(obj) || isWindow(obj)) {
return false;
}
return (
type === "array" ||
length === 0 ||
(typeof length === "number" && length > 0 && length - 1 in obj)
);
}
var Sizzle =
/*!
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
*/
(function (window) {
var i,
support,
Expr,
getText,
isXML,
tokenize,
compile,
select,
outermostContext,
sortInput,
hasDuplicate,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + 1 * new Date(),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
nonnativeSelectorCache = createCache(),
sortOrder = function (a, b) {
if (a === b) {
hasDuplicate = true;
}
return 0;
},
// Instance methods
hasOwn = {}.hasOwnProperty,
arr = [],
pop = arr.pop,
pushNative = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf as it's faster than native
// https://jsperf.com/thor-indexof-vs-for/5
indexOf = function (list, elem) {
var i = 0,
len = list.length;
for (; i < len; i++) {
if (list[i] === elem) {
return i;
}
}
return -1;
},
booleans =
"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
"ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
identifier =
"(?:\\\\[\\da-fA-F]{1,6}" +
whitespace +
"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
attributes =
"\\[" +
whitespace +
"*(" +
identifier +
")(?:" +
whitespace +
// Operator (capture 2)
"*([*^$|!~]?=)" +
whitespace +
// "Attribute values must be CSS identifiers [capture 5]
// or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" +
identifier +
"))|)" +
whitespace +
"*\\]",
pseudos =
":(" +
identifier +
")(?:\\((" +
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" +
attributes +
")*)|" +
// 3. anything else (capture 2)
".*" +
")\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rwhitespace = new RegExp(whitespace + "+", "g"),
rtrim = new RegExp(
"^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
"g"
),
rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
rcombinators = new RegExp(
"^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"
),
rdescend = new RegExp(whitespace + "|>"),
rpseudo = new RegExp(pseudos),
ridentifier = new RegExp("^" + identifier + "$"),
matchExpr = {
ID: new RegExp("^#(" + identifier + ")"),
CLASS: new RegExp("^\\.(" + identifier + ")"),
TAG: new RegExp("^(" + identifier + "|[*])"),
ATTR: new RegExp("^" + attributes),
PSEUDO: new RegExp("^" + pseudos),
CHILD: new RegExp(
"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" +
whitespace +
"*(?:([+-]|)" +
whitespace +
"*(\\d+)|))" +
whitespace +
"*\\)|)",
"i"
),
bool: new RegExp("^(?:" + booleans + ")$", "i"),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
needsContext: new RegExp(
"^" +
whitespace +
"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace +
"*((?:-\\d)?\\d*)" +
whitespace +
"*\\)|)(?=[^-]|$)",
"i"
),
},
rhtml = /HTML$/i,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
// CSS escapes
// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp(
"\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])",
"g"
),
funescape = function (escape, nonHex) {
var high = "0x" + escape.slice(1) - 0x10000;
return nonHex
? // Strip the backslash prefix from a non-hex escape sequence
nonHex
: // Replace a hexadecimal escape sequence with the encoded Unicode code point
// Support: IE <=11+
// For values outside the Basic Multilingual Plane (BMP), manually construct a
// surrogate pair
high < 0
? String.fromCharCode(high + 0x10000)
: String.fromCharCode(
(high >> 10) | 0xd800,
(high & 0x3ff) | 0xdc00
);
},
// CSS string/identifier serialization
// https://drafts.csswg.org/cssom/#common-serializing-idioms
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
fcssescape = function (ch, asCodePoint) {
if (asCodePoint) {
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
if (ch === "\0") {
return "\uFFFD";
}
// Control characters and (dependent upon position) numbers get escaped as code points
return (
ch.slice(0, -1) +
"\\" +
ch.charCodeAt(ch.length - 1).toString(16) +
" "
);
}
// Other potentially-special ASCII characters get backslash-escaped
return "\\" + ch;
},
// Used for iframes
// See setDocument()
// Removing the function wrapper causes a "Permission Denied"
// error in IE
unloadHandler = function () {
setDocument();
},
inDisabledFieldset = addCombinator(
function (elem) {
return (
elem.disabled === true &&
elem.nodeName.toLowerCase() === "fieldset"
);
},
{ dir: "parentNode", next: "legend" }
);
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call(preferredDoc.childNodes)),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
// eslint-disable-next-line no-unused-expressions
arr[preferredDoc.childNodes.length].nodeType;
} catch (e) {
push = {
apply: arr.length
? // Leverage slice if possible
function (target, els) {
pushNative.apply(target, slice.call(els));
}
: // Support: IE<9
// Otherwise append directly
function (target, els) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ((target[j++] = els[i++])) {}
target.length = j - 1;
},
};
}
function Sizzle(selector, context, results, seed) {
var m,
i,
elem,
nid,
match,
groups,
newSelector,
newContext = context && context.ownerDocument,
// nodeType defaults to 9, since context defaults to document
nodeType = context ? context.nodeType : 9;
results = results || [];
// Return early from calls with invalid selector or context
if (
typeof selector !== "string" ||
!selector ||
(nodeType !== 1 && nodeType !== 9 && nodeType !== 11)
) {
return results;
}
// Try to shortcut find operations (as opposed to filters) in HTML documents
if (!seed) {
setDocument(context);
context = context || document;
if (documentIsHTML) {
// If the selector is sufficiently simple, try using a "get*By*" DOM method
// (excepting DocumentFragment context, where the methods don't exist)
if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
// ID selector
if ((m = match[1])) {
// Document context
if (nodeType === 9) {
if ((elem = context.getElementById(m))) {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if (elem.id === m) {
results.push(elem);
return results;
}
} else {
return results;
}
// Element context
} else {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if (
newContext &&
(elem = newContext.getElementById(m)) &&
contains(context, elem) &&
elem.id === m
) {
results.push(elem);
return results;
}
}
// Type selector
} else if (match[2]) {
push.apply(results, context.getElementsByTagName(selector));
return results;
// Class selector
} else if (
(m = match[3]) &&
support.getElementsByClassName &&
context.getElementsByClassName
) {
push.apply(results, context.getElementsByClassName(m));
return results;
}
}
// Take advantage of querySelectorAll
if (
support.qsa &&
!nonnativeSelectorCache[selector + " "] &&
(!rbuggyQSA || !rbuggyQSA.test(selector)) &&
// Support: IE 8 only
// Exclude object elements
(nodeType !== 1 || context.nodeName.toLowerCase() !== "object")
) {
newSelector = selector;
newContext = context;
// qSA considers elements outside a scoping root when evaluating child or
// descendant combinators, which is not what we want.
// In such cases, we work around the behavior by prefixing every selector in the
// list with an ID selector referencing the scope context.
// The technique has to be used as well when a leading combinator is used
// as such selectors are not recognized by querySelectorAll.
// Thanks to Andrew Dupont for this technique.
if (
nodeType === 1 &&
(rdescend.test(selector) || rcombinators.test(selector))
) {
// Expand context for sibling selectors
newContext =
(rsibling.test(selector) &&
testContext(context.parentNode)) ||
context;
// We can use :scope instead of the ID hack if the browser
// supports it & if we're not changing the context.
if (newContext !== context || !support.scope) {
// Capture the context ID, setting it first if necessary
if ((nid = context.getAttribute("id"))) {
nid = nid.replace(rcssescape, fcssescape);
} else {
context.setAttribute("id", (nid = expando));
}
}
// Prefix every selector in the list
groups = tokenize(selector);
i = groups.length;
while (i--) {
groups[i] =
(nid ? "#" + nid : ":scope") + " " + toSelector(groups[i]);
}
newSelector = groups.join(",");
}
try {
push.apply(results, newContext.querySelectorAll(newSelector));
return results;
} catch (qsaError) {
nonnativeSelectorCache(selector, true);
} finally {
if (nid === expando) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select(selector.replace(rtrim, "$1"), context, results, seed);
}
/**
* Create key-value caches of limited size
* @returns {function(string, object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache(key, value) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if (keys.push(key + " ") > Expr.cacheLength) {
// Only keep the most recent entries
delete cache[keys.shift()];
}
return (cache[key + " "] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction(fn) {
fn[expando] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created element and returns a boolean result
*/
function assert(fn) {
var el = document.createElement("fieldset");
try {
return !!fn(el);
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if (el.parentNode) {
el.parentNode.removeChild(el);
}
// release memory in IE
el = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle(attrs, handler) {
var arr = attrs.split("|"),
i = arr.length;
while (i--) {
Expr.attrHandle[arr[i]] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck(a, b) {
var cur = b && a,
diff =
cur &&
a.nodeType === 1 &&
b.nodeType === 1 &&
a.sourceIndex - b.sourceIndex;
// Use IE sourceIndex if available on both nodes
if (diff) {
return diff;
}
// Check if b follows a
if (cur) {
while ((cur = cur.nextSibling)) {
if (cur === b) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo(type) {
return function (elem) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo(type) {
return function (elem) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for :enabled/:disabled
* @param {Boolean} disabled true for :disabled; false for :enabled
*/
function createDisabledPseudo(disabled) {
// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
return function (elem) {
// Only certain elements can match :enabled or :disabled
// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
if ("form" in elem) {
// Check for inherited disabledness on relevant non-disabled elements:
// * listed form-associated elements in a disabled fieldset
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
// * option elements in a disabled optgroup
// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
// All such elements have a "form" property.
if (elem.parentNode && elem.disabled === false) {
// Option elements defer to a parent optgroup if present
if ("label" in elem) {
if ("label" in elem.parentNode) {
return elem.parentNode.disabled === disabled;
} else {
return elem.disabled === disabled;
}
}
// Support: IE 6 - 11
// Use the isDisabled shortcut property to check for disabled fieldset ancestors
return (
elem.isDisabled === disabled ||
// Where there is no isDisabled, check manually
/* jshint -W018 */
(elem.isDisabled !== !disabled &&
inDisabledFieldset(elem) === disabled)
);
}
return elem.disabled === disabled;
// Try to winnow out elements that can't be disabled before trusting the disabled property.
// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
// even exist on them, let alone have a boolean value.
} else if ("label" in elem) {
return elem.disabled === disabled;
}
// Remaining elements are neither :enabled nor :disabled
return false;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo(fn) {
return markFunction(function (argument) {
argument = +argument;
return markFunction(function (seed, matches) {
var j,
matchIndexes = fn([], seed.length, argument),
i = matchIndexes.length;
// Match elements found at the specified indexes
while (i--) {
if (seed[(j = matchIndexes[i])]) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Checks a node for validity as a Sizzle context
* @param {Element|Object=} context
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
*/
function testContext(context) {
return (
context &&
typeof context.getElementsByTagName !== "undefined" &&
context
);
}
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Detects XML nodes
* @param {Element|Object} elem An element or a document
* @returns {Boolean} True iff elem is a non-HTML XML node
*/
isXML = Sizzle.isXML = function (elem) {
var namespace = elem && elem.namespaceURI,
docElem = elem && (elem.ownerDocument || elem).documentElement;
// Support: IE <=8
// Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
// https://bugs.jquery.com/ticket/4833
return !rhtml.test(
namespace || (docElem && docElem.nodeName) || "HTML"
);
};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function (node) {
var hasCompare,
subWindow,
doc = node ? node.ownerDocument || node : preferredDoc;
// Return early if doc is invalid or already selected
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
if (doc == document || doc.nodeType !== 9 || !doc.documentElement) {
return document;
}
// Update global variables
document = doc;
docElem = document.documentElement;
documentIsHTML = !isXML(document);
// Support: IE 9 - 11+, Edge 12 - 18+
// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
if (
preferredDoc != document &&
(subWindow = document.defaultView) &&
subWindow.top !== subWindow
) {
// Support: IE 11, Edge
if (subWindow.addEventListener) {
subWindow.addEventListener("unload", unloadHandler, false);
// Support: IE 9 - 10 only
} else if (subWindow.attachEvent) {
subWindow.attachEvent("onunload", unloadHandler);
}
}
// Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
// Safari 4 - 5 only, Opera <=11.6 - 12.x only
// IE/Edge & older browsers don't support the :scope pseudo-class.
// Support: Safari 6.0 only
// Safari 6.0 supports :scope but it's an alias of :root there.
support.scope = assert(function (el) {
docElem.appendChild(el).appendChild(document.createElement("div"));
return (
typeof el.querySelectorAll !== "undefined" &&
!el.querySelectorAll(":scope fieldset div").length
);
});
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties
// (excepting IE8 booleans)
support.attributes = assert(function (el) {
el.className = "i";
return !el.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function (el) {
el.appendChild(document.createComment(""));
return !el.getElementsByTagName("*").length;
});
// Support: IE<9
support.getElementsByClassName = rnative.test(
document.getElementsByClassName
);
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programmatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function (el) {
docElem.appendChild(el).id = expando;
return (
!document.getElementsByName ||
!document.getElementsByName(expando).length
);
});
// ID filter and find
if (support.getById) {
Expr.filter["ID"] = function (id) {
var attrId = id.replace(runescape, funescape);
return function (elem) {
return elem.getAttribute("id") === attrId;
};
};
Expr.find["ID"] = function (id, context) {
if (
typeof context.getElementById !== "undefined" &&
documentIsHTML
) {
var elem = context.getElementById(id);
return elem ? [elem] : [];
}
};
} else {
Expr.filter["ID"] = function (id) {
var attrId = id.replace(runescape, funescape);
return function (elem) {
var node =
typeof elem.getAttributeNode !== "undefined" &&
elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
// Support: IE 6 - 7 only
// getElementById is not reliable as a find shortcut
Expr.find["ID"] = function (id, context) {
if (
typeof context.getElementById !== "undefined" &&
documentIsHTML
) {
var node,
i,
elems,
elem = context.getElementById(id);
if (elem) {
// Verify the id attribute
node = elem.getAttributeNode("id");
if (node && node.value === id) {
return [elem];
}
// Fall back on getElementsByName
elems = context.getElementsByName(id);
i = 0;
while ((elem = elems[i++])) {
node = elem.getAttributeNode("id");
if (node && node.value === id) {
return [elem];
}
}
}
return [];
}
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName
? function (tag, context) {
if (typeof context.getElementsByTagName !== "undefined") {
return context.getElementsByTagName(tag);
// DocumentFragment nodes don't have gEBTN
} else if (support.qsa) {
return context.querySelectorAll(tag);
}
}
: function (tag, context) {
var elem,
tmp = [],
i = 0,
// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
results = context.getElementsByTagName(tag);
// Filter out possible comments
if (tag === "*") {
while ((elem = results[i++])) {
if (elem.nodeType === 1) {
tmp.push(elem);
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] =
support.getElementsByClassName &&
function (className, context) {
if (
typeof context.getElementsByClassName !== "undefined" &&
documentIsHTML
) {
return context.getElementsByClassName(className);
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See https://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ((support.qsa = rnative.test(document.querySelectorAll))) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function (el) {
var input;
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// https://bugs.jquery.com/ticket/12359
docElem.appendChild(el).innerHTML =
"<a id='" +
expando +
"'></a>" +
"<select id='" +
expando +
"-\r\\' msallowcapture=''>" +
"<option selected=''></option></select>";
// Support: IE8, Opera 11-12.16
// Nothing should be selected when empty strings follow ^= or $= or *=
// The test attribute must be unknown in Opera but "safe" for WinRT
// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
if (el.querySelectorAll("[msallowcapture^='']").length) {
rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
}
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if (!el.querySelectorAll("[selected]").length) {
rbuggyQSA.push(
"\\[" + whitespace + "*(?:value|" + booleans + ")"
);
}
// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
rbuggyQSA.push("~=");
}
// Support: IE 11+, Edge 15 - 18+
// IE 11/Edge don't find elements on a `[name='']` query in some cases.
// Adding a temporary attribute to the document before the selection works
// around the issue.
// Interestingly, IE 10 & older don't seem to have the issue.
input = document.createElement("input");
input.setAttribute("name", "");
el.appendChild(input);
if (!el.querySelectorAll("[name='']").length) {
rbuggyQSA.push(
"\\[" +
whitespace +
"*name" +
whitespace +
"*=" +
whitespace +
"*(?:''|\"\")"
);
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if (!el.querySelectorAll(":checked").length) {
rbuggyQSA.push(":checked");
}
// Support: Safari 8+, iOS 8+
// https://bugs.webkit.org/show_bug.cgi?id=136851
// In-page `selector#id sibling-combinator selector` fails
if (!el.querySelectorAll("a#" + expando + "+*").length) {
rbuggyQSA.push(".#.+[+~]");
}
// Support: Firefox <=3.6 - 5 only
// Old Firefox doesn't throw on a badly-escaped identifier.
el.querySelectorAll("\\\f");
rbuggyQSA.push("[\\r\\n\\f]");
});
assert(function (el) {
el.innerHTML =
"<a href='' disabled='disabled'></a>" +
"<select disabled='disabled'><option/></select>";
// Support: Windows 8 Native Apps
// The type and name attributes are restricted during .innerHTML assignment
var input = document.createElement("input");
input.setAttribute("type", "hidden");
el.appendChild(input).setAttribute("name", "D");
// Support: IE8
// Enforce case-sensitivity of name attribute
if (el.querySelectorAll("[name=d]").length) {
rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if (el.querySelectorAll(":enabled").length !== 2) {
rbuggyQSA.push(":enabled", ":disabled");
}
// Support: IE9-11+
// IE's :disabled selector does not pick up the children of disabled fieldsets
docElem.appendChild(el).disabled = true;
if (el.querySelectorAll(":disabled").length !== 2) {
rbuggyQSA.push(":enabled", ":disabled");
}
// Support: Opera 10 - 11 only
// Opera 10-11 does not throw on post-comma invalid pseudos
el.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if (
(support.matchesSelector = rnative.test(
(matches =
docElem.matches ||
docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector)
))
) {
assert(function (el) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call(el, "*");
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call(el, "[s!='']:x");
rbuggyMatches.push("!=", pseudos);
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
rbuggyMatches =
rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
/* Contains
---------------------------------------------------------------------- */
hasCompare = rnative.test(docElem.compareDocumentPosition);
// Element contains another
// Purposefully self-exclusive
// As in, an element does not contain itself
contains =
hasCompare || rnative.test(docElem.contains)
? function (a, b) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return (
a === bup ||
!!(
bup &&
bup.nodeType === 1 &&
(adown.contains
? adown.contains(bup)
: a.compareDocumentPosition &&
a.compareDocumentPosition(bup) & 16)
)
);
}
: function (a, b) {
if (b) {
while ((b = b.parentNode)) {
if (b === a) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = hasCompare
? function (a, b) {
// Flag for duplicate removal
if (a === b) {
hasDuplicate = true;
return 0;
}
// Sort on method existence if only one input has compareDocumentPosition
var compare =
!a.compareDocumentPosition - !b.compareDocumentPosition;
if (compare) {
return compare;
}
// Calculate position if both inputs belong to the same document
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
compare =
(a.ownerDocument || a) == (b.ownerDocument || b)
? a.compareDocumentPosition(b)
: // Otherwise we know they are disconnected
1;
// Disconnected nodes
if (
compare & 1 ||
(!support.sortDetached &&
b.compareDocumentPosition(a) === compare)
) {
// Choose the first element that is related to our preferred document
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
if (
a == document ||
(a.ownerDocument == preferredDoc && contains(preferredDoc, a))
) {
return -1;
}
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
if (
b == document ||
(b.ownerDocument == preferredDoc && contains(preferredDoc, b))
) {
return 1;
}
// Maintain original order
return sortInput
? indexOf(sortInput, a) - indexOf(sortInput, b)
: 0;
}
return compare & 4 ? -1 : 1;
}
: function (a, b) {
// Exit early if the nodes are identical
if (a === b) {
hasDuplicate = true;
return 0;
}
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [a],
bp = [b];
// Parentless nodes are either documents or disconnected
if (!aup || !bup) {
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
/* eslint-disable eqeqeq */
return a == document
? -1
: b == document
? 1
: /* eslint-enable eqeqeq */
aup
? -1
: bup
? 1
: sortInput
? indexOf(sortInput, a) - indexOf(sortInput, b)
: 0;
// If the nodes are siblings, we can do a quick check
} else if (aup === bup) {
return siblingCheck(a, b);
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ((cur = cur.parentNode)) {
ap.unshift(cur);
}
cur = b;
while ((cur = cur.parentNode)) {
bp.unshift(cur);
}
// Walk down the tree looking for a discrepancy
while (ap[i] === bp[i]) {
i++;
}
return i
? // Do a sibling check if the nodes have a common ancestor
siblingCheck(ap[i], bp[i])
: // Otherwise nodes in our document sort first
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
/* eslint-disable eqeqeq */
ap[i] == preferredDoc
? -1
: bp[i] == preferredDoc
? 1
: /* eslint-enable eqeqeq */
0;
};
return document;
};
Sizzle.matches = function (expr, elements) {
return Sizzle(expr, null, null, elements);
};
Sizzle.matchesSelector = function (elem, expr) {
setDocument(elem);
if (
support.matchesSelector &&
documentIsHTML &&
!nonnativeSelectorCache[expr + " "] &&
(!rbuggyMatches || !rbuggyMatches.test(expr)) &&
(!rbuggyQSA || !rbuggyQSA.test(expr))
) {
try {
var ret = matches.call(elem, expr);
// IE 9's matchesSelector returns false on disconnected nodes
if (
ret ||
support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
(elem.document && elem.document.nodeType !== 11)
) {
return ret;
}
} catch (e) {
nonnativeSelectorCache(expr, true);
}
}
return Sizzle(expr, document, null, [elem]).length > 0;
};
Sizzle.contains = function (context, elem) {
// Set document vars if needed
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
if ((context.ownerDocument || context) != document) {
setDocument(context);
}
return contains(context, elem);
};
Sizzle.attr = function (elem, name) {
// Set document vars if needed
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
if ((elem.ownerDocument || elem) != document) {
setDocument(elem);
}
var fn = Expr.attrHandle[name.toLowerCase()],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val =
fn && hasOwn.call(Expr.attrHandle, name.toLowerCase())
? fn(elem, name, !documentIsHTML)
: undefined;
return val !== undefined
? val
: support.attributes || !documentIsHTML
? elem.getAttribute(name)
: (val = elem.getAttributeNode(name)) && val.specified
? val.value
: null;
};
Sizzle.escape = function (sel) {
return (sel + "").replace(rcssescape, fcssescape);
};
Sizzle.error = function (msg) {
throw new Error("Syntax error, unrecognized expression: " + msg);
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function (results) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice(0);
results.sort(sortOrder);
if (hasDuplicate) {
while ((elem = results[i++])) {
if (elem === results[i]) {
j = duplicates.push(i);
}
}
while (j--) {
results.splice(duplicates[j], 1);
}
}
// Clear input after sorting to release objects
// See https://github.com/jquery/sizzle/pull/225
sortInput = null;
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function (elem) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if (!nodeType) {
// If no nodeType, this is expected to be an array
while ((node = elem[i++])) {
// Do not traverse comment nodes
ret += getText(node);
}
} else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (jQuery #11153)
if (typeof elem.textContent === "string") {
return elem.textContent;
} else {
// Traverse its children
for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
ret += getText(elem);
}
}
} else if (nodeType === 3 || nodeType === 4) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" },
},
preFilter: {
ATTR: function (match) {
match[1] = match[1].replace(runescape, funescape);
// Move the given value to match[3] whether quoted or unquoted
match[3] = (match[3] || match[4] || match[5] || "").replace(
runescape,
funescape
);
if (match[2] === "~=") {
match[3] = " " + match[3] + " ";
}
return match.slice(0, 4);
},
CHILD: function (match) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if (match[1].slice(0, 3) === "nth") {
// nth-* requires argument
if (!match[3]) {
Sizzle.error(match[0]);
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +(match[4]
? match[5] + (match[6] || 1)
: 2 * (match[3] === "even" || match[3] === "odd"));
match[5] = +(match[7] + match[8] || match[3] === "odd");
// other types prohibit arguments
} else if (match[3]) {
Sizzle.error(match[0]);
}
return match;
},
PSEUDO: function (match) {
var excess,
unquoted = !match[6] && match[2];
if (matchExpr["CHILD"].test(match[0])) {
return null;
}
// Accept quoted arguments as-is
if (match[3]) {
match[2] = match[4] || match[5] || "";
// Strip excess characters from unquoted arguments
} else if (
unquoted &&
rpseudo.test(unquoted) &&
// Get excess from tokenize (recursively)
(excess = tokenize(unquoted, true)) &&
// advance to the next closing parenthesis
(excess =
unquoted.indexOf(")", unquoted.length - excess) -
unquoted.length)
) {
// excess is a negative index
match[0] = match[0].slice(0, excess);
match[2] = unquoted.slice(0, excess);
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice(0, 3);
},
},
filter: {
TAG: function (nodeNameSelector) {
var nodeName = nodeNameSelector
.replace(runescape, funescape)
.toLowerCase();
return nodeNameSelector === "*"
? function () {
return true;
}
: function (elem) {
return (
elem.nodeName && elem.nodeName.toLowerCase() === nodeName
);
};
},
CLASS: function (className) {
var pattern = classCache[className + " "];
return (
pattern ||
((pattern = new RegExp(
"(^|" + whitespace + ")" + className + "(" + whitespace + "|$)"
)) &&
classCache(className, function (elem) {
return pattern.test(
(typeof elem.className === "string" && elem.className) ||
(typeof elem.getAttribute !== "undefined" &&
elem.getAttribute("class")) ||
""
);
}))
);
},
ATTR: function (name, operator, check) {
return function (elem) {
var result = Sizzle.attr(elem, name);
if (result == null) {
return operator === "!=";
}
if (!operator) {
return true;
}
result += "";
/* eslint-disable max-len */
return operator === "="
? result === check
: operator === "!="
? result !== check
: operator === "^="
? check && result.indexOf(check) === 0
: operator === "*="
? check && result.indexOf(check) > -1
: operator === "$="
? check && result.slice(-check.length) === check
: operator === "~="
? (" " + result.replace(rwhitespace, " ") + " ").indexOf(
check
) > -1
: operator === "|="
? result === check ||
result.slice(0, check.length + 1) === check + "-"
: false;
/* eslint-enable max-len */
};
},
CHILD: function (type, what, _argument, first, last) {
var simple = type.slice(0, 3) !== "nth",
forward = type.slice(-4) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0
? // Shortcut for :nth-*(n)
function (elem) {
return !!elem.parentNode;
}
: function (elem, _context, xml) {
var cache,
uniqueCache,
outerCache,
node,
nodeIndex,
start,
dir =
simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType,
diff = false;
if (parent) {
// :(first|last|only)-(child|of-type)
if (simple) {
while (dir) {
node = elem;
while ((node = node[dir])) {
if (
ofType
? node.nodeName.toLowerCase() === name
: node.nodeType === 1
) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir =
type === "only" && !start && "nextSibling";
}
return true;
}
start = [forward ? parent.firstChild : parent.lastChild];
// non-xml :nth-child(...) stores cache data on `parent`
if (forward && useCache) {
// Seek `elem` from a previously-cached index
// ...in a gzip-friendly way
node = parent;
outerCache = node[expando] || (node[expando] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache =
outerCache[node.uniqueID] ||
(outerCache[node.uniqueID] = {});
cache = uniqueCache[type] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = nodeIndex && cache[2];
node = nodeIndex && parent.childNodes[nodeIndex];
while (
(node =
(++nodeIndex && node && node[dir]) ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) ||
start.pop())
) {
// When found, cache indexes on `parent` and break
if (node.nodeType === 1 && ++diff && node === elem) {
uniqueCache[type] = [dirruns, nodeIndex, diff];
break;
}
}
} else {
// Use previously-cached element index if available
if (useCache) {
// ...in a gzip-friendly way
node = elem;
outerCache = node[expando] || (node[expando] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache =
outerCache[node.uniqueID] ||
(outerCache[node.uniqueID] = {});
cache = uniqueCache[type] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = nodeIndex;
}
// xml :nth-child(...)
// or :nth-last-child(...) or :nth(-last)?-of-type(...)
if (diff === false) {
// Use the same loop as above to seek `elem` from the start
while (
(node =
(++nodeIndex && node && node[dir]) ||
(diff = nodeIndex = 0) ||
start.pop())
) {
if (
(ofType
? node.nodeName.toLowerCase() === name
: node.nodeType === 1) &&
++diff
) {
// Cache the index of each encountered element
if (useCache) {
outerCache =
node[expando] || (node[expando] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache =
outerCache[node.uniqueID] ||
(outerCache[node.uniqueID] = {});
uniqueCache[type] = [dirruns, diff];
}
if (node === elem) {
break;
}
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return (
diff === first ||
(diff % first === 0 && diff / first >= 0)
);
}
};
},
PSEUDO: function (pseudo, argument) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn =
Expr.pseudos[pseudo] ||
Expr.setFilters[pseudo.toLowerCase()] ||
Sizzle.error("unsupported pseudo: " + pseudo);
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if (fn[expando]) {
return fn(argument);
}
// But maintain support for old signatures
if (fn.length > 1) {
args = [pseudo, pseudo, "", argument];
return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase())
? markFunction(function (seed, matches) {
var idx,
matched = fn(seed, argument),
i = matched.length;
while (i--) {
idx = indexOf(seed, matched[i]);
seed[idx] = !(matches[idx] = matched[i]);
}
})
: function (elem) {
return fn(elem, 0, args);
};
}
return fn;
},
},
pseudos: {
// Potentially complex pseudos
not: markFunction(function (selector) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile(selector.replace(rtrim, "$1"));
return matcher[expando]
? markFunction(function (seed, matches, _context, xml) {
var elem,
unmatched = matcher(seed, null, xml, []),
i = seed.length;
// Match elements unmatched by `matcher`
while (i--) {
if ((elem = unmatched[i])) {
seed[i] = !(matches[i] = elem);
}
}
})
: function (elem, _context, xml) {
input[0] = elem;
matcher(input, null, xml, results);
// Don't keep the element (issue #299)
input[0] = null;
return !results.pop();
};
}),
has: markFunction(function (selector) {
return function (elem) {
return Sizzle(selector, elem).length > 0;
};
}),
contains: markFunction(function (text) {
text = text.replace(runescape, funescape);
return function (elem) {
return (elem.textContent || getText(elem)).indexOf(text) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
lang: markFunction(function (lang) {
// lang value must be a valid identifier
if (!ridentifier.test(lang || "")) {
Sizzle.error("unsupported lang: " + lang);
}
lang = lang.replace(runescape, funescape).toLowerCase();
return function (elem) {
var elemLang;
do {
if (
(elemLang = documentIsHTML
? elem.lang
: elem.getAttribute("xml:lang") ||
elem.getAttribute("lang"))
) {
elemLang = elemLang.toLowerCase();
return (
elemLang === lang || elemLang.indexOf(lang + "-") === 0
);
}
} while ((elem = elem.parentNode) && elem.nodeType === 1);
return false;
};
}),
// Miscellaneous
target: function (elem) {
var hash = window.location && window.location.hash;
return hash && hash.slice(1) === elem.id;
},
root: function (elem) {
return elem === docElem;
},
focus: function (elem) {
return (
elem === document.activeElement &&
(!document.hasFocus || document.hasFocus()) &&
!!(elem.type || elem.href || ~elem.tabIndex)
);
},
// Boolean properties
enabled: createDisabledPseudo(false),
disabled: createDisabledPseudo(true),
checked: function (elem) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (
(nodeName === "input" && !!elem.checked) ||
(nodeName === "option" && !!elem.selected)
);
},
selected: function (elem) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if (elem.parentNode) {
// eslint-disable-next-line no-unused-expressions
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
empty: function (elem) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
// but not by others (comment: 8; processing instruction: 7; etc.)
// nodeType < 6 works because attributes (2) do not appear as children
for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
if (elem.nodeType < 6) {
return false;
}
}
return true;
},
parent: function (elem) {
return !Expr.pseudos["empty"](elem);
},
// Element/input types
header: function (elem) {
return rheader.test(elem.nodeName);
},
input: function (elem) {
return rinputs.test(elem.nodeName);
},
button: function (elem) {
var name = elem.nodeName.toLowerCase();
return (
(name === "input" && elem.type === "button") || name === "button"
);
},
text: function (elem) {
var attr;
return (
elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
// Support: IE<8
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
((attr = elem.getAttribute("type")) == null ||
attr.toLowerCase() === "text")
);
},
// Position-in-collection
first: createPositionalPseudo(function () {
return [0];
}),
last: createPositionalPseudo(function (_matchIndexes, length) {
return [length - 1];
}),
eq: createPositionalPseudo(function (
_matchIndexes,
length,
argument
) {
return [argument < 0 ? argument + length : argument];
}),
even: createPositionalPseudo(function (matchIndexes, length) {
var i = 0;
for (; i < length; i += 2) {
matchIndexes.push(i);
}
return matchIndexes;
}),
odd: createPositionalPseudo(function (matchIndexes, length) {
var i = 1;
for (; i < length; i += 2) {
matchIndexes.push(i);
}
return matchIndexes;
}),
lt: createPositionalPseudo(function (matchIndexes, length, argument) {
var i =
argument < 0
? argument + length
: argument > length
? length
: argument;
for (; --i >= 0; ) {
matchIndexes.push(i);
}
return matchIndexes;
}),
gt: createPositionalPseudo(function (matchIndexes, length, argument) {
var i = argument < 0 ? argument + length : argument;
for (; ++i < length; ) {
matchIndexes.push(i);
}
return matchIndexes;
}),
},
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for (i in {
radio: true,
checkbox: true,
file: true,
password: true,
image: true,
}) {
Expr.pseudos[i] = createInputPseudo(i);
}
for (i in { submit: true, reset: true }) {
Expr.pseudos[i] = createButtonPseudo(i);
}
// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
tokenize = Sizzle.tokenize = function (selector, parseOnly) {
var matched,
match,
tokens,
type,
soFar,
groups,
preFilters,
cached = tokenCache[selector + " "];
if (cached) {
return parseOnly ? 0 : cached.slice(0);
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while (soFar) {
// Comma and first run
if (!matched || (match = rcomma.exec(soFar))) {
if (match) {
// Don't consume trailing commas as valid
soFar = soFar.slice(match[0].length) || soFar;
}
groups.push((tokens = []));
}
matched = false;
// Combinators
if ((match = rcombinators.exec(soFar))) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace(rtrim, " "),
});
soFar = soFar.slice(matched.length);
}
// Filters
for (type in Expr.filter) {
if (
(match = matchExpr[type].exec(soFar)) &&
(!preFilters[type] || (match = preFilters[type](match)))
) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match,
});
soFar = soFar.slice(matched.length);
}
}
if (!matched) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly
? soFar.length
: soFar
? Sizzle.error(selector)
: // Cache the tokens
tokenCache(selector, groups).slice(0);
};
function toSelector(tokens) {
var i = 0,
len = tokens.length,
selector = "";
for (; i < len; i++) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator(matcher, combinator, base) {
var dir = combinator.dir,
skip = combinator.next,
key = skip || dir,
checkNonElements = base && key === "parentNode",
doneName = done++;
return combinator.first
? // Check against closest ancestor/preceding element
function (elem, context, xml) {
while ((elem = elem[dir])) {
if (elem.nodeType === 1 || checkNonElements) {
return matcher(elem, context, xml);
}
}
return false;
}
: // Check against all ancestor/preceding elements
function (elem, context, xml) {
var oldCache,
uniqueCache,
outerCache,
newCache = [dirruns, doneName];
// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
if (xml) {
while ((elem = elem[dir])) {
if (elem.nodeType === 1 || checkNonElements) {
if (matcher(elem, context, xml)) {
return true;
}
}
}
} else {
while ((elem = elem[dir])) {
if (elem.nodeType === 1 || checkNonElements) {
outerCache = elem[expando] || (elem[expando] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache =
outerCache[elem.uniqueID] ||
(outerCache[elem.uniqueID] = {});
if (skip && skip === elem.nodeName.toLowerCase()) {
elem = elem[dir] || elem;
} else if (
(oldCache = uniqueCache[key]) &&
oldCache[0] === dirruns &&
oldCache[1] === doneName
) {
// Assign to newCache so results back-propagate to previous elements
return (newCache[2] = oldCache[2]);
} else {
// Reuse newcache so results back-propagate to previous elements
uniqueCache[key] = newCache;
// A match means we're done; a fail means we have to keep checking
if ((newCache[2] = matcher(elem, context, xml))) {
return true;
}
}
}
}
}
return false;
};
}
function elementMatcher(matchers) {
return matchers.length > 1
? function (elem, context, xml) {
var i = matchers.length;
while (i--) {
if (!matchers[i](elem, context, xml)) {
return false;
}
}
return true;
}
: matchers[0];
}
function multipleContexts(selector, contexts, results) {
var i = 0,
len = contexts.length;
for (; i < len; i++) {
Sizzle(selector, contexts[i], results);
}
return results;
}
function condense(unmatched, map, filter, context, xml) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for (; i < len; i++) {
if ((elem = unmatched[i])) {
if (!filter || filter(elem, context, xml)) {
newUnmatched.push(elem);
if (mapped) {
map.push(i);
}
}
}
}
return newUnmatched;
}
function setMatcher(
preFilter,
selector,
matcher,
postFilter,
postFinder,
postSelector
) {
if (postFilter && !postFilter[expando]) {
postFilter = setMatcher(postFilter);
}
if (postFinder && !postFinder[expando]) {
postFinder = setMatcher(postFinder, postSelector);
}
return markFunction(function (seed, results, context, xml) {
var temp,
i,
elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems =
seed ||
multipleContexts(
selector || "*",
context.nodeType ? [context] : context,
[]
),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn =
preFilter && (seed || !selector)
? condense(elems, preMap, preFilter, context, xml)
: elems,
matcherOut = matcher
? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || (seed ? preFilter : preexisting || postFilter)
? // ...intermediate processing is necessary
[]
: // ...otherwise use results directly
results
: matcherIn;
// Find primary matches
if (matcher) {
matcher(matcherIn, matcherOut, context, xml);
}
// Apply postFilter
if (postFilter) {
temp = condense(matcherOut, postMap);
postFilter(temp, [], context, xml);
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while (i--) {
if ((elem = temp[i])) {
matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
}
}
}
if (seed) {
if (postFinder || preFilter) {
if (postFinder) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while (i--) {
if ((elem = matcherOut[i])) {
// Restore matcherIn since elem is not yet a final match
temp.push((matcherIn[i] = elem));
}
}
postFinder(null, (matcherOut = []), temp, xml);
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while (i--) {
if (
(elem = matcherOut[i]) &&
(temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1
) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results
? matcherOut.splice(preexisting, matcherOut.length)
: matcherOut
);
if (postFinder) {
postFinder(null, results, matcherOut, xml);
} else {
push.apply(results, matcherOut);
}
}
});
}
function matcherFromTokens(tokens) {
var checkContext,
matcher,
j,
len = tokens.length,
leadingRelative = Expr.relative[tokens[0].type],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator(
function (elem) {
return elem === checkContext;
},
implicitRelative,
true
),
matchAnyContext = addCombinator(
function (elem) {
return indexOf(checkContext, elem) > -1;
},
implicitRelative,
true
),
matchers = [
function (elem, context, xml) {
var ret =
(!leadingRelative && (xml || context !== outermostContext)) ||
((checkContext = context).nodeType
? matchContext(elem, context, xml)
: matchAnyContext(elem, context, xml));
// Avoid hanging onto element (issue #299)
checkContext = null;
return ret;
},
];
for (; i < len; i++) {
if ((matcher = Expr.relative[tokens[i].type])) {
matchers = [addCombinator(elementMatcher(matchers), matcher)];
} else {
matcher = Expr.filter[tokens[i].type].apply(
null,
tokens[i].matches
);
// Return special upon seeing a positional matcher
if (matcher[expando]) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for (; j < len; j++) {
if (Expr.relative[tokens[j].type]) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher(matchers),
i > 1 &&
toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens
.slice(0, i - 1)
.concat({ value: tokens[i - 2].type === " " ? "*" : "" })
).replace(rtrim, "$1"),
matcher,
i < j && matcherFromTokens(tokens.slice(i, j)),
j < len && matcherFromTokens((tokens = tokens.slice(j))),
j < len && toSelector(tokens)
);
}
matchers.push(matcher);
}
}
return elementMatcher(matchers);
}
function matcherFromGroupMatchers(elementMatchers, setMatchers) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function (seed, context, xml, results, outermost) {
var elem,
j,
matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || (byElement && Expr.find["TAG"]("*", outermost)),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns +=
contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if (outermost) {
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
outermostContext = context == document || context || outermost;
}
// Add elements passing elementMatchers directly to results
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for (; i !== len && (elem = elems[i]) != null; i++) {
if (byElement && elem) {
j = 0;
// Support: IE 11+, Edge 17 - 18+
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
if (!context && elem.ownerDocument != document) {
setDocument(elem);
xml = !documentIsHTML;
}
while ((matcher = elementMatchers[j++])) {
if (matcher(elem, context || document, xml)) {
results.push(elem);
break;
}
}
if (outermost) {
dirruns = dirrunsUnique;
}
}
// Track unmatched elements for set filters
if (bySet) {
// They will have gone through all possible matchers
if ((elem = !matcher && elem)) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if (seed) {
unmatched.push(elem);
}
}
}
// `i` is now the count of elements visited above, and adding it to `matchedCount`
// makes the latter nonnegative.
matchedCount += i;
// Apply set filters to unmatched elements
// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
// no element matchers and no seed.
// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
// case, which will result in a "00" `matchedCount` that differs from `i` but is also
// numerically zero.
if (bySet && i !== matchedCount) {
j = 0;
while ((matcher = setMatchers[j++])) {
matcher(unmatched, setMatched, context, xml);
}
if (seed) {
// Reintegrate element matches to eliminate the need for sorting
if (matchedCount > 0) {
while (i--) {
if (!(unmatched[i] || setMatched[i])) {
setMatched[i] = pop.call(results);
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense(setMatched);
}
// Add matches to results
push.apply(results, setMatched);
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if (
outermost &&
!seed &&
setMatched.length > 0 &&
matchedCount + setMatchers.length > 1
) {
Sizzle.uniqueSort(results);
}
}
// Override manipulation of globals by nested matchers
if (outermost) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ? markFunction(superMatcher) : superMatcher;
}
compile = Sizzle.compile = function (
selector,
match /* Internal Use Only */
) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[selector + " "];
if (!cached) {
// Generate a function of recursive functions that can be used to check each element
if (!match) {
match = tokenize(selector);
}
i = match.length;
while (i--) {
cached = matcherFromTokens(match[i]);
if (cached[expando]) {
setMatchers.push(cached);
} else {
elementMatchers.push(cached);
}
}
// Cache the compiled function
cached = compilerCache(
selector,
matcherFromGroupMatchers(elementMatchers, setMatchers)
);
// Save selector and tokenization
cached.selector = selector;
}
return cached;
};
/**
* A low-level selection function that works with Sizzle's compiled
* selector functions
* @param {String|Function} selector A selector or a pre-compiled
* selector function built with Sizzle.compile
* @param {Element} context
* @param {Array} [results]
* @param {Array} [seed] A set of elements to match against
*/
select = Sizzle.select = function (selector, context, results, seed) {
var i,
tokens,
token,
type,
find,
compiled = typeof selector === "function" && selector,
match = !seed && tokenize((selector = compiled.selector || selector));
results = results || [];
// Try to minimize operations if there is only one selector in the list and no seed
// (the latter of which guarantees us context)
if (match.length === 1) {
// Reduce context if the leading compound selector is an ID
tokens = match[0] = match[0].slice(0);
if (
tokens.length > 2 &&
(token = tokens[0]).type === "ID" &&
context.nodeType === 9 &&
documentIsHTML &&
Expr.relative[tokens[1].type]
) {
context = (Expr.find["ID"](
token.matches[0].replace(runescape, funescape),
context
) || [])[0];
if (!context) {
return results;
// Precompiled matchers will still verify ancestry, so step up a level
} else if (compiled) {
context = context.parentNode;
}
selector = selector.slice(tokens.shift().value.length);
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
while (i--) {
token = tokens[i];
// Abort if we hit a combinator
if (Expr.relative[(type = token.type)]) {
break;
}
if ((find = Expr.find[type])) {
// Search, expanding context for leading sibling combinators
if (
(seed = find(
token.matches[0].replace(runescape, funescape),
(rsibling.test(tokens[0].type) &&
testContext(context.parentNode)) ||
context
))
) {
// If seed is empty or no tokens remain, we can return early
tokens.splice(i, 1);
selector = seed.length && toSelector(tokens);
if (!selector) {
push.apply(results, seed);
return results;
}
break;
}
}
}
}
// Compile and execute a filtering function if one is not provided
// Provide `match` to avoid retokenization if we modified the selector above
(compiled || compile(selector, match))(
seed,
context,
!documentIsHTML,
results,
!context ||
(rsibling.test(selector) && testContext(context.parentNode)) ||
context
);
return results;
};
// One-time assignments
// Sort stability
support.sortStable =
expando.split("").sort(sortOrder).join("") === expando;
// Support: Chrome 14-35+
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function (el) {
// Should return 1, but returns 4 (following)
return (
el.compareDocumentPosition(document.createElement("fieldset")) & 1
);
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if (
!assert(function (el) {
el.innerHTML = "<a href='#'></a>";
return el.firstChild.getAttribute("href") === "#";
})
) {
addHandle("type|href|height|width", function (elem, name, isXML) {
if (!isXML) {
return elem.getAttribute(
name,
name.toLowerCase() === "type" ? 1 : 2
);
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if (
!support.attributes ||
!assert(function (el) {
el.innerHTML = "<input/>";
el.firstChild.setAttribute("value", "");
return el.firstChild.getAttribute("value") === "";
})
) {
addHandle("value", function (elem, _name, isXML) {
if (!isXML && elem.nodeName.toLowerCase() === "input") {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if (
!assert(function (el) {
return el.getAttribute("disabled") == null;
})
) {
addHandle(booleans, function (elem, name, isXML) {
var val;
if (!isXML) {
return elem[name] === true
? name.toLowerCase()
: (val = elem.getAttributeNode(name)) && val.specified
? val.value
: null;
}
});
}
return Sizzle;
})(window);
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
// Deprecated
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
jQuery.escapeSelector = Sizzle.escape;
var dir = function (elem, dir, until) {
var matched = [],
truncate = until !== undefined;
while ((elem = elem[dir]) && elem.nodeType !== 9) {
if (elem.nodeType === 1) {
if (truncate && jQuery(elem).is(until)) {
break;
}
matched.push(elem);
}
}
return matched;
};
var siblings = function (n, elem) {
var matched = [];
for (; n; n = n.nextSibling) {
if (n.nodeType === 1 && n !== elem) {
matched.push(n);
}
}
return matched;
};
var rneedsContext = jQuery.expr.match.needsContext;
function nodeName(elem, name) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
}
var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
// Implement the identical functionality for filter and not
function winnow(elements, qualifier, not) {
if (isFunction(qualifier)) {
return jQuery.grep(elements, function (elem, i) {
return !!qualifier.call(elem, i, elem) !== not;
});
}
// Single element
if (qualifier.nodeType) {
return jQuery.grep(elements, function (elem) {
return (elem === qualifier) !== not;
});
}
// Arraylike of elements (jQuery, arguments, Array)
if (typeof qualifier !== "string") {
return jQuery.grep(elements, function (elem) {
return indexOf.call(qualifier, elem) > -1 !== not;
});
}
// Filtered directly for both simple and complex selectors
return jQuery.filter(qualifier, elements, not);
}
jQuery.filter = function (expr, elems, not) {
var elem = elems[0];
if (not) {
expr = ":not(" + expr + ")";
}
if (elems.length === 1 && elem.nodeType === 1) {
return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
}
return jQuery.find.matches(
expr,
jQuery.grep(elems, function (elem) {
return elem.nodeType === 1;
})
);
};
jQuery.fn.extend({
find: function (selector) {
var i,
ret,
len = this.length,
self = this;
if (typeof selector !== "string") {
return this.pushStack(
jQuery(selector).filter(function () {
for (i = 0; i < len; i++) {
if (jQuery.contains(self[i], this)) {
return true;
}
}
})
);
}
ret = this.pushStack([]);
for (i = 0; i < len; i++) {
jQuery.find(selector, self[i], ret);
}
return len > 1 ? jQuery.uniqueSort(ret) : ret;
},
filter: function (selector) {
return this.pushStack(winnow(this, selector || [], false));
},
not: function (selector) {
return this.pushStack(winnow(this, selector || [], true));
},
is: function (selector) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test(selector)
? jQuery(selector)
: selector || [],
false
).length;
},
});
// Initialize a jQuery object
// A central reference to the root jQuery(document)
var rootjQuery,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
// Shortcut simple #id case for speed
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
init = (jQuery.fn.init = function (selector, context, root) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if (!selector) {
return this;
}
// Method init() accepts an alternate rootjQuery
// so migrate can support jQuery.sub (gh-2101)
root = root || rootjQuery;
// Handle HTML strings
if (typeof selector === "string") {
if (
selector[0] === "<" &&
selector[selector.length - 1] === ">" &&
selector.length >= 3
) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [null, selector, null];
} else {
match = rquickExpr.exec(selector);
}
// Match html or make sure no context is specified for #id
if (match && (match[1] || !context)) {
// HANDLE: $(html) -> $(array)
if (match[1]) {
context = context instanceof jQuery ? context[0] : context;
// Option to run scripts is true for back-compat
// Intentionally let the error be thrown if parseHTML is not present
jQuery.merge(
this,
jQuery.parseHTML(
match[1],
context && context.nodeType
? context.ownerDocument || context
: document,
true
)
);
// HANDLE: $(html, props)
if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
for (match in context) {
// Properties of context are called as methods if possible
if (isFunction(this[match])) {
this[match](context[match]);
// ...and otherwise set as attributes
} else {
this.attr(match, context[match]);
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById(match[2]);
if (elem) {
// Inject the element directly into the jQuery object
this[0] = elem;
this.length = 1;
}
return this;
}
// HANDLE: $(expr, $(...))
} else if (!context || context.jquery) {
return (context || root).find(selector);
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor(context).find(selector);
}
// HANDLE: $(DOMElement)
} else if (selector.nodeType) {
this[0] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if (isFunction(selector)) {
return root.ready !== undefined
? root.ready(selector)
: // Execute immediately if ready is not present
selector(jQuery);
}
return jQuery.makeArray(selector, this);
});
// Give the init function the jQuery prototype for later instantiation
init.prototype = jQuery.fn;
// Initialize central reference
rootjQuery = jQuery(document);
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
// Methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true,
};
jQuery.fn.extend({
has: function (target) {
var targets = jQuery(target, this),
l = targets.length;
return this.filter(function () {
var i = 0;
for (; i < l; i++) {
if (jQuery.contains(this, targets[i])) {
return true;
}
}
});
},
closest: function (selectors, context) {
var cur,
i = 0,
l = this.length,
matched = [],
targets = typeof selectors !== "string" && jQuery(selectors);
// Positional selectors never match, since there's no _selection_ context
if (!rneedsContext.test(selectors)) {
for (; i < l; i++) {
for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
// Always skip document fragments
if (
cur.nodeType < 11 &&
(targets
? targets.index(cur) > -1
: // Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
jQuery.find.matchesSelector(cur, selectors))
) {
matched.push(cur);
break;
}
}
}
}
return this.pushStack(
matched.length > 1 ? jQuery.uniqueSort(matched) : matched
);
},
// Determine the position of an element within the set
index: function (elem) {
// No argument, return index in parent
if (!elem) {
return this[0] && this[0].parentNode
? this.first().prevAll().length
: -1;
}
// Index in selector
if (typeof elem === "string") {
return indexOf.call(jQuery(elem), this[0]);
}
// Locate the position of the desired element
return indexOf.call(
this,
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem
);
},
add: function (selector, context) {
return this.pushStack(
jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context)))
);
},
addBack: function (selector) {
return this.add(
selector == null ? this.prevObject : this.prevObject.filter(selector)
);
},
});
function sibling(cur, dir) {
while ((cur = cur[dir]) && cur.nodeType !== 1) {}
return cur;
}
jQuery.each(
{
parent: function (elem) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function (elem) {
return dir(elem, "parentNode");
},
parentsUntil: function (elem, _i, until) {
return dir(elem, "parentNode", until);
},
next: function (elem) {
return sibling(elem, "nextSibling");
},
prev: function (elem) {
return sibling(elem, "previousSibling");
},
nextAll: function (elem) {
return dir(elem, "nextSibling");
},
prevAll: function (elem) {
return dir(elem, "previousSibling");
},
nextUntil: function (elem, _i, until) {
return dir(elem, "nextSibling", until);
},
prevUntil: function (elem, _i, until) {
return dir(elem, "previousSibling", until);
},
siblings: function (elem) {
return siblings((elem.parentNode || {}).firstChild, elem);
},
children: function (elem) {
return siblings(elem.firstChild);
},
contents: function (elem) {
if (
elem.contentDocument != null &&
// Support: IE 11+
// <object> elements with no `data` attribute has an object
// `contentDocument` with a `null` prototype.
getProto(elem.contentDocument)
) {
return elem.contentDocument;
}
// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
// Treat the template element as a regular one in browsers that
// don't support it.
if (nodeName(elem, "template")) {
elem = elem.content || elem;
}
return jQuery.merge([], elem.childNodes);
},
},
function (name, fn) {
jQuery.fn[name] = function (until, selector) {
var matched = jQuery.map(this, fn, until);
if (name.slice(-5) !== "Until") {
selector = until;
}
if (selector && typeof selector === "string") {
matched = jQuery.filter(selector, matched);
}
if (this.length > 1) {
// Remove duplicates
if (!guaranteedUnique[name]) {
jQuery.uniqueSort(matched);
}
// Reverse order for parents* and prev-derivatives
if (rparentsprev.test(name)) {
matched.reverse();
}
}
return this.pushStack(matched);
};
}
);
var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
// Convert String-formatted options into Object-formatted ones
function createOptions(options) {
var object = {};
jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
object[flag] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function (options) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options =
typeof options === "string"
? createOptions(options)
: jQuery.extend({}, options);
var // Flag to know if list is currently firing
firing,
// Last fire value for non-forgettable lists
memory,
// Flag to know if list was already fired
fired,
// Flag to prevent firing
locked,
// Actual callback list
list = [],
// Queue of execution data for repeatable lists
queue = [],
// Index of currently firing callback (modified by add/remove as needed)
firingIndex = -1,
// Fire callbacks
fire = function () {
// Enforce single-firing
locked = locked || options.once;
// Execute callbacks for all pending executions,
// respecting firingIndex overrides and runtime changes
fired = firing = true;
for (; queue.length; firingIndex = -1) {
memory = queue.shift();
while (++firingIndex < list.length) {
// Run callback and check for early termination
if (
list[firingIndex].apply(memory[0], memory[1]) === false &&
options.stopOnFalse
) {
// Jump to end and forget the data so .add doesn't re-fire
firingIndex = list.length;
memory = false;
}
}
}
// Forget the data if we're done with it
if (!options.memory) {
memory = false;
}
firing = false;
// Clean up if we're done firing for good
if (locked) {
// Keep an empty list if we have data for future add calls
if (memory) {
list = [];
// Otherwise, this object is spent
} else {
list = "";
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function () {
if (list) {
// If we have memory from a past run, we should fire after adding
if (memory && !firing) {
firingIndex = list.length - 1;
queue.push(memory);
}
(function add(args) {
jQuery.each(args, function (_, arg) {
if (isFunction(arg)) {
if (!options.unique || !self.has(arg)) {
list.push(arg);
}
} else if (arg && arg.length && toType(arg) !== "string") {
// Inspect recursively
add(arg);
}
});
})(arguments);
if (memory && !firing) {
fire();
}
}
return this;
},
// Remove a callback from the list
remove: function () {
jQuery.each(arguments, function (_, arg) {
var index;
while ((index = jQuery.inArray(arg, list, index)) > -1) {
list.splice(index, 1);
// Handle firing indexes
if (index <= firingIndex) {
firingIndex--;
}
}
});
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function (fn) {
return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
},
// Remove all callbacks from the list
empty: function () {
if (list) {
list = [];
}
return this;
},
// Disable .fire and .add
// Abort any current/pending executions
// Clear all callbacks and values
disable: function () {
locked = queue = [];
list = memory = "";
return this;
},
disabled: function () {
return !list;
},
// Disable .fire
// Also disable .add unless we have memory (since it would have no effect)
// Abort any pending executions
lock: function () {
locked = queue = [];
if (!memory && !firing) {
list = memory = "";
}
return this;
},
locked: function () {
return !!locked;
},
// Call all callbacks with the given context and arguments
fireWith: function (context, args) {
if (!locked) {
args = args || [];
args = [context, args.slice ? args.slice() : args];
queue.push(args);
if (!firing) {
fire();
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function () {
self.fireWith(this, arguments);
return this;
},
// To know if the callbacks have already been called at least once
fired: function () {
return !!fired;
},
};
return self;
};
function Identity(v) {
return v;
}
function Thrower(ex) {
throw ex;
}
function adoptValue(value, resolve, reject, noValue) {
var method;
try {
// Check for promise aspect first to privilege synchronous behavior
if (value && isFunction((method = value.promise))) {
method.call(value).done(resolve).fail(reject);
// Other thenables
} else if (value && isFunction((method = value.then))) {
method.call(value, resolve, reject);
// Other non-thenables
} else {
// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
// * false: [ value ].slice( 0 ) => resolve( value )
// * true: [ value ].slice( 1 ) => resolve()
resolve.apply(undefined, [value].slice(noValue));
}
// For Promises/A+, convert exceptions into rejections
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
// Deferred#then to conditionally suppress rejection.
} catch (value) {
// Support: Android 4.0 only
// Strict mode functions invoked without .call/.apply get global-object context
reject.apply(undefined, [value]);
}
}
jQuery.extend({
Deferred: function (func) {
var tuples = [
// action, add listener, callbacks,
// ... .then handlers, argument index, [final state]
[
"notify",
"progress",
jQuery.Callbacks("memory"),
jQuery.Callbacks("memory"),
2,
],
[
"resolve",
"done",
jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"),
0,
"resolved",
],
[
"reject",
"fail",
jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"),
1,
"rejected",
],
],
state = "pending",
promise = {
state: function () {
return state;
},
always: function () {
deferred.done(arguments).fail(arguments);
return this;
},
catch: function (fn) {
return promise.then(null, fn);
},
// Keep pipe for back-compat
pipe: function (/* fnDone, fnFail, fnProgress */) {
var fns = arguments;
return jQuery
.Deferred(function (newDefer) {
jQuery.each(tuples, function (_i, tuple) {
// Map tuples (progress, done, fail) to arguments (done, fail, progress)
var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
// deferred.progress(function() { bind to newDefer or newDefer.notify })
// deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
deferred[tuple[1]](function () {
var returned = fn && fn.apply(this, arguments);
if (returned && isFunction(returned.promise)) {
returned
.promise()
.progress(newDefer.notify)
.done(newDefer.resolve)
.fail(newDefer.reject);
} else {
newDefer[tuple[0] + "With"](
this,
fn ? [returned] : arguments
);
}
});
});
fns = null;
})
.promise();
},
then: function (onFulfilled, onRejected, onProgress) {
var maxDepth = 0;
function resolve(depth, deferred, handler, special) {
return function () {
var that = this,
args = arguments,
mightThrow = function () {
var returned, then;
// Support: Promises/A+ section 2.3.3.3.3
// https://promisesaplus.com/#point-59
// Ignore double-resolution attempts
if (depth < maxDepth) {
return;
}
returned = handler.apply(that, args);
// Support: Promises/A+ section 2.3.1
// https://promisesaplus.com/#point-48
if (returned === deferred.promise()) {
throw new TypeError("Thenable self-resolution");
}
// Support: Promises/A+ sections 2.3.3.1, 3.5
// https://promisesaplus.com/#point-54
// https://promisesaplus.com/#point-75
// Retrieve `then` only once
then =
returned &&
// Support: Promises/A+ section 2.3.4
// https://promisesaplus.com/#point-64
// Only check objects and functions for thenability
(typeof returned === "object" ||
typeof returned === "function") &&
returned.then;
// Handle a returned thenable
if (isFunction(then)) {
// Special processors (notify) just wait for resolution
if (special) {
then.call(
returned,
resolve(maxDepth, deferred, Identity, special),
resolve(maxDepth, deferred, Thrower, special)
);
// Normal processors (resolve) also hook into progress
} else {
// ...and disregard older resolution values
maxDepth++;
then.call(
returned,
resolve(maxDepth, deferred, Identity, special),
resolve(maxDepth, deferred, Thrower, special),
resolve(
maxDepth,
deferred,
Identity,
deferred.notifyWith
)
);
}
// Handle all other returned values
} else {
// Only substitute handlers pass on context
// and multiple values (non-spec behavior)
if (handler !== Identity) {
that = undefined;
args = [returned];
}
// Process the value(s)
// Default process is resolve
(special || deferred.resolveWith)(that, args);
}
},
// Only normal processors (resolve) catch and reject exceptions
process = special
? mightThrow
: function () {
try {
mightThrow();
} catch (e) {
if (jQuery.Deferred.exceptionHook) {
jQuery.Deferred.exceptionHook(
e,
process.stackTrace
);
}
// Support: Promises/A+ section 2.3.3.3.4.1
// https://promisesaplus.com/#point-61
// Ignore post-resolution exceptions
if (depth + 1 >= maxDepth) {
// Only substitute handlers pass on context
// and multiple values (non-spec behavior)
if (handler !== Thrower) {
that = undefined;
args = [e];
}
deferred.rejectWith(that, args);
}
}
};
// Support: Promises/A+ section 2.3.3.3.1
// https://promisesaplus.com/#point-57
// Re-resolve promises immediately to dodge false rejection from
// subsequent errors
if (depth) {
process();
} else {
// Call an optional hook to record the stack, in case of exception
// since it's otherwise lost when execution goes async
if (jQuery.Deferred.getStackHook) {
process.stackTrace = jQuery.Deferred.getStackHook();
}
window.setTimeout(process);
}
};
}
return jQuery
.Deferred(function (newDefer) {
// progress_handlers.add( ... )
tuples[0][3].add(
resolve(
0,
newDefer,
isFunction(onProgress) ? onProgress : Identity,
newDefer.notifyWith
)
);
// fulfilled_handlers.add( ... )
tuples[1][3].add(
resolve(
0,
newDefer,
isFunction(onFulfilled) ? onFulfilled : Identity
)
);
// rejected_handlers.add( ... )
tuples[2][3].add(
resolve(
0,
newDefer,
isFunction(onRejected) ? onRejected : Thrower
)
);
})
.promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function (obj) {
return obj != null ? jQuery.extend(obj, promise) : promise;
},
},
deferred = {};
// Add list-specific methods
jQuery.each(tuples, function (i, tuple) {
var list = tuple[2],
stateString = tuple[5];
// promise.progress = list.add
// promise.done = list.add
// promise.fail = list.add
promise[tuple[1]] = list.add;
// Handle state
if (stateString) {
list.add(
function () {
// state = "resolved" (i.e., fulfilled)
// state = "rejected"
state = stateString;
},
// rejected_callbacks.disable
// fulfilled_callbacks.disable
tuples[3 - i][2].disable,
// rejected_handlers.disable
// fulfilled_handlers.disable
tuples[3 - i][3].disable,
// progress_callbacks.lock
tuples[0][2].lock,
// progress_handlers.lock
tuples[0][3].lock
);
}
// progress_handlers.fire
// fulfilled_handlers.fire
// rejected_handlers.fire
list.add(tuple[3].fire);
// deferred.notify = function() { deferred.notifyWith(...) }
// deferred.resolve = function() { deferred.resolveWith(...) }
// deferred.reject = function() { deferred.rejectWith(...) }
deferred[tuple[0]] = function () {
deferred[tuple[0] + "With"](
this === deferred ? undefined : this,
arguments
);
return this;
};
// deferred.notifyWith = list.fireWith
// deferred.resolveWith = list.fireWith
// deferred.rejectWith = list.fireWith
deferred[tuple[0] + "With"] = list.fireWith;
});
// Make the deferred a promise
promise.promise(deferred);
// Call given func if any
if (func) {
func.call(deferred, deferred);
}
// All done!
return deferred;
},
// Deferred helper
when: function (singleValue) {
var // count of uncompleted subordinates
remaining = arguments.length,
// count of unprocessed arguments
i = remaining,
// subordinate fulfillment data
resolveContexts = Array(i),
resolveValues = slice.call(arguments),
// the primary Deferred
primary = jQuery.Deferred(),
// subordinate callback factory
updateFunc = function (i) {
return function (value) {
resolveContexts[i] = this;
resolveValues[i] =
arguments.length > 1 ? slice.call(arguments) : value;
if (!--remaining) {
primary.resolveWith(resolveContexts, resolveValues);
}
};
};
// Single- and empty arguments are adopted like Promise.resolve
if (remaining <= 1) {
adoptValue(
singleValue,
primary.done(updateFunc(i)).resolve,
primary.reject,
!remaining
);
// Use .then() to unwrap secondary thenables (cf. gh-3000)
if (
primary.state() === "pending" ||
isFunction(resolveValues[i] && resolveValues[i].then)
) {
return primary.then();
}
}
// Multiple arguments are aggregated like Promise.all array elements
while (i--) {
adoptValue(resolveValues[i], updateFunc(i), primary.reject);
}
return primary.promise();
},
});
// These usually indicate a programmer mistake during development,
// warn about them ASAP rather than swallowing them by default.
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
jQuery.Deferred.exceptionHook = function (error, stack) {
// Support: IE 8 - 9 only
// Console exists when dev tools are open, which can happen at any time
if (
window.console &&
window.console.warn &&
error &&
rerrorNames.test(error.name)
) {
window.console.warn(
"jQuery.Deferred exception: " + error.message,
error.stack,
stack
);
}
};
jQuery.readyException = function (error) {
window.setTimeout(function () {
throw error;
});
};
// The deferred used on DOM ready
var readyList = jQuery.Deferred();
jQuery.fn.ready = function (fn) {
readyList
.then(fn)
// Wrap jQuery.readyException in a function so that the lookup
// happens at the time of error handling instead of callback
// registration.
.catch(function (error) {
jQuery.readyException(error);
});
return this;
};
jQuery.extend({
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Handle when the DOM is ready
ready: function (wait) {
// Abort if there are pending holds or we're already ready
if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
return;
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if (wait !== true && --jQuery.readyWait > 0) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith(document, [jQuery]);
},
});
jQuery.ready.then = readyList.then;
// The ready event handler and self cleanup method
function completed() {
document.removeEventListener("DOMContentLoaded", completed);
window.removeEventListener("load", completed);
jQuery.ready();
}
// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE <=9 - 10 only
// Older IE sometimes signals "interactive" too soon
if (
document.readyState === "complete" ||
(document.readyState !== "loading" && !document.documentElement.doScroll)
) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
window.setTimeout(jQuery.ready);
} else {
// Use the handy event callback
document.addEventListener("DOMContentLoaded", completed);
// A fallback to window.onload, that will always work
window.addEventListener("load", completed);
}
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function (elems, fn, key, value, chainable, emptyGet, raw) {
var i = 0,
len = elems.length,
bulk = key == null;
// Sets many values
if (toType(key) === "object") {
chainable = true;
for (i in key) {
access(elems, fn, i, key[i], true, emptyGet, raw);
}
// Sets one value
} else if (value !== undefined) {
chainable = true;
if (!isFunction(value)) {
raw = true;
}
if (bulk) {
// Bulk operations run against the entire set
if (raw) {
fn.call(elems, value);
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function (elem, _key, value) {
return bulk.call(jQuery(elem), value);
};
}
}
if (fn) {
for (; i < len; i++) {
fn(
elems[i],
key,
raw ? value : value.call(elems[i], i, fn(elems[i], key))
);
}
}
}
if (chainable) {
return elems;
}
// Gets
if (bulk) {
return fn.call(elems);
}
return len ? fn(elems[0], key) : emptyGet;
};
// Matches dashed string for camelizing
var rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g;
// Used by camelCase as callback to replace()
function fcamelCase(_all, letter) {
return letter.toUpperCase();
}
// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 15
// Microsoft forgot to hump their vendor prefix (#9572)
function camelCase(string) {
return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
}
var acceptData = function (owner) {
// Accepts only:
// - Node
// - Node.ELEMENT_NODE
// - Node.DOCUMENT_NODE
// - Object
// - Any
return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
};
function Data() {
this.expando = jQuery.expando + Data.uid++;
}
Data.uid = 1;
Data.prototype = {
cache: function (owner) {
// Check if the owner object already has a cache
var value = owner[this.expando];
// If not, create one
if (!value) {
value = {};
// We can accept data for non-element nodes in modern browsers,
// but we should not, see #8335.
// Always return an empty object.
if (acceptData(owner)) {
// If it is a node unlikely to be stringify-ed or looped over
// use plain assignment
if (owner.nodeType) {
owner[this.expando] = value;
// Otherwise secure it in a non-enumerable property
// configurable must be true to allow the property to be
// deleted when data is removed
} else {
Object.defineProperty(owner, this.expando, {
value: value,
configurable: true,
});
}
}
}
return value;
},
set: function (owner, data, value) {
var prop,
cache = this.cache(owner);
// Handle: [ owner, key, value ] args
// Always use camelCase key (gh-2257)
if (typeof data === "string") {
cache[camelCase(data)] = value;
// Handle: [ owner, { properties } ] args
} else {
// Copy the properties one-by-one to the cache object
for (prop in data) {
cache[camelCase(prop)] = data[prop];
}
}
return cache;
},
get: function (owner, key) {
return key === undefined
? this.cache(owner)
: // Always use camelCase key (gh-2257)
owner[this.expando] && owner[this.expando][camelCase(key)];
},
access: function (owner, key, value) {
// In cases where either:
//
// 1. No key was specified
// 2. A string key was specified, but no value provided
//
// Take the "read" path and allow the get method to determine
// which value to return, respectively either:
//
// 1. The entire cache object
// 2. The data stored at the key
//
if (
key === undefined ||
(key && typeof key === "string" && value === undefined)
) {
return this.get(owner, key);
}
// When the key is not a string, or both a key and value
// are specified, set or extend (existing objects) with either:
//
// 1. An object of properties
// 2. A key and value
//
this.set(owner, key, value);
// Since the "set" path can have two possible entry points
// return the expected data based on which path was taken[*]
return value !== undefined ? value : key;
},
remove: function (owner, key) {
var i,
cache = owner[this.expando];
if (cache === undefined) {
return;
}
if (key !== undefined) {
// Support array or space separated string of keys
if (Array.isArray(key)) {
// If key is an array of keys...
// We always set camelCase keys, so remove that.
key = key.map(camelCase);
} else {
key = camelCase(key);
// If a key with the spaces exists, use it.
// Otherwise, create an array by matching non-whitespace
key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
}
i = key.length;
while (i--) {
delete cache[key[i]];
}
}
// Remove the expando if there's no more data
if (key === undefined || jQuery.isEmptyObject(cache)) {
// Support: Chrome <=35 - 45
// Webkit & Blink performance suffers when deleting properties
// from DOM nodes, so set to undefined instead
// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
if (owner.nodeType) {
owner[this.expando] = undefined;
} else {
delete owner[this.expando];
}
}
},
hasData: function (owner) {
var cache = owner[this.expando];
return cache !== undefined && !jQuery.isEmptyObject(cache);
},
};
var dataPriv = new Data();
var dataUser = new Data();
// Implementation Summary
//
// 1. Enforce API surface and semantic compatibility with 1.9.x branch
// 2. Improve the module's maintainability by reducing the storage
// paths to a single mechanism.
// 3. Use the same single mechanism to support "private" and "user" data.
// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
// 5. Avoid exposing implementation details on user objects (eg. expando properties)
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
rmultiDash = /[A-Z]/g;
function getData(data) {
if (data === "true") {
return true;
}
if (data === "false") {
return false;
}
if (data === "null") {
return null;
}
// Only convert to a number if it doesn't change the string
if (data === +data + "") {
return +data;
}
if (rbrace.test(data)) {
return JSON.parse(data);
}
return data;
}
function dataAttr(elem, key, data) {
var name;
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if (data === undefined && elem.nodeType === 1) {
name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
data = elem.getAttribute(name);
if (typeof data === "string") {
try {
data = getData(data);
} catch (e) {}
// Make sure we set the data so it isn't changed later
dataUser.set(elem, key, data);
} else {
data = undefined;
}
}
return data;
}
jQuery.extend({
hasData: function (elem) {
return dataUser.hasData(elem) || dataPriv.hasData(elem);
},
data: function (elem, name, data) {
return dataUser.access(elem, name, data);
},
removeData: function (elem, name) {
dataUser.remove(elem, name);
},
// TODO: Now that all calls to _data and _removeData have been replaced
// with direct calls to dataPriv methods, these can be deprecated.
_data: function (elem, name, data) {
return dataPriv.access(elem, name, data);
},
_removeData: function (elem, name) {
dataPriv.remove(elem, name);
},
});
jQuery.fn.extend({
data: function (key, value) {
var i,
name,
data,
elem = this[0],
attrs = elem && elem.attributes;
// Gets all values
if (key === undefined) {
if (this.length) {
data = dataUser.get(elem);
if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
i = attrs.length;
while (i--) {
// Support: IE 11 only
// The attrs elements can be null (#14894)
if (attrs[i]) {
name = attrs[i].name;
if (name.indexOf("data-") === 0) {
name = camelCase(name.slice(5));
dataAttr(elem, name, data[name]);
}
}
}
dataPriv.set(elem, "hasDataAttrs", true);
}
}
return data;
}
// Sets multiple values
if (typeof key === "object") {
return this.each(function () {
dataUser.set(this, key);
});
}
return access(
this,
function (value) {
var data;
// The calling jQuery object (element matches) is not empty
// (and therefore has an element appears at this[ 0 ]) and the
// `value` parameter was not undefined. An empty jQuery object
// will result in `undefined` for elem = this[ 0 ] which will
// throw an exception if an attempt to read a data cache is made.
if (elem && value === undefined) {
// Attempt to get data from the cache
// The key will always be camelCased in Data
data = dataUser.get(elem, key);
if (data !== undefined) {
return data;
}
// Attempt to "discover" the data in
// HTML5 custom data-* attrs
data = dataAttr(elem, key);
if (data !== undefined) {
return data;
}
// We tried really hard, but the data doesn't exist.
return;
}
// Set the data...
this.each(function () {
// We always store the camelCased key
dataUser.set(this, key, value);
});
},
null,
value,
arguments.length > 1,
null,
true
);
},
removeData: function (key) {
return this.each(function () {
dataUser.remove(this, key);
});
},
});
jQuery.extend({
queue: function (elem, type, data) {
var queue;
if (elem) {
type = (type || "fx") + "queue";
queue = dataPriv.get(elem, type);
// Speed up dequeue by getting out quickly if this is just a lookup
if (data) {
if (!queue || Array.isArray(data)) {
queue = dataPriv.access(elem, type, jQuery.makeArray(data));
} else {
queue.push(data);
}
}
return queue || [];
}
},
dequeue: function (elem, type) {
type = type || "fx";
var queue = jQuery.queue(elem, type),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks(elem, type),
next = function () {
jQuery.dequeue(elem, type);
};
// If the fx queue is dequeued, always remove the progress sentinel
if (fn === "inprogress") {
fn = queue.shift();
startLength--;
}
if (fn) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if (type === "fx") {
queue.unshift("inprogress");
}
// Clear up the last queue stop function
delete hooks.stop;
fn.call(elem, next, hooks);
}
if (!startLength && hooks) {
hooks.empty.fire();
}
},
// Not public - generate a queueHooks object, or return the current one
_queueHooks: function (elem, type) {
var key = type + "queueHooks";
return (
dataPriv.get(elem, key) ||
dataPriv.access(elem, key, {
empty: jQuery.Callbacks("once memory").add(function () {
dataPriv.remove(elem, [type + "queue", key]);
}),
})
);
},
});
jQuery.fn.extend({
queue: function (type, data) {
var setter = 2;
if (typeof type !== "string") {
data = type;
type = "fx";
setter--;
}
if (arguments.length < setter) {
return jQuery.queue(this[0], type);
}
return data === undefined
? this
: this.each(function () {
var queue = jQuery.queue(this, type, data);
// Ensure a hooks for this queue
jQuery._queueHooks(this, type);
if (type === "fx" && queue[0] !== "inprogress") {
jQuery.dequeue(this, type);
}
});
},
dequeue: function (type) {
return this.each(function () {
jQuery.dequeue(this, type);
});
},
clearQueue: function (type) {
return this.queue(type || "fx", []);
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function (type, obj) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function () {
if (!--count) {
defer.resolveWith(elements, [elements]);
}
};
if (typeof type !== "string") {
obj = type;
type = undefined;
}
type = type || "fx";
while (i--) {
tmp = dataPriv.get(elements[i], type + "queueHooks");
if (tmp && tmp.empty) {
count++;
tmp.empty.add(resolve);
}
}
resolve();
return defer.promise(obj);
},
});
var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
var cssExpand = ["Top", "Right", "Bottom", "Left"];
var documentElement = document.documentElement;
var isAttached = function (elem) {
return jQuery.contains(elem.ownerDocument, elem);
},
composed = { composed: true };
// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
// Check attachment across shadow DOM boundaries when possible (gh-3504)
// Support: iOS 10.0-10.2 only
// Early iOS 10 versions support `attachShadow` but not `getRootNode`,
// leading to errors. We need to check for `getRootNode`.
if (documentElement.getRootNode) {
isAttached = function (elem) {
return (
jQuery.contains(elem.ownerDocument, elem) ||
elem.getRootNode(composed) === elem.ownerDocument
);
};
}
var isHiddenWithinTree = function (elem, el) {
// isHiddenWithinTree might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
// Inline style trumps all
return (
elem.style.display === "none" ||
(elem.style.display === "" &&
// Otherwise, check computed style
// Support: Firefox <=43 - 45
// Disconnected elements can have computed display: none, so first confirm that elem is
// in the document.
isAttached(elem) &&
jQuery.css(elem, "display") === "none")
);
};
function adjustCSS(elem, prop, valueParts, tween) {
var adjusted,
scale,
maxIterations = 20,
currentValue = tween
? function () {
return tween.cur();
}
: function () {
return jQuery.css(elem, prop, "");
},
initial = currentValue(),
unit =
(valueParts && valueParts[3]) || (jQuery.cssNumber[prop] ? "" : "px"),
// Starting value computation is required for potential unit mismatches
initialInUnit =
elem.nodeType &&
(jQuery.cssNumber[prop] || (unit !== "px" && +initial)) &&
rcssNum.exec(jQuery.css(elem, prop));
if (initialInUnit && initialInUnit[3] !== unit) {
// Support: Firefox <=54
// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
initial = initial / 2;
// Trust units reported by jQuery.css
unit = unit || initialInUnit[3];
// Iteratively approximate from a nonzero starting point
initialInUnit = +initial || 1;
while (maxIterations--) {
// Evaluate and update our best guess (doubling guesses that zero out).
// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
jQuery.style(elem, prop, initialInUnit + unit);
if (
(1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <=
0
) {
maxIterations = 0;
}
initialInUnit = initialInUnit / scale;
}
initialInUnit = initialInUnit * 2;
jQuery.style(elem, prop, initialInUnit + unit);
// Make sure we update the tween properties later on
valueParts = valueParts || [];
}
if (valueParts) {
initialInUnit = +initialInUnit || +initial || 0;
// Apply relative offset (+=/-=) if specified
adjusted = valueParts[1]
? initialInUnit + (valueParts[1] + 1) * valueParts[2]
: +valueParts[2];
if (tween) {
tween.unit = unit;
tween.start = initialInUnit;
tween.end = adjusted;
}
}
return adjusted;
}
var defaultDisplayMap = {};
function getDefaultDisplay(elem) {
var temp,
doc = elem.ownerDocument,
nodeName = elem.nodeName,
display = defaultDisplayMap[nodeName];
if (display) {
return display;
}
temp = doc.body.appendChild(doc.createElement(nodeName));
display = jQuery.css(temp, "display");
temp.parentNode.removeChild(temp);
if (display === "none") {
display = "block";
}
defaultDisplayMap[nodeName] = display;
return display;
}
function showHide(elements, show) {
var display,
elem,
values = [],
index = 0,
length = elements.length;
// Determine new display value for elements that need to change
for (; index < length; index++) {
elem = elements[index];
if (!elem.style) {
continue;
}
display = elem.style.display;
if (show) {
// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
// check is required in this first loop unless we have a nonempty display value (either
// inline or about-to-be-restored)
if (display === "none") {
values[index] = dataPriv.get(elem, "display") || null;
if (!values[index]) {
elem.style.display = "";
}
}
if (elem.style.display === "" && isHiddenWithinTree(elem)) {
values[index] = getDefaultDisplay(elem);
}
} else {
if (display !== "none") {
values[index] = "none";
// Remember what we're overwriting
dataPriv.set(elem, "display", display);
}
}
}
// Set the display of the elements in a second loop to avoid constant reflow
for (index = 0; index < length; index++) {
if (values[index] != null) {
elements[index].style.display = values[index];
}
}
return elements;
}
jQuery.fn.extend({
show: function () {
return showHide(this, true);
},
hide: function () {
return showHide(this);
},
toggle: function (state) {
if (typeof state === "boolean") {
return state ? this.show() : this.hide();
}
return this.each(function () {
if (isHiddenWithinTree(this)) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
},
});
var rcheckableType = /^(?:checkbox|radio)$/i;
var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i;
var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
(function () {
var fragment = document.createDocumentFragment(),
div = fragment.appendChild(document.createElement("div")),
input = document.createElement("input");
// Support: Android 4.0 - 4.3 only
// Check state lost if the name is set (#11217)
// Support: Windows Web Apps (WWA)
// `name` and `type` must use .setAttribute for WWA (#14901)
input.setAttribute("type", "radio");
input.setAttribute("checked", "checked");
input.setAttribute("name", "t");
div.appendChild(input);
// Support: Android <=4.1 only
// Older WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
// Support: IE <=11 only
// Make sure textarea (and checkbox) defaultValue is properly cloned
div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
// Support: IE <=9 only
// IE <=9 replaces <option> tags with their contents when inserted outside of
// the select element.
div.innerHTML = "<option></option>";
support.option = !!div.lastChild;
})();
// We have to close these tags to support XHTML (#13200)
var wrapMap = {
// XHTML parsers do not magically insert elements in the
// same way that tag soup parsers do. So we cannot shorten
// this by omitting <tbody> or other required elements.
thead: [1, "<table>", "</table>"],
col: [2, "<table><colgroup>", "</colgroup></table>"],
tr: [2, "<table><tbody>", "</tbody></table>"],
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
_default: [0, "", ""],
};
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption =
wrapMap.thead;
wrapMap.th = wrapMap.td;
// Support: IE <=9 only
if (!support.option) {
wrapMap.optgroup = wrapMap.option = [
1,
"<select multiple='multiple'>",
"</select>",
];
}
function getAll(context, tag) {
// Support: IE <=9 - 11 only
// Use typeof to avoid zero-argument method invocation on host objects (#15151)
var ret;
if (typeof context.getElementsByTagName !== "undefined") {
ret = context.getElementsByTagName(tag || "*");
} else if (typeof context.querySelectorAll !== "undefined") {
ret = context.querySelectorAll(tag || "*");
} else {
ret = [];
}
if (tag === undefined || (tag && nodeName(context, tag))) {
return jQuery.merge([context], ret);
}
return ret;
}
// Mark scripts as having already been evaluated
function setGlobalEval(elems, refElements) {
var i = 0,
l = elems.length;
for (; i < l; i++) {
dataPriv.set(
elems[i],
"globalEval",
!refElements || dataPriv.get(refElements[i], "globalEval")
);
}
}
var rhtml = /<|&#?\w+;/;
function buildFragment(elems, context, scripts, selection, ignored) {
var elem,
tmp,
tag,
wrap,
attached,
j,
fragment = context.createDocumentFragment(),
nodes = [],
i = 0,
l = elems.length;
for (; i < l; i++) {
elem = elems[i];
if (elem || elem === 0) {
// Add nodes directly
if (toType(elem) === "object") {
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
// Convert non-html into a text node
} else if (!rhtml.test(elem)) {
nodes.push(context.createTextNode(elem));
// Convert html into DOM nodes
} else {
tmp = tmp || fragment.appendChild(context.createElement("div"));
// Deserialize a standard representation
tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
wrap = wrapMap[tag] || wrapMap._default;
tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];
while (j--) {
tmp = tmp.lastChild;
}
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge(nodes, tmp.childNodes);
// Remember the top-level container
tmp = fragment.firstChild;
// Ensure the created nodes are orphaned (#12392)
tmp.textContent = "";
}
}
}
// Remove wrapper from fragment
fragment.textContent = "";
i = 0;
while ((elem = nodes[i++])) {
// Skip elements already in the context collection (trac-4087)
if (selection && jQuery.inArray(elem, selection) > -1) {
if (ignored) {
ignored.push(elem);
}
continue;
}
attached = isAttached(elem);
// Append to fragment
tmp = getAll(fragment.appendChild(elem), "script");
// Preserve script evaluation history
if (attached) {
setGlobalEval(tmp);
}
// Capture executables
if (scripts) {
j = 0;
while ((elem = tmp[j++])) {
if (rscriptType.test(elem.type || "")) {
scripts.push(elem);
}
}
}
}
return fragment;
}
var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
// Support: IE <=9 - 11+
// focus() and blur() are asynchronous, except when they are no-op.
// So expect focus to be synchronous when the element is already active,
// and blur to be synchronous when the element is not already active.
// (focus and blur are always synchronous in other supported browsers,
// this just defines when we can count on it).
function expectSync(elem, type) {
return (elem === safeActiveElement()) === (type === "focus");
}
// Support: IE <=9 only
// Accessing document.activeElement can throw unexpectedly
// https://bugs.jquery.com/ticket/13393
function safeActiveElement() {
try {
return document.activeElement;
} catch (err) {}
}
function on(elem, types, selector, data, fn, one) {
var origFn, type;
// Types can be a map of types/handlers
if (typeof types === "object") {
// ( types-Object, selector, data )
if (typeof selector !== "string") {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for (type in types) {
on(elem, type, selector, data, types[type], one);
}
return elem;
}
if (data == null && fn == null) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if (fn == null) {
if (typeof selector === "string") {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if (fn === false) {
fn = returnFalse;
} else if (!fn) {
return elem;
}
if (one === 1) {
origFn = fn;
fn = function (event) {
// Can use an empty set, since event contains the info
jQuery().off(event);
return origFn.apply(this, arguments);
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
}
return elem.each(function () {
jQuery.event.add(this, types, fn, data, selector);
});
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function (elem, types, handler, data, selector) {
var handleObjIn,
eventHandle,
tmp,
events,
t,
handleObj,
special,
handlers,
type,
namespaces,
origType,
elemData = dataPriv.get(elem);
// Only attach events to objects that accept data
if (!acceptData(elem)) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if (handler.handler) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Ensure that invalid selectors throw exceptions at attach time
// Evaluate against documentElement in case elem is a non-element node (e.g., document)
if (selector) {
jQuery.find.matchesSelector(documentElement, selector);
}
// Make sure that the handler has a unique ID, used to find/remove it later
if (!handler.guid) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if (!(events = elemData.events)) {
events = elemData.events = Object.create(null);
}
if (!(eventHandle = elemData.handle)) {
eventHandle = elemData.handle = function (e) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" &&
jQuery.event.triggered !== e.type
? jQuery.event.dispatch.apply(elem, arguments)
: undefined;
};
}
// Handle multiple events separated by a space
types = (types || "").match(rnothtmlwhite) || [""];
t = types.length;
while (t--) {
tmp = rtypenamespace.exec(types[t]) || [];
type = origType = tmp[1];
namespaces = (tmp[2] || "").split(".").sort();
// There *must* be a type, no attaching namespace-only handlers
if (!type) {
continue;
}
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[type] || {};
// If selector defined, determine special event api type, otherwise given type
type = (selector ? special.delegateType : special.bindType) || type;
// Update special based on newly reset type
special = jQuery.event.special[type] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend(
{
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext:
selector && jQuery.expr.match.needsContext.test(selector),
namespace: namespaces.join("."),
},
handleObjIn
);
// Init the event handler queue if we're the first
if (!(handlers = events[type])) {
handlers = events[type] = [];
handlers.delegateCount = 0;
// Only use addEventListener if the special events handler returns false
if (
!special.setup ||
special.setup.call(elem, data, namespaces, eventHandle) === false
) {
if (elem.addEventListener) {
elem.addEventListener(type, eventHandle);
}
}
}
if (special.add) {
special.add.call(elem, handleObj);
if (!handleObj.handler.guid) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if (selector) {
handlers.splice(handlers.delegateCount++, 0, handleObj);
} else {
handlers.push(handleObj);
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[type] = true;
}
},
// Detach an event or set of events from an element
remove: function (elem, types, handler, selector, mappedTypes) {
var j,
origCount,
tmp,
events,
t,
handleObj,
special,
handlers,
type,
namespaces,
origType,
elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
if (!elemData || !(events = elemData.events)) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = (types || "").match(rnothtmlwhite) || [""];
t = types.length;
while (t--) {
tmp = rtypenamespace.exec(types[t]) || [];
type = origType = tmp[1];
namespaces = (tmp[2] || "").split(".").sort();
// Unbind all events (on this namespace, if provided) for the element
if (!type) {
for (type in events) {
jQuery.event.remove(elem, type + types[t], handler, selector, true);
}
continue;
}
special = jQuery.event.special[type] || {};
type = (selector ? special.delegateType : special.bindType) || type;
handlers = events[type] || [];
tmp =
tmp[2] &&
new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
// Remove matching events
origCount = j = handlers.length;
while (j--) {
handleObj = handlers[j];
if (
(mappedTypes || origType === handleObj.origType) &&
(!handler || handler.guid === handleObj.guid) &&
(!tmp || tmp.test(handleObj.namespace)) &&
(!selector ||
selector === handleObj.selector ||
(selector === "**" && handleObj.selector))
) {
handlers.splice(j, 1);
if (handleObj.selector) {
handlers.delegateCount--;
}
if (special.remove) {
special.remove.call(elem, handleObj);
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if (origCount && !handlers.length) {
if (
!special.teardown ||
special.teardown.call(elem, namespaces, elemData.handle) === false
) {
jQuery.removeEvent(elem, type, elemData.handle);
}
delete events[type];
}
}
// Remove data and the expando if it's no longer used
if (jQuery.isEmptyObject(events)) {
dataPriv.remove(elem, "handle events");
}
},
dispatch: function (nativeEvent) {
var i,
j,
ret,
matched,
handleObj,
handlerQueue,
args = new Array(arguments.length),
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix(nativeEvent),
handlers =
(dataPriv.get(this, "events") || Object.create(null))[event.type] ||
[],
special = jQuery.event.special[event.type] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
for (i = 1; i < arguments.length; i++) {
args[i] = arguments[i];
}
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if (
special.preDispatch &&
special.preDispatch.call(this, event) === false
) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call(this, event, handlers);
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
event.currentTarget = matched.elem;
j = 0;
while (
(handleObj = matched.handlers[j++]) &&
!event.isImmediatePropagationStopped()
) {
// If the event is namespaced, then each handler is only invoked if it is
// specially universal or its namespaces are a superset of the event's.
if (
!event.rnamespace ||
handleObj.namespace === false ||
event.rnamespace.test(handleObj.namespace)
) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = (
(jQuery.event.special[handleObj.origType] || {}).handle ||
handleObj.handler
).apply(matched.elem, args);
if (ret !== undefined) {
if ((event.result = ret) === false) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if (special.postDispatch) {
special.postDispatch.call(this, event);
}
return event.result;
},
handlers: function (event, handlers) {
var i,
handleObj,
sel,
matchedHandlers,
matchedSelectors,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
if (
delegateCount &&
// Support: IE <=9
// Black-hole SVG <use> instance trees (trac-13180)
cur.nodeType &&
// Support: Firefox <=42
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
// Support: IE 11 only
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
!(event.type === "click" && event.button >= 1)
) {
for (; cur !== this; cur = cur.parentNode || this) {
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if (
cur.nodeType === 1 &&
!(event.type === "click" && cur.disabled === true)
) {
matchedHandlers = [];
matchedSelectors = {};
for (i = 0; i < delegateCount; i++) {
handleObj = handlers[i];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if (matchedSelectors[sel] === undefined) {
matchedSelectors[sel] = handleObj.needsContext
? jQuery(sel, this).index(cur) > -1
: jQuery.find(sel, this, null, [cur]).length;
}
if (matchedSelectors[sel]) {
matchedHandlers.push(handleObj);
}
}
if (matchedHandlers.length) {
handlerQueue.push({ elem: cur, handlers: matchedHandlers });
}
}
}
}
// Add the remaining (directly-bound) handlers
cur = this;
if (delegateCount < handlers.length) {
handlerQueue.push({
elem: cur,
handlers: handlers.slice(delegateCount),
});
}
return handlerQueue;
},
addProp: function (name, hook) {
Object.defineProperty(jQuery.Event.prototype, name, {
enumerable: true,
configurable: true,
get: isFunction(hook)
? function () {
if (this.originalEvent) {
return hook(this.originalEvent);
}
}
: function () {
if (this.originalEvent) {
return this.originalEvent[name];
}
},
set: function (value) {
Object.defineProperty(this, name, {
enumerable: true,
configurable: true,
writable: true,
value: value,
});
},
});
},
fix: function (originalEvent) {
return originalEvent[jQuery.expando]
? originalEvent
: new jQuery.Event(originalEvent);
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true,
},
click: {
// Utilize native event to ensure correct state for checkable inputs
setup: function (data) {
// For mutual compressibility with _default, replace `this` access with a local var.
// `|| data` is dead code meant only to preserve the variable through minification.
var el = this || data;
// Claim the first handler
if (
rcheckableType.test(el.type) &&
el.click &&
nodeName(el, "input")
) {
// dataPriv.set( el, "click", ... )
leverageNative(el, "click", returnTrue);
}
// Return false to allow normal processing in the caller
return false;
},
trigger: function (data) {
// For mutual compressibility with _default, replace `this` access with a local var.
// `|| data` is dead code meant only to preserve the variable through minification.
var el = this || data;
// Force setup before triggering a click
if (
rcheckableType.test(el.type) &&
el.click &&
nodeName(el, "input")
) {
leverageNative(el, "click");
}
// Return non-false to allow normal event-path propagation
return true;
},
// For cross-browser consistency, suppress native .click() on links
// Also prevent it if we're currently inside a leveraged native-event stack
_default: function (event) {
var target = event.target;
return (
(rcheckableType.test(target.type) &&
target.click &&
nodeName(target, "input") &&
dataPriv.get(target, "click")) ||
nodeName(target, "a")
);
},
},
beforeunload: {
postDispatch: function (event) {
// Support: Firefox 20+
// Firefox doesn't alert if the returnValue field is not set.
if (event.result !== undefined && event.originalEvent) {
event.originalEvent.returnValue = event.result;
}
},
},
},
};
// Ensure the presence of an event listener that handles manually-triggered
// synthetic events by interrupting progress until reinvoked in response to
// *native* events that it fires directly, ensuring that state changes have
// already occurred before other listeners are invoked.
function leverageNative(el, type, expectSync) {
// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
if (!expectSync) {
if (dataPriv.get(el, type) === undefined) {
jQuery.event.add(el, type, returnTrue);
}
return;
}
// Register the controller as a special universal handler for all event namespaces
dataPriv.set(el, type, false);
jQuery.event.add(el, type, {
namespace: false,
handler: function (event) {
var notAsync,
result,
saved = dataPriv.get(this, type);
if (event.isTrigger & 1 && this[type]) {
// Interrupt processing of the outer synthetic .trigger()ed event
// Saved data should be false in such cases, but might be a leftover capture object
// from an async native handler (gh-4350)
if (!saved.length) {
// Store arguments for use when handling the inner native event
// There will always be at least one argument (an event object), so this array
// will not be confused with a leftover capture object.
saved = slice.call(arguments);
dataPriv.set(this, type, saved);
// Trigger the native event and capture its result
// Support: IE <=9 - 11+
// focus() and blur() are asynchronous
notAsync = expectSync(this, type);
this[type]();
result = dataPriv.get(this, type);
if (saved !== result || notAsync) {
dataPriv.set(this, type, false);
} else {
result = {};
}
if (saved !== result) {
// Cancel the outer synthetic event
event.stopImmediatePropagation();
event.preventDefault();
// Support: Chrome 86+
// In Chrome, if an element having a focusout handler is blurred by
// clicking outside of it, it invokes the handler synchronously. If
// that handler calls `.remove()` on the element, the data is cleared,
// leaving `result` undefined. We need to guard against this.
return result && result.value;
}
// If this is an inner synthetic event for an event with a bubbling surrogate
// (focus or blur), assume that the surrogate already propagated from triggering the
// native event and prevent that from happening again here.
// This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
// bubbling surrogate propagates *after* the non-bubbling base), but that seems
// less bad than duplication.
} else if ((jQuery.event.special[type] || {}).delegateType) {
event.stopPropagation();
}
// If this is a native event triggered above, everything is now in order
// Fire an inner synthetic event with the original arguments
} else if (saved.length) {
// ...and capture the result
dataPriv.set(this, type, {
value: jQuery.event.trigger(
// Support: IE <=9 - 11+
// Extend with the prototype to reset the above stopImmediatePropagation()
jQuery.extend(saved[0], jQuery.Event.prototype),
saved.slice(1),
this
),
});
// Abort handling of the native event
event.stopImmediatePropagation();
}
},
});
}
jQuery.removeEvent = function (elem, type, handle) {
// This "if" is needed for plain objects
if (elem.removeEventListener) {
elem.removeEventListener(type, handle);
}
};
jQuery.Event = function (src, props) {
// Allow instantiation without the 'new' keyword
if (!(this instanceof jQuery.Event)) {
return new jQuery.Event(src, props);
}
// Event object
if (src && src.type) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented =
src.defaultPrevented ||
(src.defaultPrevented === undefined &&
// Support: Android <=2.3 only
src.returnValue === false)
? returnTrue
: returnFalse;
// Create target properties
// Support: Safari <=6 - 7 only
// Target should not be a text node (#504, #13143)
this.target =
src.target && src.target.nodeType === 3
? src.target.parentNode
: src.target;
this.currentTarget = src.currentTarget;
this.relatedTarget = src.relatedTarget;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if (props) {
jQuery.extend(this, props);
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = (src && src.timeStamp) || Date.now();
// Mark it as fixed
this[jQuery.expando] = true;
};
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
constructor: jQuery.Event,
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
isSimulated: false,
preventDefault: function () {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if (e && !this.isSimulated) {
e.preventDefault();
}
},
stopPropagation: function () {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if (e && !this.isSimulated) {
e.stopPropagation();
}
},
stopImmediatePropagation: function () {
var e = this.originalEvent;
this.isImmediatePropagationStopped = returnTrue;
if (e && !this.isSimulated) {
e.stopImmediatePropagation();
}
this.stopPropagation();
},
};
// Includes all common event props including KeyEvent and MouseEvent specific props
jQuery.each(
{
altKey: true,
bubbles: true,
cancelable: true,
changedTouches: true,
ctrlKey: true,
detail: true,
eventPhase: true,
metaKey: true,
pageX: true,
pageY: true,
shiftKey: true,
view: true,
char: true,
code: true,
charCode: true,
key: true,
keyCode: true,
button: true,
buttons: true,
clientX: true,
clientY: true,
offsetX: true,
offsetY: true,
pointerId: true,
pointerType: true,
screenX: true,
screenY: true,
targetTouches: true,
toElement: true,
touches: true,
which: true,
},
jQuery.event.addProp
);
jQuery.each({ focus: "focusin", blur: "focusout" }, function (
type,
delegateType
) {
jQuery.event.special[type] = {
// Utilize native event if possible so blur/focus sequence is correct
setup: function () {
// Claim the first handler
// dataPriv.set( this, "focus", ... )
// dataPriv.set( this, "blur", ... )
leverageNative(this, type, expectSync);
// Return false to allow normal processing in the caller
return false;
},
trigger: function () {
// Force setup before trigger
leverageNative(this, type);
// Return non-false to allow normal event-path propagation
return true;
},
// Suppress native focus or blur as it's already being fired
// in leverageNative.
_default: function () {
return true;
},
delegateType: delegateType,
};
});
// Create mouseenter/leave events using mouseover/out and event-time checks
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
//
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
jQuery.each(
{
mouseenter: "mouseover",
mouseleave: "mouseout",
pointerenter: "pointerover",
pointerleave: "pointerout",
},
function (orig, fix) {
jQuery.event.special[orig] = {
delegateType: fix,
bindType: fix,
handle: function (event) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mouseenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if (
!related ||
(related !== target && !jQuery.contains(target, related))
) {
event.type = handleObj.origType;
ret = handleObj.handler.apply(this, arguments);
event.type = fix;
}
return ret;
},
};
}
);
jQuery.fn.extend({
on: function (types, selector, data, fn) {
return on(this, types, selector, data, fn);
},
one: function (types, selector, data, fn) {
return on(this, types, selector, data, fn, 1);
},
off: function (types, selector, fn) {
var handleObj, type;
if (types && types.preventDefault && types.handleObj) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery(types.delegateTarget).off(
handleObj.namespace
? handleObj.origType + "." + handleObj.namespace
: handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if (typeof types === "object") {
// ( types-object [, selector] )
for (type in types) {
this.off(type, selector, types[type]);
}
return this;
}
if (selector === false || typeof selector === "function") {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if (fn === false) {
fn = returnFalse;
}
return this.each(function () {
jQuery.event.remove(this, types, fn, selector);
});
},
});
var // Support: IE <=10 - 11, Edge 12 - 13 only
// In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
rnoInnerhtml = /<script|<style|<link/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
// Prefer a tbody over its parent table for containing new rows
function manipulationTarget(elem, content) {
if (
nodeName(elem, "table") &&
nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")
) {
return jQuery(elem).children("tbody")[0] || elem;
}
return elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript(elem) {
elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
return elem;
}
function restoreScript(elem) {
if ((elem.type || "").slice(0, 5) === "true/") {
elem.type = elem.type.slice(5);
} else {
elem.removeAttribute("type");
}
return elem;
}
function cloneCopyEvent(src, dest) {
var i, l, type, pdataOld, udataOld, udataCur, events;
if (dest.nodeType !== 1) {
return;
}
// 1. Copy private data: events, handlers, etc.
if (dataPriv.hasData(src)) {
pdataOld = dataPriv.get(src);
events = pdataOld.events;
if (events) {
dataPriv.remove(dest, "handle events");
for (type in events) {
for (i = 0, l = events[type].length; i < l; i++) {
jQuery.event.add(dest, type, events[type][i]);
}
}
}
}
// 2. Copy user data
if (dataUser.hasData(src)) {
udataOld = dataUser.access(src);
udataCur = jQuery.extend({}, udataOld);
dataUser.set(dest, udataCur);
}
}
// Fix IE bugs, see support tests
function fixInput(src, dest) {
var nodeName = dest.nodeName.toLowerCase();
// Fails to persist the checked state of a cloned checkbox or radio button.
if (nodeName === "input" && rcheckableType.test(src.type)) {
dest.checked = src.checked;
// Fails to return the selected option to the default selected state when cloning options
} else if (nodeName === "input" || nodeName === "textarea") {
dest.defaultValue = src.defaultValue;
}
}
function domManip(collection, args, callback, ignored) {
// Flatten any nested arrays
args = flat(args);
var fragment,
first,
scripts,
hasScripts,
node,
doc,
i = 0,
l = collection.length,
iNoClone = l - 1,
value = args[0],
valueIsFunction = isFunction(value);
// We can't cloneNode fragments that contain checked, in WebKit
if (
valueIsFunction ||
(l > 1 &&
typeof value === "string" &&
!support.checkClone &&
rchecked.test(value))
) {
return collection.each(function (index) {
var self = collection.eq(index);
if (valueIsFunction) {
args[0] = value.call(this, index, self.html());
}
domManip(self, args, callback, ignored);
});
}
if (l) {
fragment = buildFragment(
args,
collection[0].ownerDocument,
false,
collection,
ignored
);
first = fragment.firstChild;
if (fragment.childNodes.length === 1) {
fragment = first;
}
// Require either new content or an interest in ignored elements to invoke the callback
if (first || ignored) {
scripts = jQuery.map(getAll(fragment, "script"), disableScript);
hasScripts = scripts.length;
// Use the original fragment for the last item
// instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for (; i < l; i++) {
node = fragment;
if (i !== iNoClone) {
node = jQuery.clone(node, true, true);
// Keep references to cloned scripts for later restoration
if (hasScripts) {
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge(scripts, getAll(node, "script"));
}
}
callback.call(collection[i], node, i);
}
if (hasScripts) {
doc = scripts[scripts.length - 1].ownerDocument;
// Reenable scripts
jQuery.map(scripts, restoreScript);
// Evaluate executable scripts on first document insertion
for (i = 0; i < hasScripts; i++) {
node = scripts[i];
if (
rscriptType.test(node.type || "") &&
!dataPriv.access(node, "globalEval") &&
jQuery.contains(doc, node)
) {
if (node.src && (node.type || "").toLowerCase() !== "module") {
// Optional AJAX dependency, but won't run scripts if not present
if (jQuery._evalUrl && !node.noModule) {
jQuery._evalUrl(
node.src,
{
nonce: node.nonce || node.getAttribute("nonce"),
},
doc
);
}
} else {
DOMEval(node.textContent.replace(rcleanScript, ""), node, doc);
}
}
}
}
}
}
return collection;
}
function remove(elem, selector, keepData) {
var node,
nodes = selector ? jQuery.filter(selector, elem) : elem,
i = 0;
for (; (node = nodes[i]) != null; i++) {
if (!keepData && node.nodeType === 1) {
jQuery.cleanData(getAll(node));
}
if (node.parentNode) {
if (keepData && isAttached(node)) {
setGlobalEval(getAll(node, "script"));
}
node.parentNode.removeChild(node);
}
}
return elem;
}
jQuery.extend({
htmlPrefilter: function (html) {
return html;
},
clone: function (elem, dataAndEvents, deepDataAndEvents) {
var i,
l,
srcElements,
destElements,
clone = elem.cloneNode(true),
inPage = isAttached(elem);
// Fix IE cloning issues
if (
!support.noCloneChecked &&
(elem.nodeType === 1 || elem.nodeType === 11) &&
!jQuery.isXMLDoc(elem)
) {
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
destElements = getAll(clone);
srcElements = getAll(elem);
for (i = 0, l = srcElements.length; i < l; i++) {
fixInput(srcElements[i], destElements[i]);
}
}
// Copy the events from the original to the clone
if (dataAndEvents) {
if (deepDataAndEvents) {
srcElements = srcElements || getAll(elem);
destElements = destElements || getAll(clone);
for (i = 0, l = srcElements.length; i < l; i++) {
cloneCopyEvent(srcElements[i], destElements[i]);
}
} else {
cloneCopyEvent(elem, clone);
}
}
// Preserve script evaluation history
destElements = getAll(clone, "script");
if (destElements.length > 0) {
setGlobalEval(destElements, !inPage && getAll(elem, "script"));
}
// Return the cloned set
return clone;
},
cleanData: function (elems) {
var data,
elem,
type,
special = jQuery.event.special,
i = 0;
for (; (elem = elems[i]) !== undefined; i++) {
if (acceptData(elem)) {
if ((data = elem[dataPriv.expando])) {
if (data.events) {
for (type in data.events) {
if (special[type]) {
jQuery.event.remove(elem, type);
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent(elem, type, data.handle);
}
}
}
// Support: Chrome <=35 - 45+
// Assign undefined instead of using delete, see Data#remove
elem[dataPriv.expando] = undefined;
}
if (elem[dataUser.expando]) {
// Support: Chrome <=35 - 45+
// Assign undefined instead of using delete, see Data#remove
elem[dataUser.expando] = undefined;
}
}
}
},
});
jQuery.fn.extend({
detach: function (selector) {
return remove(this, selector, true);
},
remove: function (selector) {
return remove(this, selector);
},
text: function (value) {
return access(
this,
function (value) {
return value === undefined
? jQuery.text(this)
: this.empty().each(function () {
if (
this.nodeType === 1 ||
this.nodeType === 11 ||
this.nodeType === 9
) {
this.textContent = value;
}
});
},
null,
value,
arguments.length
);
},
append: function () {
return domManip(this, arguments, function (elem) {
if (
this.nodeType === 1 ||
this.nodeType === 11 ||
this.nodeType === 9
) {
var target = manipulationTarget(this, elem);
target.appendChild(elem);
}
});
},
prepend: function () {
return domManip(this, arguments, function (elem) {
if (
this.nodeType === 1 ||
this.nodeType === 11 ||
this.nodeType === 9
) {
var target = manipulationTarget(this, elem);
target.insertBefore(elem, target.firstChild);
}
});
},
before: function () {
return domManip(this, arguments, function (elem) {
if (this.parentNode) {
this.parentNode.insertBefore(elem, this);
}
});
},
after: function () {
return domManip(this, arguments, function (elem) {
if (this.parentNode) {
this.parentNode.insertBefore(elem, this.nextSibling);
}
});
},
empty: function () {
var elem,
i = 0;
for (; (elem = this[i]) != null; i++) {
if (elem.nodeType === 1) {
// Prevent memory leaks
jQuery.cleanData(getAll(elem, false));
// Remove any remaining nodes
elem.textContent = "";
}
}
return this;
},
clone: function (dataAndEvents, deepDataAndEvents) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents =
deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map(function () {
return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
});
},
html: function (value) {
return access(
this,
function (value) {
var elem = this[0] || {},
i = 0,
l = this.length;
if (value === undefined && elem.nodeType === 1) {
return elem.innerHTML;
}
// See if we can take a shortcut and just use innerHTML
if (
typeof value === "string" &&
!rnoInnerhtml.test(value) &&
!wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]
) {
value = jQuery.htmlPrefilter(value);
try {
for (; i < l; i++) {
elem = this[i] || {};
// Remove element nodes and prevent memory leaks
if (elem.nodeType === 1) {
jQuery.cleanData(getAll(elem, false));
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch (e) {}
}
if (elem) {
this.empty().append(value);
}
},
null,
value,
arguments.length
);
},
replaceWith: function () {
var ignored = [];
// Make the changes, replacing each non-ignored context element with the new content
return domManip(
this,
arguments,
function (elem) {
var parent = this.parentNode;
if (jQuery.inArray(this, ignored) < 0) {
jQuery.cleanData(getAll(this));
if (parent) {
parent.replaceChild(elem, this);
}
}
// Force callback invocation
},
ignored
);
},
});
jQuery.each(
{
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith",
},
function (name, original) {
jQuery.fn[name] = function (selector) {
var elems,
ret = [],
insert = jQuery(selector),
last = insert.length - 1,
i = 0;
for (; i <= last; i++) {
elems = i === last ? this : this.clone(true);
jQuery(insert[i])[original](elems);
// Support: Android <=4.0 only, PhantomJS 1 only
// .get() because push.apply(_, arraylike) throws on ancient WebKit
push.apply(ret, elems.get());
}
return this.pushStack(ret);
};
}
);
var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
var getStyles = function (elem) {
// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
// IE throws on elements created in popups
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
var view = elem.ownerDocument.defaultView;
if (!view || !view.opener) {
view = window;
}
return view.getComputedStyle(elem);
};
var swap = function (elem, options, callback) {
var ret,
name,
old = {};
// Remember the old values, and insert the new ones
for (name in options) {
old[name] = elem.style[name];
elem.style[name] = options[name];
}
ret = callback.call(elem);
// Revert the old values
for (name in options) {
elem.style[name] = old[name];
}
return ret;
};
var rboxStyle = new RegExp(cssExpand.join("|"), "i");
(function () {
// Executing both pixelPosition & boxSizingReliable tests require only one layout
// so they're executed at the same time to save the second computation.
function computeStyleTests() {
// This is a singleton, we need to execute it only once
if (!div) {
return;
}
container.style.cssText =
"position:absolute;left:-11111px;width:60px;" +
"margin-top:1px;padding:0;border:0";
div.style.cssText =
"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
"margin:auto;border:1px;padding:1px;" +
"width:60%;top:1%";
documentElement.appendChild(container).appendChild(div);
var divStyle = window.getComputedStyle(div);
pixelPositionVal = divStyle.top !== "1%";
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
// Some styles come back with percentage values, even though they shouldn't
div.style.right = "60%";
pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
// Support: IE 9 - 11 only
// Detect misreporting of content dimensions for box-sizing:border-box elements
boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
// Support: IE 9 only
// Detect overflow:scroll screwiness (gh-3699)
// Support: Chrome <=64
// Don't get tricked when zoom affects offsetWidth (gh-4029)
div.style.position = "absolute";
scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;
documentElement.removeChild(container);
// Nullify the div so it wouldn't be stored in the memory and
// it will also be a sign that checks already performed
div = null;
}
function roundPixelMeasures(measure) {
return Math.round(parseFloat(measure));
}
var pixelPositionVal,
boxSizingReliableVal,
scrollboxSizeVal,
pixelBoxStylesVal,
reliableTrDimensionsVal,
reliableMarginLeftVal,
container = document.createElement("div"),
div = document.createElement("div");
// Finish early in limited (non-browser) environments
if (!div.style) {
return;
}
// Support: IE <=9 - 11 only
// Style of cloned element affects source element cloned (#8908)
div.style.backgroundClip = "content-box";
div.cloneNode(true).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
jQuery.extend(support, {
boxSizingReliable: function () {
computeStyleTests();
return boxSizingReliableVal;
},
pixelBoxStyles: function () {
computeStyleTests();
return pixelBoxStylesVal;
},
pixelPosition: function () {
computeStyleTests();
return pixelPositionVal;
},
reliableMarginLeft: function () {
computeStyleTests();
return reliableMarginLeftVal;
},
scrollboxSize: function () {
computeStyleTests();
return scrollboxSizeVal;
},
// Support: IE 9 - 11+, Edge 15 - 18+
// IE/Edge misreport `getComputedStyle` of table rows with width/height
// set in CSS while `offset*` properties report correct values.
// Behavior in IE 9 is more subtle than in newer versions & it passes
// some versions of this test; make sure not to make it pass there!
//
// Support: Firefox 70+
// Only Firefox includes border widths
// in computed dimensions. (gh-4529)
reliableTrDimensions: function () {
var table, tr, trChild, trStyle;
if (reliableTrDimensionsVal == null) {
table = document.createElement("table");
tr = document.createElement("tr");
trChild = document.createElement("div");
table.style.cssText =
"position:absolute;left:-11111px;border-collapse:separate";
tr.style.cssText = "border:1px solid";
// Support: Chrome 86+
// Height set through cssText does not get applied.
// Computed height then comes back as 0.
tr.style.height = "1px";
trChild.style.height = "9px";
// Support: Android 8 Chrome 86+
// In our bodyBackground.html iframe,
// display for all div elements is set to "inline",
// which causes a problem only in Android 8 Chrome 86.
// Ensuring the div is display: block
// gets around this issue.
trChild.style.display = "block";
documentElement
.appendChild(table)
.appendChild(tr)
.appendChild(trChild);
trStyle = window.getComputedStyle(tr);
reliableTrDimensionsVal =
parseInt(trStyle.height, 10) +
parseInt(trStyle.borderTopWidth, 10) +
parseInt(trStyle.borderBottomWidth, 10) ===
tr.offsetHeight;
documentElement.removeChild(table);
}
return reliableTrDimensionsVal;
},
});
})();
function curCSS(elem, name, computed) {
var width,
minWidth,
maxWidth,
ret,
// Support: Firefox 51+
// Retrieving style before computed somehow
// fixes an issue with getting wrong values
// on detached elements
style = elem.style;
computed = computed || getStyles(elem);
// getPropertyValue is needed for:
// .css('filter') (IE 9 only, #12537)
// .css('--customProperty) (#3144)
if (computed) {
ret = computed.getPropertyValue(name) || computed[name];
if (ret === "" && !isAttached(elem)) {
ret = jQuery.style(elem, name);
}
// A tribute to the "awesome hack by Dean Edwards"
// Android Browser returns percentage for some values,
// but width seems to be reliably pixels.
// This is against the CSSOM draft spec:
// https://drafts.csswg.org/cssom/#resolved-values
if (
!support.pixelBoxStyles() &&
rnumnonpx.test(ret) &&
rboxStyle.test(name)
) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret !== undefined
? // Support: IE <=9 - 11 only
// IE returns zIndex value as an integer.
ret + ""
: ret;
}
function addGetHookIf(conditionFn, hookFn) {
// Define the hook, we'll check on the first run if it's really needed.
return {
get: function () {
if (conditionFn()) {
// Hook not needed (or it's not possible to use it due
// to missing dependency), remove it.
delete this.get;
return;
}
// Hook needed; redefine it so that the support test is not executed again.
return (this.get = hookFn).apply(this, arguments);
},
};
}
var cssPrefixes = ["Webkit", "Moz", "ms"],
emptyStyle = document.createElement("div").style,
vendorProps = {};
// Return a vendor-prefixed property or undefined
function vendorPropName(name) {
// Check for vendor prefixed names
var capName = name[0].toUpperCase() + name.slice(1),
i = cssPrefixes.length;
while (i--) {
name = cssPrefixes[i] + capName;
if (name in emptyStyle) {
return name;
}
}
}
// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
function finalPropName(name) {
var final = jQuery.cssProps[name] || vendorProps[name];
if (final) {
return final;
}
if (name in emptyStyle) {
return name;
}
return (vendorProps[name] = vendorPropName(name) || name);
}
var // Swappable if display is none or starts with table
// except "table", "table-cell", or "table-caption"
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rcustomProp = /^--/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: "0",
fontWeight: "400",
};
function setPositiveNumber(_elem, value, subtract) {
// Any relative (+/-) values have already been
// normalized at this point
var matches = rcssNum.exec(value);
return matches
? // Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px")
: value;
}
function boxModelAdjustment(
elem,
dimension,
box,
isBorderBox,
styles,
computedVal
) {
var i = dimension === "width" ? 1 : 0,
extra = 0,
delta = 0;
// Adjustment may not be necessary
if (box === (isBorderBox ? "border" : "content")) {
return 0;
}
for (; i < 4; i += 2) {
// Both box models exclude margin
if (box === "margin") {
delta += jQuery.css(elem, box + cssExpand[i], true, styles);
}
// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
if (!isBorderBox) {
// Add padding
delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
// For "border" or "margin", add border
if (box !== "padding") {
delta += jQuery.css(
elem,
"border" + cssExpand[i] + "Width",
true,
styles
);
// But still keep track of it otherwise
} else {
extra += jQuery.css(
elem,
"border" + cssExpand[i] + "Width",
true,
styles
);
}
// If we get here with a border-box (content + padding + border), we're seeking "content" or
// "padding" or "margin"
} else {
// For "content", subtract padding
if (box === "content") {
delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
}
// For "content" or "padding", subtract border
if (box !== "margin") {
delta -= jQuery.css(
elem,
"border" + cssExpand[i] + "Width",
true,
styles
);
}
}
}
// Account for positive content-box scroll gutter when requested by providing computedVal
if (!isBorderBox && computedVal >= 0) {
// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
// Assuming integer scroll gutter, subtract the rest and round down
delta +=
Math.max(
0,
Math.ceil(
elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] -
computedVal -
delta -
extra -
0.5
// If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
// Use an explicit zero to avoid NaN (gh-3964)
)
) || 0;
}
return delta;
}
function getWidthOrHeight(elem, dimension, extra) {
// Start with computed style
var styles = getStyles(elem),
// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
// Fake content-box until we know it's needed to know the true value.
boxSizingNeeded = !support.boxSizingReliable() || extra,
isBorderBox =
boxSizingNeeded &&
jQuery.css(elem, "boxSizing", false, styles) === "border-box",
valueIsBorderBox = isBorderBox,
val = curCSS(elem, dimension, styles),
offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1);
// Support: Firefox <=54
// Return a confounding non-pixel value or feign ignorance, as appropriate.
if (rnumnonpx.test(val)) {
if (!extra) {
return val;
}
val = "auto";
}
// Support: IE 9 - 11 only
// Use offsetWidth/offsetHeight for when box sizing is unreliable.
// In those cases, the computed value can be trusted to be border-box.
if (
((!support.boxSizingReliable() && isBorderBox) ||
// Support: IE 10 - 11+, Edge 15 - 18+
// IE/Edge misreport `getComputedStyle` of table rows with width/height
// set in CSS while `offset*` properties report correct values.
// Interestingly, in some cases IE 9 doesn't suffer from this issue.
(!support.reliableTrDimensions() && nodeName(elem, "tr")) ||
// Fall back to offsetWidth/offsetHeight when value is "auto"
// This happens for inline elements with no explicit setting (gh-3571)
val === "auto" ||
// Support: Android <=4.1 - 4.3 only
// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
(!parseFloat(val) &&
jQuery.css(elem, "display", false, styles) === "inline")) &&
// Make sure the element is visible & connected
elem.getClientRects().length
) {
isBorderBox =
jQuery.css(elem, "boxSizing", false, styles) === "border-box";
// Where available, offsetWidth/offsetHeight approximate border box dimensions.
// Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
// retrieved value as a content box dimension.
valueIsBorderBox = offsetProp in elem;
if (valueIsBorderBox) {
val = elem[offsetProp];
}
}
// Normalize "" and auto
val = parseFloat(val) || 0;
// Adjust for the element's box model
return (
val +
boxModelAdjustment(
elem,
dimension,
extra || (isBorderBox ? "border" : "content"),
valueIsBorderBox,
styles,
// Provide the current computed size to request scroll gutter calculation (gh-3589)
val
) +
"px"
);
}
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function (elem, computed) {
if (computed) {
// We should always get a number back from opacity
var ret = curCSS(elem, "opacity");
return ret === "" ? "1" : ret;
}
},
},
},
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
animationIterationCount: true,
columnCount: true,
fillOpacity: true,
flexGrow: true,
flexShrink: true,
fontWeight: true,
gridArea: true,
gridColumn: true,
gridColumnEnd: true,
gridColumnStart: true,
gridRow: true,
gridRowEnd: true,
gridRowStart: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
widows: true,
zIndex: true,
zoom: true,
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {},
// Get and set the style property on a DOM Node
style: function (elem, name, value, extra) {
// Don't set styles on text and comment nodes
if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
return;
}
// Make sure that we're working with the right name
var ret,
type,
hooks,
origName = camelCase(name),
isCustomProp = rcustomProp.test(name),
style = elem.style;
// Make sure that we're working with the right name. We don't
// want to query the value if it is a CSS custom property
// since they are user-defined.
if (!isCustomProp) {
name = finalPropName(origName);
}
// Gets hook for the prefixed version, then unprefixed version
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
// Check if we're setting a value
if (value !== undefined) {
type = typeof value;
// Convert "+=" or "-=" to relative numbers (#7345)
if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
value = adjustCSS(elem, name, ret);
// Fixes bug #9237
type = "number";
}
// Make sure that null and NaN values aren't set (#7116)
if (value == null || value !== value) {
return;
}
// If a number was passed in, add the unit (except for certain CSS properties)
// The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
// "px" to a few hardcoded values.
if (type === "number" && !isCustomProp) {
value += (ret && ret[3]) || (jQuery.cssNumber[origName] ? "" : "px");
}
// background-* props affect original clone's values
if (
!support.clearCloneStyle &&
value === "" &&
name.indexOf("background") === 0
) {
style[name] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if (
!hooks ||
!("set" in hooks) ||
(value = hooks.set(elem, value, extra)) !== undefined
) {
if (isCustomProp) {
style.setProperty(name, value);
} else {
style[name] = value;
}
}
} else {
// If a hook was provided get the non-computed value from there
if (
hooks &&
"get" in hooks &&
(ret = hooks.get(elem, false, extra)) !== undefined
) {
return ret;
}
// Otherwise just get the value from the style object
return style[name];
}
},
css: function (elem, name, extra, styles) {
var val,
num,
hooks,
origName = camelCase(name),
isCustomProp = rcustomProp.test(name);
// Make sure that we're working with the right name. We don't
// want to modify the value if it is a CSS custom property
// since they are user-defined.
if (!isCustomProp) {
name = finalPropName(origName);
}
// Try prefixed name followed by the unprefixed name
hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
// If a hook was provided get the computed value from there
if (hooks && "get" in hooks) {
val = hooks.get(elem, true, extra);
}
// Otherwise, if a way to get the computed value exists, use that
if (val === undefined) {
val = curCSS(elem, name, styles);
}
// Convert "normal" to computed value
if (val === "normal" && name in cssNormalTransform) {
val = cssNormalTransform[name];
}
// Make numeric if forced or a qualifier was provided and val looks numeric
if (extra === "" || extra) {
num = parseFloat(val);
return extra === true || isFinite(num) ? num || 0 : val;
}
return val;
},
});
jQuery.each(["height", "width"], function (_i, dimension) {
jQuery.cssHooks[dimension] = {
get: function (elem, computed, extra) {
if (computed) {
// Certain elements can have dimension info if we invisibly show them
// but it must have a current display style that would benefit
return rdisplayswap.test(jQuery.css(elem, "display")) &&
// Support: Safari 8+
// Table columns in Safari have non-zero offsetWidth & zero
// getBoundingClientRect().width unless display is changed.
// Support: IE <=11 only
// Running getBoundingClientRect on a disconnected node
// in IE throws an error.
(!elem.getClientRects().length ||
!elem.getBoundingClientRect().width)
? swap(elem, cssShow, function () {
return getWidthOrHeight(elem, dimension, extra);
})
: getWidthOrHeight(elem, dimension, extra);
}
},
set: function (elem, value, extra) {
var matches,
styles = getStyles(elem),
// Only read styles.position if the test has a chance to fail
// to avoid forcing a reflow.
scrollboxSizeBuggy =
!support.scrollboxSize() && styles.position === "absolute",
// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
boxSizingNeeded = scrollboxSizeBuggy || extra,
isBorderBox =
boxSizingNeeded &&
jQuery.css(elem, "boxSizing", false, styles) === "border-box",
subtract = extra
? boxModelAdjustment(elem, dimension, extra, isBorderBox, styles)
: 0;
// Account for unreliable border-box dimensions by comparing offset* to computed and
// faking a content-box to get border and padding (gh-3699)
if (isBorderBox && scrollboxSizeBuggy) {
subtract -= Math.ceil(
elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] -
parseFloat(styles[dimension]) -
boxModelAdjustment(elem, dimension, "border", false, styles) -
0.5
);
}
// Convert to pixels if value adjustment is needed
if (
subtract &&
(matches = rcssNum.exec(value)) &&
(matches[3] || "px") !== "px"
) {
elem.style[dimension] = value;
value = jQuery.css(elem, dimension);
}
return setPositiveNumber(elem, value, subtract);
},
};
});
jQuery.cssHooks.marginLeft = addGetHookIf(
support.reliableMarginLeft,
function (elem, computed) {
if (computed) {
return (
(parseFloat(curCSS(elem, "marginLeft")) ||
elem.getBoundingClientRect().left -
swap(elem, { marginLeft: 0 }, function () {
return elem.getBoundingClientRect().left;
})) + "px"
);
}
}
);
// These hooks are used by animate to expand properties
jQuery.each(
{
margin: "",
padding: "",
border: "Width",
},
function (prefix, suffix) {
jQuery.cssHooks[prefix + suffix] = {
expand: function (value) {
var i = 0,
expanded = {},
// Assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [value];
for (; i < 4; i++) {
expanded[prefix + cssExpand[i] + suffix] =
parts[i] || parts[i - 2] || parts[0];
}
return expanded;
},
};
if (prefix !== "margin") {
jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
}
}
);
jQuery.fn.extend({
css: function (name, value) {
return access(
this,
function (elem, name, value) {
var styles,
len,
map = {},
i = 0;
if (Array.isArray(name)) {
styles = getStyles(elem);
len = name.length;
for (; i < len; i++) {
map[name[i]] = jQuery.css(elem, name[i], false, styles);
}
return map;
}
return value !== undefined
? jQuery.style(elem, name, value)
: jQuery.css(elem, name);
},
name,
value,
arguments.length > 1
);
},
});
function Tween(elem, options, prop, end, easing) {
return new Tween.prototype.init(elem, options, prop, end, easing);
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function (elem, options, prop, end, easing, unit) {
this.elem = elem;
this.prop = prop;
this.easing = easing || jQuery.easing._default;
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
},
cur: function () {
var hooks = Tween.propHooks[this.prop];
return hooks && hooks.get
? hooks.get(this)
: Tween.propHooks._default.get(this);
},
run: function (percent) {
var eased,
hooks = Tween.propHooks[this.prop];
if (this.options.duration) {
this.pos = eased = jQuery.easing[this.easing](
percent,
this.options.duration * percent,
0,
1,
this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = (this.end - this.start) * eased + this.start;
if (this.options.step) {
this.options.step.call(this.elem, this.now, this);
}
if (hooks && hooks.set) {
hooks.set(this);
} else {
Tween.propHooks._default.set(this);
}
return this;
},
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function (tween) {
var result;
// Use a property on the element directly when it is not a DOM element,
// or when there is no matching style property that exists.
if (
tween.elem.nodeType !== 1 ||
(tween.elem[tween.prop] != null &&
tween.elem.style[tween.prop] == null)
) {
return tween.elem[tween.prop];
}
// Passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails.
// Simple values such as "10px" are parsed to Float;
// complex values such as "rotate(1rad)" are returned as-is.
result = jQuery.css(tween.elem, tween.prop, "");
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function (tween) {
// Use step hook for back compat.
// Use cssHook if its there.
// Use .style if available and use plain properties where available.
if (jQuery.fx.step[tween.prop]) {
jQuery.fx.step[tween.prop](tween);
} else if (
tween.elem.nodeType === 1 &&
(jQuery.cssHooks[tween.prop] ||
tween.elem.style[finalPropName(tween.prop)] != null)
) {
jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
} else {
tween.elem[tween.prop] = tween.now;
}
},
},
};
// Support: IE <=9 only
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function (tween) {
if (tween.elem.nodeType && tween.elem.parentNode) {
tween.elem[tween.prop] = tween.now;
}
},
};
jQuery.easing = {
linear: function (p) {
return p;
},
swing: function (p) {
return 0.5 - Math.cos(p * Math.PI) / 2;
},
_default: "swing",
};
jQuery.fx = Tween.prototype.init;
// Back compat <1.8 extension point
jQuery.fx.step = {};
var fxNow,
inProgress,
rfxtypes = /^(?:toggle|show|hide)$/,
rrun = /queueHooks$/;
function schedule() {
if (inProgress) {
if (document.hidden === false && window.requestAnimationFrame) {
window.requestAnimationFrame(schedule);
} else {
window.setTimeout(schedule, jQuery.fx.interval);
}
jQuery.fx.tick();
}
}
// Animations created synchronously will run synchronously
function createFxNow() {
window.setTimeout(function () {
fxNow = undefined;
});
return (fxNow = Date.now());
}
// Generate parameters to create a standard animation
function genFx(type, includeWidth) {
var which,
i = 0,
attrs = { height: type };
// If we include width, step value is 1 to do all cssExpand values,
// otherwise step value is 2 to skip over Left and Right
includeWidth = includeWidth ? 1 : 0;
for (; i < 4; i += 2 - includeWidth) {
which = cssExpand[i];
attrs["margin" + which] = attrs["padding" + which] = type;
}
if (includeWidth) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
function createTween(value, prop, animation) {
var tween,
collection = (Animation.tweeners[prop] || []).concat(
Animation.tweeners["*"]
),
index = 0,
length = collection.length;
for (; index < length; index++) {
if ((tween = collection[index].call(animation, prop, value))) {
// We're done with this property
return tween;
}
}
}
function defaultPrefilter(elem, props, opts) {
var prop,
value,
toggle,
hooks,
oldfire,
propTween,
restoreDisplay,
display,
isBox = "width" in props || "height" in props,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHiddenWithinTree(elem),
dataShow = dataPriv.get(elem, "fxshow");
// Queue-skipping animations hijack the fx hooks
if (!opts.queue) {
hooks = jQuery._queueHooks(elem, "fx");
if (hooks.unqueued == null) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function () {
if (!hooks.unqueued) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function () {
// Ensure the complete handler is called before this completes
anim.always(function () {
hooks.unqueued--;
if (!jQuery.queue(elem, "fx").length) {
hooks.empty.fire();
}
});
});
}
// Detect show/hide animations
for (prop in props) {
value = props[prop];
if (rfxtypes.test(value)) {
delete props[prop];
toggle = toggle || value === "toggle";
if (value === (hidden ? "hide" : "show")) {
// Pretend to be hidden if this is a "show" and
// there is still data from a stopped show/hide
if (value === "show" && dataShow && dataShow[prop] !== undefined) {
hidden = true;
// Ignore all other no-op show/hide data
} else {
continue;
}
}
orig[prop] = (dataShow && dataShow[prop]) || jQuery.style(elem, prop);
}
}
// Bail out if this is a no-op like .hide().hide()
propTween = !jQuery.isEmptyObject(props);
if (!propTween && jQuery.isEmptyObject(orig)) {
return;
}
// Restrict "overflow" and "display" styles during box animations
if (isBox && elem.nodeType === 1) {
// Support: IE <=9 - 11, Edge 12 - 15
// Record all 3 overflow attributes because IE does not infer the shorthand
// from identically-valued overflowX and overflowY and Edge just mirrors
// the overflowX value there.
opts.overflow = [style.overflow, style.overflowX, style.overflowY];
// Identify a display type, preferring old show/hide data over the CSS cascade
restoreDisplay = dataShow && dataShow.display;
if (restoreDisplay == null) {
restoreDisplay = dataPriv.get(elem, "display");
}
display = jQuery.css(elem, "display");
if (display === "none") {
if (restoreDisplay) {
display = restoreDisplay;
} else {
// Get nonempty value(s) by temporarily forcing visibility
showHide([elem], true);
restoreDisplay = elem.style.display || restoreDisplay;
display = jQuery.css(elem, "display");
showHide([elem]);
}
}
// Animate inline elements as inline-block
if (
display === "inline" ||
(display === "inline-block" && restoreDisplay != null)
) {
if (jQuery.css(elem, "float") === "none") {
// Restore the original display value at the end of pure show/hide animations
if (!propTween) {
anim.done(function () {
style.display = restoreDisplay;
});
if (restoreDisplay == null) {
display = style.display;
restoreDisplay = display === "none" ? "" : display;
}
}
style.display = "inline-block";
}
}
}
if (opts.overflow) {
style.overflow = "hidden";
anim.always(function () {
style.overflow = opts.overflow[0];
style.overflowX = opts.overflow[1];
style.overflowY = opts.overflow[2];
});
}
// Implement show/hide animations
propTween = false;
for (prop in orig) {
// General show/hide setup for this element animation
if (!propTween) {
if (dataShow) {
if ("hidden" in dataShow) {
hidden = dataShow.hidden;
}
} else {
dataShow = dataPriv.access(elem, "fxshow", {
display: restoreDisplay,
});
}
// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
if (toggle) {
dataShow.hidden = !hidden;
}
// Show elements before animating them
if (hidden) {
showHide([elem], true);
}
/* eslint-disable no-loop-func */
anim.done(function () {
/* eslint-enable no-loop-func */
// The final step of a "hide" animation is actually hiding the element
if (!hidden) {
showHide([elem]);
}
dataPriv.remove(elem, "fxshow");
for (prop in orig) {
jQuery.style(elem, prop, orig[prop]);
}
});
}
// Per-property setup
propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
if (!(prop in dataShow)) {
dataShow[prop] = propTween.start;
if (hidden) {
propTween.end = propTween.start;
propTween.start = 0;
}
}
}
}
function propFilter(props, specialEasing) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for (index in props) {
name = camelCase(index);
easing = specialEasing[name];
value = props[index];
if (Array.isArray(value)) {
easing = value[1];
value = props[index] = value[0];
}
if (index !== name) {
props[name] = value;
delete props[index];
}
hooks = jQuery.cssHooks[name];
if (hooks && "expand" in hooks) {
value = hooks.expand(value);
delete props[name];
// Not quite $.extend, this won't overwrite existing keys.
// Reusing 'index' because we have the correct "name"
for (index in value) {
if (!(index in props)) {
props[index] = value[index];
specialEasing[index] = easing;
}
}
} else {
specialEasing[name] = easing;
}
}
}
function Animation(elem, properties, options) {
var result,
stopped,
index = 0,
length = Animation.prefilters.length,
deferred = jQuery.Deferred().always(function () {
// Don't match elem in the :animated selector
delete tick.elem;
}),
tick = function () {
if (stopped) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max(
0,
animation.startTime + animation.duration - currentTime
),
// Support: Android 2.3 only
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for (; index < length; index++) {
animation.tweens[index].run(percent);
}
deferred.notifyWith(elem, [animation, percent, remaining]);
// If there's more to do, yield
if (percent < 1 && length) {
return remaining;
}
// If this was an empty animation, synthesize a final progress notification
if (!length) {
deferred.notifyWith(elem, [animation, 1, 0]);
}
// Resolve the animation and report its conclusion
deferred.resolveWith(elem, [animation]);
return false;
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend({}, properties),
opts: jQuery.extend(
true,
{
specialEasing: {},
easing: jQuery.easing._default,
},
options
),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function (prop, end) {
var tween = jQuery.Tween(
elem,
animation.opts,
prop,
end,
animation.opts.specialEasing[prop] || animation.opts.easing
);
animation.tweens.push(tween);
return tween;
},
stop: function (gotoEnd) {
var index = 0,
// If we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if (stopped) {
return this;
}
stopped = true;
for (; index < length; index++) {
animation.tweens[index].run(1);
}
// Resolve when we played the last frame; otherwise, reject
if (gotoEnd) {
deferred.notifyWith(elem, [animation, 1, 0]);
deferred.resolveWith(elem, [animation, gotoEnd]);
} else {
deferred.rejectWith(elem, [animation, gotoEnd]);
}
return this;
},
}),
props = animation.props;
propFilter(props, animation.opts.specialEasing);
for (; index < length; index++) {
result = Animation.prefilters[index].call(
animation,
elem,
props,
animation.opts
);
if (result) {
if (isFunction(result.stop)) {
jQuery._queueHooks(
animation.elem,
animation.opts.queue
).stop = result.stop.bind(result);
}
return result;
}
}
jQuery.map(props, createTween, animation);
if (isFunction(animation.opts.start)) {
animation.opts.start.call(elem, animation);
}
// Attach callbacks from options
animation
.progress(animation.opts.progress)
.done(animation.opts.done, animation.opts.complete)
.fail(animation.opts.fail)
.always(animation.opts.always);
jQuery.fx.timer(
jQuery.extend(tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue,
})
);
return animation;
}
jQuery.Animation = jQuery.extend(Animation, {
tweeners: {
"*": [
function (prop, value) {
var tween = this.createTween(prop, value);
adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
return tween;
},
],
},
tweener: function (props, callback) {
if (isFunction(props)) {
callback = props;
props = ["*"];
} else {
props = props.match(rnothtmlwhite);
}
var prop,
index = 0,
length = props.length;
for (; index < length; index++) {
prop = props[index];
Animation.tweeners[prop] = Animation.tweeners[prop] || [];
Animation.tweeners[prop].unshift(callback);
}
},
prefilters: [defaultPrefilter],
prefilter: function (callback, prepend) {
if (prepend) {
Animation.prefilters.unshift(callback);
} else {
Animation.prefilters.push(callback);
}
},
});
jQuery.speed = function (speed, easing, fn) {
var opt =
speed && typeof speed === "object"
? jQuery.extend({}, speed)
: {
complete: fn || (!fn && easing) || (isFunction(speed) && speed),
duration: speed,
easing: (fn && easing) || (easing && !isFunction(easing) && easing),
};
// Go to the end state if fx are off
if (jQuery.fx.off) {
opt.duration = 0;
} else {
if (typeof opt.duration !== "number") {
if (opt.duration in jQuery.fx.speeds) {
opt.duration = jQuery.fx.speeds[opt.duration];
} else {
opt.duration = jQuery.fx.speeds._default;
}
}
}
// Normalize opt.queue - true/undefined/null -> "fx"
if (opt.queue == null || opt.queue === true) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function () {
if (isFunction(opt.old)) {
opt.old.call(this);
}
if (opt.queue) {
jQuery.dequeue(this, opt.queue);
}
};
return opt;
};
jQuery.fn.extend({
fadeTo: function (speed, to, easing, callback) {
// Show any hidden elements after setting opacity to 0
return (
this.filter(isHiddenWithinTree)
.css("opacity", 0)
.show()
// Animate to the value specified
.end()
.animate({ opacity: to }, speed, easing, callback)
);
},
animate: function (prop, speed, easing, callback) {
var empty = jQuery.isEmptyObject(prop),
optall = jQuery.speed(speed, easing, callback),
doAnimation = function () {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation(this, jQuery.extend({}, prop), optall);
// Empty animations, or finishing resolves immediately
if (empty || dataPriv.get(this, "finish")) {
anim.stop(true);
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false
? this.each(doAnimation)
: this.queue(optall.queue, doAnimation);
},
stop: function (type, clearQueue, gotoEnd) {
var stopQueue = function (hooks) {
var stop = hooks.stop;
delete hooks.stop;
stop(gotoEnd);
};
if (typeof type !== "string") {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if (clearQueue) {
this.queue(type || "fx", []);
}
return this.each(function () {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = dataPriv.get(this);
if (index) {
if (data[index] && data[index].stop) {
stopQueue(data[index]);
}
} else {
for (index in data) {
if (data[index] && data[index].stop && rrun.test(index)) {
stopQueue(data[index]);
}
}
}
for (index = timers.length; index--; ) {
if (
timers[index].elem === this &&
(type == null || timers[index].queue === type)
) {
timers[index].anim.stop(gotoEnd);
dequeue = false;
timers.splice(index, 1);
}
}
// Start the next in the queue if the last step wasn't forced.
// Timers currently will call their complete callbacks, which
// will dequeue but only if they were gotoEnd.
if (dequeue || !gotoEnd) {
jQuery.dequeue(this, type);
}
});
},
finish: function (type) {
if (type !== false) {
type = type || "fx";
}
return this.each(function () {
var index,
data = dataPriv.get(this),
queue = data[type + "queue"],
hooks = data[type + "queueHooks"],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// Enable finishing flag on private data
data.finish = true;
// Empty the queue first
jQuery.queue(this, type, []);
if (hooks && hooks.stop) {
hooks.stop.call(this, true);
}
// Look for any active animations, and finish them
for (index = timers.length; index--; ) {
if (timers[index].elem === this && timers[index].queue === type) {
timers[index].anim.stop(true);
timers.splice(index, 1);
}
}
// Look for any animations in the old queue and finish them
for (index = 0; index < length; index++) {
if (queue[index] && queue[index].finish) {
queue[index].finish.call(this);
}
}
// Turn off finishing flag
delete data.finish;
});
},
});
jQuery.each(["toggle", "show", "hide"], function (_i, name) {
var cssFn = jQuery.fn[name];
jQuery.fn[name] = function (speed, easing, callback) {
return speed == null || typeof speed === "boolean"
? cssFn.apply(this, arguments)
: this.animate(genFx(name, true), speed, easing, callback);
};
});
// Generate shortcuts for custom animations
jQuery.each(
{
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" },
},
function (name, props) {
jQuery.fn[name] = function (speed, easing, callback) {
return this.animate(props, speed, easing, callback);
};
}
);
jQuery.timers = [];
jQuery.fx.tick = function () {
var timer,
i = 0,
timers = jQuery.timers;
fxNow = Date.now();
for (; i < timers.length; i++) {
timer = timers[i];
// Run the timer and safely remove it when done (allowing for external removal)
if (!timer() && timers[i] === timer) {
timers.splice(i--, 1);
}
}
if (!timers.length) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function (timer) {
jQuery.timers.push(timer);
jQuery.fx.start();
};
jQuery.fx.interval = 13;
jQuery.fx.start = function () {
if (inProgress) {
return;
}
inProgress = true;
schedule();
};
jQuery.fx.stop = function () {
inProgress = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400,
};
// Based off of the plugin by Clint Helfers, with permission.
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function (time, type) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
type = type || "fx";
return this.queue(type, function (next, hooks) {
var timeout = window.setTimeout(next, time);
hooks.stop = function () {
window.clearTimeout(timeout);
};
});
};
(function () {
var input = document.createElement("input"),
select = document.createElement("select"),
opt = select.appendChild(document.createElement("option"));
input.type = "checkbox";
// Support: Android <=4.3 only
// Default value for a checkbox should be "on"
support.checkOn = input.value !== "";
// Support: IE <=11 only
// Must access selectedIndex to make default options select
support.optSelected = opt.selected;
// Support: IE <=11 only
// An input loses its value after becoming a radio
input = document.createElement("input");
input.value = "t";
input.type = "radio";
support.radioValue = input.value === "t";
})();
var boolHook,
attrHandle = jQuery.expr.attrHandle;
jQuery.fn.extend({
attr: function (name, value) {
return access(this, jQuery.attr, name, value, arguments.length > 1);
},
removeAttr: function (name) {
return this.each(function () {
jQuery.removeAttr(this, name);
});
},
});
jQuery.extend({
attr: function (elem, name, value) {
var ret,
hooks,
nType = elem.nodeType;
// Don't get/set attributes on text, comment and attribute nodes
if (nType === 3 || nType === 8 || nType === 2) {
return;
}
// Fallback to prop when attributes are not supported
if (typeof elem.getAttribute === "undefined") {
return jQuery.prop(elem, name, value);
}
// Attribute hooks are determined by the lowercase version
// Grab necessary hook if one is defined
if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
hooks =
jQuery.attrHooks[name.toLowerCase()] ||
(jQuery.expr.match.bool.test(name) ? boolHook : undefined);
}
if (value !== undefined) {
if (value === null) {
jQuery.removeAttr(elem, name);
return;
}
if (
hooks &&
"set" in hooks &&
(ret = hooks.set(elem, value, name)) !== undefined
) {
return ret;
}
elem.setAttribute(name, value + "");
return value;
}
if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
return ret;
}
ret = jQuery.find.attr(elem, name);
// Non-existent attributes return null, we normalize to undefined
return ret == null ? undefined : ret;
},
attrHooks: {
type: {
set: function (elem, value) {
if (
!support.radioValue &&
value === "radio" &&
nodeName(elem, "input")
) {
var val = elem.value;
elem.setAttribute("type", value);
if (val) {
elem.value = val;
}
return value;
}
},
},
},
removeAttr: function (elem, value) {
var name,
i = 0,
// Attribute names can contain non-HTML whitespace characters
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
attrNames = value && value.match(rnothtmlwhite);
if (attrNames && elem.nodeType === 1) {
while ((name = attrNames[i++])) {
elem.removeAttribute(name);
}
}
},
});
// Hooks for boolean attributes
boolHook = {
set: function (elem, value, name) {
if (value === false) {
// Remove boolean attributes when set to false
jQuery.removeAttr(elem, name);
} else {
elem.setAttribute(name, name);
}
return name;
},
};
jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (_i, name) {
var getter = attrHandle[name] || jQuery.find.attr;
attrHandle[name] = function (elem, name, isXML) {
var ret,
handle,
lowercaseName = name.toLowerCase();
if (!isXML) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[lowercaseName];
attrHandle[lowercaseName] = ret;
ret = getter(elem, name, isXML) != null ? lowercaseName : null;
attrHandle[lowercaseName] = handle;
}
return ret;
};
});
var rfocusable = /^(?:input|select|textarea|button)$/i,
rclickable = /^(?:a|area)$/i;
jQuery.fn.extend({
prop: function (name, value) {
return access(this, jQuery.prop, name, value, arguments.length > 1);
},
removeProp: function (name) {
return this.each(function () {
delete this[jQuery.propFix[name] || name];
});
},
});
jQuery.extend({
prop: function (elem, name, value) {
var ret,
hooks,
nType = elem.nodeType;
// Don't get/set properties on text, comment and attribute nodes
if (nType === 3 || nType === 8 || nType === 2) {
return;
}
if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
// Fix name and attach hooks
name = jQuery.propFix[name] || name;
hooks = jQuery.propHooks[name];
}
if (value !== undefined) {
if (
hooks &&
"set" in hooks &&
(ret = hooks.set(elem, value, name)) !== undefined
) {
return ret;
}
return (elem[name] = value);
}
if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
return ret;
}
return elem[name];
},
propHooks: {
tabIndex: {
get: function (elem) {
// Support: IE <=9 - 11 only
// elem.tabIndex doesn't always return the
// correct value when it hasn't been explicitly set
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr(elem, "tabindex");
if (tabindex) {
return parseInt(tabindex, 10);
}
if (
rfocusable.test(elem.nodeName) ||
(rclickable.test(elem.nodeName) && elem.href)
) {
return 0;
}
return -1;
},
},
},
propFix: {
for: "htmlFor",
class: "className",
},
});
// Support: IE <=11 only
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
// eslint rule "no-unused-expressions" is disabled for this code
// since it considers such accessions noop
if (!support.optSelected) {
jQuery.propHooks.selected = {
get: function (elem) {
/* eslint no-unused-expressions: "off" */
var parent = elem.parentNode;
if (parent && parent.parentNode) {
parent.parentNode.selectedIndex;
}
return null;
},
set: function (elem) {
/* eslint no-unused-expressions: "off" */
var parent = elem.parentNode;
if (parent) {
parent.selectedIndex;
if (parent.parentNode) {
parent.parentNode.selectedIndex;
}
}
},
};
}
jQuery.each(
[
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable",
],
function () {
jQuery.propFix[this.toLowerCase()] = this;
}
);
// Strip and collapse whitespace according to HTML spec
// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
function stripAndCollapse(value) {
var tokens = value.match(rnothtmlwhite) || [];
return tokens.join(" ");
}
function getClass(elem) {
return (elem.getAttribute && elem.getAttribute("class")) || "";
}
function classesToArray(value) {
if (Array.isArray(value)) {
return value;
}
if (typeof value === "string") {
return value.match(rnothtmlwhite) || [];
}
return [];
}
jQuery.fn.extend({
addClass: function (value) {
var classes,
elem,
cur,
curValue,
clazz,
j,
finalValue,
i = 0;
if (isFunction(value)) {
return this.each(function (j) {
jQuery(this).addClass(value.call(this, j, getClass(this)));
});
}
classes = classesToArray(value);
if (classes.length) {
while ((elem = this[i++])) {
curValue = getClass(elem);
cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
if (cur) {
j = 0;
while ((clazz = classes[j++])) {
if (cur.indexOf(" " + clazz + " ") < 0) {
cur += clazz + " ";
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = stripAndCollapse(cur);
if (curValue !== finalValue) {
elem.setAttribute("class", finalValue);
}
}
}
}
return this;
},
removeClass: function (value) {
var classes,
elem,
cur,
curValue,
clazz,
j,
finalValue,
i = 0;
if (isFunction(value)) {
return this.each(function (j) {
jQuery(this).removeClass(value.call(this, j, getClass(this)));
});
}
if (!arguments.length) {
return this.attr("class", "");
}
classes = classesToArray(value);
if (classes.length) {
while ((elem = this[i++])) {
curValue = getClass(elem);
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
if (cur) {
j = 0;
while ((clazz = classes[j++])) {
// Remove *all* instances
while (cur.indexOf(" " + clazz + " ") > -1) {
cur = cur.replace(" " + clazz + " ", " ");
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = stripAndCollapse(cur);
if (curValue !== finalValue) {
elem.setAttribute("class", finalValue);
}
}
}
}
return this;
},
toggleClass: function (value, stateVal) {
var type = typeof value,
isValidValue = type === "string" || Array.isArray(value);
if (typeof stateVal === "boolean" && isValidValue) {
return stateVal ? this.addClass(value) : this.removeClass(value);
}
if (isFunction(value)) {
return this.each(function (i) {
jQuery(this).toggleClass(
value.call(this, i, getClass(this), stateVal),
stateVal
);
});
}
return this.each(function () {
var className, i, self, classNames;
if (isValidValue) {
// Toggle individual class names
i = 0;
self = jQuery(this);
classNames = classesToArray(value);
while ((className = classNames[i++])) {
// Check each className given, space separated list
if (self.hasClass(className)) {
self.removeClass(className);
} else {
self.addClass(className);
}
}
// Toggle whole class name
} else if (value === undefined || type === "boolean") {
className = getClass(this);
if (className) {
// Store className if set
dataPriv.set(this, "__className__", className);
}
// If the element has a class name or if we're passed `false`,
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
if (this.setAttribute) {
this.setAttribute(
"class",
className || value === false
? ""
: dataPriv.get(this, "__className__") || ""
);
}
}
});
},
hasClass: function (selector) {
var className,
elem,
i = 0;
className = " " + selector + " ";
while ((elem = this[i++])) {
if (
elem.nodeType === 1 &&
(" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1
) {
return true;
}
}
return false;
},
});
var rreturn = /\r/g;
jQuery.fn.extend({
val: function (value) {
var hooks,
ret,
valueIsFunction,
elem = this[0];
if (!arguments.length) {
if (elem) {
hooks =
jQuery.valHooks[elem.type] ||
jQuery.valHooks[elem.nodeName.toLowerCase()];
if (
hooks &&
"get" in hooks &&
(ret = hooks.get(elem, "value")) !== undefined
) {
return ret;
}
ret = elem.value;
// Handle most common string cases
if (typeof ret === "string") {
return ret.replace(rreturn, "");
}
// Handle cases where value is null/undef or number
return ret == null ? "" : ret;
}
return;
}
valueIsFunction = isFunction(value);
return this.each(function (i) {
var val;
if (this.nodeType !== 1) {
return;
}
if (valueIsFunction) {
val = value.call(this, i, jQuery(this).val());
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if (val == null) {
val = "";
} else if (typeof val === "number") {
val += "";
} else if (Array.isArray(val)) {
val = jQuery.map(val, function (value) {
return value == null ? "" : value + "";
});
}
hooks =
jQuery.valHooks[this.type] ||
jQuery.valHooks[this.nodeName.toLowerCase()];
// If set returns undefined, fall back to normal setting
if (
!hooks ||
!("set" in hooks) ||
hooks.set(this, val, "value") === undefined
) {
this.value = val;
}
});
},
});
jQuery.extend({
valHooks: {
option: {
get: function (elem) {
var val = jQuery.find.attr(elem, "value");
return val != null
? val
: // Support: IE <=10 - 11 only
// option.text throws exceptions (#14686, #14858)
// Strip and collapse whitespace
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
stripAndCollapse(jQuery.text(elem));
},
},
select: {
get: function (elem) {
var value,
option,
i,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one",
values = one ? null : [],
max = one ? index + 1 : options.length;
if (index < 0) {
i = max;
} else {
i = one ? index : 0;
}
// Loop through all the selected options
for (; i < max; i++) {
option = options[i];
// Support: IE <=9 only
// IE8-9 doesn't update selected after form reset (#2551)
if (
(option.selected || i === index) &&
// Don't return options that are disabled or in a disabled optgroup
!option.disabled &&
(!option.parentNode.disabled ||
!nodeName(option.parentNode, "optgroup"))
) {
// Get the specific value for the option
value = jQuery(option).val();
// We don't need an array for one selects
if (one) {
return value;
}
// Multi-Selects return an array
values.push(value);
}
}
return values;
},
set: function (elem, value) {
var optionSet,
option,
options = elem.options,
values = jQuery.makeArray(value),
i = options.length;
while (i--) {
option = options[i];
/* eslint-disable no-cond-assign */
if (
(option.selected =
jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1)
) {
optionSet = true;
}
/* eslint-enable no-cond-assign */
}
// Force browsers to behave consistently when non-matching value is set
if (!optionSet) {
elem.selectedIndex = -1;
}
return values;
},
},
},
});
// Radios and checkboxes getter/setter
jQuery.each(["radio", "checkbox"], function () {
jQuery.valHooks[this] = {
set: function (elem, value) {
if (Array.isArray(value)) {
return (elem.checked =
jQuery.inArray(jQuery(elem).val(), value) > -1);
}
},
};
if (!support.checkOn) {
jQuery.valHooks[this].get = function (elem) {
return elem.getAttribute("value") === null ? "on" : elem.value;
};
}
});
// Return jQuery for attributes-only inclusion
support.focusin = "onfocusin" in window;
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
stopPropagationCallback = function (e) {
e.stopPropagation();
};
jQuery.extend(jQuery.event, {
trigger: function (event, data, elem, onlyHandlers) {
var i,
cur,
tmp,
bubbleType,
ontype,
handle,
special,
lastElement,
eventPath = [elem || document],
type = hasOwn.call(event, "type") ? event.type : event,
namespaces = hasOwn.call(event, "namespace")
? event.namespace.split(".")
: [];
cur = lastElement = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if (elem.nodeType === 3 || elem.nodeType === 8) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if (rfocusMorph.test(type + jQuery.event.triggered)) {
return;
}
if (type.indexOf(".") > -1) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[jQuery.expando]
? event
: new jQuery.Event(type, typeof event === "object" && event);
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join(".");
event.rnamespace = event.namespace
? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)")
: null;
// Clean up the event in case it is being reused
event.result = undefined;
if (!event.target) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ? [event] : jQuery.makeArray(data, [event]);
// Allow special events to draw outside the lines
special = jQuery.event.special[type] || {};
if (
!onlyHandlers &&
special.trigger &&
special.trigger.apply(elem, data) === false
) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
bubbleType = special.delegateType || type;
if (!rfocusMorph.test(bubbleType + type)) {
cur = cur.parentNode;
}
for (; cur; cur = cur.parentNode) {
eventPath.push(cur);
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if (tmp === (elem.ownerDocument || document)) {
eventPath.push(tmp.defaultView || tmp.parentWindow || window);
}
}
// Fire handlers on the event path
i = 0;
while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
lastElement = cur;
event.type = i > 1 ? bubbleType : special.bindType || type;
// jQuery handler
handle =
(dataPriv.get(cur, "events") || Object.create(null))[event.type] &&
dataPriv.get(cur, "handle");
if (handle) {
handle.apply(cur, data);
}
// Native handler
handle = ontype && cur[ontype];
if (handle && handle.apply && acceptData(cur)) {
event.result = handle.apply(cur, data);
if (event.result === false) {
event.preventDefault();
}
}
}
event.type = type;
// If nobody prevented the default action, do it now
if (!onlyHandlers && !event.isDefaultPrevented()) {
if (
(!special._default ||
special._default.apply(eventPath.pop(), data) === false) &&
acceptData(elem)
) {
// Call a native DOM method on the target with the same name as the event.
// Don't do default actions on window, that's where global variables be (#6170)
if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ontype];
if (tmp) {
elem[ontype] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
if (event.isPropagationStopped()) {
lastElement.addEventListener(type, stopPropagationCallback);
}
elem[type]();
if (event.isPropagationStopped()) {
lastElement.removeEventListener(type, stopPropagationCallback);
}
jQuery.event.triggered = undefined;
if (tmp) {
elem[ontype] = tmp;
}
}
}
}
return event.result;
},
// Piggyback on a donor event to simulate a different one
// Used only for `focus(in | out)` events
simulate: function (type, elem, event) {
var e = jQuery.extend(new jQuery.Event(), event, {
type: type,
isSimulated: true,
});
jQuery.event.trigger(e, null, elem);
},
});
jQuery.fn.extend({
trigger: function (type, data) {
return this.each(function () {
jQuery.event.trigger(type, data, this);
});
},
triggerHandler: function (type, data) {
var elem = this[0];
if (elem) {
return jQuery.event.trigger(type, data, elem, true);
}
},
});
// Support: Firefox <=44
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
if (!support.focusin) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
// Attach a single capturing handler on the document while someone wants focusin/focusout
var handler = function (event) {
jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
};
jQuery.event.special[fix] = {
setup: function () {
// Handle: regular nodes (via `this.ownerDocument`), window
// (via `this.document`) & document (via `this`).
var doc = this.ownerDocument || this.document || this,
attaches = dataPriv.access(doc, fix);
if (!attaches) {
doc.addEventListener(orig, handler, true);
}
dataPriv.access(doc, fix, (attaches || 0) + 1);
},
teardown: function () {
var doc = this.ownerDocument || this.document || this,
attaches = dataPriv.access(doc, fix) - 1;
if (!attaches) {
doc.removeEventListener(orig, handler, true);
dataPriv.remove(doc, fix);
} else {
dataPriv.access(doc, fix, attaches);
}
},
};
});
}
var location = window.location;
var nonce = { guid: Date.now() };
var rquery = /\?/;
// Cross-browser xml parsing
jQuery.parseXML = function (data) {
var xml, parserErrorElem;
if (!data || typeof data !== "string") {
return null;
}
// Support: IE 9 - 11 only
// IE throws on parseFromString with invalid input.
try {
xml = new window.DOMParser().parseFromString(data, "text/xml");
} catch (e) {}
parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0];
if (!xml || parserErrorElem) {
jQuery.error(
"Invalid XML: " +
(parserErrorElem
? jQuery
.map(parserErrorElem.childNodes, function (el) {
return el.textContent;
})
.join("\n")
: data)
);
}
return xml;
};
var rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
function buildParams(prefix, obj, traditional, add) {
var name;
if (Array.isArray(obj)) {
// Serialize array item.
jQuery.each(obj, function (i, v) {
if (traditional || rbracket.test(prefix)) {
// Treat each array item as a scalar.
add(prefix, v);
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams(
prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]",
v,
traditional,
add
);
}
});
} else if (!traditional && toType(obj) === "object") {
// Serialize object item.
for (name in obj) {
buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
}
} else {
// Serialize scalar item.
add(prefix, obj);
}
}
// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.param = function (a, traditional) {
var prefix,
s = [],
add = function (key, valueOrFunction) {
// If value is a function, invoke it and use its return value
var value = isFunction(valueOrFunction)
? valueOrFunction()
: valueOrFunction;
s[s.length] =
encodeURIComponent(key) +
"=" +
encodeURIComponent(value == null ? "" : value);
};
if (a == null) {
return "";
}
// If an array was passed in, assume that it is an array of form elements.
if (Array.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
// Serialize the form elements
jQuery.each(a, function () {
add(this.name, this.value);
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for (prefix in a) {
buildParams(prefix, a[prefix], traditional, add);
}
}
// Return the resulting serialization
return s.join("&");
};
jQuery.fn.extend({
serialize: function () {
return jQuery.param(this.serializeArray());
},
serializeArray: function () {
return this.map(function () {
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop(this, "elements");
return elements ? jQuery.makeArray(elements) : this;
})
.filter(function () {
var type = this.type;
// Use .is( ":disabled" ) so that fieldset[disabled] works
return (
this.name &&
!jQuery(this).is(":disabled") &&
rsubmittable.test(this.nodeName) &&
!rsubmitterTypes.test(type) &&
(this.checked || !rcheckableType.test(type))
);
})
.map(function (_i, elem) {
var val = jQuery(this).val();
if (val == null) {
return null;
}
if (Array.isArray(val)) {
return jQuery.map(val, function (val) {
return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
});
}
return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
})
.get();
},
});
var r20 = /%20/g,
rhash = /#.*$/,
rantiCache = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/gm,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*"),
// Anchor tag for parsing the document origin
originAnchor = document.createElement("a");
originAnchor.href = location.href;
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports(structure) {
// dataTypeExpression is optional and defaults to "*"
return function (dataTypeExpression, func) {
if (typeof dataTypeExpression !== "string") {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
if (isFunction(func)) {
// For each dataType in the dataTypeExpression
while ((dataType = dataTypes[i++])) {
// Prepend if requested
if (dataType[0] === "+") {
dataType = dataType.slice(1) || "*";
(structure[dataType] = structure[dataType] || []).unshift(func);
// Otherwise append
} else {
(structure[dataType] = structure[dataType] || []).push(func);
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports(
structure,
options,
originalOptions,
jqXHR
) {
var inspected = {},
seekingTransport = structure === transports;
function inspect(dataType) {
var selected;
inspected[dataType] = true;
jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
var dataTypeOrTransport = prefilterOrFactory(
options,
originalOptions,
jqXHR
);
if (
typeof dataTypeOrTransport === "string" &&
!seekingTransport &&
!inspected[dataTypeOrTransport]
) {
options.dataTypes.unshift(dataTypeOrTransport);
inspect(dataTypeOrTransport);
return false;
} else if (seekingTransport) {
return !(selected = dataTypeOrTransport);
}
});
return selected;
}
return inspect(options.dataTypes[0]) || (!inspected["*"] && inspect("*"));
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend(target, src) {
var key,
deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for (key in src) {
if (src[key] !== undefined) {
(flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
}
}
if (deep) {
jQuery.extend(true, target, deep);
}
return target;
}
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses(s, jqXHR, responses) {
var ct,
type,
finalDataType,
firstDataType,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while (dataTypes[0] === "*") {
dataTypes.shift();
if (ct === undefined) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if (ct) {
for (type in contents) {
if (contents[type] && contents[type].test(ct)) {
dataTypes.unshift(type);
break;
}
}
}
// Check to see if we have a response for the expected dataType
if (dataTypes[0] in responses) {
finalDataType = dataTypes[0];
} else {
// Try convertible dataTypes
for (type in responses) {
if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
finalDataType = type;
break;
}
if (!firstDataType) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if (finalDataType) {
if (finalDataType !== dataTypes[0]) {
dataTypes.unshift(finalDataType);
}
return responses[finalDataType];
}
}
/* Chain conversions given the request and the original response
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert(s, response, jqXHR, isSuccess) {
var conv2,
current,
conv,
tmp,
prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if (dataTypes[1]) {
for (conv in s.converters) {
converters[conv.toLowerCase()] = s.converters[conv];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while (current) {
if (s.responseFields[current]) {
jqXHR[s.responseFields[current]] = response;
}
// Apply the dataFilter if provided
if (!prev && isSuccess && s.dataFilter) {
response = s.dataFilter(response, s.dataType);
}
prev = current;
current = dataTypes.shift();
if (current) {
// There's only work to do if current dataType is non-auto
if (current === "*") {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if (prev !== "*" && prev !== current) {
// Seek a direct converter
conv = converters[prev + " " + current] || converters["* " + current];
// If none found, seek a pair
if (!conv) {
for (conv2 in converters) {
// If conv2 outputs current
tmp = conv2.split(" ");
if (tmp[1] === current) {
// If prev can be converted to accepted input
conv =
converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
if (conv) {
// Condense equivalence converters
if (conv === true) {
conv = converters[conv2];
// Otherwise, insert the intermediate dataType
} else if (converters[conv2] !== true) {
current = tmp[0];
dataTypes.unshift(tmp[1]);
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if (conv !== true) {
// Unless errors are allowed to bubble, catch and return them
if (conv && s.throws) {
response = conv(response);
} else {
try {
response = conv(response);
} catch (e) {
return {
state: "parsererror",
error: conv
? e
: "No conversion from " + prev + " to " + current,
};
}
}
}
}
}
}
return { state: "success", data: response };
}
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: location.href,
type: "GET",
isLocal: rlocalProtocol.test(location.protocol),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript",
},
contents: {
xml: /\bxml\b/,
html: /\bhtml/,
json: /\bjson\b/,
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON",
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": JSON.parse,
// Parse text as xml
"text xml": jQuery.parseXML,
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true,
},
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function (target, settings) {
return settings
? // Building a settings object
ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings)
: // Extending ajaxSettings
ajaxExtend(jQuery.ajaxSettings, target);
},
ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
ajaxTransport: addToPrefiltersOrTransports(transports),
// Main method
ajax: function (url, options) {
// If url is an object, simulate pre-1.5 signature
if (typeof url === "object") {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var transport,
// URL without anti-cache param
cacheURL,
// Response headers
responseHeadersString,
responseHeaders,
// timeout handle
timeoutTimer,
// Url cleanup var
urlAnchor,
// Request state (becomes false upon send and true upon completion)
completed,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// uncached part of the url
uncached,
// Create the final options object
s = jQuery.ajaxSetup({}, options),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext =
s.context && (callbackContext.nodeType || callbackContext.jquery)
? jQuery(callbackContext)
: jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function (key) {
var match;
if (completed) {
if (!responseHeaders) {
responseHeaders = {};
while ((match = rheaders.exec(responseHeadersString))) {
responseHeaders[match[1].toLowerCase() + " "] = (
responseHeaders[match[1].toLowerCase() + " "] || []
).concat(match[2]);
}
}
match = responseHeaders[key.toLowerCase() + " "];
}
return match == null ? null : match.join(", ");
},
// Raw string
getAllResponseHeaders: function () {
return completed ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function (name, value) {
if (completed == null) {
name = requestHeadersNames[name.toLowerCase()] =
requestHeadersNames[name.toLowerCase()] || name;
requestHeaders[name] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function (type) {
if (completed == null) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function (map) {
var code;
if (map) {
if (completed) {
// Execute the appropriate callbacks
jqXHR.always(map[jqXHR.status]);
} else {
// Lazy-add the new callbacks in a way that preserves old ones
for (code in map) {
statusCode[code] = [statusCode[code], map[code]];
}
}
}
return this;
},
// Cancel the request
abort: function (statusText) {
var finalText = statusText || strAbort;
if (transport) {
transport.abort(finalText);
}
done(0, finalText);
return this;
},
};
// Attach deferreds
deferred.promise(jqXHR);
// Add protocol if not provided (prefilters might expect it)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ((url || s.url || location.href) + "").replace(
rprotocol,
location.protocol + "//"
);
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [
"",
];
// A cross-domain request is in order when the origin doesn't match the current origin.
if (s.crossDomain == null) {
urlAnchor = document.createElement("a");
// Support: IE <=8 - 11, Edge 12 - 15
// IE throws exception on accessing the href property if url is malformed,
// e.g. http://example.com:80x/
try {
urlAnchor.href = s.url;
// Support: IE <=8 - 11 only
// Anchor's host property isn't correctly set when s.url is relative
urlAnchor.href = urlAnchor.href;
s.crossDomain =
originAnchor.protocol + "//" + originAnchor.host !==
urlAnchor.protocol + "//" + urlAnchor.host;
} catch (e) {
// If there is an error parsing the URL, assume it is crossDomain,
// it can be rejected by the transport if it is invalid
s.crossDomain = true;
}
}
// Convert data if not already a string
if (s.data && s.processData && typeof s.data !== "string") {
s.data = jQuery.param(s.data, s.traditional);
}
// Apply prefilters
inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
// If request was aborted inside a prefilter, stop there
if (completed) {
return jqXHR;
}
// We can fire global events as of now if asked to
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
fireGlobals = jQuery.event && s.global;
// Watch for a new set of requests
if (fireGlobals && jQuery.active++ === 0) {
jQuery.event.trigger("ajaxStart");
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test(s.type);
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
// Remove hash to simplify url manipulation
cacheURL = s.url.replace(rhash, "");
// More options handling for requests with no content
if (!s.hasContent) {
// Remember the hash so we can put it back
uncached = s.url.slice(cacheURL.length);
// If data is available and should be processed, append data to url
if (s.data && (s.processData || typeof s.data === "string")) {
cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add or update anti-cache param if needed
if (s.cache === false) {
cacheURL = cacheURL.replace(rantiCache, "$1");
uncached =
(rquery.test(cacheURL) ? "&" : "?") +
"_=" +
nonce.guid++ +
uncached;
}
// Put hash and anti-cache on the URL that will be requested (gh-1732)
s.url = cacheURL + uncached;
// Change '%20' to '+' if this is encoded form body content (gh-2658)
} else if (
s.data &&
s.processData &&
(s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0
) {
s.data = s.data.replace(r20, "+");
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if (s.ifModified) {
if (jQuery.lastModified[cacheURL]) {
jqXHR.setRequestHeader(
"If-Modified-Since",
jQuery.lastModified[cacheURL]
);
}
if (jQuery.etag[cacheURL]) {
jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
}
}
// Set the correct header, if data is being sent
if (
(s.data && s.hasContent && s.contentType !== false) ||
options.contentType
) {
jqXHR.setRequestHeader("Content-Type", s.contentType);
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[0] && s.accepts[s.dataTypes[0]]
? s.accepts[s.dataTypes[0]] +
(s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "")
: s.accepts["*"]
);
// Check for headers option
for (i in s.headers) {
jqXHR.setRequestHeader(i, s.headers[i]);
}
// Allow custom headers/mimetypes and early abort
if (
s.beforeSend &&
(s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)
) {
// Abort if not done already and return
return jqXHR.abort();
}
// Aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
completeDeferred.add(s.complete);
jqXHR.done(s.success);
jqXHR.fail(s.error);
// Get transport
transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
// If no transport, we auto-abort
if (!transport) {
done(-1, "No Transport");
} else {
jqXHR.readyState = 1;
// Send global event
if (fireGlobals) {
globalEventContext.trigger("ajaxSend", [jqXHR, s]);
}
// If request was aborted inside ajaxSend, stop there
if (completed) {
return jqXHR;
}
// Timeout
if (s.async && s.timeout > 0) {
timeoutTimer = window.setTimeout(function () {
jqXHR.abort("timeout");
}, s.timeout);
}
try {
completed = false;
transport.send(requestHeaders, done);
} catch (e) {
// Rethrow post-completion exceptions
if (completed) {
throw e;
}
// Propagate others as results
done(-1, e);
}
}
// Callback for when everything is done
function done(status, nativeStatusText, responses, headers) {
var isSuccess,
success,
error,
response,
modified,
statusText = nativeStatusText;
// Ignore repeat invocations
if (completed) {
return;
}
completed = true;
// Clear timeout if it exists
if (timeoutTimer) {
window.clearTimeout(timeoutTimer);
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = (status >= 200 && status < 300) || status === 304;
// Get response data
if (responses) {
response = ajaxHandleResponses(s, jqXHR, responses);
}
// Use a noop converter for missing script but not if jsonp
if (
!isSuccess &&
jQuery.inArray("script", s.dataTypes) > -1 &&
jQuery.inArray("json", s.dataTypes) < 0
) {
s.converters["text script"] = function () {};
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert(s, response, jqXHR, isSuccess);
// If successful, handle type chaining
if (isSuccess) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if (s.ifModified) {
modified = jqXHR.getResponseHeader("Last-Modified");
if (modified) {
jQuery.lastModified[cacheURL] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if (modified) {
jQuery.etag[cacheURL] = modified;
}
}
// if no content
if (status === 204 || s.type === "HEAD") {
statusText = "nocontent";
// if not modified
} else if (status === 304) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// Extract error from statusText and normalize for non-aborts
error = statusText;
if (status || !statusText) {
statusText = "error";
if (status < 0) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = (nativeStatusText || statusText) + "";
// Success/Error
if (isSuccess) {
deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
} else {
deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
}
// Status-dependent callbacks
jqXHR.statusCode(statusCode);
statusCode = undefined;
if (fireGlobals) {
globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [
jqXHR,
s,
isSuccess ? success : error,
]);
}
// Complete
completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
if (fireGlobals) {
globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
// Handle the global AJAX counter
if (!--jQuery.active) {
jQuery.event.trigger("ajaxStop");
}
}
}
return jqXHR;
},
getJSON: function (url, data, callback) {
return jQuery.get(url, data, callback, "json");
},
getScript: function (url, callback) {
return jQuery.get(url, undefined, callback, "script");
},
});
jQuery.each(["get", "post"], function (_i, method) {
jQuery[method] = function (url, data, callback, type) {
// Shift arguments if data argument was omitted
if (isFunction(data)) {
type = type || callback;
callback = data;
data = undefined;
}
// The url can be an options object (which then must have .url)
return jQuery.ajax(
jQuery.extend(
{
url: url,
type: method,
dataType: type,
data: data,
success: callback,
},
jQuery.isPlainObject(url) && url
)
);
};
});
jQuery.ajaxPrefilter(function (s) {
var i;
for (i in s.headers) {
if (i.toLowerCase() === "content-type") {
s.contentType = s.headers[i] || "";
}
}
});
jQuery._evalUrl = function (url, options, doc) {
return jQuery.ajax({
url: url,
// Make this explicit, since user can override this through ajaxSetup (#11264)
type: "GET",
dataType: "script",
cache: true,
async: false,
global: false,
// Only evaluate the response if it is successful (gh-4126)
// dataFilter is not invoked for failure responses, so using it instead
// of the default converter is kludgy but it works.
converters: {
"text script": function () {},
},
dataFilter: function (response) {
jQuery.globalEval(response, options, doc);
},
});
};
jQuery.fn.extend({
wrapAll: function (html) {
var wrap;
if (this[0]) {
if (isFunction(html)) {
html = html.call(this[0]);
}
// The elements to wrap the target around
wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
if (this[0].parentNode) {
wrap.insertBefore(this[0]);
}
wrap
.map(function () {
var elem = this;
while (elem.firstElementChild) {
elem = elem.firstElementChild;
}
return elem;
})
.append(this);
}
return this;
},
wrapInner: function (html) {
if (isFunction(html)) {
return this.each(function (i) {
jQuery(this).wrapInner(html.call(this, i));
});
}
return this.each(function () {
var self = jQuery(this),
contents = self.contents();
if (contents.length) {
contents.wrapAll(html);
} else {
self.append(html);
}
});
},
wrap: function (html) {
var htmlIsFunction = isFunction(html);
return this.each(function (i) {
jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
});
},
unwrap: function (selector) {
this.parent(selector)
.not("body")
.each(function () {
jQuery(this).replaceWith(this.childNodes);
});
return this;
},
});
jQuery.expr.pseudos.hidden = function (elem) {
return !jQuery.expr.pseudos.visible(elem);
};
jQuery.expr.pseudos.visible = function (elem) {
return !!(
elem.offsetWidth ||
elem.offsetHeight ||
elem.getClientRects().length
);
};
jQuery.ajaxSettings.xhr = function () {
try {
return new window.XMLHttpRequest();
} catch (e) {}
};
var xhrSuccessStatus = {
// File protocol always yields status code 0, assume 200
0: 200,
// Support: IE <=9 only
// #1450: sometimes IE returns 1223 when it should be 204
1223: 204,
},
xhrSupported = jQuery.ajaxSettings.xhr();
support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
support.ajax = xhrSupported = !!xhrSupported;
jQuery.ajaxTransport(function (options) {
var callback, errorCallback;
// Cross domain only allowed if supported through XMLHttpRequest
if (support.cors || (xhrSupported && !options.crossDomain)) {
return {
send: function (headers, complete) {
var i,
xhr = options.xhr();
xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);
// Apply custom fields if provided
if (options.xhrFields) {
for (i in options.xhrFields) {
xhr[i] = options.xhrFields[i];
}
}
// Override mime type if needed
if (options.mimeType && xhr.overrideMimeType) {
xhr.overrideMimeType(options.mimeType);
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if (!options.crossDomain && !headers["X-Requested-With"]) {
headers["X-Requested-With"] = "XMLHttpRequest";
}
// Set headers
for (i in headers) {
xhr.setRequestHeader(i, headers[i]);
}
// Callback
callback = function (type) {
return function () {
if (callback) {
callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
if (type === "abort") {
xhr.abort();
} else if (type === "error") {
// Support: IE <=9 only
// On a manual native abort, IE9 throws
// errors on any property access that is not readyState
if (typeof xhr.status !== "number") {
complete(0, "error");
} else {
complete(
// File: protocol always yields status 0; see #8605, #14207
xhr.status,
xhr.statusText
);
}
} else {
complete(
xhrSuccessStatus[xhr.status] || xhr.status,
xhr.statusText,
// Support: IE <=9 only
// IE9 has no XHR2 but throws on binary (trac-11426)
// For XHR2 non-text, let the caller handle it (gh-2498)
(xhr.responseType || "text") !== "text" ||
typeof xhr.responseText !== "string"
? { binary: xhr.response }
: { text: xhr.responseText },
xhr.getAllResponseHeaders()
);
}
}
};
};
// Listen to events
xhr.onload = callback();
errorCallback = xhr.onerror = xhr.ontimeout = callback("error");
// Support: IE 9 only
// Use onreadystatechange to replace onabort
// to handle uncaught aborts
if (xhr.onabort !== undefined) {
xhr.onabort = errorCallback;
} else {
xhr.onreadystatechange = function () {
// Check readyState before timeout as it changes
if (xhr.readyState === 4) {
// Allow onerror to be called first,
// but that will not handle a native abort
// Also, save errorCallback to a variable
// as xhr.onerror cannot be accessed
window.setTimeout(function () {
if (callback) {
errorCallback();
}
});
}
};
}
// Create the abort callback
callback = callback("abort");
try {
// Do send the request (this may raise an exception)
xhr.send((options.hasContent && options.data) || null);
} catch (e) {
// #14683: Only rethrow if this hasn't been notified as an error yet
if (callback) {
throw e;
}
}
},
abort: function () {
if (callback) {
callback();
}
},
};
}
});
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter(function (s) {
if (s.crossDomain) {
s.contents.script = false;
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script:
"text/javascript, application/javascript, " +
"application/ecmascript, application/x-ecmascript",
},
contents: {
script: /\b(?:java|ecma)script\b/,
},
converters: {
"text script": function (text) {
jQuery.globalEval(text);
return text;
},
},
});
// Handle cache's special case and crossDomain
jQuery.ajaxPrefilter("script", function (s) {
if (s.cache === undefined) {
s.cache = false;
}
if (s.crossDomain) {
s.type = "GET";
}
});
// Bind script tag hack transport
jQuery.ajaxTransport("script", function (s) {
// This transport only deals with cross domain or forced-by-attrs requests
if (s.crossDomain || s.scriptAttrs) {
var script, callback;
return {
send: function (_, complete) {
script = jQuery("<script>")
.attr(s.scriptAttrs || {})
.prop({ charset: s.scriptCharset, src: s.url })
.on(
"load error",
(callback = function (evt) {
script.remove();
callback = null;
if (evt) {
complete(evt.type === "error" ? 404 : 200, evt.type);
}
})
);
// Use native DOM manipulation to avoid our domManip AJAX trickery
document.head.appendChild(script[0]);
},
abort: function () {
if (callback) {
callback();
}
},
};
}
});
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function () {
var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce.guid++;
this[callback] = true;
return callback;
},
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
var callbackName,
overwritten,
responseContainer,
jsonProp =
s.jsonp !== false &&
(rjsonp.test(s.url)
? "url"
: typeof s.data === "string" &&
(s.contentType || "").indexOf(
"application/x-www-form-urlencoded"
) === 0 &&
rjsonp.test(s.data) &&
"data");
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if (jsonProp || s.dataTypes[0] === "jsonp") {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = isFunction(s.jsonpCallback)
? s.jsonpCallback()
: s.jsonpCallback;
// Insert callback into url or form data
if (jsonProp) {
s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
} else if (s.jsonp !== false) {
s.url +=
(rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function () {
if (!responseContainer) {
jQuery.error(callbackName + " was not called");
}
return responseContainer[0];
};
// Force json dataType
s.dataTypes[0] = "json";
// Install callback
overwritten = window[callbackName];
window[callbackName] = function () {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function () {
// If previous value didn't exist - remove it
if (overwritten === undefined) {
jQuery(window).removeProp(callbackName);
// Otherwise restore preexisting value
} else {
window[callbackName] = overwritten;
}
// Save back as free
if (s[callbackName]) {
// Make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// Save the callback name for future use
oldCallbacks.push(callbackName);
}
// Call if it was a function and we have a response
if (responseContainer && isFunction(overwritten)) {
overwritten(responseContainer[0]);
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = (function () {
var body = document.implementation.createHTMLDocument("").body;
body.innerHTML = "<form></form><form></form>";
return body.childNodes.length === 2;
})();
// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function (data, context, keepScripts) {
if (typeof data !== "string") {
return [];
}
if (typeof context === "boolean") {
keepScripts = context;
context = false;
}
var base, parsed, scripts;
if (!context) {
// Stop scripts or inline event handlers from being executed immediately
// by using document.implementation
if (support.createHTMLDocument) {
context = document.implementation.createHTMLDocument("");
// Set the base href for the created document
// so any parsed elements with URLs
// are based on the document's URL (gh-2965)
base = context.createElement("base");
base.href = document.location.href;
context.head.appendChild(base);
} else {
context = document;
}
}
parsed = rsingleTag.exec(data);
scripts = !keepScripts && [];
// Single tag
if (parsed) {
return [context.createElement(parsed[1])];
}
parsed = buildFragment([data], context, scripts);
if (scripts && scripts.length) {
jQuery(scripts).remove();
}
return jQuery.merge([], parsed.childNodes);
};
/**
* Load a url into a page
*/
jQuery.fn.load = function (url, params, callback) {
var selector,
type,
response,
self = this,
off = url.indexOf(" ");
if (off > -1) {
selector = stripAndCollapse(url.slice(off));
url = url.slice(0, off);
}
// If it's a function
if (isFunction(params)) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if (params && typeof params === "object") {
type = "POST";
}
// If we have elements to modify, make the request
if (self.length > 0) {
jQuery
.ajax({
url: url,
// If "type" variable is undefined, then "GET" method will be used.
// Make value of this field explicit since
// user can override it through ajaxSetup method
type: type || "GET",
dataType: "html",
data: params,
})
.done(function (responseText) {
// Save response for use in complete callback
response = arguments;
self.html(
selector
? // If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>")
.append(jQuery.parseHTML(responseText))
.find(selector)
: // Otherwise use the full result
responseText
);
// If the request succeeds, this function gets "data", "status", "jqXHR"
// but they are ignored because response was set above.
// If it fails, this function gets "jqXHR", "status", "error"
})
.always(
callback &&
function (jqXHR, status) {
self.each(function () {
callback.apply(
this,
response || [jqXHR.responseText, status, jqXHR]
);
});
}
);
}
return this;
};
jQuery.expr.pseudos.animated = function (elem) {
return jQuery.grep(jQuery.timers, function (fn) {
return elem === fn.elem;
}).length;
};
jQuery.offset = {
setOffset: function (elem, options, i) {
var curPosition,
curLeft,
curCSSTop,
curTop,
curOffset,
curCSSLeft,
calculatePosition,
position = jQuery.css(elem, "position"),
curElem = jQuery(elem),
props = {};
// Set position first, in-case top/left are set even on static elem
if (position === "static") {
elem.style.position = "relative";
}
curOffset = curElem.offset();
curCSSTop = jQuery.css(elem, "top");
curCSSLeft = jQuery.css(elem, "left");
calculatePosition =
(position === "absolute" || position === "fixed") &&
(curCSSTop + curCSSLeft).indexOf("auto") > -1;
// Need to be able to calculate position if either
// top or left is auto and position is either absolute or fixed
if (calculatePosition) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat(curCSSTop) || 0;
curLeft = parseFloat(curCSSLeft) || 0;
}
if (isFunction(options)) {
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
options = options.call(elem, i, jQuery.extend({}, curOffset));
}
if (options.top != null) {
props.top = options.top - curOffset.top + curTop;
}
if (options.left != null) {
props.left = options.left - curOffset.left + curLeft;
}
if ("using" in options) {
options.using.call(elem, props);
} else {
curElem.css(props);
}
},
};
jQuery.fn.extend({
// offset() relates an element's border box to the document origin
offset: function (options) {
// Preserve chaining for setter
if (arguments.length) {
return options === undefined
? this
: this.each(function (i) {
jQuery.offset.setOffset(this, options, i);
});
}
var rect,
win,
elem = this[0];
if (!elem) {
return;
}
// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
// Support: IE <=11 only
// Running getBoundingClientRect on a
// disconnected node in IE throws an error
if (!elem.getClientRects().length) {
return { top: 0, left: 0 };
}
// Get document-relative position by adding viewport scroll to viewport-relative gBCR
rect = elem.getBoundingClientRect();
win = elem.ownerDocument.defaultView;
return {
top: rect.top + win.pageYOffset,
left: rect.left + win.pageXOffset,
};
},
// position() relates an element's margin box to its offset parent's padding box
// This corresponds to the behavior of CSS absolute positioning
position: function () {
if (!this[0]) {
return;
}
var offsetParent,
offset,
doc,
elem = this[0],
parentOffset = { top: 0, left: 0 };
// position:fixed elements are offset from the viewport, which itself always has zero offset
if (jQuery.css(elem, "position") === "fixed") {
// Assume position:fixed implies availability of getBoundingClientRect
offset = elem.getBoundingClientRect();
} else {
offset = this.offset();
// Account for the *real* offset parent, which can be the document or its root element
// when a statically positioned element is identified
doc = elem.ownerDocument;
offsetParent = elem.offsetParent || doc.documentElement;
while (
offsetParent &&
(offsetParent === doc.body || offsetParent === doc.documentElement) &&
jQuery.css(offsetParent, "position") === "static"
) {
offsetParent = offsetParent.parentNode;
}
if (
offsetParent &&
offsetParent !== elem &&
offsetParent.nodeType === 1
) {
// Incorporate borders into its offset, since they are outside its content origin
parentOffset = jQuery(offsetParent).offset();
parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
parentOffset.left += jQuery.css(
offsetParent,
"borderLeftWidth",
true
);
}
}
// Subtract parent offsets and element margins
return {
top:
offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
left:
offset.left -
parentOffset.left -
jQuery.css(elem, "marginLeft", true),
};
},
// This method will return documentElement in the following cases:
// 1) For the element inside the iframe without offsetParent, this method will return
// documentElement of the parent window
// 2) For the hidden or detached element
// 3) For body or html element, i.e. in case of the html node - it will return itself
//
// but those exceptions were never presented as a real life use-cases
// and might be considered as more preferable results.
//
// This logic, however, is not guaranteed and can change at any point in the future
offsetParent: function () {
return this.map(function () {
var offsetParent = this.offsetParent;
while (
offsetParent &&
jQuery.css(offsetParent, "position") === "static"
) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || documentElement;
});
},
});
// Create scrollLeft and scrollTop methods
jQuery.each(
{ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" },
function (method, prop) {
var top = "pageYOffset" === prop;
jQuery.fn[method] = function (val) {
return access(
this,
function (elem, method, val) {
// Coalesce documents and windows
var win;
if (isWindow(elem)) {
win = elem;
} else if (elem.nodeType === 9) {
win = elem.defaultView;
}
if (val === undefined) {
return win ? win[prop] : elem[method];
}
if (win) {
win.scrollTo(
!top ? val : win.pageXOffset,
top ? val : win.pageYOffset
);
} else {
elem[method] = val;
}
},
method,
val,
arguments.length
);
};
}
);
// Support: Safari <=7 - 9.1, Chrome <=37 - 49
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
// getComputedStyle returns percent when specified for top/left/bottom/right;
// rather than make the css module depend on the offset module, just check for it here
jQuery.each(["top", "left"], function (_i, prop) {
jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (
elem,
computed
) {
if (computed) {
computed = curCSS(elem, prop);
// If curCSS returns percentage, fallback to offset
return rnumnonpx.test(computed)
? jQuery(elem).position()[prop] + "px"
: computed;
}
});
});
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
jQuery.each(
{
padding: "inner" + name,
content: type,
"": "outer" + name,
},
function (defaultExtra, funcName) {
// Margin is only for outerHeight, outerWidth
jQuery.fn[funcName] = function (margin, value) {
var chainable =
arguments.length && (defaultExtra || typeof margin !== "boolean"),
extra =
defaultExtra ||
(margin === true || value === true ? "margin" : "border");
return access(
this,
function (elem, type, value) {
var doc;
if (isWindow(elem)) {
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
return funcName.indexOf("outer") === 0
? elem["inner" + name]
: elem.document.documentElement["client" + name];
}
// Get document width or height
if (elem.nodeType === 9) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
// whichever is greatest
return Math.max(
elem.body["scroll" + name],
doc["scroll" + name],
elem.body["offset" + name],
doc["offset" + name],
doc["client" + name]
);
}
return value === undefined
? // Get width or height on the element, requesting but not forcing parseFloat
jQuery.css(elem, type, extra)
: // Set width or height on the element
jQuery.style(elem, type, value, extra);
},
type,
chainable ? margin : undefined,
chainable
);
};
}
);
});
jQuery.each(
[
"ajaxStart",
"ajaxStop",
"ajaxComplete",
"ajaxError",
"ajaxSuccess",
"ajaxSend",
],
function (_i, type) {
jQuery.fn[type] = function (fn) {
return this.on(type, fn);
};
}
);
jQuery.fn.extend({
bind: function (types, data, fn) {
return this.on(types, null, data, fn);
},
unbind: function (types, fn) {
return this.off(types, null, fn);
},
delegate: function (selector, types, data, fn) {
return this.on(types, selector, data, fn);
},
undelegate: function (selector, types, fn) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1
? this.off(selector, "**")
: this.off(types, selector || "**", fn);
},
hover: function (fnOver, fnOut) {
return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
},
});
jQuery.each(
(
"blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu"
).split(" "),
function (_i, name) {
// Handle event binding
jQuery.fn[name] = function (data, fn) {
return arguments.length > 0
? this.on(name, null, data, fn)
: this.trigger(name);
};
}
);
// Support: Android <=4.0 only
// Make sure we trim BOM and NBSP
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
// Bind a function to a context, optionally partially applying any
// arguments.
// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
// However, it is not slated for removal any time soon
jQuery.proxy = function (fn, context) {
var tmp, args, proxy;
if (typeof context === "string") {
tmp = fn[context];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if (!isFunction(fn)) {
return undefined;
}
// Simulated bind
args = slice.call(arguments, 2);
proxy = function () {
return fn.apply(context || this, args.concat(slice.call(arguments)));
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
};
jQuery.holdReady = function (hold) {
if (hold) {
jQuery.readyWait++;
} else {
jQuery.ready(true);
}
};
jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
jQuery.isFunction = isFunction;
jQuery.isWindow = isWindow;
jQuery.camelCase = camelCase;
jQuery.type = toType;
jQuery.now = Date.now;
jQuery.isNumeric = function (obj) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = jQuery.type(obj);
return (
(type === "number" || type === "string") &&
// parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN(obj - parseFloat(obj))
);
};
jQuery.trim = function (text) {
return text == null ? "" : (text + "").replace(rtrim, "");
};
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.
// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
if (typeof define === "function" && define.amd) {
define("jquery", [], function () {
return jQuery;
});
}
var // Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$;
jQuery.noConflict = function (deep) {
if (window.$ === jQuery) {
window.$ = _$;
}
if (deep && window.jQuery === jQuery) {
window.jQuery = _jQuery;
}
return jQuery;
};
// Expose jQuery and $ identifiers, even in AMD
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if (typeof noGlobal === "undefined") {
window.jQuery = window.$ = jQuery;
}
return jQuery;
});
var BiwaScheme = (function () {
//
// variables
//
const TopEnv = {};
const CoreEnv = {};
//
// Nil
// javascript representation of empty list( '() )
//
const nil = {
toString: function () {
return "nil";
},
to_write: function () {
return "()";
},
to_array: function () {
return [];
},
length: function () {
return 0;
},
// Moved to main.js to avoid circular dependency
//to_set: function() { return new BiwaSet(); },
};
//
// #<undef> (The undefined value)
// also used as #<unspecified> values
//
const undef = new Object();
undef.toString = function () {
return "#<undef>";
};
//
// Configurations
//
// Maximum depth of stack trace
// (You can also set Interpreter#max_trace_size for each Interpreter)
const max_trace_size = 40;
// Stop showing deprecation warning
const suppress_deprecation_warning = false;
// Actual values are set by rollup (see rollup.config.js)
const VERSION$1 = "0.7.4";
const GitCommit = "09aecb2d4ed634a08ff03c3dee807ef2bad4ca50";
// Underscore.js 1.13.1
// https://underscorejs.org
// (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
// Current version.
var VERSION = "1.13.1";
// Establish the root object, `window` (`self`) in the browser, `global`
// on the server, or `this` in some virtual machines. We use `self`
// instead of `window` for `WebWorker` support.
var root =
(typeof self == "object" && self.self === self && self) ||
(typeof global == "object" && global.global === global && global) ||
Function("return this")() ||
{};
// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype,
ObjProto = Object.prototype;
var SymbolProto = typeof Symbol !== "undefined" ? Symbol.prototype : null;
// Create quick reference variables for speed access to core prototypes.
var push = ArrayProto.push,
slice = ArrayProto.slice,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
// Modern feature detection.
var supportsArrayBuffer = typeof ArrayBuffer !== "undefined",
supportsDataView = typeof DataView !== "undefined";
// All **ECMAScript 5+** native function implementations that we hope to use
// are declared here.
var nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeCreate = Object.create,
nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
// Create references to these builtin functions because we override them.
var _isNaN = isNaN,
_isFinite = isFinite;
// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
var hasEnumBug = !{ toString: null }.propertyIsEnumerable("toString");
var nonEnumerableProps = [
"valueOf",
"isPrototypeOf",
"toString",
"propertyIsEnumerable",
"hasOwnProperty",
"toLocaleString",
];
// The largest integer that can be represented exactly.
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
// Some functions take a variable number of arguments, or a few expected
// arguments at the beginning and then a variable number of values to operate
// on. This helper accumulates all remaining arguments past the functionโs
// argument length (or an explicit `startIndex`), into an array that becomes
// the last argument. Similar to ES6โs "rest parameter".
function restArguments(func, startIndex) {
startIndex = startIndex == null ? func.length - 1 : +startIndex;
return function () {
var length = Math.max(arguments.length - startIndex, 0),
rest = Array(length),
index = 0;
for (; index < length; index++) {
rest[index] = arguments[index + startIndex];
}
switch (startIndex) {
case 0:
return func.call(this, rest);
case 1:
return func.call(this, arguments[0], rest);
case 2:
return func.call(this, arguments[0], arguments[1], rest);
}
var args = Array(startIndex + 1);
for (index = 0; index < startIndex; index++) {
args[index] = arguments[index];
}
args[startIndex] = rest;
return func.apply(this, args);
};
}
// Is a given variable an object?
function isObject(obj) {
var type = typeof obj;
return type === "function" || (type === "object" && !!obj);
}
// Is a given value equal to null?
function isNull(obj) {
return obj === null;
}
// Is a given variable undefined?
function isUndefined(obj) {
return obj === void 0;
}
// Is a given value a boolean?
function isBoolean$1(obj) {
return (
obj === true || obj === false || toString.call(obj) === "[object Boolean]"
);
}
// Is a given value a DOM element?
function isElement(obj) {
return !!(obj && obj.nodeType === 1);
}
// Internal function for creating a `toString`-based type tester.
function tagTester(name) {
var tag = "[object " + name + "]";
return function (obj) {
return toString.call(obj) === tag;
};
}
var isString$1 = tagTester("String");
var isNumber$2 = tagTester("Number");
var isDate = tagTester("Date");
var isRegExp = tagTester("RegExp");
var isError = tagTester("Error");
var isSymbol$1 = tagTester("Symbol");
var isArrayBuffer = tagTester("ArrayBuffer");
var isFunction$1 = tagTester("Function");
// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
var nodelist = root.document && root.document.childNodes;
if (
typeof /./ != "function" &&
typeof Int8Array != "object" &&
typeof nodelist != "function"
) {
isFunction$1 = function (obj) {
return typeof obj == "function" || false;
};
}
var isFunction$1$1 = isFunction$1;
var hasObjectTag = tagTester("Object");
// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
// In IE 11, the most common among them, this problem also applies to
// `Map`, `WeakMap` and `Set`.
var hasStringTagBug =
supportsDataView && hasObjectTag(new DataView(new ArrayBuffer(8))),
isIE11 = typeof Map !== "undefined" && hasObjectTag(new Map());
var isDataView = tagTester("DataView");
// In IE 10 - Edge 13, we need a different heuristic
// to determine whether an object is a `DataView`.
function ie10IsDataView(obj) {
return (
obj != null && isFunction$1$1(obj.getInt8) && isArrayBuffer(obj.buffer)
);
}
var isDataView$1 = hasStringTagBug ? ie10IsDataView : isDataView;
// Is a given value an array?
// Delegates to ECMA5's native `Array.isArray`.
var isArray = nativeIsArray || tagTester("Array");
// Internal function to check whether `key` is an own property name of `obj`.
function has$1(obj, key) {
return obj != null && hasOwnProperty.call(obj, key);
}
var isArguments = tagTester("Arguments");
// Define a fallback version of the method in browsers (ahem, IE < 9), where
// there isn't any inspectable "Arguments" type.
(function () {
if (!isArguments(arguments)) {
isArguments = function (obj) {
return has$1(obj, "callee");
};
}
})();
var isArguments$1 = isArguments;
// Is a given object a finite number?
function isFinite$1(obj) {
return !isSymbol$1(obj) && _isFinite(obj) && !isNaN(parseFloat(obj));
}
// Is the given value `NaN`?
function isNaN$1(obj) {
return isNumber$2(obj) && _isNaN(obj);
}
// Predicate-generating function. Often useful outside of Underscore.
function constant(value) {
return function () {
return value;
};
}
// Common internal logic for `isArrayLike` and `isBufferLike`.
function createSizePropertyCheck(getSizeProperty) {
return function (collection) {
var sizeProperty = getSizeProperty(collection);
return (
typeof sizeProperty == "number" &&
sizeProperty >= 0 &&
sizeProperty <= MAX_ARRAY_INDEX
);
};
}
// Internal helper to generate a function to obtain property `key` from `obj`.
function shallowProperty(key) {
return function (obj) {
return obj == null ? void 0 : obj[key];
};
}
// Internal helper to obtain the `byteLength` property of an object.
var getByteLength = shallowProperty("byteLength");
// Internal helper to determine whether we should spend extensive checks against
// `ArrayBuffer` et al.
var isBufferLike = createSizePropertyCheck(getByteLength);
// Is a given value a typed array?
var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
function isTypedArray(obj) {
// `ArrayBuffer.isView` is the most future-proof, so use it when available.
// Otherwise, fall back on the above regular expression.
return nativeIsView
? nativeIsView(obj) && !isDataView$1(obj)
: isBufferLike(obj) && typedArrayPattern.test(toString.call(obj));
}
var isTypedArray$1 = supportsArrayBuffer ? isTypedArray : constant(false);
// Internal helper to obtain the `length` property of an object.
var getLength = shallowProperty("length");
// Internal helper to create a simple lookup structure.
// `collectNonEnumProps` used to depend on `_.contains`, but this led to
// circular imports. `emulatedSet` is a one-off solution that only works for
// arrays of strings.
function emulatedSet(keys) {
var hash = {};
for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
return {
contains: function (key) {
return hash[key];
},
push: function (key) {
hash[key] = true;
return keys.push(key);
},
};
}
// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
// needed.
function collectNonEnumProps(obj, keys) {
keys = emulatedSet(keys);
var nonEnumIdx = nonEnumerableProps.length;
var constructor = obj.constructor;
var proto =
(isFunction$1$1(constructor) && constructor.prototype) || ObjProto;
// Constructor is a special case.
var prop = "constructor";
if (has$1(obj, prop) && !keys.contains(prop)) keys.push(prop);
while (nonEnumIdx--) {
prop = nonEnumerableProps[nonEnumIdx];
if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
keys.push(prop);
}
}
}
// Retrieve the names of an object's own properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`.
function keys(obj) {
if (!isObject(obj)) return [];
if (nativeKeys) return nativeKeys(obj);
var keys = [];
for (var key in obj) if (has$1(obj, key)) keys.push(key);
// Ahem, IE < 9.
if (hasEnumBug) collectNonEnumProps(obj, keys);
return keys;
}
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
function isEmpty(obj) {
if (obj == null) return true;
// Skip the more expensive `toString`-based type checks if `obj` has no
// `.length`.
var length = getLength(obj);
if (
typeof length == "number" &&
(isArray(obj) || isString$1(obj) || isArguments$1(obj))
)
return length === 0;
return getLength(keys(obj)) === 0;
}
// Returns whether an object has a given set of `key:value` pairs.
function isMatch(object, attrs) {
var _keys = keys(attrs),
length = _keys.length;
if (object == null) return !length;
var obj = Object(object);
for (var i = 0; i < length; i++) {
var key = _keys[i];
if (attrs[key] !== obj[key] || !(key in obj)) return false;
}
return true;
}
// If Underscore is called as a function, it returns a wrapped object that can
// be used OO-style. This wrapper holds altered versions of all functions added
// through `_.mixin`. Wrapped objects may be chained.
function _$1(obj) {
if (obj instanceof _$1) return obj;
if (!(this instanceof _$1)) return new _$1(obj);
this._wrapped = obj;
}
_$1.VERSION = VERSION;
// Extracts the result from a wrapped and chained object.
_$1.prototype.value = function () {
return this._wrapped;
};
// Provide unwrapping proxies for some methods used in engine operations
// such as arithmetic and JSON stringification.
_$1.prototype.valueOf = _$1.prototype.toJSON = _$1.prototype.value;
_$1.prototype.toString = function () {
return String(this._wrapped);
};
// Internal function to wrap or shallow-copy an ArrayBuffer,
// typed array or DataView to a new view, reusing the buffer.
function toBufferView(bufferSource) {
return new Uint8Array(
bufferSource.buffer || bufferSource,
bufferSource.byteOffset || 0,
getByteLength(bufferSource)
);
}
// We use this string twice, so give it a name for minification.
var tagDataView = "[object DataView]";
// Internal recursive comparison function for `_.isEqual`.
function eq$1(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a === 1 / b;
// `null` or `undefined` only equal to itself (strict comparison).
if (a == null || b == null) return false;
// `NaN`s are equivalent, but non-reflexive.
if (a !== a) return b !== b;
// Exhaust primitive checks
var type = typeof a;
if (type !== "function" && type !== "object" && typeof b != "object")
return false;
return deepEq(a, b, aStack, bStack);
}
// Internal recursive comparison function for `_.isEqual`.
function deepEq(a, b, aStack, bStack) {
// Unwrap any wrapped objects.
if (a instanceof _$1) a = a._wrapped;
if (b instanceof _$1) b = b._wrapped;
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className !== toString.call(b)) return false;
// Work around a bug in IE 10 - Edge 13.
if (hasStringTagBug && className == "[object Object]" && isDataView$1(a)) {
if (!isDataView$1(b)) return false;
className = tagDataView;
}
switch (className) {
// These types are compared by value.
case "[object RegExp]":
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
case "[object String]":
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return "" + a === "" + b;
case "[object Number]":
// `NaN`s are equivalent, but non-reflexive.
// Object(NaN) is equivalent to NaN.
if (+a !== +a) return +b !== +b;
// An `egal` comparison is performed for other numeric values.
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
case "[object Date]":
case "[object Boolean]":
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a === +b;
case "[object Symbol]":
return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b);
case "[object ArrayBuffer]":
case tagDataView:
// Coerce to typed array so we can fall through.
return deepEq(toBufferView(a), toBufferView(b), aStack, bStack);
}
var areArrays = className === "[object Array]";
if (!areArrays && isTypedArray$1(a)) {
var byteLength = getByteLength(a);
if (byteLength !== getByteLength(b)) return false;
if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
areArrays = true;
}
if (!areArrays) {
if (typeof a != "object" || typeof b != "object") return false;
// Objects with different constructors are not equivalent, but `Object`s or `Array`s
// from different frames are.
var aCtor = a.constructor,
bCtor = b.constructor;
if (
aCtor !== bCtor &&
!(
isFunction$1$1(aCtor) &&
aCtor instanceof aCtor &&
isFunction$1$1(bCtor) &&
bCtor instanceof bCtor
) &&
"constructor" in a &&
"constructor" in b
) {
return false;
}
}
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
// Initializing stack of traversed objects.
// It's done here since we only need them for objects and arrays comparison.
aStack = aStack || [];
bStack = bStack || [];
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] === a) return bStack[length] === b;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
// Recursively compare objects and arrays.
if (areArrays) {
// Compare array lengths to determine if a deep comparison is necessary.
length = a.length;
if (length !== b.length) return false;
// Deep compare the contents, ignoring non-numeric properties.
while (length--) {
if (!eq$1(a[length], b[length], aStack, bStack)) return false;
}
} else {
// Deep compare objects.
var _keys = keys(a),
key;
length = _keys.length;
// Ensure that both objects contain the same number of properties before comparing deep equality.
if (keys(b).length !== length) return false;
while (length--) {
// Deep compare each member
key = _keys[length];
if (!(has$1(b, key) && eq$1(a[key], b[key], aStack, bStack)))
return false;
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return true;
}
// Perform a deep comparison to check if two objects are equal.
function isEqual(a, b) {
return eq$1(a, b);
}
// Retrieve all the enumerable property names of an object.
function allKeys(obj) {
if (!isObject(obj)) return [];
var keys = [];
for (var key in obj) keys.push(key);
// Ahem, IE < 9.
if (hasEnumBug) collectNonEnumProps(obj, keys);
return keys;
}
// Since the regular `Object.prototype.toString` type tests don't work for
// some types in IE 11, we use a fingerprinting heuristic instead, based
// on the methods. It's not great, but it's the best we got.
// The fingerprint method lists are defined below.
function ie11fingerprint(methods) {
var length = getLength(methods);
return function (obj) {
if (obj == null) return false;
// `Map`, `WeakMap` and `Set` have no enumerable keys.
var keys = allKeys(obj);
if (getLength(keys)) return false;
for (var i = 0; i < length; i++) {
if (!isFunction$1$1(obj[methods[i]])) return false;
}
// If we are testing against `WeakMap`, we need to ensure that
// `obj` doesn't have a `forEach` method in order to distinguish
// it from a regular `Map`.
return methods !== weakMapMethods || !isFunction$1$1(obj[forEachName]);
};
}
// In the interest of compact minification, we write
// each string in the fingerprints only once.
var forEachName = "forEach",
hasName = "has",
commonInit = ["clear", "delete"],
mapTail = ["get", hasName, "set"];
// `Map`, `WeakMap` and `Set` each have slightly different
// combinations of the above sublists.
var mapMethods = commonInit.concat(forEachName, mapTail),
weakMapMethods = commonInit.concat(mapTail),
setMethods = ["add"].concat(commonInit, forEachName, hasName);
var isMap = isIE11 ? ie11fingerprint(mapMethods) : tagTester("Map");
var isWeakMap = isIE11
? ie11fingerprint(weakMapMethods)
: tagTester("WeakMap");
var isSet = isIE11 ? ie11fingerprint(setMethods) : tagTester("Set");
var isWeakSet = tagTester("WeakSet");
// Retrieve the values of an object's properties.
function values(obj) {
var _keys = keys(obj);
var length = _keys.length;
var values = Array(length);
for (var i = 0; i < length; i++) {
values[i] = obj[_keys[i]];
}
return values;
}
// Convert an object into a list of `[key, value]` pairs.
// The opposite of `_.object` with one argument.
function pairs(obj) {
var _keys = keys(obj);
var length = _keys.length;
var pairs = Array(length);
for (var i = 0; i < length; i++) {
pairs[i] = [_keys[i], obj[_keys[i]]];
}
return pairs;
}
// Invert the keys and values of an object. The values must be serializable.
function invert(obj) {
var result = {};
var _keys = keys(obj);
for (var i = 0, length = _keys.length; i < length; i++) {
result[obj[_keys[i]]] = _keys[i];
}
return result;
}
// Return a sorted list of the function names available on the object.
function functions(obj) {
var names = [];
for (var key in obj) {
if (isFunction$1$1(obj[key])) names.push(key);
}
return names.sort();
}
// An internal function for creating assigner functions.
function createAssigner(keysFunc, defaults) {
return function (obj) {
var length = arguments.length;
if (defaults) obj = Object(obj);
if (length < 2 || obj == null) return obj;
for (var index = 1; index < length; index++) {
var source = arguments[index],
keys = keysFunc(source),
l = keys.length;
for (var i = 0; i < l; i++) {
var key = keys[i];
if (!defaults || obj[key] === void 0) obj[key] = source[key];
}
}
return obj;
};
}
// Extend a given object with all the properties in passed-in object(s).
var extend = createAssigner(allKeys);
// Assigns a given object with all the own properties in the passed-in
// object(s).
// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
var extendOwn = createAssigner(keys);
// Fill in a given object with default properties.
var defaults = createAssigner(allKeys, true);
// Create a naked function reference for surrogate-prototype-swapping.
function ctor() {
return function () {};
}
// An internal function for creating a new object that inherits from another.
function baseCreate(prototype) {
if (!isObject(prototype)) return {};
if (nativeCreate) return nativeCreate(prototype);
var Ctor = ctor();
Ctor.prototype = prototype;
var result = new Ctor();
Ctor.prototype = null;
return result;
}
// Creates an object that inherits from the given prototype object.
// If additional properties are provided then they will be added to the
// created object.
function create(prototype, props) {
var result = baseCreate(prototype);
if (props) extendOwn(result, props);
return result;
}
// Create a (shallow-cloned) duplicate of an object.
function clone(obj) {
if (!isObject(obj)) return obj;
return isArray(obj) ? obj.slice() : extend({}, obj);
}
// Invokes `interceptor` with the `obj` and then returns `obj`.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
function tap(obj, interceptor) {
interceptor(obj);
return obj;
}
// Normalize a (deep) property `path` to array.
// Like `_.iteratee`, this function can be customized.
function toPath$1(path) {
return isArray(path) ? path : [path];
}
_$1.toPath = toPath$1;
// Internal wrapper for `_.toPath` to enable minification.
// Similar to `cb` for `_.iteratee`.
function toPath(path) {
return _$1.toPath(path);
}
// Internal function to obtain a nested property in `obj` along `path`.
function deepGet(obj, path) {
var length = path.length;
for (var i = 0; i < length; i++) {
if (obj == null) return void 0;
obj = obj[path[i]];
}
return length ? obj : void 0;
}
// Get the value of the (deep) property on `path` from `object`.
// If any property in `path` does not exist or if the value is
// `undefined`, return `defaultValue` instead.
// The `path` is normalized through `_.toPath`.
function get(object, path, defaultValue) {
var value = deepGet(object, toPath(path));
return isUndefined(value) ? defaultValue : value;
}
// Shortcut function for checking if an object has a given property directly on
// itself (in other words, not on a prototype). Unlike the internal `has`
// function, this public version can also traverse nested properties.
function has(obj, path) {
path = toPath(path);
var length = path.length;
for (var i = 0; i < length; i++) {
var key = path[i];
if (!has$1(obj, key)) return false;
obj = obj[key];
}
return !!length;
}
// Keep the identity function around for default iteratees.
function identity(value) {
return value;
}
// Returns a predicate for checking whether an object has a given set of
// `key:value` pairs.
function matcher(attrs) {
attrs = extendOwn({}, attrs);
return function (obj) {
return isMatch(obj, attrs);
};
}
// Creates a function that, when passed an object, will traverse that objectโs
// properties down the given `path`, specified as an array of keys or indices.
function property(path) {
path = toPath(path);
return function (obj) {
return deepGet(obj, path);
};
}
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
// functions.
function optimizeCb(func, context, argCount) {
if (context === void 0) return func;
switch (argCount == null ? 3 : argCount) {
case 1:
return function (value) {
return func.call(context, value);
};
// The 2-argument case is omitted because weโre not using it.
case 3:
return function (value, index, collection) {
return func.call(context, value, index, collection);
};
case 4:
return function (accumulator, value, index, collection) {
return func.call(context, accumulator, value, index, collection);
};
}
return function () {
return func.apply(context, arguments);
};
}
// An internal function to generate callbacks that can be applied to each
// element in a collection, returning the desired result โ either `_.identity`,
// an arbitrary callback, a property matcher, or a property accessor.
function baseIteratee(value, context, argCount) {
if (value == null) return identity;
if (isFunction$1$1(value)) return optimizeCb(value, context, argCount);
if (isObject(value) && !isArray(value)) return matcher(value);
return property(value);
}
// External wrapper for our callback generator. Users may customize
// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
// This abstraction hides the internal-only `argCount` argument.
function iteratee(value, context) {
return baseIteratee(value, context, Infinity);
}
_$1.iteratee = iteratee;
// The function we call internally to generate a callback. It invokes
// `_.iteratee` if overridden, otherwise `baseIteratee`.
function cb(value, context, argCount) {
if (_$1.iteratee !== iteratee) return _$1.iteratee(value, context);
return baseIteratee(value, context, argCount);
}
// Returns the results of applying the `iteratee` to each element of `obj`.
// In contrast to `_.map` it returns an object.
function mapObject(obj, iteratee, context) {
iteratee = cb(iteratee, context);
var _keys = keys(obj),
length = _keys.length,
results = {};
for (var index = 0; index < length; index++) {
var currentKey = _keys[index];
results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
}
return results;
}
// Predicate-generating function. Often useful outside of Underscore.
function noop() {}
// Generates a function for a given object that returns a given property.
function propertyOf(obj) {
if (obj == null) return noop;
return function (path) {
return get(obj, path);
};
}
// Run a function **n** times.
function times(n, iteratee, context) {
var accum = Array(Math.max(0, n));
iteratee = optimizeCb(iteratee, context, 1);
for (var i = 0; i < n; i++) accum[i] = iteratee(i);
return accum;
}
// Return a random integer between `min` and `max` (inclusive).
function random(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.floor(Math.random() * (max - min + 1));
}
// A (possibly faster) way to get the current timestamp as an integer.
var now =
Date.now ||
function () {
return new Date().getTime();
};
// Internal helper to generate functions for escaping and unescaping strings
// to/from HTML interpolation.
function createEscaper(map) {
var escaper = function (match) {
return map[match];
};
// Regexes for identifying a key that needs to be escaped.
var source = "(?:" + keys(map).join("|") + ")";
var testRegexp = RegExp(source);
var replaceRegexp = RegExp(source, "g");
return function (string) {
string = string == null ? "" : "" + string;
return testRegexp.test(string)
? string.replace(replaceRegexp, escaper)
: string;
};
}
// Internal list of HTML entities for escaping.
var escapeMap = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
"`": "`",
};
// Function for escaping strings to HTML interpolation.
var _escape = createEscaper(escapeMap);
// Internal list of HTML entities for unescaping.
var unescapeMap = invert(escapeMap);
// Function for unescaping strings from HTML interpolation.
var _unescape = createEscaper(unescapeMap);
// By default, Underscore uses ERB-style template delimiters. Change the
// following template settings to use alternative delimiters.
var templateSettings = (_$1.templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g,
});
// When customizing `_.templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
var noMatch = /(.)^/;
// Certain characters need to be escaped so that they can be put into a
// string literal.
var escapes = {
"'": "'",
"\\": "\\",
"\r": "r",
"\n": "n",
"\u2028": "u2028",
"\u2029": "u2029",
};
var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
function escapeChar(match) {
return "\\" + escapes[match];
}
// In order to prevent third-party code injection through
// `_.templateSettings.variable`, we test it against the following regular
// expression. It is intentionally a bit more liberal than just matching valid
// identifiers, but still prevents possible loopholes through defaults or
// destructuring assignment.
var bareIdentifier = /^\s*(\w|\$)+\s*$/;
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
// NB: `oldSettings` only exists for backwards compatibility.
function template(text, settings, oldSettings) {
if (!settings && oldSettings) settings = oldSettings;
settings = defaults({}, settings, _$1.templateSettings);
// Combine delimiters into one regular expression via alternation.
var matcher = RegExp(
[
(settings.escape || noMatch).source,
(settings.interpolate || noMatch).source,
(settings.evaluate || noMatch).source,
].join("|") + "|$",
"g"
);
// Compile the template source, escaping string literals appropriately.
var index = 0;
var source = "__p+='";
text.replace(matcher, function (
match,
escape,
interpolate,
evaluate,
offset
) {
source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
index = offset + match.length;
if (escape) {
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
} else if (interpolate) {
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
} else if (evaluate) {
source += "';\n" + evaluate + "\n__p+='";
}
// Adobe VMs need the match returned to produce the correct offset.
return match;
});
source += "';\n";
var argument = settings.variable;
if (argument) {
// Insure against third-party code injection. (CVE-2021-23358)
if (!bareIdentifier.test(argument))
throw new Error("variable is not a bare identifier: " + argument);
} else {
// If a variable is not specified, place data values in local scope.
source = "with(obj||{}){\n" + source + "}\n";
argument = "obj";
}
source =
"var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" +
source +
"return __p;\n";
var render;
try {
render = new Function(argument, "_", source);
} catch (e) {
e.source = source;
throw e;
}
var template = function (data) {
return render.call(this, data, _$1);
};
// Provide the compiled source as a convenience for precompilation.
template.source = "function(" + argument + "){\n" + source + "}";
return template;
}
// Traverses the children of `obj` along `path`. If a child is a function, it
// is invoked with its parent as context. Returns the value of the final
// child, or `fallback` if any child is undefined.
function result(obj, path, fallback) {
path = toPath(path);
var length = path.length;
if (!length) {
return isFunction$1$1(fallback) ? fallback.call(obj) : fallback;
}
for (var i = 0; i < length; i++) {
var prop = obj == null ? void 0 : obj[path[i]];
if (prop === void 0) {
prop = fallback;
i = length; // Ensure we don't continue iterating.
}
obj = isFunction$1$1(prop) ? prop.call(obj) : prop;
}
return obj;
}
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
function uniqueId(prefix) {
var id = ++idCounter + "";
return prefix ? prefix + id : id;
}
// Start chaining a wrapped Underscore object.
function chain(obj) {
var instance = _$1(obj);
instance._chain = true;
return instance;
}
// Internal function to execute `sourceFunc` bound to `context` with optional
// `args`. Determines whether to execute a function as a constructor or as a
// normal function.
function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
if (!(callingContext instanceof boundFunc))
return sourceFunc.apply(context, args);
var self = baseCreate(sourceFunc.prototype);
var result = sourceFunc.apply(self, args);
if (isObject(result)) return result;
return self;
}
// Partially apply a function by creating a version that has had some of its
// arguments pre-filled, without changing its dynamic `this` context. `_` acts
// as a placeholder by default, allowing any combination of arguments to be
// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
var partial = restArguments(function (func, boundArgs) {
var placeholder = partial.placeholder;
var bound = function () {
var position = 0,
length = boundArgs.length;
var args = Array(length);
for (var i = 0; i < length; i++) {
args[i] =
boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
}
while (position < arguments.length) args.push(arguments[position++]);
return executeBound(func, bound, this, this, args);
};
return bound;
});
partial.placeholder = _$1;
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally).
var bind = restArguments(function (func, context, args) {
if (!isFunction$1$1(func))
throw new TypeError("Bind must be called on a function");
var bound = restArguments(function (callArgs) {
return executeBound(func, bound, context, this, args.concat(callArgs));
});
return bound;
});
// Internal helper for collection methods to determine whether a collection
// should be iterated as an array or as an object.
// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
var isArrayLike = createSizePropertyCheck(getLength);
// Internal implementation of a recursive `flatten` function.
function flatten$1(input, depth, strict, output) {
output = output || [];
if (!depth && depth !== 0) {
depth = Infinity;
} else if (depth <= 0) {
return output.concat(input);
}
var idx = output.length;
for (var i = 0, length = getLength(input); i < length; i++) {
var value = input[i];
if (isArrayLike(value) && (isArray(value) || isArguments$1(value))) {
// Flatten current level of array or arguments object.
if (depth > 1) {
flatten$1(value, depth - 1, strict, output);
idx = output.length;
} else {
var j = 0,
len = value.length;
while (j < len) output[idx++] = value[j++];
}
} else if (!strict) {
output[idx++] = value;
}
}
return output;
}
// Bind a number of an object's methods to that object. Remaining arguments
// are the method names to be bound. Useful for ensuring that all callbacks
// defined on an object belong to it.
var bindAll = restArguments(function (obj, keys) {
keys = flatten$1(keys, false, false);
var index = keys.length;
if (index < 1) throw new Error("bindAll must be passed function names");
while (index--) {
var key = keys[index];
obj[key] = bind(obj[key], obj);
}
return obj;
});
// Memoize an expensive function by storing its results.
function memoize(func, hasher) {
var memoize = function (key) {
var cache = memoize.cache;
var address = "" + (hasher ? hasher.apply(this, arguments) : key);
if (!has$1(cache, address)) cache[address] = func.apply(this, arguments);
return cache[address];
};
memoize.cache = {};
return memoize;
}
// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
var delay = restArguments(function (func, wait, args) {
return setTimeout(function () {
return func.apply(null, args);
}, wait);
});
// Defers a function, scheduling it to run after the current call stack has
// cleared.
var defer = partial(delay, _$1, 1);
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time. Normally, the throttled function will run
// as much as it can, without ever going more than once per `wait` duration;
// but if you'd like to disable the execution on the leading edge, pass
// `{leading: false}`. To disable execution on the trailing edge, ditto.
function throttle(func, wait, options) {
var timeout, context, args, result;
var previous = 0;
if (!options) options = {};
var later = function () {
previous = options.leading === false ? 0 : now();
timeout = null;
result = func.apply(context, args);
if (!timeout) context = args = null;
};
var throttled = function () {
var _now = now();
if (!previous && options.leading === false) previous = _now;
var remaining = wait - (_now - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
previous = _now;
result = func.apply(context, args);
if (!timeout) context = args = null;
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining);
}
return result;
};
throttled.cancel = function () {
clearTimeout(timeout);
previous = 0;
timeout = context = args = null;
};
return throttled;
}
// When a sequence of calls of the returned function ends, the argument
// function is triggered. The end of a sequence is defined by the `wait`
// parameter. If `immediate` is passed, the argument function will be
// triggered at the beginning of the sequence instead of at the end.
function debounce(func, wait, immediate) {
var timeout, previous, args, result, context;
var later = function () {
var passed = now() - previous;
if (wait > passed) {
timeout = setTimeout(later, wait - passed);
} else {
timeout = null;
if (!immediate) result = func.apply(context, args);
// This check is needed because `func` can recursively invoke `debounced`.
if (!timeout) args = context = null;
}
};
var debounced = restArguments(function (_args) {
context = this;
args = _args;
previous = now();
if (!timeout) {
timeout = setTimeout(later, wait);
if (immediate) result = func.apply(context, args);
}
return result;
});
debounced.cancel = function () {
clearTimeout(timeout);
timeout = args = context = null;
};
return debounced;
}
// Returns the first function passed as an argument to the second,
// allowing you to adjust arguments, run code before and after, and
// conditionally execute the original function.
function wrap(func, wrapper) {
return partial(wrapper, func);
}
// Returns a negated version of the passed-in predicate.
function negate(predicate) {
return function () {
return !predicate.apply(this, arguments);
};
}
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
function compose() {
var args = arguments;
var start = args.length - 1;
return function () {
var i = start;
var result = args[start].apply(this, arguments);
while (i--) result = args[i].call(this, result);
return result;
};
}
// Returns a function that will only be executed on and after the Nth call.
function after(times, func) {
return function () {
if (--times < 1) {
return func.apply(this, arguments);
}
};
}
// Returns a function that will only be executed up to (but not including) the
// Nth call.
function before(times, func) {
var memo;
return function () {
if (--times > 0) {
memo = func.apply(this, arguments);
}
if (times <= 1) func = null;
return memo;
};
}
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
var once = partial(before, 2);
// Returns the first key on an object that passes a truth test.
function findKey(obj, predicate, context) {
predicate = cb(predicate, context);
var _keys = keys(obj),
key;
for (var i = 0, length = _keys.length; i < length; i++) {
key = _keys[i];
if (predicate(obj[key], key, obj)) return key;
}
}
// Internal function to generate `_.findIndex` and `_.findLastIndex`.
function createPredicateIndexFinder(dir) {
return function (array, predicate, context) {
predicate = cb(predicate, context);
var length = getLength(array);
var index = dir > 0 ? 0 : length - 1;
for (; index >= 0 && index < length; index += dir) {
if (predicate(array[index], index, array)) return index;
}
return -1;
};
}
// Returns the first index on an array-like that passes a truth test.
var findIndex = createPredicateIndexFinder(1);
// Returns the last index on an array-like that passes a truth test.
var findLastIndex = createPredicateIndexFinder(-1);
// Use a comparator function to figure out the smallest index at which
// an object should be inserted so as to maintain order. Uses binary search.
function sortedIndex(array, obj, iteratee, context) {
iteratee = cb(iteratee, context, 1);
var value = iteratee(obj);
var low = 0,
high = getLength(array);
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (iteratee(array[mid]) < value) low = mid + 1;
else high = mid;
}
return low;
}
// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
function createIndexFinder(dir, predicateFind, sortedIndex) {
return function (array, item, idx) {
var i = 0,
length = getLength(array);
if (typeof idx == "number") {
if (dir > 0) {
i = idx >= 0 ? idx : Math.max(idx + length, i);
} else {
length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
}
} else if (sortedIndex && idx && length) {
idx = sortedIndex(array, item);
return array[idx] === item ? idx : -1;
}
if (item !== item) {
idx = predicateFind(slice.call(array, i, length), isNaN$1);
return idx >= 0 ? idx + i : -1;
}
for (
idx = dir > 0 ? i : length - 1;
idx >= 0 && idx < length;
idx += dir
) {
if (array[idx] === item) return idx;
}
return -1;
};
}
// Return the position of the first occurrence of an item in an array,
// or -1 if the item is not included in the array.
// If the array is large and already in sort order, pass `true`
// for **isSorted** to use binary search.
var indexOf = createIndexFinder(1, findIndex, sortedIndex);
// Return the position of the last occurrence of an item in an array,
// or -1 if the item is not included in the array.
var lastIndexOf = createIndexFinder(-1, findLastIndex);
// Return the first value which passes a truth test.
function find(obj, predicate, context) {
var keyFinder = isArrayLike(obj) ? findIndex : findKey;
var key = keyFinder(obj, predicate, context);
if (key !== void 0 && key !== -1) return obj[key];
}
// Convenience version of a common use case of `_.find`: getting the first
// object containing specific `key:value` pairs.
function findWhere(obj, attrs) {
return find(obj, matcher(attrs));
}
// The cornerstone for collection functions, an `each`
// implementation, aka `forEach`.
// Handles raw objects in addition to array-likes. Treats all
// sparse array-likes as if they were dense.
function each(obj, iteratee, context) {
iteratee = optimizeCb(iteratee, context);
var i, length;
if (isArrayLike(obj)) {
for (i = 0, length = obj.length; i < length; i++) {
iteratee(obj[i], i, obj);
}
} else {
var _keys = keys(obj);
for (i = 0, length = _keys.length; i < length; i++) {
iteratee(obj[_keys[i]], _keys[i], obj);
}
}
return obj;
}
// Return the results of applying the iteratee to each element.
function map(obj, iteratee, context) {
iteratee = cb(iteratee, context);
var _keys = !isArrayLike(obj) && keys(obj),
length = (_keys || obj).length,
results = Array(length);
for (var index = 0; index < length; index++) {
var currentKey = _keys ? _keys[index] : index;
results[index] = iteratee(obj[currentKey], currentKey, obj);
}
return results;
}
// Internal helper to create a reducing function, iterating left or right.
function createReduce(dir) {
// Wrap code that reassigns argument variables in a separate function than
// the one that accesses `arguments.length` to avoid a perf hit. (#1991)
var reducer = function (obj, iteratee, memo, initial) {
var _keys = !isArrayLike(obj) && keys(obj),
length = (_keys || obj).length,
index = dir > 0 ? 0 : length - 1;
if (!initial) {
memo = obj[_keys ? _keys[index] : index];
index += dir;
}
for (; index >= 0 && index < length; index += dir) {
var currentKey = _keys ? _keys[index] : index;
memo = iteratee(memo, obj[currentKey], currentKey, obj);
}
return memo;
};
return function (obj, iteratee, memo, context) {
var initial = arguments.length >= 3;
return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial);
};
}
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`.
var reduce = createReduce(1);
// The right-associative version of reduce, also known as `foldr`.
var reduceRight = createReduce(-1);
// Return all the elements that pass a truth test.
function filter(obj, predicate, context) {
var results = [];
predicate = cb(predicate, context);
each(obj, function (value, index, list) {
if (predicate(value, index, list)) results.push(value);
});
return results;
}
// Return all the elements for which a truth test fails.
function reject(obj, predicate, context) {
return filter(obj, negate(cb(predicate)), context);
}
// Determine whether all of the elements pass a truth test.
function every(obj, predicate, context) {
predicate = cb(predicate, context);
var _keys = !isArrayLike(obj) && keys(obj),
length = (_keys || obj).length;
for (var index = 0; index < length; index++) {
var currentKey = _keys ? _keys[index] : index;
if (!predicate(obj[currentKey], currentKey, obj)) return false;
}
return true;
}
// Determine if at least one element in the object passes a truth test.
function some(obj, predicate, context) {
predicate = cb(predicate, context);
var _keys = !isArrayLike(obj) && keys(obj),
length = (_keys || obj).length;
for (var index = 0; index < length; index++) {
var currentKey = _keys ? _keys[index] : index;
if (predicate(obj[currentKey], currentKey, obj)) return true;
}
return false;
}
// Determine if the array or object contains a given item (using `===`).
function contains(obj, item, fromIndex, guard) {
if (!isArrayLike(obj)) obj = values(obj);
if (typeof fromIndex != "number" || guard) fromIndex = 0;
return indexOf(obj, item, fromIndex) >= 0;
}
// Invoke a method (with arguments) on every item in a collection.
var invoke = restArguments(function (obj, path, args) {
var contextPath, func;
if (isFunction$1$1(path)) {
func = path;
} else {
path = toPath(path);
contextPath = path.slice(0, -1);
path = path[path.length - 1];
}
return map(obj, function (context) {
var method = func;
if (!method) {
if (contextPath && contextPath.length) {
context = deepGet(context, contextPath);
}
if (context == null) return void 0;
method = context[path];
}
return method == null ? method : method.apply(context, args);
});
});
// Convenience version of a common use case of `_.map`: fetching a property.
function pluck(obj, key) {
return map(obj, property(key));
}
// Convenience version of a common use case of `_.filter`: selecting only
// objects containing specific `key:value` pairs.
function where(obj, attrs) {
return filter(obj, matcher(attrs));
}
// Return the maximum element (or element-based computation).
function max(obj, iteratee, context) {
var result = -Infinity,
lastComputed = -Infinity,
value,
computed;
if (
iteratee == null ||
(typeof iteratee == "number" && typeof obj[0] != "object" && obj != null)
) {
obj = isArrayLike(obj) ? obj : values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
if (value != null && value > result) {
result = value;
}
}
} else {
iteratee = cb(iteratee, context);
each(obj, function (v, index, list) {
computed = iteratee(v, index, list);
if (
computed > lastComputed ||
(computed === -Infinity && result === -Infinity)
) {
result = v;
lastComputed = computed;
}
});
}
return result;
}
// Return the minimum element (or element-based computation).
function min(obj, iteratee, context) {
var result = Infinity,
lastComputed = Infinity,
value,
computed;
if (
iteratee == null ||
(typeof iteratee == "number" && typeof obj[0] != "object" && obj != null)
) {
obj = isArrayLike(obj) ? obj : values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
if (value != null && value < result) {
result = value;
}
}
} else {
iteratee = cb(iteratee, context);
each(obj, function (v, index, list) {
computed = iteratee(v, index, list);
if (
computed < lastComputed ||
(computed === Infinity && result === Infinity)
) {
result = v;
lastComputed = computed;
}
});
}
return result;
}
// Sample **n** random values from a collection using the modern version of the
// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/FisherโYates_shuffle).
// If **n** is not specified, returns a single random element.
// The internal `guard` argument allows it to work with `_.map`.
function sample(obj, n, guard) {
if (n == null || guard) {
if (!isArrayLike(obj)) obj = values(obj);
return obj[random(obj.length - 1)];
}
var sample = isArrayLike(obj) ? clone(obj) : values(obj);
var length = getLength(sample);
n = Math.max(Math.min(n, length), 0);
var last = length - 1;
for (var index = 0; index < n; index++) {
var rand = random(index, last);
var temp = sample[index];
sample[index] = sample[rand];
sample[rand] = temp;
}
return sample.slice(0, n);
}
// Shuffle a collection.
function shuffle(obj) {
return sample(obj, Infinity);
}
// Sort the object's values by a criterion produced by an iteratee.
function sortBy(obj, iteratee, context) {
var index = 0;
iteratee = cb(iteratee, context);
return pluck(
map(obj, function (value, key, list) {
return {
value: value,
index: index++,
criteria: iteratee(value, key, list),
};
}).sort(function (left, right) {
var a = left.criteria;
var b = right.criteria;
if (a !== b) {
if (a > b || a === void 0) return 1;
if (a < b || b === void 0) return -1;
}
return left.index - right.index;
}),
"value"
);
}
// An internal function used for aggregate "group by" operations.
function group(behavior, partition) {
return function (obj, iteratee, context) {
var result = partition ? [[], []] : {};
iteratee = cb(iteratee, context);
each(obj, function (value, index) {
var key = iteratee(value, index, obj);
behavior(result, value, key);
});
return result;
};
}
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
var groupBy = group(function (result, value, key) {
if (has$1(result, key)) result[key].push(value);
else result[key] = [value];
});
// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
// when you know that your index values will be unique.
var indexBy = group(function (result, value, key) {
result[key] = value;
});
// Counts instances of an object that group by a certain criterion. Pass
// either a string attribute to count by, or a function that returns the
// criterion.
var countBy = group(function (result, value, key) {
if (has$1(result, key)) result[key]++;
else result[key] = 1;
});
// Split a collection into two arrays: one whose elements all pass the given
// truth test, and one whose elements all do not pass the truth test.
var partition = group(function (result, value, pass) {
result[pass ? 0 : 1].push(value);
}, true);
// Safely create a real, live array from anything iterable.
var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
function toArray(obj) {
if (!obj) return [];
if (isArray(obj)) return slice.call(obj);
if (isString$1(obj)) {
// Keep surrogate pair characters together.
return obj.match(reStrSymbol);
}
if (isArrayLike(obj)) return map(obj, identity);
return values(obj);
}
// Return the number of elements in a collection.
function size(obj) {
if (obj == null) return 0;
return isArrayLike(obj) ? obj.length : keys(obj).length;
}
// Internal `_.pick` helper function to determine whether `key` is an enumerable
// property name of `obj`.
function keyInObj(value, key, obj) {
return key in obj;
}
// Return a copy of the object only containing the allowed properties.
var pick = restArguments(function (obj, keys) {
var result = {},
iteratee = keys[0];
if (obj == null) return result;
if (isFunction$1$1(iteratee)) {
if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]);
keys = allKeys(obj);
} else {
iteratee = keyInObj;
keys = flatten$1(keys, false, false);
obj = Object(obj);
}
for (var i = 0, length = keys.length; i < length; i++) {
var key = keys[i];
var value = obj[key];
if (iteratee(value, key, obj)) result[key] = value;
}
return result;
});
// Return a copy of the object without the disallowed properties.
var omit = restArguments(function (obj, keys) {
var iteratee = keys[0],
context;
if (isFunction$1$1(iteratee)) {
iteratee = negate(iteratee);
if (keys.length > 1) context = keys[1];
} else {
keys = map(flatten$1(keys, false, false), String);
iteratee = function (value, key) {
return !contains(keys, key);
};
}
return pick(obj, iteratee, context);
});
// Returns everything but the last entry of the array. Especially useful on
// the arguments object. Passing **n** will return all the values in
// the array, excluding the last N.
function initial(array, n, guard) {
return slice.call(
array,
0,
Math.max(0, array.length - (n == null || guard ? 1 : n))
);
}
// Get the first element of an array. Passing **n** will return the first N
// values in the array. The **guard** check allows it to work with `_.map`.
function first(array, n, guard) {
if (array == null || array.length < 1)
return n == null || guard ? void 0 : [];
if (n == null || guard) return array[0];
return initial(array, array.length - n);
}
// Returns everything but the first entry of the `array`. Especially useful on
// the `arguments` object. Passing an **n** will return the rest N values in the
// `array`.
function rest(array, n, guard) {
return slice.call(array, n == null || guard ? 1 : n);
}
// Get the last element of an array. Passing **n** will return the last N
// values in the array.
function last(array, n, guard) {
if (array == null || array.length < 1)
return n == null || guard ? void 0 : [];
if (n == null || guard) return array[array.length - 1];
return rest(array, Math.max(0, array.length - n));
}
// Trim out all falsy values from an array.
function compact(array) {
return filter(array, Boolean);
}
// Flatten out an array, either recursively (by default), or up to `depth`.
// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
function flatten(array, depth) {
return flatten$1(array, depth, false);
}
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
var difference = restArguments(function (array, rest) {
rest = flatten$1(rest, true, true);
return filter(array, function (value) {
return !contains(rest, value);
});
});
// Return a version of the array that does not contain the specified value(s).
var without = restArguments(function (array, otherArrays) {
return difference(array, otherArrays);
});
// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// The faster algorithm will not work with an iteratee if the iteratee
// is not a one-to-one function, so providing an iteratee will disable
// the faster algorithm.
function uniq(array, isSorted, iteratee, context) {
if (!isBoolean$1(isSorted)) {
context = iteratee;
iteratee = isSorted;
isSorted = false;
}
if (iteratee != null) iteratee = cb(iteratee, context);
var result = [];
var seen = [];
for (var i = 0, length = getLength(array); i < length; i++) {
var value = array[i],
computed = iteratee ? iteratee(value, i, array) : value;
if (isSorted && !iteratee) {
if (!i || seen !== computed) result.push(value);
seen = computed;
} else if (iteratee) {
if (!contains(seen, computed)) {
seen.push(computed);
result.push(value);
}
} else if (!contains(result, value)) {
result.push(value);
}
}
return result;
}
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
var union = restArguments(function (arrays) {
return uniq(flatten$1(arrays, true, true));
});
// Produce an array that contains every item shared between all the
// passed-in arrays.
function intersection(array) {
var result = [];
var argsLength = arguments.length;
for (var i = 0, length = getLength(array); i < length; i++) {
var item = array[i];
if (contains(result, item)) continue;
var j;
for (j = 1; j < argsLength; j++) {
if (!contains(arguments[j], item)) break;
}
if (j === argsLength) result.push(item);
}
return result;
}
// Complement of zip. Unzip accepts an array of arrays and groups
// each array's elements on shared indices.
function unzip(array) {
var length = (array && max(array, getLength).length) || 0;
var result = Array(length);
for (var index = 0; index < length; index++) {
result[index] = pluck(array, index);
}
return result;
}
// Zip together multiple lists into a single array -- elements that share
// an index go together.
var zip = restArguments(unzip);
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
function object(list, values) {
var result = {};
for (var i = 0, length = getLength(list); i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
}
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](https://docs.python.org/library/functions.html#range).
function range(start, stop, step) {
if (stop == null) {
stop = start || 0;
start = 0;
}
if (!step) {
step = stop < start ? -1 : 1;
}
var length = Math.max(Math.ceil((stop - start) / step), 0);
var range = Array(length);
for (var idx = 0; idx < length; idx++, start += step) {
range[idx] = start;
}
return range;
}
// Chunk a single array into multiple arrays, each containing `count` or fewer
// items.
function chunk(array, count) {
if (count == null || count < 1) return [];
var result = [];
var i = 0,
length = array.length;
while (i < length) {
result.push(slice.call(array, i, (i += count)));
}
return result;
}
// Helper function to continue chaining intermediate results.
function chainResult(instance, obj) {
return instance._chain ? _$1(obj).chain() : obj;
}
// Add your own custom functions to the Underscore object.
function mixin(obj) {
each(functions(obj), function (name) {
var func = (_$1[name] = obj[name]);
_$1.prototype[name] = function () {
var args = [this._wrapped];
push.apply(args, arguments);
return chainResult(this, func.apply(_$1, args));
};
});
return _$1;
}
// Add all mutator `Array` functions to the wrapper.
each(
["pop", "push", "reverse", "shift", "sort", "splice", "unshift"],
function (name) {
var method = ArrayProto[name];
_$1.prototype[name] = function () {
var obj = this._wrapped;
if (obj != null) {
method.apply(obj, arguments);
if ((name === "shift" || name === "splice") && obj.length === 0) {
delete obj[0];
}
}
return chainResult(this, obj);
};
}
);
// Add all accessor `Array` functions to the wrapper.
each(["concat", "join", "slice"], function (name) {
var method = ArrayProto[name];
_$1.prototype[name] = function () {
var obj = this._wrapped;
if (obj != null) obj = method.apply(obj, arguments);
return chainResult(this, obj);
};
});
// Named Exports
var allExports = {
__proto__: null,
VERSION: VERSION,
restArguments: restArguments,
isObject: isObject,
isNull: isNull,
isUndefined: isUndefined,
isBoolean: isBoolean$1,
isElement: isElement,
isString: isString$1,
isNumber: isNumber$2,
isDate: isDate,
isRegExp: isRegExp,
isError: isError,
isSymbol: isSymbol$1,
isArrayBuffer: isArrayBuffer,
isDataView: isDataView$1,
isArray: isArray,
isFunction: isFunction$1$1,
isArguments: isArguments$1,
isFinite: isFinite$1,
isNaN: isNaN$1,
isTypedArray: isTypedArray$1,
isEmpty: isEmpty,
isMatch: isMatch,
isEqual: isEqual,
isMap: isMap,
isWeakMap: isWeakMap,
isSet: isSet,
isWeakSet: isWeakSet,
keys: keys,
allKeys: allKeys,
values: values,
pairs: pairs,
invert: invert,
functions: functions,
methods: functions,
extend: extend,
extendOwn: extendOwn,
assign: extendOwn,
defaults: defaults,
create: create,
clone: clone,
tap: tap,
get: get,
has: has,
mapObject: mapObject,
identity: identity,
constant: constant,
noop: noop,
toPath: toPath$1,
property: property,
propertyOf: propertyOf,
matcher: matcher,
matches: matcher,
times: times,
random: random,
now: now,
escape: _escape,
unescape: _unescape,
templateSettings: templateSettings,
template: template,
result: result,
uniqueId: uniqueId,
chain: chain,
iteratee: iteratee,
partial: partial,
bind: bind,
bindAll: bindAll,
memoize: memoize,
delay: delay,
defer: defer,
throttle: throttle,
debounce: debounce,
wrap: wrap,
negate: negate,
compose: compose,
after: after,
before: before,
once: once,
findKey: findKey,
findIndex: findIndex,
findLastIndex: findLastIndex,
sortedIndex: sortedIndex,
indexOf: indexOf,
lastIndexOf: lastIndexOf,
find: find,
detect: find,
findWhere: findWhere,
each: each,
forEach: each,
map: map,
collect: map,
reduce: reduce,
foldl: reduce,
inject: reduce,
reduceRight: reduceRight,
foldr: reduceRight,
filter: filter,
select: filter,
reject: reject,
every: every,
all: every,
some: some,
any: some,
contains: contains,
includes: contains,
include: contains,
invoke: invoke,
pluck: pluck,
where: where,
max: max,
min: min,
shuffle: shuffle,
sample: sample,
sortBy: sortBy,
groupBy: groupBy,
indexBy: indexBy,
countBy: countBy,
partition: partition,
toArray: toArray,
size: size,
pick: pick,
omit: omit,
first: first,
head: first,
take: first,
initial: initial,
last: last,
rest: rest,
tail: rest,
drop: rest,
compact: compact,
flatten: flatten,
without: without,
uniq: uniq,
unique: uniq,
union: union,
intersection: intersection,
difference: difference,
unzip: unzip,
transpose: unzip,
zip: zip,
object: object,
range: range,
chunk: chunk,
mixin: mixin,
default: _$1,
};
// Default Export
// Add all of the Underscore functions to the wrapper object.
var _ = mixin(allExports);
// Legacy Node.js API.
_._ = _;
//
// Super-simple class implementation
//
// Example usage:
//
// BiwaScheme.Foo = BiwaScheme.Class.create({
// initialize: function(a){
// this.a = a;
// },
//
// toString: function(){
// return "foo[" + this.a + "]";
// }
// });
//
// BiwaScheme.Bar = BiwaScheme.Class.extend(new BiwaScheme.Foo("hello1"), {
// initialize: function(b){
// this.b = b;
// },
//
// printEverything: function(){
// console.log("a = ", this.a, "b = ", this.b);
// },
//
// toString: function(){
// return "bar[" + this.b + "]";
// }
// });
const Class = {
create: function (methods) {
var klass = function () {
this.initialize.apply(this, arguments);
};
extend(klass.prototype, methods);
return klass;
},
extend: function (parent, methods) {
var klass = function () {
this.initialize.apply(this, arguments);
};
klass.prototype = parent;
extend(klass.prototype, methods);
return klass;
},
};
// Update the given method to memoized version.
//
// - klass : a class defined by BiwaScheme.Class.create
// - name_or_names : method name (a string or an array of strings)
//
// Example
//
// // Given this method
// BiwaScheme.Enumeration.EnumType = ...
// universe: function(){
// return ...
// }
// ...
// // Memoize
// BiwaScheme.Class.memoize(BiwaScheme.Enumeration.EnumType,
// "_universe");
//
// // Equal to:
// BiwaScheme.Enumeration.EnumType = ...
// universe: function(){
// if(!this.hasOwnProperty("cached_universe")){
// this.cached_universe = this.compute_universe();
// }
// return this.cached_universe;
// },
// compute_universe: function(){
// // Original function, renamed to compute_*
// return ...
// }
// ...
Class.memoize = function (klass, name_or_names) {
var proto = klass.prototype;
var names = isArray(name_or_names) ? name_or_names : [name_or_names];
each(names, function (name) {
// Copy original function foo as 'compute_foo'
proto["compute_" + name] = proto[name];
// Define memoizing version
proto[name] = function (/*arguments*/) {
if (!this.hasOwnProperty("cached_" + name)) {
this["cached_" + name] = this["compute_" + name].apply(
this,
toArray(arguments)
);
}
return this["cached_" + name];
};
});
};
//
// Symbol
//
const Symbols = {};
const BiwaSymbol = Class.create({
initialize: function (str) {
this.name = str;
Symbols[str] = this;
},
inspect: function () {
return "'" + this.name;
//return "#<Symbol '"+this.name+"'>";
},
toString: function () {
return "'" + this.name;
},
to_write: function () {
return this.name;
},
});
const Sym = function (name, leaveCase) {
if (Symbols[name] === undefined) {
return new BiwaSymbol(name);
} else if (!(Symbols[name] instanceof BiwaSymbol)) {
//pre-defined member (like 'eval' in Firefox)
return new BiwaSymbol(name);
} else {
return Symbols[name];
}
};
const gensym = function () {
return Sym(uniqueId("__gensym"));
};
//
// Errors
//
const BiwaError = Class.create({
initialize: function (msg, form = null) {
const info = form === null ? "" : `: ${to_write$1(form)}`;
this.message = `Error: ${msg}${info}`;
this.form = form;
},
toString: function () {
return this.message;
},
});
const Bug = Class.extend(new BiwaError(), {
initialize: function (msg) {
this.message = "[BUG] " + msg;
},
});
// currently used by "raise"
const UserError = Class.extend(new BiwaError(), {
initialize: function (msg) {
this.message = msg;
},
});
//
// Set - set of string
// contents must be string (or at least sortable)
//
const BiwaSet = Class.create({
initialize: function (/*args*/) {
this.arr = [];
var i;
for (i = 0; i < arguments.length; i++) this.arr[i] = arguments[i];
},
equals: function (other) {
if (this.arr.length != other.arr.length) return false;
var a1 = clone(this.arr);
var a2 = clone(other.arr);
a1.sort();
a2.sort();
for (var i = 0; i < this.arr.length; i++) {
if (a1[i] != a2[i]) return false;
}
return true;
},
set_cons: function (item) {
var o = new BiwaSet(item);
o.arr = clone(this.arr);
o.arr.push(item);
return o;
},
set_union: function (/*args*/) {
var o = new BiwaSet();
o.arr = clone(this.arr);
for (var k = 0; k < arguments.length; k++) {
var s2 = arguments[k];
if (!(s2 instanceof BiwaSet))
throw new BiwaError("set_union: arguments must be a set");
for (var i = 0; i < s2.arr.length; i++) o.add(s2.arr[i]);
}
return o;
},
set_intersect: function (s2) {
if (!(s2 instanceof BiwaSet))
throw new BiwaError("set_intersect: arguments must be a set");
var o = new BiwaSet();
for (var i = 0; i < this.arr.length; i++)
if (s2.member(this.arr[i])) o.add(this.arr[i]);
return o;
},
set_minus: function (s2) {
if (!(s2 instanceof BiwaSet))
throw new BiwaError("set_minus: arguments must be a set");
var o = new BiwaSet();
for (var i = 0; i < this.arr.length; i++)
if (!s2.member(this.arr[i])) o.add(this.arr[i]);
return o;
},
add: function (item) {
if (!this.member(item)) {
this.arr.push(item);
}
},
member: function (item) {
for (var i = 0; i < this.arr.length; i++)
if (this.arr[i] == item) return true;
return false;
},
rindex: function (item) {
for (var i = this.arr.length - 1; i >= 0; i--)
if (this.arr[i] == item) return this.arr.length - 1 - i;
return null;
},
index: function (item) {
for (var i = 0; i < this.arr.length; i++)
if (this.arr[i] == item) return i;
return null;
},
inspect: function () {
return "Set(" + this.arr.join(", ") + ")";
},
toString: function () {
return this.inspect();
},
size: function () {
return this.arr.length;
},
});
//
// Pair
// cons cell
//
const Pair = Class.create({
initialize: function (car, cdr) {
this.car = car;
this.cdr = cdr;
},
caar: function () {
return this.car.car;
},
cadr: function () {
return this.cdr.car;
},
cdar: function () {
return this.cdr.car;
},
cddr: function () {
return this.cdr.cdr;
},
first: function () {
return this.car;
},
second: function () {
return this.cdr.car;
},
third: function () {
return this.cdr.cdr.car;
},
fourth: function () {
return this.cdr.cdr.cdr.car;
},
fifth: function () {
return this.cdr.cdr.cdr.cdr.car;
},
// returns array containing all the car's of list
// '(1 2 3) => [1,2,3]
// '(1 2 . 3) => [1,2]
to_array: function () {
var ary = [];
for (var o = this; o instanceof Pair; o = o.cdr) {
ary.push(o.car);
}
return ary;
},
to_set: function () {
var set = new BiwaSet();
for (var o = this; o instanceof Pair; o = o.cdr) {
set.add(o.car);
}
return set;
},
length: function () {
var n = 0;
for (var o = this; o instanceof Pair; o = o.cdr) {
n++;
}
return n;
},
// Return the last cdr
last_cdr: function () {
var o;
for (o = this; o instanceof Pair; o = o.cdr);
return o;
},
// calls the given func passing each car of list
// returns cdr of last Pair
forEach: function (func) {
for (var o = this; o instanceof Pair; o = o.cdr) {
func(o.car);
}
return o;
},
// Alias of `forEach` (for backward compatibility)
foreach: function (func) {
for (var o = this; o instanceof Pair; o = o.cdr) {
func(o.car);
}
return o;
},
// Returns an array which contains the resuls of calling func
// with the car's as an argument.
// If the receiver is not a proper list, the last cdr is ignored.
// The receiver must not be a cyclic list.
map: function (func) {
var ary = [];
for (var o = this; isPair(o); o = o.cdr) {
ary.push(func(o.car));
}
return ary;
},
// Returns a new list made by applying `func` to each element
mapList: function (func) {
return array_to_list(this.map(func));
},
// Destructively concat the given list to the receiver.
// The receiver must be a proper list.
// Returns the receiver.
concat: function (list) {
var o = this;
while (o instanceof Pair && o.cdr != nil) {
o = o.cdr;
}
o.cdr = list;
return this;
},
// returns human-redable string of pair
inspect: function (conv) {
conv || (conv = inspect);
var a = [];
var last = this.foreach(function (o) {
a.push(conv(o));
});
if (last != nil) {
a.push(".");
a.push(conv(last));
}
return "(" + a.join(" ") + ")";
},
toString: function () {
return this.inspect();
},
to_display: function (to_display) {
return this.inspect(to_display);
},
to_write: function () {
return this.inspect(to_write$1);
},
});
// Note: '() is not a pair in scheme
const isPair = function (obj) {
return obj instanceof Pair;
};
// Returns true if obj is a proper list
// Note: isList returns true for '()
const isList = function (obj) {
if (obj === nil) {
// Empty list
return true;
}
if (!(obj instanceof Pair)) {
// Argument isn't even a pair
return false;
}
var tortoise = obj;
var hare = obj.cdr;
while (true) {
if (hare === nil) {
// End of list
return true;
}
if (hare === tortoise) {
// Cycle
return false;
}
if (!(hare instanceof Pair)) {
// Improper list
return false;
}
if (hare.cdr === nil) {
// End of list
return true;
}
if (!(hare.cdr instanceof Pair)) {
// Improper list
return false;
}
hare = hare.cdr.cdr;
tortoise = tortoise.cdr;
}
};
// Creates a list out of the arguments, optionally converting any nested arrays into nested lists if the deep argument is true.
// Example:
// BiwaScheme.List(1, 2, [3, 4]) ;=> (list 1 2 (vector 3 4))
// BiwaScheme.deep_array_to_list(1, 2, [3, 4]) ;=> (list 1 2 (list 3 4))
const array_to_list_ = function (ary, deep) {
var list = nil;
for (var i = ary.length - 1; i >= 0; i--) {
var obj = ary[i];
if (deep && isArray(obj) && !obj.is_vector) {
obj = array_to_list_(obj, deep);
}
list = new Pair(obj, list);
}
return list;
};
// Shallow: List(1, 2, [3]) == (list 1 2 (vector 3 4))
const List = function () {
var ary = toArray(arguments);
return array_to_list_(ary, false);
};
// Shallow: array_to_list(1, 2, [3]) == (list 1 2 (vector 3 4))
const array_to_list = function (ary) {
return array_to_list_(ary, false);
};
// Deep: deep_array_to_list(1, 2, [3, 4]) == (list 1 2 (list 3 4))
// deep_array_to_list([1, 2, 3]) - deep
const deep_array_to_list = function (ary) {
return array_to_list_(ary, true);
};
const Cons = function (car, cdr) {
return new Pair(car, cdr);
};
const js_obj_to_alist = function (obj) {
if (obj === undefined) {
return nil;
}
var arr = [];
each(obj, function (val, key) {
arr.push(new Pair(key, val));
});
var alist = array_to_list(arr);
return alist;
};
const alist_to_js_obj = function (alist) {
if (alist === nil) {
return {};
}
var obj = {};
alist.foreach(function (item) {
obj[item.car] = item.cdr;
});
return obj;
};
//
// _writer.js: Functions to convert objects to strings
//
// Truncate long string with '...'
const truncate = function (str, length) {
const truncateStr = "...";
return str.length > length ? str.slice(0, length) + truncateStr : str;
};
//
// write
//
const write_simple = function (obj) {
if (obj === undefined) return "undefined";
else if (obj === null) return "null";
else if (isFunction$1$1(obj))
return (
"#<Function " +
(obj.fname
? obj.fname
: obj.toSource
? truncate(obj.toSource(), 40)
: "") +
">"
);
else if (isString$1(obj))
return (
'"' +
obj
.replace(/\\|\"/g, function ($0) {
return "\\" + $0;
})
.replace(/\x07/g, "\\a")
.replace(/\x08/g, "\\b")
.replace(/\t/g, "\\t")
.replace(/\n/g, "\\n")
.replace(/\v/g, "\\v")
.replace(/\f/g, "\\f")
.replace(/\r/g, "\\r") +
'"'
);
else if (isArray(obj))
return (
"#(" +
map(obj, function (e) {
return write_simple(e);
}).join(" ") +
")"
);
else if (typeof obj.to_write == "function") return obj.to_write();
else if (isNaN(obj) && typeof obj == "number") return "+nan.0";
else {
switch (obj) {
case true:
return "#t";
case false:
return "#f";
case Infinity:
return "+inf.0";
case -Infinity:
return "-inf.0";
}
}
return inspect(obj);
};
//
// display
//
const to_display = function (obj) {
if (isUndefined(obj)) return "undefined";
else if (isNull(obj)) return "null";
else if (obj.to_display) return obj.to_display(to_display);
else if (typeof obj.valueOf() == "string") return obj;
else if (obj instanceof BiwaSymbol) return obj.name;
else if (obj instanceof Array)
return "#(" + map(obj, to_display).join(" ") + ")";
else return write_simple(obj);
};
//
// inspect (for debugging)
//
const inspect = function (object, opts) {
try {
if (isUndefined(object)) return "undefined";
if (object === null) return "null";
if (object === true) return "#t";
if (object === false) return "#f";
if (object.inspect) return object.inspect();
if (isString$1(object)) {
return '"' + object.replace(/"/g, '\\"') + '"';
}
if (isArray(object)) {
return "[" + map(object, inspect).join(", ") + "]";
}
if (opts && opts["fallback"]) {
return opts["fallback"];
} else {
return object.toString();
}
} catch (e) {
if (e instanceof RangeError) return "...";
throw e;
}
};
//
// write/ss (write with substructure)
//
// Uses datum label if cyclic. Otherwise does not
function write(obj) {
const wstate = _preprocess(obj);
if (wstate.cyclic) {
return _write_shared(obj, wstate);
} else {
return write_simple(obj);
}
}
function _preprocess(obj) {
const state = {
objs: new Set(),
shared_objs: new Set(),
parents: new Set(),
cyclic: false,
};
_gather_information(obj, state);
// Create initial writer state
const ids = new Map();
for (const o of state.shared_objs) {
ids.set(o, null);
}
const wstate = {
ids: ids,
last_id: -1,
cyclic: state.cyclic,
};
return wstate;
}
function _gather_information(obj, state) {
if (state.parents.has(obj)) {
// Already seen and this is a cyclic object
state.cyclic = true;
}
if (state.shared_objs.has(obj)) {
return;
} else if (state.objs.has(obj)) {
state.shared_objs.add(obj);
return;
}
// Found a new object
state.objs.add(obj);
if (isPair(obj)) {
state.parents.add(obj);
_gather_information(obj.car, state);
_gather_information(obj.cdr, state);
state.parents.delete(obj);
} else if (isVector(obj)) {
state.parents.add(obj);
obj.forEach((item) => {
_gather_information(item, state);
});
state.parents.delete(obj);
}
}
// Always use datum label
function write_shared(obj) {
const wstate = _preprocess(obj);
return _write_shared(obj, wstate);
}
function _write_shared(obj, wstate) {
let s = "";
if (wstate.ids.has(obj)) {
const id = wstate.ids.get(obj);
if (id === null) {
// First occurrence of a shared object; Give it a number
const new_id = wstate.last_id + 1;
wstate.ids.set(obj, new_id);
wstate.last_id = new_id;
s += `#${new_id}=`;
} else {
// Already printed. Just show the reference
return `#${id}#`;
}
}
if (isPair(obj)) {
const a = [];
// Note that we cannot use obj.forEach (because it does not stop)
a.push(_write_shared(obj.car, wstate));
for (let o = obj.cdr; o !== nil; o = o.cdr) {
if (!isPair(o) || wstate.ids.has(o)) {
a.push(".");
a.push(_write_shared(o, wstate));
break;
}
a.push(_write_shared(o.car, wstate));
}
s += "(" + a.join(" ") + ")";
} else if (isVector(obj)) {
const a = obj.map((item) => _write_shared(item, wstate));
s += "#(" + a.join(" ") + ")";
} else {
s += write_simple(obj);
}
return s;
}
const to_write$1 = write;
//
// Char
//
const Chars = {};
const Char = Class.create({
initialize: function (c) {
Chars[(this.value = c)] = this;
},
to_write: function () {
switch (this.value) {
case "\n":
return "#\\newline";
case " ":
return "#\\space";
case "\t":
return "#\\tab";
default:
return "#\\" + this.value;
}
},
to_display: function () {
return this.value;
},
inspect: function () {
return this.to_write();
},
});
Char.get = function (c) {
if (typeof c != "string") {
throw new Bug("Char.get: " + inspect(c) + " is not a string");
}
if (Chars[c] === undefined) return new Char(c);
else return Chars[c];
};
//
// pause object (facility to stop/resume interpreting)
//
var Pause = Class.create({
//new (on_pause: javascript function calling setTimeout, Ajax.Request, ..)
initialize: function (on_pause) {
this.on_pause = on_pause;
},
//save state of interpreter
set_state: function (intp, x, f, c, s) {
this.interpreter = intp;
this.x = x;
this.f = f;
this.c = c;
this.s = s;
},
//call this when ready (to fire setTimeout, Ajax.Request..)
ready: function () {
this.on_pause(this);
},
//restart calculation
resume: function (value) {
return this.interpreter.resume(
true,
value,
this.x,
this.f,
this.c,
this.s
);
},
});
//
// Port
//
// (eof-object)
const eof = new Object();
const Port = Class.create({
initialize: function (is_in, is_out) {
this.is_open = true;
this.is_binary = false; //??
this.is_input = is_in;
this.is_output = is_out;
},
close: function () {
// close port
this.is_open = false;
},
inspect: function () {
return "#<Port>";
},
to_write: function () {
return "#<Port>";
},
});
//
// string ports (srfi-6)
//
Port.StringOutput = Class.extend(new Port(false, true), {
initialize: function () {
this.buffer = [];
},
put_string: function (str) {
this.buffer.push(str);
},
output_string: function (str) {
return this.buffer.join("");
},
});
Port.StringInput = Class.extend(new Port(true, false), {
initialize: function (str) {
this.str = str;
},
get_string: function (after) {
return after(this.str);
},
});
Port.NullInput = Class.extend(new Port(true, false), {
initialize: function () {},
get_string: function (after) {
// Never give them anything!
return after("");
},
});
Port.NullOutput = Class.extend(new Port(false, true), {
initialize: function (output_function) {
this.output_function = output_function;
},
put_string: function (str) {},
});
Port.CustomOutput = Class.extend(new Port(false, true), {
initialize: function (output_function) {
this.output_function = output_function;
},
put_string: function (str) {
this.output_function(str);
},
});
Port.CustomInput = Class.extend(new Port(true, false), {
initialize: function (input_function) {
this.input_function = input_function;
},
get_string: function (after) {
var input_function = this.input_function;
return new Pause(function (pause) {
input_function(function (input) {
pause.resume(after(input));
});
});
},
});
// User must set the current input/output
Port.current_input = new Port.NullInput();
Port.current_output = new Port.NullOutput();
Port.current_error = new Port.NullOutput();
// A Scheme lambda
const Closure = Class.create({
// body: Intermediate Language (JS array)
// freevars: Captured free variables
// dotpos: The position of `.` in the parameter list. -1 if none
// expected_args: Expected number of args or `undefined`
initialize: function (body, freevars, dotpos, expected_args) {
this.body = body;
this.freevars = freevars;
this.dotpos = dotpos;
this.expected_args = expected_args;
},
to_write: function () {
return "#<Closure>";
},
});
const isClosure = function (obj) {
return obj instanceof Closure;
};
//
const isNil = function (obj) {
return obj === nil;
};
const isUndef = function (obj) {
return obj === undef;
};
const isBoolean = isBoolean$1; // Return true if arg is either true or false
//isNumber is defined in number.js (Return true if arg is scheme number)
const isString = isString$1;
const isFunction = isFunction$1$1;
const isChar = function (obj) {
return obj instanceof Char;
};
const isSymbol = function (obj) {
return obj instanceof BiwaSymbol;
};
const isPort = function (obj) {
return obj instanceof Port;
};
const isVector = function (obj) {
return obj instanceof Array;
};
// procedure: Scheme closure or JavaScript function
// valid argument for anywhere function is expected
const isProcedure = function (obj) {
return isClosure(obj) || isFunction$1$1(obj);
};
// Return true if obj is a scheme value which evaluates to itself
const isSelfEvaluating = function (obj) {
return isBoolean(obj) || isNumber(obj) || isString(obj) || isChar(obj);
};
//
// equality
//
const eq = function (a, b) {
return a === b;
};
// TODO: Records (etc.)
const eqv = function (a, b) {
return a == b && typeof a == typeof b;
};
const equal = function (a, b) {
//TODO: must terminate for cyclic objects
return to_write$1(a) == to_write$1(b);
};
//
// comaprator
//
// Return true when a < b
const lt = function (a, b) {
if (typeof a !== typeof b) {
return compareFn(typeof a, typeof b);
}
return a < b;
};
///
/// Call
///
// The class Call is used to invoke scheme closure from
// library functions.
//
// Call#initialize takes three arguments: proc, args and after.
// * proc is the scheme closure to invoke.
// * args is an Array (not list!) of arguments for the invocation.
// * after is a javascript function which is invoked when
// returned from the proc.
//
// after takes two arguments: ar and intp.
// * ar is an Array which contains the result of the invocation.
// * intp is an Interpreter which is running.
//
// If after returns another Call object, another invocation
// happens. If after returns a normal value, it is the value
// of the library function.
//
// example:
// return new Call(proc, [x, y], function(ar){ ar[0] });
//
const Call = Class.create({
initialize: function (proc, args, after) {
this.proc = proc;
this.args = args;
this.after =
after ||
function (ar) {
// just return result which closure returned
return ar[0];
};
},
inspect: function () {
return "#<Call args=" + this.args.inspect() + ">";
},
toString: function () {
return "#<Call>";
},
to_write: function () {
return "#<Call>";
},
});
//
// Iterator - external iterator for Call.foreach
//
const Iterator = {
ForArray: Class.create({
initialize: function (arr) {
this.arr = arr;
this.i = 0;
},
has_next: function () {
return this.i < this.arr.length;
},
next: function () {
return this.arr[this.i++];
},
}),
ForString: Class.create({
initialize: function (str) {
this.str = str;
this.i = 0;
},
has_next: function () {
return this.i < this.str.length;
},
next: function () {
return Char.get(this.str.charAt(this.i++));
},
}),
ForList: Class.create({
initialize: function (ls) {
this.ls = ls;
},
has_next: function () {
return this.ls instanceof Pair && this.ls != nil;
},
next: function () {
var pair = this.ls;
this.ls = this.ls.cdr;
return pair;
},
}),
ForMulti: Class.create({
initialize: function (objs) {
this.objs = objs;
this.size = objs.length;
this.iterators = map(objs, function (x) {
return Iterator.of(x);
});
},
has_next: function () {
for (var i = 0; i < this.size; i++)
if (!this.iterators[i].has_next()) return false;
return true;
},
next: function () {
return map(this.iterators, function (ite) {
return ite.next();
});
},
}),
of: function (obj) {
switch (true) {
case obj instanceof Array:
return new this.ForArray(obj);
case typeof obj == "string":
return new this.ForString(obj);
case obj instanceof Pair:
case obj === nil:
return new this.ForList(obj);
default:
throw new Bug("Iterator.of: unknown class: " + inspect(obj));
}
},
};
//
// Call.foreach - shortcut for successive Calls
//
// Some library functions, such as for-each or map,
// call a closure for each element. Call.foreach is
// a utility to help defining such methods.
//
// Call.foreach takes a sequence and some callbacks.
// Sequence is an Array, String, or list.
//
// Example:
// return Call.foreach(sequence, {
// // before each call
// call: function(elem){
// return new Call(proc, [elem]);
// },
// // after each call
// result: function(value, elem){
// ary.push(value);
// // you can return a value to terminate the loop
// },
// // after all the calls
// finish: function(){
// return ary;
// }
// });
Call.default_callbacks = {
call: function (x) {
return new Call(this.proc, [x]);
},
result: function () {},
finish: function () {},
};
Call.foreach = function (obj, callbacks, is_multi) {
is_multi || (is_multi = false);
each(["call", "result", "finish"], function (key) {
if (!callbacks[key]) callbacks[key] = Call.default_callbacks[key];
});
var iterator = null;
var x = null;
var loop = function (ar) {
if (iterator) {
var ret = callbacks["result"](ar[0], x);
if (ret !== undefined) return ret;
} else {
// first lap
if (is_multi) iterator = new Iterator.ForMulti(obj);
else iterator = Iterator.of(obj);
}
if (!iterator.has_next()) {
return callbacks["finish"]();
} else {
x = iterator.next();
var result = callbacks["call"](x);
result.after = loop;
return result;
}
};
return loop(null);
};
Call.multi_foreach = function (obj, callbacks) {
return Call.foreach(obj, callbacks, true);
};
//
// Syntax
//
const Syntax = Class.create({
initialize: function (sname, func) {
this.sname = sname;
this.func = func;
},
transform: function (x) {
if (!this.func) {
throw new Bug(
"sorry, syntax " + this.sname + " is a pseudo syntax now"
);
}
return this.func(x);
},
inspect: function () {
return "#<Syntax " + this.sname + ">";
},
});
// A built-in syntax did not have associated Syntax object.
// Following code installed dummy Syntax objects to built-in syntax.
CoreEnv["define"] = new Syntax("define");
CoreEnv["begin"] = new Syntax("begin");
CoreEnv["quote"] = new Syntax("quote");
CoreEnv["lambda"] = new Syntax("lambda");
CoreEnv["if"] = new Syntax("if");
CoreEnv["set!"] = new Syntax("set!");
// A compiled Scheme expression
const VMCode = Class.create({
// il: Intermediate Language (JS array)
initialize: function (il) {
if (!isVector(il)) {
console.error(il);
throw "not array";
}
this.il = il;
},
to_write: function () {
return "#<VMCode>";
},
});
///
/// Compiler
///
/// Note: macro expansion is done by Intepreter#expand
const Compiler = Class.create({
initialize: function () {},
is_tail: function (x) {
return x[0] == "return";
},
//free: set
//e: env(= [locals, frees])
//next: opc
//ret: opc["refer_*", n, ["argument",
// ["refer_*", n, ... ["argument", next]
collect_free: function (free, e, next) {
var vars = free;
var opc = next;
var arr = vars.arr;
for (var i = 0; i < arr.length; i++) {
opc = this.compile_refer(arr[i], e, ["argument", opc]);
}
//Console.puts("collect_free "+free.inspect()+" / "+e.inspect()+" => "+opc.inspect());
return opc;
},
//x: Symbol
//e: env [set of locals, set of frees]
//ret: opc
compile_refer: function (x, e, next) {
return this.compile_lookup(
x,
e,
function (n) {
return ["refer-local", n, next];
},
function (n) {
return ["refer-free", n, next];
},
function (sym) {
return ["refer-global", sym, next];
}
);
},
compile_lookup: function (x, e, return_local, return_free, return_global) {
var locals = e[0],
free = e[1];
var n;
if ((n = locals.index(x)) != null) {
//Console.puts("compile_refer:"+x.inspect()+" in "+e.inspect()+" results refer-local "+n);
return return_local(n);
} else if ((n = free.index(x)) != null) {
//Console.puts("compile_refer:"+x.inspect()+" in "+e.inspect()+" results refer-free "+n);
return return_free(n);
} else {
var sym = x.name;
return return_global(sym);
}
//throw new BiwaError("undefined symbol `" + sym + "'");
},
//generate boxing code (intersection of sets & vars)
//if no need of boxing, just returns next
// sets(Set): assigned variables
// vars(List): used variables
// next(opc):
// ret(opc):
make_boxes: function (sets, vars, next) {
var vars = vars;
var n = 0;
var a = [];
while (vars instanceof Pair) {
if (sets.member(vars.car)) a.push(n);
n++;
vars = vars.cdr;
}
var opc = next;
for (var i = a.length - 1; i >= 0; i--) opc = ["box", a[i], opc];
return opc;
},
// Enumerate variables which (could be assigned && included in v)
// x: exp
// v: set(vars)
// ret: set
find_sets: function (x, v) {
//Console.puts("find_sets: " + to_write(x) + " " + to_write(v))
var ret = null;
if (x instanceof BiwaSymbol) {
ret = new BiwaSet();
} else if (x instanceof Pair) {
switch (x.first()) {
case Sym("define"):
var exp = x.third();
ret = this.find_sets(exp, v);
case Sym("begin"):
ret = this.find_sets(x.cdr, v); //(ignores improper list)
break;
case Sym("quote"):
ret = new BiwaSet();
break;
case Sym("lambda"):
var vars = x.second(),
body = x.cdr.cdr;
if (vars instanceof Pair) {
// (lambda (...) ...)
ret = this.find_sets(body, v.set_minus(vars.to_set()));
} else {
// (lambda args ...)
ret = this.find_sets(body, v.set_minus(new BiwaSet(vars)));
}
break;
case Sym("if"):
var testc = x.second(),
thenc = x.third(),
elsec = x.fourth();
ret = this.find_sets(testc, v).set_union(
this.find_sets(thenc, v),
this.find_sets(elsec, v)
);
break;
case Sym("set!"):
var vari = x.second(),
xx = x.third();
if (v.member(vari)) ret = this.find_sets(xx, v).set_cons(vari);
else ret = this.find_sets(xx, v);
break;
case Sym("call/cc"):
var exp = x.second();
ret = this.find_sets(exp, v);
break;
default:
var set = new BiwaSet();
for (var p = x; p instanceof Pair; p = p.cdr) {
set = set.set_union(this.find_sets(p.car, v));
}
ret = set;
break;
}
} else {
ret = new BiwaSet();
}
if (ret == null) throw new Bug("find_sets() exited in unusual way");
else return ret;
},
// find_free(): find free variables in x
// these variables are collected by collect_free().
// x: expression
// b: set of local vars (= variables which are not free)
// f: set of free var candidates
// (local vars of outer lambdas)
// ret: set of free vars
find_free: function (x, b, f) {
var ret = null;
if (x instanceof BiwaSymbol) {
if (f.member(x)) ret = new BiwaSet(x);
else ret = new BiwaSet();
} else if (x instanceof Pair) {
switch (x.first()) {
case Sym("define"):
var exp = x.third();
ret = this.find_free(exp, b, f);
break;
case Sym("begin"):
ret = this.find_free(x.cdr, b, f); //(ignores improper list)
break;
case Sym("quote"):
ret = new BiwaSet();
break;
case Sym("lambda"):
var vars = x.second(),
body = x.cdr.cdr;
if (vars instanceof Pair) {
// (lambda (...) ...)
ret = this.find_free(body, b.set_union(vars.to_set()), f);
} else {
// (lambda args ...)
ret = this.find_free(body, b.set_cons(vars), f);
}
break;
case Sym("if"):
var testc = x.second(),
thenc = x.third(),
elsec = x.fourth();
ret = this.find_free(testc, b, f).set_union(
this.find_free(thenc, b, f),
this.find_free(elsec, b, f)
);
break;
case Sym("set!"):
var vari = x.second(),
exp = x.third();
if (f.member(vari)) ret = this.find_free(exp, b, f).set_cons(vari);
else ret = this.find_free(exp, b, f);
break;
case Sym("call/cc"):
var exp = x.second();
ret = this.find_free(exp, b, f);
break;
default:
var set = new BiwaSet();
for (var p = x; p instanceof Pair; p = p.cdr) {
set = set.set_union(this.find_free(p.car, b, f));
}
ret = set;
break;
}
} else {
ret = new BiwaSet();
}
//Console.p("find_free "+x.inspect()+" / "+b.inspect()+" => "+ret.inspect());
if (ret == null) throw new Bug("find_free() exited in unusual way");
else return ret;
},
// Returns the position of the dot pair.
// Returns -1 if x is a proper list.
//
// eg. (a b . c) -> 2
find_dot_pos: function (x) {
var idx = 0;
for (; x instanceof Pair; x = x.cdr, ++idx);
if (x != nil) {
return idx;
} else {
return -1;
}
},
last_pair: function (x) {
if (x instanceof Pair) {
for (; x.cdr instanceof Pair; x = x.cdr);
}
return x;
},
// Takes an dotted list and returns proper list.
//
// eg. (x y . z) -> (x y z)
dotted2proper: function (ls) {
if (ls === nil) return nil;
var nreverse = function (ls) {
var res = nil;
for (; ls instanceof Pair; ) {
var d = ls.cdr;
ls.cdr = res;
res = ls;
ls = d;
}
return res;
};
var copy_list = function (ls) {
var res = nil;
for (; ls instanceof Pair; ls = ls.cdr) {
res = new Pair(ls.car, res);
}
return nreverse(res);
};
if (ls instanceof Pair) {
var last = this.last_pair(ls);
if (last instanceof Pair && last.cdr === nil) {
return ls;
} else {
var copied = copy_list(ls);
this.last_pair(copied).cdr = new Pair(last.cdr, nil);
return copied;
}
} else {
return new Pair(ls, nil);
}
},
// x: exp(list of symbol or integer or..)
// e: env (= [locals, frees])
// s: vars might be set!
// next: opc
// ret: opc
compile: function (x, e, s, f, next) {
//Console.p(x);
var ret = null;
while (1) {
if (x instanceof BiwaSymbol) {
// Variable reference
// compiled into refer-(local|free|global)
return this.compile_refer(
x,
e,
s.member(x) ? ["indirect", next] : next
);
} else if (x instanceof Pair) {
switch (x.first()) {
case Sym("define"):
ret = this._compile_define(x, next);
x = ret[0];
next = ret[1];
break;
case Sym("begin"):
var a = [];
for (var p = x.cdr; p instanceof Pair; p = p.cdr) a.push(p.car);
//compile each expression (in reverse order)
var c = next;
for (var i = a.length - 1; i >= 0; i--) {
c = this.compile(a[i], e, s, f, c);
}
return c;
case Sym("quote"):
if (x.length() < 2)
throw new BiwaError("Invalid quote: " + x.to_write());
var obj = x.second();
return ["constant", obj, next];
case Sym("lambda"):
return this._compile_lambda(x, e, s, f, next);
case Sym("if"):
if (x.length() < 3 || x.length() > 4)
throw new BiwaError("Invalid if: " + x.to_write());
var testc = x.second(),
thenc = x.third(),
elsec = x.fourth();
var thenc = this.compile(thenc, e, s, f, next);
var elsec = this.compile(elsec, e, s, f, next);
x = testc;
next = ["test", thenc, elsec];
break;
case Sym("set!"):
// error-checking: should have only 3 things
if (x.length() != 3)
throw new BiwaError("Invalid set!: " + x.to_write());
var v = x.second(),
x = x.third();
var do_assign = this.compile_lookup(
v,
e,
function (n) {
return ["assign-local", n, next];
},
function (n) {
return ["assign-free", n, next];
},
function (sym) {
return ["assign-global", sym, next];
}
);
next = do_assign;
break;
case Sym("call/cc"):
var x = x.second();
var arity_of_arg = 1; // Always 1. (lambda (cc) ...)
var c = [
"conti",
this.is_tail(next) ? e[0].size() + 1 : 0, //number of args for outer lambda
[
"argument", // Push the continuaion closure onto the stack
[
"constant",
arity_of_arg,
[
"argument",
this.compile(
x,
e,
s,
f,
this.is_tail(next)
? ["shift", arity_of_arg, ["tco_hinted_apply"]]
: ["apply"]
),
],
],
],
];
// Do not push stack frame when call/cc is in a tail context
return this.is_tail(next) ? c : ["frame", c, next];
default:
//apply
//x = (func 1 2)
//x.car = func = '(lambda (x) ..) or Symbol
//x.cdr = args = '(1 2)
var func = x.car;
var args = x.cdr;
var c = this.compile(
func,
e,
s,
f,
this.is_tail(next)
? ["shift", args.length(), ["tco_hinted_apply"]]
: ["apply"]
);
// VM will push the number of arguments to the stack.
c = this.compile(args.length(), e, s, f, ["argument", c]);
for (var p = args; p instanceof Pair; p = p.cdr) {
c = this.compile(p.car, e, s, f, ["argument", c]);
}
// Do not push stack frame for tail calls
return this.is_tail(next) ? c : ["frame", c, next];
}
} else {
return ["constant", x, next];
}
}
//Console.p("result of " + x.inspect() + ":");
//Console.p(ret);
//dump({"ret":ret, "x":x, "e":e, "s":s, "next":next, "stack":[]});
// if(ret == null)
// throw new Bug("compile() exited in unusual way");
// else
// return ret;
},
// Compile define.
//
// 0. (define) ; => error
// 1. (define a)
// 2. (define a 1)
// 3. (define a 1 2) ; => error
// 4. (define (f x) x), (define (f . a) a)
// 5. (define 1 2)
//
// Note: define may appear in lambda, let, let*, let-values,
// let*-values, letrec, letrec*. These definitions are local to the
// <body> of these forms.
_compile_define: function (x, next) {
if (x.length() == 1) {
// 0. (define)
throw new BiwaError("Invalid `define': " + x.to_write());
}
var first = x.cdr.car;
var rest = x.cdr.cdr;
if (first instanceof BiwaSymbol) {
if (rest === nil) {
// 1. (define a)
x = undef;
} else {
if (rest.cdr === nil)
// 2. (define a 1)
x = rest.car;
// 3. (define a 1 2)
else throw new BiwaError("Invalid `define': " + x.to_write());
}
if (!TopEnv.hasOwnProperty(first.name)) {
TopEnv[first.name] = undef;
}
next = ["assign-global", first.name, next];
} else if (first instanceof Pair) {
// 4. (define (f x) ...)
// Note: define of this form may contain internal define.
// They are handled in compilation of "lambda".
var fname = first.car,
args = first.cdr;
var lambda = new Pair(Sym("lambda"), new Pair(args, rest));
x = lambda;
if (!TopEnv.hasOwnProperty(first.name)) {
TopEnv[fname.name] = undef;
}
next = ["assign-global", fname.name, next];
} else {
// 5. (define 1 2)
throw new BiwaError("define: symbol or pair expected but got " + first);
}
return [x, next];
},
// Compiles various forms of "lambda".
//
// * (lambda (x y) ...)
// * (lambda (x y . rest) ...)
// * (lambda args ...)
_compile_lambda: function (x, e, s, f, next) {
if (x.length() < 3)
throw new BiwaError("Invalid lambda: " + x.to_write());
var vars = x.cdr.car;
var body = x.cdr.cdr;
// Handle internal defines
var tbody = Compiler.transform_internal_define(body);
if (isPair(tbody) && isSymbol(tbody.car) && tbody.car.name == "letrec*") {
// The body has internal defines.
// Expand letrec* macro
var cbody = Compiler.expand(tbody);
} else {
// The body has no internal defines.
// Just wrap the list with begin
var cbody = new Pair(Sym("begin"), x.cdr.cdr);
}
var dotpos = this.find_dot_pos(vars);
var proper = this.dotted2proper(vars);
var free = this.find_free(cbody, proper.to_set(), f); //free variables
var sets = this.find_sets(cbody, proper.to_set()); //local variables
var do_body = this.compile(
cbody,
[proper.to_set(), free],
sets.set_union(s.set_intersect(free)),
f.set_union(proper.to_set()),
["return"]
);
var do_close = [
"close",
vars instanceof Pair ? vars.length() : 0,
free.size(),
this.make_boxes(sets, proper, do_body),
next,
dotpos,
];
return this.collect_free(free, e, do_close);
},
run: function (expr) {
const opc = this.compile(
expr,
[new BiwaSet(), new BiwaSet()],
new BiwaSet(),
new BiwaSet(),
["halt"]
);
return new VMCode(opc);
},
});
// Compile an expression with new compiler
Compiler.compile = function (expr, next) {
expr = Compiler.expand(expr);
return new Compiler().run(expr, next);
};
// Expand macro calls in a expression recursively.
//
// x - expression
// flag - used internally. do not specify this
//
// @throws {BiwaError} when x has syntax error
Compiler.expand = function (x, flag /*optional*/) {
var expand = Compiler.expand;
flag || (flag = {});
var ret = null;
if (x instanceof Pair) {
switch (x.car) {
case Sym("define"):
var left = x.cdr.car,
exp = x.cdr.cdr;
ret = new Pair(Sym("define"), new Pair(left, expand(exp, flag)));
break;
case Sym("begin"):
ret = new Pair(Sym("begin"), expand(x.cdr, flag));
break;
case Sym("quote"):
ret = x;
break;
case Sym("lambda"):
var vars = x.cdr.car,
body = x.cdr.cdr;
ret = new Pair(Sym("lambda"), new Pair(vars, expand(body, flag)));
break;
case Sym("if"):
var testc = x.second(),
thenc = x.third(),
elsec = x.fourth();
ret = List(
Sym("if"),
expand(testc, flag),
expand(thenc, flag),
expand(elsec, flag)
);
break;
case Sym("set!"):
var v = x.second(),
x = x.third();
ret = List(Sym("set!"), v, expand(x, flag));
break;
case Sym("call-with-current-continuation"):
case Sym("call/cc"):
var x = x.second();
ret = List(Sym("call/cc"), expand(x, flag));
break;
default:
//apply
var transformer = null;
if (isSymbol(x.car)) {
if (TopEnv[x.car.name] instanceof Syntax)
transformer = TopEnv[x.car.name];
else if (CoreEnv[x.car.name] instanceof Syntax)
transformer = CoreEnv[x.car.name];
}
if (transformer) {
flag["modified"] = true;
ret = transformer.transform(x);
// // Debug
// var before = to_write(x);
// var after = to_write(ret);
// if(before != after){
// console.log("before: " + before)
// console.log("expand: " + after)
// }
var fl;
for (;;) {
ret = expand(ret, (fl = {}));
if (!fl["modified"]) break;
}
} else {
var expanded_car = expand(x.car, flag);
var expanded_cdr;
if (!(x.cdr instanceof Pair) && x.cdr !== nil) {
throw new BiwaError(
"proper list required for function application " +
"or macro use: " +
to_write(x)
);
}
expanded_cdr = array_to_list(
x.cdr.to_array().map(function (item) {
return expand(item, flag);
})
);
ret = new Pair(expanded_car, expanded_cdr);
}
}
} else {
ret = x;
}
return ret;
};
// Transform internal defines to letrec*.
//
// Example
// (let ((a 1))
// (define (b) a)
// (b))
//
// (let ((a 1))
// (letrec* ((b (lambda () a)))
// (b)))
//
// x - expression starts with (define ...)
//
// Returns a letrec* expression, or
// just returns x, when x does not contain definitions.
// Returns true if x is a definition
var is_definition = function (x) {
return isPair(x) && Sym("define") === x.car;
// TODO: support "begin", nested "begin", "let(rec)-syntax"
};
// Convert function definition to lambda binding
// (define a ..) -> (a ..)
// (define (f) ..) -> (f (lambda () ..))
// (define (f x . y) ..) -> (f (lambda (x . y) ..))
// (define (f . a) ..) -> (f (lambda a ..))
var define_to_lambda_bind = function (def) {
var sig = def.cdr.car;
var body = def.cdr.cdr;
if (isSymbol(sig)) {
var variable = sig;
return new Pair(variable, body);
} else {
var variable = sig.car;
var value = new Pair(Sym("lambda"), new Pair(sig.cdr, body));
return List(variable, value);
}
};
Compiler.transform_internal_define = function (x) {
// 1. Split x into definitions and expressions
var defs = [],
item = x;
while (is_definition(item.car)) {
defs.push(item.car);
item = item.cdr;
}
var exprs = item;
// 2. Return x if there is no definitions
if (defs.length == 0) return x;
// 3. Return (letrec* <bindings> <expressions>)
var bindings = List.apply(null, map(defs, define_to_lambda_bind));
return new Pair(Sym("letrec*"), new Pair(bindings, exprs));
};
//
// assertions - type checks
//
const make_assert = function (check) {
return function (/*args*/) {
// We cannot use callee/caller in ESM (=JS strict mode)
//var fname = arguments.callee.caller
// ? arguments.callee.caller.fname
// : "";
const fname = "";
check.apply(this, [fname].concat(toArray(arguments)));
};
};
const make_simple_assert = function (type, test, _fname) {
return make_assert(function (fname, obj, opt) {
const option = opt ? "(" + opt + "): " : "";
if (!test(obj)) {
throw new BiwaError(
option + type + " required, but got " + to_write$1(obj)
);
}
});
};
//
// Hashtable
//
// TODO: Reimplement with JavaScript Map
//
// Based on the base JavaScript Object class, but
// * Object takes only strings as keys
// * R6RS hashtable needs its own hash function
// so some hacks are needed.
const Hashtable = Class.create({
initialize: function (_hash_proc, _equiv_proc, mutable) {
this.mutable = mutable === undefined ? true : mutable ? true : false;
this.hash_proc = _hash_proc;
this.equiv_proc = _equiv_proc;
// Hash (hashed) => (array of (key and value))
this.pairs_of = {};
},
clear: function () {
this.pairs_of = {};
},
candidate_pairs: function (hashed) {
return this.pairs_of[hashed];
},
add_pair: function (hashed, key, value) {
var pairs = this.pairs_of[hashed];
if (pairs) {
pairs.push([key, value]);
} else {
this.pairs_of[hashed] = [[key, value]];
}
},
remove_pair: function (hashed, pair) {
var pairs = this.pairs_of[hashed];
var i = pairs.indexOf(pair);
if (i == -1) {
throw new Bug("Hashtable#remove_pair: pair not found!");
} else {
pairs.splice(i, 1); //remove 1 element from i-th index
}
},
create_copy: function (mutable) {
var copy = new Hashtable(this.hash_proc, this.equiv_proc, mutable);
// clone the pairs to copy
each(
keys(this.pairs_of),
bind(function (hashed) {
var pairs = this.pairs_of[hashed];
var cloned = map(pairs, function (pair) {
return clone(pair);
});
copy.pairs_of[hashed] = cloned;
}, this)
);
return copy;
},
size: function () {
var n = 0;
this._apply_pair(function (pair) {
n++;
});
return n;
},
keys: function () {
return this._apply_pair(function (pair) {
return pair[0];
});
},
values: function () {
return this._apply_pair(function (pair) {
return pair[1];
});
},
_apply_pair: function (func) {
var a = [];
each(values(this.pairs_of), function (pairs) {
each(pairs, function (pair) {
a.push(func(pair));
});
});
return a;
},
to_write: function () {
return "#<Hashtable size=" + this.size() + ">";
},
});
const isHashtable = function (obj) {
return obj instanceof Hashtable;
};
const isMutableHashtable = function (obj) {
return obj instanceof Hashtable && obj.mutable;
};
//
// Hash functions
//
Hashtable.equal_hash = function (ar) {
return to_write$1(ar[0]);
};
Hashtable.eq_hash = Hashtable.equal_hash;
Hashtable.eqv_hash = Hashtable.equal_hash;
Hashtable.string_hash = function (ar) {
return ar[0];
};
Hashtable.string_ci_hash = function (ar) {
return isString$1(ar[0]) ? ar[0].toLowerCase() : ar[0];
};
Hashtable.symbol_hash = function (ar) {
return ar[0] instanceof BiwaSymbol ? ar[0].name : ar[0];
};
//
// Equivalence functions
//
Hashtable.eq_equiv = function (ar) {
return eq(ar[0], ar[1]);
};
Hashtable.eqv_equiv = function (ar) {
return eqv(ar[0], ar[1]);
};
//
// Parser
// copied from jsScheme - should be rewrriten (support #0=, etc)
//
const Parser = Class.create({
initialize: function (txt) {
this.tokens = this.tokenize(txt);
this.i = 0;
},
// Inject scheme program into current position
insert: function (txt) {
this.tokens.splice(this.i, 0, ...this.tokenize(txt));
},
inspect: function () {
return [
"#<Parser:",
this.i,
"/",
this.tokens.length,
" ",
inspect(this.tokens),
">",
].join("");
},
tokenize: function (txt) {
var tokens = new Array(),
oldTxt = null;
var in_srfi_30_comment = 0;
while (txt != "" && oldTxt != txt) {
oldTxt = txt;
txt = txt.replace(
/^\s*(;[^\r\n]*(\r|\n|$)|#;|#\||#\\[^\w]|#?(\(|\[|{)|\)|\]|}|\'|`|,@|,|\+inf\.0|-inf\.0|\+nan\.0|\"(\\(.|$)|[^\"\\])*(\"|$)|[^\s()\[\]{}]+)/,
function ($0, $1) {
var t = $1;
if (t == "#|") {
in_srfi_30_comment++;
return "";
} else if (in_srfi_30_comment > 0) {
if (/(.*\|#)/.test(t)) {
in_srfi_30_comment--;
if (in_srfi_30_comment < 0) {
throw new BiwaError(
"Found an extra comment terminator: `|#'"
);
}
// Push back the rest substring to input stream.
return t.substring(RegExp.$1.length, t.length);
} else {
return "";
}
} else {
if (t.charAt(0) != ";") tokens[tokens.length] = t;
return "";
}
}
);
}
return tokens;
},
sexpCommentMarker: new Object(),
getObject: function () {
var r = this.getObject0();
if (r != this.sexpCommentMarker) return r;
r = this.getObject();
if (r == Parser.EOS)
throw new BiwaError(
"Readable object not found after S exression comment"
);
r = this.getObject();
return r;
},
getList: function (close) {
var list = nil,
prev = list;
while (this.i < this.tokens.length) {
this.eatObjectsInSexpComment(
"Input stream terminated unexpectedly(in list)"
);
if (
this.tokens[this.i] == ")" ||
this.tokens[this.i] == "]" ||
this.tokens[this.i] == "}"
) {
this.i++;
break;
}
if (this.tokens[this.i] == ".") {
this.i++;
var o = this.getObject();
if (o != Parser.EOS && list != nil) {
prev.cdr = o;
}
} else {
var cur = new Pair(this.getObject(), nil);
if (list == nil) list = cur;
else prev.cdr = cur;
prev = cur;
}
}
return list;
},
getVector: function (close) {
var arr = new Array();
while (this.i < this.tokens.length) {
this.eatObjectsInSexpComment(
"Input stream terminated unexpectedly(in vector)"
);
if (
this.tokens[this.i] == ")" ||
this.tokens[this.i] == "]" ||
this.tokens[this.i] == "}"
) {
this.i++;
break;
}
arr[arr.length] = this.getObject();
}
return arr;
},
eatObjectsInSexpComment: function (err_msg) {
while (this.tokens[this.i] == "#;") {
this.i++;
if (this.getObject() == Parser.EOS || this.i >= this.tokens.length)
throw new BiwaError(err_msg);
}
},
getObject0: function () {
if (this.i >= this.tokens.length) return Parser.EOS;
var t = this.tokens[this.i++];
// if( t == ')' ) return null;
if (t == "#;") return this.sexpCommentMarker;
var s =
t == "'"
? "quote"
: t == "`"
? "quasiquote"
: t == ","
? "unquote"
: t == ",@"
? "unquote-splicing"
: false;
if (
s ||
t == "(" ||
t == "#(" ||
t == "[" ||
t == "#[" ||
t == "{" ||
t == "#{"
) {
return s
? new Pair(Sym(s), new Pair(this.getObject(), nil))
: t == "(" || t == "[" || t == "{"
? this.getList(t)
: this.getVector(t);
} else {
switch (t) {
case "+inf.0":
return Infinity;
case "-inf.0":
return -Infinity;
case "+nan.0":
return NaN;
}
var n;
if (/^#x[0-9a-z]+$/i.test(t)) {
// #x... Hex
n = new Number("0x" + t.substring(2, t.length));
} else if (/^#d[0-9\.]+$/i.test(t)) {
// #d... Decimal
n = new Number(t.substring(2, t.length));
} else {
n = new Number(t); // use constrictor as parser
}
if (!isNaN(n)) {
return n.valueOf();
} else if (t == "#f" || t == "#F") {
return false;
} else if (t == "#t" || t == "#T") {
return true;
} else if (t.toLowerCase() == "#\\newline") {
return Char.get("\n");
} else if (t.toLowerCase() == "#\\space") {
return Char.get(" ");
} else if (t.toLowerCase() == "#\\tab") {
return Char.get("\t");
} else if (/^#\\.$/.test(t)) {
return Char.get(t.charAt(2));
} else if (/^#\\x[a-zA-Z0-9]+$/.test(t)) {
var scalar = parseInt(t.slice(3), 16);
// R6RS 11.11 (surrogate codepoints)
if (scalar >= 0xd800 && scalar <= 0xdfff) {
throw new BiwaError("Character in Unicode excluded range.");
}
// ECMA-262 4.3.16 -- Basically, strings are sequences of 16-bit
// unsigned integers, so anything greater than 0xFFFF won't fit.
// NOTE: This violates R6RS which requires the full Unicode range!
else if (scalar > 0xffff) {
throw new BiwaError("Character literal out of range.");
} else {
return Char.get(String.fromCharCode(scalar));
}
} else if (/^\"(\\(.|$)|[^\"\\])*\"?$/.test(t)) {
return t
.replace(/(\r?\n|\\n)/g, "\n")
.replace(/^\"|\\(.|$)|\"$/g, function ($0, $1) {
return $1 ? $1 : "";
});
} else return Sym(t); // 2Do: validate !!
}
},
});
// indicates end of source file
Parser.EOS = new Object();
// Parser the text and return an array of exprs
Parser.parse = (txt) => {
const parser = new Parser(txt);
const ret = [];
while (true) {
var expr = parser.getObject();
if (expr === Parser.EOS) break;
ret.push(expr);
}
return ret;
};
///
/// Interpreter
///
const Interpreter = Class.create({
// new Interpreter()
// new Interpreter(lastInterpreter)
// new Interpreter(errorHandler)
// new Interpreter(lastInterpreter, errorHandler)
initialize: function () {
var last_interpreter = null;
var on_error = null;
if (arguments.length == 2) {
last_interpreter = arguments[0];
on_error = arguments[1];
} else if (arguments.length == 1 && arguments[0] instanceof Interpreter) {
last_interpreter = arguments[0];
} else if (arguments.length == 1 && typeof arguments[0] == "function") {
on_error = arguments[0];
}
// Interpreter stack
this.stack = [];
// JS function to handle error
this.on_error =
on_error ||
(last_interpreter ? last_interpreter.on_error : function (e) {});
// JS function to handle result
this.after_evaluate = function () {};
// (Variables for stack trace)
// Name of the last variable read by refer-xx
this.last_refer = last_interpreter ? last_interpreter.last_refer : null;
// Call stack (array of last_refer)
this.call_stack = last_interpreter
? clone(last_interpreter.call_stack)
: [];
// Counts number of tail calls (= how many times should we pop call_stack
// in op_return)
this.tco_counter = [];
// Maximum length of call_stack
// (Note: we should cap call_stack for inifinite loop with recursion)
this.max_trace_size = last_interpreter
? last_interpreter.max_trace_size
: max_trace_size;
// dynamic-wind
this.current_dynamic_winder = Interpreter.DynamicWind.ROOT;
},
inspect: function () {
return [
"#<Interpreter: stack size=>",
this.stack.length,
" ",
"after_evaluate=",
inspect(this.after_evaluate),
">",
].join("");
},
// private
push: function (x, s) {
this.stack[s] = x;
return s + 1;
},
// private
//s: depth of stack to save
//ret: saved(copied) stack
save_stack: function (s) {
var v = [];
for (var i = 0; i < s; i++) {
v[i] = this.stack[i];
}
return {
stack: v,
last_refer: this.last_refer,
call_stack: clone(this.call_stack),
tco_counter: clone(this.tco_counter),
};
},
// private
//v: stack array to restore
//ret: lenght of restored stack
restore_stack: function (stuff) {
const v = stuff.stack;
const s = v.length;
for (var i = 0; i < s; i++) {
this.stack[i] = v[i];
}
this.last_refer = stuff.last_refer;
this.call_stack = clone(stuff.call_stack);
this.tco_counter = clone(stuff.tco_counter);
return s;
},
// private
//s: depth of stack to save
//n: number of args(for outer lambda) to remove (= 0 unless tail position)
//ret: closure array
capture_continuation: function (s, n) {
// note: implementation of this function for final version doesn't exist in 3imp.pdf..
var ss = this.push(n, s);
return this.closure(
["nuate1", this.save_stack(ss), this.current_dynamic_winder],
1, //arity
0, //n (number of frees)
null, //s (stack position to get frees)
-1
); // dotpos
},
// private
// shift stack
// n: number of items to skip (from stack top)
// m: number of items to shift
// s: stack pointer (= index of stack top + 1)
shift_args: function (n, m, s) {
for (var i = n; i >= 0; i--) {
this.index_set(s, i + m + 1, this.index(s, i));
}
return s - m - 1;
},
index: function (s, i) {
return this.stack[s - 1 - i];
},
// private
index_set: function (s, i, v) {
this.stack[s - 1 - i] = v;
},
// private
closure: function (body, n_args, n, s, dotpos) {
const freevars = [];
for (var i = 0; i < n; i++) {
freevars[i] = this.index(s, i);
}
const expected_args = dotpos == -1 ? n_args : undefined;
return new Closure(body, freevars, dotpos, expected_args);
},
// private
run_dump_hook: function (a, x, f, c, s) {
var dumper;
var state;
if (this.dumper) {
dumper = this.dumper;
} else if (Interpreter.dumper) {
dumper = Interpreter.dumper;
} else return;
if (dumper) {
state = { a: a, f: f, c: c, s: s, x: x, stack: this.stack };
dumper.dump(state);
}
},
// private
// a: arbitary object (temporary register)
// x: opecode
// f: integer
// c: BiwaScheme.Closure
// s: integer
_execute: function (a, x, f, c, s) {
var ret = null;
//Console.puts("executing "+x[0]);
while (true) {
//x[0] != "halt"){
this.run_dump_hook(a, x, f, c, s);
switch (x[0]) {
case "halt":
return a;
case "refer-local":
var n = x[1],
x = x[2];
a = this.index(f, n + 1);
this.last_refer = "(anon)";
break;
case "refer-free":
var n = x[1],
x = x[2];
a = c.freevars[n];
this.last_refer = "(anon)";
break;
case "refer-global":
var sym = x[1],
x = x[2];
if (TopEnv.hasOwnProperty(sym)) var val = TopEnv[sym];
else if (CoreEnv.hasOwnProperty(sym)) var val = CoreEnv[sym];
else
throw new BiwaError("execute: unbound symbol: " + inspect(sym));
a = val;
this.last_refer = sym || "(anon)";
break;
case "indirect":
var x = x[1];
a = a[0]; //unboxing
break;
case "constant":
var obj = x[1],
x = x[2];
a = obj;
this.last_refer = "(anon)";
break;
case "close":
var ox = x;
var v = ox[1],
n = ox[2],
body = ox[3],
x = ox[4],
dotpos = ox[5];
a = this.closure(body, v, n, s, dotpos);
s -= n;
break;
case "box":
var n = x[1],
x = x[2];
this.index_set(s, n + 1, [this.index(s, n + 1)]); //boxing
break;
case "test":
var thenc = x[1],
elsec = x[2];
x = a !== false ? thenc : elsec;
break;
case "assign-global":
var name = x[1],
x = x[2];
if (!TopEnv.hasOwnProperty(name) && !CoreEnv.hasOwnProperty(name))
throw new BiwaError(
"global variable '" + name + "' is not defined"
);
TopEnv[name] = a;
a = undef;
break;
case "assign-local":
var n = x[1],
x = x[2];
var box = this.index(f, n + 1);
box[0] = a;
a = undef;
break;
case "assign-free":
var n = x[1],
x = x[2];
var box = c.freevars[n];
box[0] = a;
a = undef;
break;
case "conti":
var n = x[1],
x = x[2];
a = this.capture_continuation(s, n);
break;
case "nuate1":
var stack = x[1],
to = x[2];
var from = this.current_dynamic_winder;
var winders = Interpreter.DynamicWind.listWinders(from, to);
x = Interpreter.DynamicWind.joinWinders(winders, [
"refer-local",
0,
["nuate2", stack],
]);
break;
case "nuate2":
var stack = x[1],
x = ["return"];
s = this.restore_stack(stack);
break;
case "frame":
var ret = x[2];
x = x[1];
s = this.push(ret, this.push(f, this.push(c, s)));
this.tco_counter[this.tco_counter.length] = 0;
break;
case "argument":
var x = x[1];
s = this.push(a, s);
break;
case "shift":
var n = x[1],
x = x[2];
// the number of arguments in the last call
var n_args = this.index(s, n + 1);
s = this.shift_args(n, n_args, s);
break;
case "tco_hinted_apply": // just like a regular apply, except we need to trace the # of TCO calls so we can generate a stacktrace
this.tco_counter[this.tco_counter.length - 1]++;
x = ["apply"].concat(rest(x));
break;
case "apply": //extended: n_args as second argument
var func = a; //, n_args = x[1];
// Save stack trace
this.call_stack.push(this.last_refer);
if (this.call_stack.length > this.max_trace_size) {
// Remove old memory if it grows too long
// Note: this simple way may be inconvenient (e.g. no trace
// will be shown when an error occurred right after returning
// from a large function)
this.call_stack.shift();
}
// the number of arguments in the last call is
// pushed to the stack.
var n_args = this.index(s, 0);
if (isClosure(func)) {
a = func;
x = func.body;
// The position of dot in the parameter list.
const dotpos = func.dotpos;
if (dotpos >= 0) {
// The dot is found
// ----------------
// => Process the &rest args: packing the rest args into a list.
var ls = nil;
for (var i = n_args; --i >= dotpos; ) {
ls = new Pair(this.index(s, i + 1), ls);
}
if (dotpos >= n_args) {
// No rest argument is passed to this closure.
// However, the closure expects the caller passes the rest argument.
// In such case this VM prepares an empty list as the rest argument.
// --------------------------------------------------------------
// => We extend the stack to put the empty list.
for (var i = 0; i < n_args + 1; i++) {
this.index_set(s, i - 1, this.index(s, i));
}
s++;
// => Update the number of arguments
this.index_set(s, 0, this.index(s, 0) + 1);
}
this.index_set(s, dotpos + 1, ls);
} else {
// the dot is not found
// --------------------
// => Verify that number of arguments = expected number of arguments
// (if the closure knows how many it wants)
if (
func.expected_args !== undefined &&
n_args != func.expected_args
) {
var errMsg =
"Function call error: got " +
n_args +
" but wanted " +
func.expected_args;
throw new BiwaError(errMsg);
}
}
f = s;
c = func;
} else if (func instanceof Function) {
// Apply JavaScript function
// load arguments from stack
var args = [];
for (var i = 0; i < n_args; i++) args.push(this.index(s, i + 1));
// invoke the function
var result = func(args, this);
if (result instanceof Pause) {
// it requested the interpreter to suspend
var pause = result;
pause.set_state(this, ["return"], f, c, s);
pause.ready();
return pause;
} else if (result instanceof Call) {
// it requested the interpreter to call a scheme closure
// [frame,
// [constant... (args)
// [constant, proc
// [apply]]]]
// [frame,
// [constant, after
// [apply 1]]]]
// x
var call_after = [
"frame",
[
"argument",
[
"constant",
1,
["argument", ["constant", result.after, ["apply"]]],
],
],
["return"],
];
var call_proc = [
"constant",
result.args.length,
[
"argument",
["constant", result.proc, ["apply", result.args.length]],
],
];
var push_args = reduce(
result.args,
function (opc, arg) {
// (foo 1 2) => first push 2, then 1
// [constant 2 ... [constant 1 ... ]
return ["constant", arg, ["argument", opc]];
},
call_proc
);
x = ["frame", push_args, call_after];
} else {
// the JavaScript function returned a normal value
a = result;
x = ["return"];
}
} else {
// unknown function type
throw new BiwaError(inspect(func) + " is not a function");
}
break;
case "return":
// Pop stack frame
var n = this.index(s, 0);
var ss = s - n;
(x = this.index(ss, 1)),
(f = this.index(ss, 2)),
(c = this.index(ss, 3)),
(s = ss - 3 - 1);
// Pop stack trace (> 1 times if tail calls are done)
var n_pops = 1 + this.tco_counter[this.tco_counter.length - 1];
this.call_stack.splice(-n_pops);
this.tco_counter.pop();
break;
default:
throw new Bug("unknown opecode type: " + x[0]);
}
}
// if(ret === null)
// throw new Bug("interpreter exited in unusual way");
// else
// return ret;
return a;
},
// Compile and evaluate Scheme program
evaluate: function (str, after_evaluate) {
this.call_stack = [];
this.parser = new Parser(str);
this.compiler = new Compiler();
if (after_evaluate) this.after_evaluate = after_evaluate;
//Console.puts("executing: " + str);
this.is_top = true;
this.file_stack = [];
try {
return this.resume(false);
} catch (e) {
e.message = e.message + " [" + this.call_stack.join(", ") + "]";
return this.on_error(e);
}
},
// Resume evaluation
// (internally used from Interpreter#execute and Pause#resume)
resume: function (is_resume, a, x, f, c, s) {
var ret = undef;
for (;;) {
if (is_resume) {
ret = this._execute(a, x, f, c, s);
is_resume = false;
} else {
if (!this.parser) break; // adhoc: when Pause is used via invoke_closure
var expr = this.parser.getObject();
if (expr === Parser.EOS) break;
// expand
expr = Compiler.expand(expr);
// compile
const vmcode = this.compiler.run(expr);
// execute
ret = this._execute(expr, vmcode.il, 0, [], 0);
}
if (ret instanceof Pause) {
//suspend evaluation
return ret;
}
}
// finished executing all forms
this.after_evaluate(ret);
return ret;
},
// Invoke a scheme closure
invoke_closure: function (closure, args) {
args || (args = []);
var n_args = args.length;
var x = [
"constant",
n_args,
["argument", ["constant", closure, ["apply"]]],
];
for (var i = 0; i < n_args; i++)
x = ["constant", args[i], ["argument", x]];
return this._execute(closure, ["frame", x, ["halt"]], 0, closure, 0);
},
// only compiling (for debug use only)
compile: function (str) {
var obj = Interpreter.read(str);
var opc = Compiler.compile(obj);
return opc;
},
// before, after: Scheme closure
push_dynamic_winder: function (before, after) {
this.current_dynamic_winder = new Interpreter.DynamicWind(
this.current_dynamic_winder,
before,
after
);
},
pop_dynamic_winder: function (before, after) {
this.current_dynamic_winder = this.current_dynamic_winder.parent;
},
});
// Take a string and returns an expression.
Interpreter.read = function (str) {
var parser = new Parser(str);
var r = parser.getObject();
return r == Parser.EOS ? eof : r;
};
Interpreter.expand = function () {
throw "Interpreter.expand is moved to Compiler.expand";
};
//
// dynamic-wind
//
Interpreter.DynamicWind = Class.create({
initialize: function (parent, before, after) {
// Parent `DynamicWind` obj
this.parent = parent;
// "before" winder (Scheme closure)
this.before = before;
// "after" winder (Scheme closure)
this.after = after;
},
});
// A special value indicates the root of the winders
// (the string is just for debugging purpose.)
Interpreter.DynamicWind.ROOT = { _: "this is ROOT." };
// Return the list of winders to call
Interpreter.DynamicWind.listWinders = function (from, to) {
// List winders from `from` to `ROOT`
var fromStack = [from];
while (from !== Interpreter.DynamicWind.ROOT) {
from = from.parent;
fromStack.push(from);
}
// List winders from `to` to `ROOT` and find the common one
var toStack = [];
var common;
while (true) {
var matched = fromStack.find(function (item) {
return item === to;
});
if (matched) {
common = matched;
break;
}
toStack.push(to);
to = to.parent;
}
// List `after`s to call
var ret = [];
for (var i = 0; i < fromStack.length; i++) {
if (fromStack[i] === common) break;
ret.push(fromStack[i].after);
}
// List `before`s to call
toStack.reverse();
toStack.forEach(function (item) {
ret.push(item.before);
});
return ret;
};
// Return an opecode to run all the winders
Interpreter.DynamicWind.joinWinders = function (winders, x) {
return winders.reduceRight(function (acc, winder) {
return [
"frame",
["constant", 0, ["argument", ["constant", winder, ["apply"]]]],
acc,
];
}, x);
};
//
// number.js
//
//
// Complex
//
const Complex = Class.create({
initialize: function (real, imag) {
this.real = real;
this.imag = imag;
},
magnitude: function () {
return Math.sqrt(this.real * this.real + this.imag * this.imag);
},
angle: function () {
return Math.atan2(this.imag, this.real);
},
isReal: function () {
return this.imag == 0;
},
isRational: function () {
return this.imag == 0 && isRational(this.real);
},
isInteger: function () {
return this.imag == 0 && isInteger(this.real);
},
toString: function (radix) {
if (this.real === 0 && this.imag === 0) return "0";
var img = "";
if (this.imag !== 0) {
if (this.imag > 0 && this.real !== 0) {
img += "+";
}
switch (this.imag) {
case 1:
break;
case -1:
img += "-";
break;
default:
img += this.imag.toString(radix);
}
img += "i";
}
var real = "";
if (this.real !== 0) {
real += this.real.toString(radix);
}
return real + img;
},
});
Complex.from_polar = function (r, theta) {
var real = r * Math.cos(theta);
var imag = r * Math.sin(theta);
return new Complex(real, imag);
};
Complex.assure = function (num) {
if (num instanceof Complex) return num;
else return new Complex(num, 0);
};
//
// Rational (unfinished)
//
const Rational = Class.create({
initialize: function (numerator, denominator) {
this.numerator = numerator;
this.denominator = denominator;
},
isInteger: function () {
// FIXME
},
});
//
// Predicates
//
const isNumber$1 = function (x) {
return (
x instanceof Complex || x instanceof Rational || typeof x == "number"
);
};
const isComplex = isNumber$1;
const isReal = function (x) {
if (x instanceof Complex || x instanceof Rational) {
return x.isReal();
} else {
return typeof x == "number";
}
};
const isRational = function (x) {
if (x instanceof Complex) {
return x.isRational();
} else if (x instanceof Rational) {
return true;
} else {
return typeof x == "number";
}
};
const isInteger = function (x) {
if (x instanceof Complex || x instanceof Rational) {
return x.isInteger();
} else {
return typeof x == "number" && x % 1 == 0;
}
};
//
// R7RS Promise (lazy library)
//
const BiwaPromise = Class.create({
initialize: function (done, thunk_or_value) {
this.box = [done, thunk_or_value];
},
// Return true when this promise is already calculated
is_done: function () {
return this.box[0];
},
// Return calculated value of this promise
value: function () {
if (!this.is_done()) {
throw new Bug("this promise is not calculated yet");
}
return this.box[1];
},
thunk: function () {
if (this.is_done()) {
throw new Bug("this promise does not know the thunk");
}
return this.box[1];
},
update_with: function (new_promise) {
this.box[0] = new_promise.box[0];
this.box[1] = new_promise.box[1];
new_promise.box = this.box;
},
});
const isPromise = function (obj) {
return obj instanceof BiwaPromise;
};
// Create fresh promise
BiwaPromise.fresh = function (thunk) {
return new BiwaPromise(false, thunk);
};
// Create calculated promise
BiwaPromise.done = function (value) {
return new BiwaPromise(true, value);
};
///
/// infra.js - Basis for library functions
///
//
// define_*func - define library functions
//
const check_arity = function (fname, len, min, max) {
if (len < min) {
if (max && max == min)
throw new BiwaError(
fname +
": wrong number of arguments (expected: " +
min +
" got: " +
len +
")"
);
else
throw new BiwaError(
fname + ": too few arguments (at least: " + min + " got: " + len + ")"
);
} else if (max && max < len)
throw new BiwaError(
fname + ": too many arguments (at most: " + max + " got: " + len + ")"
);
};
const define_libfunc = function (fname, min, max, func) {
var f = function (ar, intp) {
check_arity(fname, ar.length, min, max);
return func(ar, intp);
};
func["fname"] = fname; // for assert_*
f["inspect"] = function () {
return this.fname;
};
CoreEnv[fname] = f;
};
const alias_libfunc = function (fname, aliases) {
if (CoreEnv[fname]) {
if (isArray(aliases)) {
map(aliases, function (a) {
alias_libfunc(fname, a);
});
} else if (isString$1(aliases)) {
CoreEnv[aliases] = CoreEnv[fname];
} else {
console.error(
"[BUG] bad alias for library function " +
"`" +
fname +
"': " +
aliases.toString()
);
}
} else {
console.error(
"[BUG] library function " +
"`" +
fname +
"'" +
" does not exist, so can't alias it."
);
}
};
const define_syntax = function (sname, func) {
var s = new Syntax(sname, func);
CoreEnv[sname] = s;
};
const define_scmfunc = function (fname, min, max, str) {
new Interpreter().evaluate("(define " + fname + " " + str + "\n)");
};
// define_scmfunc("map+", 2, null,
// "(lambda (proc ls) (if (null? ls) ls (cons (proc (car ls)) (map proc (cdr ls)))))");
//
// assertions - type checks
//
const assert_number = make_simple_assert("number", function (obj) {
return typeof obj == "number" || obj instanceof Complex;
});
const assert_integer = make_simple_assert("integer", function (obj) {
return typeof obj == "number" && obj % 1 == 0;
});
const assert_real = make_simple_assert("real number", function (obj) {
return typeof obj == "number";
});
const assert_between = make_assert(function (fname, obj, from, to) {
if (typeof obj != "number" || obj != Math.round(obj)) {
throw new BiwaError(
fname + ": " + "number required, but got " + to_write$1(obj)
);
}
if (obj < from || to < obj) {
throw new BiwaError(
fname +
": " +
"number must be between " +
from +
" and " +
to +
", but got " +
to_write$1(obj)
);
}
});
const assert_string = make_simple_assert("string", isString);
const assert_char = make_simple_assert("character", isChar);
const assert_symbol = make_simple_assert("symbol", isSymbol);
const assert_port = make_simple_assert("port", isPort);
const assert_pair = make_simple_assert("pair", isPair);
const assert_list = make_simple_assert("list", isList);
const assert_vector = make_simple_assert("vector", isVector);
const assert_hashtable = make_simple_assert("hashtable", isHashtable);
const assert_promise = make_simple_assert("promise", isPromise);
const assert_function = make_simple_assert("JavaScript function", isFunction);
const assert_closure = make_simple_assert("scheme closure", isClosure);
const assert_procedure = make_simple_assert("scheme/js function", function (
obj
) {
return isClosure(obj) || isFunction(obj);
});
const assert_date = make_simple_assert("date", function (obj) {
// FIXME: this is not accurate (about cross-frame issue)
// https://prototype.lighthouseapp.com/projects/8886/tickets/443
return obj instanceof Date;
});
//var assert_instance_of = BiwaScheme.make_assert(function(fname, type, obj, klass){
// if(!(obj instanceof klass)){
// throw new BiwaScheme.Error(fname + ": " +
// type + " required, but got " +
// BiwaScheme.to_write(obj));
// }
//});
const assert = make_assert(function (fname, success, message, _fname) {
if (!success) {
throw new BiwaError((_fname || fname) + ": " + message);
}
});
//
// deprecation
//
// Show deprecation warnig
// @param {string} title - feature to be deprecated
// @param {string} ver - when it will be removed (eg. "1.0")
// @param {string} alt - alternatives
const deprecate = function (title, ver, alt) {
var msg =
title +
" is deprecated and will be removed in BiwaScheme " +
ver +
". " +
"Please use " +
alt +
" instead";
console.warn(msg);
};
//
// utils
//
// Parses a fractional notation in the format: <num>/<denom> (e.g. 3/7, -9/4),
// where <num> is a valid integer notation, and <denom> is a valid notation
// for a positive integer.
//
// Returns a float if the notation is valid, otherwise false.
//
// @param {string} rep - the string representation of the fraction
// @return {float|false}
const parse_fraction = function (rep) {
assert_string(rep);
var frac_parts = rep.split("/");
if (frac_parts.length !== 2) return false;
var num_rep = frac_parts[0];
var denom_rep = frac_parts[1];
var num = parse_integer(num_rep, 10);
var denom = parse_integer(denom_rep, 10);
if (num === false || denom === false) return false;
if (denom <= 0) return false;
return num / denom;
};
// Given a string notation of an integer, and the radix, validates the
// notation: returns true if the notation is valid, otherwise false.
//
// @param {string} rep - the string representation of the integer
// @param {integer} rdx - the radix, where 2 <= rdx <= 36
// @return {boolean}
const is_valid_integer_notation = function (rep, rdx) {
assert_string(rep);
assert_integer(rdx);
if (rdx < 2 || rdx > 36) return false;
var rdx_symbols = "0123456789abcdefghijklmnopqrstuvwxyz";
var valid_symbols = rdx_symbols.slice(0, rdx);
var sym_regex = new RegExp("^[+-]?" + "[" + valid_symbols + "]+$", "ig");
return sym_regex.test(rep);
};
// Parse an integer. If the integer does not have a valid representation, or
// produces NaN, - false is returned. If the radix is not within [2..36]
// range, false is returned as well.
//
// @param {string} rep - the string representation of the integer
// @param {integer} rdx - the radix, where 2 <= rdx <= 36
// @return {integer|false}
const parse_integer = function (rep, rdx) {
assert_string(rep);
assert_integer(rdx);
if (rdx < 2 || rdx > 36) return false;
if (!is_valid_integer_notation(rep, rdx)) return false;
var res = parseInt(rep, rdx);
if (Number.isNaN(res)) return false;
return res;
};
// Given a string notation of a floating-point number in the standard or
// scientific notation, returns true if the notation valid, otherwise false.
//
// For example:
// "1" -> true
// "1." -> true
// "1.23" -> true
// "1e4" -> true
// "1E4" -> true
// "1E4.34" -> false
// "e34" -> false
//
// @param {string} rep - the string representation of the float.
// @return {boolean}
const is_valid_float_notation = function (rep) {
assert_string(rep);
var sci_regex = /^[+-]?[0-9]+[.]?[0-9]*e[+-]?[0-9]+$/i;
var fp_regex = /(^[+-]?[0-9]*[.][0-9]+$)|(^[+-]?[0-9]+[.][0-9]*$)/;
if (sci_regex.test(rep) || fp_regex.test(rep)) return true;
return is_valid_integer_notation(rep, 10);
};
// Parse a floating-point number. If the floating-point number does not have a
// valid representation, or produces -Infinity, +Infinity or NaN, - false is
// returned.
//
// @param {string} rep - the string representation of the floating-point value
// @return {float|false}
const parse_float = function (rep) {
assert_string(rep);
if (!is_valid_float_notation(rep)) return false;
var res = new Number(rep).valueOf();
if (Number.isNaN(res)) return false;
if (!Number.isFinite(res)) return false;
return res;
};
//
// R6RS Enumerations
// http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-15.html#node_chap_14
//
// Example
//
// (define-enumeration color
// (black white purple maroon)
// color-set)
//
// (color black) ;=> 'black
// (color purpel) ;=> &syntax exception
// (enum-set->list
// (color-set maroon white)) ;=> #<enum-set (white maroon)>
const Enumeration = {};
// Represents an enum_type.
//
// Becuase there is no way to access an EnumType directly from Scheme,
// EnumType#to_write is not defined.
//
// Properties
//
// members - Array of symbols (no duplicate)
//
Enumeration.EnumType = Class.create({
// Creates a new enum_type.
//
// members - Array of symbols.
// Symbols may be duplicate (I think you shouldn't, though :-p).
initialize: function (members) {
this.members = uniq(members);
},
// Returns an EnumSet.
universe: function () {
return new Enumeration.EnumSet(this, this.members);
},
// Returns a function which map a symbol to an integer (or #f, if
// the symbol is out of the universe).
//
// Implementation note: don't forget this.members may have duplicates.
indexer: function () {
// ar[0] - a symbol
// Returns an integer or #f.
return bind(function (ar) {
assert_symbol(ar[0], "(enum-set indexer)");
var idx = indexOf(this.members, ar[0]);
return idx === -1 ? false : idx;
}, this);
},
// Retuns a function which creates an enum_set from a list of
// symbols (Symbols may be duplicate.)
constructor: function () {
// ar[0] - a list of symbol
// Returns a enum_set.
return bind(function (ar) {
assert_list(ar[0], "(enum-set constructor)");
var symbols = ar[0].to_array();
each(symbols, function (arg) {
assert_symbol(arg, "(enum-set constructor)");
});
return new Enumeration.EnumSet(this, symbols);
}, this);
},
});
Class.memoize(Enumeration.EnumType, ["universe", "indexer", "constructor"]);
// Represents an enum_set of an enum_type.
//
// Properties
//
// enum_type - The enum_type.
// symbols - Array of symbols (no duplicate, properly ordered)
//
Enumeration.EnumSet = Class.create({
// Creates a new enum_set.
//
// enum_type - An EnumType
// symbols - Array of symbols.
//
// initialize normalizes symbols.
// - remove duplicates
// - order by universe
initialize: function (enum_type, symbols) {
this.enum_type = enum_type;
this.symbols = filter(enum_type.members, function (sym) {
return contains(symbols, sym);
});
},
// Returns a list of symbols.
symbol_list: function () {
return array_to_list(this.symbols);
},
// Returns true if the enum_set includes the symbol.
// 'symbol' is allowed to be a symbol which is not included in the universe.
is_member: function (symbol) {
return contains(this.symbols, symbol);
},
// Returns true if:
// - the enum_set is a subset of the enum_set 'other', and
// - the universe of the enum_set is a subset of
// the universe of 'other'.
// The enum_set and 'other' may belong to different enum_type.
is_subset: function (other) {
// Check elements
if (
some(this.symbols, function (sym) {
return !contains(other.symbols, sym);
})
) {
return false;
}
// Check universe
if (this.enum_type === other.enum_type) {
return true;
} else {
return every(this.enum_type.members, function (sym) {
return contains(other.enum_type.members, sym);
});
}
},
// Returns true if:
// - the enum_set contains the same set of symbols as 'other', and
// - universe of the enum_set contains the same set of symbols
// as the universe of 'other'.
//
// The enum_set and 'other' may belong to different enum_type.
equal_to: function (other) {
return this.is_subset(other) && other.is_subset(this);
},
// Returns a enum_set which has:
// - all the symbols included in the enum_set or the enum_set 'other'.
// The enum_set and 'other' *must* belong to the same enum_type.
union: function (other) {
var syms = filter(
this.enum_type.members,
bind(function (sym) {
return contains(this.symbols, sym) || contains(other.symbols, sym);
}, this)
);
return new Enumeration.EnumSet(this.enum_type, syms);
},
// Returns a enum_set which has:
// - the symbols included both in the enum_set or the enum_set 'other'.
// The enum_set and 'other' *must* belong to the same enum_type.
intersection: function (other) {
var syms = filter(this.symbols, function (sym) {
return contains(other.symbols, sym);
});
return new Enumeration.EnumSet(this.enum_type, syms);
},
// Returns a enum_set which has:
// - the symbols included in the enum_set and not in the enum_set 'other'.
// The enum_set and 'other' *must* belong to the same enum_type.
difference: function (other) {
var syms = filter(this.symbols, function (sym) {
return !contains(other.symbols, sym);
});
return new Enumeration.EnumSet(this.enum_type, syms);
},
// Returns a enum_set which has:
// - the symbols included in the universe but not in the enum_set.
complement: function () {
var syms = filter(
this.enum_type.members,
bind(function (sym) {
return !contains(this.symbols, sym);
}, this)
);
return new Enumeration.EnumSet(this.enum_type, syms);
},
// Returns a enum_set which has:
// - the symbols included in the enum_set and the universe of the enum_set 'other'.
// The enum_set and 'other' may belong to different enum_type.
projection: function (other) {
var syms = filter(this.symbols, function (sym) {
return contains(other.enum_type.members, sym);
});
return new Enumeration.EnumSet(other.enum_type, syms);
},
// Returns a string which represents the enum_set.
toString: function () {
return "#<EnumSet " + inspect(this.symbols) + ">";
},
});
Class.memoize(Enumeration.EnumSet, "symbol_list");
const isEnumSet = function (obj) {
return obj instanceof Enumeration.EnumSet;
};
const assert_enum_set = make_simple_assert("enum_set", isEnumSet);
//
// R6RS Records
// http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-7.html#node_chap_6
//
// Record is like struct in C, but supports more feature like inheritance.
// see also: src/library/r6rs_lib.js
//
// Record
// represents each instance of record type
//
const Record = Class.create({
initialize: function (rtd, values) {
assert_record_td(rtd, "new Record");
this.rtd = rtd;
this.fields = values;
},
get: function (k) {
return this.fields[k];
},
set: function (k, v) {
this.fields[k] = v;
},
toString: function () {
var contents = to_write$1(this.fields);
return "#<Record " + this.rtd.name + " " + contents + ">";
},
});
const isRecord = function (o) {
return o instanceof Record;
};
// Defined record types
Record._DefinedTypes = {};
Record.define_type = function (name_str, rtd, cd) {
return (Record._DefinedTypes[name_str] = { rtd: rtd, cd: cd });
};
Record.get_type = function (name_str) {
return Record._DefinedTypes[name_str];
};
//
// RTD (Record type descriptor)
//
Record.RTD = Class.create({
// Symbol RTD Symbol Bool Bool Array
initialize: function (name, parent_rtd, uid, sealed, opaque, fields) {
this.name = name;
this.parent_rtd = parent_rtd;
this.is_base_type = !parent_rtd;
if (uid) {
this.uid = uid;
this.generative = false;
} else {
this.uid = this._generate_new_uid();
this.generative = true;
}
this.sealed = !!sealed;
this.opaque = parent_rtd.opaque || !!opaque;
this.fields = map(fields, function (field) {
return { name: field[0], mutable: !!field[1] };
});
},
// Returns the name of the k-th field.
// Only used for error messages.
field_name: function (k) {
var names = this._field_names();
for (var par = this.parent_rtd; par; par = par.parent_rtd) {
names = par._field_names() + names;
}
return names[k];
},
_field_names: function () {
return map(this.fields, function (spec) {
return spec.name;
});
},
_generate_new_uid: function () {
return Sym(uniqueId("__record_td_uid"));
},
toString: function () {
return "#<RecordTD " + name + ">";
},
});
Record.RTD.NongenerativeRecords = {};
const isRecordTD = function (o) {
return o instanceof Record.RTD;
};
//
// CD (Record constructor descriptor)
//
Record.CD = Class.create({
initialize: function (rtd, parent_cd, protocol) {
this._check(rtd, parent_cd, protocol);
this.rtd = rtd;
this.parent_cd = parent_cd;
if (protocol) {
this.has_custom_protocol = true;
this.protocol = protocol;
} else {
this.has_custom_protocol = false;
if (rtd.parent_rtd)
this.protocol = this._default_protocol_for_derived_types();
else this.protocol = this._default_protocol_for_base_types();
}
},
_check: function (rtd, parent_cd, protocol) {
if (rtd.is_base_type && parent_cd)
throw new Error(
"Record.CD.new: cannot specify parent cd of a base type"
);
if (parent_cd && rtd.parent_rtd && parent_cd.rtd != rtd.parent_rtd)
throw new Error(
"Record.CD.new: mismatched parents between rtd and parent_cd"
);
if (rtd.parent_rtd && !parent_cd && protocol)
throw new Error(
"Record.CD.new: protocol must be #f when parent_cd is not given"
);
if (parent_cd && parent_cd.has_custom_protocol && !protocol)
throw new Error(
"Record.CD.new: protocol must be specified when parent_cd has a custom protocol"
);
},
_default_protocol_for_base_types: function () {
// (lambda (p) p)
// called with `p' as an argument
return function (ar) {
var p = ar[0];
assert_procedure(p, "_default_protocol/base");
return p;
};
},
_default_protocol_for_derived_types: function () {
// (lambda (n)
// (lambda (a b x y s t)
// (let1 p (n a b x y) (p s t))))
// called with `n' as an argument
var rtd = this.rtd;
return function (ar) {
var n = ar[0];
assert_procedure(n, "_default_protocol/n");
var ctor = function (args) {
var my_argc = rtd.fields.length;
var ancestor_argc = args.length - my_argc;
var ancestor_values = args.slice(0, ancestor_argc);
var my_values = args.slice(ancestor_argc);
// (n a b x y) => p
return new Call(n, ancestor_values, function (ar) {
var p = ar[0];
assert_procedure(p, "_default_protocol/p");
// (p s t) => record
return new Call(p, my_values, function (ar) {
var record = ar[0];
assert_record(record, "_default_protocol/result");
return record;
});
});
};
return ctor;
};
},
toString: function () {
return "#<RecordCD " + this.rtd.name + ">";
},
record_constructor: function () {
var arg_for_protocol = this.parent_cd
? this._make_n([], this.rtd)
: this._make_p();
arg_for_protocol = bind(arg_for_protocol, this);
return new Call(this.protocol, [arg_for_protocol], function (ar) {
var ctor = ar[0];
assert_procedure(ctor, "record_constructor");
return ctor;
});
},
// Create the function `p' which is given to the protocol.
_make_p: function () {
return function (values) {
return new Record(this.rtd, values);
// TODO: check argc
};
},
// Create the function `n' which is given to the protocol.
// When creating an instance of a derived type,
// _make_n is called for each ancestor rtd's.
_make_n: function (children_values, rtd) {
var parent_cd = this.parent_cd;
if (parent_cd) {
// called from protocol (n)
var n = function (args_for_n) {
// called from protocol (p)
var p = function (args_for_p) {
var values = [].concat(args_for_p[0]).concat(children_values);
var parent_n = parent_cd._make_n(values, rtd);
return new Call(parent_cd.protocol, [parent_n], function (ar) {
var ctor = ar[0];
assert_procedure(ctor, "_make_n");
return new Call(ctor, args_for_n, function (ar) {
var record = ar[0];
assert_record(record);
return record;
});
});
};
return p;
};
return n;
} else {
var n = function (my_values) {
var values = my_values.concat(children_values);
return new Record(rtd, values);
// TODO: check argc
};
return n;
}
},
});
const isRecordCD = function (o) {
return o instanceof Record.CD;
};
const assert_record = make_simple_assert("record", isRecord);
const assert_record_td = make_simple_assert(
"record type descriptor",
isRecordTD
);
const assert_record_cd = make_simple_assert(
"record constructor descriptor",
isRecordCD
);
//
// Values
//
const Values$1 = Class.create({
initialize: function (values) {
this.content = values;
},
to_write: function () {
return "#<Values " + map(this.content, to_write$1).join(" ") + ">";
},
});
const Console = {};
// Actual implementation is in src/platforms/*/console.js
define_libfunc("html-escape", 1, 1, function (ar) {
assert_string(ar[0]);
return _escape(ar[0]);
});
const inspect_objs = function (objs) {
return map(objs, inspect).join(", ");
};
define_libfunc("inspect", 1, null, function (ar) {
return inspect_objs(ar);
});
define_libfunc("inspect!", 1, null, function (ar) {
Console.puts(inspect_objs(ar));
return undef;
});
//
// json
//
// json->sexp
// Array -> list
// Object -> alist
// (number, boolean, string,
//
const json2sexp = function (json) {
switch (true) {
case isNumber$2(json) ||
isString$1(json) ||
json === true ||
json === false:
return json;
case isArray(json):
return array_to_list(map(json, json2sexp));
case typeof json == "object":
var ls = nil;
for (key in json) {
ls = new Pair(new Pair(key, json2sexp(json[key])), ls);
}
return ls;
default:
throw new Error(
"json->sexp: detected invalid value for json: " + inspect(json)
);
}
};
define_libfunc("json->sexp", 1, 1, function (ar) {
return json2sexp(ar[0]);
});
// (vector-push! v item1 item2 ...)
define_libfunc("vector-push!", 2, null, function (ar) {
assert_vector(ar[0]);
for (var i = 1; i < ar.length; i++) {
ar[0].push(ar[i]);
}
return ar[0];
});
//
//from Gauche
//
// (identity obj)
// Returns obj.
define_libfunc("identity", 1, 1, function (ar) {
return ar[0];
});
// (inc! i)
// = (begin (set! i (+ i 1)) i)
// Increments i (i.e., set i+1 to i).
define_syntax("inc!", function (x) {
var target = x.cdr.car;
return List(
Sym("begin"),
List(Sym("set!"), target, List(Sym("+"), target, 1)),
target
);
});
// (dec! i)
// = (begin (set! i (- i 1)) i)
// Decrements i (i.e., set i-1 to i).
define_syntax("dec!", function (x) {
var target = x.cdr.car;
return List(
Sym("begin"),
List(Sym("set!"), target, List(Sym("-"), target, 1)),
target
);
});
// string
define_libfunc("string-concat", 1, 1, function (ar) {
assert_list(ar[0]);
return ar[0].to_array().join("");
});
define_libfunc("string-split", 2, 2, function (ar) {
assert_string(ar[0]);
assert_string(ar[1]);
return array_to_list(ar[0].split(ar[1]));
});
define_libfunc("string-join", 1, 2, function (ar) {
assert_list(ar[0]);
var delim = "";
if (ar[1]) {
assert_string(ar[1]);
delim = ar[1];
}
return ar[0].to_array().join(delim);
});
// lists
define_libfunc("intersperse", 2, 2, function (ar) {
var item = ar[0],
ls = ar[1];
assert_list(ls);
var ret = [];
each(ls.to_array().reverse(), function (x) {
ret.push(x);
ret.push(item);
});
ret.pop();
return array_to_list(ret);
});
define_libfunc("map-with-index", 2, null, function (ar) {
var proc = ar.shift(),
lists = ar;
each(lists, assert_list);
var results = [],
i = 0;
return Call.multi_foreach(lists, {
call: function (xs) {
var args = map(xs, function (x) {
return x.car;
});
args.unshift(i);
i++;
return new Call(proc, args);
},
result: function (res) {
results.push(res);
},
finish: function () {
return array_to_list(results);
},
});
});
// loop
// (dotimes (variable limit result) body ...)
// Iterate with variable 0 to limit-1.
// ->
// (do ((tlimit limit)
// (variable 0 (+ variable 1)))
// ((>= variable tlimit) result)
// body ...)
define_syntax("dotimes", function (x) {
var spec = x.cdr.car,
bodies = x.cdr.cdr;
var variable = spec.car,
limit = spec.cdr.car,
result = spec.cdr.cdr.car;
var tlimit = gensym();
var do_vars = deep_array_to_list([
[tlimit, limit],
[variable, 0, [Sym("+"), variable, 1]],
]);
var do_check = deep_array_to_list([[Sym(">="), variable, tlimit], result]);
return new Pair(Sym("do"), new Pair(do_vars, new Pair(do_check, bodies)));
});
// sorting (Obsolete: use list-sort, etc. instead of these.)
// utility function. takes a JS Array and a Scheme procedure,
// returns sorted array
var sort_with_comp = function (ary, proc, intp) {
return ary.sort(function (a, b) {
var intp2 = new Interpreter(intp);
return intp2.invoke_closure(proc, [a, b]);
});
};
define_libfunc("list-sort/comp", 1, 2, function (ar, intp) {
assert_procedure(ar[0]);
assert_list(ar[1]);
return array_to_list(sort_with_comp(ar[1].to_array(), ar[0], intp));
});
define_libfunc("vector-sort/comp", 1, 2, function (ar, intp) {
assert_procedure(ar[0]);
assert_vector(ar[1]);
return sort_with_comp(clone(ar[1]), ar[0], intp);
});
define_libfunc("vector-sort/comp!", 1, 2, function (ar, intp) {
assert_procedure(ar[0]);
assert_vector(ar[1]);
sort_with_comp(ar[1], ar[0], intp);
return undef;
});
// macros
//(define-macro (foo x y) body ...)
//(define-macro foo lambda)
var rearrange_args = function (expected, given) {
var args = [];
var dotpos = new Compiler().find_dot_pos(expected);
if (dotpos == -1) args = given;
else {
for (var i = 0; i < dotpos; i++) {
args[i] = given[i];
}
args[i] = array_to_list(given.slice(i));
}
return args;
};
define_syntax("define-macro", function (x) {
var head = x.cdr.car;
var expected_args;
if (head instanceof Pair) {
var name = head.car;
expected_args = head.cdr;
var body = x.cdr.cdr;
var lambda = new Pair(Sym("lambda"), new Pair(expected_args, body));
} else {
var name = head;
var lambda = x.cdr.cdr.car;
expected_args = lambda.cdr.car;
}
//["close", <args>, <n>, <body>, <opecodes_next>, <dotpos>]
var opc = Compiler.compile(lambda).il;
if (opc[2] != 0)
throw new Bug(
"you cannot use free variables in macro expander (or define-macro must be on toplevel)"
);
var cls = new Closure(opc[3], [], -1, undefined);
TopEnv[name.name] = new Syntax(name.name, function (sexp) {
var given_args = sexp.to_array();
given_args.shift();
var intp = new Interpreter();
var args = rearrange_args(expected_args, given_args);
var result = intp.invoke_closure(cls, args);
return result;
});
return undef;
});
var macroexpand_1 = function (x) {
if (x instanceof Pair) {
// TODO: Should we check CoreEnv too?
if (x.car instanceof BiwaSymbol && TopEnv[x.car.name] instanceof Syntax) {
var transformer = TopEnv[x.car.name];
x = transformer.transform(x);
} else
throw new Error(
"macroexpand-1: `" + to_write$1(x) + "' is not a macro"
);
}
return x;
};
define_syntax("%macroexpand", function (x) {
var expanded = Compiler.expand(x.cdr.car);
return List(Sym("quote"), expanded);
});
define_syntax("%macroexpand-1", function (x) {
var expanded = macroexpand_1(x.cdr.car);
return List(Sym("quote"), expanded);
});
define_libfunc("macroexpand", 1, 1, function (ar) {
return Compiler.expand(ar[0]);
});
define_libfunc("macroexpand-1", 1, 1, function (ar) {
return macroexpand_1(ar[0]);
});
define_libfunc("gensym", 0, 0, function (ar) {
return gensym();
});
// i/o
define_libfunc("print", 1, null, function (ar) {
map(ar, function (item) {
Console.puts(to_display(item), true);
});
Console.puts(""); //newline
return undef;
});
define_libfunc("write-to-string", 1, 1, function (ar) {
return to_write$1(ar[0]);
});
define_libfunc("read-from-string", 1, 1, function (ar) {
assert_string(ar[0]);
return Interpreter.read(ar[0]);
});
define_libfunc("port-closed?", 1, 1, function (ar) {
assert_port(ar[0]);
return !ar[0].is_open;
});
//define_libfunc("with-input-from-port", 2, 2, function(ar){
//define_libfunc("with-error-to-port", 2, 2, function(ar){
define_libfunc("with-output-to-port", 2, 2, function (ar) {
var port = ar[0],
proc = ar[1];
assert_port(port);
assert_procedure(proc);
var original_port = Port.current_output;
Port.current_output = port;
return new Call(proc, [port], function (ar) {
port.close();
Port.current_output = original_port;
return ar[0];
});
});
// syntax
define_syntax("let1", function (x) {
//(let1 vari expr body ...)
//=> ((lambda (var) body ...) expr)
var vari = x.cdr.car;
var expr = x.cdr.cdr.car;
var body = x.cdr.cdr.cdr;
return new Pair(
new Pair(Sym("lambda"), new Pair(new Pair(vari, nil), body)),
new Pair(expr, nil)
);
});
//
// Regular Expression
//
var assert_regexp = function (obj, fname) {
if (!(obj instanceof RegExp))
throw new Error(fname + ": regexp required, but got " + to_write$1(obj));
};
//Function: string->regexp string &keyword case-fold
define_libfunc("string->regexp", 1, 1, function (ar) {
assert_string(ar[0], "string->regexp");
return new RegExp(ar[0]); //todo: case-fold
});
//Function: regexp? obj
define_libfunc("regexp?", 1, 1, function (ar) {
return ar[0] instanceof RegExp;
});
//Function: regexp->string regexp
define_libfunc("regexp->string", 1, 1, function (ar) {
assert_regexp(ar[0], "regexp->string");
return ar[0].toString().slice(1, -1); //cut '/'
});
define_libfunc("regexp-exec", 2, 2, function (ar) {
var rexp = ar[0];
if (isString$1(ar[0])) {
rexp = new RegExp(ar[0]);
}
assert_regexp(rexp, "regexp-exec");
assert_string(ar[1], "regexp-exec");
var ret = rexp.exec(ar[1]);
return ret === null ? false : array_to_list(ret);
});
// //Function: rxmatch regexp string
// define_libfunc("rxmatch", 1, 1, function(ar){
// assert_regexp(ar[0], "rxmatch");
// assert_string(ar[1], "rxmatch");
// return ar[0].match(ar[1]);
// });
//Function: rxmatch-start match &optional (i 0)
//Function: rxmatch-end match &optional (i 0)
//Function: rxmatch-substring match &optional (i 0)
//Function: rxmatch-num-matches match
//Function: rxmatch-after match &optional (i 0)
//Function: rxmatch-before match &optional (i 0)
//Generic application: regmatch &optional index
//Generic application: regmatch 'before &optional index
//Generic application: regmatch 'after &optional index
//Function: regexp-replace regexp string substitution
// regexp-replace-all regexp string substitution
define_libfunc("regexp-replace-all", 3, 3, function (ar) {
var pat = ar[0];
if (isString$1(pat)) {
var rexp = new RegExp(pat, "g");
} else {
assert_regexp(pat);
var rexp = new RegExp(pat.source, "g");
}
assert_string(ar[1]);
assert_string(ar[2]);
return ar[1].replace(rexp, ar[2]);
});
//Function: regexp-replace* string rx1 sub1 rx2 sub2 ...
//Function: regexp-replace-all* string rx1 sub1 rx2 sub2 ...
//Function: regexp-quote string
//Macro: rxmatch-let match-expr (var ...) form ...
//Macro: rxmatch-if match-expr (var ...) then-form else-form
//Macro: rxmatch-cond clause ...
//Macro: rxmatch-case string-expr clause ...
//
// interface to javascript
//
// Rebind uses of eval to the global scope, to avoid polluting downstream code.
// See: https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval
let eval2 = eval;
define_libfunc("js-eval", 1, 1, function (ar) {
return eval2(ar[0]);
});
define_libfunc("js-ref", 2, 2, function (ar) {
if (isString$1(ar[1])) {
return ar[0][ar[1]];
} else {
assert_symbol(ar[1]);
return ar[0][ar[1].name];
}
});
define_libfunc("js-set!", 3, 3, function (ar) {
assert_string(ar[1]);
ar[0][ar[1]] = ar[2];
return undef;
});
// (js-call (js-eval "Math.pow") 2 4)
define_libfunc("js-call", 1, null, function (ar) {
var js_func = ar.shift();
assert_function(js_func);
var receiver = null;
return js_func.apply(receiver, ar);
});
// (js-invoke (js-new "Date") "getTime")
define_libfunc("js-invoke", 2, null, function (ar) {
var js_obj = ar.shift();
var func_name = ar.shift();
if (!isString$1(func_name)) {
assert_symbol(func_name);
func_name = func_name.name;
}
if (js_obj[func_name]) return js_obj[func_name].apply(js_obj, ar);
else
throw new Error("js-invoke: function " + func_name + " is not defined");
});
// Short hand for JavaScript method call.
//
// (js-invocation obj '(foo 1 2 3)) ;=> obj.foo(1,2,3)
// (js-invocation obj '(foo 1 2 3) ;=> obj.foo(1,2,3)
// 'bar ; .bar
// '(baz 4 5)) ; .baz(4,5)
// (js-invocation 'Math '(pow 2 3)) ;=> Math.pow(2,3)
//
// It also converts
// (lambda (e) ...) to
// (js-closure (lambda (e) ...))
// and
// '((a . b) (c . 4)) to
// {a: "b", c: 4}
//
define_libfunc("js-invocation", 2, null, function (ar, intp) {
var receiver = ar.shift();
// TODO: convert lambdas by js-closure
if (isSymbol(receiver)) {
receiver = eval2(receiver.name); //XXX: is this ok?
}
var v = receiver;
// Process each method call
each(ar, function (callspec) {
if (isSymbol(callspec)) {
// Property access
v = v[callspec.name];
} else if (isList(callspec)) {
// Method call
var args = callspec.to_array();
assert_symbol(args[0]);
var method = args.shift().name;
// Convert arguments
args = map(args, function (arg) {
if (isClosure(arg)) {
// closure -> JavaScript funciton
return js_closure(arg, intp);
} else if (isList(arg)) {
// alist -> JavaScript Object
var o = {};
arg.foreach(function (pair) {
assert_symbol(pair.car);
o[pair.car.name] = pair.cdr;
});
return o;
} else return arg;
});
// Call the method
if (!isFunction$1$1(v[method])) {
throw new BiwaError(
"js-invocation: the method `" + method + "' not found"
);
}
v = v[method].apply(v, args);
} else {
// (wrong argument)
throw new BiwaError(
"js-invocation: expected list or symbol for callspec but got " +
inspect(callspec)
);
}
});
return v;
});
// TODO: provide corresponding macro ".."
define_syntax("..", function (x) {
if (x.cdr == nil) {
throw new Error("malformed ..");
}
return new Pair(Sym("js-invocation"), x.cdr);
});
// (js-new (js-eval "Date") 2005 1 1)
// (js-new (js-eval "Draggable") elem 'onEnd (lambda (drg) ...))
// If symbol is given, following arguments are converted to
// an js object. If any of them is a scheme closure,
// it is converted to js function which invokes that closure.
//
// (js-new "Date" 2005 1 1)
// You can pass javascript program string for constructor.
define_libfunc("js-new", 1, null, function (ar, intp) {
// make js object from key-value pair
var array_to_obj = function (ary) {
if (ary.length % 2 != 0)
throw new Error("js-new: odd number of key-value pair");
var obj = {};
for (var i = 0; i < ary.length; i += 2) {
var key = ary[i],
value = ary[i + 1];
assert_symbol(key);
if (isClosure(value)) value = js_closure(value, intp);
obj[key.name] = value;
}
return obj;
};
var ctor = ar.shift();
if (isString$1(ctor)) ctor = eval2(ctor);
if (ar.length == 0) {
return new ctor();
} else {
// pack args to js object, if symbol appears
var args = [];
for (var i = 0; i < ar.length; i++) {
if (ar[i] instanceof BiwaSymbol) {
args.push(array_to_obj(ar.slice(i)));
break;
} else {
args.push(ar[i]);
}
}
// Run `new ctor(...args)`;
return new (Function.prototype.bind.apply(ctor, [null].concat(args)))();
}
});
// (js-obj "foo" 1 "bar" 2)
// -> {"foo": 1, "bar": 2}
define_libfunc("js-obj", 0, null, function (ar) {
if (ar.length % 2 != 0) {
throw new Error("js-obj: number of arguments must be even");
}
var obj = {};
for (i = 0; i < ar.length / 2; i++) {
assert_string(ar[i * 2]);
obj[ar[i * 2]] = ar[i * 2 + 1];
}
return obj;
});
const js_closure = function (proc, intp) {
var intp2 = new Interpreter(intp);
return function (/*args*/) {
return intp2.invoke_closure(proc, toArray(arguments));
};
};
// (js-closure (lambda (event) ..))
// Returns a js function which executes the given procedure.
//
// Example
// (add-handler! ($ "#btn") "click" (js-closure on-click))
define_libfunc("js-closure", 1, 1, function (ar, intp) {
assert_closure(ar[0]);
return js_closure(ar[0], intp);
});
define_libfunc("js-null?", 1, 1, function (ar) {
return ar[0] === null;
});
define_libfunc("js-undefined?", 1, 1, function (ar) {
return ar[0] === undefined;
});
define_libfunc("js-function?", 1, 1, function (ar) {
return isFunction$1$1(ar[0]);
});
define_libfunc("js-array-to-list", 1, 1, function (ar) {
deprecate("js-array-to-list", "1.0", "js-array->list");
return array_to_list(ar[0]);
});
define_libfunc("js-array->list", 1, 1, function (ar) {
return array_to_list(ar[0]);
});
define_libfunc("list-to-js-array", 1, 1, function (ar) {
deprecate("list-to-js-array", "1.0", "list->js-array");
return ar[0].to_array();
});
define_libfunc("list->js-array", 1, 1, function (ar) {
return ar[0].to_array();
});
define_libfunc("alist-to-js-obj", 1, 1, function (ar) {
deprecate("alist-to-js-obj", "1.0", "alist->js-obj");
return alist_to_js_obj(ar[0]);
});
define_libfunc("alist->js-obj", 1, 1, function (ar) {
assert_list(ar[0]);
return alist_to_js_obj(ar[0]);
});
define_libfunc("js-obj-to-alist", 1, 1, function (ar) {
deprecate("js-obj-to-alist", "1.0", "js-obj->alist");
return js_obj_to_alist(ar[0]);
});
define_libfunc("js-obj->alist", 1, 1, function (ar) {
return js_obj_to_alist(ar[0]);
});
//
// timer, sleep
//
define_libfunc("timer", 2, 2, function (ar, intp) {
var proc = ar[0],
sec = ar[1];
assert_closure(proc);
assert_real(sec);
var intp2 = new Interpreter(intp);
setTimeout(function () {
intp2.invoke_closure(proc);
}, sec * 1000);
return undef;
});
define_libfunc("set-timer!", 2, 2, function (ar, intp) {
var proc = ar[0],
sec = ar[1];
assert_closure(proc);
assert_real(sec);
var intp2 = new Interpreter(intp);
return setInterval(function () {
intp2.invoke_closure(proc);
}, sec * 1000);
});
define_libfunc("clear-timer!", 1, 1, function (ar) {
var timer_id = ar[0];
clearInterval(timer_id);
return undef;
});
define_libfunc("sleep", 1, 1, function (ar) {
var sec = ar[0];
assert_real(sec);
return new Pause(function (pause) {
setTimeout(function () {
pause.resume(nil);
}, sec * 1000);
});
});
//
// console
//
// (console-debug obj1 ...)
// (console-log obj1 ...)
// (console-info obj1 ...)
// (console-warn obj1 ...)
// (console-error obj1 ...)
// Put objects to console, if window.console is defined.
// Returns obj1.
//
// Example:
// (some-func arg1 (console-debug arg2) arg3)
var define_console_func = function (name) {
define_libfunc("console-" + name, 1, null, function (ar) {
var con = window.console;
if (con) {
var vals = map(ar, function (item) {
return inspect(item, { fallback: item });
});
con[name].apply(con, vals);
}
return ar[0];
});
};
define_console_func("debug");
define_console_func("log");
define_console_func("info");
define_console_func("warn");
define_console_func("error");
///
/// R6RS Base library
///
//
// 11.4 Expressions
//
// 11.4.1 Quotation
//(quote)
// 11.4.2 Procedures
//(lambda)
// 11.4.3 Conditionaar
//(if)
// 11.4.4 Assignments
//(set!)
// 11.4.5 Derived conditionaar
define_syntax("cond", function (x) {
var clauses = x.cdr;
if (!(clauses instanceof Pair) || clauses === nil) {
throw new BiwaError(
"malformed cond: cond needs list but got " + write_ss(clauses)
);
}
// TODO: assert that clauses is a proper list
var ret = null;
each(clauses.to_array().reverse(), function (clause) {
if (!(clause instanceof Pair)) {
throw new BiwaError("bad clause in cond: " + write_ss(clause));
}
if (clause.car === Sym("else")) {
if (ret !== null) {
throw new BiwaError(
"'else' clause of cond followed by more clauses: " +
write_ss(clauses)
);
} else if (clause.cdr === nil) {
// pattern A: (else)
// -> #f ; not specified in R6RS...?
ret = false;
} else if (clause.cdr.cdr === nil) {
// pattern B: (else expr)
// -> expr
ret = clause.cdr.car;
} else {
// pattern C: (else expr ...)
// -> (begin expr ...)
ret = new Pair(Sym("begin"), clause.cdr);
}
} else {
var test = clause.car;
if (clause.cdr === nil) {
// pattern 1: (test)
// -> (or test ret)
ret = List(Sym("or"), test, ret);
} else if (clause.cdr.cdr === nil) {
// pattern 2: (test expr)
// -> (if test expr ret)
ret = List(Sym("if"), test, clause.cdr.car, ret);
} else if (clause.cdr.car === Sym("=>")) {
// pattern 3: (test => expr)
// -> (let ((#<gensym1> test))
// (if test (expr #<gensym1>) ret))
var test = clause.car,
expr = clause.cdr.cdr.car;
var tmp_sym = gensym();
ret = List(
Sym("let"),
List(List(tmp_sym, test)),
List(Sym("if"), test, List(expr, tmp_sym), ret)
);
} else {
// pattern 4: (test expr ...)
// -> (if test (begin expr ...) ret)
ret = List(Sym("if"), test, new Pair(Sym("begin"), clause.cdr), ret);
}
}
});
return ret;
});
define_syntax("case", function (x) {
var tmp_sym = gensym();
if (x.cdr === nil) {
throw new BiwaError("case: at least one clause is required");
} else if (!(x.cdr instanceof Pair)) {
throw new BiwaError("case: proper list is required");
} else {
// (case key clauses ....)
// -> (let ((#<gensym1> key))
var key = x.cdr.car;
var clauses = x.cdr.cdr;
var ret = undefined;
each(clauses.to_array().reverse(), function (clause) {
if (clause.car === Sym("else")) {
// pattern 0: (else expr ...)
// -> (begin expr ...)
if (ret === undefined) {
ret = new Pair(Sym("begin"), clause.cdr);
} else {
throw new BiwaError(
"case: 'else' clause followed by more clauses: " +
write_ss(clauses)
);
}
} else {
// pattern 1: ((datum ...) expr ...)
// -> (if (or (eqv? key (quote d1)) ...) (begin expr ...) ret)
ret = List(
Sym("if"),
new Pair(
Sym("or"),
array_to_list(
map(clause.car.to_array(), function (d) {
return List(Sym("eqv?"), tmp_sym, List(Sym("quote"), d));
})
)
),
new Pair(Sym("begin"), clause.cdr),
ret
);
}
});
return new Pair(
Sym("let1"),
new Pair(tmp_sym, new Pair(key, new Pair(ret, nil)))
);
}
});
define_syntax("and", function (x) {
// (and a b c) => (if a (if b c #f) #f)
//todo: check improper list
if (x.cdr == nil) return true;
var objs = x.cdr.to_array();
var i = objs.length - 1;
var t = objs[i];
for (i = i - 1; i >= 0; i--) t = List(Sym("if"), objs[i], t, false);
return t;
});
define_syntax("or", function (x) {
// (or a b c) => (if a a (if b b (if c c #f)))
//todo: check improper list
var objs = x.cdr.to_array();
var f = false;
for (var i = objs.length - 1; i >= 0; i--)
f = List(Sym("if"), objs[i], objs[i], f);
return f;
});
// 11.4.6 Binding constructs
define_syntax("let", function (x) {
//(let ((a 1) (b 2)) (print a) (+ a b))
//=> ((lambda (a b) (print a) (+ a b)) 1 2)
var name = null;
if (x.cdr.car instanceof BiwaSymbol) {
name = x.cdr.car;
x = x.cdr;
}
var binds = x.cdr.car,
body = x.cdr.cdr;
if (!(binds instanceof Pair) && binds != nil) {
throw new BiwaError(
"let: need a pair for bindings: got " + to_write$1(binds)
);
}
var vars = nil,
vals = nil;
for (var p = binds; p instanceof Pair; p = p.cdr) {
if (!(p.car instanceof Pair)) {
throw new BiwaError(
"let: need a pair for bindings: got " + to_write$1(p.car)
);
}
vars = new Pair(p.car.car, vars);
vals = new Pair(p.car.cdr.car, vals);
}
var lambda = null;
if (name) {
// (let loop ((a 1) (b 2)) body ..)
//=> (letrec ((loop (lambda (a b) body ..))) (loop 1 2))
vars = array_to_list(vars.to_array().reverse());
vals = array_to_list(vals.to_array().reverse());
var body_lambda = new Pair(Sym("lambda"), new Pair(vars, body));
var init_call = new Pair(name, vals);
lambda = List(
Sym("letrec"),
new Pair(List(name, body_lambda), nil),
init_call
);
} else {
lambda = new Pair(new Pair(Sym("lambda"), new Pair(vars, body)), vals);
}
return lambda;
});
define_syntax("let*", function (x) {
//(let* ((a 1) (b a)) (print a) (+ a b))
//-> (let ((a 1))
// (let ((b a)) (print a) (+ a b)))
var binds = x.cdr.car,
body = x.cdr.cdr;
if (binds === nil) return new Pair(Sym("let"), new Pair(nil, body));
if (!(binds instanceof Pair))
throw new BiwaError(
"let*: need a pair for bindings: got " + to_write$1(binds)
);
var ret = null;
each(binds.to_array().reverse(), function (bind) {
ret = new Pair(
Sym("let"),
new Pair(new Pair(bind, nil), ret == null ? body : new Pair(ret, nil))
);
});
return ret;
});
var expand_letrec_star = function (x) {
var binds = x.cdr.car,
body = x.cdr.cdr;
if (!(binds instanceof Pair))
throw new BiwaError(
"letrec*: need a pair for bindings: got " + to_write$1(binds)
);
var ret = body;
each(binds.to_array().reverse(), function (bind) {
ret = new Pair(new Pair(Sym("set!"), bind), ret);
});
var letbody = nil;
each(binds.to_array().reverse(), function (bind) {
letbody = new Pair(new Pair(bind.car, new Pair(undef, nil)), letbody);
});
return new Pair(Sym("let"), new Pair(letbody, ret));
};
define_syntax("letrec", expand_letrec_star);
define_syntax("letrec*", expand_letrec_star);
define_syntax("let-values", function (x) {
// (let-values (((a b) (values 1 2))
// ((c d . e) (values 3 4 a)))
// (print a b c d e))
// =>
// (let ((#<gensym1> (lambda () (values 1 2)))
// (#<gensym2> (lambda () (values 3 4 a))))
// (let*-values (((a b) #<gensym1>)
// ((c d . e) #<gensym2>))
// (print a b c d e)))
var mv_bindings = x.cdr.car;
var body = x.cdr.cdr;
var ret = null;
var let_bindings = nil;
var let_star_values_bindings = nil;
each(mv_bindings.to_array().reverse(), function (item) {
var init = item.cdr.car;
var tmpsym = gensym();
var binding = new Pair(
tmpsym,
new Pair(
new Pair(Sym("lambda"), new Pair(nil, new Pair(init, nil))),
nil
)
);
let_bindings = new Pair(binding, let_bindings);
var formals = item.car;
let_star_values_bindings = new Pair(
new Pair(formals, new Pair(new Pair(tmpsym, nil), nil)),
let_star_values_bindings
);
});
var let_star_values = new Pair(
Sym("let*-values"),
new Pair(let_star_values_bindings, body)
);
ret = new Pair(
Sym("let"),
new Pair(let_bindings, new Pair(let_star_values, nil))
);
return ret;
});
//let*-values
define_syntax("let*-values", function (x) {
// (let*-values (((a b) (values 1 2))
// ((c d . e) (values 3 4 a)))
// (print a b c d e))
// -> (call-with-values
// (lambda () (values 1 2))
// (lambda (a b)
// (call-with-values
// (lambda () (values 3 4 a))
// (lambda (c d . e)
// (print a b c d e)))))
var mv_bindings = x.cdr.car;
var body = x.cdr.cdr;
var ret = null;
each(mv_bindings.to_array().reverse(), function (item) {
var formals = item.car,
init = item.cdr.car;
ret = new Pair(
Sym("call-with-values"),
new Pair(
new Pair(Sym("lambda"), new Pair(nil, new Pair(init, nil))),
new Pair(
new Pair(
Sym("lambda"),
new Pair(formals, ret == null ? body : new Pair(ret, nil))
),
nil
)
)
);
});
return ret;
});
// 11.4.7 Sequencing
//(begin)
//
// 11.5 Equivalence predicates
//
define_libfunc("eqv?", 2, 2, function (ar) {
return eqv(ar[0], ar[1]);
});
define_libfunc("eq?", 2, 2, function (ar) {
return eq(ar[0], ar[1]);
});
define_libfunc("equal?", 2, 2, function (ar) {
return equal(ar[0], ar[1]);
});
//
// 11.6 Procedure predicate
//
//"procedure?", 1, 1
define_libfunc("procedure?", 1, 1, function (ar) {
return isProcedure(ar[0]);
});
//
// 11.7 Arithmetic
//
// 11.7.1 Propagation of exactness and inexactness
// 11.7.2 Representability of infinities and NaNs
// 11.7.3 Semantics of common operations
// 11.7.3.1 Integer division
// 11.7.3.2 Transcendental functions
//(no functions are introduced by above sections)
//
// 11.7.4 Numerical operations
//
// 11.7.4.1 Numerical type predicates
define_libfunc("number?", 1, 1, function (ar) {
return isNumber$1(ar[0]);
});
define_libfunc("complex?", 1, 1, function (ar) {
return isComplex(ar[0]);
});
define_libfunc("real?", 1, 1, function (ar) {
return isReal(ar[0]);
});
define_libfunc("rational?", 1, 1, function (ar) {
return isRational(ar[0]);
});
define_libfunc("integer?", 1, 1, function (ar) {
return isInteger(ar[0]);
});
//(real-valued? obj) procedure
//(rational-valued? obj) procedure
//(integer-valued? obj) procedure
//
//(exact? z) procedure
//(inexact? z) procedure
// 11.7.4.2 Generic conversions
//
//(inexact z) procedure
//(exact z) procedure
//
// 11.7.4.3 Arithmetic operations
//inf & nan: ok (for this section)
define_libfunc("=", 2, null, function (ar) {
var v = ar[0];
assert_number(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_number(ar[i]);
if (real_part(ar[i]) != real_part(v)) return false;
if (imag_part(ar[i]) != imag_part(v)) return false;
}
return true;
});
define_libfunc("<", 2, null, function (ar) {
assert_number(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_number(ar[i]);
if (!(ar[i - 1] < ar[i])) return false;
}
return true;
});
define_libfunc(">", 2, null, function (ar) {
assert_number(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_number(ar[i]);
if (!(ar[i - 1] > ar[i])) return false;
}
return true;
});
define_libfunc("<=", 2, null, function (ar) {
assert_number(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_number(ar[i]);
if (!(ar[i - 1] <= ar[i])) return false;
}
return true;
});
define_libfunc(">=", 2, null, function (ar) {
assert_number(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_number(ar[i]);
if (!(ar[i - 1] >= ar[i])) return false;
}
return true;
});
define_libfunc("zero?", 1, 1, function (ar) {
assert_number(ar[0]);
return ar[0] === 0;
});
define_libfunc("positive?", 1, 1, function (ar) {
assert_number(ar[0]);
return ar[0] > 0;
});
define_libfunc("negative?", 1, 1, function (ar) {
assert_number(ar[0]);
return ar[0] < 0;
});
define_libfunc("odd?", 1, 1, function (ar) {
assert_number(ar[0]);
return ar[0] % 2 == 1 || ar[0] % 2 == -1;
});
define_libfunc("even?", 1, 1, function (ar) {
assert_number(ar[0]);
return ar[0] % 2 == 0;
});
define_libfunc("finite?", 1, 1, function (ar) {
assert_number(ar[0]);
return ar[0] != Infinity && ar[0] != -Infinity && !isNaN(ar[0]);
});
define_libfunc("infinite?", 1, 1, function (ar) {
assert_number(ar[0]);
return ar[0] == Infinity || ar[0] == -Infinity;
});
define_libfunc("nan?", 1, 1, function (ar) {
assert_number(ar[0]);
return isNaN(ar[0]);
});
define_libfunc("max", 2, null, function (ar) {
for (var i = 0; i < ar.length; i++) assert_number(ar[i]);
return Math.max.apply(null, ar);
});
define_libfunc("min", 2, null, function (ar) {
for (var i = 0; i < ar.length; i++) assert_number(ar[i]);
return Math.min.apply(null, ar);
});
var complex_or_real = function (real, imag) {
if (imag === 0) return real;
return new Complex(real, imag);
};
var polar_or_real = function (magnitude, angle) {
if (angle === 0) return magnitude;
return Complex.from_polar(magnitude, angle);
};
define_libfunc("+", 0, null, function (ar) {
var real = 0;
var imag = 0;
for (var i = 0; i < ar.length; i++) {
assert_number(ar[i]);
real += real_part(ar[i]);
imag += imag_part(ar[i]);
}
return complex_or_real(real, imag);
});
var the_magnitude = function (n) {
if (n instanceof Complex) return n.magnitude();
return n;
};
var the_angle = function (n) {
if (n instanceof Complex) return n.angle();
return 0;
};
define_libfunc("*", 0, null, function (ar) {
var magnitude = 1;
var angle = 0;
for (var i = 0; i < ar.length; i++) {
assert_number(ar[i]);
magnitude *= the_magnitude(ar[i]);
angle += the_angle(ar[i]);
}
return polar_or_real(magnitude, angle);
});
define_libfunc("-", 1, null, function (ar) {
var len = ar.length;
assert_number(ar[0]);
if (len == 1) {
if (ar[0] instanceof Complex)
return new Complex(-real_part(ar[0]), -imag_part(ar[0]));
return -ar[0];
} else {
var real = real_part(ar[0]);
var imag = imag_part(ar[0]);
for (var i = 1; i < len; i++) {
assert_number(ar[i]);
real -= real_part(ar[i]);
imag -= imag_part(ar[i]);
}
return complex_or_real(real, imag);
}
});
//for r6rs specification, (/ 0 0) or (/ 3 0) raises '&assertion exception'
define_libfunc("/", 1, null, function (ar) {
var len = ar.length;
assert_number(ar[0]);
if (len == 1) {
if (ar[0] instanceof Complex)
return Complex.from_polar(1 / the_magnitude(ar[0]), -the_angle(ar[0]));
return 1 / ar[0];
} else {
var magnitude = the_magnitude(ar[0]);
var angle = the_angle(ar[0]);
for (var i = 1; i < len; i++) {
assert_number(ar[i]);
magnitude /= the_magnitude(ar[i]);
angle -= the_angle(ar[i]);
}
return polar_or_real(magnitude, angle);
}
});
define_libfunc("abs", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.abs(ar[0]);
});
var div = function (n, m) {
return Math.floor(n / m);
};
var mod = function (n, m) {
return n - Math.floor(n / m) * m;
};
var div0 = function (n, m) {
return n > 0 ? Math.floor(n / m) : Math.ceil(n / m);
};
var mod0 = function (n, m) {
return n > 0 ? n - Math.floor(n / m) * m : n - Math.ceil(n / m) * m;
};
define_libfunc("div0-and-mod0", 2, 2, function (ar) {
assert_number(ar[0]);
assert_number(ar[1]);
return new Values$1([div(ar[0], ar[1]), mod(ar[0], ar[1])]);
});
define_libfunc("div", 2, 2, function (ar) {
assert_number(ar[0]);
assert_number(ar[1]);
return div(ar[0], ar[1]);
});
define_libfunc("mod", 2, 2, function (ar) {
assert_number(ar[0]);
assert_number(ar[1]);
return mod(ar[0], ar[1]);
});
define_libfunc("div0-and-mod0", 2, 2, function (ar) {
assert_number(ar[0]);
assert_number(ar[1]);
return new Values$1([div0(ar[0], ar[1]), mod0(ar[0], ar[1])]);
});
define_libfunc("div0", 2, 2, function (ar) {
assert_number(ar[0]);
assert_number(ar[1]);
return div0(ar[0], ar[1]);
});
define_libfunc("mod0", 2, 2, function (ar) {
assert_number(ar[0]);
assert_number(ar[1]);
return mod0(ar[0], ar[1]);
});
//(gcd n1 ...) procedure
//(lcm n1 ...) procedure
define_libfunc("numerator", 1, 1, function (ar) {
assert_number(ar[0]);
if (ar[0] instanceof Rational) return ar[0].numerator;
else throw new Bug("todo");
});
define_libfunc("denominator", 1, 1, function (ar) {
assert_number(ar[0]);
if (ar[0] instanceof Rational) return ar[0].denominator;
else throw new Bug("todo");
});
define_libfunc("floor", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.floor(ar[0]);
});
define_libfunc("ceiling", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.ceil(ar[0]);
});
define_libfunc("truncate", 1, 1, function (ar) {
assert_number(ar[0]);
return ar[0] < 0 ? Math.ceil(ar[0]) : Math.floor(ar[0]);
});
define_libfunc("round", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.round(ar[0]);
});
//(rationalize x1 x2) procedure
define_libfunc("exp", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.exp(ar[0]);
});
define_libfunc("log", 1, 2, function (ar) {
var num = ar[0],
base = ar[1];
assert_number(num);
if (base) {
// log b num == log e num / log e b
assert_number(base);
return Math.log(num) / Math.log(base);
} else return Math.log(num);
});
define_libfunc("sin", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.sin(ar[0]);
});
define_libfunc("cos", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.cos(ar[0]);
});
define_libfunc("tan", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.tan(ar[0]);
});
define_libfunc("asin", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.asin(ar[0]);
});
define_libfunc("acos", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.acos(ar[0]);
});
define_libfunc("atan", 1, 2, function (ar) {
assert_number(ar[0]);
if (ar.length == 2) {
assert_number(ar[1]);
return Math.atan2(ar[0], ar[1]);
} else return Math.atan(ar[0]);
});
define_libfunc("sqrt", 1, 1, function (ar) {
assert_number(ar[0]);
return Math.sqrt(ar[0]);
});
define_libfunc("exact-integer-sqrt", 1, 1, function (ar) {
assert_number(ar[0]);
var sqrt_f = Math.sqrt(ar[0]);
var sqrt_i = sqrt_f - (sqrt_f % 1);
var rest = ar[0] - sqrt_i * sqrt_i;
return new Values$1([sqrt_i, rest]);
});
define_libfunc("expt", 2, 2, function (ar) {
assert_number(ar[0]);
assert_number(ar[1]);
return Math.pow(ar[0], ar[1]);
});
define_libfunc("make-rectangular", 2, 2, function (ar) {
assert_number(ar[0]);
assert_number(ar[1]);
return new Complex(ar[0], ar[1]);
});
define_libfunc("make-polar", 2, 2, function (ar) {
assert_number(ar[0]);
assert_number(ar[1]);
return Complex.from_polar(ar[0], ar[1]);
});
var real_part = function (n) {
return Complex.assure(n).real;
};
var imag_part = function (n) {
return Complex.assure(n).imag;
};
define_libfunc("real-part", 1, 1, function (ar) {
assert_number(ar[0]);
return real_part(ar[0]);
});
define_libfunc("imag-part", 1, 1, function (ar) {
assert_number(ar[0]);
return Complex.assure(ar[0]).imag;
});
define_libfunc("magnitude", 1, 1, function (ar) {
assert_number(ar[0]);
return Complex.assure(ar[0]).magnitude();
});
define_libfunc("angle", 1, 1, function (ar) {
assert_number(ar[0]);
return Complex.assure(ar[0]).angle();
});
//
// 11.7.4.4 Numerical Input and Output
//
define_libfunc("number->string", 1, 3, function (ar) {
var z = ar[0],
radix = ar[1],
precision = ar[2];
if (precision)
throw new Bug("number->string: precision is not yet implemented");
radix = radix || 10; //TODO: check radix is 2, 8, 10, or 16.
return z.toString(radix);
});
define_libfunc("string->number", 1, 3, function (ar) {
var s = ar[0];
if (s === "+inf.0") return Infinity;
if (s === "-inf.0") return -Infinity;
if (s === "+nan.0") return NaN;
var radix = ar[1];
var int_res = parse_integer(s, radix === 0 ? 0 : radix || 10);
if (int_res !== false) return int_res;
if (radix !== undefined && radix !== 10) return false;
var fp_res = parse_float(s);
if (fp_res !== false) return fp_res;
var frac_res = parse_fraction(s);
if (frac_res !== false) return frac_res;
return false;
});
//
// 11.8 Booleans
//
define_libfunc("not", 1, 1, function (ar) {
return ar[0] === false ? true : false;
});
define_libfunc("boolean?", 1, 1, function (ar) {
return ar[0] === false || ar[0] === true ? true : false;
});
define_libfunc("boolean=?", 2, null, function (ar) {
var len = ar.length;
for (var i = 1; i < len; i++) {
if (ar[i] != ar[0]) return false;
}
return true;
});
// 11.9 Pairs and lists
define_libfunc("pair?", 1, 1, function (ar) {
return ar[0] instanceof Pair ? true : false;
});
define_libfunc("cons", 2, 2, function (ar) {
return new Pair(ar[0], ar[1]);
});
define_libfunc("car", 1, 1, function (ar) {
//should raise &assertion for '()...
if (!(ar[0] instanceof Pair))
throw new BiwaError("Attempt to apply car on " + ar[0]);
return ar[0].car;
});
define_libfunc("cdr", 1, 1, function (ar) {
//should raise &assertion for '()...
if (!(ar[0] instanceof Pair))
throw new BiwaError("Attempt to apply cdr on " + ar[0]);
return ar[0].cdr;
});
define_libfunc("set-car!", 2, 2, function (ar) {
if (!(ar[0] instanceof Pair))
throw new BiwaError("Attempt to apply set-car! on " + ar[0]);
ar[0].car = ar[1];
return undef;
});
define_libfunc("set-cdr!", 2, 2, function (ar) {
if (!(ar[0] instanceof Pair))
throw new BiwaError("Attempt to apply set-cdr! on " + ar[0]);
ar[0].cdr = ar[1];
return undef;
});
// cadr, caddr, cadddr, etc.
(function () {
// To traverse into pair and raise error
var get = function (funcname, spec, obj) {
var ret = obj;
each(spec, function (is_cdr) {
if (ret instanceof Pair) {
ret = is_cdr ? ret.cdr : ret.car;
} else {
throw new BiwaError(
funcname +
": attempt to get " +
(is_cdr ? "cdr" : "car") +
" of " +
ret
);
}
});
return ret;
};
define_libfunc("caar", 1, 1, function (ar) {
return get("caar", [0, 0], ar[0]);
});
define_libfunc("cadr", 1, 1, function (ar) {
return get("cadr", [1, 0], ar[0]);
});
define_libfunc("cdar", 1, 1, function (ar) {
return get("cadr", [0, 1], ar[0]);
});
define_libfunc("cddr", 1, 1, function (ar) {
return get("cadr", [1, 1], ar[0]);
});
define_libfunc("caaar", 1, 1, function (ar) {
return get("caaar", [0, 0, 0], ar[0]);
});
define_libfunc("caadr", 1, 1, function (ar) {
return get("caadr", [1, 0, 0], ar[0]);
});
define_libfunc("cadar", 1, 1, function (ar) {
return get("cadar", [0, 1, 0], ar[0]);
});
define_libfunc("caddr", 1, 1, function (ar) {
return get("caddr", [1, 1, 0], ar[0]);
});
define_libfunc("cdaar", 1, 1, function (ar) {
return get("cdaar", [0, 0, 1], ar[0]);
});
define_libfunc("cdadr", 1, 1, function (ar) {
return get("cdadr", [1, 0, 1], ar[0]);
});
define_libfunc("cddar", 1, 1, function (ar) {
return get("cddar", [0, 1, 1], ar[0]);
});
define_libfunc("cdddr", 1, 1, function (ar) {
return get("cdddr", [1, 1, 1], ar[0]);
});
define_libfunc("caaaar", 1, 1, function (ar) {
return get("caaaar", [0, 0, 0, 0], ar[0]);
});
define_libfunc("caaadr", 1, 1, function (ar) {
return get("caaadr", [1, 0, 0, 0], ar[0]);
});
define_libfunc("caadar", 1, 1, function (ar) {
return get("caadar", [0, 1, 0, 0], ar[0]);
});
define_libfunc("caaddr", 1, 1, function (ar) {
return get("caaddr", [1, 1, 0, 0], ar[0]);
});
define_libfunc("cadaar", 1, 1, function (ar) {
return get("cadaar", [0, 0, 1, 0], ar[0]);
});
define_libfunc("cadadr", 1, 1, function (ar) {
return get("cadadr", [1, 0, 1, 0], ar[0]);
});
define_libfunc("caddar", 1, 1, function (ar) {
return get("caddar", [0, 1, 1, 0], ar[0]);
});
define_libfunc("cadddr", 1, 1, function (ar) {
return get("cadddr", [1, 1, 1, 0], ar[0]);
});
define_libfunc("cdaaar", 1, 1, function (ar) {
return get("cdaaar", [0, 0, 0, 1], ar[0]);
});
define_libfunc("cdaadr", 1, 1, function (ar) {
return get("cdaadr", [1, 0, 0, 1], ar[0]);
});
define_libfunc("cdadar", 1, 1, function (ar) {
return get("cdadar", [0, 1, 0, 1], ar[0]);
});
define_libfunc("cdaddr", 1, 1, function (ar) {
return get("cdaddr", [1, 1, 0, 1], ar[0]);
});
define_libfunc("cddaar", 1, 1, function (ar) {
return get("cddaar", [0, 0, 1, 1], ar[0]);
});
define_libfunc("cddadr", 1, 1, function (ar) {
return get("cddadr", [1, 0, 1, 1], ar[0]);
});
define_libfunc("cdddar", 1, 1, function (ar) {
return get("cdddar", [0, 1, 1, 1], ar[0]);
});
define_libfunc("cddddr", 1, 1, function (ar) {
return get("cddddr", [1, 1, 1, 1], ar[0]);
});
})();
define_libfunc("null?", 1, 1, function (ar) {
return ar[0] === nil;
});
define_libfunc("list?", 1, 1, function (ar) {
return isList(ar[0]);
});
define_libfunc("list", 0, null, function (ar) {
var l = nil;
for (var i = ar.length - 1; i >= 0; i--) l = new Pair(ar[i], l);
return l;
});
define_libfunc("length", 1, 1, function (ar) {
assert_list(ar[0]);
var n = 0;
for (var o = ar[0]; o != nil; o = o.cdr) n++;
return n;
});
define_libfunc("append", 1, null, function (ar) {
var k = ar.length;
var ret = ar[--k];
while (k--) {
each(ar[k].to_array().reverse(), function (item) {
ret = new Pair(item, ret);
});
}
return ret;
});
define_libfunc("reverse", 1, 1, function (ar) {
// (reverse '()) => '()
if (ar[0] == nil) return nil;
assert_pair(ar[0]);
var l = nil;
for (var o = ar[0]; o != nil; o = o.cdr) l = new Pair(o.car, l);
return l;
});
define_libfunc("list-tail", 2, 2, function (ar) {
assert_pair(ar[0]);
assert_integer(ar[1]);
if (ar[1] < 0)
throw new BiwaError("list-tail: index out of range (" + ar[1] + ")");
var o = ar[0];
for (var i = 0; i < ar[1]; i++) {
if (!(o instanceof Pair))
throw new BiwaError("list-tail: the list is shorter than " + ar[1]);
o = o.cdr;
}
return o;
});
define_libfunc("list-ref", 2, 2, function (ar) {
assert_pair(ar[0]);
assert_integer(ar[1]);
if (ar[1] < 0)
throw new BiwaError("list-tail: index out of range (" + ar[1] + ")");
var o = ar[0];
for (var i = 0; i < ar[1]; i++) {
if (!(o instanceof Pair))
throw new BiwaError("list-ref: the list is shorter than " + ar[1]);
o = o.cdr;
}
return o.car;
});
define_libfunc("map", 2, null, function (ar) {
var proc = ar.shift(),
lists = ar;
each(lists, assert_list);
var a = [];
return Call.multi_foreach(lists, {
// Called for each element
// input: the element (or the elements, if more than one list is given)
// output: a Call request of proc and args
call: function (xs) {
return new Call(
proc,
map(xs, function (x) {
return x.car;
})
);
},
// Called when each Call request is finished
// input: the result of Call request,
// the element(s) of the Call request (which is not used here)
// output: `undefined' to continue,
// some value to terminate (the value will be the result)
result: function (res) {
a.push(res);
},
// Called when reached to the end of the list(s)
// input: none
// output: the resultant value
finish: function () {
return array_to_list(a);
},
});
});
define_libfunc("for-each", 2, null, function (ar) {
var proc = ar.shift(),
lists = ar;
each(lists, assert_list);
return Call.multi_foreach(lists, {
call: function (xs) {
return new Call(
proc,
map(xs, function (x) {
return x.car;
})
);
},
finish: function () {
return undef;
},
});
});
// 11.10 Symbols
define_libfunc("symbol?", 1, 1, function (ar) {
return ar[0] instanceof BiwaSymbol ? true : false;
});
define_libfunc("symbol->string", 1, 1, function (ar) {
assert_symbol(ar[0]);
return ar[0].name;
});
define_libfunc("symbol=?", 2, null, function (ar) {
assert_symbol(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_symbol(ar[i]);
if (ar[i] != ar[0]) return false;
}
return true;
});
define_libfunc("string->symbol", 1, 1, function (ar) {
assert_string(ar[0]);
return Sym(ar[0]);
});
//
// 11.11 Characters
//
define_libfunc("char?", 1, 1, function (ar) {
return ar[0] instanceof Char;
});
define_libfunc("char->integer", 1, 1, function (ar) {
assert_char(ar[0]);
return ar[0].value.charCodeAt(0);
});
define_libfunc("integer->char", 1, 1, function (ar) {
assert_integer(ar[0]);
return Char.get(String.fromCharCode(ar[0]));
});
var make_char_compare_func = function (test) {
return function (ar) {
assert_char(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_char(ar[i]);
if (!test(ar[i - 1].value, ar[i].value)) return false;
}
return true;
};
};
define_libfunc(
"char=?",
2,
null,
make_char_compare_func(function (a, b) {
return a == b;
})
);
define_libfunc(
"char<?",
2,
null,
make_char_compare_func(function (a, b) {
return a < b;
})
);
define_libfunc(
"char>?",
2,
null,
make_char_compare_func(function (a, b) {
return a > b;
})
);
define_libfunc(
"char<=?",
2,
null,
make_char_compare_func(function (a, b) {
return a <= b;
})
);
define_libfunc(
"char>=?",
2,
null,
make_char_compare_func(function (a, b) {
return a >= b;
})
);
//
// 11.12 Strings
//
define_libfunc("string?", 1, 1, function (ar) {
return typeof ar[0] == "string";
});
define_libfunc("make-string", 1, 2, function (ar) {
assert_integer(ar[0]);
var c = " ";
if (ar[1]) {
assert_char(ar[1]);
c = ar[1].value;
}
var out = "";
times(ar[0], function () {
out += c;
});
return out;
});
define_libfunc("string", 0, null, function (ar) {
if (ar.length == 0) return "";
for (var i = 0; i < ar.length; i++) assert_char(ar[i]);
return map(ar, function (c) {
return c.value;
}).join("");
});
define_libfunc("string-length", 1, 1, function (ar) {
assert_string(ar[0]);
return ar[0].length;
});
define_libfunc("string-ref", 2, 2, function (ar) {
assert_string(ar[0]);
assert_between(ar[1], 0, ar[0].length - 1);
return Char.get(ar[0].charAt([ar[1]]));
});
define_libfunc("string=?", 2, null, function (ar) {
assert_string(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_string(ar[i]);
if (ar[0] != ar[i]) return false;
}
return true;
});
define_libfunc("string<?", 2, null, function (ar) {
assert_string(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_string(ar[i]);
if (!(ar[i - 1] < ar[i])) return false;
}
return true;
});
define_libfunc("string>?", 2, null, function (ar) {
assert_string(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_string(ar[i]);
if (!(ar[i - 1] > ar[i])) return false;
}
return true;
});
define_libfunc("string<=?", 2, null, function (ar) {
assert_string(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_string(ar[i]);
if (!(ar[i - 1] <= ar[i])) return false;
}
return true;
});
define_libfunc("string>=?", 2, null, function (ar) {
assert_string(ar[0]);
for (var i = 1; i < ar.length; i++) {
assert_string(ar[i]);
if (!(ar[i - 1] >= ar[i])) return false;
}
return true;
});
define_libfunc("substring", 3, 3, function (ar) {
assert_string(ar[0]);
assert_integer(ar[1]);
assert_integer(ar[2]);
if (ar[1] < 0) throw new BiwaError("substring: start too small: " + ar[1]);
if (ar[2] < 0) throw new BiwaError("substring: end too small: " + ar[2]);
if (ar[0].length + 1 <= ar[1])
throw new BiwaError("substring: start too big: " + ar[1]);
if (ar[0].length + 1 <= ar[2])
throw new BiwaError("substring: end too big: " + ar[2]);
if (!(ar[1] <= ar[2]))
throw new BiwaError(
"substring: not start <= end: " + ar[1] + ", " + ar[2]
);
return ar[0].substring(ar[1], ar[2]);
});
define_libfunc("string-append", 0, null, function (ar) {
for (var i = 0; i < ar.length; i++) assert_string(ar[i]);
return ar.join("");
});
define_libfunc("string->list", 1, 1, function (ar) {
assert_string(ar[0]);
return array_to_list(
map(ar[0].split(""), function (s) {
return Char.get(s[0]);
})
);
});
define_libfunc("list->string", 1, 1, function (ar) {
assert_list(ar[0]);
return map(ar[0].to_array(), function (c) {
return c.value;
}).join("");
});
define_libfunc("string-for-each", 2, null, function (ar) {
var proc = ar.shift(),
strs = ar;
each(strs, assert_string);
return Call.multi_foreach(strs, {
call: function (chars) {
return new Call(proc, chars);
},
finish: function () {
return undef;
},
});
});
define_libfunc("string-copy", 1, 1, function (ar) {
// note: this is useless, because javascript strings are immutable
assert_string(ar[0]);
return ar[0];
});
//
// 11.13 Vectors
//
define_libfunc("vector?", 1, 1, function (ar) {
return isVector(ar[0]);
});
define_libfunc("make-vector", 1, 2, function (ar) {
assert_integer(ar[0]);
var vec = new Array(ar[0]);
if (ar.length == 2) {
for (var i = 0; i < ar[0]; i++) vec[i] = ar[1];
}
return vec;
});
define_libfunc("vector", 0, null, function (ar) {
return ar;
});
define_libfunc("vector-length", 1, 1, function (ar) {
assert_vector(ar[0]);
return ar[0].length;
});
define_libfunc("vector-ref", 2, 2, function (ar) {
assert_vector(ar[0]);
assert_integer(ar[1]);
assert_between(ar[1], 0, ar[0].length - 1);
return ar[0][ar[1]];
});
define_libfunc("vector-set!", 3, 3, function (ar) {
assert_vector(ar[0]);
assert_integer(ar[1]);
ar[0][ar[1]] = ar[2];
return undef;
});
define_libfunc("vector->list", 1, 1, function (ar) {
assert_vector(ar[0]);
return array_to_list(ar[0]);
});
define_libfunc("list->vector", 1, 1, function (ar) {
assert_list(ar[0]);
return ar[0].to_array();
});
define_libfunc("vector-fill!", 2, 2, function (ar) {
assert_vector(ar[0]);
var vec = ar[0],
obj = ar[1];
for (var i = 0; i < vec.length; i++) vec[i] = obj;
return vec;
});
define_libfunc("vector-map", 2, null, function (ar) {
var proc = ar.shift(),
vecs = ar;
each(vecs, assert_vector);
var a = [];
return Call.multi_foreach(vecs, {
call: function (objs) {
return new Call(proc, objs);
},
result: function (res) {
a.push(res);
},
finish: function () {
return a;
},
});
});
define_libfunc("vector-for-each", 2, null, function (ar) {
var proc = ar.shift(),
vecs = ar;
each(vecs, assert_vector);
return Call.multi_foreach(vecs, {
call: function (objs) {
return new Call(proc, objs);
},
finish: function () {
return undef;
},
});
});
//
// 11.14 Errors and violations
//
//(error who message irritant1 ...) procedure
//(assertion-violation who message irritant1 ...) procedure
//(assert <expression>) syntax
//
// 11.15 Control features
//
define_libfunc("apply", 2, null, function (ar) {
var proc = ar.shift(),
rest_args = ar.pop(),
args = ar;
args = args.concat(rest_args.to_array());
return new Call(proc, args);
});
define_syntax("call-with-current-continuation", function (x) {
return new Pair(Sym("call/cc"), x.cdr);
});
define_libfunc("values", 0, null, function (ar) {
if (ar.length == 1)
// eg. (values 3)
return ar[0];
else return new Values$1(ar);
});
define_libfunc("call-with-values", 2, 2, function (ar) {
var producer = ar[0],
consumer = ar[1];
assert_procedure(producer);
assert_procedure(consumer);
return new Call(producer, [], function (ar) {
var result = ar[0];
if (result instanceof Values$1) {
return new Call(consumer, result.content);
} else {
// eg. (call-with-values (lambda () 3)
// (lambda (x) x))
return new Call(consumer, [result]);
}
});
});
define_libfunc("dynamic-wind", 3, 3, function (ar, intp) {
var before = ar[0],
thunk = ar[1],
after = ar[2];
return new Call(before, [], function () {
intp.push_dynamic_winder(before, after);
return new Call(thunk, [], function (ar2) {
var result = ar2[0];
intp.pop_dynamic_winder();
return new Call(after, [], function () {
return result;
});
});
});
});
// 11.16 Iteration
//named let
// 11.17 Quasiquotation
// `() is expanded to `cons` and `append`.
// `#() is expanded to `vector` and `vector-append`.
var expand_qq = function (f, lv) {
if (f instanceof BiwaSymbol || f === nil) {
return List(Sym("quote"), f);
} else if (f instanceof Pair) {
var car = f.car;
if (car instanceof Pair && car.car === Sym("unquote-splicing")) {
if (lv == 1)
return List(Sym("append"), f.car.cdr.car, expand_qq(f.cdr, lv));
else
return List(
Sym("cons"),
List(
Sym("list"),
List(Sym("quote"), Sym("unquote-splicing")),
expand_qq(f.car.cdr.car, lv - 1)
),
expand_qq(f.cdr, lv)
);
} else if (car === Sym("unquote")) {
if (lv == 1) return f.cdr.car;
else
return List(
Sym("list"),
List(Sym("quote"), Sym("unquote")),
expand_qq(f.cdr.car, lv - 1)
);
} else if (car === Sym("quasiquote"))
return List(
Sym("list"),
List(Sym("quote"), Sym("quasiquote")),
expand_qq(f.cdr.car, lv + 1)
);
else return List(Sym("cons"), expand_qq(f.car, lv), expand_qq(f.cdr, lv));
} else if (f instanceof Array) {
var vecs = [[]];
for (var i = 0; i < f.length; i++) {
if (f[i] instanceof Pair && f[i].car === Sym("unquote-splicing")) {
if (lv == 1) {
var item = List(Sym("list->vector"), f[i].cdr.car);
item["splicing"] = true;
vecs.push(item);
vecs.push([]);
} else {
var item = List(
Sym("cons"),
List(
Sym("list"),
List(Sym("quote"), Sym("unquote-splicing")),
expand_qq(f[i].car.cdr.car, lv - 1)
),
expand_qq(f[i].cdr, lv)
);
last(vecs).push(item);
}
} else {
// Expand other things as the same as if they are in a list quasiquote
last(vecs).push(expand_qq(f[i], lv));
}
}
var vectors = vecs.map(function (vec) {
if (vec["splicing"]) {
return vec;
} else {
return Cons(Sym("vector"), array_to_list(vec));
}
});
if (vectors.length == 1) {
return Cons(Sym("vector"), array_to_list(vecs[0]));
} else {
return Cons(Sym("vector-append"), array_to_list(vectors));
}
} else return f;
};
define_syntax("quasiquote", function (x) {
return expand_qq(x.cdr.car, 1);
});
//unquote
define_syntax("unquote", function (x) {
throw new BiwaError("unquote(,) must be inside quasiquote(`)");
});
//unquote-splicing
define_syntax("unquote-splicing", function (x) {
throw new BiwaError("unquote-splicing(,@) must be inside quasiquote(`)");
});
// 11.18 Binding constructs for syntactic keywords
//let-syntax
//letrec-syntax
// 11.19 Macro transformers
//syntax-rules
//identifier-syntax
//
// 11.20 Tail calls and tail contexts
//(no library function introduced)
///
/// R6RS Standard Libraries
///
//
// Chapter 1 Unicode
//
//(char-upcase char) procedure
//(char-downcase char) procedure
//(char-titlecase char) procedure
//(char-foldcase char) procedure
//
//(char-ci=? char1 char2 char3 ...) procedure
//(char-ci<? char1 char2 char3 ...) procedure
//(char-ci>? char1 char2 char3 ...) procedure
//(char-ci<=? char1 char2 char3 ...) procedure
//(char-ci>=? char1 char2 char3 ...) procedure
//
//(char-alphabetic? char) procedure
//(char-numeric? char) procedure
//(char-whitespace? char) procedure
//(char-upper-case? char) procedure
//(char-lower-case? char) procedure
//(char-title-case? char) procedure
//
//(char-general-category char) procedure
//(string-upcase string) procedure
define_libfunc("string-upcase", 1, 1, function (ar) {
assert_string(ar[0]);
return ar[0].toUpperCase();
});
//(string-downcase string) procedure
define_libfunc("string-downcase", 1, 1, function (ar) {
assert_string(ar[0]);
return ar[0].toLowerCase();
});
//(string-titlecase string) procedure
//(string-foldcase string) procedure
const make_string_ci_function = function (compare) {
return function (ar) {
assert_string(ar[0]);
var str = ar[0].toUpperCase();
for (var i = 1; i < ar.length; i++) {
assert_string(ar[i]);
if (!compare(str, ar[i].toUpperCase())) return false;
}
return true;
};
};
//(string-ci=? string1 string2 string3 ...) procedure
define_libfunc(
"string-ci=?",
2,
null,
make_string_ci_function(function (a, b) {
return a == b;
})
);
//(string-ci<? string1 string2 string3 ...) procedure
define_libfunc(
"string-ci<?",
2,
null,
make_string_ci_function(function (a, b) {
return a < b;
})
);
//(string-ci>? string1 string2 string3 ...) procedure
define_libfunc(
"string-ci>?",
2,
null,
make_string_ci_function(function (a, b) {
return a > b;
})
);
//(string-ci<=? string1 string2 string3 ...) procedure
define_libfunc(
"string-ci<=?",
2,
null,
make_string_ci_function(function (a, b) {
return a <= b;
})
);
//(string-ci>=? string1 string2 string3 ...) procedure
define_libfunc(
"string-ci>=?",
2,
null,
make_string_ci_function(function (a, b) {
return a >= b;
})
);
//(string-normalize-nfd string) procedure
//(string-normalize-nfkd string) procedure
//(string-normalize-nfc string) procedure
//(string-normalize-nfkc string) procedure
//
// Chapter 2 Bytevectors
//
//
// Chapter 3 List utilities
//
define_libfunc("find", 2, 2, function (ar) {
var proc = ar[0],
ls = ar[1];
assert_list(ls);
return Call.foreach(ls, {
call: function (x) {
return new Call(proc, [x.car]);
},
result: function (res, x) {
if (res) return x.car;
},
finish: function () {
return false;
},
});
});
define_libfunc("for-all", 2, null, function (ar) {
var proc = ar.shift();
var lists = ar;
each(lists, assert_list);
var last = true; //holds last result which proc returns
return Call.multi_foreach(lists, {
call: function (pairs) {
return new Call(
proc,
map(pairs, function (x) {
return x.car;
})
);
},
result: function (res, pairs) {
if (res === false) return false;
last = res;
},
finish: function () {
return last;
},
});
});
define_libfunc("exists", 2, null, function (ar) {
var proc = ar.shift();
var lists = ar;
each(lists, assert_list);
return Call.multi_foreach(lists, {
call: function (pairs) {
return new Call(
proc,
map(pairs, function (x) {
return x.car;
})
);
},
result: function (res, pairs) {
if (res !== false) return res;
},
finish: function () {
return false;
},
});
});
define_libfunc("filter", 2, 2, function (ar) {
var proc = ar[0],
ls = ar[1];
assert_list(ls);
var a = [];
return Call.foreach(ls, {
call: function (x) {
return new Call(proc, [x.car]);
},
result: function (res, x) {
if (res) a.push(x.car);
},
finish: function () {
return array_to_list(a);
},
});
});
// define_scmfunc("partition+", 2, 2,
// "(lambda (proc ls) \
// (define (partition2 proc ls t f) \
// (if (null? ls) \
// (values (reverse t) (reverse f)) \
// (if (proc (car ls)) \
// (partition2 proc (cdr ls) (cons (car ls) t) f) \
// (partition2 proc (cdr ls) t (cons (car ls) f))))) \
// (partition2 proc ls '() '()))");
define_libfunc("partition", 2, 2, function (ar) {
var proc = ar[0],
ls = ar[1];
assert_list(ls);
var t = [],
f = [];
return Call.foreach(ls, {
call: function (x) {
return new Call(proc, [x.car]);
},
result: function (res, x) {
if (res) t.push(x.car);
else f.push(x.car);
},
finish: function () {
return new Values$1([array_to_list(t), array_to_list(f)]);
},
});
});
define_libfunc("fold-left", 3, null, function (ar) {
var proc = ar.shift(),
accum = ar.shift(),
lists = ar;
each(lists, assert_list);
return Call.multi_foreach(lists, {
call: function (pairs) {
var args = map(pairs, function (x) {
return x.car;
});
args.unshift(accum);
return new Call(proc, args);
},
result: function (res, pairs) {
accum = res;
},
finish: function () {
return accum;
},
});
});
define_libfunc("fold-right", 3, null, function (ar) {
var proc = ar.shift(),
accum = ar.shift();
var lists = map(ar, function (ls) {
// reverse each list
assert_list(ls);
return array_to_list(ls.to_array().reverse());
});
return Call.multi_foreach(lists, {
call: function (pairs) {
var args = map(pairs, function (x) {
return x.car;
});
args.push(accum);
return new Call(proc, args);
},
result: function (res, pairs) {
accum = res;
},
finish: function () {
return accum;
},
});
});
define_libfunc("remp", 2, 2, function (ar) {
var proc = ar[0],
ls = ar[1];
assert_list(ls);
var ret = [];
return Call.foreach(ls, {
call: function (x) {
return new Call(proc, [x.car]);
},
result: function (res, x) {
if (!res) ret.push(x.car);
},
finish: function () {
return array_to_list(ret);
},
});
});
var make_remover = function (key) {
return function (ar) {
var obj = ar[0],
ls = ar[1];
assert_list(ls);
var ret = [];
return Call.foreach(ls, {
call: function (x) {
return new Call(TopEnv[key] || CoreEnv[key], [obj, x.car]);
},
result: function (res, x) {
if (!res) ret.push(x.car);
},
finish: function () {
return array_to_list(ret);
},
});
};
};
define_libfunc("remove", 2, 2, make_remover("equal?"));
define_libfunc("remv", 2, 2, make_remover("eqv?"));
define_libfunc("remq", 2, 2, make_remover("eq?"));
define_libfunc("memp", 2, 2, function (ar) {
var proc = ar[0],
ls = ar[1];
assert_list(ls);
return Call.foreach(ls, {
call: function (x) {
return new Call(proc, [x.car]);
},
result: function (res, x) {
if (res) return x;
},
finish: function () {
return false;
},
});
});
var make_finder = function (key) {
return function (ar) {
var obj = ar[0],
ls = ar[1];
assert_list(ls);
return Call.foreach(ls, {
call: function (x) {
return new Call(TopEnv[key] || CoreEnv[key], [obj, x.car]);
},
result: function (res, x) {
if (res) return x;
},
finish: function () {
return false;
},
});
};
};
define_libfunc("member", 2, 2, make_finder("equal?"));
define_libfunc("memv", 2, 2, make_finder("eqv?"));
define_libfunc("memq", 2, 2, make_finder("eq?"));
define_libfunc("assp", 2, 2, function (ar) {
var proc = ar[0],
als = ar[1];
assert_list(als);
return Call.foreach(als, {
call: function (x) {
if (x.car.car) return new Call(proc, [x.car.car]);
else
throw new BiwaError(
"ass*: pair required but got " + to_write$1(x.car)
);
},
result: function (res, x) {
if (res) return x.car;
},
finish: function () {
return false;
},
});
});
var make_assoc = function (func_name, eq_func_name) {
return function (ar) {
var obj = ar[0],
list = ar[1];
assert_list(list);
return Call.foreach(list, {
call: function (ls) {
if (!isPair(ls.car))
throw new BiwaError(
func_name + ": pair required but got " + to_write$1(ls.car)
);
var equality = TopEnv[eq_func_name] || CoreEnv[eq_func_name];
return new Call(equality, [obj, ls.car.car]);
},
result: function (was_equal, ls) {
if (was_equal) return ls.car;
},
finish: function () {
return false;
},
});
};
};
define_libfunc("assoc", 2, 2, make_assoc("assoc", "equal?"));
define_libfunc("assv", 2, 2, make_assoc("assv", "eqv?"));
define_libfunc("assq", 2, 2, make_assoc("assq", "eq?"));
define_libfunc("cons*", 1, null, function (ar) {
if (ar.length == 1) return ar[0];
else {
var ret = null;
each(ar.reverse(), function (x) {
if (ret) {
ret = new Pair(x, ret);
} else ret = x;
});
return ret;
}
});
//
// Chapter 4 Sorting
//
(function () {
// Destructively sort the given array
// with scheme function `proc` as comparator
var mergeSort = function (ary, proc, finish) {
if (ary.length <= 1) return finish(ary);
return mergeSort_(ary, proc, finish, [[0, ary.length, false]], false);
};
var mergeSort_ = function (ary, proc, finish, stack, up) {
while (true) {
var start = stack[stack.length - 1][0],
end = stack[stack.length - 1][1],
left = stack[stack.length - 1][2];
var len = end - start;
//console.debug("mergeSort_", ary, stack.join(' '), up?"u":"d", ""+start+".."+(end-1))
if (len >= 2 && !up) {
// There are parts to be sorted
stack.push([start, start + (len >> 1), true]);
continue;
} else if (left) {
// Left part sorted. Continue to the right one
stack.pop();
var rend = stack[stack.length - 1][1];
stack.push([end, rend, false]);
up = false;
continue;
} else {
// Right part sorted. Merge left and right
stack.pop();
var lstart = stack[stack.length - 1][0];
var ary1 = ary.slice(lstart, start),
ary2 = ary.slice(start, end);
return merge_(ary1, ary2, proc, [], 0, 0, function (ret) {
//console.debug("mergeSortd", ary, stack.join(' '), up?"u":"d", ary1, ary2, ret, ""+start+".."+(start+len-1));
for (var i = 0; i < ret.length; i++) {
ary[lstart + i] = ret[i];
}
if (stack.length == 1) {
return finish(ary);
} else {
return mergeSort_(ary, proc, finish, stack, true);
}
});
}
}
};
var merge_ = function (ary1, ary2, proc, ret, i, j, cont) {
//console.debug("merge_", ary1, ary2, ret, i, j);
var len1 = ary1.length,
len2 = ary2.length;
if (i < len1 && j < len2) {
return new Call(proc, [ary2[j], ary1[i]], function (ar) {
//console.debug("comp", [ary2[j], ary1[i]], ar[0]);
if (ar[0]) {
ret.push(ary2[j]);
j += 1;
} else {
ret.push(ary1[i]);
i += 1;
}
return merge_(ary1, ary2, proc, ret, i, j, cont);
});
} else {
while (i < len1) {
ret.push(ary1[i]);
i += 1;
}
while (j < len2) {
ret.push(ary2[j]);
j += 1;
}
return cont(ret);
}
};
var compareFn = function (a, b) {
return lt(a, b) ? -1 : lt(b, a) ? 1 : 0;
};
define_libfunc("list-sort", 1, 2, function (ar) {
if (ar[1]) {
assert_procedure(ar[0]);
assert_list(ar[1]);
return mergeSort(ar[1].to_array(), ar[0], function (ret) {
return array_to_list(ret);
});
} else {
assert_list(ar[0]);
return array_to_list(ar[0].to_array().sort(compareFn));
}
});
//(vector-sort proc vector) procedure
define_libfunc("vector-sort", 1, 2, function (ar) {
if (ar[1]) {
assert_procedure(ar[0]);
assert_vector(ar[1]);
return mergeSort(clone(ar[1]), ar[0], function (ret) {
return ret;
});
} else {
assert_vector(ar[0]);
return clone(ar[0]).sort(compareFn);
}
});
//(vector-sort! proc vector) procedure
define_libfunc("vector-sort!", 1, 2, function (ar) {
if (ar[1]) {
assert_procedure(ar[0]);
assert_vector(ar[1]);
return mergeSort(ar[1], ar[0], function (ret) {
return undef;
});
} else {
assert_vector(ar[0]);
ar[0].sort(compareFn);
return undef;
}
});
})();
//
// Chapter 5 Control Structures
//
define_syntax("when", function (x) {
//(when test body ...)
//=> (if test (begin body ...) #<undef>)
var test = x.cdr.car,
body = x.cdr.cdr;
return new Pair(
Sym("if"),
new Pair(
test,
new Pair(new Pair(Sym("begin"), body), new Pair(undef, nil))
)
);
});
define_syntax("unless", function (x) {
//(unless test body ...)
//=> (if (not test) (begin body ...) #<undef>)
var test = x.cdr.car,
body = x.cdr.cdr;
return new Pair(
Sym("if"),
new Pair(
new Pair(Sym("not"), new Pair(test, nil)),
new Pair(new Pair(Sym("begin"), body), new Pair(undef, nil))
)
);
});
define_syntax("do", function (x) {
//(do ((var1 init1 step1)
// (var2 init2 step2) ...)
// (test expr1 expr2 ...)
// body1 body2 ...)
//=> (let loop` ((var1 init1) (var2 init2) ...)
// (if test
// (begin expr1 expr2 ...)
// (begin body1 body2 ...
// (loop` step1 step2 ...)))))
// parse arguments
if (!isPair(x.cdr)) throw new BiwaError("do: no variables of do");
var varsc = x.cdr.car;
if (!isPair(varsc))
throw new BiwaError("do: variables must be given as a list");
if (!isPair(x.cdr.cdr)) throw new BiwaError("do: no resulting form of do");
var resultc = x.cdr.cdr.car;
var bodyc = x.cdr.cdr.cdr;
// construct subforms
var loop = gensym();
var init_vars = array_to_list(
varsc.map(function (var_def) {
var a = var_def.to_array();
return List(a[0], a[1]);
})
);
var test = resultc.car;
var result_exprs = new Pair(Sym("begin"), resultc.cdr);
var next_loop = new Pair(
loop,
array_to_list(
varsc.map(function (var_def) {
var a = var_def.to_array();
return a[2] || a[0];
})
)
);
var body_exprs = new Pair(Sym("begin"), bodyc).concat(List(next_loop));
// combine subforms
return List(
Sym("let"),
loop,
init_vars,
List(Sym("if"), test, result_exprs, body_exprs)
);
});
//(case-lambda <case-lambda clause> ...) syntax
define_syntax("case-lambda", function (x) {
if (!isPair(x.cdr))
throw new BiwaError("case-lambda: at least 1 clause required");
var clauses = x.cdr.to_array();
var args_ = gensym();
var exec = List(Sym("raise"), "case-lambda: no matching clause found");
clauses.reverse().forEach(function (clause) {
if (!isPair(clause))
throw new BiwaError(
"case-lambda: clause must be a pair: " + to_write$1(clause)
);
var formals = clause.car,
clause_body = clause.cdr;
if (formals === nil) {
exec = List(
Sym("if"),
List(Sym("null?"), args_),
new Pair(Sym("begin"), clause_body),
exec
);
} else if (isPair(formals)) {
var len = formals.length(),
last_cdr = formals.last_cdr();
var pred = last_cdr === nil ? Sym("=") : Sym(">=");
var lambda = new Pair(Sym("lambda"), new Pair(formals, clause_body));
exec = List(
Sym("if"),
List(pred, List(Sym("length"), args_), len),
List(Sym("apply"), lambda, args_),
exec
);
} else if (isSymbol(formals)) {
exec = new Pair(
Sym("let1"),
new Pair(formals, new Pair(args_, clause_body))
);
// Note: previous `exec` is just discarded because this is a wildcard pattern.
} else {
throw new BiwaError(
"case-lambda: invalid formals: " + to_write$1(formals)
);
}
});
return List(Sym("lambda"), args_, exec);
});
//
// Chapter 6 Records
// see also: src/system/record.js
//
// 6.2 Records: Syntactic layer
//eqv, eq
//(define-record-type <name spec> <record clause>*) syntax
define_syntax("define-record-type", function (x) {
// (define-record-type <name spec> <record clause>*)
var name_spec = x.cdr.car;
var record_clauses = x.cdr.cdr;
// 1. parse name spec
// <name spec>: either
// - <record name> eg: point
// - (<record name> <constructor name> <predicate name>)
// eg: (point make-point point?)
if (isSymbol(name_spec)) {
var record_name = name_spec;
var constructor_name = Sym("make-" + name_spec.name);
var predicate_name = Sym(name_spec.name + "?");
} else {
assert_list(name_spec);
var record_name = name_spec.car;
var constructor_name = name_spec.cdr.car;
var predicate_name = name_spec.cdr.cdr.car;
assert_symbol(record_name);
assert_symbol(constructor_name);
assert_symbol(predicate_name);
}
// 2. parse record clauses
var sealed = false;
var opaque = false;
var uid = false;
var parent_name;
var parent_rtd = false;
var parent_cd = false;
var protocol = false;
var fields = [];
// <record clause>:
each(record_clauses.to_array(), function (clause) {
switch (clause.car) {
// - (fields <field spec>*)
case Sym("fields"):
fields = map(clause.cdr.to_array(), function (field_spec, idx) {
if (isSymbol(field_spec)) {
// - <field name>
return {
name: field_spec,
idx: idx,
mutable: false,
accessor_name: null,
mutator_name: null,
};
} else {
assert_list(field_spec);
assert_symbol(field_spec.car);
switch (field_spec.car) {
case Sym("immutable"):
// - (immutable <field name>)
// - (immutable <field name> <accessor name>)
var field_name = field_spec.cdr.car;
assert_symbol(field_name);
if (isNil(field_spec.cdr.cdr))
return { name: field_name, idx: idx, mutable: false };
else
return {
name: field_name,
idx: idx,
mutable: false,
accessor_name: field_spec.cdr.cdr.car,
};
case Sym("mutable"):
// - (mutable <field name>)
// - (mutable <field name> <accessor name> <mutator name>)
var field_name = field_spec.cdr.car;
assert_symbol(field_name);
if (isNil(field_spec.cdr.cdr))
return { name: field_name, idx: idx, mutable: true };
else
return {
name: field_name,
idx: idx,
mutable: true,
accessor_name: field_spec.cdr.cdr.car,
mutator_name: field_spec.cdr.cdr.cdr.car,
};
default:
throw new BiwaError(
"define-record-type: field definition " +
"must start with `immutable' or `mutable' " +
"but got " +
inspect(field_spec.car)
);
}
}
});
break;
// - (parent <name>)
case Sym("parent"):
parent_name = clause.cdr.car;
assert_symbol(parent_name);
break;
// - (protocol <expr>)
case Sym("protocol"):
protocol = clause.cdr.car;
break;
// - (sealed <bool>)
case Sym("sealed"):
sealed = !!clause.cdr.car;
break;
// - (opaque <bool>)
case Sym("opaque"):
opaque = !!clause.cdr.car;
break;
// - (nongenerative <uid>?)
case Sym("nongenerative"):
uid = clause.cdr.car;
break;
// - (parent-rtd <rtd> <cd>)
case Sym("parent-rtd"):
parent_rtd = clause.cdr.car;
parent_cd = clause.cdr.cdr.car;
break;
default:
throw new BiwaError(
"define-record-type: unknown clause `" +
to_write$1(clause.car) +
"'"
);
}
});
if (parent_name) {
parent_rtd = [Sym("record-type-descriptor"), parent_name];
parent_cd = [Sym("record-constructor-descriptor"), parent_name];
}
// 3. build the definitions
// Note: In this implementation, rtd and cd are not bound to symbols.
// They are referenced through record name by record-type-descriptor
// and record-constructor-descriptor. These relation are stored in
// the hash BiwaScheme.Record._DefinedTypes.
var rtd = [Sym("record-type-descriptor"), record_name];
var cd = [Sym("record-constructor-descriptor"), record_name];
// registration
var rtd_fields = map(fields, function (field) {
return List(Sym(field.mutable ? "mutable" : "immutable"), field.name);
});
rtd_fields.is_vector = true; //tell List not to convert
var rtd_def = [
Sym("make-record-type-descriptor"),
[Sym("quote"), record_name],
parent_rtd,
uid,
sealed,
opaque,
rtd_fields,
];
var cd_def = [
Sym("make-record-constructor-descriptor"),
Sym("__rtd"),
parent_cd,
protocol,
];
var registration = [
Sym("let*"),
[
[Sym("__rtd"), rtd_def],
[Sym("__cd"), cd_def],
],
[
Sym("_define-record-type"),
[Sym("quote"), record_name],
Sym("__rtd"),
Sym("__cd"),
],
];
// accessors and mutators
var accessor_defs = map(fields, function (field) {
var name =
field.accessor_name || Sym(record_name.name + "-" + field.name.name);
return [Sym("define"), name, [Sym("record-accessor"), rtd, field.idx]];
});
var mutator_defs = filter(fields, function (field) {
return field.mutable;
});
mutator_defs = map(mutator_defs, function (field) {
var name =
field.mutator_name ||
Sym(record_name.name + "-" + field.name.name + "-set!");
return [Sym("define"), name, [Sym("record-mutator"), rtd, field.idx]];
});
// Wrap the definitions with `begin'
// Example:
// (begin
// (let* ((__rtd (make-record-type-descriptor 'square
// (record-type-descriptor rect)
// #f #f #f
// #((mutable w) (mutable h))))
// (__cd (make-record-constructor-descriptor __rtd
// (record-constructor-descriptor rect)
// (lambda (n) ...))))
// (_define-record-type 'square __rtd __cd))
//
// (define make-square
// (record-constructor
// (record-constructor-descriptor square)))
// (define square?
// (record-predicate (record-type-descriptor square)))
// (define square-w
// (record-accessor (record-type-descriptor square) 0))
// (define square-h
// (record-accessor (record-type-descriptor square) 1))
// (define set-square-w!
// (record-mutator (record-type-descriptor square) 0))
// (define set-square-h!
// (record-mutator (record-type-descriptor square) 1)))
//
return deep_array_to_list(
[
Sym("begin"),
registration,
[Sym("define"), constructor_name, [Sym("record-constructor"), cd]],
[Sym("define"), predicate_name, [Sym("record-predicate"), rtd]],
]
.concat(accessor_defs)
.concat(mutator_defs)
);
});
define_libfunc("_define-record-type", 3, 3, function (ar) {
assert_symbol(ar[0]);
assert_record_td(ar[1]);
assert_record_cd(ar[2]);
Record.define_type(ar[0].name, ar[1], ar[2]);
return undef;
});
//(record-type-descriptor <record name>) syntax
define_syntax("record-type-descriptor", function (x) {
return deep_array_to_list([
Sym("_record-type-descriptor"),
[Sym("quote"), x.cdr.car],
]);
});
define_libfunc("_record-type-descriptor", 1, 1, function (ar) {
assert_symbol(ar[0]);
var type = Record.get_type(ar[0].name);
if (type) return type.rtd;
else
throw new BiwaError(
"record-type-descriptor: unknown record type " + ar[0].name
);
});
//(record-constructor-descriptor <record name>) syntax
define_syntax("record-constructor-descriptor", function (x) {
return deep_array_to_list([
Sym("_record-constructor-descriptor"),
[Sym("quote"), x.cdr.car],
]);
});
define_libfunc("_record-constructor-descriptor", 1, 1, function (ar) {
assert_symbol(ar[0]);
var type = Record.get_type(ar[0].name);
if (type) return type.cd;
else
throw new BiwaError(
"record-constructor-descriptor: unknown record type " + ar[0].name
);
});
// 6.3 Records: Procedural layer
//(make-record-type-descriptor name procedure
define_libfunc("make-record-type-descriptor", 6, 6, function (ar) {
var name = ar[0],
parent_rtd = ar[1],
uid = ar[2],
sealed = ar[3],
opaque = ar[4],
fields = ar[5];
assert_symbol(name);
if (parent_rtd) assert_record_td(parent_rtd);
if (uid) {
assert_symbol(uid);
var _rtd = Record.RTD.NongenerativeRecords[uid.name];
if (_rtd) {
// the record type is already defined.
return _rtd;
// should check equality of other arguments..
}
}
sealed = !!sealed;
opaque = !!opaque;
assert_vector(fields);
for (var i = 0; i < fields.length; i++) {
var list = fields[i];
assert_symbol(list.car, "mutability");
assert_symbol(list.cdr.car, "field name");
fields[i] = [list.cdr.car.name, list.car == Sym("mutable")];
}
var rtd = new Record.RTD(name, parent_rtd, uid, sealed, opaque, fields);
if (uid) Record.RTD.NongenerativeRecords[uid.name] = rtd;
return rtd;
});
//(record-type-descriptor? obj) procedure
define_libfunc("record-type-descriptor?", 1, 1, function (ar) {
return ar[0] instanceof Record.RTD;
});
//(make-record-constructor-descriptor rtd procedure
define_libfunc("make-record-constructor-descriptor", 3, 3, function (ar) {
var rtd = ar[0],
parent_cd = ar[1],
protocol = ar[2];
assert_record_td(rtd);
if (parent_cd) assert_record_cd(parent_cd);
if (protocol) assert_procedure(protocol);
return new Record.CD(rtd, parent_cd, protocol);
});
//(record-constructor constructor-descriptor) procedure
define_libfunc("record-constructor", 1, 1, function (ar) {
var cd = ar[0];
assert_record_cd(cd);
return cd.record_constructor();
});
//(record-predicate rtd) procedure
define_libfunc("record-predicate", 1, 1, function (ar) {
var rtd = ar[0];
assert_record_td(rtd);
return function (args) {
var obj = args[0];
return obj instanceof Record && obj.rtd === rtd;
};
});
//(record-accessor rtd k) procedure
define_libfunc("record-accessor", 2, 2, function (ar) {
var rtd = ar[0],
k = ar[1];
assert_record_td(rtd);
assert_integer(k);
for (var _rtd = rtd.parent_rtd; _rtd; _rtd = _rtd.parent_rtd)
k += _rtd.fields.length;
return function (args) {
var record = args[0];
var error_msg =
rtd.name.name +
"-" +
rtd.field_name(k) +
": " +
to_write$1(record) +
" is not a " +
rtd.name.name;
assert(isRecord(record), error_msg);
var descendant = false;
for (var _rtd = record.rtd; _rtd; _rtd = _rtd.parent_rtd) {
if (_rtd == rtd) descendant = true;
}
assert(descendant, error_msg);
return record.get(k);
};
});
//(record-mutator rtd k) procedure
define_libfunc("record-mutator", 2, 2, function (ar) {
var rtd = ar[0],
k = ar[1];
assert_record_td(rtd);
assert_integer(k);
for (var _rtd = rtd.parent_rtd; _rtd; _rtd = _rtd.parent_rtd)
k += _rtd.fields.length;
return function (args) {
var record = args[0],
val = args[1];
var func_name = rtd.field_name(k);
assert_record(record);
assert(
record.rtd === rtd,
func_name + ": " + to_write$1(record) + " is not a " + rtd.name.name
);
assert(
!record.rtd.sealed,
func_name + ": " + rtd.name.name + " is sealed (can't mutate)"
);
record.set(k, val);
};
});
// 6.4 Records: Inspection
//(record? obj) procedure
define_libfunc("record?", 1, 1, function (ar) {
var obj = ar[0];
if (isRecord(obj)) {
if (obj.rtd.opaque) return false;
// opaque records pretend as if it is not a record.
else return true;
} else return false;
});
//(record-rtd record) procedure
define_libfunc("record-rtd", 1, 1, function (ar) {
assert_record(ar[0]);
return ar[0].rtd;
});
//(record-type-name rtd) procedure
define_libfunc("record-type-name", 1, 1, function (ar) {
assert_record_td(ar[0]);
return ar[0].name;
});
//(record-type-parent rtd) procedure
define_libfunc("record-type-parent", 1, 1, function (ar) {
assert_record_td(ar[0]);
return ar[0].parent_rtd;
});
//(record-type-uid rtd) procedure
define_libfunc("record-type-uid", 1, 1, function (ar) {
assert_record_td(ar[0]);
return ar[0].uid;
});
//(record-type-generative? rtd) procedure
define_libfunc("record-type-generative?", 1, 1, function (ar) {
assert_record_td(ar[0]);
return ar[0].generative;
});
//(record-type-sealed? rtd) procedure
define_libfunc("record-type-sealed?", 1, 1, function (ar) {
assert_record_td(ar[0]);
return ar[0].sealed;
});
//(record-type-opaque? rtd) procedure
define_libfunc("record-type-opaque?", 1, 1, function (ar) {
assert_record_td(ar[0]);
return ar[0].opaque;
});
//(record-type-field-names rtd) procedure
define_libfunc("record-type-field-names", 1, 1, function (ar) {
assert_record_td(ar[0]);
return map(ar[0].fields, function (field) {
return field.name;
});
});
//(record-field-mutable? rtd k) procedure
define_libfunc("record-field-mutable?", 2, 2, function (ar) {
var rtd = ar[0],
k = ar[1];
assert_record_td(ar[0]);
assert_integer(k);
for (var _rtd = rtd.parent_rtd; _rtd; _rtd = _rtd.parent_rtd)
k += _rtd.fields.length;
return ar[0].fields[k].mutable;
});
//
// Chapter 7 Exceptions and conditions
//
//(with-exception-handler handler thunk) procedure
//(guard (<variable> syntax
//(raise obj) procedure
define_libfunc("raise", 1, 1, function (ar) {
throw new UserError(to_write$1(ar[0]));
});
//(raise-continuable obj) procedure
//
//&condition condition type
//(condition condition1 ...) procedure
//(simple-conditions condition) procedure
//(condition? obj) procedure
//(condition-predicate rtd) procedure
//(condition-accessor rtd proc) procedure
//
//&message condition type
//&warning condition type
//&serious condition type
//&error condition type
//&violation condition type
//&assertion condition type
//&irritants condition type
//&who condition type
//&non-continuable condition type
//&implementation-restriction condition type
//&lexical condition type
//&syntax condition type
//&undefined condition type
//
// Chapter 8 I/O
//
// // 8 I/O
// // 8.1 Condition types
//&i/o condition type
//&i/o-read condition type
//&i/o-write condition type
//&i/o-invalid-position condition type
//&i/o-filename condition type
//&i/o-file-protection condition type
//&i/o-file-is-read-only condition type
//&i/o-file-already-exists condition type
//&i/o-file-does-not-exist condition type
//&i/o-port condition type
//
// // 8.2 Port I/O
// // 8.2.1 File names
// //(no function introduced)
//
// // 8.2.2 File options
//(file-options <file-options symbol> ...) syntax
//
// // 8.2.3 Buffer modes
//(buffer-mode <buffer-mode symbol>) syntax
//(buffer-mode? obj) procedure
//
// // 8.2.4 Transcoders
//(latin-1-codec) procedure
//(utf-8-codec) procedure
//(utf-16-codec) procedure
//(eol-style <eol-style symbol>) syntax
//(native-eol-style) procedure
//&i/o-decoding condition type
//&i/o-encoding condition type
//(error-handling-mode <error-handling-mode symbol>) syntax
//(make-transcoder codec) procedure
//(make-transcoder codec eol-style) procedure
//(make-transcoder codec eol-style handling-mode) procedure
//(native-transcoder) procedure
//(transcoder-codec transcoder) procedure
//(transcoder-eol-style transcoder) procedure
//(transcoder-error-handling-mode transcoder) procedure
//(bytevector->string bytevector transcoder) procedure
//(string->bytevector string transcoder) procedure
//
// 8.2.5 End-of-file object
//-> 8.3 (eof-object) procedure
//-> 8.3 (eof-object? obj) procedure
// 8.2.6 Input and output ports
define_libfunc("port?", 1, 1, function (ar) {
return ar[0] instanceof Port;
});
//(port-transcoder port) procedure
define_libfunc("textual-port?", 1, 1, function (ar) {
assert_port(ar[0]);
return !ar[0].is_binary;
});
define_libfunc("binary-port?", 1, 1, function (ar) {
assert_port(ar[0]);
return ar[0].is_binary;
});
//(transcoded-port binary-port transcoder) procedure
//(port-has-port-position? port) procedure
//(port-position port) procedure
//(port-has-set-port-position!? port) procedure
//(set-port-position! port pos) procedure
define_libfunc("close-port", 1, 1, function (ar) {
assert_port(ar[0]);
ar[0].close();
return undef;
});
//(call-with-port port proc) procedure
define_libfunc("call-with-port", 2, 2, function (ar) {
var port = ar[0],
proc = ar[1];
assert_port(port);
assert_closure(proc);
return new Call(proc, [port], function (ar) {
// Automatically close the port
port.close();
return ar[0]; // TODO: values
});
});
// 8.2.7 Input ports
//8.3 (input-port? obj) procedure
//(port-eof? input-port) procedure
//(open-file-input-port filename) procedure
//(open-bytevector-input-port bytevector) procedure
//(open-string-input-port string) procedure
//(standard-input-port) procedure
//8.3 (current-input-port) procedure
//(make-custom-binary-input-port id read! procedure
//(make-custom-textual-input-port id read! procedure
//
// // 8.2.8 Binary input
//(get-u8 binary-input-port) procedure
//(lookahead-u8 binary-input-port) procedure
//(get-bytevector-n binary-input-port count) procedure
//(get-bytevector-n! binary-input-port procedure
//(get-bytevector-some binary-input-port) procedure
//(get-bytevector-all binary-input-port) procedure
//
// // 8.2.9 Textual input
//(get-char textual-input-port) procedure
//(lookahead-char textual-input-port) procedure
//(get-string-n textual-input-port count) procedure
//(get-string-n! textual-input-port string start count) procedure
//(get-string-all textual-input-port) procedure
//(get-line textual-input-port) procedure
//(get-datum textual-input-port) procedure
//
// 8.2.10 Output ports
//8.3 (output-port? obj) procedure
//(flush-output-port output-port) procedure
//(output-port-buffer-mode output-port) procedure
//(open-file-output-port filename) procedure
//(open-bytevector-output-port) procedure
//(call-with-bytevector-output-port proc) procedure
//(open-string-output-port) procedure
//(call-with-string-output-port proc) procedure
define_libfunc("call-with-string-output-port", 1, 1, function (ar) {
var proc = ar[0];
assert_procedure(proc);
var port = new Port.StringOutput();
return new Call(proc, [port], function (ar) {
port.close();
return port.output_string();
});
});
//(standard-output-port) procedure
//(standard-error-port) procedure
//8.3 (current-output-port) procedure
//8.3 (current-error-port) procedure
//(make-custom-binary-output-port id procedure
//(make-custom-textual-output-port id write! get-position set-position! close)
// define_libfunc("make-custom-textual-output-port", 5, 5, function(ar){
// assert_string(ar[0]);
// assert_closure(ar[1]);
// assert_closure(ar[2]);
// assert_closure(ar[3]);
// assert_closure(ar[4]);
// return new Port(ar[0], ar[1], ar[2], ar[3], ar[4]);
// })
//
// // 8.2.11 Binary output
//(put-u8 binary-output-port octet) procedure
//(put-bytevector binary-output-port bytevector) procedure
//
// 8.2.12 Textual output
define_libfunc("put-char", 2, 2, function (ar) {
assert_port(ar[0]);
assert_char(ar[1]);
ar[0].put_string(ar[1].value);
return undef;
});
define_libfunc("put-string", 2, 2, function (ar) {
assert_port(ar[0]);
assert_string(ar[1]);
ar[0].put_string(ar[1]);
return undef;
});
define_libfunc("put-datum", 2, 2, function (ar) {
assert_port(ar[0]);
ar[0].put_string(to_write$1(ar[1]));
return undef;
});
//
// // 8.2.13 Input/output ports
//(open-file-input/output-port filename) procedure
//(make-custom-binary-input/output-port procedure
//(make-custom-textual-input/output-port procedure
//
// // 8.3 Simple I/O
define_libfunc("eof-object", 0, 0, function (ar) {
return eof;
});
define_libfunc("eof-object?", 1, 1, function (ar) {
return ar[0] === eof;
});
//(call-with-input-file filename proc) procedure
//(call-with-output-file filename proc) procedure
define_libfunc("input-port?", 1, 1, function (ar) {
assert_port(ar[0]);
return ar[0].is_input;
});
define_libfunc("output-port?", 1, 1, function (ar) {
assert_port(ar[0]);
return ar[0].is_output;
});
define_libfunc("current-input-port", 0, 0, function (ar) {
return Port.current_input;
});
define_libfunc("current-output-port", 0, 0, function (ar) {
return Port.current_output;
});
define_libfunc("current-error-port", 0, 0, function (ar) {
return Port.current_error;
});
//(with-input-from-file filename thunk) procedure
//(with-output-to-file filename thunk) procedure
//(open-input-file filename) procedure
//(open-output-file filename) procedure
define_libfunc("close-input-port", 1, 1, function (ar) {
assert_port(ar[0]);
if (!ar[0].is_input)
throw new BiwaError("close-input-port: port is not input port");
ar[0].close();
return undef;
});
define_libfunc("close-output-port", 1, 1, function (ar) {
assert_port(ar[0]);
if (!ar[0].is_output)
throw new BiwaError("close-output-port: port is not output port");
ar[0].close();
return undef;
});
//(read-char) procedure
//(peek-char) procedure
define_libfunc("read", 0, 1, function (ar) {
var port = ar[0] || Port.current_input;
assert_port(port);
return port.get_string(function (str) {
return Interpreter.read(str);
});
});
define_libfunc("write-char", 1, 2, function (ar) {
var port = ar[1] || Port.current_output;
assert_char(ar[0]);
port.put_string(ar[0].value);
return undef;
});
define_libfunc("newline", 0, 1, function (ar) {
var port = ar[0] || Port.current_output;
port.put_string("\n");
return undef;
});
define_libfunc("display", 1, 2, function (ar) {
var port = ar[1] || Port.current_output;
port.put_string(to_display(ar[0]));
return undef;
});
define_libfunc("write", 1, 2, function (ar) {
var port = ar[1] || Port.current_output;
assert_port(port);
port.put_string(to_write$1(ar[0]));
return undef;
});
define_libfunc("write-shared", 1, 2, function (ar) {
var port = ar[1] || Port.current_output;
assert_port(port);
port.put_string(write_shared(ar[0]));
return undef;
});
define_libfunc("write-simple", 1, 2, function (ar) {
var port = ar[1] || Port.current_output;
assert_port(port);
port.put_string(write_simple(ar[0]));
return undef;
});
//
// Chapter 9 File System
// Chapter 10 Command-line access and exit values
//
// see src/library/node_functions.js
//
// Chapter 11 Arithmetic
//
//// 11.1 Bitwise operations
//// 11.2 Fixnums
//(fixnum? obj) procedure
//(fixnum-width) procedure
//(least-fixnum) procedure
//(greatest-fixnum) procedure
//(fx=? fx1 fx2 fx3 ...) procedure
//(fx>? fx1 fx2 fx3 ...) procedure
//(fx<? fx1 fx2 fx3 ...) procedure
//(fx>=? fx1 fx2 fx3 ...) procedure
//(fx<=? fx1 fx2 fx3 ...) procedure
//(fxzero? fx) procedure
//(fxpositive? fx) procedure
//(fxnegative? fx) procedure
//(fxodd? fx) procedure
//(fxeven? fx) procedure
//(fxmax fx1 fx2 ...) procedure
//(fxmin fx1 fx2 ...) procedure
//(fx+ fx1 fx2) procedure
//(fx* fx1 fx2) procedure
//(fx- fx1 fx2) procedure
//(fxdiv-and-mod fx1 fx2) procedure
//(fxdiv fx1 fx2) procedure
//(fxmod fx1 fx2) procedure
//(fxdiv0-and-mod0 fx1 fx2) procedure
//(fxdiv0 fx1 fx2) procedure
//(fxmod0 fx1 fx2) procedure
//(fx+/carry fx1 fx2 fx3) procedure
//(fx-/carry fx1 fx2 fx3) procedure
//(fx*/carry fx1 fx2 fx3) procedure
//(fxnot fx) procedure
//(fxand fx1 ...) procedure
//(fxior fx1 ...) procedure
//(fxxor fx1 ...) procedure
//(fxif fx1 fx2 fx3) procedure
//(fxbit-count fx) procedure
//(fxlength fx) procedure
//(fxfirst-bit-set fx) procedure
//(fxbit-set? fx1 fx2) procedure
//(fxcopy-bit fx1 fx2 fx3) procedure
//(fxbit-field fx1 fx2 fx3) procedure
//(fxcopy-bit-field fx1 fx2 fx3 fx4) procedure
//(fxarithmetic-shift fx1 fx2) procedure
//(fxarithmetic-shift-left fx1 fx2) procedure
//(fxarithmetic-shift-right fx1 fx2) procedure
//(fxrotate-bit-field fx1 fx2 fx3 fx4) procedure
//(fxreverse-bit-field fx1 fx2 fx3) procedure
//
//// 11.3 Flonums
//(flonum? obj) procedure
//(real->flonum x) procedure
//(fl=? fl1 fl2 fl3 ...) procedure
//(fl<? fl1 fl2 fl3 ...) procedure
//(fl<=? fl1 fl2 fl3 ...) procedure
//(fl>? fl1 fl2 fl3 ...) procedure
//(fl>=? fl1 fl2 fl3 ...) procedure
//(flinteger? fl) procedure
//(flzero? fl) procedure
//(flpositive? fl) procedure
//(flnegative? fl) procedure
//(flodd? ifl) procedure
//(fleven? ifl) procedure
//(flfinite? fl) procedure
//(flinfinite? fl) procedure
//(flnan? fl) procedure
//(flmax fl1 fl2 ...) procedure
//(flmin fl1 fl2 ...) procedure
//(fl+ fl1 ...) procedure
//(fl* fl1 ...) procedure
//(fl- fl1 fl2 ...) procedure
//(fl- fl) procedure
//(fl/ fl1 fl2 ...) procedure
//(fl/ fl) procedure
//(flabs fl) procedure
//(fldiv-and-mod fl1 fl2) procedure
//(fldiv fl1 fl2) procedure
//(flmod fl1 fl2) procedure
//(fldiv0-and-mod0 fl1 fl2) procedure
//(fldiv0 fl1 fl2) procedure
//(flmod0 fl1 fl2) procedure
//(flnumerator fl) procedure
//(fldenominator fl) procedure
//(flfloor fl) procedure
//(flceiling fl) procedure
//(fltruncate fl) procedure
//(flround fl) procedure
//(flexp fl) procedure
//(fllog fl) procedure
//(fllog fl1 fl2) procedure
//(flsin fl) procedure
//(flcos fl) procedure
//(fltan fl) procedure
//(flasin fl) procedure
//(flacos fl) procedure
//(flatan fl) procedure
//(flatan fl1 fl2) procedure
//(flsqrt fl) procedure
//(flexpt fl1 fl2) procedure
//&no-infinities condition type
//&no-nans condition type
//(fixnum->flonum fx) procedure
//// 11.4 Exact bitwise arithmetic
//(bitwise-not ei) procedure
define_libfunc("bitwise-not", 1, 1, function (ar) {
return ~ar[0];
});
//(bitwise-and ei1 ...) procedure
define_libfunc("bitwise-and", 1, null, function (ar) {
return reduce(ar, function (ret, item) {
return ret & item;
});
});
//(bitwise-ior ei1 ...) procedure
define_libfunc("bitwise-ior", 1, null, function (ar) {
return reduce(ar, function (ret, item) {
return ret | item;
});
});
//(bitwise-xor ei1 ...) procedure
define_libfunc("bitwise-xor", 1, null, function (ar) {
return reduce(ar, function (ret, item) {
return ret ^ item;
});
});
//(bitwise-if ei1 ei2 ei3) procedure
define_libfunc("bitwise-if", 3, 3, function (ar) {
return (ar[0] & ar[1]) | (~ar[0] & ar[2]);
});
//(bitwise-bit-count ei) procedure
define_libfunc("bitwise-bit-count", 1, 1, function (ar) {
var e = Math.abs(ar[0]),
ret = 0;
for (; e != 0; e >>= 1) {
if (e & 1) ret++;
}
return ret;
});
//(bitwise-length ei) procedure
define_libfunc("bitwise-length", 1, 1, function (ar) {
var e = Math.abs(ar[0]),
ret = 0;
for (; e != 0; e >>= 1) {
ret++;
}
return ret;
});
//(bitwise-first-bit-set ei) procedure
define_libfunc("bitwise-first-bit-set", 1, 1, function (ar) {
var e = Math.abs(ar[0]),
ret = 0;
if (e == 0) return -1;
for (; e != 0; e >>= 1) {
if (e & 1) return ret;
ret++;
}
});
//(bitwise-bit-set? ei1 ei2) procedure
define_libfunc("bitwise-bit-set?", 2, 2, function (ar) {
return !!(ar[0] & (1 << ar[1]));
});
//(bitwise-copy-bit ei1 n b) procedure
define_libfunc("bitwise-copy-bit", 3, 3, function (ar) {
var mask = 1 << ar[1];
return (
(mask & (ar[2] << ar[1])) | // Set n-th bit to b
(~mask & ar[0])
); // and use ei1 for rest of the bits
});
//(bitwise-bit-field ei1 start end) procedure
define_libfunc("bitwise-bit-field", 3, 3, function (ar) {
var mask = ~(-1 << ar[2]); // Has 1 at 0...end
return (mask & ar[0]) >> ar[1];
});
//(bitwise-copy-bit-field dst start end src) procedure
define_libfunc("bitwise-copy-bit-field", 4, 4, function (ar) {
var dst = ar[0],
start = ar[1],
end = ar[2],
src = ar[3];
var mask =
~(-1 << end) & // Has 1 at 0...end
(-1 << start); // Clear 0...start
return (mask & (src << start)) | (~mask & dst);
});
//(bitwise-arithmetic-shift ei1 ei2) procedure
define_libfunc("bitwise-arithmetic-shift", 2, 2, function (ar) {
return ar[1] >= 0 ? ar[0] << ar[1] : ar[0] >> -ar[1];
});
//(bitwise-arithmetic-shift-left ei1 ei2) procedure
define_libfunc("bitwise-arithmetic-shift-left", 2, 2, function (ar) {
return ar[0] << ar[1];
});
//(bitwise-arithmetic-shift-right ei1 ei2) procedure
define_libfunc("bitwise-arithmetic-shift-right", 2, 2, function (ar) {
return ar[0] >> ar[1];
});
//(bitwise-rotate-bit-field ei1 start end count) procedure
define_libfunc("bitwise-rotate-bit-field", 4, 4, function (ar) {
var n = ar[0],
start = ar[1],
end = ar[2],
count = ar[3];
var width = end - start;
if (width <= 0) return n;
count %= width;
var orig_field = (~(-1 << end) & n) >> start;
var rotated_field = (orig_field << count) | (orig_field >> (width - count));
var mask = ~(-1 << end) & (-1 << start);
return (mask & (rotated_field << start)) | (~mask & n);
});
//(bitwise-reverse-bit-field ei1 ei2 ei3) procedure
define_libfunc("bitwise-reverse-bit-field", 3, 3, function (ar) {
var ret = ar[0],
n = ar[0],
start = ar[1],
end = ar[2];
var orig_field = (~(-1 << end) & n) >> start;
for (var i = 0; i < end - start; i++, orig_field >>= 1) {
var bit = orig_field & 1;
var setpos = end - 1 - i;
var mask = 1 << setpos;
ret = (mask & (bit << setpos)) | (~mask & ret);
}
return ret;
});
//
// Chapter 12 syntax-case
//
//
// Chapter 13 Hashtables
//
//13.1 Constructors
//(define h (make-eq-hashtale)
//(define h (make-eq-hashtable 1000))
define_libfunc("make-eq-hashtable", 0, 1, function (ar) {
// Note: ar[1] (hashtable size) is just ignored
return new Hashtable(Hashtable.eq_hash, Hashtable.eq_equiv);
});
//(make-eqv-hashtable) procedure
//(make-eqv-hashtable k) procedure
define_libfunc("make-eqv-hashtable", 0, 1, function (ar) {
return new Hashtable(Hashtable.eqv_hash, Hashtable.eqv_equiv);
});
//(make-hashtable hash-function equiv) procedure
//(make-hashtable hash-function equiv k) procedure
define_libfunc("make-hashtable", 2, 3, function (ar) {
assert_procedure(ar[0]);
assert_procedure(ar[1]);
return new Hashtable(ar[0], ar[1]);
});
//13.2 Procedures
// (hashtable? hash)
define_libfunc("hashtable?", 1, 1, function (ar) {
return ar[0] instanceof Hashtable;
});
//(hashtable-size hash)
define_libfunc("hashtable-size", 1, 1, function (ar) {
assert_hashtable(ar[0]);
return ar[0].keys().length;
});
// Find a pair from a hashtable with given key.
//
// hash - a BiwaScheme.Hashtable
// key - an object
// callbacks - an object contains callback functions
// .on_found - function(pair, hashed)
// pair - [Object key, Object value]
// hashed - Object hashed
// .on_not_found - function(hashed)
// hashed - Object hashed
//
// Returns an instance of BiwaScheme.Call.
const find_hash_pair = function (hash, key, callbacks) {
// invoke hash proc
return new Call(hash.hash_proc, [key], function (ar) {
var hashed = ar[0];
var candidate_pairs = hash.candidate_pairs(hashed);
if (!candidate_pairs) {
// shortcut: obviously not found
return callbacks.on_not_found(hashed);
}
// search the exact key from candidates
return Call.foreach(candidate_pairs, {
call: function (pair) {
// invoke the equivalence proc
return new Call(hash.equiv_proc, [key, pair[0]]);
},
result: function (equal, pair) {
if (equal) {
// found
return callbacks.on_found(pair, hashed);
}
},
finish: function () {
// not found
return callbacks.on_not_found(hashed);
},
});
});
};
//(hashtable-ref hash "foo" #f)
define_libfunc("hashtable-ref", 3, 3, function (ar) {
var hash = ar[0],
key = ar[1],
ifnone = ar[2];
assert_hashtable(hash);
return find_hash_pair(hash, key, {
on_found: function (pair) {
return pair[1];
},
on_not_found: function (hashed) {
return ifnone;
},
});
});
//(hashtable-set! hash "foo" '(1 2))
define_libfunc("hashtable-set!", 3, 3, function (ar) {
var hash = ar[0],
key = ar[1],
value = ar[2];
assert_hashtable(hash);
assert(hash.mutable, "hashtable is not mutable");
return find_hash_pair(hash, key, {
on_found: function (pair) {
pair[1] = value;
return undef;
},
on_not_found: function (hashed) {
hash.add_pair(hashed, key, value);
return undef;
},
});
});
//(hashtable-delete! hash "foo")
define_libfunc("hashtable-delete!", 2, 2, function (ar) {
var hash = ar[0],
key = ar[1];
assert_hashtable(hash);
assert(hash.mutable, "hashtable is not mutable");
return find_hash_pair(hash, key, {
on_found: function (pair, hashed) {
hash.remove_pair(hashed, pair);
return undef;
},
on_not_found: function (hashed) {
return undef;
},
});
});
//(hashtable-contains? hash "foo")
define_libfunc("hashtable-contains?", 2, 2, function (ar) {
var hash = ar[0],
key = ar[1];
assert_hashtable(hash);
return find_hash_pair(hash, key, {
on_found: function (pair) {
return true;
},
on_not_found: function (hashed) {
return false;
},
});
});
//(hashtable-update! hashtable key proc default) procedure
define_libfunc("hashtable-update!", 4, 4, function (ar) {
var hash = ar[0],
key = ar[1],
proc = ar[2],
ifnone = ar[3];
assert_hashtable(hash);
assert(hash.mutable, "hashtable is not mutable");
assert_procedure(proc);
return find_hash_pair(hash, key, {
on_found: function (pair, hashed) {
// invoke proc and get new value
return new Call(proc, [pair[1]], function (ar) {
// replace the value
pair[1] = ar[0];
return undef;
});
},
on_not_found: function (hashed) {
// invoke proc and get new value
return new Call(proc, [ifnone], function (ar) {
// create new pair
hash.add_pair(hashed, key, ar[0]);
return undef;
});
},
});
});
//(hashtable-copy hashtable) procedure
//(hashtable-copy hashtable mutable) procedure
define_libfunc("hashtable-copy", 1, 2, function (ar) {
var mutable = ar[1] === undefined ? false : !!ar[1];
assert_hashtable(ar[0]);
return ar[0].create_copy(mutable);
});
//(hashtable-clear! hashtable) procedure
//(hashtable-clear! hashtable k) procedure
define_libfunc("hashtable-clear!", 0, 1, function (ar) {
assert_hashtable(ar[0]);
assert(ar[0].mutable, "hashtable is not mutable");
ar[0].clear();
return undef;
});
//(hashtable-keys hash) ; => vector
define_libfunc("hashtable-keys", 1, 1, function (ar) {
assert_hashtable(ar[0]);
return ar[0].keys();
});
//(hashtable-entries hash) ; => two vectors (keys, values)
define_libfunc("hashtable-entries", 1, 1, function (ar) {
assert_hashtable(ar[0]);
return new Values$1([ar[0].keys(), ar[0].values()]);
});
//13.3 Inspection
//(hashtable-equivalence-function hashtable) procedure
define_libfunc("hashtable-equivalence-function", 1, 1, function (ar) {
assert_hashtable(ar[0]);
return ar[0].equiv_proc;
});
//(hashtable-hash-function hashtable) procedure
define_libfunc("hashtable-hash-function", 1, 1, function (ar) {
assert_hashtable(ar[0]);
return ar[0].hash_proc;
});
//(hashtable-mutable? hashtable) procedure
define_libfunc("hashtable-mutable?", 1, 1, function (ar) {
assert_hashtable(ar[0]);
return ar[0].mutable;
});
//13.4 Hash functions
//(equal-hash obj) procedure
define_libfunc("equal-hash", 0, 0, function (ar) {
return Hashtable.equal_hash;
});
//(string-hash string) procedure
define_libfunc("string-hash", 0, 0, function (ar) {
return Hashtable.string_hash;
});
//(string-ci-hash string) procedure
define_libfunc("string-ci-hash", 0, 0, function (ar) {
return Hashtable.string_ci_hash;
});
//(symbol-hash symbol) procedure
define_libfunc("symbol-hash", 0, 0, function (ar) {
return Hashtable.symbol_hash;
});
//
// Chapter 14 Enumerators
//
//(make-enumeration symbol-list) -> enum-set(new type)
define_libfunc("make-enumeration", 1, 1, function (ar) {
assert_list(ar[0]);
var members = ar[0].to_array();
var enum_type = new Enumeration.EnumType(members);
return enum_type.universe();
});
//(enum-set-universe enum-set) -> enum-set(same type as the argument)
define_libfunc("enum-set-universe", 1, 1, function (ar) {
assert_enum_set(ar[0]);
return ar[0].enum_type.universe();
});
//(enum-set-indexer enum-set) -> (lambda (sym)) -> integer or #f
define_libfunc("enum-set-indexer", 1, 1, function (ar) {
assert_enum_set(ar[0]);
return ar[0].enum_type.indexer();
});
//(enum-set-constructor enum-set) -> (lambda (syms)) -> enum-set(same type as the argument)
define_libfunc("enum-set-constructor", 1, 1, function (ar) {
assert_enum_set(ar[0]);
return ar[0].enum_type.constructor();
});
//(enum-set->list enum-set) -> symbol-list
define_libfunc("enum-set->list", 1, 1, function (ar) {
assert_enum_set(ar[0]);
return ar[0].symbol_list();
});
//(enum-set-member? symbol enum-set) -> bool
define_libfunc("enum-set-member?", 2, 2, function (ar) {
assert_symbol(ar[0]);
assert_enum_set(ar[1]);
return ar[1].is_member(ar[0]);
});
//(enum-set-subset? esa esb) -> bool
define_libfunc("enum-set-subset?", 2, 2, function (ar) {
assert_enum_set(ar[0]);
assert_enum_set(ar[1]);
return ar[0].is_subset(ar[1]);
});
//(enum-set=? esa esb) -> bool
define_libfunc("enum-set=?", 2, 2, function (ar) {
assert_enum_set(ar[0]);
assert_enum_set(ar[1]);
return ar[0].equal_to(ar[1]);
});
//(enum-set-union es1 es2) -> enum-set
define_libfunc("enum-set-union", 2, 2, function (ar) {
assert_enum_set(ar[0]);
assert_enum_set(ar[1]);
assert(
ar[0].enum_type === ar[1].enum_type,
"two enum-sets must be the same enum-type",
"enum-set-union"
);
return ar[0].union(ar[1]);
});
//(enum-set-intersection es1 es2) -> enum-set
define_libfunc("enum-set-intersection", 2, 2, function (ar) {
assert_enum_set(ar[0]);
assert_enum_set(ar[1]);
return ar[0].intersection(ar[1]);
});
//(enum-set-difference es1 es2) -> enum-set
define_libfunc("enum-set-difference", 2, 2, function (ar) {
assert_enum_set(ar[0]);
assert_enum_set(ar[1]);
return ar[0].difference(ar[1]);
});
//(enum-set-complement enum-set) -> enum-set
define_libfunc("enum-set-complement", 1, 1, function (ar) {
assert_enum_set(ar[0]);
return ar[0].complement();
});
//(enum-set-projection esa esb) -> enum-set
define_libfunc("enum-set-projection", 2, 2, function (ar) {
assert_enum_set(ar[0]);
assert_enum_set(ar[1]);
return ar[0].projection(ar[1]);
});
//(define-enumeration <type-name> (<symbol> ...) <constructor-syntax>)
// Example:
// (define-enumeration color (red green black white) color-set)
// this defines:
// - an EnumType
// - (color red) ;=> 'red
// - (color-set red black) ;=> #<enum-set (red black)>
define_syntax("define-enumeration", function (x) {
// Extract parameters
var type_name = x.cdr.car;
assert(
isSymbol(type_name),
"expected symbol for type_name",
"define-enumeration"
);
type_name = type_name.name;
var members = x.cdr.cdr.car;
assert(
isList(members),
"expected list of symbol for members",
"define-enumeration"
);
members = members.to_array();
var constructor_name = x.cdr.cdr.cdr.car;
assert(
isSymbol(constructor_name),
"expected symbol for constructor_name",
"define-enumeration"
);
constructor_name = constructor_name.name;
// Define EnumType
var enum_type = new Enumeration.EnumType(members);
// Define (color red)
define_syntax(type_name, function (x) {
// (color)
assert(!isNil(x.cdr), "an argument is needed", type_name);
var arg = x.cdr.car;
assert_symbol(arg, type_name);
// Check arg is included in the universe
assert(
contains(enum_type.members, arg),
arg.name +
" is not included in the universe: " +
to_write$1(enum_type.members),
type_name
);
return List(Sym("quote"), arg);
});
// Define (color-set red black)
define_syntax(constructor_name, function (x) {
assert_list(x.cdr, constructor_name);
var symbols = x.cdr.to_array();
// Check each argument is included in the universe
each(symbols, function (arg) {
assert_symbol(arg, constructor_name);
assert(
contains(enum_type.members, arg),
arg.name +
" is not included in the universe: " +
to_write$1(enum_type.members),
constructor_name
);
});
// Create an EnumSet
return new Enumeration.EnumSet(enum_type, symbols);
});
});
//
// Chapter 15 Composite library
//
//(rnrs 6) = all - eval - mutable pairs - mutable strings - r5rs compatibility
//
// Chapter 16 eval
//
//(eval expression environment) procedure
define_libfunc("eval", 1, 1, function (ar, intp) {
//TODO: environment
//TODO: this implementation has a bug that
// expressions which contains #<undef>, etc. cannot be evaluated.
var expr = ar[0];
var intp2 = new Interpreter(intp);
return intp2.evaluate(to_write$1(expr));
});
//(environment import-spec ...) procedure
//
// Chapter 17 Mutable pairs
//
//(set-car! pair obj) procedure
//(set-cdr! pair obj) procedure
//
// Chapter 18 Mutable strings
//
//(string-set! string k char) procedure
// (string-fill! string char) procedure
//
// Chapter 19 R5RS compatibility
//
//(exact->inexact z) procedure
//(inexact->exact z) procedure
//
//(quotient n1 n2) procedure
//(remainder n1 n2) procedure
//(modulo n1 n2) procedure
//
//(null-environment n) procedure
//(scheme-report-environment n) procedure
//
// R7RS (TODO: split file?)
//
// R7RS Promise
//
// (delay expression)
define_syntax("delay", function (x) {
if (x.cdr === nil) {
throw new BiwaError("malformed delay: no argument");
}
if (x.cdr.cdr !== nil) {
throw new BiwaError(
"malformed delay: too many arguments: " + write_ss(x)
);
}
var expr = x.cdr.car;
// Expand into call of internal function
// ( procedure->promise (lambda () (make-promise expr)))
return new Pair(
Sym(" procedure->promise"),
new Pair(
new Pair(
Sym("lambda"),
new Pair(
nil,
new Pair(new Pair(Sym("make-promise"), new Pair(expr, nil)), nil)
)
)
)
);
});
// (delay-force promise-expr)
define_syntax("delay-force", function (x) {
if (x.cdr === nil) {
throw new BiwaError("malformed delay-force: no argument");
}
if (x.cdr.cdr !== nil) {
throw new BiwaError(
"malformed delay-force: too many arguments: " + write_ss(x)
);
}
var expr = x.cdr.car;
// Expand into call of internal function
// ( procedure->promise (lambda () expr))
return new Pair(
Sym(" procedure->promise"),
new Pair(new Pair(Sym("lambda"), new Pair(nil, new Pair(expr, nil))), nil)
);
});
// (force promise)
var force = function (promise) {
if (promise.is_done()) {
return promise.value();
}
return new Call(promise.thunk(), [], function (ar) {
assert_promise(ar[0]);
var new_promise = ar[0];
if (promise.is_done()) {
// reentrant!
return promise.value();
} else {
promise.update_with(new_promise);
return force(new_promise);
}
});
};
define_libfunc("force", 1, 1, function (ar, intp) {
assert_promise(ar[0]);
return force(ar[0]);
});
// (promise? obj)
define_libfunc("promise?", 1, 1, function (ar, intp) {
return ar[0] instanceof BiwaPromise;
});
// (make-promise obj)
define_libfunc("make-promise", 1, 1, function (ar, intp) {
var obj = ar[0];
if (obj instanceof BiwaPromise) {
return obj;
} else {
return BiwaPromise.done(obj);
}
});
// internal function
// ( procedure->promise proc)
// proc must be a procedure with no argument and return a promise
define_libfunc(" procedure->promise", 1, 1, function (ar, intp) {
assert_procedure(ar[0]);
return BiwaPromise.fresh(ar[0]);
});
//
// parameterize
//
// (make-parameter init)
// (make-parameter init converter)
define_libfunc("make-parameter", 1, 2, function (ar, intp) {
let currentValue;
const converter = ar[1];
// A parameter is represented by a JS function.
// (parameterObj) ;=> Return the current value
// (parameterObj v) ;=> Set v as the value and return the original value
const parameterObj = function (ar2) {
if (ar2.length == 0) {
// Get
return currentValue;
} else {
// Set
const origValue = currentValue;
if (converter) {
return new Call(converter, [ar2[0]], (ar3) => {
currentValue = ar3[0];
return origValue;
});
} else {
currentValue = ar2[0];
return origValue;
}
}
};
if (converter) {
return new Call(converter, [ar[0]], (initialValue) => {
currentValue = initialValue;
return parameterObj;
});
} else {
const initialValue = ar[0];
currentValue = initialValue;
return parameterObj;
}
});
// (parameterize ((param val) ...) body ...)
define_syntax("parameterize", function (x) {
const inits = x.cdr.car.to_array();
const body = x.cdr.cdr;
const tmpNames = inits.map(() => gensym());
// (let ((tmp0 val0) (tmp1 val1) ...)
// (dynamic-wind
// (lambda () (begin (set! tmp0 (param0 tmp0))) ...)
// (lambda () body ...)
// (lambda () (begin (set! tmp0 (param0 tmp0))) ...)))
const givenValues = List(
...inits.map((item, i) => List(tmpNames[i], item.cdr.car))
);
const updateValues = Cons(
Sym("begin"),
List(
...inits.map((item, i) =>
List(Sym("set!"), tmpNames[i], List(item.car, tmpNames[i]))
)
)
);
const before = List(Sym("lambda"), nil, updateValues);
const thunk = Cons(Sym("lambda"), Cons(nil, body));
const after = List(Sym("lambda"), nil, updateValues);
//return List(Sym("quote"),
return List(
Sym("let"),
givenValues,
List(Sym("dynamic-wind"), before, thunk, after)
);
//)
});
//
// srfi.js - SRFI libraries
//
// should be src/library/srfi/1.js, etc (in the future).
//
//
// srfi-1 (list)
//
// (iota count start? step?)
define_libfunc("iota", 1, 3, function (ar) {
var count = ar[0];
var start = ar[1] || 0;
var step = ar[2] === undefined ? 1 : ar[2];
assert_integer(count);
assert_number(start);
assert_number(step);
var a = [],
n = start;
for (var i = 0; i < count; i++) {
a.push(n);
n += step;
}
return array_to_list(a);
});
var copy_pair = function (pair) {
var car = isPair(pair.car) ? copy_pair(pair.car) : pair.car;
var cdr = isPair(pair.cdr) ? copy_pair(pair.cdr) : pair.cdr;
return new Pair(car, cdr);
};
// (list-copy list)
define_libfunc("list-copy", 1, 1, function (ar) {
if (isPair(ar[0])) {
return copy_pair(ar[0]);
} else {
return nil;
}
});
//
// srfi-6 & Gauche (string port)
//
define_libfunc("open-input-string", 1, 1, function (ar) {
assert_string(ar[0]);
return new Port.StringInput(ar[0]);
});
define_libfunc("open-output-string", 0, 0, function (ar) {
return new Port.StringOutput();
});
define_libfunc("get-output-string", 1, 1, function (ar) {
assert_port(ar[0]);
if (!(ar[0] instanceof Port.StringOutput))
throw new Error(
"get-output-string: port must be made by 'open-output-string'"
);
return ar[0].output_string();
});
//
// srfi-8 (receive)
//
// (receive <formals> <expression> <body>...)
// -> (call-with-values (lambda () expression)
// (lambda formals body ...))
define_syntax("receive", function (x) {
assert(isPair(x.cdr), "missing formals", "receive");
var formals = x.cdr.car;
assert(isPair(x.cdr.cdr), "missing expression", "receive");
var expression = x.cdr.cdr.car;
var body = x.cdr.cdr.cdr;
return deep_array_to_list([
Sym("call-with-values"),
[Sym("lambda"), nil, expression],
new Pair(Sym("lambda"), new Pair(formals, body)),
]);
});
// srfi-19 (time)
//
// // constants
//time-duration
//time-monotonic
//time-process
//time-tai
//time-thread
//time-utc
// Current time and clock resolution
// (current-date [tz-offset])
define_libfunc("current-date", 0, 1, function (ar) {
//todo: tz-offset (ar[1])
return new Date();
});
//
//current-julian-day -> jdn
//current-modified-julian-day -> mjdn
//current-time [time-type] -> time
//time-resolution [time-type] -> integer
// // Time object and accessors
//make-time type nanosecond second -> time
//time? object -> boolean
//time-type time -> time-type
//time-nanosecond time -> integer
//time-second time -> integer
//set-time-type! time time-type
//set-time-nanosecond! time integer
//set-time-second! time integer
//copy-time time1 -> time2
// // Time comparison procedures
//time<=? time1 time2 -> boolean
//time<? time1 time2 -> boolean
//time=? time1 time2 -> boolean
//time>=? time1 time2 -> boolean
//time>? time1 time2 -> boolean
// // Time arithmetic procedures
//time-difference time1 time2 -> time-duration
//time-difference! time1 time2 -> time-duration
//add-duration time1 time-duration -> time
//add-duration! time1 time-duration -> time
//subtract-duration time1 time-duration -> time
//subtract-duration! time1 time-duration -> time
// Date object and accessors
// make-date
define_libfunc("date?", 1, 1, function (ar) {
return ar[0] instanceof Date;
});
define_libfunc("date-nanosecond", 1, 1, function (ar) {
assert_date(ar[0]);
return ar[0].getMilliseconds() * 1000000;
});
define_libfunc("date-millisecond", 1, 1, function (ar) {
// not srfi-19
assert_date(ar[0]);
return ar[0].getMilliseconds();
});
define_libfunc("date-second", 1, 1, function (ar) {
assert_date(ar[0]);
return ar[0].getSeconds();
});
define_libfunc("date-minute", 1, 1, function (ar) {
assert_date(ar[0]);
return ar[0].getMinutes();
});
define_libfunc("date-hour", 1, 1, function (ar) {
assert_date(ar[0]);
return ar[0].getHours();
});
define_libfunc("date-day", 1, 1, function (ar) {
assert_date(ar[0]);
return ar[0].getDate();
});
define_libfunc("date-month", 1, 1, function (ar) {
assert_date(ar[0]);
return ar[0].getMonth() + 1; //Jan = 0 in javascript..
});
define_libfunc("date-year", 1, 1, function (ar) {
assert_date(ar[0]);
return ar[0].getFullYear();
});
//date-zone-offset
//date-year-day
define_libfunc("date-week-day", 1, 1, function (ar) {
assert_date(ar[0]);
return ar[0].getDay();
});
//date-week-number
// Time/Date/Julian Day/Modified Julian Day Converters
// (snipped)
// Date to String/String to Date Converters
// TODO: support locale
// * date_names
// * ~f 5.2 sec
// * ~p AM/PM
// * ~X 2007/01/01
const date_names = {
weekday: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
full_weekday: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
],
month: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
],
full_month: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"Octorber",
"November",
"December",
],
};
const date2string = function (date, format) {
var zeropad = function (n) {
return n < 10 ? "0" + n : "" + n;
};
var spacepad = function (n) {
return n < 10 ? " " + n : "" + n;
};
var isoweeknum = function (x) {
var janFour = new Date(x.getFullYear(), 0, 4);
var weekone = new Date(x.getFullYear(), 0, 4);
if (janFour.getDay() >= date_names.weekday.indexOf("Thu")) {
weekone.setDate(janFour.getDate() - (janFour.getDay() + 1));
} else {
weekone.setDate(janFour.getDate() + (7 - janFour.getDay() + 1));
}
return Math.ceil((x - weekone) / 86400000 / 7);
};
var getter = {
a: function (x) {
return date_names.weekday[x.getDay()];
},
A: function (x) {
return date_names.full_weekday[x.getDay()];
},
b: function (x) {
return date_names.month[x.getMonth()];
},
B: function (x) {
return date_names.full_month[x.getMonth()];
},
c: function (x) {
return x.toString();
},
d: function (x) {
return zeropad(x.getDate());
},
D: function (x) {
return getter.d(x) + getter.m(x) + getter.y(x);
},
e: function (x) {
return spacepad(x.getDate());
},
f: function (x) {
return x.getSeconds() + x.getMilliseconds() / 1000;
},
h: function (x) {
return date_names.month[x.getMonth()];
},
H: function (x) {
return zeropad(x.getHours());
},
I: function (x) {
var h = x.getHours();
return zeropad(h < 13 ? h : h - 12);
},
j: function (x) {
throw new Bug("not implemented: day of year");
},
k: function (x) {
return spacepad(x.getHours());
},
l: function (x) {
var h = x.getHours();
return spacepad(h < 13 ? h : h - 12);
},
m: function (x) {
return zeropad(x.getMonth() + 1);
},
M: function (x) {
return zeropad(x.getMinutes());
},
n: function (x) {
return "\n";
},
N: function (x) {
throw new Bug("not implemented: nanoseconds");
},
p: function (x) {
return x.getHours() < 13 ? "AM" : "PM";
},
r: function (x) {
return (
getter.I(x) +
":" +
getter.M(x) +
":" +
getter.S(x) +
" " +
getter.p(x)
);
},
s: function (x) {
return Math.floor(x.getTime() / 1000);
},
S: function (x) {
return zeropad(x.getSeconds());
},
t: function (x) {
return "\t";
},
T: function (x) {
return getter.H(x) + ":" + getter.M(x) + ":" + getter.S(x);
},
U: function (x) {
throw new Bug("not implemented: weeknum(0~, Sun)");
},
V: function (x) {
return isoweeknum(x);
},
w: function (x) {
return x.getDay();
},
W: function (x) {
throw new Bug("not implemented: weeknum(0~, Mon)");
},
x: function (x) {
throw new Bug("not implemented: weeknum(1~, Mon)");
},
X: function (x) {
return getter.Y(x) + "/" + getter.m(x) + "/" + getter.d(x);
},
y: function (x) {
return x.getFullYear() % 100;
},
Y: function (x) {
return x.getFullYear();
},
z: function (x) {
throw new Bug("not implemented: time-zone");
},
Z: function (x) {
throw new Bug("not implemented: symbol time zone");
},
1: function (x) {
throw new Bug("not implemented: ISO-8601 year-month-day format");
},
2: function (x) {
throw new Bug(
"not implemented: ISO-8601 hour-minute-second-timezone format"
);
},
3: function (x) {
throw new Bug("not implemented: ISO-8601 hour-minute-second format");
},
4: function (x) {
throw new Bug(
"not implemented: ISO-8601 year-month-day-hour-minute-second-timezone format"
);
},
5: function (x) {
throw new Bug(
"not implemented: ISO-8601 year-month-day-hour-minute-second format"
);
},
};
return format.replace(/~([\w1-5~])/g, function (str, x) {
var func = getter[x];
if (func) return func(date);
else if (x == "~") return "~";
else return x;
});
};
// date->string date template
define_libfunc("date->string", 1, 2, function (ar) {
assert_date(ar[0]);
if (ar[1]) {
assert_string(ar[1]);
return date2string(ar[0], ar[1]);
} else return ar[0].toString();
});
// string->date
// parse-date date
define_libfunc("parse-date", 1, 1, function (ar) {
// not srfi-19
assert_string(ar[0]);
return new Date(Date.parse(ar[0]));
});
//
// srfi-27
//
define_libfunc("random-integer", 1, 1, function (ar) {
var n = ar[0];
assert_integer(n);
if (n < 0) throw new Error("random-integer: the argument must be >= 0");
else return Math.floor(Math.random() * ar[0]);
});
define_libfunc("random-real", 0, 0, function (ar) {
return Math.random();
});
//
// srfi-28 (format)
//
// (format format-str obj1 obj2 ...) -> string
// (format #f format-str ...) -> string
// (format #t format-str ...) -> output to current port
// (format port format-str ...) -> output to the port
// ~a: display
// ~s: write
// ~%: newline
// ~~: tilde
define_libfunc("format", 1, null, function (ar) {
if (isString$1(ar[0])) {
var port = null,
format_str = ar.shift();
} else if (ar[0] === false) {
ar.shift();
var port = null,
format_str = ar.shift();
} else if (ar[0] === true) {
ar.shift();
var port = Port.current_output,
format_str = ar.shift();
} else {
var port = ar.shift(),
format_str = ar.shift();
assert_port(port);
}
var str = format_str
.replace(/~[as]/g, function (matched) {
assert(ar.length > 0, "insufficient number of arguments", "format");
if (matched == "~a") return to_display(ar.shift());
else return to_write$1(ar.shift());
})
.replace(/~%/, "\n")
.replace(/~~/, "~");
if (port) {
port.put_string(str);
return undef;
} else {
return str;
}
});
//
// srfi-38 (write/ss)
//
const user_write_ss = function (ar) {
Console.puts(write_shared(ar[0]), true);
return undef;
};
define_libfunc("write/ss", 1, 2, user_write_ss);
define_libfunc("write-with-shared-structure", 1, 2, user_write_ss);
define_libfunc("write*", 1, 2, user_write_ss); //from Gauche(STklos)
//
// srfi-43 (vector library)
//
define_libfunc("vector-append", 2, null, function (ar) {
var vec = [];
return vec.concat.apply(vec, ar);
});
// (vector-copy vector)
define_libfunc("vector-copy", 1, 1, function (ar) {
assert_vector(ar[0]);
return clone(ar[0]);
});
//
// see src/library/node_functions.js for:
// - srfi-98 (get-environment-variable)
//
// Avoid circular dependency
nil.to_set = function () {
return new BiwaSet();
};
var BiwaScheme$1 = {
TopEnv,
CoreEnv,
nil,
undef,
max_trace_size,
suppress_deprecation_warning,
Version: VERSION$1,
VERSION: VERSION$1,
GitCommit,
isNil,
isUndef,
isBoolean,
isString,
isChar,
isSymbol,
isPort,
isPair,
isList,
isVector,
isHashtable,
isMutableHashtable,
isProcedure,
isSelfEvaluating,
eq,
eqv,
equal,
lt,
to_write: to_write$1,
to_display,
inspect,
write_ss: write_shared,
to_write_ss: write_shared, // For backward compatibility
Call,
Char,
Closure,
isClosure,
Compiler,
Enumeration,
isEnumSet,
Error: BiwaError,
Bug,
UserError,
Hashtable,
Interpreter,
Complex,
Rational,
isNumber: isNumber$1,
isComplex,
isReal,
isRational,
isInteger,
Pair,
List,
array_to_list,
deep_array_to_list,
Cons,
Parser,
Pause,
Port,
eof,
Promise: BiwaPromise,
isPromise,
Record,
isRecord,
isRecordTD,
isRecordCD,
Set: BiwaSet,
Symbol: BiwaSymbol,
Sym,
gensym,
Syntax,
Values: Values$1,
VMCode,
define_libfunc,
define_scmfunc,
parse_fraction,
is_valid_integer_notation,
parse_integer,
is_valid_float_notation,
parse_float,
};
Console.puts = function (str, no_newline) {
Port.current_output.put_string(str + (no_newline ? "" : "\n"));
};
Console.p = function (/*ARGS*/) {
Port.current_output.put_string(
"p> " + map(toArray(arguments), inspect).join(" ")
);
};
const current_input = new Port.CustomInput(function (callback) {
const out = document.querySelector("#bs-console");
const form = document.createElement("form");
form.innerHTML =
"<input id='webscheme-read-line' type='text'><input type='submit' value='ok'>";
out.appendChild(form);
form.addEventListener("submit", function () {
const input = document.querySelector("#webscheme-read-line").value;
form.remove();
callback(input);
return false;
});
});
const current_output = new Port.CustomOutput(function (str) {
const out = document.querySelector("#bs-console");
if (!out) return;
const span = document.createElement("span");
span.innerHTML = _escape(str)
.replace(/\n/g, "<br>")
.replace(/ /g, " ");
out.appendChild(span);
});
const current_error = current_output;
// To use webscheme_lib, jQuery must be loaded beforehand
const $$1 = window.jQuery;
define_libfunc("read-line", 0, 1, function (ar) {
var port = ar[0] || Port.current_input;
assert_port(port);
return port.get_string((str) => str);
});
//
// element
//
define_libfunc("element-empty!", 1, 1, function (ar) {
if ($$1(ar[0]).prop("value")) {
return $$1(ar[0]).val("");
} else {
return $$1(ar[0]).empty();
}
});
alias_libfunc("element-empty!", "element-clear!");
define_libfunc("element-visible?", 1, 1, function (ar) {
return $$1(ar[0]).is(":visible");
});
define_libfunc("element-toggle!", 1, 1, function (ar) {
return $$1(ar[0]).toggle();
});
define_libfunc("element-hide!", 1, 1, function (ar) {
return $$1(ar[0]).hide();
});
define_libfunc("element-show!", 1, 1, function (ar) {
return $$1(ar[0]).show();
});
define_libfunc("element-remove!", 1, 1, function (ar) {
return $$1(ar[0]).remove();
});
define_libfunc("element-update!", 2, 2, function (ar) {
return $$1(ar[0]).html(ar[1]);
});
define_libfunc("element-replace!", 2, 2, function (ar) {
return $$1(ar[0]).replaceWith(ar[1]);
});
define_libfunc("element-insert!", 2, 2, function (ar) {
return $$1(ar[0]).append(ar[1]);
});
define_libfunc("element-wrap!", 3, 3, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-ancestors", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-descendants", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-first-descendant", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-immediate-descendants", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-previous-sibling", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-next-sibling", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-siblings", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-match?", 2, 2, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-up", 3, 3, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-down", 3, 3, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-previous", 3, 3, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-next", 3, 3, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-select", 1, 1, function (ar) {
$$1(ar[0]).select();
});
define_libfunc("element-adjacent", 0, 0, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-identify", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-read-attribute", 2, 2, function (ar) {
assert_string(ar[1]);
return $$1(ar[0]).prop(ar[1]);
});
var element_write_attribute = function (ar) {
assert_string(ar[1]);
return $$1(ar[0]).prop(ar[1], ar[2]);
};
define_libfunc("element-write-attribute", 3, 3, function (ar) {
deprecate("element-write-attribute", "1.0", "element-write-attribute!");
return element_write_attribute(ar);
});
define_libfunc("element-write-attribute!", 3, 3, element_write_attribute);
define_libfunc("element-height", 1, 1, function (ar) {
return $$1(ar[0]).height();
});
define_libfunc("element-width", 1, 1, function (ar) {
return $$1(ar[0]).width();
});
define_libfunc("element-class-names", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-has-class-name?", 2, 2, function (ar) {
assert_string(ar[1]);
return $$1(ar[0]).hasClass(ar[1]);
});
var element_add_class_name = function (ar) {
assert_string(ar[1]);
return $$1(ar[0]).addClass(ar[1]);
};
define_libfunc("element-add-class-name", 2, 2, function (ar) {
deprecate("element-add-class-name", "1.0", "element-add-class-name!");
return element_add_class_name(ar);
});
define_libfunc("element-add-class-name!", 2, 2, element_add_class_name);
var element_remove_class_name = function (ar) {
assert_string(ar[1]);
return $$1(ar[0]).removeClass(ar[1]);
};
define_libfunc("element-remove-class-name", 2, 2, function (ar) {
deprecate("element-remove-class-name", "1.0", "element-remove-class-name!");
return element_remove_class_name(ar);
});
define_libfunc("element-remove-class-name!", 2, 2, element_remove_class_name);
var element_toggle_class_name = function (ar) {
assert_string(ar[1]);
return $$1(ar[0]).toggleClass(ar[1]);
};
define_libfunc("element-toggle-class-name", 2, 2, function (ar) {
deprecate("element-toggle-class-name", "1.0", "element-toggle-class-name!");
return element_toggle_class_name(ar);
});
define_libfunc("element-toggle-class-name!", 2, 2, element_toggle_class_name);
define_libfunc("element-clean-whitespace!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-empty?", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-descendant-of!", 2, 2, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("scroll-to-element!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-style", 2, 2, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-opacity", 2, 2, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-style-set!", 2, 2, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-opacity-set!", 2, 2, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-dimensions", 1, 1, function (ar) {
return new Values($$1(ar[0]).width(), $$1(ar[0]).height());
});
define_libfunc("element-make-positioned!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-undo-positioned!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-make-clipping!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-undo-clipping!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-cumulative-offset", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-positioned-offset", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-absolutize!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-relativize!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-cumulative-scroll-offset", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-offset-parent", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-viewport-offset", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-clone-position!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-absolutize!", 1, 1, function (ar) {
throw new Bug("not yet implemented");
});
define_libfunc("element-focus!", 1, 1, function (ar) {
return $$1(ar[0]).focus();
});
// usage:
// (element-new '(div "foo")) => <div>foo</div>
// (element-new '("div#main" "foo")) => <div id='main'>foo</div>
// (element-new '("div.red" "foo")) => <div class='red'>foo</div>
// (element-new '(div align "right" "foo")) => <div align='right'>foo</div>
// (element-new '(div (span "foo")) => <div><span>foo</span></div>
//
const create_elements_by_string = function (spec) {
spec = spec.to_array();
var name = spec.shift();
if (name instanceof BiwaSymbol) name = name.name;
var m = name.match(/(.*)\.(.*)/);
if (m) {
name = m[1];
spec.unshift(Sym("class"), m[2]);
}
m = name.match(/(.*)\#(.*)/);
if (m) {
name = m[1];
spec.unshift(Sym("id"), m[2]);
}
var children = [];
var s = ["<" + name];
for (var i = 0; i < spec.length; i++) {
if (spec[i] instanceof BiwaSymbol) {
s.push(" " + spec[i].name + '="' + spec[i + 1] + '"');
i++;
} else {
if (spec[i] instanceof Pair)
children.push(create_elements_by_string(spec[i]));
else children.push(spec[i]); // String
}
}
s.push(">");
s.push(children.join(""));
s.push("</" + name + ">");
return s.join("");
};
const tree_all = function (tree, pred) {
if (tree === nil) return true;
else if (pred(tree.car) === false) return false;
else return tree_all(tree.cdr, pred);
};
define_libfunc("element-new", 1, 1, function (ar) {
var string_or_symbol = function (item) {
return (
isString$1(item) || item instanceof BiwaSymbol || item instanceof Pair
);
};
if (tree_all(ar[0], string_or_symbol)) {
return $$1(create_elements_by_string(ar[0]))[0];
} else {
return nil;
}
});
const element_content = function (selector) {
if ($$1(selector).prop("value")) {
return $$1(selector).val();
} else {
return _escape($$1(selector).html());
}
};
define_libfunc("element-content", 1, 1, function (ar) {
return element_content(ar[0]);
});
//
// load from network
//
define_libfunc("load", 1, 1, function (ar, intp) {
var path = ar[0];
assert_string(path);
var intp2 = new Interpreter(intp);
return new Pause(function (pause) {
$$1.ajax(path, {
dataType: "text",
mimeType: "text/plain; charset=UTF-8", // For Firefox (#88)
success: function (data) {
// create new interpreter not to destroy current stack.
intp2.evaluate(data, function () {
return pause.resume(undef);
});
},
error: function () {
throw new Error("load: network error: failed to load " + path);
},
});
});
});
// Load javascript file on the server
const _require = function (src, check, proc) {
var script = $$1("<script/>", { src: src });
$$1("body").append(script);
var checker = new Function("return !!(" + check + ")");
if (checker()) proc();
else
setTimeout(function () {
checker() ? proc() : setTimeout(arguments.callee, 10);
}, 10);
};
// (js-load "lib/foo.js" "Foo")
define_libfunc("js-load", 2, 2, function (ar) {
var path = ar[0];
var check = ar[1];
assert_string(path);
assert_string(check);
return new Pause(function (pause) {
_require(path, "window." + check, function () {
pause.resume(undef);
});
});
});
//
// html modification
//
const getelem = function (ar) {
// account for getelem returning false when no results (and that getting passed back in)
if (ar.length > 1 && ar[1] === false) {
ar[1] = [];
}
var x = $$1.apply(this, ar);
if (x.length > 0) {
return x;
} else {
return false;
}
};
define_libfunc("$", 1, 2, getelem);
define_libfunc("getelem", 1, 2, getelem);
define_libfunc("dom-element", 1, 1, function (ar) {
return $$1(ar[0])[0];
});
define_libfunc("set-style!", 3, 3, function (ar) {
assert_string(ar[1]);
$$1(ar[0]).css(ar[1], ar[2]);
return undef;
});
define_libfunc("get-style", 2, 2, function (ar) {
assert_string(ar[1]);
return $$1(ar[0]).css(ar[1]);
});
define_libfunc("set-content!", 2, 2, function (ar) {
assert_string(ar[1]);
var str = ar[1].replace(/\n/g, "<br>").replace(/\t/g, " ");
$$1(ar[0]).html(str);
return undef;
});
define_libfunc("get-content", 1, 1, function (ar) {
return element_content(ar[0]);
});
//
// handlers
//
define_libfunc("set-handler!", 3, 3, function (ar, intp) {
throw new Error(
"set-handler! is obsolete, please use add-handler! instead"
);
});
define_libfunc("add-handler!", 3, 3, function (ar, intp) {
var selector = ar[0],
evtype = ar[1],
proc = ar[2];
var intp2 = new Interpreter(intp);
var handler = function (event) {
return clone(intp2).invoke_closure(proc, [event]);
};
$$1(selector).on(evtype, handler);
return handler;
});
define_libfunc("remove-handler!", 3, 3, function (ar, intp) {
var selector = ar[0],
evtype = ar[1],
handler = ar[2];
$$1(selector).off(evtype, handler);
return undef;
});
define_libfunc("wait-for", 2, 2, function (ar) {
var selector = ar[0],
evtype = ar[1];
var elem = $$1(selector);
elem.biwascheme_wait_for = elem.biwascheme_wait_for || {};
var prev_handler = elem.biwascheme_wait_for[evtype];
if (prev_handler) {
// Maybe a wait-for is called more than once,
// and previous handler is not consumed.
elem.off(evtype, prev_handler);
}
return new Pause(function (pause) {
var handler = function (event) {
elem.biwascheme_wait_for[evtype] = undefined;
elem.off(evtype, handler);
return pause.resume(event);
};
elem.biwascheme_wait_for[evtype] = handler;
elem.on(evtype, handler);
});
});
//
// dom
//
define_libfunc("domelem", 1, null, function (ar) {
throw new Error("obsolete");
});
define_libfunc("dom-remove-children!", 1, 1, function (ar) {
Console.puts(
"warning: dom-remove-children! is obsolete. use element-empty! instead"
);
$$1(ar[0]).empty();
return undef;
});
define_libfunc("dom-create-element", 1, 1, function (ar) {
throw new Error("obsolete");
});
define_libfunc("element-append-child!", 2, 2, function (ar) {
return $$1(ar[0]).append(ar[1]);
});
define_libfunc("dom-remove-child!", 2, 2, function (ar) {
throw new Error("obsolete");
});
// define_libfunc("dom-get-attribute", 2, 2, function(ar){
// });
// define_libfunc("dom-remove-child!", 2, 2, function(ar){
// });
//
// communication to server
//
define_libfunc("http-request", 1, 1, function (ar) {
var path = ar[0];
assert_string(path);
return new Pause(function (pause) {
$$1.get(
path,
function (data) {
pause.resume(data);
},
"text"
);
});
});
// (http-post "/foo" '(("x" . 1) ("y" . 2)))
define_libfunc("http-post", 2, 2, function (ar) {
var path = ar[0];
assert_string(path);
var alist = ar[1];
assert_list(alist);
var h = alist_to_js_obj(alist);
return new Pause(function (pause) {
$$1.post(
path,
h,
function (data) {
pause.resume(data);
},
"text"
);
});
});
const jsonp_receiver = [];
define_libfunc("receive-jsonp", 1, 1, function (ar) {
var url = ar[0];
assert_string(url);
var receives = jsonp_receiver;
for (var i = 0; i < receives.length; i++) if (receives[i] === null) break;
var receiver_id = i;
url += "?callback=BiwaScheme.jsonp_receiver[" + receiver_id + "]";
return new Pause(function (pause) {
receives[receiver_id] = function (data) {
pause.resume(data);
receives[receiver_id] = null;
};
var script = $$1("<script/>", { src: url });
$$1("body").append(script);
});
});
//
// dialog, debug
//
define_libfunc("alert", 1, 1, function (ar) {
alert(ar[0]);
return undef;
});
define_libfunc("confirm", 1, 1, function (ar) {
return confirm(ar[0]);
});
//
// Dumper - graphical state dumper
//
const Dumper = Class.create({
initialize: function (dumparea) {
this.dumparea = dumparea || $("#dumparea")[0] || null;
this.reset();
},
reset: function () {
if (this.dumparea) {
// Note: this is for repl.html (needs refactoring..)
$(this.dumparea).empty();
}
this.n_folds = 0;
this.closures = [];
this.n_dumps = 0;
this.cur = -1;
this.is_folded = true;
},
is_opc: function (obj) {
return obj instanceof Array && typeof obj[0] == "string";
},
dump_pad: " ",
dump_opc: function (obj, level, nested) {
var s = "";
var pad1 = "",
pad2 = "";
var level = level || 0;
var nested = nested || false;
times(
level,
bind(function () {
pad1 += this.dump_pad;
}, this)
);
times(
level + 1,
bind(function () {
pad2 += this.dump_pad;
}, this)
);
s += pad1 + '[<span class="dump_opecode">' + obj[0] + "</span>";
var i = 1;
while (!(obj[i] instanceof Array) && i < obj.length) {
if (obj[0] == "constant")
s +=
" <span class='dump_constant'>" +
this.dump_obj(obj[i]) +
"</span>";
else s += " " + this.dump_obj(obj[i]);
i++;
}
if (i < obj.length) s += "<br>\n";
for (; i < obj.length; i++) {
if (this.is_opc(obj[i])) {
s += this.dump_opc(
obj[i],
i == obj.length - 1 ? level : level + 1,
true
);
} else {
s += i == obj.length - 1 ? pad1 : pad2;
s += this.dump_obj(obj[i]);
}
if (i != obj.length - 1) s += "<br>\n";
}
s += "]";
return nested ? s : this.add_fold(s);
},
fold_limit: 20,
add_fold: function (s) {
var lines = s.split(/<br>/gim);
if (lines.length > this.fold_limit) {
var fold_btn =
" <span style='text-decoration:underline; color:blue; cursor:pointer;'" +
"onclick='BiwaScheme.Dumper.toggle_fold(" +
this.n_folds +
")'>more</span>";
var fold_start =
"<div style='display:none' class='fold" + this.n_folds + "'>";
var fold_end = "</div>";
this.n_folds++;
return [
lines.slice(0, this.fold_limit).join("<br>"),
fold_btn,
fold_start,
lines.slice(this.fold_limit).join("<br>"),
fold_end,
].join("");
} else {
return s;
}
},
stack_max_len: 80,
dump_stack: function (stk, size) {
if (stk === null || stk === undefined) return inspect(stk);
var s = "<table>";
// show the 'physical' stack top
if (stk.length == 0) {
s += "<tr><td class='dump_dead'>(stack is empty)</td></tr>";
} else if (size < stk.length) {
var l = stk.length - 1;
s +=
"<tr><td class='dump_dead'>[" +
l +
"]</td>" +
"<td class='dump_dead'>" +
truncate(this.dump_obj(stk[l]), this.stack_max_len) +
"</td></tr>";
}
// show the element in the stack
for (var i = size - 1; i >= 0; i--) {
s +=
"<tr><td class='dump_stknum'>[" +
i +
"]</td>" +
"<td>" +
truncate(this.dump_obj(stk[i]), this.stack_max_len) +
"</td></tr>";
}
return s + "</table>";
},
dump_object: function (obj) {
var a = [];
for (var k in obj) {
//if(this.prototype[k]) continue;
a.push(k.toString()); //+" => "+this[k].toString() );
}
return "#<Object{" + a.join(",") + "}>";
},
dump_closure: function (cls) {
if (!cls) return "**BROKEN**";
if (cls.length == 0) return "[]";
var cls_num = null;
for (var i = 0; i < this.closures.length; i++) {
if (this.closures[i] == cls) cls_num = i;
}
if (cls_num == null) {
cls_num = this.closures.length;
this.closures.push(cls);
}
var c = clone(cls);
var body = c.shift && c.shift();
return [
"c",
cls_num,
" <span class='dump_closure'>free vars :</span> ",
this.dump_obj(c),
" <span class='dump_closure'>body :</span> ",
truncate(this.dump_obj(body), 100),
].join("");
},
dump_obj: function (obj) {
if (obj && typeof obj.to_html == "function") return obj.to_html();
else {
var s = to_write$1(obj);
if (s == "[object Object]") s = this.dump_object(obj);
return _escape(s);
}
},
dump: function (obj) {
var s = "";
if (obj instanceof Object) {
s += "<table>";
// header
s +=
"<tr><td colspan='4'>" +
"<a href='#' class='header'>" +
"#" +
this.n_dumps +
"</a></td></tr>";
// registers
each(
keys(obj),
bind(function (key) {
var value = obj[key];
if (key != "x" && key != "stack") {
value =
key == "c" ? this.dump_closure(value) : this.dump_obj(value);
s +=
"<tr><td>" +
key +
": </td>" +
"<td colspan='3'>" +
value +
"</td></tr>";
}
}, this)
);
s +=
"<tr><td>x:</td><td>" +
(this.is_opc(obj["x"])
? this.dump_opc(obj["x"])
: this.dump_obj(obj["x"])) +
"</td>";
// stack
s +=
"<td style='border-left: 1px solid black'>stack:</td><td>" +
this.dump_stack(obj["stack"], obj["s"]) +
"</td></tr>";
s += "</table>";
} else {
s = _escape(inspect(obj)) + "<br>\n";
}
var dumpitem = $("<div/>", { class: "dump" + this.n_dumps });
dumpitem.html(s);
$(this.dumparea).append(dumpitem);
bind(function (n) {
$(".header", this.dump_el(this.n_dumps)).click(
bind(function () {
this.dump_move_to(n);
this.dump_fold();
}, this)
);
}, this)(this.n_dumps);
dumpitem.hide();
this.n_dumps++;
},
//
// UI
//
dump_el: function (n) {
return $(".dump" + n, this.dumparea);
},
dump_move_to: function (n) {
if (n < 0) n = this.n_dumps + n;
if (0 <= n && n <= this.n_dumps) {
this.dump_el(this.cur).hide();
this.cur = n;
this.dump_el(this.cur).show();
}
},
dump_move: function (dir) {
if (0 <= this.cur && this.cur < this.n_dumps)
this.dump_el(this.cur).hide();
if (0 <= this.cur + dir && this.cur + dir < this.n_dumps) this.cur += dir;
this.dump_el(this.cur).show();
},
dump_fold: function () {
for (var i = 0; i < this.n_dumps; i++)
if (i != this.cur) this.dump_el(i).hide();
this.is_folded = true;
},
dump_unfold: function () {
for (var i = 0; i < this.n_dumps; i++) this.dump_el(i).show();
this.is_folded = false;
},
dump_toggle_fold: function () {
if (this.is_folded) this.dump_unfold();
else this.dump_fold();
},
});
Dumper.toggle_fold = function (n) {
$(".fold" + n, this.dumparea).toggle();
};
//
// release_initializer.js - read user's program and eval it (if it exists)
//
const execute_user_program = function () {
const dumper = null;
const debug_area = document.querySelector("#biwascheme-debugger");
if (debug_area) {
dumper = new Dumper(debug_area);
}
// Error handler (show message to console div)
const onError = function (e, state) {
BiwaScheme.Port.current_error.put_string(e.message + "\n");
if (dumper) {
dumper.dump(state);
dumper.dump_move(1);
} else if (typeof console !== "undefined" && console.error) {
console.error(e.message);
} else {
throw e;
}
};
const run = function (script) {
const intp = new BiwaScheme.Interpreter(onError);
try {
intp.evaluate(script, function () {});
} catch (e) {
onError(e);
}
};
// Start user's program (old style)
let script = "";
for (const s of document.querySelectorAll("script[src$='biwascheme.js']")) {
script += s.innerHTML;
}
for (const s of document.querySelectorAll(
"script[src$='biwascheme-min.js']"
)) {
script += s.innerHTML;
}
if (script.length > 0) run(script);
// Start user's program (new style)
window.addEventListener("DOMContentLoaded", function () {
for (const s of document.querySelectorAll(
"script[type='text/biwascheme']"
)) {
run(s.innerHTML);
}
});
};
BiwaScheme$1.on_node = false;
BiwaScheme$1.Console = Console;
BiwaScheme$1.Port.current_input = current_input;
BiwaScheme$1.Port.current_output = current_output;
BiwaScheme$1.Port.current_error = current_error;
BiwaScheme$1.jsonp_receiver = jsonp_receiver;
BiwaScheme$1.Dumper = Dumper;
// TODO: ideally this should just be `window.BiwaScheme = BiwaScheme` but it will break test/spec.html (grep with `register_tests`)
window.BiwaScheme = window.BiwaScheme || {};
Object.assign(window.BiwaScheme, BiwaScheme$1);
execute_user_program();
return BiwaScheme$1;
})();
| 29.549712 | 157 | 0.534352 |
02024a2ca211d1c25adc6a3f23d0bf1a1f6fbcc3 | 5,045 | js | JavaScript | extensions/swfupload/handlers.js | dongnanyanhai/fnx103 | 8d678ddf123ecaa60d1fbefe1dd9a9379a2748b1 | [
"Apache-2.0"
] | 5 | 2015-06-06T09:38:25.000Z | 2017-02-15T14:53:42.000Z | extensions/swfupload/handlers.js | dongnanyanhai/fnx103 | 8d678ddf123ecaa60d1fbefe1dd9a9379a2748b1 | [
"Apache-2.0"
] | null | null | null | extensions/swfupload/handlers.js | dongnanyanhai/fnx103 | 8d678ddf123ecaa60d1fbefe1dd9a9379a2748b1 | [
"Apache-2.0"
] | null | null | null | function att_show(serverData,file)
{
var serverData = serverData.replace(/<div.*?<\/div>/g,'');
var data = serverData.split(',');
var id = data[0];
var src = data[1];
var ext = data[2];
var filename = data[3];
if(id == 0) {
alert(src)
return false;
}
if(ext == 1) {
var img = '<a href="javascript:;" onclick="javascript:att_cancel(this,'+id+',\'upload\')" class="on"><div class="icon"></div><img src="'+src+'" width="80" imgid="'+id+'" path="'+src+'" title="'+filename+'"/></a>';
} else {
var img = '<a href="javascript:;" onclick="javascript:att_cancel(this,'+id+',\'upload\')" class="on"><div class="icon"></div><img src="'+viewpath+'ext/'+ext+'.gif" width="80" imgid="'+id+'" path="'+src+'" title="'+filename+'"/></a>';
}
$('#fsUploadProgress').append('<li><div id="attachment_'+id+'" class="img-wrap"></div></li>');
$('#attachment_'+id).html(img);
$('#att-status').append('|'+src);
$('#att-name').append('|'+filename);
}
function att_insert(obj,id)
{
var uploadfile = $("#attachment_"+id+"> img").attr('path');
$('#att-status').append('|'+uploadfile);
}
function att_cancel(obj,id,source){
var src = $(obj).children("img").attr("path");
var filename = $(obj).children("img").attr("title");
if($(obj).hasClass('on')){
$(obj).removeClass("on");
var imgstr = $("#att-status").html();
var length = $("a[class='on']").children("img").length;
var strs = filenames = '';
for(var i=0;i<length;i++){
strs += '|'+$("a[class='on']").children("img").eq(i).attr('path');
filenames += '|'+$("a[class='on']").children("img").eq(i).attr('title');
}
$('#att-status').html(strs);
$('#att-name').html(filenames);
if(source=='upload') $('#att-status-del').append('|'+id);
} else {
$(obj).addClass("on");
$('#att-status').append('|'+src);
$('#att-name').append('|'+filename);
var imgstr_del = $("#att-status-del").html();
var imgstr_del_obj = $("a[class!='on']").children("img")
var length_del = imgstr_del_obj.length;
var strs_del='';
for(var i=0;i<length_del;i++){strs_del += '|'+imgstr_del_obj.eq(i).attr('imgid');}
if(source=='upload') $('#att-status-del').html(strs_del);
}
}
//swfupload functions
function fileDialogStart() {
/* I don't need to do anything here */
}
function fileQueued(file) {
if(file!= null){
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.toggleCancel(true, this);
} catch (ex) {
this.debug(ex);
}
}
}
function fileDialogComplete(numFilesSelected, numFilesQueued)
{
try {
if (this.getStats().files_queued > 0) {
document.getElementById(this.customSettings.cancelButtonId).disabled = false;
}
/* I want auto start and I can do that here */
//this.startUpload();
} catch (ex) {
this.debug(ex);
}
}
function uploadStart(file)
{
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setStatus(fc_lang[8]);
return true;
}
function uploadProgress(file, bytesLoaded, bytesTotal)
{
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setProgress(percent);
progress.setStatus(fc_lang[9]+"("+percent+" %)"+fc_lang[10]);
}
function uploadSuccess(file, serverData)
{
att_show(serverData,file);
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setComplete();
progress.setStatus(fc_lang[11]);
}
function uploadComplete(file)
{
if (this.getStats().files_queued > 0)
{
this.startUpload();
}
}
function uploadError(file, errorCode, message) {
var msg;
switch (errorCode)
{
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
msg = fc_lang[12] + "๏ผ" + message;
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
msg = fc_lang[12];
break;
case SWFUpload.UPLOAD_ERROR.IO_ERROR:
msg = fc_lang[13];
break;
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
msg = fc_lang[14];
break;
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
msg = fc_lang[15];
break;
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
msg = fc_lang[16];
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
msg = fc_lang[17];
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
msg = fc_lang[18]+swfu.settings.file_upload_limit;
break;
default:
msg = message;
break;
}
var progress = new FileProgress(file,this.customSettings.progressTarget);
progress.setError();
progress.setStatus(msg);
}
function fileQueueError(file, errorCode, message)
{
var errormsg;
switch (errorCode) {
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
errormsg = fc_lang[19];
break;
case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
errormsg = fc_lang[20];
break;
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
errormsg = fc_lang[21];
break;
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
errormsg = fc_lang[22];
default:
errormsg = fc_lang[23];
break;
}
var progress = new FileProgress('file',this.customSettings.progressTarget);
progress.setError();
progress.setStatus(errormsg);
}
| 28.828571 | 235 | 0.667592 |
02027aa4bcb7b01efda393ff52823c43967268bd | 762 | js | JavaScript | x_desktop_web/x_component_portal_SourceDesigner/Module/Package.js | fancylou/o2oa | e7ec39fc586fab3d38b62415ed06448e6a9d6e26 | [
"BSD-3-Clause"
] | 1 | 2019-10-05T03:47:23.000Z | 2019-10-05T03:47:23.000Z | x_desktop_web/x_component_portal_SourceDesigner/Module/Package.js | Mendeling/o2oa | afd053e465b54b1b21b8db558bffbd93e7923b79 | [
"BSD-3-Clause"
] | null | null | null | x_desktop_web/x_component_portal_SourceDesigner/Module/Package.js | Mendeling/o2oa | afd053e465b54b1b21b8db558bffbd93e7923b79 | [
"BSD-3-Clause"
] | null | null | null | MWF.xDesktop.requireApp("portal.PageDesigner", "Module.Package", null, false);
MWF.xApplication.portal.SourceDesigner = MWF.xApplication.portal.SourceDesigner || {};
MWF.xApplication.portal.SourceDesigner.Module = MWF.xApplication.portal.SourceDesigner.Module || {};
MWF.xApplication.portal.SourceDesigner.Module.Page = MWF.PSCPage = new Class({
Extends: MWF.PCPage,
options: {
"propertyPath": "/x_component_portal_SourceDesigner/Module/Page/page.html"
},
initializeBase: function(options){
this.setOptions(options);
this.path = "/x_component_portal_SourceDesigner/Module/Page/";
this.cssPath = "/x_component_portal_SourceDesigner/Module/Page/"+this.options.style+"/css.wcss";
this._loadCss();
}
}); | 44.823529 | 104 | 0.724409 |
020327d37afaac95742e3ea80514108ef2f3095d | 1,882 | js | JavaScript | Develop/index.js | Kammielatay/read-me-generator | 62522cdfde19f18bada56fbe890a604ddaad41ae | [
"MIT"
] | null | null | null | Develop/index.js | Kammielatay/read-me-generator | 62522cdfde19f18bada56fbe890a604ddaad41ae | [
"MIT"
] | null | null | null | Develop/index.js | Kammielatay/read-me-generator | 62522cdfde19f18bada56fbe890a604ddaad41ae | [
"MIT"
] | 1 | 2021-06-25T20:14:03.000Z | 2021-06-25T20:14:03.000Z | const inquirer = require('inquirer');
const fs = require('fs');
const generateMarkdown = require('./utils/generateMarkdown.js')
// array of questions for user
const questions = [
{
type: 'input',
name: 'title',
message: 'What is the title of your project?',
},
{
type: 'input',
name: 'description',
message: 'Add a brief description of the project?',
},
{
type: 'input',
name: 'installation',
message: 'What is the installation process? (clone URL)',
},
{
type: 'input',
name: 'install',
message: 'What command should be used to run depencencies?',
},
{
type: 'input',
name: 'demo',
message: 'Please enter your demo file name?',
},
{
type: 'list',
name: 'licenses',
message: 'What licenses are required for this project?',
choices: ["MIT", "Apache", "ISC", "Unlicense"]
},
{
type: 'input',
name: 'credit',
message: 'Who were the contributors?',
},
{
type: 'input',
name: 'tests',
message: 'What command line should be ran in order to run a test?',
},
{
type: 'input',
name: 'questions',
message: 'Where should people contact you for questions?',
},
{
type: 'input',
name: 'github',
message: 'What is your GitHub username?',
},
];
// function to write README file
function writeToFile(fileName, data) {
fs.writeFile(fileName, data, (err) =>
err ? console.log(err) : console.log('Success'))
}
// function to initialize program
function init() {
inquirer.prompt(questions).then(data =>
writeToFile('sampleReadME.md', generateMarkdown(data)));
}
// function call to initialize program
init();
| 20.021277 | 75 | 0.544102 |
0203571e3e9365d9dcfac4ac8d11d94b2229358f | 3,055 | js | JavaScript | script/tips.js | MHuiG/Karat-Django-Backend | 8887417bb3eee302a1639e247957539479d2ef67 | [
"MIT"
] | null | null | null | script/tips.js | MHuiG/Karat-Django-Backend | 8887417bb3eee302a1639e247957539479d2ef67 | [
"MIT"
] | null | null | null | script/tips.js | MHuiG/Karat-Django-Backend | 8887417bb3eee302a1639e247957539479d2ef67 | [
"MIT"
] | null | null | null | (function($){$.fn.initTips=function(option){var defaults={title:"",message:"",duration:5000,space:8,firstSpace:8,limit:4,margin:15,direction:'right bottom',timingFun:'ease',width:'auto',toastType:'info',type:'click',action:function(){},}
var options=$.extend(defaults,option);var firstDirection=direction(options.direction)[0].trim().toString();var lastDirection=direction(options.direction)[1].trim().toString();var minus="";if(firstDirection=='left'){minus="-";}else{minus="";}
if($('.ez_tips').size()==0||$('.ez_tips').size()<options.limit){var container="<div class='ez_tips "+options.toastType+"' style="+firstDirection+":"+options.margin+"px;transform:translateX("+minus+"110%)></div>"
var head="<div class='title clearfix'><i class='tips_icon_l fl'></i><i class='tips_icon_r close'></i></div>";var content="<div class='tips-message'></div>"
var newHead=$(head).append(options.title);var newContent=$(content).append(options.message)
var newContainer=$(container).append(newHead,newContent);setTimeout(function(){var timer;function timeOut(){$(newContainer).removeClass('active');setTimeout(function(){$(newContainer).remove();},700)};timer=setTimeout(timeOut,options.duration);var newTimes;var times=Date.now();$(newContainer).css({'transition-timing-function':options.timingFun,'width':options.width,});var height=$(newContainer).outerHeight(true);var len=$('.ez_tips').size();if(len>=2){for(var i=1;i<len;i++){if(!$('.ez_tips').hasClass('length1')){$(newContainer).css(lastDirection,options.firstSpace+'px');$(newContainer).addClass('active length1');break;}else if(!$('.ez_tips').hasClass('length'+(i+1))){$(newContainer).css(lastDirection,i*height+options.space*i+options.firstSpace+'px');$(newContainer).addClass('active length'+(i+1));break;}}}else{$(newContainer).css(lastDirection,options.firstSpace+'px');$(newContainer).addClass('active length1');}
$(newContainer).on('mouseenter',function(event){event.stopPropagation();$(newHead).find('.close').addClass('active');clearTimeout(timer);newTimes=Date.now()-times;});$(newContainer).on('mouseleave',function(event){event.stopPropagation();$(newHead).find('.close').removeClass('active');timer=setTimeout(timeOut,options.duration-newTimes);});$(newHead).find('.close').click(function(){$(newContainer).removeClass('active');setTimeout(function(){$(newContainer).remove();},700)});if(options.action){$(newContent).css('cursor','pointer').on(options.type,options.action);}},1);$(this).append(newContainer);}else{return;}
function direction(params){var index=params.indexOf(" ");var result=[];var firstDirection=params.substring(0,index);var lastDirection=params.substring(index);result.push(firstDirection,lastDirection);return result;}}})(jQuery);
Function.prototype.method = function (name, func) {this.prototype[name] = func;return this;};if (!String.prototype.trim) {String.method('trim', function () {return this.replace(/^\s+|\s+$/g, '');});String.method('ltrim', function () {return this.replace(/^\s+/g, '');});String.method('rtrim', function () { return this.replace(/\s+$/g, '');});} | 339.444444 | 925 | 0.730278 |
0203a533d924f70d3ec8d42f67229514ff2c889b | 1,252 | js | JavaScript | bin/bpm.js | bahamas10/node-bpm | 6100e5d357bb0352da71e9bb85ce27c86964698f | [
"MIT"
] | 9 | 2015-03-19T03:27:54.000Z | 2022-03-15T03:41:20.000Z | bin/bpm.js | bahamas10/node-bpm | 6100e5d357bb0352da71e9bb85ce27c86964698f | [
"MIT"
] | null | null | null | bin/bpm.js | bahamas10/node-bpm | 6100e5d357bb0352da71e9bb85ce27c86964698f | [
"MIT"
] | 2 | 2017-02-08T19:59:59.000Z | 2018-06-07T16:04:41.000Z | #!/usr/bin/env node
/**
* Calculate BPM on the command line
*
* Author: Dave Eddy <dave@daveeddy.com>
* License: MIT
*/
// Requires and such
var BPM = require('../'),
b = new BPM(),
path = require('path'),
util = require('util'),
keypress = require('keypress'),
version = require('../package.json').version,
args = process.argv.slice(2);
/**
* Usage
*
* return the usage message
*/
function usage() {
return util.format([
'Usage: %s',
'',
'Tap on the command line to calculate BPM',
'',
'Options',
' --help | -h: Print this help message and exit',
' --version | -v: Print the version number and exit',
''
].join('\n'), path.basename(process.argv[1]));
}
// Command line arguments
switch (args[0]) {
case '-h': case '--help':
console.log(usage());
process.exit(0);
break;
case '-v': case '--version':
console.log(version);
process.exit(0);
break;
}
keypress(process.stdin);
console.log('Tap when ready... ctrl-c to break');
process.stdin.on('keypress', function(c, key) {
if (key && key.ctrl && key.name == 'c') process.exit(0);
console.log(b.tap());
});
if (process.stdin.setRawMode) process.stdin.setRawMode(true);
process.stdin.resume();
| 21.586207 | 61 | 0.596645 |
020406d931142d0e756cd6224efd12261d329302 | 3,509 | js | JavaScript | src/helpers.js | deciob/d3-bar | 8ca222b6ca6dd1a014bd7103edb3ddf95e66fc11 | [
"BSD-3-Clause"
] | null | null | null | src/helpers.js | deciob/d3-bar | 8ca222b6ca6dd1a014bd7103edb3ddf95e66fc11 | [
"BSD-3-Clause"
] | null | null | null | src/helpers.js | deciob/d3-bar | 8ca222b6ca6dd1a014bd7103edb3ddf95e66fc11 | [
"BSD-3-Clause"
] | null | null | null | import {entries} from '../node_modules/d3-collection/index';
import {max} from '../node_modules/d3-array/index';
function inspect(x) {
return (typeof x === 'function') ? inspectFn(x) : inspectArgs(x);
}
function inspectFn(f) {
return (f.name) ? f.name : f.toString();
}
function inspectArgs(args) {
return args.reduce(function(acc, x){
return acc += inspect(x);
}, '(') + ')';
}
export function curry(fx) {
var arity = fx.length;
return function f1() {
var args = Array.prototype.slice.call(arguments, 0);
if (args.length >= arity) {
return fx.apply(null, args);
}
else {
var f2 = function f2() {
var args2 = Array.prototype.slice.call(arguments, 0);
return f1.apply(null, args.concat(args2));
}
f2.toString = function() {
return inspectFn(fx) + inspectArgs(args);
}
return f2;
}
};
}
// isObject :: a -> Bool
export function isObject(o) {
return Object.prototype.toString.call(o) === '[object Object]';
}
// clone :: Object -> Object
export function clone(obj) {
if (obj === null || typeof obj !== 'object') return obj;
var copy = obj.constructor();
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = clone(obj[attr]);
}
}
return copy;
}
// extend target with source, clone by default
// extend :: Object -> Object -> Object -> Object
export function extend(target, source, options) {
if (!isObject(target) || !isObject(source)) {
throw new Error('extend only accepts objects');
}
var useClone = (!options || options.useClone === undefined) ? true : options.useClone;
// notOverride (target) defaults to false.
var notOverride = (options && options.notOverride === undefined || !options) ?
false : options.notOverride;
var targetClone = useClone ? clone(target) : target;
for (var prop in source) {
if (notOverride) {
targetClone[prop] = targetClone[prop] ? targetClone[prop] : source[prop];
} else {
targetClone[prop] = source[prop];
}
}
return targetClone;
}
// For each attribute in `state` it sets a getter-setter function on `obj`.
// Accepts one level nested `state` objects.
// getset :: a -> a
export function getSet(obj, state) {
entries(state).forEach(function(o) {
obj[o.key] = function getSetCallback(x) {
if (!arguments.length) return state[o.key];
if (isObject(o.value)) {
state[o.key] = extend(o.value, x);
} else {
state[o.key] = x;
}
return obj;
};
});
return obj;
}
// getRange :: String -> Object -> Array
export function getRange(axes, config) {
var width = config.width - config.margin.left - config.margin.right;
var height = config.height - config.margin.top - config.margin.bottom;
if (axes === 'x') {
return config.invertOrientation ? [0, height] : [0, width];
} else if (axes = 'y') {
return config.invertOrientation ? [0, width] : [0, height];
}
}
function getContinousDomain(accessor, data) {
return [0, max(data, accessor)];
}
function getOrdinalDomain(accessor, data) {
return data.map(function(d) {
return accessor(d);
});
}
export function getDomain(scaleType, accessor, data) {
if (scaleType === 'continuous') {
return getContinousDomain(accessor, data);
} else if (scaleType === 'ordinal') {
return getOrdinalDomain(accessor, data);
}
}
var getRangeCurried = curry(getRange);
export var getXRange = getRangeCurried('x');
export var getYRange = getRangeCurried('y');
| 27.414063 | 88 | 0.635224 |
0204537da78622457f1b88c966478bad15a7a285 | 2,013 | js | JavaScript | www/res/nouislider-angular-master/nouislider2.min.js | aspirin1/hueLightComposer | 6e3f47ae4df40dc12fe004114446e97d7dfa0516 | [
"BSD-3-Clause"
] | null | null | null | www/res/nouislider-angular-master/nouislider2.min.js | aspirin1/hueLightComposer | 6e3f47ae4df40dc12fe004114446e97d7dfa0516 | [
"BSD-3-Clause"
] | null | null | null | www/res/nouislider-angular-master/nouislider2.min.js | aspirin1/hueLightComposer | 6e3f47ae4df40dc12fe004114446e97d7dfa0516 | [
"BSD-3-Clause"
] | null | null | null | "use strict";angular.module("ya.nouislider",[]).value("yaNoUiSliderConfig",{}).directive("yaNoUiSlider",["$timeout","yaNoUiSliderConfig",function(i,e){function n(i){return angular.isArray(i)?i.slice():i}function a(i,e){return angular.isArray(i)?i[0]===e[0]&&i[1]===e[1]:i===e}function r(i,e){for(var n=Object.keys(i),a=-1,r=n.length,t={};++a<r;){var o=n[a];o!==e&&(t[o]=i[o])}return t}return{restrict:"A",require:"yaNoUiSlider",scope:{yaNoUiSlider:"=",yaNoUiSliderDisabled:"=",yaNoUiSliderHandle1Disabled:"=",yaNoUiSliderHandle2Disabled:"=",yaNoUiSliderSlideDebounce:"@"},controller:["$scope","$element","$attrs",function(t,o,l){function d(i,e,n){e!==n&&(e?i.setAttribute("disabled",!0):i.removeAttribute("disabled"))}function c(){S.$destroy(),y.off("slide change update slide"),y.destroy(),i.cancel(U)}function u(){function r(i){var e=n(i);a(e,l)||(l=e,t.$applyAsync(function(){angular.isArray(i)?(t.yaNoUiSlider.start[0]=i[0],t.yaNoUiSlider.start[1]=i[1]):t.yaNoUiSlider.start=i}))}S=t.$new();var o=angular.extend({},e,t.yaNoUiSlider),l=n(o.start);o.start=n(o.start),noUiSlider.create($,o),f=$.getElementsByClassName("noUi-origin"),y=$.noUiSlider,S.$watch(function(){var i=t.yaNoUiSlider.start;return a(i,l)||(l=n(i),y.set(n(i))),l}),angular.forEach(v,function(e){y.on(e+".internal",function(n,a,t){"slide"===e&&b?(i.cancel(U),U=i(function(){r(t)},b)):r(t)})}),angular.forEach(g,function(i,e){y.on(e+".noUiSlider",function(){var e=arguments;t.$applyAsync(function(){i(e)})})}),S.$watch("yaNoUiSliderDisabled",d.bind(void 0,$)),S.$watch("yaNoUiSliderHandle1Disabled",d.bind(void 0,f[0])),S.$watch("yaNoUiSliderHandle2Disabled",d.bind(void 0,f[1]))}function s(){t.$watch(function(){return r(t.yaNoUiSlider,"start")},function(){y&&c(),u()},!0),t.$on("$destroy",c)}var y,f,S,U,N=this,$=o[0],g=t.$parent.$eval(l.yaNoUiSliderEvents),b=t.yaNoUiSliderSlideDebounce||0,v=b&&"Infinity"===b?["change"]:["change","slide"];N.getNoUiSlider=function(){return y};var h=t.$watch("yaNoUiSlider",function(i){i&&(h(),s())})}]}}]);
| 1,006.5 | 2,012 | 0.685047 |
02048952bde826961ed1efc286013ab658e738fc | 6,373 | js | JavaScript | public/javascript/sport/weekControl.js | QuilesVincent/maisonfit | 52672ba5ad3ef1108f6ef5b40b545639be4245f8 | [
"MIT"
] | null | null | null | public/javascript/sport/weekControl.js | QuilesVincent/maisonfit | 52672ba5ad3ef1108f6ef5b40b545639be4245f8 | [
"MIT"
] | null | null | null | public/javascript/sport/weekControl.js | QuilesVincent/maisonfit | 52672ba5ad3ef1108f6ef5b40b545639be4245f8 | [
"MIT"
] | null | null | null | /**
* Button to mean the week is done
* @type {HTMLCollectionOf<Element>}
*/
let buttonYes = document.getElementsByClassName("weekDoneYes");
/**
* Button to mean the week is not done
* @type {HTMLCollectionOf<Element>}
*/
let buttonNo = document.getElementsByClassName("weekNotDone");
/**
* The contener for the answer yes or no if the week's done
* @type {HTMLCollectionOf<Element>}
*/
let contenerInfoWeekDoneOrNot = document.getElementsByClassName("weekDoneContener");
/**
* The contener for the answer why the week doesn't done
* @type {HTMLCollectionOf<Element>}
*/
let contenerWhyWeekDontDone = document.getElementsByClassName("contenerWhyWeekDontDone");
/**
* The div for the answer holidays
* @type {HTMLCollectionOf<Element>}
*/
let answerWhyIsHolidays = document.getElementsByClassName("holidaysDiv");
/**
* The div for the answer maladie or fiest
* @type {HTMLCollectionOf<Element>}
*/
let answerWhyIsMaladieOrFiestal = document.getElementsByClassName("maladieOrFiesta");
/**
* The div for the answer motivation miss
* @type {HTMLCollectionOf<Element>}
*/
let answerWhyIsMotivationMiss = document.getElementsByClassName("motivationMiss");
/**
* The contener to show the astuce to purpose to do a detox after holidays
* @type {HTMLCollectionOf<Element>}
*/
let contenerAstuceAfterHolidays = document.getElementsByClassName("contenerAstuceAfterHolidays");
/**
*
* @type {HTMLCollectionOf<Element>}
*/
let buttonYesDetoxAfterHolidays = document.getElementsByClassName("buttonDetoxYes");
/**
*
* @type {HTMLCollectionOf<Element>}
*/
let buttonNotDetoxAfterHolidays = document.getElementsByClassName("buttonDetoxNot");
/**
* The contener to show the astuce to do a detox and proposition to push in the planning
* @type {HTMLCollectionOf<Element>}
*/
let contenerAstuceAfterMaladieOrFiesta = document.getElementsByClassName("contenerAstuceAfterMaladieOrFiesta");
/**
*
* @type {HTMLCollectionOf<Element>}
*/
let buttonYesDetoxProgrammationAfterMaladieOrFiesta = document.getElementsByClassName("buttonDetoxProgrammationYes");
/**
*
* @type {HTMLCollectionOf<Element>}
*/
let buttonNotDetoxProgrammationAfterMaladieOrFiesta = document.getElementsByClassName("buttonDetoxProgrammationNot");
/**
* The contener to offer the possibility to order directly the product
* @type {HTMLCollectionOf<Element>}
*/
let contenerPropositionBuyProductDetox = document.getElementsByClassName("contenerPropositionBuyProduct");
/**
*
* @type {HTMLCollectionOf<Element>}
*/
let butttonBuyDetoxProduct = document.getElementsByClassName("buttonBuyDetoxProduct");
/**
*
* @type {HTMLCollectionOf<Element>}
*/
let buttonDontBuyDetoxProduct = document.getElementsByClassName("buttonDontBuyDetoxProduct");
/**
* The contener to show where find smoothie detox in the application
* @type {HTMLCollectionOf<Element>}
*/
let contenerMessageToSayWhereFindSmoothieDetox = document.getElementsByClassName("messageToSayWhereFindSmoothieDetox");
/**
* The form contener to writte the informations by the user
* @type {HTMLCollectionOf<Element>}
*/
let formContener = document.getElementsByClassName("divForm");
/**
* if click on Yes
* add hidden to hidden the contener for the answer yes or no if the week''s done
* Remove hidden in the form to display him
*/
buttonYes[0].addEventListener("click", (e) => {
contenerInfoWeekDoneOrNot[0].classList.add("hidden");
formContener[0].classList.remove("hidden");
});
/**
* Post the information to change the date of the next control
* and redirect on the principal page
*/
buttonNo[0].addEventListener("click", (e) => {
getHttpRequest("http://localhost/code/blog-with-nutrition/public/index.php/sport/programme/weekControlChangeDate-javascript");
contenerInfoWeekDoneOrNot[0].classList.add("hidden");
contenerWhyWeekDontDone[0].classList.remove("hidden");
});
answerWhyIsHolidays[0].addEventListener("click", (e) => {
contenerWhyWeekDontDone[0].classList.add("hidden");
contenerAstuceAfterHolidays[0].classList.remove("hidden");
});
buttonYesDetoxAfterHolidays[0].addEventListener("click", (e) => {
contenerAstuceAfterHolidays[0].classList.add("hidden");
contenerAstuceAfterMaladieOrFiesta[0].classList.remove("hidden");
})
buttonNotDetoxAfterHolidays[0].addEventListener("click", (e) => {
contenerAstuceAfterHolidays[0].classList.add("hidden");
contenerMessageToSayWhereFindSmoothieDetox[0].classList.remove("hidden");
setTimeout(redirectOnTheHomePage(), 4000);
})
buttonNotDetoxProgrammationAfterMaladieOrFiesta[0].addEventListener("click", (e) => {
contenerAstuceAfterMaladieOrFiesta[0].classList.add("hidden");
contenerMessageToSayWhereFindSmoothieDetox[0].classList.remove("hidden");
setTimeout(redirectOnTheHomePage(), 4000);
});
buttonYesDetoxProgrammationAfterMaladieOrFiesta[0].addEventListener("click", (e) => {
contenerAstuceAfterMaladieOrFiesta[0].classList.add("hidden");
contenerPropositionBuyProductDetox[0].classList.remove("hidden");
});
butttonBuyDetoxProduct[0].addEventListener("click", (e) => {
alert("amener sur la page d'achat des produits et le laisser choisir 6 smoothie parmis les diffรฉrents produits");
})
buttonDontBuyDetoxProduct[0].addEventListener("click", (e) => {
contenerAstuceAfterMaladieOrFiesta[0].classList.add("hidden");
contenerMessageToSayWhereFindSmoothieDetox[0].classList.remove("hidden");
setTimeout(redirectOnTheHomePage(), 4000);
})
function redirectOnTheHomePage() {
windows.location = "http://localhost/code/blog-with-nutrition/public/index.php/sport/programme/programs";
}
/**
* Get information in the controller Symfony that search the information on the human in the JsonFile
* @param url
*/
function getHttpRequest(url) {
let xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.send();
xhr.onload = function () {
//Si le statut HTTP n'est pas 200...
if (xhr.status !== 200) {
//...On affiche le statut et le message correspondant
alert("Erreur " + xhr.status + " : " + xhr.statusText);
} else {
/**
* transform the string Json data in an array
* @type {any}
*/
let tablInformationPlanningObject = JSON.parse(xhr.responseText);
console.log(tablInformationPlanningObject);
}
};
}
| 33.719577 | 130 | 0.740154 |
0204debdbb271c428f1fbb0bdafc77d6e1440185 | 14,967 | js | JavaScript | packages/unpack-textureatlas/panel/index.js | zengmax/CocosCreatorPlugins | 88d1c25d3f42f13fa29ae945e3d343e172601214 | [
"MIT"
] | 3 | 2018-09-17T03:49:04.000Z | 2018-12-04T09:14:48.000Z | packages/unpack-textureatlas/panel/index.js | gsrkuang/CocosCreatorPlugins | 7475115a4e03707dd5858f3d2e4705b94b032544 | [
"MIT"
] | null | null | null | packages/unpack-textureatlas/panel/index.js | gsrkuang/CocosCreatorPlugins | 7475115a4e03707dd5858f3d2e4705b94b032544 | [
"MIT"
] | null | null | null | let packageName = "unpack-textureatlas";
let fs = require('fire-fs');
let path = require('fire-path');
let Electron = require('electron');
let fs_extra = require('fs-extra');
let Sharp = require(Editor.url('unpack://utils/sharp'));
const Del = require('del');
let co = Editor.require('packages://' + packageName + '/node_modules/co');
let item = Editor.require('packages://' + packageName + '/panel/item/item.js');
const Async = require('async');
let toFilePromise = function (sharpObj, savePath, callback) {
return new Promise(function (resolve, reject) {
sharpObj.toFile(savePath, function (error) {
if (error) {
console.log(error);
reject(error);
return;
}
callback && callback(error);
resolve();
})
})
};
let importPromise = function (path, url, isShowProcess, callBack) {
return new Promise(function (resolve, reject) {
Editor.assetdb.import(path, url, isShowProcess, function (err, results) {
if (err) {
console.log(err);
reject(err);
}
callBack && callBack(results);
resolve();
return results;
})
});
};
Editor.Panel.extend({
style: fs.readFileSync(Editor.url('packages://' + packageName + '/panel/index.css', 'utf8')) + "",
template: fs.readFileSync(Editor.url('packages://' + packageName + '/panel/index.html', 'utf8')) + "",
$: {
logTextArea: '#logTextArea',
},
ready() {
let logCtrl = this.$logTextArea;
let logListScrollToBottom = function () {
setTimeout(function () {
logCtrl.scrollTop = logCtrl.scrollHeight;
}, 10);
};
item.init();
window.plugin = new window.Vue({
el: this.shadowRoot,
created() {
this.onBtnClickRefreshProject();
},
init() {
},
data: {
logView: "",
itemArray: [
{uuid: "88a33018-0323-4c25-9b0c-c54f147f5dd8"},
],
},
methods: {
_addLog(str) {
let time = new Date();
// this.logView = "[" + time.toLocaleString() + "]: " + str + "\n" + this.logView;
this.logView += "[" + time.toLocaleString() + "]: " + str + "\n";
logListScrollToBottom();
},
onBtnClickTest() {
this.onBtnClickRefreshProject();
},
// ๅทๆฐ้กน็ฎplistๆไปถ
onBtnClickRefreshProject() {
Editor.assetdb.deepQuery(function (err, results) {
let num = 0;
results.forEach(function (result) {
if (result.extname === '.plist') {
// console.log(result);
num++;
}
});
console.log(num);
});
Editor.assetdb.queryAssets('db://assets/**\/*', ["sprite-atlas"], function (err, results) {
this.itemArray = [];
results.forEach(function (result) {
let ext = path.extname(result.path);
if (ext === '.plist') {
this.itemArray.push(result);
}
}.bind(this));
}.bind(this));
},
// ๆๅๆๆ็plist
onBtnClickDealAllPlist() {
this.splitPlist(this.itemArray);
},
// ๆๅๅไธชplist
onSplitItemPlist(data) {
this.splitPlist([data]);
},
splitPlist(dataArr) {
co(function* () {
for (let i = 0; i < dataArr.length; i++) {
let selectionUUid = dataArr[i].uuid;
let selectionMeta = Editor.remote.assetdb.loadMetaByUuid(selectionUUid);
let selectionUrl = Editor.remote.assetdb.uuidToUrl(selectionUUid);
let assetInfo = Editor.remote.assetdb.assetInfoByUuid(selectionUUid);
const textureAtlasPath = Editor.remote.assetdb.uuidToFspath(selectionMeta.rawTextureUuid);
if (!textureAtlasPath) {
console.log('ๅพ้็บน็ไธๅญๅจ๏ผ');
return;
}
let textureAtlasSubMetas = selectionMeta.getSubMetas();
if (assetInfo.type === 'sprite-atlas'
&& selectionMeta.type === 'Texture Packer'
&& textureAtlasSubMetas) {
let extractedImageSaveFolder = path.join(Editor.projectInfo.path, 'temp', path.basenameNoExt(textureAtlasPath) + '_unpack');
if (!fs.existsSync(extractedImageSaveFolder)) {
fs.mkdirsSync(extractedImageSaveFolder);
}
let spriteFrameNames = Object.keys(textureAtlasSubMetas);
for (let j = 0; j < spriteFrameNames.length; j++) {
let spriteFrameName = spriteFrameNames[j];
let spriteFrameObj = textureAtlasSubMetas[spriteFrameName];
let isRotated = spriteFrameObj.rotated;
let originalSize = cc.size(spriteFrameObj.rawWidth, spriteFrameObj.rawHeight);
let rect = cc.rect(spriteFrameObj.trimX, spriteFrameObj.trimY, spriteFrameObj.width, spriteFrameObj.height);
let offset = cc.p(spriteFrameObj.offsetX, spriteFrameObj.offsetY);
let trimmedLeft = offset.x + (originalSize.width - rect.width) / 2;
let trimmedRight = (originalSize.width - rect.width) / 2 - offset.x;
let trimmedTop = (originalSize.height - rect.height) / 2 - offset.y;
let trimmedBottom = offset.y + (originalSize.height - rect.height) / 2;
trimmedLeft = trimmedLeft <= 0 ? 0 : Math.floor(trimmedLeft);
trimmedBottom = trimmedBottom <= 0 ? 0 : Math.floor(trimmedBottom);
trimmedRight = trimmedRight <= 0 ? 0 : Math.floor(trimmedRight);
trimmedTop = trimmedTop <= 0 ? 0 : Math.floor(trimmedTop);
let sharpCallback = function (err) {
if (err) {
console.error('Generating ' + spriteFrameName + ' error occurs, details:' + err);
} else {
console.log(' ็ๆๆๅ๏ผ' + spriteFrameName);
}
};
// console.log("frame: " + spriteFrameName);
let extractedSmallPngSavePath = path.join(extractedImageSaveFolder, spriteFrameName);
if (isRotated) {
let img = Sharp(textureAtlasPath).extract({
left: rect.x,
top: rect.y,
width: rect.height,
height: rect.width
})
.background('rgba(0,0,0,0)')
.extend({
top: trimmedTop,
bottom: trimmedBottom,
left: trimmedLeft,
right: trimmedRight
})
.rotate(270);
yield toFilePromise(img, extractedSmallPngSavePath, sharpCallback);
// img.toFile(extractedSmallPngSavePath, sharpCallback);
} else {
let img = Sharp(textureAtlasPath).extract({
left: rect.x,
top: rect.y,
width: rect.width,
height: rect.height
})
.background('rgba(0,0,0,0)')
.extend({
top: trimmedTop,
bottom: trimmedBottom,
left: trimmedLeft,
right: trimmedRight
})
.rotate(0);
yield toFilePromise(img, extractedSmallPngSavePath, sharpCallback);
// img.toFile(extractedSmallPngSavePath, sharpCallback);
}
}
let curPlist = path.basenameNoExt(assetInfo.path);
this._addLog(`[${i + 1}/${dataArr.length}] (${curPlist}) ๅพ้ๆๅๆฐ้๏ผ ${spriteFrameNames.length}`);
yield importPromise([extractedImageSaveFolder], path.dirname(selectionUrl),
true, function (results) {
// console.log(results);
Del(extractedImageSaveFolder, {force: true});
this.onBtnClickRefreshProject();
}.bind(this));
} else {
console.log("ๆฒกๆ้ๆฉ่ตๆบ");
}
}
this._addLog("----- ๆๅๅฎๆ -----");
}.bind(this));
},
testFunc() {
let fileData = fs.readFileSync(data.path, 'utf-8');
let json = plist.parse(fileData);
console.log(json);
let pngFileName = json.metadata.textureFileName;
let relativePath = data.path.replace(/\\/g, '/');
let fileDir = path.dirname(relativePath);
let pngFilePath = path.join(fileDir, pngFileName);
if (!fs.existsSync(pngFilePath)) {
this._addLog("plistๅพ็ไธๅญๅจ๏ผ " + pngFilePath);
return;
}
// ่ฎพ็ฝฎๅญๆพ็ฎๅฝ
let saveDir = path.join(fileDir, path.basenameNoExt(data.path) + '_unpack');
if (!fs.existsSync(saveDir)) {
fs.mkdirSync(saveDir);
}
function decodeSizeString(str) {
let tmp = str.substring(1, str.length - 1);
let arr = tmp.split(',');
return arr;
}
function decodeFramesString(str) {
let ret = null;
let arr = decodeSizeString(str);
if (arr.length > 0) {
ret = decodeSizeString(arr[0]);
}
return ret;
}
for (let key in json.frames) {
let itemPngName = key;
// sourceSize
let itemPngSizeString = json.frames[key].sourceSize;
let itemPngSize = {width: 0, height: 0};
let size1 = itemPngSizeString.replace(/{/g, '[').replace(/}/g, ']');
size1 = JSON.parse(size1);
itemPngSize.width = size1[0];
itemPngSize.height = size1[1];
// frameSize
let itemPngFrameString = json.frames[key].frame;
let itemPngFrame = {x: 0, y: 0};
let size2 = itemPngFrameString.replace(/{/g, '[').replace(/}/g, ']');
size2 = JSON.parse(size2);
itemPngFrame.x = size2[0][0];
itemPngFrame.y = size2[0][1];
let rotated = json.frames[key].rotated;
let offset = json.frames[key].offset;
let smallPngSavePath = path.join(saveDir, itemPngName.replace(/\//g, '-'));
if (rotated) {
} else {
Sharp(pngFilePath).extract({
left: itemPngFrame.x,
top: itemPngFrame.y,
width: itemPngSize.width,
height: itemPngSize.height
})
// .background('rgba(0,0,0,0)')
// .extend({
// top: trimmedTop,
// bottom: trimmedBottom,
// left: trimmedLeft,
// right: trimmedRight
// })
.rotate(0)
.toFile(smallPngSavePath, function (err) {
if (err) {
console.log(err);
} else {
console.log("over: " + smallPngSavePath);
let dir
Editor.assetdb.refresh();
}
});
}
break;
}
}
}
});
}
}); | 47.971154 | 156 | 0.384646 |
020551565c3f1187e84915bc1220ce0e9a738c35 | 1,509 | js | JavaScript | www/src/components/navigation/Submenu.js | asamoal/plural | 5b336f27cb2d775560e35e5323192c42d62e72f5 | [
"Apache-2.0"
] | 59 | 2021-09-16T19:29:39.000Z | 2022-03-31T20:44:24.000Z | www/src/components/navigation/Submenu.js | svilenkov/plural | ac6c6cc15ac4b66a3b5e32ed4a7bee4d46d1f026 | [
"Apache-2.0"
] | 111 | 2021-08-15T09:56:37.000Z | 2022-03-31T23:59:32.000Z | www/src/components/navigation/Submenu.js | svilenkov/plural | ac6c6cc15ac4b66a3b5e32ed4a7bee4d46d1f026 | [
"Apache-2.0"
] | 4 | 2021-12-13T09:43:01.000Z | 2022-03-29T18:08:44.000Z | import { Box, Text } from 'grommet'
import React from 'react'
import { useState } from 'react'
import { useEffect } from 'react'
import { useContext } from 'react'
import { Portal } from 'react-portal'
import { useHistory } from 'react-router'
export const SubmenuContext = React.createContext({})
export function SubmenuPortal({children, name}) {
const {ref, setName} = useContext(SubmenuContext)
useEffect(() => setName(name), [name])
return (
<Portal node={ref}>
<Box pad={{vertical: 'xsmall'}}>
{children}
</Box>
</Portal>
)
}
export function Submenu() {
const {setRef} = useContext(SubmenuContext)
return <Box ref={setRef} flex={false} />
}
const ignore = (e) => { e.preventDefault(); e.stopPropagation(); }
export function SubmenuItem({icon, label, selected, url}) {
let history = useHistory()
return (
<Box background={selected ? 'sidebarHover' : null} focusIndicator={false}
hoverIndicator='sidebarHover' direction='row' align='center' gap='small'
pad={{right: 'small', vertical: '7px', left: '20px'}}
onClick={(e) => { ignore(e); history.push(url) }}>
{icon}
<Box fill='horizontal'>
<Text size='small'>{label}</Text>
</Box>
</Box>
)
}
export function NavigationContext({children}) {
const [ref, setRef] = useState(null)
const [name, setName] = useState('')
return (
<SubmenuContext.Provider value={{ref, setRef, name, setName}}>
{children}
</SubmenuContext.Provider>
)
} | 26.946429 | 78 | 0.640822 |
02065476d492b8e5c427951a41c7cc50ad9e0505 | 241 | js | JavaScript | src/dashboard/actions/redo.js | lit-dashboard/frc | f95a0cd6b2f014e6d7087224d50fa87e29834922 | [
"MIT"
] | 13 | 2020-05-01T06:43:04.000Z | 2022-03-03T16:05:59.000Z | src/dashboard/actions/redo.js | lit-dashboard/frc | f95a0cd6b2f014e6d7087224d50fa87e29834922 | [
"MIT"
] | 69 | 2020-05-08T13:17:02.000Z | 2022-02-26T23:16:48.000Z | src/dashboard/actions/redo.js | lit-dashboard/frc | f95a0cd6b2f014e6d7087224d50fa87e29834922 | [
"MIT"
] | 2 | 2021-01-14T21:51:48.000Z | 2022-01-31T18:59:33.000Z | import Action from '../action';
export default class Redo extends Action {
execute({ wom }) {
wom.history.goForward();
const layoutHtml = wom.history.getCurrentLayout();
wom.setHtml(layoutHtml);
wom.deselectNode();
};
} | 21.909091 | 54 | 0.672199 |
0206a3947fa2e4c2ec526756c3364cca0f9a0d67 | 162,343 | js | JavaScript | static/js/57.2476061da0b4e5e35db5.js | chris-mask/cgy-web | 93a4d6272cfe480693c8f072ba0ad76776751893 | [
"MIT"
] | null | null | null | static/js/57.2476061da0b4e5e35db5.js | chris-mask/cgy-web | 93a4d6272cfe480693c8f072ba0ad76776751893 | [
"MIT"
] | null | null | null | static/js/57.2476061da0b4e5e35db5.js | chris-mask/cgy-web | 93a4d6272cfe480693c8f072ba0ad76776751893 | [
"MIT"
] | null | null | null | webpackJsonp([57,130,132,133,134,135],{"8NX8":function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAAAcCAMAAAC6cQpEAAABEVBMVEUAAAAAqv8AgP8Av/8An/85xv8uuf8Aqv8zu/8wv/8ttP85uP8Aqv8zuP8xuv8xvf8wt/83uv8Aqv8Apv80uf81uv8Erf8Eqv81uv80u/83u/82uf8Dqv8DqP8Dq/8Dqf8Dqf82vP8Dp/81uv8DqP81u/8CqP8Cq/8Cqf81uf8Fqv83uv82uv82vP81uv82u/82uf81uv8Eqv82vP82u/82uv82u/83vP82u/8Fqf8Eqv83u/82u/82u/83uv83u/83u/82u/8Eqv8Eqf8Eqv8Eqf82u/83u/83u/8Fqf8Fqv83uv83u/82u/83uv8Hq/82u/8Eqv8Eqf83u/82u/82u/8Eqv83u/8Fqv8Hqv83u/9/tEGjAAAAWHRSTlMAAwQECAkLDA8QERIYGRofICUnKCwwOzw/QE9QV1hbXF9fYGBkZWdnaGpvb3Z6fX+EhoeJio2On6Gnq62vtLa7v8bLz8/T1dba39/f5Ofu7/Dz9/f4+vv8EKmNmAAAAX9JREFUSMfVlllTwkAQhFtcxQMPiAIqCCKSiAcaz+AN6xE8AxrH+f8/xAfABIXywU2q7Keu6oevard3ZoH/qbGdg+lQQOfMrf2JEEBvzMxPmyODcpGv2o5jW3nxRxC39bA21DfO2NSRnVECYr5Z+hlGTCJpaEJohiQyI0pAzFfp76FJbrHrDZdMRSDms7necyM3BVGuOU6tLJByKaMKxO/HM74e2FRETLavSMZgkC1UgZhfDye7UZ4kxHW3DFJA0rI6EPPL1mg7qpKBMn2pDIMslSDmx/VhAGiQhpoHqkGj50pbswBWfH6j4+cBLPp82vPcV7dxAE0SaHogB1H66OQLAC59/r7jVwEc+XzF8/1BfBoW6CSko7uLA7BI7y2DHlAZCiQhZE+9c4HUW9ik+x+sHtSDRZbcpDeCki5lgxlBgEmu3vV6gEMVEZOoXkpEo4lSPdA1AWS9xZcNcPEBEAWr4TgNKxfwKlcn/uVzokwXzK298RC+W1O72+F8IAfrE3TX9Eef5rMLAAAAAElFTkSuQmCC"},"8mNq":function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJEAAAA6CAYAAACwA7sOAAAABHNCSVQICAgIfAhkiAAAA31JREFUeF7tmctLlFEYxp/XRRG0cWGUi6A/oNbRP9A4WjR2BRdtsgg1u1ve84aYZTfLhYsWQmgXL2mXVSuXLorWEV0USgiCForOG8cIQs+XH3xnZnHOM8vhnPfw/N4fDwwjAKBverZiYXkQwB4ICs13/JDACgHFPIBpZLVS0vXfbVTkj0BL7yBSRGwk8B8Cn7C8sFPSrT9XnxF93TUEoIL4SGBdAqoDkmo4vVaiV52zgGxbdwAPkADwUVL1O2wSKemQQEwCKqmGAkoUkxaPWQlESdTBJqIxcQmopBotTfSSEsUlyHNQKbFK1M4moh1xCaiUNNmaiBLFJchzpolsEr1oYxPRjrgEVNLNliaiRHEB8hwQJdE1NhH1iEtAJd1iayJKFJcgz5kmskk01comoh1xCaiUtlqaaKqFEsVFGPw5VSlto0TBe5AIQJREk81sokRgQ7qsKmXtliaiRCFZkDBrpERNbKKEaMO5biTqsDTRc0oUjgRJk6rKPqtEjWyipGyDuW8k6rQ1ESUKxoHEQSMlamATJYYbygAjUZeliSYoUSgKJM+pKvutEtWziZLTDWiCTqJAa6Ws+8Pf0KITlCggA9xEVSxC0IeNi+2yt/eX6PhVNpEbtAFO0VkUZDOUKMDVu42sb0XHr7CJ3FINa5pijhKFtXL3aSV7QnSsjk3kHq3/ExUzgJySTPcMJfJ/3W4TKuYArcOBniERrBSQ6NhlNpFbzH5P25TdbH7W/xtSdJQS+b11l+lUJXPd8rfH6CU2kUvOXs8yEvVSIq93nPNwkRJdZBPlHL4vDxiJblia6Bkl8mXFuc+hKuVWiS6wiXJP35MXjEQ3bU1EiTzZcB5iREn09DybKA/4/XhCVQ72WZqIEvmx37ykiJToHJsoLwvw4REj0S1LEz05S4l82G9eMqjKoduUKC+svX0kUqJaNpG3S3cdzEh0x9ZElMg1an/nRUn0+AybyN+tO06mKofvWpqIEjkG7fO4SIlq2EQ+791pNiPRPUsTjVAip5y9HqYqR6wSVbOJvF68y3BGon5bE1Eil5j9nhUl0XDVVwiK/Q7PdE4IqH6Wo/e3r54lOlz1EMBxJ49wiN8EFINyrL9yrUQjNUXQpfeAbPGbANMlJPAFS7pLKh78WCOR+UIfVRdDlgcB7IZIYcLHeN0nAqrzgExjQ/aklA98s0X7DTKfazcW/yjxAAAAAElFTkSuQmCC"},B1DZ:function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOIAAACMCAYAAABh7nX9AAAWIElEQVR42u2dCXhUVZbHy0ZWURBQcaHZRGFoNmlAZB0R7O4B2XeUpbFBux1mbEVAegFFHLD7U9BWexGnbQaysgRCyELYslUiyL7KFlZZQxICZPnPOXn1UpVKJXmVSlW9W3X+33c+ksqr914l58e579xzz7VYRCIP9GQ0aveJR8e+iRjbNwFzesfji94JiO4VjxSyPc/F43jPOJzvEYcbz8Yhv0csCrrH4Wa3WFwiO/HTWOx6ZjPinolFSJfNWEY2p/NmTOy0Cb1bJKKh/IZFIid1zUDNfvHo2T8Rs/59C1b234LDZAX9EgCCEH1sRjCCIMRzNiMQ8azNCEh0jwW62YxARNfNwDM2IxDRmS0G6ETWYTNO/2QT1neIxu9/Eo1BBP4D8pcQBZ0GbEfH5xMxZ0AiYsly6Gs8vwUgEEEQoh+bF0HsyDCybQIISLQn+7do7G4fjffbReNZC3CP/JVEgSdy7Be3os/AbVg+aCsyB24FXkjUbABDaAIQbTCCQMTT0bjUdhM+pUjZT6AUKa+fJ6D1z7fhw59tQyaBCDYCEWYHsa3Nnt4IPLURZ9tsxJI2G9BO/qIiZUTPevf+YjtG/mIbYunfQgIRBCIUBhFtbPbkRqS02oipFkomyV9aZEq9mIxGg7fhj4N34Ox/bAcIxGILKBA3AK3JWm3AxZYb8LvHI9FY/vIicww/KeM4ZCcWDNmBrMEEIFugg2iDES2jkN1iAz58LApNxBNEftHoUNQYugOvv7QDl8kwxAZhkIGIFmTNCcjm6/H+E6GoK54h8pmGbceAYTuxj0AEW7CDaIMRP16PU82iMEw8RORVjUhC8xE7ET58JzDMBqGAWArEYnsiChsfWY+W4jGi6tUf8SMC8L8IxFyGUECsGMRmDOM63Hp0HeZavkRNcSCRxxq5DW1GJSF5JME3wgahgGgARLLH15GtR9ojEWglniSqskbtxIjRScgiECEgVhFEMoqMWY+sxVjxKJFb4kn5MUn4iCAsYggFRM9AfEyDEY+uxyc0zL9XPExUeUImFU8QgEkEIkbbIBQQqwnEtUDTNdh6v8w7iirSmBT0GpuCywyhgOglEMlomHrqwXXoKB4nKqNxyRhOljc2WYNQQPQqiHh4LXKaROAl8TxRicYnYwZZAYEIAdFnIOLhNUCTSMwUDxQxhHPHp6CI/oWA6HsQH1qLokaReFM8MYg1MQX/MyEFYAgFRD+ByFGRrPEamvwXBSGEqXiPQISAaBoQ0TgcvxHPDCJNSsVbkwhAAdFkIEYCDSMxWTw0CPRyKsYRiEUCojlBbLQG+Q9GYrB4agBrghV9CcQ7DKGAaFIQyQjE3AZr0FU8NgA1OQOtX0nFVQIRAqLpQeQh6qWGa9BCPDeANDoODSan4QCBCAFRDRDZGkQiw7ICdcSDA0SvpCCSIQwUEPmcM9KBhfuBRQeAz48DC+jreXu1z8PHBwKIDSOAB8LxjXhwIECYhjcm2yBUGcTXMoA1Z4FTOahU+UXA3uvAZ8foXrapDWIDsvsj8EvxZJUhTEXHKVbcVhVE/v6Dg8bgq0hJl4HpVnVBbBCOHEretBaPVlC8uctUK3ZNSQNUBPHN3Z4D6Kwtl7T7UQ3EBzRLk7WMCmpqKhZMJQhVA5G/DzsDryk3H5j9nZIg8hB1tni2QpqSgbYE4V3VQOTj+dnOF/r79+qBWD8CuXWkO5xC0dCKrQyhSiC+RO85nQuf6puTykVE3BeBGPFwNSCcNM0GoSog8vG+ioTO+vK4WiDWDwfqhUsTY1PrVxmo90srMlUDMeYC/Ko3vlULRLLvLaGoJR5vUk2zYiGBCJVA5Il4T7TvhpZ82XCu6ufIuqtNlygEIu4LxxzxeHNGwyYEYa5KIPJ7frjtGYh8v1zixiVv1+9U/TxR5xQDMQLXqPytoXi+yTQ9DUsYQpVA/N+Tng8rh++w15qev+XZufjzKRQRUS8CC8XzTaTxFA2n26KhKiDy8dn57oGy6xoQngkUFFUMIs8V/ukw8Jdj2tdGFX9RMRDDkGVZiQeFAJPo1QwsmG6DUBUQlxwyDgiDt/SwveibM50VgfjxEXvRN3+mKwaHv/mFWl2rMiCS1QnDPCHABBqdjLqvpuOyaiB+e804iFxv6rj6gifjKwIx5Ezp1Rf8uYxGRr6WSiDWDcd5yzLUFhL8HQ2teJ0MKoHIP79TaAyM6POll0G9S0udbhdW/ozIsDoug3r/gLHr7fhBMRDDiqPiVCHB39nSdOxVDcS3dhuD4laBdn4dxDl7Sj8fVpasWXGi9HrEwzeN1aKqBmLdUFiFBH9CmIreBCJUA3H5UWMgRmba1yPyNW7edT9rOjPdDuK8Pcauy0UGSoFIVjMSnYQI/80dfq0iiOvOGgPiP3fZQfzXqapNX6RftYPIc423Cyq/Lv+eVAOxdhiWCRF+0JRE1KF2EVkqgrjZYEkbzzXqIJY3R2hkHpHPo6/QP3Cj8uu+/Z16INJz4hUqe6shZPg6SfMtxjCEgQrihTx7qww+R3niz88g8mLi8jKjPDzVQTQSjefuURJE3BuKgUKGjzUjAyHBAiLfR3m6lKcNWw9mlX8MJ3mCAUQann4hZPhy7nA/aunDUhVBjDrnHohsnqi4X40NRCPF4fx7UxTESxbgHiHEV9HQip/NsEGoIohceubuM+KhrKpByMkZnn905xmR71tREFEzFN2FEB9pZgY+VhnE+XuNQfTfu+0gfna0aiBy/WhJ1jRea7VYGbi8al9VEGuFSSG47yJiOvarDCK/v6DIeFUNG/e04edBd8TX4HvWQTRSXZN2VcEJfUcQZXLfR9MWVjSliFikMohca7rPwBCRy+D4mnplDX/WWwXGQeRO4HplTVea3jhjoCfOJ0cUBzEM+ZYo1BNSvB8Nh3I6XnUQjT4ncnNgx1pTKnCvNDJyLer8faVrTT81eD2+R8UjIk9j9BNSvP98uDAQQOTzGS38/uJ46dUXXILGS6EynSIcL3eKyNSu47j6gn83+QaGwsmXFVuPWD6I0kbD23rtW4QHAoicEWVojIo3mnG1GxSfh++Fr+NqN6hfZxhfAsW/p0AAkSxMSPFAXWn7NCrVWkT2p04JeNzVMVN34SGC8EuyAtVB5Gu4s0p/2w/a9Yxsy8YZ0n+eNBYJWSlXlGseVRGIR4QmD9QjHtE9bI5Fdqt7HJa0j0Ejl8+KaehEAG5VGUS2z465OS9YqK3K4BEBR0hnEPleedh6+bZ72VW+7wACsZDqTusKUVUFMQ75DiBqFo9r5GTvtEh0vWElJS9GEoQnVAWRn/esV6s4WU9QHs/WVvtziZurZVJG9OFB5fqaVgYiCMRytv6mnU9rhGAyPUiG1QzBSfo3m42/JlvFPwv23VHLQFjaznaPp33yXFTYv3EMtQnAuWQ5KoLI5/N1u33HuUrVOn0bAbFGKEaVcTB6cWwxcKHFJTjlGx3DxwqIFdpBipDDXb2f1ic+SiB+TY2GC1Xb+4Lv5+od30K47ZK2X2IggkhB7m27Z9B+bvTCYh00+nr3j0Iw0/J/aFsc/djoa36Nf+Zw3OJg3AvOIIjaM1EckrttRt9yJv27EYTJqu0Gxffkq8gYe1GrPVVtExqjIBJHy0scQoeQ/s2vsRrTK3NEG5D5JTAKiEaAjKJsaweXQCZjAkGYqdL+iPx+buDkLXFihtstKro/ojsRMdw+HLVBSNZbf06k12bR9+n6MyJ/za/pz4d8rA5jsA1TqwKizQpouPp1lwQ0dz7nENqYhgBcODkNuSrtGMwNgt1tQFyZuHnUyynK7hjsLoiJGnC2Z8KSSBiKpo7DT2fjn/ExemTUnxmDKYHjAYh6Cv82Rcg/U1KnsfO5X96BHxOEq8iKVACRN4Xhc3Jbfk+B5BrT3+/TJvn5mTAYQKwZhj0WzoCWwGWLhPeGYF9lyZri4+2RsRjaGmGYKCC6abHIIiDf7eqi+Jfg6zUxFRkqgKgvDOb3LDqgNYIyWhbH5W4bKSNKJYHFE/z6esRgAZH4ybQUT1HQN8WJGRIPPSvNmNptllNUXCUgVjFCxuE8RcmZlkSnxBet4p6YjGkE4gUVQHQs+uafcwEDd+T+GzURXn1aW3XPkfNzKg54Z492v461pvoyqCAD8QqDVzwsLc6OatEt3SiIfGyxs9B7+Xs6+XVyqD+UZ503oYWjj9GwbLI7x1P0mFXR8VSt0dkJlqHuHE/f9zN6fHWD6ADkYfqcbZzBp5Yb9cenYL1KIDrXmpZX4iYgIttCw9C8YhD1Yabte4MgZtueKesXgxhasZP9NA79nUBJdOv4WJys6Hj6w05xKkNb4c7xDJvR470Fos1RXRYCj6b1jQJiQIKYLyCaEET6nKsExCACkRcIy9DUXENTskPd4tHK1dCUnhGjBMSAjIg5Fk6wFCdrwjCjyskaeq8ka7yXrCEAp6iYrBEQDYN4zVJjFaaUmb6oYA6xwumLEEwSEKt3+oLmEtNVmr4QEKsE4rlSE/p6VHRrQt8eDWVCv5om9MdZ0Uy1CX0B0aNa031aidtqjCspcYtAL8MlbnRsSYkbnUNK3DwvcZtsxQLVStwERI8j4laXRd8lkbGiom86Roq+q6/om1ZfjKfVF2dUKvoWEKsNxIjyl0GF0DKo1QRkKJ7m6QmbPc2v8c9kGVRwL4MSEL20DKpkYTAPU40uDA6y4Wh1LgyexAuD09RcGCwgenNhsKO4VQZnU7WpDXurjNCSVhmTpFWGZ60ypqchW8VWGQKij1pliAyDmO9iKqLS5lGvKt48SkD0QvOo1XhGiKoqiLGIdW6n2GEDHnR1LLdTpFaKyrRT5E5pP9DSpJWnjIH45m6HXaF2VT+Iu65p5+Z2jgEIYkGwjy49UrdENCWnWtwtDvO7xOIxV8e8oWiD4aM3Ncc/clNA9AGIh4QmL4sWuoao1nL/d/s0py8s0rbRFhC9DuJqIcXLei0Dc1UD8bvrmtPzv0afEd0F8Wa+b7q/ZVxVYBOaELwlpHgbxHS8oBKIvGKeIyF3T+N7dQTxo8Payvqv2U5otsJmMRfszh9DLS/+8b1mf3cwXqHPEY1BvJCnwWjU7hbadwjmDuGuLMuF8f4bpgcxDM8JKV7WtMO4n4and1UBUX82jLtYNmtqZLPSysSNpWRoWgrEu5Zo1BZSfPGcmI4kFUBcfFBzdt7ll+9DB/FEDjV2OqdlUEsi4snSEXGzc0Q8UXFEFBA1EGkh/U4hxEeaYcV7ZgeR36+30OcGT/o8IgOkJ27e+U6SNV7YunueEOIrEHehp9lB3HRec3R+dtMn9Pn8elKFN3/xRtb0D/u8k6RRBUSqVOsshPhKtMKeALxoVhDn2BI0rFTaAPSbU9rWaWdvaa/x3oV8Dm+CyNf3NFnj2NhYERAzBQ7fzyf+zawg8j2VJwZk7h7vzSPqIDJsng5N+fenFIih+FjI8LFoC7ZBZh6acnKFnwd5996lNE2RY4suPGR1nEc8f8uzjKmAaAexZI8Zke80mlZh/MqKSypM6K89qznzxTztPAKiV0A8z48sQoYfRAB+bHYQubyNh6P59Ez2eob3V18EK4i1w7FUiPDf8LSDmUHkzK4+JA0545tlUDqItwu1YfEXNvv8uLY3BttfjtkjsfWqBiPbp0c1W24zPZKrAGKt1WgnRPg3KiaZEUS+pp4l3X9Dg5CvuWC/5uQRmVpCxlsgBtX0RShShAR/R8U0TDAjiIez7E7ME/tcXeMsvpcPD1YdDoa6PBDzCrRaVraluh3SouONu6XPcyhLu4/FNvvAZv86pQaIdWgbRCHBz+pPXbwJxEyzgZhw0XVy5XyeFiG5tI2HpjqI/BzJPzdi+hylKxD58/CQlKOu8zMiX09fCaLPI/K5Cm3beTs/I/Lxy45qZmIQL1L7lFpCgglEEP7WbCD+drdWC8pbcM/fW36rDB1EBszo0FSfaHcFYnklbnzvvHOwXtWjJ2siM7XOAQwj/+egWolbnXC8KwSYRLwig0C8qmLPGl+A+BbVtOba3sO7CDtnTYfs0HYYLi4wv6CdTwUQ64bTzmmRZbu6i/woAnC+aiDyNbwJIp9v3Vn78JOf+cqbvuD7P51rr4/l35sCIC4WzzeZJqbiAT0qmhFEvo+PKFnyFVXcfJ+tJW/4a2+ByENjLiDQEzecfKlsHpEzuPrr+QTuqtPaNU0KYpZlpevGYiJ/R8U0zDYDiHxNTn7w+sJj2VoBtSvxfF51g8j3nHbVntA5maO95s6E/j9P2t/PGdZPjmhwmwnEerLcybyijUdrEYin/Q3ikkNloeNWGRyh+Bnsk6PaCg3HZ8Q7haUXBrN95WCOrTLuFJYFcTjdw5pM7Tp6VpTXQTLYVams4eTXhTz7/V+/o12bz+dvECkanpBV+GZP3Fgx0d8g8jm4ouZEtgYRDwtH7aw4WePJPCJfP8dhydLBLO2zeFrixlGW/0O47TAHajVB86i6Ea63XBCZTFOtSFAta8rO7lxitszBOIryEJGHvHkFZSPiogNaxOUJ/epeoc+VPxxdT+Vow2R/gkjRMEY8XBFNSUUbgvC2TF8EVquM+hHIrROKluLhKsGYhnmy90WA7X0RXt4OTyLTikvfCMR0ATEwQKRhaYqrncBECoi27G5PIOYJiGqDSJZdJwKtxKPVhvE1AVFtEO8Pw1Tx5ADQK2kIFRDVBJGGpSvEgwNEXP5GEB4UENUCkaKhVSbuA22ImoTWBOJVAVENEBtG4mLdVWgmnhuAejkZ/QjEOwKi6UG82XCNdOwOaE1KxvhJqSgSEM0JIkF4t0EkBoqnBkNkpFUaAqJJQQzHePHQYErgJGOxgGguECkazhTPDEYYU/CRgGgaEOeKRwaxCMT5AqIfQVyLoiaReFM8UWQZl4pfC4j+AZEi4W/EA0V2GJMwikDMExB9BmIuJWdGiOeJymhMCnqNScYVAdHLIK7D6YdknlBUkYaloAVBuFtA9BqI2+tH4yHxNFGlGp2MuqN3YqWAWL0gNl2H5RZaJyoeJnJLo3bgFYIwW0D0DESC8CY9F04QjxJVfahKxeIjk2AVEKsI4nqkPSKLekXVIW67QTC+TyAWCIgGQVyHW/RMOMfyJWqKB4mqNzpuR3dq5JsmIFYMIkXD6Ecj0Fw8RuQ9AfcQeNMIxHMCohOIUThF0XCoOInIZ+pJmdWXtmP20O24EuwgEoQ5zaKwsEUi6ohniPyiF+LQYPAOvEd7DGYFIYg3CcQPHpc9CkVm0YB4NCYAFxGI1wIdRILwQssNmPdEDBrJX15kSg3ajPsIwFlkBwMQxLRWG6m1oexZL1JJBGEXgnApWabCIF4m+/OTMWgvf1GR8pnWQQno++I2fEoQnlUAxGttN+CvT23AC9LmXhSwGpiIzgThuwThlgFbccsUIMbgYLtNWNJuI/oKfKLgG75SA10CsB/Z7P4JCCMQT3obRILwIkG4mSD8oH00hjyViCbylxCJnNSREj794tGtTzwm9YnD270TsJjsq+cSENUzAakE4nEC8RJBmN0jFoUEYSEBmNMtDpcJwtME4Z6usUgkCMO7xOBzAnAegTiZzvs82cPB8nv8f8ADSa2bF5nXAAAAAElFTkSuQmCC"},Ea42:function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHEAAABGCAYAAAD7AXvFAAAABHNCSVQICAgIfAhkiAAADFJJREFUeF7tnQl0VOUVgL87kwERBUUQPWIFDsp6KvsmVCNLWRWIIBXbUhWPe9kRIjqyKYqAWnGpRVApJUggECBBBauAILJWQEABLS1QFhEtW5K5Pf+8DJkkk+TNZCbJTPqfk8Phvfvf/777vfu/f7nvjfD/EtADmvb8zcBtiKc2SA2gBqrVEWqAVAcVkJOgJ4FjqHwLfINDd5MlO6T72IMl5VopqYaioR1d9VxfPPRHtDvIFcWzWY+CrEdZTcXz70u8+1Tx9BVcu9xD1LTn6iGeUSCDgMqRcjRKMsifpdvYtHC3UW4h6oeT2pLlGIXQL9xOLVyf7kZxS7fEpHC1W+4gatrkeJBngY7hcmJIelR34JRHpOu4dSHV96tUbiDqMveluFwvAw8U12lhrK/AXOJkpHQedyJUveUCoqZPaYN65oPUCdVREa53AmWQdE9MD6WdmIeo6ZNGokwBXKE4qATrKOgLnK6fKAMGZAXTbkxD1JWTkoG+wTik1GVVV5GV1Vd6u8/YtSUmIeraqZfz0/l0kHZ2HVGm5JRt4OwqPcYds2NXzEH0Ajx9/u+INLPjgDIro7qfCs720jnxaFE2xhRE3emuwPfOj4EORV14VJxXvqJKhfbSYcxPhdkbWxCXT1iAMCAqANk2UtdKj2cKndPGDERdPuEphIm2fVMcwctrgusSOH0EMs8XR5O9uqozpOczwwsSjgmIutzdC5Fl9jwSglRcRajdFmrWhyrX5FaQeQ6OfA3/2g4nvwtBuc0qqt2lpzvgumvUQ9Q0dzU88rV3qygSpXYbuPFWiLukaO2HtsHu9EhF5wlwNQw0Yo1+iKnu9xHMDkT4yy/7QC2zrRhEMV3sjhSrqw13UeZJL/e9edVGNURNndAR8Xwabl959YUC0GeIAbhhLpiuNtxF6SK93B/5q41yiO51CO3D7SdqNoAWdxes9ugeMF1nYTKHtsOOJWE3DdgrPd31YwKirnT3wKPLI+El4odCpQAb+ybCzMBm3yfWXw83nM3esA8kv/aNCHWrkiC93GZJ0VuiNhI19ZnIRGG12tB2cP57Y1caHNxgnTtxMAfihjkWKHM878jVRGtEolE3Sc8JraMaoi51N8fh2RyRKGzUHeq0za366Nfw5Xyo1RRu7msB3LsGej5rReLn70DGOeg0LPco1pxbPSMiZuLQDtJjondDOSojUVPHvweSb5QWFm+1+wOYaPQvn71uQbp9mHXUH6L5/4kDYCLSADag/cvyZ8JiVj4lqm9L74lDohKirnFfwn+zfgBsTNxC8F+7+/JDXP403BQPN8ZbCg98DrtWQs8JOQ2kT4FrGlogc90AsyL0XORnLnPWkHj3uaiLRF2WOAhxvB8CHntV7EA0mk4fhirX5uj8bJa1FNf2vtztrJ6eM/ixZ0EQUp4B0mvywuiDuHT8EoQ7g7jS4ERb3gPXNMhdJ20KVK8N5lygYuaDRsZEq/nzL6lPB9d+cNKzpffE+6MQYuJpRC4P7lqDkK7TDhr3yF1h5wqrC213P1yV53lpJLclw6Gt0GlE7qmJGbV++loQjQct+q30nlQvqiDqirGNyHLuDPpSg6lg5nsGhn8xgxoDw/zbpAfUyt5vNqNPA/jIbigMfjDtByvribuuTENs9ZHWdcBlGzvLDnNtujyxJR7Mpm+VYK81KPmmCTmgfBXP/mBFnBmJ5i112uePXtPFfjQtMktv/u0rd5VpiG1W6QmEagppIozY2Fl2eXctLlyYgsoQBEdQcOwKm2i87bHAOxdHdsGPhy1NrkrWiPTSK/Nr3jTPitBIF9WncyD+TW9yORmnyq+9d72yMkuZzEDv2z6lUtp8qCa51ltU8YgwLxOe2txFvtelYxqjjjcRuSUixpmR562PhaZ6/3rYGZkVwfwG6XwLYpI2ckGKOhmceZ5vzKG4OG4UeDfDQzcGyt7QrqZ4tfwh+sG8IPBGpofnN3eTw5rypJlyTAWuK15rAWobkLc8YG8v0Vd972rYY3r8EirKl0KS1ndBaoaLVq4MZij0ETCrv3MyXAxzXWBrRhydSJD9JWTWxWYCQfSz4awqr15w8dxWnj3HzxfGoYwK+yKA2Qxu0hOub1745ZtnpYEX6JkZSccp34prgc5VD2/jZISQZ/6lzFXhHRF+l9Ff7o+kLYF0FwHR6mbhlMLUuMq8vP7UmKu44JiJSELYbTUwr20E1evmfgYe3w+Hd1mT/9IpxyQuSQ9nQjMX5LPCOCgTGrpgR/MruTi09yhzN3WVOa1W6WCH8PuLtivbN3aVoYUcb+oQclaEc+QDHrcD0c9vKRu7SB8v2KVjuqOOFaXj0xJuVfVsURB/zIQGBmKzK9h18bkEc3wQBS7u2whs80Es4HhTgZk+PX7yAY+HDDHlyW7AyhJ2Z6k1J84FOltgDsLwgN2phzkq3Js1UEr8lTA7EPN1pxmO6UD/UvNoiTesx83App4LVmW4aB6XwRzzsQGBqihzMyow1HWBHRlxdCRBIpiPF/jKgxrYnDrzJDAakUol7sfSbFDZb00xzBxRSFdhcCbsMYfismggDt7NUOJLa65ob4oxehAqkZlilCYcu20rm3Mm+4u0rjOTRBG6m/oCKzKcTCyNCPTZX+Rk36NvQoQm+3adWNpySlKZXnZr/aGeMl27QjpOxnxxu2zXtGHVOBcX2WW30gYTTPvCxDINMd8C+OIRLcCxGiT8C+C3DIErakGgdIo+U2HrB/DdpqLd27i7lfIfqbSMvBaIZ1CZhpjXXk0ZXR+PmpT98JYbWkGz/rBktKXXpF2YXfrCitk/9G1JBWONr41g6hQmm8VNUQXRXIsuHnnM+ixXGIuBZvJofDC3LswddX1egLzHCmrebCh7IzGiO/pW68oh6ffi9dEHMXlkMhLG9/C7jsu9jHZsH6x7KzeiPi9mQ/wiPzpzzk758d+wJszpiybjrd9LQ6IP4uIRv0Hlr3b8FpSMLx3R5ImaXJrrC3lb3IBemw2674uwxURuNmATiWaXP3V8TvMdHoQKlSORg9pH+k1LiT6IScMq4XScCOuk3psc1TC34+3eAaUGUU/xi5+ulpZvZUQdRO+jYNHweYgUkHpm1/vZcje0huYDrIxuX6baliTrWEHFyPo2fftOs9eg6U5N+mK4iurrkjD9EaMuOiEuGdkGj24Iiz+8XWdzOPMDpE+2VPrALh6Zv4lek6zMt0A794175twIJqkq9amwmBhQiWo7SZju9UFUQvRG4wfDtyBE5jMntU103g3JebLeTMO9J8OB9fBVnvSLbtnAzNTDJE79I8XSYXb688oWH+0GSZh+8Rs90Qtx0fA7gJTi+yNbQ6fhUDU7w+OfW6zotAPRwDOJUj5YJgvAQFyWaCn2nd+yAA4GGN2GdAHaRRJmXHzRNGohWs/GYZ8DeV5hCtIr3cZbEAy4TdlvB5j39E0UFfhMXG0lCRvQXnipOZJNemVDHJe7du8p1gJCcoEfwbBpuK6ThJm5vtMT3RCTn+iAOj+zefX2xXwQAzncwPB2p37g/DUXBNF+60VIagtJmLnFXyiqIVrPxmFmQzsnRSRsziqTiv4iCTPybc5HP8SkMVWRc3sQqVkm3R4uo5TjOOMaS79p/8mrMuoheqMx+YlueByxnVPj8XSUAa+sDXRPxAREq1t9IhFkUrhu/DKlR3lU+r88qyCbYgaiF+TCPyYhsZYkpbPlrlcKzfmNLYhJ7gpw8mMkVj6Vqeuoez7erI8W1jPEFERvNCY9WBWpuA6kcZnqEoM3Zj/OrNbS77Uiv9IfcxAvgqTiSiRKPx+N7kSJlwGvls/PR/vf8Lrw8UVQ0r9AE3zI5a6hn1DhzB1y5+xCvzYcU5P9olymCx8fimLyUisUJVu651VRXuLq6mMl3p0ZjC0x2Z3mdYAmPdwCnAuBMvrjJnoC9F4ZMCukHwMrFxC9z8llD17KWdc0kIeDucsjK+t9E3oucYy0M4ApF/NEOw7XBY/+CtSNSJ4PztipHUYZZTvqeUgGvl7sze1yE4n5utj5j7VEPGMRKdmf3lP9CnG45e4/mUFXWEq5hejzniY9Ug+PjEL0HpDLwuLVQEpUU3DwRqjPvXI12S8OBE16qC/q6I/SHuGG4uiyfmtYzKcs15CV+Z7c89bx4ukruHa5j8SCXKPv/rYyripNEE8jhEZAQ5RaCNVBfF/qOOKFpZjtoQMI+xDZh0d2yMDXSuyLI/8DyYNtUgTc6cwAAAAASUVORK5CYII="},L1UP:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=n("mvHQ"),s=n.n(r),i=n("bOdI"),a=n.n(i),l=n("fksm"),c=n("c8+v"),d=n("Q5rI"),A=n("tZro"),m=n("jlNU"),p=(n("/jS7"),n("gu65")),f=n("MdFA"),C=(n("kvU2"),{data:function(){var e;return e={closePro:!1,orderId:"",isCheck:!1,endProcess:!1,batchNoList:[{label:"ๆชๆๅฎ",value:0},{label:"็ฌฌไธๆน",value:1},{label:"็ฌฌไบๆน",value:2},{label:"็ฌฌไธๆน",value:3},{label:"็ฌฌๅๆน",value:4},{label:"็ฌฌไบๆน",value:5}],projectPersonList:[],patentPersonList:[],auditPersonList:[],roleUserList:[],deptUserList:[],orderForm:{},processialogVisible:!1,reviewForm:{},recheckLoading:!1,rules:{},fileList:[],firstFlow:[{userName:""}],lastFlow:[],commentDialog:!1,commentList:[],addCommentForm:{},fileCommentList:[],commentIdList:[],holdProcessList:[],flowList:[],rolesList:[],uploadFileModal:!1,activeSelectProjectModal:"",selectProjectModalData:[],collectDataList:[],uploadAnnexParams:{materialTypeName:"",materialDesc:"",fileIds:[]},annexFilesList:[],anFilesList:[],isOtherFile:"",activeJiBa:0,annexTypeData:[],curData:"",isFileClick:!1,annexRule:{materialType:[{required:!0,message:"่ฏท้ๆฉ็ฑปๅๅ็งฐ",trigger:"blur"}]},userFlowList:[],personList:[],checkOrderIds:[],assignForm:{},personId:"",applyNumTotal:0,personNum:0,personDialogVisible:!1,sendBackDialog:!1,sendBackForm:{},openOrCloseHistory:!1,userId:"",allowDetail:this.authorityControl("SYSTEM:DECLARE:SYNERGY","SYSTEM:DECLARE:ORDER:MANAGE","SYSTEM:DECLARE:ORDER:DETAILS"),allowUpdate:this.authorityControl("SYSTEM:DECLARE:SYNERGY","SYSTEM:DECLARE:ORDER:MANAGE","SYSTEM:DECLARE:ORDER:UPDATE"),allowFlowReview:this.authorityControl("SYSTEM:DECLARE:SYNERGY","SYSTEM:DECLARE:ORDER:MANAGE","SYSTEM:DECLARE:ORDER:FLOW:REVIEW"),allowFlowComplete:this.authorityControl("SYSTEM:DECLARE:SYNERGY","SYSTEM:DECLARE:ORDER:MANAGE","SYSTEM:DECLARE:ORDER:FLOW:COMPLETE"),allowProcessReview:this.authorityControl("SYSTEM:DECLARE:SYNERGY","SYSTEM:DECLARE:ORDER:MANAGE","SYSTEM:DECLARE:ORDER:PROCESS:REVIEW"),allowBatchassignOrder:this.authorityControl("SYSTEM:DECLARE:SYNERGY","SYSTEM:DECLARE:ORDER:MANAGE","SYSTEM:DECLARE:ORDER:BATCHASSIGNORDERENGINEER"),allowOrderCheckInfo:this.authorityControl("SYSTEM:DECLARE:SYNERGY","SYSTEM:DECLARE:ORDER:MANAGE","SYSTEM:DECLARE:ORDER:CHECK:INFO"),upload_url:"/core/upload-files-api/",uploadData:{save_path:"enterprise_info/enterprise_chat/"}},a()(e,"fileList",[]),a()(e,"ConnectContentDialogVisible",!1),a()(e,"connectList",[]),a()(e,"connectListQuery",{page:0,pageSize:20}),a()(e,"connectTotal",0),a()(e,"connectContentForm",{}),a()(e,"toUserId",0),a()(e,"toUserName",""),a()(e,"toCompanyId",0),a()(e,"fromcompanyId",0),a()(e,"searchForm",{companyId:"",page:0,pageSize:10,labelValue:1}),a()(e,"chatData",[]),a()(e,"isShowMoreNews",!0),a()(e,"chatContent",""),a()(e,"fileTemp",[]),e},filters:{titleSize:function(e){return e.substring(0,1)}},activated:function(){this.orderId=this.$route.query.orderId,this.isCheck=this.$route.query.isCheck,this.userId=this.$store.getters.userId,this.getDetail(),this.changeOrderRead(),this.getDictData()},methods:(o={handleShowConnectContentListPeople:function(e,t){var n=this,o=new FormData;switch(t){case 0:o.append("roleNameList","ไธๅกๅ,ไธๅกไธป็ฎก");break;case 1:o.append("roleNameList","้กน็ฎไธป็ฎก,้กน็ฎๅ");break;case 2:o.append("roleNameList","ไธๅฉๅ,ไธๅฉไธป็ฎก");break;case 3:o.append("roleNameList","ๅฎก่ฎกๅ")}Object(c.D)(o).then(function(e){200==e.code?n.personList=e.data:n.$message.warning(e.message)}).then(function(){switch(t){case 0:if(void 0==e.signUserName)return;var o=n.personList.findIndex(function(t){return t.userName==e.signUserName});n.toUserId=n.personList[o].userId,n.toUserName=e.signUserName;break;case 1:if(void 0==e.userName)return;o=n.personList.findIndex(function(t){return t.userName==e.userName});n.toUserName=e.userName,n.toUserId=n.personList[o].userId;break;case 2:case 3:if(void 0==e.userName)return;o=n.personList.findIndex(function(t){return t.userName==e.userName});n.toUserId=n.personList[o].userId,n.toUserName=e.userName}n.ConnectContentDialogVisible=!0,n.searchForm.companyId=n.$store.getters.companyId,n.isShowMoreNews=!0,n.getConnectList()})},getConnectList:function(){var e=this;this.searchForm.page=0,this.searchForm.pageSize=10,0!=this.toUserId&&(this.searchForm.companyName="็ง็ญ้ๅข",this.searchForm.name=this.toUserName,this.searchForm.userId=this.toUserId,this.searchForm.messageType=0),Object(A.i)(this.searchForm).then(function(t){200===t.code?(e.chatData=t.data.msgChatListVos,e.$nextTick(function(){e.$refs.dialog.scrollTop=e.$refs.dialog.scrollHeight})):e.$message.error(t.message)})},getMore:function(){var e=this;this.searchForm.page+=1,Object(A.i)(this.searchForm).then(function(t){200===t.code&&(0!==t.data.msgChatListVos.length?JSON.parse(s()(t.data.msgChatListVos)).reverse().forEach(function(t){e.chatData.unshift(t),e.$nextTick(function(){var t=e.$refs.dialog.clientHeight;e.$refs.dialog.scrollTop=e.$refs.dialog.scrollHeight/2+t})}):e.isShowMoreNews=!1)})},sendData:function(){var e=this;if(""!=this.chatContent){var t=void 0;t=0!=this.toUserId?{companyId:this.$store.getters.companyId,chatContent:this.chatContent,toUserId:this.toUserId}:{companyId:this.$store.getters.companyId,chatContent:this.chatContent,toCompanyId:this.searchForm.companyId},""!==this.fileIds&&(t.fileIds=this.fileIds),Object(A.a)(t).then(function(t){200===t.code&&(e.chatContent="",e.fileTemp=[],e.fileIds="",e.getConnectList())})}else this.$message.warning("่ฏท่พๅ
ฅๆฒ้ๅ
ๅฎน")},fileChange:function(e,t){var n=this;if(e.name.length>=150)return this.$message("ๆไปถๅ็งฐ่ถ
้ฟ๏ผ่ฏทๆฃๆฅ"),void(this.fileTemp=JSON.parse(s()(this.fileTemp)));var o=new FormData;o.append("companyId",this.searchForm.companyId),o.append("files",e.raw),t.length>1&&t.splice(0,1),Object(A.b)(o).then(function(e){200===e.code&&(n.fileIds=e.data)})},delChat:function(e){var t=this;this.$confirm("ๆญคๆไฝๅฐๆฐธไน
ๅ ้ค่ฏฅๆถๆฏ, ๆฏๅฆ็ปง็ปญ?","ๆ็คบ",{confirmButtonText:"็กฎๅฎ",cancelButtonText:"ๅๆถ",type:"warning"}).then(function(){Object(A.d)({chatId:e.chatId}).then(function(n){200===n.code&&(t.chatData.forEach(function(n,o){e.chatId==n.chatId&&t.chatData.splice(o,1)}),t.$message({type:"success",message:"ๅ ้คๆๅ!"}))})}).catch(function(){t.$message({type:"info",message:"ๅทฒๅๆถๅ ้ค"})})},handleKeyCode:function(e){13==e.keyCode&&e.ctrlKey?this.chatContent+="\n":13==e.keyCode&&(this.sendData(),e.preventDefault())},downHandle:function(e){window.location.href=e},changeOrderRead:function(){var e=new FormData;e.append("orderId",this.orderId),Object(l.h)(e).then(function(e){e.code})},getDetail:function(){var e=this;this.allowDetail.twoAllow?Object(l.q)({orderId:this.orderId}).then(function(t){if(200==t.code){e.orderForm=t.data,0==e.orderForm.orderType?e.getPersonList("้กน็ฎไธป็ฎก,้กน็ฎๅ","",""):1==e.orderForm.orderType?e.getPersonList("ไธๅฉๅ,ไธๅฉไธป็ฎก","",""):2==e.orderForm.orderType?e.getPersonList("ๅฎก่ฎกๅ","",""):4==e.orderForm.orderType&&e.getPersonList("้กน็ฎไธป็ฎก,้กน็ฎๅ,ๅฎก่ฎกๅ","",""),t.data.engineerUserId&&(e.orderForm.holdEngineerUserId=JSON.parse(s()(t.data.engineerUserId))),e.$set(e.orderForm,"applyBatchNo",t.data.batch),e.userFlowList=[];var n=[];for(var o in e.orderForm.workOrderProcessVoMap)n.push(e.orderForm.workOrderProcessVoMap[o]);for(var r=n.length-1;r>=0;r--)e.userFlowList.push(n[r]);var i=[];if(e.userFlowList.forEach(function(t){var n;(Object(l.o)({orderId:e.orderForm.orderId}).then(function(n){200==n.code&&n.data.allAllocationUserList.forEach(function(n){t.workId==n.workId&&(e.personList.forEach(function(t){t.userId==n.userId&&e.$set(n,"userName",t.userName)}),e.$set(t,"userName",n.userName))})}),t.orderProcessVoList.length>0)&&(t.holdProcessList=JSON.parse(s()(t.orderProcessVoList)),t.firstFlow=t.orderProcessVoList.splice(0,1),t.lastFlow=t.orderProcessVoList.splice(t.orderProcessVoList.length-1,1),t.lastFlow[0].signTime&&(t.endProcess=!0),i.push(t.holdProcessList[t.holdProcessList.length-1]),t.orderProcessVoList.forEach(function(n,o){if(n.userId==e.$store.getters.userId&&(n.isMyself=!0),t.workId=n.workId,e.$set(n,"closePro",!1),n.fileIds&&""!=n.fileIds){var r=n.fileIds.split(",");e.getFileDetail(r,n)}}),e.getHistoryList(t),t.orderProcessVoList=t.orderProcessVoList.filter(function(e,t){return 1==e.needCheck&&1==e.needRecheck&&(2!=e.checkResult&&2!=e.recheckResult||2==e.goToType||(n=JSON.parse(s()(t)))),1==e.needCheck&&2==e.needRecheck&&2==e.recheckResult&&2!=e.goToType&&(n=JSON.parse(s()(t))),1==e.needCheck&&0==e.needRecheck&&2==e.checkResult&&2!=e.goToType&&(n=JSON.parse(s()(t))),""!=n&&void 0!=n?e.sendTime&&e.signTime||!e.sendTime&&e.signTime:e}))}),0!=i.length)1==i.every(function(e,t,n){return e.signTime})&&(e.endProcess=!0);e.allowOrderCheckInfo.twoAllow&&e.getEditPersonNum(),e.getCollectData()}else e.$message.warning(t.message)}):this.$message.warning("ๆฑๆญ๏ผๆจๆฒกๆๆ้่ทๅๆญค่ฏฆๆ
")},changeCheck:function(){this.isCheck=!this.isCheck},getRoleName:function(e){var t=this;Object(d.u)({roleId:e}).then(function(e){200==e.code&&(t.$set(t.reviewForm,"roleName",e.data),t.getPersonList(e.data,1))})},getPersonList:function(e,t,n,o){var r=this,s=new FormData;s.append("roleNameList",e),void 0!=o&&s.append("isResign",o),void 0!=n&&s.append("deptIdList",n),Object(c.D)(s).then(function(n){200==n.code?(r.personList=n.data,"้กน็ฎไธป็ฎก,้กน็ฎๅ"==e&&(r.projectPersonList=n.data),"ไธๅฉไธป็ฎก,ไธๅฉๅ"==e&&(r.patentPersonList=n.data),"ๅฎก่ฎกๅ"==e&&(r.auditPersonList=n.data),1==t&&(r.roleUserList=n.data),2==t&&(r.deptUserList=n.data)):r.$message.warning(n.message)})},submitOrder:function(){var e=this;1==this.orderForm.orderState||""!=this.orderForm.orderRemarks&&void 0!=this.orderForm.orderRemarks?Object(l.g)(this.orderForm).then(function(t){200==t.code?(e.$message.success("ไฟฎๆนๆๅ"),e.orderForm={},e.closeCurrent(e.$store.state.tagsView.visitedViews,e.$route)):e.$message.warning(t.message)}):this.$message.warning("่ฏทๅกซๅ็ถๆๅคๆณจ")},reviewBtn:function(e,t,n,o){var r=this;this.getDetail(),setTimeout(function(){if(r.userFlowList.forEach(function(n){n.workId==e.workId&&n.orderProcessVoList.forEach(function(e){e.processId==t.processId&&(1==o&&(1!=e.needCheck||!e.signTime||e.sendTime||e.checkResult||(r.processialogVisible=!r.processialogVisible)),2==o&&(1!=e.needRecheck&&2!=e.needRecheck||!e.signTime||e.sendTime||!e.checkResult||1!=e.checkResult&&2!=e.checkResult||e.recheckResult||(r.processialogVisible=!r.processialogVisible)))})}),t.fileIds&&""!=t.fileIds){var i=t.fileIds.split(",");r.getFileDetail(i,t)}if(r.reviewForm={},r.reviewForm=JSON.parse(s()(t)),r.reviewForm.num=o,e.orderProcessVoList.forEach(function(e,o){if(n+1==o&&(r.$set(r.reviewForm,"nextHandlerType",e.handlerType),r.$set(r.reviewForm,"nextHandlerId",e.handlerId),r.$set(r.reviewForm,"holdCheckResult",t.checkResult),4==r.reviewForm.nextHandlerType&&r.getRoleName(r.reviewForm.nextHandlerId),2==r.reviewForm.nextHandlerType&&(r.$set(r.reviewForm,"nextNodeUserId",e.handlerId),r.personList.forEach(function(e){r.reviewForm.nextHandlerId==e.userId&&(r.reviewForm.nextNodeUserName=e.userName)})),3==r.reviewForm.nextHandlerType)){var s=[];s.push(e.handlerId),r.getPersonList("",2,s)}}),1==t.goToType&&0!=t.needRecheck&&r.$set(r.reviewForm,"holdRecheckResult",t.checkResult),0!=r.reviewForm.goToType){var a=[];e.holdProcessList.forEach(function(t,n){"ๅผๅง"==t.nodeName&&e.holdProcessList.splice(n,1),t.sendTime||"ๅผๅง"==t.nodeName||a.push(t)}),a.forEach(function(e,t){r.reviewForm.nodeId==e.nodeId&&a.splice(t,1)}),r.flowList=a}},300)},recheckReChange:function(e){this.$set(this.reviewForm,"holdRecheckResult",e)},checkResultSubmit:function(){var e=this;this.getDetail(),setTimeout(function(){e.userFlowList.forEach(function(t){t.workId==e.reviewForm.workId&&t.orderProcessVoList.forEach(function(t){if(t.processId==e.reviewForm.processId)if(1!=t.needCheck||!t.signTime||t.sendTime||t.checkResult)e.processialogVisible=!1;else{if(1==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck){if(1==e.reviewForm.nextHandlerType&&void 0!=e.reviewForm.nextHandlerType&&(""==e.reviewForm.nextNodeUserId||void 0==e.reviewForm.nextNodeUserId))return void e.$message.warning("่ฏท้ๆฉๆๅฎ็จๆท");if(2==e.reviewForm.nextHandlerType&&void 0!=e.reviewForm.nextHandlerType&&(""==e.reviewForm.nextNodeUserId||void 0==e.reviewForm.nextNodeUserId))return void e.$message.warning("่ฏท้ๆฉๆๅฎ็จๆท");if(3==e.reviewForm.nextHandlerType&&void 0!=e.reviewForm.nextHandlerType&&(""==e.reviewForm.nextNodeUserId||void 0==e.reviewForm.nextNodeUserId))return void e.$message.warning("่ฏท้ๆฉๆๅฎ็จๆท");if(4==e.reviewForm.nextHandlerType&&void 0!=e.reviewForm.nextHandlerType&&(""==e.reviewForm.nextNodeUserId||void 0==e.reviewForm.nextNodeUserId))return void e.$message.warning("่ฏท้ๆฉๆๅฎ็จๆท");if(0!=e.reviewForm.goToType&&3!=e.reviewForm.goToType){if(1==e.reviewForm.needRecheck&&1==e.reviewForm.goToType&&1==e.reviewForm.checkResult&&1==e.reviewForm.recheckResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(2==e.reviewForm.needRecheck&&1==e.reviewForm.goToType&&1==e.reviewForm.checkResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(1==e.reviewForm.needRecheck&&1==e.reviewForm.goToType&&1==e.reviewForm.checkResult&&1==e.reviewForm.recheckResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(2==e.reviewForm.needRecheck&&2==e.reviewForm.goToType&&2==e.reviewForm.checkResult&&2==e.reviewForm.recheckResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(1==e.reviewForm.needRecheck&&!(2!=e.reviewForm.goToType||2!=e.reviewForm.checkResult&&2!=e.reviewForm.recheckResult||""!=e.reviewForm.goToNodeId&&void 0!=e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(0==e.reviewForm.needRecheck&&2==e.reviewForm.goToType&&2==e.reviewForm.checkResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น")}}if(""==e.reviewForm.checkResult||void 0==e.reviewForm.checkResult)return void e.$message.warning("่ฏท้ๆฉ่ฏๅฎก็ปๆ");if(1==e.reviewForm.isMustUploadAccessory&&1==e.reviewForm.checkResult&&(""==e.reviewForm.fileIds||void 0==e.reviewForm.fileIds))return void e.$message.warning("่ฏทไธไผ ้ไปถ");e.recheckLoading=!0,Object(l.l)(e.reviewForm).then(function(t){200==t.code&&(e.$message.success("ๅๅฎกๆๅ"),e.recheckLoading=!1,e.getDetail(),e.fileList=[],e.flowList=[],e.processialogVisible=!1)})}})})},300)},recheckResultSubmit:function(){var e=this;this.getDetail(),setTimeout(function(){e.userFlowList.forEach(function(t){t.workId==e.reviewForm.workId&&t.orderProcessVoList.forEach(function(t){if(t.processId==e.reviewForm.processId)if(1!=t.needRecheck&&2!=t.needRecheck||!t.signTime||t.sendTime||!t.checkResult||1!=t.checkResult&&2!=t.checkResult||t.recheckResult)e.processialogVisible=!1;else{if(1==e.reviewForm.needCheck&&0!=e.reviewForm.needRecheck){if(0!=e.reviewForm.nextHandlerType&&void 0!=e.reviewForm.nextHandlerType&&(""==e.reviewForm.nextNodeUserId||void 0==e.reviewForm.nextNodeUserId))return void e.$message.warning("่ฏท้ๆฉๆๅฎ็จๆท");if(0!=e.reviewForm.goToType&&3!=e.reviewForm.goToType){if(1==e.reviewForm.needRecheck&&1==e.reviewForm.goToType&&1==e.reviewForm.checkResult&&1==e.reviewForm.recheckResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(2==e.reviewForm.needRecheck&&1==e.reviewForm.goToType&&1==e.reviewForm.checkResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(1==e.reviewForm.needRecheck&&1==e.reviewForm.goToType&&1==e.reviewForm.checkResult&&1==e.reviewForm.recheckResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(2==e.reviewForm.needRecheck&&2==e.reviewForm.goToType&&2==e.reviewForm.checkResult&&2==e.reviewForm.recheckResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(1==e.reviewForm.needRecheck&&!(2!=e.reviewForm.goToType||2!=e.reviewForm.checkResult&&2!=e.reviewForm.recheckResult||""!=e.reviewForm.goToNodeId&&void 0!=e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น");if(0==e.reviewForm.needRecheck&&2==e.reviewForm.goToType&&2==e.reviewForm.checkResult&&(""==e.reviewForm.goToNodeId||void 0==e.reviewForm.goToNodeId))return void e.$message.warning("่ฏท้ๆฉ่ทณ่ฝฌ่็น")}}if(""==e.reviewForm.recheckResult||void 0==e.reviewForm.recheckResult)return void e.$message.warning("่ฏท้ๆฉ่ฏๅฎก็ปๆ");e.recheckLoading=!0,Object(l.m)(e.reviewForm).then(function(t){200==t.code&&(e.$message.success("ๅคๅฎกๆๅ"),e.recheckLoading=!1,e.getDetail(),e.fileList=[],e.flowList=[],e.processialogVisible=!1)})}})})},300)},cancelSubmit:function(){this.fileList=[],this.flowList=[],this.processialogVisible=!1,this.recheckLoading=!1},completeBtn:function(e,t,n,o){var r=this;this.getDetail(),setTimeout(function(){r.userFlowList.forEach(function(i){i.workId==e.workId&&i.orderProcessVoList.forEach(function(i){if(i.processId==t.processId)if(0!=i.needCheck||0!=i.needRecheck||i.checkResult||i.sendTime||!i.signTime)e.orderProcessVoList.forEach(function(e,o){n+1==o&&(r.$set(r.reviewForm,"nextHandlerType",e.handlerType),r.$set(r.reviewForm,"nextHandlerId",e.handlerId),r.$set(r.reviewForm,"holdCheckResult",t.checkResult))}),r.reviewForm.nextHandlerType&&0!=r.reviewForm.nextHandlerType&&2!=r.reviewForm.nextHandlerType&&5!=r.reviewForm.nextHandlerType&&!r.reviewForm.nextHandlerUserId&&(r.processialogVisible=!1);else{if(r.reviewForm={},r.reviewForm=JSON.parse(s()(t)),e.orderProcessVoList.forEach(function(e,o){if(n+1==o&&(r.$set(r.reviewForm,"nextHandlerType",e.handlerType),r.$set(r.reviewForm,"nextHandlerId",e.handlerId),r.$set(r.reviewForm,"holdCheckResult",t.checkResult),4==r.reviewForm.nextHandlerType&&r.getRoleName(r.reviewForm.nextHandlerId),2==r.reviewForm.nextHandlerType&&(r.$set(r.reviewForm,"nextNodeUserId",e.handlerId),r.personList.forEach(function(e){r.reviewForm.nextHandlerId==e.userId&&(r.reviewForm.nextNodeUserName=e.userName)})),3==r.reviewForm.nextHandlerType)){var s=[];s.push(e.handlerId),r.getPersonList("",2,s)}}),1==t.goToType&&0!=t.needRecheck&&r.$set(r.reviewForm,"holdRecheckResult",t.checkResult),0!=r.reviewForm.goToType){var a=[];e.holdProcessList.forEach(function(t,n){"ๅผๅง"==t.nodeName&&e.holdProcessList.splice(n,1),t.sendTime||"ๅผๅง"==t.nodeName||a.push(t)}),a.forEach(function(e,t){r.reviewForm.nodeId==e.nodeId&&a.splice(t,1)}),r.flowList=a}r.reviewForm.nextHandlerType&&0!=r.reviewForm.nextHandlerType&&2!=r.reviewForm.nextHandlerType&&5!=r.reviewForm.nextHandlerType&&!r.reviewForm.nextHandlerUserId?(r.processialogVisible=!r.processialogVisible,r.reviewForm.num=o):Object(l.k)(t).then(function(e){200==e.code&&(r.$message.success("ๆไฝๆๅ"),r.getDetail())})}})})},300)},completeSubmit:function(){var e=this;this.getDetail(),setTimeout(function(){e.userFlowList.forEach(function(t){t.workId==e.reviewForm.workId&&t.orderProcessVoList.forEach(function(t){t.processId==e.reviewForm.processId&&(0!=t.needCheck||0!=t.needRecheck||t.checkResult||t.sendTime||!t.signTime?e.processialogVisible=!1:Object(l.k)(e.reviewForm).then(function(t){200==t.code&&(e.processialogVisible=!e.processialogVisible,e.$message.success("ๆไฝๆๅ"),e.getDetail())}))})})},300)},withdrawProcess:function(e){var t=this;this.getDetail(),setTimeout(function(){var n={};t.userFlowList.forEach(function(t){e.forEach(function(e){if(t.workId==e.workId){if(t.lastFlow[0].signTime)throw new Error;e.signTime&&!e.sendTime&&(n={currentProcessId:e.processId,orderId:e.orderId,workId:e.workId})}})}),t.$confirm("ๆฏๅฆ็กฎๅฎๆคๅๆญคๆต็จ","ๆ็คบ",{confirmButtonText:"็กฎๅฎ",cancelButtonText:"ๅๆถ",type:"warning"}).then(function(){Object(l.j)(n).then(function(e){200==e.code&&(t.$message.success("ๆคๅๆๅ"),t.getDetail())})})},300)},retrieveProcess:function(e){var t=this;this.getDetail(),setTimeout(function(){t.userFlowList.forEach(function(n){n.workId==e.workId&&n.orderProcessVoList.forEach(function(o,r){if(o.processId==e.processId&&n.orderProcessVoList[r-1]&&n.orderProcessVoList[r-1].signTime&&n.orderProcessVoList[r-1].userId==t.userId&&n.orderProcessVoList[r-1].sendTime&&!o.sendTime&&!o.checkResult){var s={currentProcessId:e.processId,orderId:e.orderId,workId:e.workId};Object(l.t)(s).then(function(e){200==e.code&&(t.$message.success("ๅๅๆๅ"),t.getDetail())})}})})},300)},returnBackOpen:function(e,t){var n=this;this.getDetail(),setTimeout(function(){n.userFlowList.forEach(function(o){o.workId==e.workId&&o.orderProcessVoList.forEach(function(o){o.processId==e.processId&&o.signTime&&!o.sendTime&&(n.sendBackForm={currentProcessId:e.processId,orderId:e.orderId,workId:e.workId,sendList:[]},t.forEach(function(e){e.signTime&&e.sendTime&&n.sendBackForm.sendList.push(e)}),n.sendBackDialog=!0)})})},300)},returnBackProcess:function(){var e=this;this.getDetail(),setTimeout(function(){e.userFlowList.forEach(function(t){t.workId==e.sendBackForm.workId&&t.orderProcessVoList.forEach(function(t){if(t.processId==e.sendBackForm.currentProcessId&&t.signTime&&!t.sendTime){if(void 0==e.sendBackForm.targetSkipProcessId||""==e.sendBackForm.targetSkipProcessId)return void e.$message.warning("่ฏท้ๆฉ้ๅ็ฏ่");delete e.sendBackForm.sendList,Object(l.w)(e.sendBackForm).then(function(t){200==t.code&&(e.sendBackForm={},e.getDetail(),e.sendBackDialog=!1)})}})})},300)},closeSendBack:function(){this.sendBackForm={},this.sendBackDialog=!1},getHistoryList:function(e){var t=this;Object(l.p)({workId:e.workId}).then(function(n){if(200==n.code){var o=[],r=[];for(var s in n.data)for(var i=0;i<=n.data[s].length;i++)n.data[s][i]&&o.push(n.data[s][i]);for(var a=o.length-1;a>=0;a--)r.push(o[a]);var l=[];r.forEach(function(e){(e=e.split("|"))[1]=e[1].replace("T"," ");var t={time:e[1],text:e[0]};l.push(t)}),t.$set(e,"historyList",l)}})}},a()(o,"fileChange",function(e){this.importApproval(e)}),a()(o,"handleRemove",function(e,t){var n=this;this.fileList.forEach(function(t){t.fileId==e.fileId&&n.fileList.splice(0,1)})}),a()(o,"importApproval",function(e){var t=this;if(0==e.size)return this.$message("ๆไปถไธบ็ฉบ๏ผ่ฏท้ๆฐไธไผ "),void(this.fileList=JSON.parse(s()(this.fileList)));if(e.name.length>=150)return this.$message("ๆไปถๅ็งฐ่ถ
้ฟ๏ผ่ฏทๆฃๆฅ"),void(this.fileList=JSON.parse(s()(this.fileList)));if(this.fileTemp=e.raw,this.fileTemp){var n=new FormData;n.append("crmCompanyId",this.orderForm.companyId),n.append("customerName",this.orderForm.companyName),n.append("projectName",this.orderForm.projectName),n.append("file",this.fileTemp),Object(l.A)(n).then(function(n){if(200==n.code){var o={uid:e.uid,name:e.name,fileName:e.name,filesId:n.data};t.fileList.push(o),t.reviewForm.fileIds=[],t.reviewForm.fileIds.push(n.data),t.$message.success("ไธไผ ๆๅ")}})}else this.$message({type:"warning",message:"่ฏทไธไผ ๆไปถ๏ผ"})}),a()(o,"getFileDetail",function(e,t){var n=this;Object(d.k)({fileIds:e,haveView:!1}).then(function(e){200==e.code?n.$set(t,"fileList",e.data):n.$message.warning(e.message)})}),a()(o,"downloadFile",function(e){var t=this;e.filePath&&Object(d.p)(e).then(function(e){200==e.code&&(window.open(e.data),t.$message.success("ไธ่ฝฝๆๅ"))})}),a()(o,"cancelSub",function(){this.orderForm={},this.closeCurrent(this.$store.state.tagsView.visitedViews,this.$route,"/declareCoordination/orderManage")}),a()(o,"closeProcess",function(e){e.closePro=!e.closePro}),a()(o,"openCommentList",function(e){this.commentDialog=!0,this.addCommentForm={companyId:this.orderForm.companyId,companyName:this.orderForm.companyName,fileIds:"",nodeName:e.nodeName,orderType:this.orderForm.orderType,orderId:this.orderForm.orderId,processId:e.processId,projectName:this.orderForm.projectName,userComment:"",userId:this.$store.getters.userId,userName:this.$store.getters.username,currentProcessUserId:e.userId},this.getCommentList(e.processId)}),a()(o,"getCommentList",function(e){var t=this;Object(l.s)({processId:e}).then(function(n){200==n.code&&(t.commentList=n.data,t.commentIdList=[],t.commentList.forEach(function(e){e.fileIds&&""!=e.fileIds&&(e.fileIds=e.fileIds.split(","),t.getFileDetail(e.fileIds,e)),t.commentIdList.push(e.commentId)}),0!=t.commentIdList.length&&t.changeCommentState(e))})}),a()(o,"changeCommentState",function(e){var t=this;Object(l.x)({commentIdList:this.commentIdList}).then(function(n){200==n.code&&Object(l.s)({processId:e}).then(function(e){200==e.code&&(t.commentList=e.data,t.commentIdList=[],t.commentList.forEach(function(e){e.fileIds&&""!=e.fileIds&&(e.fileIds=e.fileIds.split(","),t.getFileDetail(e.fileIds,e)),t.commentIdList.push(e.commentId)}))})})}),a()(o,"addComment",function(){var e=this;""!=this.addCommentForm.userComment&&void 0!=this.addCommentForm.userComment?Object(l.a)(this.addCommentForm).then(function(t){200==t.code&&(e.$message.success("่ฏ่ฎบๆๅ"),e.commentDialog=!1,e.getDetail())}):this.$message.warning("่ฏ่ฎบๅ
ๅฎนไธ่ฝไธบ็ฉบ")}),a()(o,"closeComment",function(){this.getDetail(),this.commentDialog=!1}),a()(o,"deleteComment",function(e){var t=this;this.$confirm("ๆฏๅฆ็กฎๅฎๅ ้ค่ฏ่ฎบ","ๆ็คบ",{confirmButtonText:"็กฎๅฎ",cancelButtonText:"ๅๆถ",type:"warning"}).then(function(){Object(l.f)({commentId:e.commentId}).then(function(n){200==n.code&&(t.$message.success("ๅ ้คๆๅ๏ผ"),t.getCommentList(e.processId),t.getDetail())})})}),a()(o,"goToNodeChange",function(e){var t=this;this.flowList.forEach(function(n){if(n.nodeId==e&&(t.$set(t.reviewForm,"nextHandlerType",n.handlerType),t.$set(t.reviewForm,"nextHandlerId",n.handlerId),1==t.reviewForm.nextHandlerType&&1==t.reviewForm.needCheck&&2==t.reviewForm.needRecheck&&t.$set(t.reviewForm,"holdCheckResult",t.reviewForm.checkResult),4==t.reviewForm.nextHandlerType&&(t.roleUserList=[],t.$set(t.reviewForm,"nextNodeUserId",""),t.$set(t.reviewForm,"holdCheckResult",t.reviewForm.checkResult),t.getRoleName(t.reviewForm.nextHandlerId)),2==t.reviewForm.nextHandlerType&&(t.$set(t.reviewForm,"nextNodeUserId",n.handlerId),t.personList.forEach(function(e){t.reviewForm.nextHandlerId==e.userId&&(t.reviewForm.nextNodeUserName=e.userName)})),3==t.reviewForm.nextHandlerType)){t.deptUserList=[],t.$set(t.reviewForm,"nextNodeUserId","");var o=[];o.push(n.handlerId),t.getPersonList("",2,o)}})}),a()(o,"handleCommentRemove",function(e,t){var n=this;this.fileCommentList.forEach(function(t){t.fileId==e.fileId&&n.fileCommentList.splice(0,1)})}),a()(o,"beforeRemove",function(e,t){return this.$confirm("ๆฏๅฆ็กฎๅฎๅ ้คๆญคๆไปถ๏ผ่งฃ้คๅ
ณ่? "+e.name+"๏ผ")}),a()(o,"onUploadChange",function(e){this.uploadCommentFile(e.raw)}),a()(o,"uploadCommentFile",function(e){var t=this;if(e.name.length>=150)return this.$message("ๆไปถๅ็งฐ่ถ
้ฟ๏ผ่ฏทๆฃๆฅ"),void(this.fileList=JSON.parse(s()(this.fileList)));if(0==e.size)return this.$message.warning("่ฏทๅฟไธไผ ็ฉบๆไปถ"),void(this.fileList=JSON.parse(s()(this.fileList)));var n=this.$loading({lock:!0,text:"ไธไผ ไธญ"}),o=new FormData;o.append("file",e),uploadFile(o).then(function(o){if(200==o.code){t.fileIdsList.push(o.data);var r={uid:e.uid,name:e.name,fileName:e.name,filesId:o.data};n.close(),t.fileList.push(r),t.fileNameList.push(r),t.$message.success("ไธไผ ๆๅ๏ผ")}else t.fileList=JSON.parse(s()(t.fileList)),t.$message.warning(o.message)})}),a()(o,"getDictData",function(){var e=this,t={keyList:"DICT:MATERIALTYPE",companyId:this.$store.getters.companyId};Object(d.d)(t).then(function(t){200==t.code?e.annexTypeData=t.data["DICT:MATERIALTYPE"]:e.$message({type:"error",message:t.message})})}),a()(o,"jiabaTabHandle",function(e){this.activeJiBa=e}),a()(o,"getCollectData",function(){var e=this,t={page:0,pageSize:20,companyId:this.orderForm.companyId,orderId:this.orderForm.orderId,applyLevel:this.orderForm.applyLevel,provinceId:this.orderForm.provinceId,cityId:this.orderForm.cityId,districtId:this.orderForm.districtId,townId:this.orderForm.townId,applyYear:this.orderForm.year,projectId:this.orderForm.projectId};Object(l.r)(t).then(function(t){if(200===t.code&&0!==t.data.data.length){e.selectProjectModalData=[];var n=JSON.parse(s()(t.data.data));n.forEach(function(t){if(t.fileIds&&""!==t.fileIds){var n=t.fileIds.split(",");Object(d.k)({fileIds:n,haveView:!1}).then(function(n){200==n.code?t.fileIds=n.data:e.$message.warning(n.message)})}else t.fileIds=[];if(t.templateFileIds&&""!==t.templateFileIds){var o=t.templateFileIds.split(",");Object(d.k)({fileIds:o,haveView:!1}).then(function(n){200==n.code?t.templateFileList=n.data:e.$message.warning(n.message)})}}),setTimeout(function(){e.collectDataList=n},300)}})}),a()(o,"downFileHandle",function(e){var t=this;e.fileId||this.annexFilesList.forEach(function(t){t.fileName==e.name&&(e=t)});var n={companyId:this.$store.getters.companyId,fileId:e.fileId};Object(c.p)(n).then(function(e){200==e.code?(window.open(e.data),t.$message({type:"success",message:"ไธ่ฝฝๆๅ"})):t.$message({type:"error",message:e.message})})}),a()(o,"addAnnexHandle",function(e){this.uploadFileModal=!0,this.anFilesList=[],-1!==e?(0!==e.fileIds.length&&e.fileIds.forEach(function(e){e.name=e.fileName}),this.uploadAnnexParams=JSON.parse(s()(e)),this.isFileClick=!0):this.isFileClick=!1}),a()(o,"tableRowClassName",function(e){var t=e.row,n=e.rowIndex;t.index=n}),a()(o,"onRowClick",function(e,t,n){this.curData=e.index}),a()(o,"handlePoliceUpload",function(e){var t=this;if(e.file.name.length>=150)return this.$message.error("ๆไปถๅ็งฐ่ถ
้ฟ๏ผ่ฏทๆฃๆฅ"),void(this.fileList=JSON.parse(s()(this.fileList)));var n=e.file.name.split("."),o=Object(p.g)("้ไปถ",n[0])+"."+n[n.length-1];Object(m.a)(o,e.file,e).then(function(r){if(r){var s=[],i={fileName:e.file.name,filePath:o,fileSize:e.file.size,fileType:n[n.length-1],parentType:4};s.push(i);var a={companyId:t.$store.getters.companyId,companyName:t.$store.getters.companyName,addFileDtos:s,haveView:!0};Object(d.a)(a).then(function(e){200==e.code&&(t.$message.success("ไธไผ ๆๅ"),t.annexFilesList.push(e.data[0]),e.data[0].name=e.data[0].fileName,t.uploadAnnexParams.fileIds.push(e.data[0]),t.$set(t.reviewForm,"fileIds",e.data[0].fileId),t.$set(t.reviewForm,"fileName",e.data[0].fileName),t.$set(t.reviewForm,"fileList",[]))})}})}),a()(o,"delUploadFileHandle",function(e,t){var n=this;this.uploadAnnexParams.fileIds.forEach(function(t,o){e.name==t.fileName&&n.uploadAnnexParams.fileIds.splice(o,1)})}),a()(o,"setAnnexHandle",function(){var e=this;this.$refs.annexParams.validate(function(t,n){if(t){if(0==e.uploadAnnexParams.fileIds.length)return void e.$message.warning("่ฏทไธไผ ้ไปถ");var o=[],r=e.uploadAnnexParams.fileIds.map(function(e){return e.fileId});e.uploadAnnexParams.fileIds=r.join(","),e.uploadAnnexParams.orderId=e.$route.query.orderId,e.uploadAnnexParams.crmCompanyId=e.orderForm.companyId,o.push(e.uploadAnnexParams),Object(l.v)(o).then(function(t){200===t.code&&(e.$message.success("ไฟๅญๆๅ"),e.getCollectData(),e.uploadAnnexParams={materialTypeName:"",materialDesc:"",fileIds:[]},e.annexFilesList=[],e.anFilesList=[],e.uploadFileModal=!1)})}})}),a()(o,"cananlUploadFile",function(){this.uploadAnnexParams={materialTypeName:"",materialDesc:"",fileIds:[]},this.annexFilesList=[],this.anFilesList=[],this.uploadFileModal=!1}),a()(o,"delListAnnex",function(e,t,n){var o=this,r=JSON.parse(s()(e));r.fileIds.forEach(function(e){e.fileId===t.fileId&&r.fileIds.splice(n,1)}),r.fileIds=r.fileIds.map(function(e){return e.fileId}),r.fileIds=r.fileIds.join(",");var i=[];i.push(r),Object(l.v)(i).then(function(e){200===e.code&&(o.$message.success("ไฟๅญๆๅ"),o.getCollectData())})}),a()(o,"goToUrl",function(e){switch(e){case 1:this.$router.push({path:"/customer/editCustomer",query:{id:this.orderForm.companyId,check:!0,tip:!0}});break;case 2:this.$router.push({path:"/policy/project/detail",query:{id:this.orderForm.projectId,check:!0}});break;case 3:this.$router.push({path:"/policy/detailPolicy",query:{noticeId:this.orderForm.noticeId,is_check:!0}})}}),a()(o,"getEditPersonNum",function(){var e=this;Object(l.o)({orderId:this.orderId}).then(function(t){200==t.code&&0!=t.data.allAllocationUserList&&e.userFlowList.forEach(function(n){t.data.allAllocationUserList.forEach(function(t){n.workId==t.workId&&e.$set(n,"allocationNumber",t.allocationNumber)})})})}),a()(o,"openEditPerson",function(e){var t=this,n=!1;if(e){var o=function(e,t){for(var n=0;n<t.length;n++){if(t[n].toString()==e)return!0}return!1};if(e.crmCompanyId=e.companyId,this.personNum=0,this.applyNumTotal=0,this.assignForm={},this.checkOrderIds=[],this.checkOrderIds.push(e),-1==e.contractState&&(n=!0),0==this.checkOrderIds.length)return void this.$message.error("่ณๅฐๅพ้ไธไธช่ฎขๅ");this.assignForm.contractState=e.contractState,this.assignForm.orderId=e.orderId,this.assignForm.flowId=e.flowId,this.assignForm.orderType=e.orderType,Object(l.o)({orderId:e.orderId}).then(function(r){if(200==r.code){if(t.applyNumTotal=r.data.orderAllocationTotalNumber,r.data.orderAllocationTotalNumber>1)if(r.data.allAllocationUserList.length>0){if(t.$set(t.assignForm,"assignUserList",r.data.allAllocationUserList),4==e.orderType){var s=[];s=e.flowId.split(","),t.getPersonList("้กน็ฎไธป็ฎก,้กน็ฎๅ,ๅฎก่ฎกๅ","","",n),t.flowList=[],s.forEach(function(e){t.getFlowList(e)}),t.assignForm.assignUserList.forEach(function(e){o(e.flowId,s)?t.$set(e,"notExistence",!1):(t.$set(e,"notExistence",!0),t.getFlowList(e.flowId,e))})}}else{t.$set(t.assignForm,"assignUserList",r.data.allAllocationUserList);var i=[];if(i=e.flowId.split(","),4==e.orderType){t.getPersonList("้กน็ฎไธป็ฎก,้กน็ฎๅ,ๅฎก่ฎกๅ","","",n),t.flowList=[],i.forEach(function(e){t.getFlowList(e)});var a={orderId:e.orderId,allocationNumber:r.data.orderAllocationTotalNumber};t.assignForm.assignUserList.push(a)}else{var l={orderId:e.orderId,flowId:e.flowId,allocationNumber:r.data.orderAllocationTotalNumber};t.$set(t.assignForm,"assignUserList",r.data.allAllocationUserList),t.assignForm.assignUserList.push(l)}}if(1==r.data.orderAllocationTotalNumber&&4==e.orderType)if(r.data.allAllocationUserList.length>0){if(t.$set(t.assignForm,"assignUserList",r.data.allAllocationUserList),4==e.orderType){var c=[];c=e.flowId.split(","),t.getPersonList("้กน็ฎไธป็ฎก,้กน็ฎๅ,ๅฎก่ฎกๅ","","",n),t.flowList=[],c.forEach(function(e){t.getFlowList(e)}),t.assignForm.assignUserList.forEach(function(e){o(e.flowId,c)?t.$set(e,"notExistence",!1):(t.$set(e,"notExistence",!0),t.getFlowList(e.flowId,e))})}}else{t.$set(t.assignForm,"assignUserList",r.data.allAllocationUserList);var d=[];if(d=e.flowId.split(","),4==e.orderType){t.getPersonList("้กน็ฎไธป็ฎก,้กน็ฎๅ,ๅฎก่ฎกๅ","","",n),t.flowList=[],d.forEach(function(e){t.getFlowList(e)});var A={orderId:e.orderId};t.assignForm.assignUserList.push(A)}else{var m={orderId:e.orderId,flowId:e.flowId};t.$set(t.assignForm,"assignUserList",r.data.allAllocationUserList),t.assignForm.assignUserList.push(m)}}setTimeout(function(){1==t.flowList.length&&t.assignForm.assignUserList.forEach(function(e){t.$set(e,"flowId",t.flowList[0].flowId)})},300)}})}this.personNum=e.orderType,this.personDialogVisible=!0,0==e.orderType?this.getPersonList("้กน็ฎไธป็ฎก,้กน็ฎๅ","","",n):1==e.orderType?this.getPersonList("ไธๅฉๅ,ไธๅฉไธป็ฎก","","",n):2==e.orderType?this.getPersonList("ๅฎก่ฎกๅ","","",n):4==e.orderType&&this.getPersonList("้กน็ฎไธป็ฎก,้กน็ฎๅ,ๅฎก่ฎกๅ","","",n)}),a()(o,"addNewAssign",function(){if(4==this.assignForm.orderType){var e={orderId:this.assignForm.orderId};this.assignForm.assignUserList.push(e)}else{var t={orderId:this.assignForm.orderId,flowId:this.assignForm.flowId,userId:""};this.assignForm.assignUserList.push(t)}}),a()(o,"cancelAssignDig",function(){this.personNum=0,this.applyNumTotal=0,this.assignForm={},this.checkOrderIds=[],this.personDialogVisible=!1}),a()(o,"editPerson",function(){var e=this;if(this.applyNumTotal>1||1==this.applyNumTotal&&4==this.assignForm.orderType){if(0==this.checkOrderIds.length)return void this.$message.error("่ณๅฐๅพ้ไธไธช่ฎขๅ");this.assignForm.assignUserList.forEach(function(t){var n=0;if(e.assignForm.assignUserList.forEach(function(e){t.flowId==e.flowId&&(n+=Number(e.allocationNumber))}),n>e.applyNumTotal)throw e.$message.warning("็ธๅๆต็จไธ๏ผๆฐ้่ถ
ๅบๆปๆฐ้๏ผ่ฏทๆฃๆฅๆฐ้"),new Error;if(n<e.applyNumTotal)throw e.$message.warning("็ธๅๆต็จไธ๏ผๅทฅๅๆชๅ้
ๅฎ๏ผ่ฏทๆฃๆฅๆฐ้"),new Error;if(void 0==t.userId||""==t.userId)throw e.$message.warning("่ฏทๅกซๅๅค็ไบบไฟกๆฏ"),new Error;if(0==t.allocationNumber||""==t.allocationNumber)throw e.$message.warning("ๆฐ้ไธ่ฝไธบ0ๆ่
็ฉบ"),new Error}),this.checkOrderIds.forEach(function(t){delete t.flowId,e.$set(t,"allocationDtoList",e.assignForm.assignUserList),e.$set(t,"assignType",e.personNum)}),Object(l.c)(this.checkOrderIds[0]).then(function(t){200==t.code&&(e.personDialogVisible=!1,e.personId="",e.personNum=0,e.applyNumTotal=0,e.assignForm={},e.checkOrderIds=[],e.getDetail(),e.$message.success("ไฟฎๆนๆๅ!"))})}if(1==this.applyNumTotal&&4!=this.assignForm.orderType){if(0==this.checkOrderIds.length)return void this.$message("่ฏท้ๆฉ่ฎขๅ");var t={assignType:this.personNum,assignUserId:this.personId,crmOrderDtoList:this.checkOrderIds};Object(l.b)(t).then(function(t){200==t.code?(e.personDialogVisible=!1,e.personId="",e.personNum=0,e.applyNumTotal=0,e.assignForm={},e.checkOrderIds=[],e.getDetail(),e.$message.success("ไฟฎๆนๆๅ!")):e.$message.warning(t.message)})}}),a()(o,"deleteAssignBox",function(e,t){var n=this;e.workId?this.$confirm("่ฏฅๅค็ไบบ็่ฟๅบฆๅฐ่ขซๅ ้ค๏ผ่ฏท็กฎ่ฎคๆฏๅฆ่ฆๅ ้ค","ๆ็คบ",{confirmButtonText:"็กฎๅฎ",cancelButtonText:"ๅๆถ",type:"warning"}).then(function(){Object(l.d)({workId:e.workId}).then(function(e){200==e.code&&n.assignForm.assignUserList.splice(t,1)})}):this.assignForm.assignUserList.splice(t,1)}),a()(o,"getFlowList",function(e,t){var n=this,o={page:0,pageSize:30,flowId:e};Object(f.f)(o).then(function(e){200==e.code?t?n.$set(t,"flowName",e.data.flowName):n.flowList.push(e.data):n.$message.warning(e.message)})}),a()(o,"inputXz",function(e){e.target.value=e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]||null,e.target.value=e.target.value.replace(".","")}),a()(o,"openOrClose",function(){this.openOrCloseHistory=!this.openOrCloseHistory}),o)}),v={render:function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"app-container"},[o("div",{staticClass:"row-width-auto-margin-0-90"},[o("el-card",{staticClass:"box-card cardCont"},[o("div",{staticClass:"headerTop",attrs:{slot:"header"},slot:"header"},[o("div",{staticClass:"headerLeft"},[o("span",{staticClass:"conditionChoose"},[e._v("่ฎขๅ่ฏฆๆ
")])])]),e._v(" "),o("div",{staticClass:"orderDetailCont"},[o("el-row",{staticClass:"orderMsg"},[o("el-col",[o("span",{staticStyle:{"margin-right":"30px"}},[e._v("\n ๅฎขๆทๅ็งฐ๏ผ\n "),o("span",{staticClass:"goLink",on:{click:function(t){return e.goToUrl(1)}}},[e._v(e._s(e.orderForm.companyName))])])])],1),e._v(" "),o("el-row",{staticClass:"orderMsg"},[o("el-col",{attrs:{span:9}},[o("span",[e._v("้กน็ฎๅ็งฐ๏ผ"),o("span",{staticClass:"goLink"},[o("span",{staticClass:"goLink",on:{click:function(t){return e.goToUrl(2)}}},[e._v(e._s(e.orderForm.projectName))])])])]),e._v(" "),o("el-col",{attrs:{span:9}},[o("span",[e._v("็บงๅซ๏ผ"+e._s(e.orderForm.companyLevelName))])])],1),e._v(" "),o("el-row",{staticClass:"orderMsg"},[o("el-col",[o("span",[e._v("็ธๅ
ณ้็ฅ๏ผ"),o("span",{staticClass:"goLink",on:{click:function(t){return e.goToUrl(3)}}},[e._v(e._s(e.orderForm.noticeName))])])])],1)],1)]),e._v(" "),o("el-card",{staticClass:"box-card cardCont"},[o("div",{staticClass:"headerTop",attrs:{slot:"header"},slot:"header"},[o("div",{staticClass:"headerLeft"},[o("span",{staticClass:"conditionChoose conOrgin"},[e._v("ๅบๆฌไฟกๆฏ")]),e._v(" "),e.isCheck&&e.allowUpdate.twoAllow&&!e.endProcess?o("img",{staticStyle:{cursor:"pointer"},attrs:{src:n("qzBd")},on:{click:e.changeCheck}}):e._e()])]),e._v(" "),o("div",{staticClass:"orderDetailCont"},[o("el-row",{staticClass:"orderMsg"},[o("el-col",{attrs:{span:5}},[o("span",[e._v("็ญพ็บฆๅ
ฌๅธ๏ผ"+e._s(e.orderForm.signCompanyName?e.orderForm.signCompanyName:"ๅ
ถไป"))])]),e._v(" "),o("el-col",{attrs:{span:5}},[o("span",{on:{click:function(t){return e.handleShowConnectContentListPeople(e.orderForm,0)}}},[e._v("็ญพ่ฎขไบบ๏ผ"),o("span",{staticClass:"classPointer"},[e._v(e._s(e.orderForm.signUserName))])])]),e._v(" "),o("el-col",{attrs:{span:5}},[o("span",[e._v("็ญพ่ฎขๆถ้ด๏ผ"+e._s(e.orderForm.signDate))])])],1),e._v(" "),o("el-row",{staticClass:"orderMsg",staticStyle:{display:"none"}},[2!=e.orderForm.orderType?o("el-col",{attrs:{span:8}},[o("div",{staticClass:"msgFlex"},[0==e.orderForm.orderType?o("span",[e._v("้กน็ฎๅทฅ็จๅธ ๏ผ")]):e._e(),e._v(" "),1==e.orderForm.orderType?o("span",[e._v("็ฅ่ฏไบงๆๅทฅ็จๅธ๏ผ")]):e._e(),e._v(" "),!e.isCheck&&0==e.orderForm.orderType&&e.allowBatchassignOrder.twoAllow?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.orderForm.engineerUserId,callback:function(t){e.$set(e.orderForm,"engineerUserId",t)},expression:"orderForm.engineerUserId"}},e._l(e.projectPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),!e.isCheck&&1==e.orderForm.orderType&&e.allowBatchassignOrder.twoAllow?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.orderForm.engineerUserId,callback:function(t){e.$set(e.orderForm,"engineerUserId",t)},expression:"orderForm.engineerUserId"}},e._l(e.patentPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),e.isCheck?o("span",[e._v(e._s(e.orderForm.engineerUserName))]):e._e(),e._v(" "),e.isCheck||e.allowBatchassignOrder.twoAllow?e._e():o("span",[e._v(e._s(e.orderForm.engineerUserName))])],1)]):e._e(),e._v(" "),2==e.orderForm.orderType?o("el-col",{attrs:{span:8}},[o("div",{staticClass:"msgFlex"},[o("span",[e._v("่ดขๅกๅฎก่ฎกไบบๅ๏ผ")]),e._v(" "),!e.isCheck&&e.allowBatchassignOrder.twoAllow?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.orderForm.engineerUserId,callback:function(t){e.$set(e.orderForm,"engineerUserId",t)},expression:"orderForm.engineerUserId"}},e._l(e.auditPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),e.isCheck?o("span",[e._v(e._s(e.orderForm.engineerUserName))]):e._e(),e._v(" "),e.isCheck||e.allowBatchassignOrder.twoAllow?e._e():o("span",[e._v(e._s(e.orderForm.engineerUserName))])],1)]):e._e()],1),e._v(" "),o("el-row",{staticClass:"orderMsg"},[o("el-col",{attrs:{span:5}},[o("span",[e._v("็ณๆฅๅนดไปฝ๏ผ"+e._s(e.orderForm.year))])]),e._v(" "),o("el-col",{attrs:{span:5}},[o("span",[e._v("ๆฐ้๏ผ"+e._s(e.orderForm.applyNum))])]),e._v(" "),o("el-col",{attrs:{span:5}},[o("span",[e._v("ๆฏๅฆๆธ ้ๅ
ฌๅธ๏ผ"+e._s(0==e.orderForm.isChannel?"ไธๆฏ":1==e.orderForm.isChannel?"ๆฏ":"-"))])])],1),e._v(" "),o("el-row",{staticClass:"orderMsg"},[o("el-col",{attrs:{span:5}},[o("div",{staticClass:"msgFlex"},[o("span",[e._v("้กน็ฎๆนๆฌก๏ผ")]),e._v(" "),e.isCheck?o("span",[e._v("\n "+e._s(0==e.orderForm.applyBatchNo?"ๆชๆๅฎ":1==e.orderForm.applyBatchNo?"็ฌฌไธๆน":2==e.orderForm.applyBatchNo?"็ฌฌไบๆน":3==e.orderForm.applyBatchNo?"็ฌฌไธๆน":4==e.orderForm.applyBatchNo?"็ฌฌๅๆน":5==e.orderForm.applyBatchNo?"็ฌฌไบๆน":"-")+"\n ")]):o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.orderForm.applyBatchNo,callback:function(t){e.$set(e.orderForm,"applyBatchNo",t)},expression:"orderForm.applyBatchNo"}},e._l(e.batchNoList,function(e){return o("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1)],1)]),e._v(" "),o("el-col",{attrs:{span:12}},[o("span",[e._v("่ฎขๅ็ถๆ๏ผ")]),e._v(" "),o("el-radio-group",{attrs:{disabled:e.isCheck},model:{value:e.orderForm.orderState,callback:function(t){e.$set(e.orderForm,"orderState",t)},expression:"orderForm.orderState"}},[o("el-radio",{attrs:{label:1}},[e._v("ๆญฃๅธธ")]),e._v(" "),o("el-radio",{attrs:{label:2}},[e._v("ๆๅ")]),e._v(" "),o("el-radio",{attrs:{label:3}},[e._v("ๅๆถ")]),e._v(" "),o("el-radio",{attrs:{label:4}},[e._v("ๆๆถไธ็ฌฆๅๆกไปถ")])],1)],1)],1),e._v(" "),1!=e.orderForm.orderState?o("el-row",{staticClass:"orderMsg"},[o("el-col",{staticStyle:{display:"flex"},attrs:{span:10}},[o("div",{staticClass:"stateDesc"},[o("span",{staticClass:"star",staticStyle:{position:"relative"}},[e._v("*")]),o("span",[e._v("็ถๆๅคๆณจ๏ผ")]),e._v(" "),e.isCheck?o("span",[e._v(e._s(e.orderForm.orderRemarks))]):o("el-input",{staticStyle:{flex:"1"},attrs:{type:"textarea",rows:4,maxlength:"150"},model:{value:e.orderForm.orderRemarks,callback:function(t){e.$set(e.orderForm,"orderRemarks",t)},expression:"orderForm.orderRemarks"}})],1)])],1):e._e(),e._v(" "),o("el-row",{staticClass:"orderMsg"},[o("el-col",{attrs:{span:5}},[0==e.orderForm.orderType||4==e.orderForm.orderType?o("p",[e._v("\n ้กน็ฎๅทฅ็จๅธ๏ผ\n "),e._l(e.userFlowList,function(t){return o("span",{on:{click:function(n){return e.handleShowConnectContentListPeople(t,1)}}},[o("span",{staticClass:"classPointer"},[e._v(e._s(t.userName))]),e._v(" ("+e._s(t.allocationNumber?t.allocationNumber+"ไปถ":0)+") | ")])}),e._v(" "),o("i",{staticClass:"el-icon-edit",staticStyle:{color:"#48D462",cursor:"pointer"},on:{click:function(t){return e.openEditPerson(e.orderForm)}}})],2):e._e(),e._v(" "),1==e.orderForm.orderType?o("p",[e._v("\n ็ฅ่ฏไบงๆๅทฅ็จๅธ๏ผ"),e._l(e.userFlowList,function(t){return o("span",{on:{click:function(n){return e.handleShowConnectContentListPeople(t,2)}}},[o("span",{staticClass:"classPointer"},[e._v(e._s(t.userName))]),e._v(" ("+e._s(t.allocationNumber?t.allocationNumber+"ไปถ":0)+") | ")])}),e._v(" "),o("i",{staticClass:"el-icon-edit",staticStyle:{color:"#48D462",cursor:"pointer"},on:{click:function(t){return e.openEditPerson(e.orderForm)}}})],2):e._e(),e._v(" "),2==e.orderForm.orderType?o("p",[e._v("\n ่ดขๅกๅฎก่ฎกไบบๅ๏ผ"),e._l(e.userFlowList,function(t){return o("span",{on:{click:function(n){return e.handleShowConnectContentListPeople(t,3)}}},[o("span",{staticClass:"classPointer"},[e._v(e._s(t.userName))]),e._v(" ("+e._s(t.allocationNumber?t.allocationNumber+"ไปถ":0)+") | ")])}),e._v(" "),o("i",{staticClass:"el-icon-edit",staticStyle:{color:"#48D462",cursor:"pointer"},on:{click:function(t){return e.openEditPerson(e.orderForm)}}})],2):e._e()]),e._v(" "),o("el-col",{attrs:{span:4}},[o("span",[e._v("้กน็ฎๆๆๆ ธ็ฎๆฅๆ๏ผ"+e._s(null==e.orderForm.deductDate?"-":e.orderForm.deductDate))])])],1)],1)]),e._v(" "),o("el-card",{staticClass:"box-card cardCont"},[o("div",{staticClass:"headerTop",attrs:{slot:"header"},slot:"header"},[o("div",{staticClass:"headerLeft jiba"},[e._l(e.userFlowList,function(t,n){return o("span",{class:e.activeJiBa===n?"liucheng cur":"liucheng",on:{click:function(t){return e.jiabaTabHandle(n)}}},[e._v("ๆต็จ่ฟๅบฆ ("+e._s(t.userName)+")")])}),e._v(" "),o("span",{class:-1===e.activeJiBa?"conditionChoose conZhi cur":"conditionChoose conZhi",on:{click:function(t){return e.jiabaTabHandle(-1)}}},[e._v("่ตๆๆถ้")])],2),e._v(" "),-1===e.activeJiBa?o("el-button",{staticClass:"upload-order-file",on:{click:function(t){return e.addAnnexHandle(-1)}}},[e._v("ไธไผ ๅ
ถไป้ไปถ")]):e._e()],1),e._v(" "),e._l(e.userFlowList,function(t,r){return e.activeJiBa===r?o("div",{staticClass:"orderDetailCont"},[o("p",{staticClass:"tips"},[e._v("ไธๅ้ข่ฒๆ็คบ๏ผ\n "),o("span",{staticStyle:{color:"#FFA96A"}},[e._v("ๆฉ่ฒ๏ผ่กจ็คบๅทฒๅฎๆ")]),e._v("๏ผ\n "),o("span",{staticStyle:{color:"#ff3643"}},[e._v("็บข่ฒ๏ผ่กจ็คบๅฎกๆนไธ้่ฟ")]),e._v("๏ผ\n "),o("span",{staticStyle:{color:"#05AAFF"}},[e._v("่่ฒ๏ผ่กจ็คบ่ฟ่กไธญ")]),e._v("๏ผ\n "),o("span",{staticStyle:{color:"rgba(68, 68, 68, 0.4)"}},[e._v("็ฐ่ฒ๏ผ่กจ็คบๆชๅผๅง")])]),e._v(" "),""==t.orderProcessVoList?o("p",[e._v("ๆๆ ๆต็จ")]):o("el-row",{staticClass:"orderMsg"},[o("el-col",[o("div",{staticClass:"processContentData"},[o("div",{staticClass:"processCont"},[o("div",[o("div",{staticClass:"processFirstBox"},[o("div",{staticClass:"processStart"},[o("img",{attrs:{src:n("13t2"),alt:""}}),e._v(" "),o("span",[e._v(e._s(t.userName))]),e._v(" "),o("p",[e._v("ๅ้
ๆถ้ด:"+e._s(t.orderProcessVoList[0].signTime))]),e._v(" "),t.lastFlow[0].signTime?e._e():o("i",{staticClass:"el-icon-refresh-right",attrs:{title:"ๆคๅ"},on:{click:function(n){return e.withdrawProcess(t.orderProcessVoList)}}})]),e._v(" "),o("img",{staticClass:"processDown",attrs:{src:n("8NX8"),alt:""}})]),e._v(" "),o("div",{staticClass:"processHistory"},[""!=t.historyList?o("el-card",{staticClass:"box-card"},[o("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[o("span",[e._v("ๅๅฒ็ๆฌ")]),e._v(" "),o("i",{staticClass:"el-icon-arrow-down historyIcon",class:e.openOrCloseHistory?"closeIcon":"",on:{click:e.openOrClose}})]),e._v(" "),o("el-collapse-transition",[o("el-timeline",{directives:[{name:"show",rawName:"v-show",value:!e.openOrCloseHistory,expression:"!openOrCloseHistory"}],staticClass:"timeLine"},e._l(t.historyList,function(t){return o("el-timeline-item",{key:t.processId,attrs:{timestamp:t.time,placement:"top"}},[o("p",[e._v(e._s(t.text))])])}),1)],1)],1):e._e()],1)]),e._v(" "),o("div",{staticClass:"processCenter"},[e._l(t.orderProcessVoList,function(r,s){return o("div",{staticClass:"processBoxBig"},[o("div",{staticClass:"processBox",class:r.signTime?1==r.recheckResult?"processBoxOrgin":2==r.checkResult||2==r.recheckResult?"processBoxRed":r.signTime&&!r.sendTime?"processBoxBlue":r.signTime&&r.sendTime?"processBoxOrgin":"":"",attrs:{title:r.signTime?"":"ๅทฅไฝ่ฟๆชๅฐ่พพ่ฏฅ็ฏ่"}},[o("div",{staticClass:"processTit"},[o("span",[e._v(e._s(r.nodeName))]),e._v(" "),o("i",{staticClass:"icon iconfont icon-jiantou processClose",class:1==r.closePro?"closePro":"",on:{click:function(t){return e.closeProcess(r)}}})]),e._v(" "),o("div",{staticClass:"processBoxList",class:1==r.closePro?"closeProBox":""},[o("div",{staticClass:"proBoxData"},[o("span",[e._v("่ด่ดฃไบบ๏ผ")]),e._v(" "),o("p",[e._v(e._s(r.userName?r.userName:"-"))])]),e._v(" "),0==r.needCheck?o("div",{staticClass:"proBoxData"},[o("span",[e._v("ๅฎ้
ๅฎๆๆถ้ด๏ผ"+e._s(r.sendTime?r.sendTime:"-"))])]):e._e(),e._v(" "),1==r.needCheck?o("div",{staticClass:"proBoxData"},[o("span",[o("span",[e._v("ๅๅฎกๅฎๆๆถ้ด๏ผ"+e._s(r.checkTime?r.checkTime:"-"))])])]):e._e(),e._v(" "),1!=r.needRecheck&&2!=r.needRecheck||!r.recheckTime?e._e():o("div",{staticClass:"proBoxData"},[o("span",[e._v("ๅคๅฎกๅฎๆๆถ้ด๏ผ"+e._s(r.recheckTime?r.recheckTime:"-"))])]),e._v(" "),r.workingHours?o("div",{staticClass:"proBoxData"},[o("span",[e._v("ๅทฅๆถ๏ผ")]),e._v(" "),o("p",[e._v(e._s(r.workingHours))])]):e._e(),e._v(" "),r.workingRatio?o("div",{staticClass:"proBoxData"},[o("span",[e._v("ๅทฅไฝ้ๅ ๆฏไพ๏ผ")]),e._v(" "),o("p",[e._v(e._s(r.workingRatio))])]):e._e(),e._v(" "),1!=r.accessory&&1!=r.isMustUploadAccessory||!r.fileIds?e._e():o("div",{staticClass:"proBoxData"},[o("span",[e._v("้ไปถ๏ผ")]),e._v(" "),o("div",{staticStyle:{flex:"1"}},e._l(r.fileList,function(t){return o("div",{staticClass:"fileShow",on:{click:function(n){return e.downloadFile(t)}}},[o("p",[e._v(e._s(t.fileName))]),e._v(" "),o("el-icon",{staticClass:"el-icon-download"})],1)}),0)]),e._v(" "),o("div",{staticClass:"proBoxData"},[o("span",[e._v("่ฏ่ฎบ๏ผ")]),e._v(" "),o("div",{staticStyle:{flex:"1","text-align":"left"}},[e._l(r.commentVoList,function(t,n){return n<2&&0!=r.commentVoList.length?o("div",{staticClass:"commentBox",on:{click:function(t){return e.openCommentList(r)}}},[o("p",{attrs:{title:t.userComment}},[t.hasRead?e._e():o("span",{staticClass:"star",staticStyle:{float:"none",color:"#ff2f34","margin-left":"-7px"}},[e._v("*")]),e._v("\n "+e._s(t.userComment)+"\n ")]),e._v(" "),o("span",[e._v(e._s(t.commentTime))]),e._v(" "),o("span",[e._v(e._s(t.userName))])]):e._e()}),e._v(" "),0==r.commentVoList.length?o("span",[e._v("ๆๆ ่ฏ่ฎบ")]):e._e()],2),e._v(" "),r.signTime?o("i",{staticClass:"el-icon-chat-dot-square commentChat",attrs:{title:"่ฏ่ฎบ"},on:{click:function(t){return e.openCommentList(r)}}}):e._e()]),e._v(" "),1==r.needCheck&&r.checkComment&&1==r.opinion?o("div",{staticClass:"proBoxData"},[o("span",[e._v("ๅๅฎกๆ่ง๏ผ")]),e._v(" "),o("p",[e._v(e._s(r.checkComment))])]):e._e(),e._v(" "),1==r.needCheck&&r.checkResult?o("div",{staticClass:"processBtn"},[1==r.checkResult?o("el-icon",{staticClass:"el-icon-success"}):e._e(),e._v(" "),2==r.checkResult?o("el-icon",{staticClass:"el-icon-circle-close"}):e._e(),e._v(" "),o("span",[e._v("ๅๅฎก็ปๆ๏ผ"+e._s(0==r.checkResult?"ๆชๅฎก":1==r.checkResult?"ๅทฒๅฎก้่ฟ":2==r.checkResult?"ๅทฒๅฎกไธ้่ฟ":""))]),e._v(" "),1!=r.needRecheck||1!=r.checkResult||r.recheckResult&&0!=r.recheckResult?e._e():o("h4",[o("p",[o("el-icon",{staticClass:"el-icon-time"}),e._v("\n ็ญๅพ
\n "),o("span",{attrs:{title:r.reviewUserListString}},[e._v(e._s(r.reviewUserListString))]),e._v("\n ๅคๅฎก\n ")],1)]),e._v(" "),2!=r.needRecheck||2!=r.checkResult||r.recheckResult&&0!=r.recheckResult?e._e():o("h4",[o("p",[o("el-icon",{staticClass:"el-icon-time"}),e._v("\n ็ญๅพ
\n "),o("span",{attrs:{title:r.reviewUserListString}},[e._v(e._s(r.reviewUserListString))]),e._v("\n ๅคๅฎก\n ")],1),e._v(" "),2!=r.needRecheck||2!=r.checkResult||r.recheckResult?e._e():o("span",[e._v("็ญๅพ
้ขๅฏผๅคๅฎก")])])],1):e._e(),e._v(" "),0!=r.needRecheck&&r.recheckComment&&1==r.opinion?o("div",{staticClass:"proBoxData"},[o("span",[e._v("ๅคๅฎกๆ่ง๏ผ")]),e._v(" "),o("p",[e._v(e._s(r.recheckComment))])]):e._e(),e._v(" "),0!=r.needRecheck&&r.recheckResult&&0!=r.recheckResult?o("div",{staticClass:"processBtn"},[1==r.recheckResult?o("el-icon",{staticClass:"el-icon-success"}):e._e(),e._v(" "),2==r.recheckResult?o("el-icon",{staticClass:"el-icon-circle-close"}):e._e(),e._v(" "),o("span",[e._v("ๅคๅฎก็ปๆ๏ผ"+e._s(0==r.recheckResult?"ๆชๅฎก":1==r.recheckResult?"ๅทฒๅฎก้่ฟ":2==r.recheckResult?"ๅทฒๅฎกไธ้่ฟ":""))])],1):e._e(),e._v(" "),1==t.hasProcessOrderFisrtReview||1==t.hasProcessOrderReview?o("div",[1!=r.needCheck&&0==r.needRecheck||!r.signTime||r.sendTime?e._e():o("div",{staticClass:"processBtn"},[1!=r.needCheck||r.sendTime||r.checkResult||1!=t.hasProcessOrderFisrtReview||!e.allowFlowReview.twoAllow?e._e():o("el-button",{attrs:{size:"mini"},on:{click:function(n){return e.reviewBtn(t,r,s,1)}}},[e._v("ๅๅฎก")]),e._v(" "),1==r.needRecheck&&!r.sendTime&&r.checkResult&&1==r.checkResult&&!r.recheckResult&&1==t.hasProcessOrderReview&&e.allowProcessReview.twoAllow?o("el-button",{attrs:{size:"mini"},on:{click:function(n){return e.reviewBtn(t,r,s,2)}}},[e._v("ๅคๅฎก")]):e._e(),e._v(" "),2==r.needRecheck&&!r.sendTime&&r.checkResult&&2==r.checkResult&&!r.recheckResult&&1==t.hasProcessOrderReview&&e.allowProcessReview.twoAllow?o("el-button",{attrs:{size:"mini"},on:{click:function(n){return e.reviewBtn(t,r,s,2)}}},[e._v("ๅคๅฎก")]):e._e()],1)]):e._e(),e._v(" "),0==r.needCheck&&0==r.needRecheck&&r.signTime&&!r.sendTime&&1==t.hasProcessComplete&&e.allowFlowComplete.twoAllow?o("div",{staticClass:"processBtn"},[0!=r.needCheck||r.checkResult||r.sendTime?e._e():o("el-button",{attrs:{size:"mini"},on:{click:function(n){return e.completeBtn(t,r,s,3)}}},[e._v("ๅฎๆ")])],1):e._e(),e._v(" "),r.signTime&&r.userId==e.userId&&!t.endProcess?o("div",{staticClass:"processBtn"},[r.signTime&&r.sendTime&&t.orderProcessVoList[s+1]&&!t.orderProcessVoList[s+1].sendTime&&!t.orderProcessVoList[s+1].checkResult&&r.userId==e.userId?o("el-button",{attrs:{size:"mini"},on:{click:function(n){return e.retrieveProcess(t.orderProcessVoList[s+1])}}},[e._v("ๅๅ")]):e._e(),e._v(" "),r.signTime&&!r.sendTime&&0!=s?o("el-button",{attrs:{size:"mini"},on:{click:function(n){return e.returnBackOpen(r,t.orderProcessVoList)}}},[e._v("้ๅ")]):e._e()],1):e._e()])]),e._v(" "),s!=t.orderProcessVoList.length-1?o("img",{staticClass:"processDown",attrs:{src:n("8NX8"),alt:""}}):o("img",{staticClass:"processDown",attrs:{src:"#",alt:""}})])}),e._v(" "),o("div",{staticClass:"processEnd"},[t.lastFlow[0].signTime?e._e():o("img",{attrs:{src:n("huis")}}),e._v(" "),t.lastFlow[0].signTime&&t.lastFlow[0].sendTime?o("img",{attrs:{src:n("Ea42")}}):e._e(),e._v(" "),t.lastFlow[0].signTime?o("img",{attrs:{src:n("B1DZ")}}):e._e()])],2)])])])],1)],1):e._e()}),e._v(" "),-1===e.activeJiBa?o("div",{staticClass:"orderDetailCont"},[o("el-table",{staticStyle:{width:"100%"},attrs:{"row-class-name":e.tableRowClassName,data:e.collectDataList,border:""},on:{"row-click":e.onRowClick}},[o("el-table-column",{attrs:{type:"index",width:"50",label:"ๅบๅท"}}),e._v(" "),o("el-table-column",{attrs:{prop:"materialTypeName",label:"็ฑปๅๅ็งฐ"}}),e._v(" "),o("el-table-column",{attrs:{prop:"materialDesc",label:"่ฆๆฑๅคๆณจ"}}),e._v(" "),o("el-table-column",{attrs:{label:"้ไปถ"},scopedSlots:e._u([{key:"default",fn:function(t){return[o("ul",[e._l(t.row.fileIds,function(n,r){return o("li",{key:r},[e._v("\n "+e._s(r+1)+"."+e._s(n.fileName)+"\n "),o("span",{staticClass:"down",on:{click:function(t){return e.downFileHandle(n)}}},[e._v("ไธ่ฝฝ")]),e._v(" "),0!=t.row.orderId?o("span",{staticClass:"del",on:{click:function(o){return e.delListAnnex(t.row,n,r)}}},[e._v("ๅ ้ค")]):e._e()])}),e._v(" "),0!=t.row.orderId?o("li",{staticClass:"add-annex-btn",on:{click:function(n){return e.addAnnexHandle(t.row)}}},[e._v("ๆฐๅข้ไปถ")]):e._e()],2)]}}],null,!1,997071095)}),e._v(" "),o("el-table-column",{attrs:{label:"ๆจกๆฟ"},scopedSlots:e._u([{key:"default",fn:function(t){return[o("ul",e._l(t.row.templateFileList,function(t,n){return o("li",{key:n},[e._v("\n "+e._s(n+1)+"."+e._s(t.fileName)+" "),o("span",{staticClass:"donwn-file",on:{click:function(n){return e.downFileHandle(t)}}},[e._v("ไธ่ฝฝ")])])}),0)]}}],null,!1,1105775294)})],1)],1):e._e()],2),e._v(" "),o("div",{staticClass:"btnList"},[!e.isCheck&&e.allowUpdate.twoAllow?o("el-button",{attrs:{size:"small",type:"primary"},on:{click:e.submitOrder}},[e._v("็กฎๅฎ")]):e._e(),e._v(" "),o("el-button",{attrs:{size:"small"},on:{click:e.cancelSub}},[e._v("ๅๆถ")])],1)],1),e._v(" "),o("el-dialog",{attrs:{title:1==e.reviewForm.num?"ๅๅฎก":2==e.reviewForm.num?"ๅคๅฎก":"่ฏทๆจ้ๆฉ",visible:e.processialogVisible,width:"30%",center:""},on:{"update:visible":function(t){e.processialogVisible=t}}},[o("div",[o("el-form",{ref:"reviewForm",attrs:{model:e.reviewForm,rules:e.rules}},[o("span",{staticClass:"star",staticStyle:{left:"0","margin-left":"15px"}},[e._v("*")]),e._v(" "),1==e.reviewForm.nextHandlerType?o("div",[1==e.reviewForm.needCheck&&1==e.reviewForm.needRecheck&&e.reviewForm.signTime&&e.reviewForm.holdCheckResult&&1==e.reviewForm.recheckResult?o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[0==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.projectPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),1==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.patentPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),2==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.auditPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),4==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.personList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e()],1):e._e(),e._v(" "),1!=e.reviewForm.needCheck||2!=e.reviewForm.needRecheck||!e.reviewForm.signTime||1!=e.reviewForm.checkResult&&2!=e.reviewForm.holdCheckResult?e._e():o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[0==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.projectPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),1==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.patentPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),2==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.auditPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),4==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.personList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e()],1)],1):e._e(),e._v(" "),1==e.reviewForm.nextHandlerType&&(1==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck||0==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck)&&e.reviewForm.signTime?o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[0==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.projectPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),1==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.patentPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),2==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.auditPersonList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e(),e._v(" "),4==e.orderForm.orderType?o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.personList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1):e._e()],1):e._e(),e._v(" "),3==e.reviewForm.nextHandlerType?o("div",[1==e.reviewForm.needCheck&&1==e.reviewForm.needRecheck&&e.reviewForm.signTime&&e.reviewForm.holdCheckResult?o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[o("el-select",{attrs:{filterable:"",placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.deptUserList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1)],1):e._e(),e._v(" "),1!=e.reviewForm.needCheck||2!=e.reviewForm.needRecheck||!e.reviewForm.signTime||1!=e.reviewForm.checkResult&&2!=e.reviewForm.holdCheckResult?e._e():o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[o("el-select",{attrs:{filterable:"",placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.deptUserList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1)],1)],1):e._e(),e._v(" "),3==e.reviewForm.nextHandlerType&&(1==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck||0==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck)&&e.reviewForm.signTime?o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[o("el-select",{attrs:{filterable:"",placeholder:"่ฏท้ๆฉ",size:"small",clearable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.deptUserList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1)],1):e._e(),e._v(" "),4==e.reviewForm.nextHandlerType?o("div",[1==e.reviewForm.needCheck&&1==e.reviewForm.needRecheck&&e.reviewForm.signTime&&e.reviewForm.holdCheckResult?o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.roleUserList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1)],1):e._e(),e._v(" "),1!=e.reviewForm.needCheck||2!=e.reviewForm.needRecheck||!e.reviewForm.signTime||2!=e.reviewForm.holdCheckResult&&1!=e.reviewForm.checkResult?e._e():o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.roleUserList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1)],1)],1):e._e(),e._v(" "),4==e.reviewForm.nextHandlerType&&(1==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck||0==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck)&&e.reviewForm.signTime?o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[o("el-select",{attrs:{placeholder:"่ฏท้ๆฉ",size:"small",clearable:"",filterable:""},model:{value:e.reviewForm.nextNodeUserId,callback:function(t){e.$set(e.reviewForm,"nextNodeUserId",t)},expression:"reviewForm.nextNodeUserId"}},e._l(e.roleUserList,function(e){return o("el-option",{key:e.userId,attrs:{label:e.userName,value:e.userId}})}),1)],1):e._e(),e._v(" "),1==e.reviewForm.num||2==e.reviewForm.num?o("span",{staticClass:"star",staticStyle:{left:"0","margin-left":"15px"}},[e._v("*")]):e._e(),e._v(" "),1==e.reviewForm.num||2==e.reviewForm.num?o("el-form-item",{attrs:{label:"็ปๆ๏ผ"}},[1==e.reviewForm.num?o("div",[o("el-radio",{attrs:{label:"1"},model:{value:e.reviewForm.checkResult,callback:function(t){e.$set(e.reviewForm,"checkResult",t)},expression:"reviewForm.checkResult"}},[e._v("้่ฟ")]),e._v(" "),o("el-radio",{attrs:{label:"2"},model:{value:e.reviewForm.checkResult,callback:function(t){e.$set(e.reviewForm,"checkResult",t)},expression:"reviewForm.checkResult"}},[e._v("ไธ้่ฟ")])],1):e._e(),e._v(" "),2==e.reviewForm.num?o("div",[o("el-radio",{attrs:{label:"1"},on:{change:e.recheckReChange},model:{value:e.reviewForm.recheckResult,callback:function(t){e.$set(e.reviewForm,"recheckResult",t)},expression:"reviewForm.recheckResult"}},[e._v("้่ฟ")]),e._v(" "),o("el-radio",{attrs:{label:"2"},on:{change:e.recheckReChange},model:{value:e.reviewForm.recheckResult,callback:function(t){e.$set(e.reviewForm,"recheckResult",t)},expression:"reviewForm.recheckResult"}},[e._v("ไธ้่ฟ")])],1):e._e()]):e._e(),e._v(" "),1==e.reviewForm.needCheck&&1==e.reviewForm.needRecheck?o("div",[1==e.reviewForm.goToType&&e.reviewForm.signTime&&1==e.reviewForm.holdRecheckResult&&1==e.reviewForm.recheckResult?o("span",{staticClass:"star",staticStyle:{left:"0","margin-left":"15px"}},[e._v("*")]):e._e(),e._v(" "),1==e.reviewForm.goToType&&e.reviewForm.signTime&&1==e.reviewForm.holdRecheckResult&&1==e.reviewForm.recheckResult?o("el-form-item",{attrs:{label:"่ทณ่ฝฌ็ฏ่๏ผ"}},[o("el-radio-group",{on:{change:e.goToNodeChange},model:{value:e.reviewForm.goToNodeId,callback:function(t){e.$set(e.reviewForm,"goToNodeId",t)},expression:"reviewForm.goToNodeId"}},e._l(e.flowList,function(t){return o("el-radio",{key:t.nodeId,attrs:{label:t.nodeId}},[e._v(e._s(t.nodeName))])}),1)],1):e._e(),e._v(" "),2==e.reviewForm.goToType&&e.reviewForm.signTime&&2==e.reviewForm.checkResult?o("span",{staticClass:"star",staticStyle:{left:"0","margin-left":"15px"}},[e._v("*")]):e._e(),e._v(" "),2==e.reviewForm.goToType&&e.reviewForm.signTime&&2==e.reviewForm.checkResult?o("el-form-item",{attrs:{label:"่ทณ่ฝฌ็ฏ่๏ผ"}},[o("el-radio-group",{on:{change:e.goToNodeChange},model:{value:e.reviewForm.goToNodeId,callback:function(t){e.$set(e.reviewForm,"goToNodeId",t)},expression:"reviewForm.goToNodeId"}},e._l(e.flowList,function(t){return o("el-radio",{key:t.nodeId,attrs:{label:t.nodeId}},[e._v(e._s(t.nodeName))])}),1)],1):e._e()],1):e._e(),e._v(" "),1==e.reviewForm.needCheck&&2==e.reviewForm.needRecheck?o("div",[1==e.reviewForm.goToType&&e.reviewForm.signTime&&1==e.reviewForm.checkResult?o("span",{staticClass:"star",staticStyle:{left:"0","margin-left":"15px"}},[e._v("*")]):e._e(),e._v(" "),1==e.reviewForm.goToType&&e.reviewForm.signTime&&1==e.reviewForm.checkResult?o("el-form-item",{attrs:{label:"่ทณ่ฝฌ็ฏ่๏ผ"}},[o("el-radio-group",{on:{change:e.goToNodeChange},model:{value:e.reviewForm.goToNodeId,callback:function(t){e.$set(e.reviewForm,"goToNodeId",t)},expression:"reviewForm.goToNodeId"}},e._l(e.flowList,function(t){return o("el-radio",{key:t.nodeId,attrs:{label:t.nodeId}},[e._v(e._s(t.nodeName))])}),1)],1):e._e(),e._v(" "),1==e.reviewForm.goToType&&e.reviewForm.signTime&&2==e.reviewForm.checkResult&&1==e.reviewForm.recheckResult?o("span",{staticClass:"star",staticStyle:{left:"0","margin-left":"15px"}},[e._v("*")]):e._e(),e._v(" "),1==e.reviewForm.goToType&&e.reviewForm.signTime&&2==e.reviewForm.checkResult&&1==e.reviewForm.recheckResult?o("el-form-item",{attrs:{label:"่ทณ่ฝฌ็ฏ่๏ผ"}},[o("el-radio-group",{on:{change:e.goToNodeChange},model:{value:e.reviewForm.goToNodeId,callback:function(t){e.$set(e.reviewForm,"goToNodeId",t)},expression:"reviewForm.goToNodeId"}},e._l(e.flowList,function(t){return o("el-radio",{key:t.nodeId,attrs:{label:t.nodeId}},[e._v(e._s(t.nodeName))])}),1)],1):e._e(),e._v(" "),2==e.reviewForm.goToType&&e.reviewForm.signTime&&2==e.reviewForm.checkResult&&2==e.reviewForm.recheckResult?o("span",{staticClass:"star",staticStyle:{left:"0","margin-left":"15px"}},[e._v("*")]):e._e(),e._v(" "),2==e.reviewForm.goToType&&e.reviewForm.signTime&&2==e.reviewForm.checkResult&&2==e.reviewForm.recheckResult?o("el-form-item",{attrs:{label:"่ทณ่ฝฌ็ฏ่๏ผ"}},[o("el-radio-group",{on:{change:e.goToNodeChange},model:{value:e.reviewForm.goToNodeId,callback:function(t){e.$set(e.reviewForm,"goToNodeId",t)},expression:"reviewForm.goToNodeId"}},e._l(e.flowList,function(t){return o("el-radio",{key:t.nodeId,attrs:{label:t.nodeId}},[e._v(e._s(t.nodeName))])}),1)],1):e._e()],1):e._e(),e._v(" "),1==e.reviewForm.goToType&&1==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck&&e.reviewForm.signTime||2==e.reviewForm.goToType&&1==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck&&e.reviewForm.signTime&&2==e.reviewForm.checkResult?o("span",{staticClass:"star",staticStyle:{left:"0","margin-left":"15px"}},[e._v("*")]):e._e(),e._v(" "),1==e.reviewForm.goToType&&1==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck&&e.reviewForm.signTime||2==e.reviewForm.goToType&&1==e.reviewForm.needCheck&&0==e.reviewForm.needRecheck&&e.reviewForm.signTime&&2==e.reviewForm.checkResult?o("el-form-item",{attrs:{label:"่ทณ่ฝฌ็ฏ่๏ผ"}},[o("el-radio-group",{on:{change:e.goToNodeChange},model:{value:e.reviewForm.goToNodeId,callback:function(t){e.$set(e.reviewForm,"goToNodeId",t)},expression:"reviewForm.goToNodeId"}},e._l(e.flowList,function(t){return o("el-radio",{key:t.nodeId,attrs:{label:t.nodeId}},[e._v(e._s(t.nodeName))])}),1)],1):e._e(),e._v(" "),1==e.reviewForm.opinion?o("el-form-item",{attrs:{label:"ๆ่ง๏ผ"}},[1==e.reviewForm.num?o("el-input",{attrs:{type:"textarea",row:3},model:{value:e.reviewForm.checkComment,callback:function(t){e.$set(e.reviewForm,"checkComment",t)},expression:"reviewForm.checkComment"}}):e._e(),e._v(" "),2==e.reviewForm.num?o("el-input",{attrs:{type:"textarea",row:3},model:{value:e.reviewForm.recheckComment,callback:function(t){e.$set(e.reviewForm,"recheckComment",t)},expression:"reviewForm.recheckComment"}}):e._e()],1):e._e(),e._v(" "),1==e.reviewForm.isMustUploadAccessory&&1==e.reviewForm.checkResult&&1==e.reviewForm.num?o("span",{staticClass:"star",staticStyle:{left:"0","margin-left":"15px"}},[e._v("*")]):e._e(),e._v(" "),1==e.reviewForm.accessory||1==e.reviewForm.isMustUploadAccessory?o("el-form-item",{attrs:{label:"้ไปถ๏ผ"}},[1==e.reviewForm.num||2==e.reviewForm.num?o("el-upload",{ref:"upload",staticClass:"upload-demo",attrs:{"http-request":e.handlePoliceUpload,"on-remove":e.delUploadFileHandle,"on-preview":e.downFileHandle,action:"","file-list":e.fileList,"show-file-list":!0}},[o("el-button",{attrs:{size:"small",type:"primary"}},[e._v("็นๅปไธไผ ")])],1):e._e(),e._v(" "),e._l(e.reviewForm.fileList,function(t){return o("span",{staticStyle:{cursor:"pointer"},on:{click:function(n){return e.downloadFile(t)}}},[e._v(e._s(t.fileName+"."+t.fileType)),o("el-icon",{staticClass:"el-icon-download"})],1)})],2):e._e()],1)],1),e._v(" "),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:e.cancelSubmit}},[e._v("ๅ ๆถ")]),e._v(" "),1==e.reviewForm.num?o("el-button",{attrs:{type:"primary",loading:e.recheckLoading},on:{click:e.checkResultSubmit}},[e._v("็กฎ ๅฎ")]):e._e(),e._v(" "),2==e.reviewForm.num?o("el-button",{attrs:{type:"primary",loading:e.recheckLoading},on:{click:e.recheckResultSubmit}},[e._v("็กฎ ๅฎ")]):e._e(),e._v(" "),3==e.reviewForm.num?o("el-button",{attrs:{type:"primary",loading:e.recheckLoading},on:{click:e.completeSubmit}},[e._v("็กฎ ๅฎ")]):e._e()],1)]),e._v(" "),o("el-dialog",{attrs:{title:"่ฏ่ฎบ",visible:e.commentDialog,width:"50%",center:""},on:{"update:visible":function(t){e.commentDialog=t}}},[o("div",{staticClass:"commentList"},[e._l(e.commentList,function(t){return 0!=e.commentList.length?o("div",{staticClass:"commentData"},[t.hasRead?e._e():o("span",{staticClass:"star",staticStyle:{float:"none",color:"#ff2f34","margin-left":"-7px"}},[e._v("*")]),e._v(" "),o("div",{staticClass:"commentDit"},[o("span",[e._v(e._s(t.userName))]),e._v(" "),o("span",{staticStyle:{color:"#1e6abc"}},[e._v(e._s(t.commentTime))])]),e._v(" "),o("p",[e._v(e._s(t.userComment))]),e._v(" "),t.operationFlag?o("div",{staticClass:"commentDit"},[o("span",{staticStyle:{color:"#ff3738"},on:{click:function(n){return e.deleteComment(t)}}},[e._v("ๅ ้ค")])]):e._e(),e._v(" "),o("div",{staticClass:"commentDit"},e._l(t.fileList,function(t){return o("div",{staticClass:"fileShow",on:{click:function(n){return e.downloadFile(t)}}},[o("p",[e._v(e._s(t.fileName+"."+t.fileType))]),e._v(" "),o("el-icon",{staticClass:"el-icon-download"})],1)}),0)]):e._e()}),e._v(" "),0==e.commentList.length?o("p",{staticStyle:{"text-align":"center"}},[e._v("ๆๆ ่ฏ่ฎบ")]):e._e()],2),e._v(" "),o("div",{staticClass:"commontSubmit"},[o("span",{staticClass:"star",staticStyle:{"margin-left":"-7px"}},[e._v("*")]),e._v(" "),o("span",[e._v("่ฏ่ฎบๆ่ง๏ผ")]),e._v(" "),o("el-input",{attrs:{type:"textarea",rows:4,maxlength:"1900"},model:{value:e.addCommentForm.userComment,callback:function(t){e.$set(e.addCommentForm,"userComment",t)},expression:"addCommentForm.userComment"}})],1),e._v(" "),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:e.closeComment}},[e._v("ๅ ๆถ")]),e._v(" "),o("el-button",{attrs:{type:"primary"},on:{click:e.addComment}},[e._v("็กฎ ๅฎ")])],1)]),e._v(" "),o("el-dialog",{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"}],staticClass:"upload-modal",attrs:{title:"ไธไผ ้ไปถ",visible:e.uploadFileModal,width:"40%","before-close":e.cananlUploadFile,center:""},on:{"update:visible":function(t){e.uploadFileModal=t}}},[o("div",[o("el-form",{ref:"annexParams",attrs:{model:e.uploadAnnexParams,rules:e.annexRule}},[2==e.reviewForm.nextHandlerType?o("el-form-item",{attrs:{label:"ๆๅฎไธไธ็ฏ่ๅค็ไบบ๏ผ"}},[o("span",[e._v(e._s(e.reviewForm.nextNodeUserName))])]):e._e(),e._v(" "),o("el-form-item",{attrs:{label:"็ฑปๅๅ็งฐ๏ผ",prop:"materialType"}},[o("el-select",{attrs:{disabled:e.isFileClick},model:{value:e.uploadAnnexParams.materialType,callback:function(t){e.$set(e.uploadAnnexParams,"materialType",t)},expression:"uploadAnnexParams.materialType"}},e._l(e.annexTypeData,function(e){return o("el-option",{key:e.dictId,attrs:{value:e.dictId,label:e.dictName}})}),1)],1),e._v(" "),o("el-form-item",{attrs:{label:"่ฆๆฑๅคๆณจ๏ผ"}},[o("el-input",{staticClass:"need-remark",attrs:{type:"textarea",resize:"none",row:6},model:{value:e.uploadAnnexParams.materialDesc,callback:function(t){e.$set(e.uploadAnnexParams,"materialDesc",t)},expression:"uploadAnnexParams.materialDesc"}})],1),e._v(" "),o("el-form-item",{staticClass:"upload-file",attrs:{label:"ใ"}},[o("div",{staticStyle:{width:"82px",color:"#606266","padding-top":"5px"}},[o("span",{staticStyle:{color:"#F56C6C","margin-right":"4px"}},[e._v("*")]),e._v("้ไปถ๏ผ\n ")]),e._v(" "),o("div",[o("el-upload",{ref:"upload",staticClass:"upload-box upload-box-width",staticStyle:{display:"inline-block",width:"100%"},attrs:{"http-request":e.handlePoliceUpload,"on-remove":e.delUploadFileHandle,"on-preview":e.downFileHandle,action:"","file-list":e.anFilesList,"show-file-list":!0}},[o("el-button",{attrs:{size:"small",type:"primary"}},[e._v("็นๅปไธไผ ")])],1)],1)])],1)],1),e._v(" "),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:e.cananlUploadFile}},[e._v("ๅ ๆถ")]),e._v(" "),o("el-button",{attrs:{type:"primary"},on:{click:e.setAnnexHandle}},[e._v("็กฎ ๅฎ")])],1)]),e._v(" "),o("el-dialog",{attrs:{title:"ๆๆดพๅค็ไบบ",visible:e.personDialogVisible,width:"45%"},on:{"update:visible":function(t){e.personDialogVisible=t}}},[e.applyNumTotal>1?o("div",{staticClass:"assignEngineer"},[o("div",{staticClass:"assignNumAndRig"},[o("span",[e._v("ๆปๆฐ้๏ผ"+e._s(e.applyNumTotal))]),e._v(" "),o("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.addNewAssign}},[e._v("ๆฐๅขๆๆดพ")])],1),e._v(" "),e._l(e.assignForm.assignUserList,function(t,n){return o("div",{staticClass:"assignBox"},[o("div",[o("span",[e._v("ๅค็ไบบ๏ผ")]),e._v(" "),o("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"่ฏท้ๆฉ",filterable:"",clearable:"",size:"small",disabled:0==t.processIsOverState},model:{value:t.userId,callback:function(n){e.$set(t,"userId",n)},expression:"item.userId"}},e._l(e.personList,function(t){return o("el-option",{key:t.userId,attrs:{label:t.userName+"_"+t.deptName+"-"+t.roleName+(-1==e.assignForm.contractState&&1==t.stateNum?"(ๅจ่)":-1==e.assignForm.contractState&&2==t.stateNum?"(็ฆป่)":""),value:t.userId}})}),1)],1),e._v(" "),o("div",[o("span",[e._v("ๆฐ้๏ผ")]),e._v(" "),o("el-input",{staticStyle:{flex:"1"},attrs:{size:"small",disabled:0==t.processIsOverState},nativeOn:{input:function(t){return e.inputXz(t)}},model:{value:t.allocationNumber,callback:function(n){e.$set(t,"allocationNumber",n)},expression:"item.allocationNumber"}})],1),e._v(" "),4==e.assignForm.orderType?o("div",[o("span",[e._v("ๆต็จ๏ผ")]),e._v(" "),t.notExistence?o("span",[e._v(e._s(t.flowName))]):o("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"่ฏท้ๆฉๆต็จ",size:"small",clearable:"",disabled:0==t.processIsOverState},model:{value:t.flowId,callback:function(n){e.$set(t,"flowId",n)},expression:"item.flowId"}},e._l(e.flowList,function(e){return o("el-option",{key:e.flowId,attrs:{label:e.flowName,value:e.flowId}})}),1)],1):e._e(),e._v(" "),0!=t.processIsOverState&&!t.processIsOverState||1==t.processIsOverState?o("i",{staticClass:"el-icon-delete-solid",on:{click:function(o){return e.deleteAssignBox(t,n)}}}):e._e()])})],2):e._e(),e._v(" "),1==e.applyNumTotal&&4==e.assignForm.orderType?o("div",{staticClass:"assignEngineer"},[o("div",{staticClass:"assignNumAndRig"},[o("span",[e._v("ๆปๆฐ้๏ผ"+e._s(e.applyNumTotal))]),e._v(" "),o("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.addNewAssign}},[e._v("ๆฐๅขๆๆดพ")])],1),e._v(" "),e._l(e.assignForm.assignUserList,function(t,n){return o("div",{staticClass:"assignBox"},[o("div",[o("span",[e._v("ๅค็ไบบ๏ผ")]),e._v(" "),o("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"่ฏท้ๆฉ",filterable:"",clearable:"",size:"small",disabled:0==t.processIsOverState},model:{value:t.userId,callback:function(n){e.$set(t,"userId",n)},expression:"item.userId"}},e._l(e.personList,function(t){return o("el-option",{key:t.userId,attrs:{label:t.userName+"_"+t.deptName+"-"+t.roleName+(-1==e.assignForm.contractState&&1==t.stateNum?"(ๅจ่)":-1==e.assignForm.contractState&&2==t.stateNum?"(็ฆป่)":""),value:t.userId}})}),1)],1),e._v(" "),o("div",[o("span",[e._v("ๆฐ้๏ผ")]),e._v(" "),o("el-input",{staticStyle:{flex:"1"},attrs:{size:"small",disabled:0==t.processIsOverState},nativeOn:{input:function(t){return e.inputXz(t)}},model:{value:t.allocationNumber,callback:function(n){e.$set(t,"allocationNumber",n)},expression:"item.allocationNumber"}})],1),e._v(" "),4==e.assignForm.orderType?o("div",[o("span",[e._v("ๆต็จ๏ผ")]),e._v(" "),t.notExistence?o("span",[e._v(e._s(t.flowName))]):o("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"่ฏท้ๆฉๆต็จ",size:"small",clearable:"",disabled:0==t.processIsOverState},model:{value:t.flowId,callback:function(n){e.$set(t,"flowId",n)},expression:"item.flowId"}},e._l(e.flowList,function(e){return o("el-option",{key:e.flowId,attrs:{label:e.flowName,value:e.flowId}})}),1)],1):e._e(),e._v(" "),0!=t.processIsOverState&&!t.processIsOverState||1==t.processIsOverState?o("i",{staticClass:"el-icon-delete-solid",on:{click:function(o){return e.deleteAssignBox(t,n)}}}):e._e()])})],2):e._e(),e._v(" "),4==e.assignForm.orderType?o("p",{staticStyle:{"margin-top":"15px",color:"red"}},[e._v("ๆ็คบ๏ผๅค็ไบบ่ง่ฒๅฟ
้กปๅฏนๅบๆๅฎๆต็จ๏ผไพๅฆๅค็ไบบๆฏ้กน็ฎๅ๏ผๆต็จๅฟ
้กปๆฏ้กน็ฎๆต็จ๏ผ่ฏทไป็ปๆฃๆฅ๏ผ")]):e._e(),e._v(" "),1==e.applyNumTotal&&4!=e.assignForm.orderType?o("div",{staticStyle:{display:"flex","align-items":"center"}},[o("span",{staticStyle:{"margin-right":"10px"}},[e._v("ๆๆดพ"+e._s(0==e.personNum?"้กน็ฎๅทฅ็จๅธ":2==e.personNum?"ๅฎก่ฎกๅ":1==e.personNum?"็ฅ่ฏไบงๆๅทฅ็จๅธ":"-"))]),e._v(" "),o("el-select",{staticStyle:{flex:"1"},attrs:{placeholder:"่ฏท้ๆฉ",filterable:"",clearable:""},model:{value:e.personId,callback:function(t){e.personId=t},expression:"personId"}},e._l(e.personList,function(t){return o("el-option",{key:t.userId,attrs:{label:t.userName+"_"+t.deptName+"-"+t.roleName+(-1==e.assignForm.contractState&&1==t.stateNum?"(ๅจ่)":-1==e.assignForm.contractState&&2==t.stateNum?"(็ฆป่)":""),value:t.userId}})}),1)],1):e._e(),e._v(" "),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:e.cancelAssignDig}},[e._v("ๅ ๆถ")]),e._v(" "),o("el-button",{attrs:{type:"primary"},on:{click:e.editPerson}},[e._v("็กฎ ๅฎ")])],1)]),e._v(" "),o("el-dialog",{attrs:{title:"้ๅ",visible:e.sendBackDialog,width:"50%",center:""},on:{"update:visible":function(t){e.sendBackDialog=t}}},[o("div",{staticClass:"backProcessList"},[o("span",[o("i",{staticStyle:{color:"red","margin-right":"3px"}},[e._v("*")]),e._v("้ๅ็ฏ่๏ผ")]),e._v(" "),o("el-radio-group",{model:{value:e.sendBackForm.targetSkipProcessId,callback:function(t){e.$set(e.sendBackForm,"targetSkipProcessId",t)},expression:"sendBackForm.targetSkipProcessId"}},e._l(e.sendBackForm.sendList,function(t){return o("el-radio",{key:t.processId,attrs:{label:t.processId}},[e._v(e._s(t.nodeName))])}),1)],1),e._v(" "),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:e.closeSendBack}},[e._v("ๅ ๆถ")]),e._v(" "),o("el-button",{attrs:{type:"primary"},on:{click:e.returnBackProcess}},[e._v("็กฎ ๅฎ")])],1)]),e._v(" "),o("el-dialog",{staticClass:"chat-modal",attrs:{title:"่ท่ฟๆถๆฏ",visible:e.ConnectContentDialogVisible,width:"40%"},on:{"update:visible":function(t){e.ConnectContentDialogVisible=t}}},[o("div",{staticClass:"dialog-box"},[o("div",{ref:"dialog",staticClass:"dialog"},[e.isShowMoreNews?o("div",{staticClass:"has-more-news",on:{click:e.getMore}},[o("span",[e._v("ๆฅ็ๆดๅคๆถๆฏ")])]):o("div",{staticClass:"has-more-news not_more"},[e._v("ๆฒกๆๅคๆถๆฏไบ")]),e._v(" "),o("div",{staticClass:"connect-div"},[e._l(e.chatData,function(t){return["left"===t.msgPosition?o("div",{staticClass:"left-massage"},[o("div",{staticClass:"title"},[o("div",{staticClass:"pic"},[e._v(e._s(e._f("titleSize")(t.userName)))]),e._v(" "),o("div",{staticClass:"text"},[e._v(e._s(t.userName))]),e._v(" "),o("div",{staticClass:"time"},[e._v(e._s(t.sendTime))])]),e._v(" "),o("div",{staticClass:"content"},[e._v("\n "+e._s(t.chatContent)+"\n ")]),e._v(" "),t.appFileVoList&&0!==t.appFileVoList.length?e._l(t.appFileVoList,function(t){return o("div",{key:t.fileId,staticClass:"down-content"},[e._v("\n ้ไปถ๏ผ"+e._s(t.fileName)+"."+e._s(t.fileType)+"\n "),o("button",{staticClass:"down-btn",on:{click:function(n){return e.downHandle(t.fileUrl)}}},[e._v("ไธ่ฝฝ")])])}):e._e()],2):e._e(),e._v(" "),"right"===t.msgPosition?o("div",{staticClass:"right-massage"},[o("div",{staticClass:"title"},[o("img",{staticClass:"del-icon",attrs:{src:e.del_icon},on:{click:function(n){return e.delChat(t)}}}),e._v(" "),o("div",{staticClass:"time"},[e._v(e._s(t.sendTime))]),e._v(" "),o("div",{staticClass:"text"},[e._v(e._s(t.userName))]),e._v(" "),o("div",{staticClass:"pic"},[e._v(e._s(e._f("titleSize")(t.userName)))])]),e._v(" "),o("div",{staticClass:"content"},[e._v("\n "+e._s(t.chatContent)+"\n ")]),e._v(" "),t.appFileVoList&&0!==t.appFileVoList.length?e._l(t.appFileVoList,function(t){return o("div",{key:t.fileId,staticClass:"down-content"},[e._v("\n ้ไปถ๏ผ"+e._s(t.fileName)+e._s(t.fileType)+"\n "),o("button",{directives:[{name:"preventReClick",rawName:"v-preventReClick"}],staticClass:"down-btn",on:{click:function(n){return e.downHandle(t.fileUrl)}}},[e._v("ไธ่ฝฝ")])])}):e._e()],2):e._e()]})],2)]),e._v(" "),o("div",{ref:"dialogInput",staticClass:"dialog-input"},[o("el-input",{staticClass:"text-input",attrs:{autofocus:"true",type:"textarea",autosize:{minRows:3,maxRows:3},placeholder:"่พๅ
ฅๆฒ้ๅ
ๅฎน..."},nativeOn:{keydown:function(t){return e.handleKeyCode(t)}},model:{value:e.chatContent,callback:function(t){e.chatContent=t},expression:"chatContent"}}),e._v(" "),o("div",{staticClass:"btn-group"},[o("div",{staticClass:"dialog-footer",staticStyle:{width:"50%"},attrs:{slot:"footer"},slot:"footer"},[o("el-upload",{staticClass:"upload-box upload-box-width",attrs:{action:"#","auto-upload":!1,"file-list":e.fileTemp,"on-remove":e.handleRemove,"on-change":e.fileChange}},[o("el-button",{staticClass:"update-files-btn",attrs:{type:"info"}},[e._v("้ไปถไธไผ "),o("i",{staticClass:"el-icon-upload el-icon--right"})])],1)],1),e._v(" "),o("div",{staticStyle:{display:"flex","align-items":"center"}},[o("span",{staticClass:"send-tap"},[e._v("Enterๅ้๏ผCtrl+Enterๆข่ก")]),e._v(" "),o("el-button",{staticClass:"send-btn",attrs:{type:"primary"},on:{click:e.sendData}},[e._v("ๅ ้")])],1)])],1)])])],1)},staticRenderFns:[]};var g=n("VU/8")(C,v,!1,function(e){n("Qw0A")},"data-v-113b061f",null);t.default=g.exports},Qw0A:function(e,t,n){var o=n("kXUw");"string"==typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals);n("rjj0")("c18a091a",o,!0)},huis:function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHEAAABGCAYAAAD7AXvFAAAABHNCSVQICAgIfAhkiAAADPlJREFUeF7tXQlwlFUS/vqfGQgICLJJNBASMJAwCRJikENYDYcLSImcxSWiQBXreq2Ku6vWllvuBe6u4FYt4goEOQ0lK7VcIteusAqSQEJCIAcwJJCEEO57JtNb/cOEmWQyR/L/ITOxqyjg//v1e6+/v9/rfq/fG8KP5FYD58+f72m1Wp8komgAocwcSkQ/ufNv+ZuI6BwznyOicgCFRFTAzLlGozGrXbt2JxpKtdRQFQVCPWfPnh3NzOMBDAfQtj5tZuYyAP9TFGWHwWBY0a5duwv1keepbJMH8cyZMzHMPAfAFCK6Ty9FA1gH4J9hYWFbtK6jyYJYUVHRt7KyUsAbo7VSvcjLBfB+WFhYmlb1NjkQy8vLU5j5dwAGaqXEushh5iwAL4WHh++pS3nnMk0GRGZuWVZWtoCIZtZXaRqWZwDLWrRo8VabNm0q6iq3SYBYWlraB8BqIupcV0XpWY6ZK4hoSnh4+Nd1qSfoQSwrK3uLmf8IwFQXBTVgGSaieWFhYe8SUaU/9QY1iKWlpeIRjvZHIY2Ad6vdbh8dERFxzde2BCWI5eXlrW02mwxN/XxVRGPiY+aDRPTUQw89JIsIXinoQBQArVbrf4iol9feN26GY4qi9A8PD5dFA48UVCAyc7OSkpLtRDTAW8cD5H220WjsHxoaetlTe4MKxFOnTn1BRBMCBCBfm7k7IiLCY0wbNCCePn36PQAf+KqZ+vCVlpbi5s2bCA8PR0hISH1E+Vr2o4iIiDdqYw4KEIuLi0cS0b991Yi/fDdu3MD+/fuRl5eHM2fOuBRv1qwZunXrhh49eiAqKspf0T7zE9HwiIgIt+uuAQ9iUVHRA4qiHJEtIp814gfjvn37sHv3bty6dctrqYSEBAwZMkQv66xQFKW7O481GEBcIasdXjVcB4aNGzfi0KFDfpUMCwvDiBEj8OCDD/pVzhdmZl4ZGRk5tTpvQIN4+vTpgXa7/b++KMBfnroA6KhDgJw8ebIuFklEQzt06LDNuT8BDWJxcbHsAPT3FyBv/DL3rVsniz3uqWvXruoc6IlH3j/99NPeqqrL+7yOHTvGBgWIRUVFIwBsrIsWvJVZuHAhLl26VINNLEwcm/79+2PgwIGYO3cu2rRpo/K5458+fbrqwepAYyMjI6u+soC1xKKiIl2s0GKxYM2aNTX0PmjQIPTu3RurV69Gx44dq0CcOHGiCpQ8r+65iqOjkzX+EBkZ+ZijkQEJ4qlTp5IqKyvTdfjCsW3bNmRkZLiIjomJwZgxY1QnZ/PmzaolDhgwAPPmzVMtUYCUeHHRokVq/OggeTd79mw9mglmHhAVFaVuKAckiBaLZTkR1fDStNCWWFRRUZGLqOeffx7NmzfHp59+qj53BlH+HxkZiUmTJmHTpk3Izs52Kfv2229r0awaMpj5s6ioqFkBCeLx48dDiOg8EemyVCJDaXUQ58yZo8aK3333narMpKQkDB48GB9++GGVcl955RXk5+djyxbXeHzatGl6zYtX7HZ7aOfOnW8EnCWeOHFCstJW6PJ5A+p86A1EqTs0NBTl5Xd3igQsWdlJS3PNf5o1axbatq1X9qOnrk6IiopaG3AgWiyWrwCM0gtECRsKCwtdxIuVCbBffSVV1yQZal999VUXa3VwiRXrRcy8JDo6ekbAgXj8+PFLRNRaL8XIGunOnTtdxKekpCA5OdmtlQrj8OHDIZ6oODbOoYaEJDKf6kiF0dHRMQEFosViMTNzjo5KwcWLF6scGEc9YmkO50YAdjgv4n1K6CHBvyfw9WyvoigdGjWIvbdxFwVotXcISY4mTp48mWyz2WTT93aErRNJGJGT4/qtCGDDhg1Dp06datQqAO7atcvluYQcM2fO1GXpzbkiIhrXqEHss5UrQHiAgS1EeHPvEDosuxY2m02y18S9VvTAUaxx+fLlqqNSnSRmlGFSSN4XFBS4Xa0ZNWqUaqF6EzP/9i6Ia7ibyYB3mPEzqZgZmysZf8BEcp3l9W6Vk/w+37Ak16rEDDsRVtqA99KH0kmLxRJvs9kWEdHjejSprKwMK1bUzQnu1auXOsw2BDHz6tsgprHZBKxnA6bbbqJAHhmN6ErA51Y7hmEi5TVEg6rX4QyiE5i3CPjEZsef04dRSWFhoWxDzSWiDlq3UYBcu3atyyqMtzr69u2Lxx/X5btyWzUz7yekcawJ2GA1obfJio8YeJZuH+tKtZrwS9MtHLAaMRhj6Zi3Dmj93h2ITnVcZ8bfb5nwp39Fn7jBzO8AEH9e00UAGTLFmTl8+LDH7sl6ar9+/dzOmVrrxVkeMxeS6QtexnZ8BgPepOrxF2MZE5YSYZp1PM3QszHuZHsB8fYwC1xgYK7xPixY2+lU+5s3b84HMFbrtjrmv+LiYpc5UMB7+OGH9VqV8doNZi4nYxqX2IBeJqCkeglRkA3obgKyktqhyl2zM5b98BSl9t7K0xXC3UCIkbn3KXrdw/NEhfBRVT13+d0+9wVEpzav3zuUnpX/FxQUDCeiTV41EBwM172BeNEGxAmIvdqiajxhINUBIgHTHbog4KADxFqeJxIglqKSE7/b5/UAcRiAzcGBkfdekOELXkJAKghvuB1O7UhlwtTKiQ1/JMwXEJ2H089DC9oD+BsRyZHtJkHMfFYcmxgTsNVqQpLRilQATxJwPxjLrM3wuukWsqxGDMRYsjS0VvxxbGw2268ByL5Pi4Zu572sj5mP3Q4xJEYkfM2E6TbgqDwyViKOFHxuZaTcq1jRlxAjPz9/CjPrEmLcS3D8qDv9brD/JXcx2PAukXpzhMxXm6wGfHAvLNDRAU/Bfn5+fjyARQAaLijzQ7MNyJrWqJfdHvuGL8jQzsDXMOBX+wZRpiy7Xb9+XddltwYEQIuqPmjUIFZfAC8oKHjUbrfvAKD5AvjBgwfVHJrnnnuuhmLnz5+PGTNmoHVr7ztgJSUlap6OOzlaIOZGxpRGDWL1Bh85ciSWiCRlX1O6cuUKFi9ejNdee02VK2umFRWe70EYOXIkNmzY4Hc7HHX4XbCWAkajsVtAgSj9OHr0qOREyLVcmpGANnXqVDjAFKtr1apVlfwFCxaoluj8rLbK5cSUWKLIawAqjo2NjQw4EHNzc9cRkWbn8CVdX7aTHPTEE08gMTHRRf+eQJR3vpAkV0nCscb0WVxc3KxABHESEa3SWBn49ttvVZGiaMmx8TRUOgNdHWB3lijz7eXLl/UA8dm4uLj1AQdiUVFRi6tXr8qEpVlQL6BJOmJdhsB7COKF2NjYMCKyBhyIYi25ubkrAUzWwhplHlyyZAkmTJhQlW744osvqs9qI+F1HF37+OOPfWqGbBRrOZwy80Kz2fySVB6QIObl5fWprKz83ifteWESK5R5UbaTHOcmHMBKGmJ1WrlypZo47O78oQyljrzT9u3bY8oUXY5Nqk1i5n5ms1nVQUCCKA0/fPiwHJjQ5ZoTAXHp0qWQfFNfQZQUfiFxYLZv3w7JsREZ48eP1+PA6fdms7nqjp6ABfHIkSPP2O329VpYo8iQNP0DBw6o4uSkr4DiC4jCJ9bsAEusUUB0WKHj/QsvvOBTiOJjf4aazeaqg6YBC6J0NicnRw5H9PWx427ZRMnHjh1TgevSpYvKI5aYmiobOu5p3LhxuHbtmgq0/Nt5aBUQd+zYoZ4UdqZVq1bh3LlzePnll+vTXBlG9yQkJLjc0xPoIEpnbscGGpIDRHcKFzAkk622M/m1gahV84joUbPZ7HL2LqBBFMVkZ2enEpGuufJaAaCBnMXx8fE17msNeBALCwvvv3bt2lEi0uVctQaK10rE2ZCQkPiYmBjXi3QC2Tt11kxOTs4wZg7qnBoiGhgfH7/b3RcR8Jbo6NShQ4feBfB7rT77xiSHiH6RkJDwj9raFDQgSgezsrLSgjBJakmPHj085vwGFYg5OTnN7pyaCoqrMiWcsFqtKcnJyVZPI0NQgSgdFUfnypUre4hIcnACmY6ZTKbHunfv7vWW/qAD0QHk1atXxdEJ1Oujc1q2bJnStWvXpnl9tLPpZWZmfnkPfoGmXtbPzLtCQkKeiYuL83jbsHMlQWmJ1YB8XY6+AWhWL+3qX1jOYv71kUce+Q0R2fypLuhBvOO1SpbcWgCN9sdNFEWZ2rNnzzr9GFiTAFGA3L9/f0uDwfAXIvq5P1+5zrzqzww1b978LV8cmCYRJ/qi8IyMjJ8S0fsAUnzh14uHmTMNBsPsnj171ntzu8lYYnUwMjIykgHI/NPQP72XzczvJyUlidOlCTVZEB3aS09Pj1EURY6Jywbg3WRTTdTrImS9oiif1HXea1LBfn10n56ePvrOsp3cZlzfq/XPAdjDzDuZeXlycvLZ+rTtRxDroL3MzEz5adoEm81mBiB/uhNRxzvZ5+pNHcxcKj8ODeAMMx9XFCWfmfMVRclKTExssBtH/g+lh1Q+GAMWjwAAAABJRU5ErkJggg=="},kXUw:function(e,t,n){(e.exports=n("FZ+f")(!0)).push([e.i,"\n.classPointer[data-v-113b061f] {\n cursor: pointer;\n color: #69ccff;\n}\n.row-width-auto-margin-0-90[data-v-113b061f] {\n width: auto;\n margin: auto 4%;\n}\n.btnList[data-v-113b061f] {\n margin-top: 30px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n /*width: 60%;*/\n}\n.cardCont[data-v-113b061f] {\n margin-bottom: 10px;\n}\n.headerTop[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n}\n.headerLeft[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n /*.conOrgin {*/\n /* &::before {*/\n /* content: '';*/\n /* border-left: 2px solid rgb(255, 169, 106);*/\n /* margin-right: 15px;*/\n /* }*/\n /*}*/\n /*.conZhi {*/\n /* &::before {*/\n /* content: '';*/\n /* border-left: 2px solid rgb(121, 156, 255);*/\n /* margin-right: 15px;*/\n /* }*/\n /*}*/\n}\n.headerLeft span[data-v-113b061f]::after {\n content: '';\n border-left: 2px solid #03adf4;\n margin-left: 15px;\n}\n.headerLeft span[data-v-113b061f]:last-child::after {\n content: '';\n border-left: 2px solid #03adf4;\n margin-left: 15px;\n display: none;\n}\n.headerLeft .conditionChoose[data-v-113b061f] {\n font-size: 16px;\n color: #444 !important;\n margin-right: 20px;\n /*&::after {*/\n /* content: '';*/\n /* border-left: 2px solid rgb(3, 173, 244);*/\n /* margin-right: 15px;*/\n /*}*/\n}\n.upload-order-file[data-v-113b061f] {\n padding: 10px;\n background: #03adf4;\n color: #fff;\n border: 0;\n}\n.upload-order-file[data-v-113b061f]:active {\n opacity: 0.5;\n}\n.orderDetailCont .orderMsg[data-v-113b061f] {\n margin-bottom: 20px;\n padding-left: 40px;\n}\n.orderDetailCont .orderMsg .msgFlex[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.orderDetailCont .orderMsg p[data-v-113b061f] {\n font-size: 14px;\n}\n.orderDetailCont span[data-v-113b061f] {\n font-size: 14px;\n}\n.orderDetailCont .orderBtn[data-v-113b061f] {\n margin-left: 15px;\n}\n.processContentData[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.processCont[data-v-113b061f] {\n min-width: 310px;\n margin-right: 20px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n width: 100%;\n}\n.processCont .processFirstBox[data-v-113b061f] {\n text-align: center;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.processCont .processFirstBox .processStart[data-v-113b061f] {\n background: url("+n("8mNq")+");\n background-size: 100% 100%;\n width: 200px;\n padding: 10px 10px;\n padding-bottom: 20px;\n /*margin: 0 auto;*/\n color: #fff;\n font-size: 12px;\n}\n.processCont .processFirstBox .processStart p[data-v-113b061f] {\n margin-top: 10px;\n}\n.processCont .processFirstBox .processStart span[data-v-113b061f] {\n vertical-align: top;\n}\n.processCont .processFirstBox .processStart i[data-v-113b061f] {\n margin-top: 10px;\n font-size: 16px;\n cursor: pointer;\n}\n.processCont .processFirstBox .processDown[data-v-113b061f] {\n width: 13%;\n}\n.processCont .processHistory[data-v-113b061f] {\n margin-top: 20px;\n width: 90%;\n}\n.processCont .processHistory[data-v-113b061f] .el-card__header {\n padding: 10px;\n}\n.processCont .processHistory[data-v-113b061f] .el-card__body {\n padding: 0;\n}\n.processCont .processHistory .historyIcon[data-v-113b061f] {\n float: right;\n cursor: pointer;\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n -webkit-transition: -webkit-transform 0.4s;\n transition: -webkit-transform 0.4s;\n transition: transform 0.4s;\n transition: transform 0.4s, -webkit-transform 0.4s;\n}\n.processCont .processHistory .closeIcon[data-v-113b061f] {\n ransform-origin: center center;\n -webkit-transform: rotate(-180deg);\n transform: rotate(-180deg);\n -webkit-transition: -webkit-transform 0.4s;\n transition: -webkit-transform 0.4s;\n transition: transform 0.4s;\n transition: transform 0.4s, -webkit-transform 0.4s;\n}\n.processCont .processHistory .timeLine[data-v-113b061f] {\n padding: 20px;\n -webkit-transition: all 0.4s;\n transition: all 0.4s;\n /*max-height: 10000px;*/\n /*overflow: hidden;*/\n}\n.processCont .processCenter[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.processCont .processCenter .processBoxBig[data-v-113b061f] {\n text-align: center;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: distribute;\n justify-content: space-around;\n width: 33%;\n}\n.processCont .processCenter .processBoxBig .processDown[data-v-113b061f] {\n width: 13%;\n}\n.processCont .processCenter .processBoxBig:nth-last-child(2) .processDown[data-v-113b061f] {\n /*display: none;*/\n}\n.processCont .processBox[data-v-113b061f] {\n border: 1px solid rgba(68, 68, 68, 0.4);\n border-radius: 4px;\n margin-bottom: 10px;\n max-width: 400px;\n width: 100%;\n}\n.processCont .processBox .processTit[data-v-113b061f] {\n border-color: rgba(68, 68, 68, 0.4);\n background: rgba(68, 68, 68, 0.4);\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n padding: 6px 0;\n}\n.processCont .processBox .processTit span[data-v-113b061f] {\n font-size: 16px;\n margin-right: 5px;\n color: #fff;\n}\n.processCont .processBox .processTit .processClose[data-v-113b061f] {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n -webkit-transition: -webkit-transform 0.6s;\n transition: -webkit-transform 0.6s;\n transition: transform 0.6s;\n transition: transform 0.6s, -webkit-transform 0.6s;\n cursor: pointer;\n font-size: 12px;\n color: #fff;\n}\n.processCont .processBox .processTit .closePro[data-v-113b061f] {\n ransform-origin: center center;\n -webkit-transform: rotate(-90deg);\n transform: rotate(-90deg);\n -webkit-transition: -webkit-transform 0.6s;\n transition: -webkit-transform 0.6s;\n transition: transform 0.6s;\n transition: transform 0.6s, -webkit-transform 0.6s;\n font-size: 12px;\n color: #fff;\n}\n.processCont .processBox .processBoxList[data-v-113b061f] {\n max-height: 1000px;\n -webkit-transition: all 0.6s;\n transition: all 0.6s;\n overflow: hidden;\n}\n.processCont .processBox .processBoxList .proBoxData[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n /*align-items: center;*/\n padding: 10px 15px;\n}\n.processCont .processBox .processBoxList .proBoxData .commentBox[data-v-113b061f] {\n cursor: pointer;\n margin-bottom: 10px;\n display: table;\n width: 100%;\n}\n.processCont .processBox .processBoxList .proBoxData .commentBox p[data-v-113b061f] {\n font-size: 14px;\n margin-bottom: 5px;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n width: 100%;\n}\n.processCont .processBox .processBoxList .proBoxData .commentBox span[data-v-113b061f] {\n float: right;\n margin-left: 10px;\n font-size: 12px;\n text-align: right;\n}\n.processCont .processBox .processBoxList .proBoxData .commentBox[data-v-113b061f]:last-child {\n margin-bottom: 0;\n}\n.processCont .processBox .processBoxList .proBoxData[data-v-113b061f]:last-child {\n margin-bottom: 0;\n}\n.processCont .processBox .processBoxList .proBoxData span[data-v-113b061f] {\n font-size: 14px;\n color: rgba(68, 68, 68, 0.6);\n text-align: left;\n}\n.processCont .processBox .processBoxList .proBoxData p[data-v-113b061f] {\n font-size: 14px;\n color: #444444;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n text-align: left;\n margin-bottom: 10px;\n}\n.processCont .processBox .processBoxList .proBoxData p[data-v-113b061f]:last-child {\n margin-bottom: 0px;\n}\n.processCont .processBox .processBoxList .proBoxData i[data-v-113b061f] {\n margin-left: 10px;\n cursor: pointer;\n}\n.processCont .processBox .processBoxList .proBoxData[data-v-113b061f]::before {\n content: '';\n width: 4px;\n height: 4px;\n background: #bccdff;\n border-radius: 100%;\n display: inline-block;\n margin-right: 10px;\n margin-top: 6px;\n}\n.processCont .processBox .closeProBox[data-v-113b061f] {\n max-height: 0px;\n}\n.processCont .processBox .processBtn[data-v-113b061f] {\n background: #ccc;\n color: #fff;\n padding: 8px 0;\n position: relative;\n}\n.processCont .processBox .processBtn h4[data-v-113b061f] {\n font-size: 14px;\n color: #fff;\n font-weight: normal;\n padding: 0 10px;\n margin-top: 10px;\n}\n.processCont .processBox .processBtn h4 p[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.processCont .processBox .processBtn h4 p i[data-v-113b061f] {\n margin-right: 5px;\n}\n.processCont .processBox .processBtn h4 span[data-v-113b061f] {\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n.processCont .processBox .processBtn span[data-v-113b061f] {\n font-size: 14px;\n color: #fff;\n}\n.processCont .processBox .processBtn .commentChat[data-v-113b061f] {\n position: absolute;\n right: 10px;\n cursor: pointer;\n top: 14px;\n}\n.processCont .processBoxOrgin[data-v-113b061f] {\n border: 1px solid #FFA96A;\n}\n.processCont .processBoxOrgin .processTit[data-v-113b061f] {\n border-color: #FFA96A;\n background: #FFA96A;\n}\n.processCont .processBoxOrgin .processTit span[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxOrgin .processTit .processClose[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxOrgin .proBoxData i[data-v-113b061f] {\n color: #FFA96A;\n}\n.processCont .processBoxOrgin .processBtn[data-v-113b061f] {\n background: #FFA96A;\n}\n.processCont .processBoxBlue[data-v-113b061f] {\n border: 1px solid #05AAFF;\n}\n.processCont .processBoxBlue .processTit[data-v-113b061f] {\n border-color: #05AAFF;\n background: #05AAFF;\n}\n.processCont .processBoxBlue .processTit span[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxBlue .processTit .processClose[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxBlue .processBtn[data-v-113b061f] {\n background: #05AAFF;\n}\n.processCont .processBoxRed[data-v-113b061f] {\n border: 1px solid #ff3643;\n}\n.processCont .processBoxRed .processTit[data-v-113b061f] {\n border-color: #ff3643;\n background: #ff3643;\n}\n.processCont .processBoxRed .processTit span[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxRed .processTit .processClose[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxRed .processBtn[data-v-113b061f] {\n background: #ff3643;\n}\n.processCont .processEnd[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.processCont .processEnd img[data-v-113b061f] {\n width: 113px;\n}\n.processCont .processDown[data-v-113b061f] {\n /*margin-bottom: 10px;*/\n}\n[data-v-113b061f] .el-form-item {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n margin-right: 75px;\n margin-bottom: 23px;\n}\n[data-v-113b061f] .el-form-item__content {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n width: 100%;\n line-height: normal;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n[data-v-113b061f] .el-form-item__label {\n font-weight: normal;\n line-height: initial;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n.fileShow[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.stateDesc[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n}\n.stateDesc[data-v-113b061f] .el-textarea {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n.commentList[data-v-113b061f] {\n margin-bottom: 10px;\n}\n.commentList .commentData[data-v-113b061f] {\n margin-bottom: 10px;\n}\n.commentList .commentData p[data-v-113b061f] {\n font-size: 14px;\n padding: 10px;\n margin-bottom: 5px;\n background: #f9f9f9;\n}\n.commentList .commentData .commentDit[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n margin-bottom: 5px;\n}\n.commentList .commentData .commentDit span[data-v-113b061f] {\n font-size: 12px;\n margin-right: 10px;\n cursor: pointer;\n}\n.commontSubmit[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n margin-top: 30px;\n}\n.commontSubmit[data-v-113b061f] .el-textarea {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n/***************่ตๆๆถ้*****************/\n.liucheng[data-v-113b061f] {\n margin-right: 15px;\n font-size: 16px;\n}\n.jiba[data-v-113b061f] {\n cursor: pointer;\n}\n.jiba span.cur[data-v-113b061f] {\n color: #00A5FF !important;\n}\nul li[data-v-113b061f] {\n list-style: none;\n}\n.upload-modal[data-v-113b061f] .el-dialog__header {\n border-bottom: 1px solid #ccc;\n}\n.upload-modal .need-remark[data-v-113b061f] .el-textarea__inner {\n height: 120px;\n}\n.upload-modal .upload-file[data-v-113b061f] .el-form-item__label {\n display: none;\n}\n.upload-modal .upload-file[data-v-113b061f] .el-form-item__content {\n -webkit-box-align: normal;\n -ms-flex-align: normal;\n align-items: normal;\n}\n.donwn-file[data-v-113b061f] {\n cursor: pointer;\n color: #03adf4;\n}\n.add-annex-btn[data-v-113b061f] {\n cursor: pointer;\n color: #03adf4;\n}\n.down[data-v-113b061f] {\n color: #00A5FF;\n cursor: pointer;\n}\n.del[data-v-113b061f] {\n color: red;\n cursor: pointer;\n margin-left: 6px;\n}\n.save-data[data-v-113b061f] {\n margin-top: 10px;\n text-align: center;\n}\n.save-data .save-btn[data-v-113b061f] {\n background: #03adf4;\n color: #fff;\n border: 0;\n}\n.save-data .save-btn[data-v-113b061f]:active {\n opacity: 0.5;\n}\n.goLink[data-v-113b061f] {\n color: #05AAFF;\n cursor: pointer;\n}\n.assignEngineer .assignNumAndRig[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n margin-bottom: 10px;\n}\n.assignEngineer .assignBox[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n margin-bottom: 10px;\n}\n.assignEngineer .assignBox div[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n margin-right: 10px;\n}\n.assignEngineer .assignBox i[data-v-113b061f] {\n color: red;\n cursor: pointer;\n}\n.tips[data-v-113b061f] {\n font-size: 14px;\n margin-bottom: 20px;\n /*color:red;*/\n}\n.chat-modal[data-v-113b061f] .el-dialog__body {\n padding-top: 0;\n}\n.chat-modal .pic[data-v-113b061f] {\n min-width: 24px;\n width: 24px;\n height: 24px;\n background: #37BBFF;\n color: #fff;\n font-size: 12px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n border-radius: 50%;\n}\n.chat-modal[data-v-113b061f] .el-dialog__headerbtn {\n top: 15px ;\n}\n.chat-modal[data-v-113b061f] .el-dialog__body {\n padding: 10px 20px 40px 20px;\n}\n.chat-modal[data-v-113b061f] .el-dialog__header {\n background: #fff;\n padding: 10px 10px 0px 10px;\n margin-bottom: 0;\n}\n.chat-modal[data-v-113b061f] .el-dialog__header /deep/ .el-dialog__title {\n color: #444;\n font-size: 14px;\n}\n.chat-modal[data-v-113b061f] .el-dialog__header /deep/ .el-dialog__headerbtn {\n border-radius: 50%;\n background: #fff;\n padding: 4px;\n font-size: 12px;\n font-weight: 400;\n}\n.chat-modal[data-v-113b061f] .el-dialog__header /deep/ .el-dialog__headerbtn /deep/ .el-dialog__close {\n color: #05AAFF;\n font-size: 16px;\n}\n.dialog-box .has-more-news[data-v-113b061f] {\n text-align: center;\n color: #37BBFF;\n font-size: 12px;\n}\n.dialog-box .has-more-news.not_more[data-v-113b061f] {\n color: rgba(68, 68, 68, 0.5);\n}\n.dialog-box .has-more-news span[data-v-113b061f] {\n cursor: pointer;\n}\n.dialog-box .dialog[data-v-113b061f] {\n height: 300px;\n overflow-y: auto;\n padding: 10px;\n border: 1px solid #37BBFF;\n border-bottom: 0;\n /*ๆปๅจๆกๆดไฝๆ ทๅผ*/\n /*ๆปๅจๆก้้ขๅฐๆนๅ*/\n /*ๆปๅจๆก้้ข่ฝจ้*/\n}\n.dialog-box .dialog .connect-div .left-massage[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage[data-v-113b061f] {\n margin-top: 10px;\n}\n.dialog-box .dialog .connect-div .left-massage .title[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title[data-v-113b061f] {\n width: 50%;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.dialog-box .dialog .connect-div .left-massage .title .pic[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title .pic[data-v-113b061f] {\n min-width: 24px;\n width: 24px;\n height: 24px;\n background: #37BBFF;\n color: #fff;\n font-size: 12px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n border-radius: 50%;\n}\n.dialog-box .dialog .connect-div .left-massage .title .text[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title .text[data-v-113b061f] {\n color: #444;\n font-size: 14px;\n margin: 0 10px;\n white-space: nowrap;\n}\n.dialog-box .dialog .connect-div .left-massage .title .time[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title .time[data-v-113b061f] {\n color: #FFA96A;\n font-size: 14px;\n white-space: nowrap;\n}\n.dialog-box .dialog .connect-div .left-massage .title .del-icon[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title .del-icon[data-v-113b061f] {\n cursor: pointer;\n margin-left: 10px;\n width: 16px;\n display: none;\n}\n.dialog-box .dialog .connect-div .left-massage .title:hover .del-icon[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title:hover .del-icon[data-v-113b061f] {\n display: block;\n}\n.dialog-box .dialog .connect-div .left-massage .content[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .content[data-v-113b061f] {\n margin-top: 10px;\n width: 50%;\n color: rgba(68, 68, 68, 0.75);\n max-width: 680px;\n background: #EEF9FF;\n font-size: 14px;\n padding: 10px;\n border-radius: 4px;\n}\n.dialog-box .dialog .connect-div .left-massage .down-content[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .down-content[data-v-113b061f] {\n margin-top: 10px;\n font-size: 14px;\n}\n.dialog-box .dialog .connect-div .left-massage .down-content .down-btn[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .down-content .down-btn[data-v-113b061f] {\n width: 70px;\n height: 30px;\n color: #fff;\n cursor: pointer;\n outline: none;\n border: 0;\n border-radius: 4px;\n margin-left: 10px;\n background: -webkit-gradient(linear, left top, left bottom, from(#69ccff), to(#05aaff));\n background: linear-gradient(180deg, #69ccff 0%, #05aaff 100%);\n}\n.dialog-box .dialog .connect-div .left-massage .down-content .down-btn[data-v-113b061f]:active,\n.dialog-box .dialog .connect-div .right-massage .down-content .down-btn[data-v-113b061f]:active {\n opacity: 0.5;\n}\n.dialog-box .dialog .connect-div .right-massage[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.dialog-box .dialog .connect-div .right-massage .title[data-v-113b061f] {\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n.dialog-box .dialog .connect-div .right-massage .content[data-v-113b061f] {\n text-align: right;\n}\n.dialog-box .dialog .connect-div .right-massage .del-icon[data-v-113b061f] {\n margin-right: 10px;\n}\n.dialog-box .dialog[data-v-113b061f]::-webkit-scrollbar {\n width: 8px;\n height: 1px;\n}\n.dialog-box .dialog[data-v-113b061f]::-webkit-scrollbar-thumb {\n border-radius: 10px;\n background: #69CCFF;\n}\n.dialog-box .dialog[data-v-113b061f]::-webkit-scrollbar-track {\n border-radius: 10px;\n background: #CDEEFF;\n}\n.dialog-box .dialog-input[data-v-113b061f] {\n height: 120px;\n border: 1px solid #37BBFF;\n}\n.dialog-box .dialog-input[data-v-113b061f] .el-textarea__inner {\n border: 0;\n resize: none;\n}\n.dialog-box .dialog-input .btn-group[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n padding: 0 15px;\n}\n.dialog-box .dialog-input .btn-group[data-v-113b061f] .el-button {\n border: 0;\n}\n.dialog-box .dialog-input .btn-group .update-files-btn[data-v-113b061f] {\n background: -webkit-gradient(linear, left top, left bottom, from(#98b1fa), to(#5883ff));\n background: linear-gradient(180deg, #98b1fa 0%, #5883ff 100%);\n}\n.dialog-box .dialog-input .btn-group .send-tap[data-v-113b061f] {\n white-space: nowrap;\n font-size: 14px;\n color: #00A5FF;\n margin-right: 10px;\n}\n.dialog-box .dialog-input .btn-group .send-btn[data-v-113b061f] {\n background: -webkit-gradient(linear, left top, left bottom, from(#69ccff), to(#05aaff));\n background: linear-gradient(180deg, #69ccff 0%, #05aaff 100%);\n}\n","",{version:3,sources:["H:/chengguoyun-web/src/views/declareCoordination/orderManage/orderDetail.vue"],names:[],mappings:";AACA;EACE,gBAAgB;EAChB,eAAe;CAChB;AACD;EACE,YAAY;EACZ,gBAAgB;CACjB;AACD;EACE,iBAAiB;EACjB,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,yBAAyB;MACrB,sBAAsB;UAClB,wBAAwB;EAChC,eAAe;CAChB;AACD;EACE,oBAAoB;CACrB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,+BAA+B;CACxC;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;EAC5B,oBAAoB;MAChB,gBAAgB;EACpB,eAAe;EACf,iBAAiB;EACjB,oBAAoB;EACpB,kDAAkD;EAClD,2BAA2B;EAC3B,OAAO;EACP,KAAK;EACL,aAAa;EACb,iBAAiB;EACjB,oBAAoB;EACpB,kDAAkD;EAClD,2BAA2B;EAC3B,OAAO;EACP,KAAK;CACN;AACD;EACE,YAAY;EACZ,+BAA+B;EAC/B,kBAAkB;CACnB;AACD;EACE,YAAY;EACZ,+BAA+B;EAC/B,kBAAkB;EAClB,cAAc;CACf;AACD;EACE,gBAAgB;EAChB,uBAAuB;EACvB,mBAAmB;EACnB,cAAc;EACd,kBAAkB;EAClB,8CAA8C;EAC9C,yBAAyB;EACzB,KAAK;CACN;AACD;EACE,cAAc;EACd,oBAAoB;EACpB,YAAY;EACZ,UAAU;CACX;AACD;EACE,aAAa;CACd;AACD;EACE,oBAAoB;EACpB,mBAAmB;CACpB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;CAC7B;AACD;EACE,gBAAgB;CACjB;AACD;EACE,gBAAgB;CACjB;AACD;EACE,kBAAkB;CACnB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;CACf;AACD;EACE,iBAAiB;EACjB,mBAAmB;EACnB,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,oBAAoB;MAChB,gBAAgB;EACpB,yBAAyB;MACrB,sBAAsB;UAClB,wBAAwB;EAChC,YAAY;CACb;AACD;EACE,mBAAmB;EACnB,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;CAC7B;AACD;EACE,0CAA8D;EAC9D,2BAA2B;EAC3B,aAAa;EACb,mBAAmB;EACnB,qBAAqB;EACrB,mBAAmB;EACnB,YAAY;EACZ,gBAAgB;CACjB;AACD;EACE,iBAAiB;CAClB;AACD;EACE,oBAAoB;CACrB;AACD;EACE,iBAAiB;EACjB,gBAAgB;EAChB,gBAAgB;CACjB;AACD;EACE,WAAW;CACZ;AACD;EACE,iBAAiB;EACjB,WAAW;CACZ;AACD;EACE,cAAc;CACf;AACD;EACE,WAAW;CACZ;AACD;EACE,aAAa;EACb,gBAAgB;EAChB,gCAAgC;UACxB,wBAAwB;EAChC,2CAA2C;EAC3C,mCAAmC;EACnC,2BAA2B;EAC3B,mDAAmD;CACpD;AACD;EACE,+BAA+B;EAC/B,mCAAmC;UAC3B,2BAA2B;EACnC,2CAA2C;EAC3C,mCAAmC;EACnC,2BAA2B;EAC3B,mDAAmD;CACpD;AACD;EACE,cAAc;EACd,6BAA6B;EAC7B,qBAAqB;EACrB,wBAAwB;EACxB,qBAAqB;CACtB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,oBAAoB;MAChB,gBAAgB;EACpB,oBAAoB;MAChB,YAAY;UACR,QAAQ;EAChB,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;CAC7B;AACD;EACE,mBAAmB;EACnB,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;EAC5B,0BAA0B;MACtB,8BAA8B;EAClC,WAAW;CACZ;AACD;EACE,WAAW;CACZ;AACD;EACE,kBAAkB;CACnB;AACD;EACE,wCAAwC;EACxC,mBAAmB;EACnB,oBAAoB;EACpB,iBAAiB;EACjB,YAAY;CACb;AACD;EACE,oCAAoC;EACpC,kCAAkC;EAClC,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,yBAAyB;MACrB,sBAAsB;UAClB,wBAAwB;EAChC,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;EAC5B,eAAe;CAChB;AACD;EACE,gBAAgB;EAChB,kBAAkB;EAClB,YAAY;CACb;AACD;EACE,gCAAgC;UACxB,wBAAwB;EAChC,2CAA2C;EAC3C,mCAAmC;EACnC,2BAA2B;EAC3B,mDAAmD;EACnD,gBAAgB;EAChB,gBAAgB;EAChB,YAAY;CACb;AACD;EACE,+BAA+B;EAC/B,kCAAkC;UAC1B,0BAA0B;EAClC,2CAA2C;EAC3C,mCAAmC;EACnC,2BAA2B;EAC3B,mDAAmD;EACnD,gBAAgB;EAChB,YAAY;CACb;AACD;EACE,mBAAmB;EACnB,6BAA6B;EAC7B,qBAAqB;EACrB,iBAAiB;CAClB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,wBAAwB;EACxB,mBAAmB;CACpB;AACD;EACE,gBAAgB;EAChB,oBAAoB;EACpB,eAAe;EACf,YAAY;CACb;AACD;EACE,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,6BAA6B;EAC7B,sBAAsB;EACtB,iBAAiB;EACjB,YAAY;CACb;AACD;EACE,aAAa;EACb,kBAAkB;EAClB,gBAAgB;EAChB,kBAAkB;CACnB;AACD;EACE,iBAAiB;CAClB;AACD;EACE,iBAAiB;CAClB;AACD;EACE,gBAAgB;EAChB,6BAA6B;EAC7B,iBAAiB;CAClB;AACD;EACE,gBAAgB;EAChB,eAAe;EACf,oBAAoB;MAChB,YAAY;UACR,QAAQ;EAChB,iBAAiB;EACjB,oBAAoB;CACrB;AACD;EACE,mBAAmB;CACpB;AACD;EACE,kBAAkB;EAClB,gBAAgB;CACjB;AACD;EACE,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,oBAAoB;EACpB,oBAAoB;EACpB,sBAAsB;EACtB,mBAAmB;EACnB,gBAAgB;CACjB;AACD;EACE,gBAAgB;CACjB;AACD;EACE,iBAAiB;EACjB,YAAY;EACZ,eAAe;EACf,mBAAmB;CACpB;AACD;EACE,gBAAgB;EAChB,YAAY;EACZ,oBAAoB;EACpB,gBAAgB;EAChB,iBAAiB;CAClB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,yBAAyB;MACrB,sBAAsB;UAClB,wBAAwB;EAChC,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;CAC7B;AACD;EACE,kBAAkB;CACnB;AACD;EACE,iBAAiB;EACjB,wBAAwB;EACxB,qBAAqB;EACrB,6BAA6B;EAC7B,sBAAsB;EACtB,oBAAoB;MAChB,YAAY;UACR,QAAQ;CACjB;AACD;EACE,gBAAgB;EAChB,YAAY;CACb;AACD;EACE,mBAAmB;EACnB,YAAY;EACZ,gBAAgB;EAChB,UAAU;CACX;AACD;EACE,0BAA0B;CAC3B;AACD;EACE,sBAAsB;EACtB,oBAAoB;CACrB;AACD;EACE,YAAY;CACb;AACD;EACE,YAAY;CACb;AACD;EACE,eAAe;CAChB;AACD;EACE,oBAAoB;CACrB;AACD;EACE,0BAA0B;CAC3B;AACD;EACE,sBAAsB;EACtB,oBAAoB;CACrB;AACD;EACE,YAAY;CACb;AACD;EACE,YAAY;CACb;AACD;EACE,oBAAoB;CACrB;AACD;EACE,0BAA0B;CAC3B;AACD;EACE,sBAAsB;EACtB,oBAAoB;CACrB;AACD;EACE,YAAY;CACb;AACD;EACE,YAAY;CACb;AACD;EACE,oBAAoB;CACrB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,yBAAyB;MACrB,sBAAsB;UAClB,wBAAwB;CACjC;AACD;EACE,aAAa;CACd;AACD;EACE,wBAAwB;CACzB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,mBAAmB;EACnB,oBAAoB;CACrB;AACD;EACE,oBAAoB;MAChB,YAAY;UACR,QAAQ;EAChB,YAAY;EACZ,oBAAoB;EACpB,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;EAC5B,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;CACf;AACD;EACE,oBAAoB;EACpB,qBAAqB;EACrB,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,sBAAsB;MAClB,mBAAmB;UACf,0BAA0B;CACnC;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;CACf;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,YAAY;CACb;AACD;EACE,oBAAoB;MAChB,YAAY;UACR,QAAQ;CACjB;AACD;EACE,oBAAoB;CACrB;AACD;EACE,oBAAoB;CACrB;AACD;EACE,gBAAgB;EAChB,cAAc;EACd,mBAAmB;EACnB,oBAAoB;CACrB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,mBAAmB;CACpB;AACD;EACE,gBAAgB;EAChB,mBAAmB;EACnB,gBAAgB;CACjB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,iBAAiB;CAClB;AACD;EACE,oBAAoB;MAChB,YAAY;UACR,QAAQ;CACjB;AACD,sCAAsC;AACtC;EACE,mBAAmB;EACnB,gBAAgB;CACjB;AACD;EACE,gBAAgB;CACjB;AACD;EACE,0BAA0B;CAC3B;AACD;EACE,iBAAiB;CAClB;AACD;EACE,8BAA8B;CAC/B;AACD;EACE,cAAc;CACf;AACD;EACE,cAAc;CACf;AACD;EACE,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;CAC7B;AACD;EACE,gBAAgB;EAChB,eAAe;CAChB;AACD;EACE,gBAAgB;EAChB,eAAe;CAChB;AACD;EACE,eAAe;EACf,gBAAgB;CACjB;AACD;EACE,WAAW;EACX,gBAAgB;EAChB,iBAAiB;CAClB;AACD;EACE,iBAAiB;EACjB,mBAAmB;CACpB;AACD;EACE,oBAAoB;EACpB,YAAY;EACZ,UAAU;CACX;AACD;EACE,aAAa;CACd;AACD;EACE,eAAe;EACf,gBAAgB;CACjB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,+BAA+B;EACvC,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;EAC5B,oBAAoB;CACrB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;EAC5B,oBAAoB;CACrB;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;EAC5B,mBAAmB;CACpB;AACD;EACE,WAAW;EACX,gBAAgB;CACjB;AACD;EACE,gBAAgB;EAChB,oBAAoB;EACpB,cAAc;CACf;AACD;EACE,eAAe;CAChB;AACD;EACE,gBAAgB;EAChB,YAAY;EACZ,aAAa;EACb,oBAAoB;EACpB,YAAY;EACZ,gBAAgB;EAChB,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;EAC5B,yBAAyB;MACrB,sBAAsB;UAClB,wBAAwB;EAChC,mBAAmB;CACpB;AACD;EACE,YAAY;CACb;AACD;EACE,6BAA6B;CAC9B;AACD;EACE,iBAAiB;EACjB,4BAA4B;EAC5B,iBAAiB;CAClB;AACD;EACE,YAAY;EACZ,gBAAgB;CACjB;AACD;EACE,mBAAmB;EACnB,iBAAiB;EACjB,aAAa;EACb,gBAAgB;EAChB,iBAAiB;CAClB;AACD;EACE,eAAe;EACf,gBAAgB;CACjB;AACD;EACE,mBAAmB;EACnB,eAAe;EACf,gBAAgB;CACjB;AACD;EACE,6BAA6B;CAC9B;AACD;EACE,gBAAgB;CACjB;AACD;EACE,cAAc;EACd,iBAAiB;EACjB,cAAc;EACd,0BAA0B;EAC1B,iBAAiB;EACjB,WAAW;EACX,YAAY;EACZ,WAAW;CACZ;AACD;;EAEE,iBAAiB;CAClB;AACD;;EAEE,WAAW;EACX,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;CAC7B;AACD;;EAEE,gBAAgB;EAChB,YAAY;EACZ,aAAa;EACb,oBAAoB;EACpB,YAAY;EACZ,gBAAgB;EAChB,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,0BAA0B;MACtB,uBAAuB;UACnB,oBAAoB;EAC5B,yBAAyB;MACrB,sBAAsB;UAClB,wBAAwB;EAChC,mBAAmB;CACpB;AACD;;EAEE,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf,oBAAoB;CACrB;AACD;;EAEE,eAAe;EACf,gBAAgB;EAChB,oBAAoB;CACrB;AACD;;EAEE,gBAAgB;EAChB,kBAAkB;EAClB,YAAY;EACZ,cAAc;CACf;AACD;;EAEE,eAAe;CAChB;AACD;;EAEE,iBAAiB;EACjB,WAAW;EACX,8BAA8B;EAC9B,iBAAiB;EACjB,oBAAoB;EACpB,gBAAgB;EAChB,cAAc;EACd,mBAAmB;CACpB;AACD;;EAEE,iBAAiB;EACjB,gBAAgB;CACjB;AACD;;EAEE,YAAY;EACZ,aAAa;EACb,YAAY;EACZ,gBAAgB;EAChB,cAAc;EACd,UAAU;EACV,mBAAmB;EACnB,kBAAkB;EAClB,wFAAwF;EACxF,8DAA8D;CAC/D;AACD;;EAEE,aAAa;CACd;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,6BAA6B;EAC7B,8BAA8B;MAC1B,2BAA2B;UACvB,uBAAuB;EAC/B,uBAAuB;MACnB,oBAAoB;UAChB,sBAAsB;CAC/B;AACD;EACE,sBAAsB;MAClB,mBAAmB;UACf,0BAA0B;CACnC;AACD;EACE,kBAAkB;CACnB;AACD;EACE,mBAAmB;CACpB;AACD;EACE,WAAW;EACX,YAAY;CACb;AACD;EACE,oBAAoB;EACpB,oBAAoB;CACrB;AACD;EACE,oBAAoB;EACpB,oBAAoB;CACrB;AACD;EACE,cAAc;EACd,0BAA0B;CAC3B;AACD;EACE,UAAU;EACV,aAAa;CACd;AACD;EACE,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;EACd,yBAAyB;MACrB,sBAAsB;UAClB,wBAAwB;EAChC,0BAA0B;MACtB,uBAAuB;UACnB,+BAA+B;EACvC,gBAAgB;CACjB;AACD;EACE,UAAU;CACX;AACD;EACE,wFAAwF;EACxF,8DAA8D;CAC/D;AACD;EACE,oBAAoB;EACpB,gBAAgB;EAChB,eAAe;EACf,mBAAmB;CACpB;AACD;EACE,wFAAwF;EACxF,8DAA8D;CAC/D",file:"orderDetail.vue",sourcesContent:["\n.classPointer[data-v-113b061f] {\n cursor: pointer;\n color: #69ccff;\n}\n.row-width-auto-margin-0-90[data-v-113b061f] {\n width: auto;\n margin: auto 4%;\n}\n.btnList[data-v-113b061f] {\n margin-top: 30px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n /*width: 60%;*/\n}\n.cardCont[data-v-113b061f] {\n margin-bottom: 10px;\n}\n.headerTop[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n}\n.headerLeft[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n /*.conOrgin {*/\n /* &::before {*/\n /* content: '';*/\n /* border-left: 2px solid rgb(255, 169, 106);*/\n /* margin-right: 15px;*/\n /* }*/\n /*}*/\n /*.conZhi {*/\n /* &::before {*/\n /* content: '';*/\n /* border-left: 2px solid rgb(121, 156, 255);*/\n /* margin-right: 15px;*/\n /* }*/\n /*}*/\n}\n.headerLeft span[data-v-113b061f]::after {\n content: '';\n border-left: 2px solid #03adf4;\n margin-left: 15px;\n}\n.headerLeft span[data-v-113b061f]:last-child::after {\n content: '';\n border-left: 2px solid #03adf4;\n margin-left: 15px;\n display: none;\n}\n.headerLeft .conditionChoose[data-v-113b061f] {\n font-size: 16px;\n color: #444 !important;\n margin-right: 20px;\n /*&::after {*/\n /* content: '';*/\n /* border-left: 2px solid rgb(3, 173, 244);*/\n /* margin-right: 15px;*/\n /*}*/\n}\n.upload-order-file[data-v-113b061f] {\n padding: 10px;\n background: #03adf4;\n color: #fff;\n border: 0;\n}\n.upload-order-file[data-v-113b061f]:active {\n opacity: 0.5;\n}\n.orderDetailCont .orderMsg[data-v-113b061f] {\n margin-bottom: 20px;\n padding-left: 40px;\n}\n.orderDetailCont .orderMsg .msgFlex[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.orderDetailCont .orderMsg p[data-v-113b061f] {\n font-size: 14px;\n}\n.orderDetailCont span[data-v-113b061f] {\n font-size: 14px;\n}\n.orderDetailCont .orderBtn[data-v-113b061f] {\n margin-left: 15px;\n}\n.processContentData[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.processCont[data-v-113b061f] {\n min-width: 310px;\n margin-right: 20px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n width: 100%;\n}\n.processCont .processFirstBox[data-v-113b061f] {\n text-align: center;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.processCont .processFirstBox .processStart[data-v-113b061f] {\n background: url(\"../../icons/enterprise/proceStartBgTwo.png\");\n background-size: 100% 100%;\n width: 200px;\n padding: 10px 10px;\n padding-bottom: 20px;\n /*margin: 0 auto;*/\n color: #fff;\n font-size: 12px;\n}\n.processCont .processFirstBox .processStart p[data-v-113b061f] {\n margin-top: 10px;\n}\n.processCont .processFirstBox .processStart span[data-v-113b061f] {\n vertical-align: top;\n}\n.processCont .processFirstBox .processStart i[data-v-113b061f] {\n margin-top: 10px;\n font-size: 16px;\n cursor: pointer;\n}\n.processCont .processFirstBox .processDown[data-v-113b061f] {\n width: 13%;\n}\n.processCont .processHistory[data-v-113b061f] {\n margin-top: 20px;\n width: 90%;\n}\n.processCont .processHistory[data-v-113b061f] .el-card__header {\n padding: 10px;\n}\n.processCont .processHistory[data-v-113b061f] .el-card__body {\n padding: 0;\n}\n.processCont .processHistory .historyIcon[data-v-113b061f] {\n float: right;\n cursor: pointer;\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n -webkit-transition: -webkit-transform 0.4s;\n transition: -webkit-transform 0.4s;\n transition: transform 0.4s;\n transition: transform 0.4s, -webkit-transform 0.4s;\n}\n.processCont .processHistory .closeIcon[data-v-113b061f] {\n ransform-origin: center center;\n -webkit-transform: rotate(-180deg);\n transform: rotate(-180deg);\n -webkit-transition: -webkit-transform 0.4s;\n transition: -webkit-transform 0.4s;\n transition: transform 0.4s;\n transition: transform 0.4s, -webkit-transform 0.4s;\n}\n.processCont .processHistory .timeLine[data-v-113b061f] {\n padding: 20px;\n -webkit-transition: all 0.4s;\n transition: all 0.4s;\n /*max-height: 10000px;*/\n /*overflow: hidden;*/\n}\n.processCont .processCenter[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.processCont .processCenter .processBoxBig[data-v-113b061f] {\n text-align: center;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: distribute;\n justify-content: space-around;\n width: 33%;\n}\n.processCont .processCenter .processBoxBig .processDown[data-v-113b061f] {\n width: 13%;\n}\n.processCont .processCenter .processBoxBig:nth-last-child(2) .processDown[data-v-113b061f] {\n /*display: none;*/\n}\n.processCont .processBox[data-v-113b061f] {\n border: 1px solid rgba(68, 68, 68, 0.4);\n border-radius: 4px;\n margin-bottom: 10px;\n max-width: 400px;\n width: 100%;\n}\n.processCont .processBox .processTit[data-v-113b061f] {\n border-color: rgba(68, 68, 68, 0.4);\n background: rgba(68, 68, 68, 0.4);\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n padding: 6px 0;\n}\n.processCont .processBox .processTit span[data-v-113b061f] {\n font-size: 16px;\n margin-right: 5px;\n color: #fff;\n}\n.processCont .processBox .processTit .processClose[data-v-113b061f] {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n -webkit-transition: -webkit-transform 0.6s;\n transition: -webkit-transform 0.6s;\n transition: transform 0.6s;\n transition: transform 0.6s, -webkit-transform 0.6s;\n cursor: pointer;\n font-size: 12px;\n color: #fff;\n}\n.processCont .processBox .processTit .closePro[data-v-113b061f] {\n ransform-origin: center center;\n -webkit-transform: rotate(-90deg);\n transform: rotate(-90deg);\n -webkit-transition: -webkit-transform 0.6s;\n transition: -webkit-transform 0.6s;\n transition: transform 0.6s;\n transition: transform 0.6s, -webkit-transform 0.6s;\n font-size: 12px;\n color: #fff;\n}\n.processCont .processBox .processBoxList[data-v-113b061f] {\n max-height: 1000px;\n -webkit-transition: all 0.6s;\n transition: all 0.6s;\n overflow: hidden;\n}\n.processCont .processBox .processBoxList .proBoxData[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n /*align-items: center;*/\n padding: 10px 15px;\n}\n.processCont .processBox .processBoxList .proBoxData .commentBox[data-v-113b061f] {\n cursor: pointer;\n margin-bottom: 10px;\n display: table;\n width: 100%;\n}\n.processCont .processBox .processBoxList .proBoxData .commentBox p[data-v-113b061f] {\n font-size: 14px;\n margin-bottom: 5px;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n width: 100%;\n}\n.processCont .processBox .processBoxList .proBoxData .commentBox span[data-v-113b061f] {\n float: right;\n margin-left: 10px;\n font-size: 12px;\n text-align: right;\n}\n.processCont .processBox .processBoxList .proBoxData .commentBox[data-v-113b061f]:last-child {\n margin-bottom: 0;\n}\n.processCont .processBox .processBoxList .proBoxData[data-v-113b061f]:last-child {\n margin-bottom: 0;\n}\n.processCont .processBox .processBoxList .proBoxData span[data-v-113b061f] {\n font-size: 14px;\n color: rgba(68, 68, 68, 0.6);\n text-align: left;\n}\n.processCont .processBox .processBoxList .proBoxData p[data-v-113b061f] {\n font-size: 14px;\n color: #444444;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n text-align: left;\n margin-bottom: 10px;\n}\n.processCont .processBox .processBoxList .proBoxData p[data-v-113b061f]:last-child {\n margin-bottom: 0px;\n}\n.processCont .processBox .processBoxList .proBoxData i[data-v-113b061f] {\n margin-left: 10px;\n cursor: pointer;\n}\n.processCont .processBox .processBoxList .proBoxData[data-v-113b061f]::before {\n content: '';\n width: 4px;\n height: 4px;\n background: #bccdff;\n border-radius: 100%;\n display: inline-block;\n margin-right: 10px;\n margin-top: 6px;\n}\n.processCont .processBox .closeProBox[data-v-113b061f] {\n max-height: 0px;\n}\n.processCont .processBox .processBtn[data-v-113b061f] {\n background: #ccc;\n color: #fff;\n padding: 8px 0;\n position: relative;\n}\n.processCont .processBox .processBtn h4[data-v-113b061f] {\n font-size: 14px;\n color: #fff;\n font-weight: normal;\n padding: 0 10px;\n margin-top: 10px;\n}\n.processCont .processBox .processBtn h4 p[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.processCont .processBox .processBtn h4 p i[data-v-113b061f] {\n margin-right: 5px;\n}\n.processCont .processBox .processBtn h4 span[data-v-113b061f] {\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n.processCont .processBox .processBtn span[data-v-113b061f] {\n font-size: 14px;\n color: #fff;\n}\n.processCont .processBox .processBtn .commentChat[data-v-113b061f] {\n position: absolute;\n right: 10px;\n cursor: pointer;\n top: 14px;\n}\n.processCont .processBoxOrgin[data-v-113b061f] {\n border: 1px solid #FFA96A;\n}\n.processCont .processBoxOrgin .processTit[data-v-113b061f] {\n border-color: #FFA96A;\n background: #FFA96A;\n}\n.processCont .processBoxOrgin .processTit span[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxOrgin .processTit .processClose[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxOrgin .proBoxData i[data-v-113b061f] {\n color: #FFA96A;\n}\n.processCont .processBoxOrgin .processBtn[data-v-113b061f] {\n background: #FFA96A;\n}\n.processCont .processBoxBlue[data-v-113b061f] {\n border: 1px solid #05AAFF;\n}\n.processCont .processBoxBlue .processTit[data-v-113b061f] {\n border-color: #05AAFF;\n background: #05AAFF;\n}\n.processCont .processBoxBlue .processTit span[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxBlue .processTit .processClose[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxBlue .processBtn[data-v-113b061f] {\n background: #05AAFF;\n}\n.processCont .processBoxRed[data-v-113b061f] {\n border: 1px solid #ff3643;\n}\n.processCont .processBoxRed .processTit[data-v-113b061f] {\n border-color: #ff3643;\n background: #ff3643;\n}\n.processCont .processBoxRed .processTit span[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxRed .processTit .processClose[data-v-113b061f] {\n color: #fff;\n}\n.processCont .processBoxRed .processBtn[data-v-113b061f] {\n background: #ff3643;\n}\n.processCont .processEnd[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.processCont .processEnd img[data-v-113b061f] {\n width: 113px;\n}\n.processCont .processDown[data-v-113b061f] {\n /*margin-bottom: 10px;*/\n}\n[data-v-113b061f] .el-form-item {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n margin-right: 75px;\n margin-bottom: 23px;\n}\n[data-v-113b061f] .el-form-item__content {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n width: 100%;\n line-height: normal;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n[data-v-113b061f] .el-form-item__label {\n font-weight: normal;\n line-height: initial;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n.fileShow[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.stateDesc[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n}\n.stateDesc[data-v-113b061f] .el-textarea {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n.commentList[data-v-113b061f] {\n margin-bottom: 10px;\n}\n.commentList .commentData[data-v-113b061f] {\n margin-bottom: 10px;\n}\n.commentList .commentData p[data-v-113b061f] {\n font-size: 14px;\n padding: 10px;\n margin-bottom: 5px;\n background: #f9f9f9;\n}\n.commentList .commentData .commentDit[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n margin-bottom: 5px;\n}\n.commentList .commentData .commentDit span[data-v-113b061f] {\n font-size: 12px;\n margin-right: 10px;\n cursor: pointer;\n}\n.commontSubmit[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n margin-top: 30px;\n}\n.commontSubmit[data-v-113b061f] .el-textarea {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n/***************่ตๆๆถ้*****************/\n.liucheng[data-v-113b061f] {\n margin-right: 15px;\n font-size: 16px;\n}\n.jiba[data-v-113b061f] {\n cursor: pointer;\n}\n.jiba span.cur[data-v-113b061f] {\n color: #00A5FF !important;\n}\nul li[data-v-113b061f] {\n list-style: none;\n}\n.upload-modal[data-v-113b061f] .el-dialog__header {\n border-bottom: 1px solid #ccc;\n}\n.upload-modal .need-remark[data-v-113b061f] .el-textarea__inner {\n height: 120px;\n}\n.upload-modal .upload-file[data-v-113b061f] .el-form-item__label {\n display: none;\n}\n.upload-modal .upload-file[data-v-113b061f] .el-form-item__content {\n -webkit-box-align: normal;\n -ms-flex-align: normal;\n align-items: normal;\n}\n.donwn-file[data-v-113b061f] {\n cursor: pointer;\n color: #03adf4;\n}\n.add-annex-btn[data-v-113b061f] {\n cursor: pointer;\n color: #03adf4;\n}\n.down[data-v-113b061f] {\n color: #00A5FF;\n cursor: pointer;\n}\n.del[data-v-113b061f] {\n color: red;\n cursor: pointer;\n margin-left: 6px;\n}\n.save-data[data-v-113b061f] {\n margin-top: 10px;\n text-align: center;\n}\n.save-data .save-btn[data-v-113b061f] {\n background: #03adf4;\n color: #fff;\n border: 0;\n}\n.save-data .save-btn[data-v-113b061f]:active {\n opacity: 0.5;\n}\n.goLink[data-v-113b061f] {\n color: #05AAFF;\n cursor: pointer;\n}\n.assignEngineer .assignNumAndRig[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n margin-bottom: 10px;\n}\n.assignEngineer .assignBox[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n margin-bottom: 10px;\n}\n.assignEngineer .assignBox div[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n margin-right: 10px;\n}\n.assignEngineer .assignBox i[data-v-113b061f] {\n color: red;\n cursor: pointer;\n}\n.tips[data-v-113b061f] {\n font-size: 14px;\n margin-bottom: 20px;\n /*color:red;*/\n}\n.chat-modal[data-v-113b061f] .el-dialog__body {\n padding-top: 0;\n}\n.chat-modal .pic[data-v-113b061f] {\n min-width: 24px;\n width: 24px;\n height: 24px;\n background: #37BBFF;\n color: #fff;\n font-size: 12px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n border-radius: 50%;\n}\n.chat-modal[data-v-113b061f] .el-dialog__headerbtn {\n top: 15px ;\n}\n.chat-modal[data-v-113b061f] .el-dialog__body {\n padding: 10px 20px 40px 20px;\n}\n.chat-modal[data-v-113b061f] .el-dialog__header {\n background: #fff;\n padding: 10px 10px 0px 10px;\n margin-bottom: 0;\n}\n.chat-modal[data-v-113b061f] .el-dialog__header /deep/ .el-dialog__title {\n color: #444;\n font-size: 14px;\n}\n.chat-modal[data-v-113b061f] .el-dialog__header /deep/ .el-dialog__headerbtn {\n border-radius: 50%;\n background: #fff;\n padding: 4px;\n font-size: 12px;\n font-weight: 400;\n}\n.chat-modal[data-v-113b061f] .el-dialog__header /deep/ .el-dialog__headerbtn /deep/ .el-dialog__close {\n color: #05AAFF;\n font-size: 16px;\n}\n.dialog-box .has-more-news[data-v-113b061f] {\n text-align: center;\n color: #37BBFF;\n font-size: 12px;\n}\n.dialog-box .has-more-news.not_more[data-v-113b061f] {\n color: rgba(68, 68, 68, 0.5);\n}\n.dialog-box .has-more-news span[data-v-113b061f] {\n cursor: pointer;\n}\n.dialog-box .dialog[data-v-113b061f] {\n height: 300px;\n overflow-y: auto;\n padding: 10px;\n border: 1px solid #37BBFF;\n border-bottom: 0;\n /*ๆปๅจๆกๆดไฝๆ ทๅผ*/\n /*ๆปๅจๆก้้ขๅฐๆนๅ*/\n /*ๆปๅจๆก้้ข่ฝจ้*/\n}\n.dialog-box .dialog .connect-div .left-massage[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage[data-v-113b061f] {\n margin-top: 10px;\n}\n.dialog-box .dialog .connect-div .left-massage .title[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title[data-v-113b061f] {\n width: 50%;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.dialog-box .dialog .connect-div .left-massage .title .pic[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title .pic[data-v-113b061f] {\n min-width: 24px;\n width: 24px;\n height: 24px;\n background: #37BBFF;\n color: #fff;\n font-size: 12px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n border-radius: 50%;\n}\n.dialog-box .dialog .connect-div .left-massage .title .text[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title .text[data-v-113b061f] {\n color: #444;\n font-size: 14px;\n margin: 0 10px;\n white-space: nowrap;\n}\n.dialog-box .dialog .connect-div .left-massage .title .time[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title .time[data-v-113b061f] {\n color: #FFA96A;\n font-size: 14px;\n white-space: nowrap;\n}\n.dialog-box .dialog .connect-div .left-massage .title .del-icon[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title .del-icon[data-v-113b061f] {\n cursor: pointer;\n margin-left: 10px;\n width: 16px;\n display: none;\n}\n.dialog-box .dialog .connect-div .left-massage .title:hover .del-icon[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .title:hover .del-icon[data-v-113b061f] {\n display: block;\n}\n.dialog-box .dialog .connect-div .left-massage .content[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .content[data-v-113b061f] {\n margin-top: 10px;\n width: 50%;\n color: rgba(68, 68, 68, 0.75);\n max-width: 680px;\n background: #EEF9FF;\n font-size: 14px;\n padding: 10px;\n border-radius: 4px;\n}\n.dialog-box .dialog .connect-div .left-massage .down-content[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .down-content[data-v-113b061f] {\n margin-top: 10px;\n font-size: 14px;\n}\n.dialog-box .dialog .connect-div .left-massage .down-content .down-btn[data-v-113b061f],\n.dialog-box .dialog .connect-div .right-massage .down-content .down-btn[data-v-113b061f] {\n width: 70px;\n height: 30px;\n color: #fff;\n cursor: pointer;\n outline: none;\n border: 0;\n border-radius: 4px;\n margin-left: 10px;\n background: -webkit-gradient(linear, left top, left bottom, from(#69ccff), to(#05aaff));\n background: linear-gradient(180deg, #69ccff 0%, #05aaff 100%);\n}\n.dialog-box .dialog .connect-div .left-massage .down-content .down-btn[data-v-113b061f]:active,\n.dialog-box .dialog .connect-div .right-massage .down-content .down-btn[data-v-113b061f]:active {\n opacity: 0.5;\n}\n.dialog-box .dialog .connect-div .right-massage[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.dialog-box .dialog .connect-div .right-massage .title[data-v-113b061f] {\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n.dialog-box .dialog .connect-div .right-massage .content[data-v-113b061f] {\n text-align: right;\n}\n.dialog-box .dialog .connect-div .right-massage .del-icon[data-v-113b061f] {\n margin-right: 10px;\n}\n.dialog-box .dialog[data-v-113b061f]::-webkit-scrollbar {\n width: 8px;\n height: 1px;\n}\n.dialog-box .dialog[data-v-113b061f]::-webkit-scrollbar-thumb {\n border-radius: 10px;\n background: #69CCFF;\n}\n.dialog-box .dialog[data-v-113b061f]::-webkit-scrollbar-track {\n border-radius: 10px;\n background: #CDEEFF;\n}\n.dialog-box .dialog-input[data-v-113b061f] {\n height: 120px;\n border: 1px solid #37BBFF;\n}\n.dialog-box .dialog-input[data-v-113b061f] .el-textarea__inner {\n border: 0;\n resize: none;\n}\n.dialog-box .dialog-input .btn-group[data-v-113b061f] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n padding: 0 15px;\n}\n.dialog-box .dialog-input .btn-group[data-v-113b061f] .el-button {\n border: 0;\n}\n.dialog-box .dialog-input .btn-group .update-files-btn[data-v-113b061f] {\n background: -webkit-gradient(linear, left top, left bottom, from(#98b1fa), to(#5883ff));\n background: linear-gradient(180deg, #98b1fa 0%, #5883ff 100%);\n}\n.dialog-box .dialog-input .btn-group .send-tap[data-v-113b061f] {\n white-space: nowrap;\n font-size: 14px;\n color: #00A5FF;\n margin-right: 10px;\n}\n.dialog-box .dialog-input .btn-group .send-btn[data-v-113b061f] {\n background: -webkit-gradient(linear, left top, left bottom, from(#69ccff), to(#05aaff));\n background: linear-gradient(180deg, #69ccff 0%, #05aaff 100%);\n}\n"],sourceRoot:""}])}});
//# sourceMappingURL=57.2476061da0b4e5e35db5.js.map | 81,171.5 | 162,291 | 0.736108 |
0207399d5af19cad1143cede7dc26113a6ba2779 | 1,073 | js | JavaScript | packages/miniapp-element/src/adapter/getLifeCycle.js | zhuowenli/kbone | ebfcc26f19fb5a75d2397b6a026914a011490316 | [
"BSD-3-Clause"
] | null | null | null | packages/miniapp-element/src/adapter/getLifeCycle.js | zhuowenli/kbone | ebfcc26f19fb5a75d2397b6a026914a011490316 | [
"BSD-3-Clause"
] | null | null | null | packages/miniapp-element/src/adapter/getLifeCycle.js | zhuowenli/kbone | ebfcc26f19fb5a75d2397b6a026914a011490316 | [
"BSD-3-Clause"
] | null | null | null | /* eslint-disable prefer-rest-params,no-inner-declarations */
import {isMiniApp} from 'universal-env'
export default function({
init, mount, ready, unmount
}) {
if (isMiniApp) {
return {
didMount() {
init.apply(this, arguments)
mount.apply(this, arguments)
ready.apply(this, arguments)
},
didUnmount() {
unmount.apply(this, arguments)
}
}
} else {
function attached() {
return mount.apply(this, arguments)
}
function detached() {
return unmount.apply(this, arguments)
}
return {
lifetimes: {
attached,
detached,
},
// Keep compatibility to wx base library version < 2.2.3
attached,
detached,
created() {
init.apply(this, arguments)
},
ready() {
ready.apply(this, arguments)
}
}
}
}
| 24.386364 | 68 | 0.457596 |
0207998c79706c237075f33ba2dacf3a5b4d9f0e | 19,680 | js | JavaScript | react/features/conference/components/web/Conference.js | jojonarte/jitsi-meet | c56d0182b8b678b25eb53d849b98afaacd0e4872 | [
"Apache-2.0"
] | null | null | null | react/features/conference/components/web/Conference.js | jojonarte/jitsi-meet | c56d0182b8b678b25eb53d849b98afaacd0e4872 | [
"Apache-2.0"
] | null | null | null | react/features/conference/components/web/Conference.js | jojonarte/jitsi-meet | c56d0182b8b678b25eb53d849b98afaacd0e4872 | [
"Apache-2.0"
] | null | null | null | // @flow
import _ from 'lodash';
import React from 'react';
import VideoLayout from '../../../../../modules/UI/videolayout/VideoLayout';
import { connect, disconnect } from '../../../base/connection';
import { translate } from '../../../base/i18n';
import { connect as reactReduxConnect, equals } from '../../../base/redux';
import { getConferenceNameForTitle } from '../../../base/conference';
import { Chat } from '../../../chat';
import { Filmstrip } from '../../../filmstrip';
import { CalleeInfoContainer, InfoDialogButton } from '../../../invite';
import { LargeVideo } from '../../../large-video';
import { Prejoin, isPrejoinPageVisible } from '../../../prejoin';
import { LAYOUTS, getCurrentLayout, TileViewButton } from '../../../video-layout';
import {
Toolbox,
fullScreenChanged,
setToolboxAlwaysVisible,
showToolbox,
setFullScreen,
setOverflowMenuVisible
} from '../../../toolbox';
import { maybeShowSuboptimalExperienceNotification } from '../../functions';
import Labels from './Labels';
import { default as Notice } from './Notice';
import { default as Subject } from './Subject';
import {
AbstractConference,
abstractMapStateToProps
} from '../AbstractConference';
import type { AbstractProps } from '../AbstractConference';
// added
import { getLocalVideoTrack, toggleScreensharing } from '../../../base/tracks';
import {
OverflowMenuVideoQualityItem,
VideoQualityDialog
} from '../../../video-quality';
import { VideoBlurButton } from '../../../blur';
import { SharedDocumentButton } from '../../../etherpad';
import {
SETTINGS_TABS,
SettingsButton,
openSettingsDialog
} from '../../../settings';
import {
IconExitFullScreen,
IconFeedback,
IconFullScreen,
IconOpenInNew,
IconPresentation,
IconShareVideo
} from '../../../base/icons';
import { E2EEButton } from '../../../e2ee';
import HelpButton from '../../../toolbox/components/HelpButton';
import DownloadButton from '../../../toolbox/components/DownloadButton';
import { createToolbarEvent, sendAnalytics } from '../../../analytics';
import { toggleSharedVideo } from '../../../shared-video';
import { SpeakerStats } from '../../../speaker-stats';
import { openFeedbackDialog } from '../../../feedback';
import { openKeyboardShortcutsDialog } from '../../../keyboard-shortcuts';
import { openDialog } from '../../../base/dialog';
import { OverflowMenuItem } from '../../../base/toolbox';
import OverflowMenuButton from '../../../toolbox/components/web/OverflowMenuButton';
import MuteEveryoneButton from '../../../toolbox/components/web/MuteEveryoneButton';
import { LiveStreamButton, RecordButton } from '../../../recording';
import OverflowMenuProfileItem from '../../../toolbox/components/web/OverflowMenuProfileItem';
declare var APP: Object;
declare var config: Object;
declare var interfaceConfig: Object;
/**
* DOM events for when full screen mode has changed. Different browsers need
* different vendor prefixes.
*
* @private
* @type {Array<string>}
*/
const FULL_SCREEN_EVENTS = [
'webkitfullscreenchange',
'mozfullscreenchange',
'fullscreenchange'
];
/**
* The CSS class to apply to the root element of the conference so CSS can
* modify the app layout.
*
* @private
* @type {Object}
*/
const LAYOUT_CLASSNAMES = {
[LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW]: 'horizontal-filmstrip',
[LAYOUTS.TILE_VIEW]: 'tile-view',
[LAYOUTS.VERTICAL_FILMSTRIP_VIEW]: 'vertical-filmstrip'
};
/**
* The type of the React {@code Component} props of {@link Conference}.
*/
type Props = AbstractProps & {
/**
* Whether the local participant is recording the conference.
*/
_iAmRecorder: boolean,
/**
* The CSS class to apply to the root of {@link Conference} to modify the
* application layout.
*/
_layoutClassName: string,
/**
* Name for this conference room.
*/
_roomName: string,
/**
* If prejoin page is visible or not.
*/
_showPrejoin: boolean,
dispatch: Function,
t: Function
};
/**
* The conference page of the Web application.
*/
class Conference extends AbstractConference<Props, *> {
_onFullScreenChange: Function;
_onShowToolbar: Function;
_originalOnShowToolbar: Function;
_renderOverflowMenuContent: Function;
_handleOnVisibilityChange: Function;
/**
* Initializes a new Conference instance.
*
* @param {Object} props - The read-only properties with which the new
* instance is to be initialized.
*/
constructor(props) {
super(props);
// Throttle and bind this component's mousemove handler to prevent it
// from firing too often.
this._originalOnShowToolbar = this._onShowToolbar;
this._onShowToolbar = _.throttle(
() => this._originalOnShowToolbar(),
100,
{
leading: true,
trailing: false
}
);
// Bind event handler so it is only bound once for every instance.
this._onFullScreenChange = this._onFullScreenChange.bind(this);
this._renderOverflowMenuContent = this._renderOverflowMenuContent.bind(
this
);
this._handleOnVisibilityChange = this._handleOnVisibilityChange.bind(
this
);
}
/**
* Start the connection and get the UI ready for the conference.
*
* @inheritdoc
*/
componentDidMount() {
document.title = `${this.props._roomName} | ${interfaceConfig.APP_NAME}`;
this._start();
}
/**
* Calls into legacy UI to update the application layout, if necessary.
*
* @inheritdoc
* returns {void}
*/
componentDidUpdate(prevProps) {
if (
this.props._shouldDisplayTileView
=== prevProps._shouldDisplayTileView
) {
return;
}
// TODO: For now VideoLayout is being called as LargeVideo and Filmstrip
// sizing logic is still handled outside of React. Once all components
// are in react they should calculate size on their own as much as
// possible and pass down sizings.
VideoLayout.refreshLayout();
}
/**
* Disconnect from the conference when component will be
* unmounted.
*
* @inheritdoc
*/
componentWillUnmount() {
APP.UI.unbindEvents();
FULL_SCREEN_EVENTS.forEach(name =>
document.removeEventListener(name, this._onFullScreenChange)
);
APP.conference.isJoined() && this.props.dispatch(disconnect());
}
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
* @returns {ReactElement}
*/
render() {
const {
VIDEO_QUALITY_LABEL_DISABLED,
// XXX The character casing of the name filmStripOnly utilized by
// interfaceConfig is obsolete but legacy support is required.
filmStripOnly: filmstripOnly
} = interfaceConfig;
const {
_iAmRecorder,
_layoutClassName,
_showPrejoin,
_overflowMenuVisible,
t
} = this.props;
const hideVideoQualityLabel
= filmstripOnly || VIDEO_QUALITY_LABEL_DISABLED || _iAmRecorder;
const overflowMenuContent = this._renderOverflowMenuContent();
return (
<div
className = { _layoutClassName }
id = 'videoconference_page'
onMouseMove = { this._onShowToolbar }>
<Notice />
<Subject />
<div id = 'videospace'>
<LargeVideo />
<div className = 'headerButtonsContainer'>
<InfoDialogButton />
<TileViewButton />
<div className = 'headerButton'>
<OverflowMenuButton
isOpen = { _overflowMenuVisible }
onVisibilityChange = {
this._handleOnVisibilityChange
}>
<ul
aria-label = { t(
'toolbar.accessibilityLabel.moreActionsMenu'
) }
className = 'overflow-menu'>
{overflowMenuContent}
</ul>
</OverflowMenuButton>
</div>
</div>
{hideVideoQualityLabel || <Labels />}
<Filmstrip filmstripOnly = { filmstripOnly } />
</div>
{filmstripOnly || _showPrejoin || <Toolbox />}
{filmstripOnly || <Chat />}
{this.renderNotificationsContainer()}
{!filmstripOnly && _showPrejoin && <Prejoin />}
{ !filmstripOnly && _showPrejoin && <Prejoin />}
<CalleeInfoContainer />
</div>
);
}
/**
* Handle cisibility change of Menu Items.
*
* @private
* @returns {void}
*/
_handleOnVisibilityChange(visible) {
this.props.dispatch(setOverflowMenuVisible(visible));
}
/**
* Renders the list elements of the overflow menu.
*
* @private
* @returns {Array<ReactElement>}
*/
_renderOverflowMenuContent() {
const {
_feedbackConfigured,
_fullScreen,
_screensharing,
_sharingVideo,
_isGuest,
_visibleButtons,
t
} = this.props;
const overflowMenuContent = [];
const shouldShowButton = buttonName => _visibleButtons.has(buttonName);
if (_isGuest && shouldShowButton('profile')) {
overflowMenuContent.push(
<OverflowMenuProfileItem
key = 'profile'
onClick = { () => {
sendAnalytics(createToolbarEvent('profile'));
this.props.dispatch(
openSettingsDialog(SETTINGS_TABS.PROFILE)
);
} } />
);
}
if (shouldShowButton('videoquality')) {
overflowMenuContent.push(
<OverflowMenuVideoQualityItem
key = 'videoquality'
onClick = { () => {
sendAnalytics(createToolbarEvent('video.quality'));
this.props.dispatch(openDialog(VideoQualityDialog));
} } />
);
}
if (shouldShowButton('fullscreen')) {
overflowMenuContent.push(
<OverflowMenuItem
accessibilityLabel = { t(
'toolbar.accessibilityLabel.fullScreen'
) }
icon = { _fullScreen ? IconExitFullScreen : IconFullScreen }
key = 'fullscreen'
onClick = { () => {
sendAnalytics(
createToolbarEvent('toggle.fullscreen', {
enable: !this.props._fullScreen
})
);
const fullScreen = !this.props._fullScreen;
this.props.dispatch(setFullScreen(fullScreen));
} }
text = {
_fullScreen
? t('toolbar.exitFullScreen')
: t('toolbar.enterFullScreen')
} />
);
}
overflowMenuContent.push(
<LiveStreamButton
key = 'livestreaming'
showLabel = { true } />
);
overflowMenuContent.push(
<RecordButton
key = 'record'
showLabel = { true } />
);
if (shouldShowButton('sharedvideo')) {
overflowMenuContent.push(
<OverflowMenuItem
accessibilityLabel = { t(
'toolbar.accessibilityLabel.sharedvideo'
) }
icon = { IconShareVideo }
key = 'sharedvideo'
onClick = { () => {
sendAnalytics(
createToolbarEvent('shared.video.toggled', {
enable: !this.props._sharingVideo
})
);
this.props.dispatch(toggleSharedVideo());
} }
text = {
_sharingVideo
? t('toolbar.stopSharedVideo')
: t('toolbar.sharedvideo')
} />
);
}
overflowMenuContent.push(
<VideoBlurButton
key = 'videobackgroundblur'
showLabel = { true }
visible = {
shouldShowButton('videobackgroundblur') && !_screensharing
} />
);
if (shouldShowButton('etherpad')) {
overflowMenuContent.push(
<SharedDocumentButton
key = 'etherpad'
showLabel = { true } />
);
}
overflowMenuContent.push(
<SettingsButton
key = 'settings'
showLabel = { true }
visible = { shouldShowButton('settings') } />
);
overflowMenuContent.push(
<MuteEveryoneButton
key = 'mute-everyone'
showLabel = { true }
visible = { shouldShowButton('mute-everyone') } />
);
// if (shouldShowButton("stats")) {
// overflowMenuContent.push(
// <OverflowMenuItem
// accessibilityLabel={t(
// "toolbar.accessibilityLabel.speakerStats"
// )}
// icon={IconPresentation}
// key="stats"
// onClick={() => {
// sendAnalytics(createToolbarEvent("speaker.stats"));
// this.props.dispatch(
// openDialog(SpeakerStats, {
// conference: this.props._conference
// })
// );
// }}
// // onClick={this._onToolbarOpenSpeakerStats}
// text={t("toolbar.speakerStats")}
// />
// );
// }
if (shouldShowButton('e2ee')) {
overflowMenuContent.push(
<E2EEButton
key = 'e2ee'
showLabel = { true } />
);
}
if (shouldShowButton('feedback') && _feedbackConfigured) {
overflowMenuContent.push(
<OverflowMenuItem
accessibilityLabel = { t(
'toolbar.accessibilityLabel.feedback'
) }
icon = { IconFeedback }
key = 'feedback'
onClick = { () => {
sendAnalytics(createToolbarEvent('feedback'));
const { _conference } = this.props;
this.props.dispatch(openFeedbackDialog(_conference));
} }
text = { t('toolbar.feedback') } />
);
}
if (shouldShowButton('shortcuts')) {
overflowMenuContent.push(
<OverflowMenuItem
accessibilityLabel = { t(
'toolbar.accessibilityLabel.shortcuts'
) }
icon = { IconOpenInNew }
key = 'shortcuts'
onClick = { () => {
sendAnalytics(createToolbarEvent('shortcuts'));
this.props.dispatch(openKeyboardShortcutsDialog());
} }
text = { t('toolbar.shortcuts') } />
);
}
if (shouldShowButton('download')) {
overflowMenuContent.push(
<DownloadButton
key = 'download'
showLabel = { true } />
);
}
if (shouldShowButton('help')) {
overflowMenuContent.push(
<HelpButton
key = 'help'
showLabel = { true } />
);
}
return overflowMenuContent;
}
/**
* Updates the Redux state when full screen mode has been enabled or
* disabled.
*
* @private
* @returns {void}
*/
_onFullScreenChange() {
this.props.dispatch(fullScreenChanged(APP.UI.isFullScreen()));
}
/**
* Displays the toolbar.
*
* @private
* @returns {void}
*/
_onShowToolbar() {
this.props.dispatch(showToolbox());
}
/**
* Until we don't rewrite UI using react components
* we use UI.start from old app. Also method translates
* component right after it has been mounted.
*
* @inheritdoc
*/
_start() {
APP.UI.start();
APP.UI.registerListeners();
APP.UI.bindEvents();
FULL_SCREEN_EVENTS.forEach(name =>
document.addEventListener(name, this._onFullScreenChange)
);
const { dispatch, t } = this.props;
dispatch(connect());
maybeShowSuboptimalExperienceNotification(dispatch, t);
interfaceConfig.filmStripOnly
&& dispatch(setToolboxAlwaysVisible(true));
}
}
/**
* Maps (parts of) the Redux state to the associated props for the
* {@code Conference} component.
*
* @param {Object} state - The Redux state.
* @private
* @returns {Props}
*/
function _mapStateToProps(state) {
const { callStatsID } = state['features/base/config'];
const { fullScreen, overflowMenuVisible } = state['features/toolbox'];
const localVideo = getLocalVideoTrack(state['features/base/tracks']);
const sharedVideoStatus = state['features/shared-video'].status;
const buttons = new Set(interfaceConfig.TOOLBAR_BUTTONS);
const visibleButtons = new Set(interfaceConfig.TOOLBAR_BUTTONS);
return {
...abstractMapStateToProps(state),
_iAmRecorder: state['features/base/config'].iAmRecorder,
_layoutClassName: LAYOUT_CLASSNAMES[getCurrentLayout(state)],
_roomName: getConferenceNameForTitle(state),
_showPrejoin: isPrejoinPageVisible(state),
_overflowMenuVisible: state['features/toolbox'].overflowMenuVisible,
_feedbackConfigured: Boolean(callStatsID),
_fullScreen: fullScreen,
_screensharing: localVideo && localVideo.videoType === 'desktop',
_sharingVideo:
sharedVideoStatus === 'playing'
|| sharedVideoStatus === 'start'
|| sharedVideoStatus === 'pause',
_isGuest: state['features/base/jwt'].isGuest,
_visibleButtons: equals(visibleButtons, buttons)
? visibleButtons
: buttons,
_conference: state['features/base/conference']
};
}
export default reactReduxConnect(_mapStateToProps)(translate(Conference));
| 32.262295 | 94 | 0.525965 |
02087d97b3198d4edf1c460f1dd941937920331c | 530 | js | JavaScript | src/config/firebaseConfig.js | opportunity-hack-san-jose-2019/Team35 | 85fb9a141912a72b9b4d7ac5984670d50ccc0939 | [
"Unlicense"
] | 1 | 2019-11-02T19:29:20.000Z | 2019-11-02T19:29:20.000Z | src/config/firebaseConfig.js | opportunity-hack-san-jose-2019/Team35 | 85fb9a141912a72b9b4d7ac5984670d50ccc0939 | [
"Unlicense"
] | null | null | null | src/config/firebaseConfig.js | opportunity-hack-san-jose-2019/Team35 | 85fb9a141912a72b9b4d7ac5984670d50ccc0939 | [
"Unlicense"
] | null | null | null | import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/storage'
const config = {
apiKey: "AIzaSyBtNTrHxCY9tqmk65vnpGpiSVgoIyYMoYM",
authDomain: "hackathon-84a0c.firebaseapp.com",
databaseURL: "https://hackathon-84a0c.firebaseio.com",
projectId: "hackathon-84a0c",
storageBucket: "hackathon-84a0c.appspot.com",
messagingSenderId: "536212789477",
};
firebase.initializeApp(config);
const storage = firebase.storage();
export {
storage, firebase as default
} | 26.5 | 58 | 0.722642 |
0209b970cdc29af2a2b57210176c89cc3b7cff4e | 123 | js | JavaScript | crates/swc/tests/tsc-references/objectLiteralShorthandPropertiesAssignment_es2015.2.minified.js | mengxy/swc | bcc3ae86ae0732979f9fbfef370ae729ba9af080 | [
"Apache-2.0"
] | 21,008 | 2017-04-01T04:06:55.000Z | 2022-03-31T23:11:05.000Z | tests/tsc-references/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentES6/input.ts/es2015.2.minified/output.js | sventschui/swc | cd2a2777d9459ba0f67774ed8a37e2b070b51e81 | [
"Apache-2.0",
"MIT"
] | 2,309 | 2018-01-14T05:54:44.000Z | 2022-03-31T15:48:40.000Z | tests/tsc-references/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentES6/input.ts/es2015.2.minified/output.js | sventschui/swc | cd2a2777d9459ba0f67774ed8a37e2b070b51e81 | [
"Apache-2.0",
"MIT"
] | 768 | 2018-01-14T05:15:43.000Z | 2022-03-30T11:29:42.000Z | function bar(name, id) {
return {
name,
id
};
}
bar("Hello", 5), bar("Hello", 5), bar("Hello", 5);
| 15.375 | 50 | 0.455285 |
020aa2d9be035097335a48997fb6bfdfc06d9027 | 14,336 | js | JavaScript | public/js/libs/raven-1.1.16.min.js | mickaobrien/web-sharelatex | 86d6b885e9ca9d261b0e7d90d6600b90c57dd353 | [
"MIT"
] | 1 | 2021-04-08T12:16:24.000Z | 2021-04-08T12:16:24.000Z | public/js/libs/raven-1.1.16.min.js | mickaobrien/web-sharelatex | 86d6b885e9ca9d261b0e7d90d6600b90c57dd353 | [
"MIT"
] | null | null | null | public/js/libs/raven-1.1.16.min.js | mickaobrien/web-sharelatex | 86d6b885e9ca9d261b0e7d90d6600b90c57dd353 | [
"MIT"
] | null | null | null | /*! Raven.js 1.1.16 (2cf8531) | github.com/getsentry/raven-js */
!function(a,b){"use strict";function c(a,b){var c,d;b=b||{},a="raven"+a.substr(0,1).toUpperCase()+a.substr(1),document.createEvent?(c=document.createEvent("HTMLEvents"),c.initEvent(a,!0,!0)):(c=document.createEventObject(),c.eventType=a);for(d in b)j(b,d)&&(c[d]=b[d]);if(document.createEvent)document.dispatchEvent(c);else try{document.fireEvent("on"+c.eventType.toLowerCase(),c)}catch(e){}}function d(a){this.name="RavenConfigError",this.message=a}function e(a){var b=Q.exec(a),c={},e=7;try{for(;e--;)c[P[e]]=b[e]||""}catch(f){throw new d("Invalid DSN: "+a)}if(c.pass)throw new d("Do not specify your private key in the DSN!");return c}function f(a){return"undefined"==typeof a}function g(a){return"function"==typeof a}function h(a){return"string"==typeof a}function i(a){for(var b in a)return!1;return!0}function j(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function k(a,b){var c,d;if(f(a.length))for(c in a)j(a,c)&&b.call(null,c,a[c]);else if(d=a.length)for(c=0;d>c;c++)b.call(null,c,a[c])}function l(){J="?sentry_version=4&sentry_client=raven-js/"+O.VERSION+"&sentry_key="+H}function m(a,b){var d=[];a.stack&&a.stack.length&&k(a.stack,function(a,b){var c=n(b);c&&d.push(c)}),c("handle",{stackInfo:a,options:b}),p(a.name,a.message,a.url,a.lineno,d,b)}function n(a){if(a.url){var b,c={filename:a.url,lineno:a.line,colno:a.column,"function":a.func||"?"},d=o(a);if(d){var e=["pre_context","context_line","post_context"];for(b=3;b--;)c[e[b]]=d[b]}return c.in_app=!(!M.includePaths.test(c.filename)||/(Raven|TraceKit)\./.test(c["function"])||/raven\.(min\.)?js$/.test(c.filename)),c}}function o(a){if(a.context&&M.fetchContext){for(var b=a.context,c=~~(b.length/2),d=b.length,e=!1;d--;)if(b[d].length>300){e=!0;break}if(e){if(f(a.column))return;return[[],b[c].substr(a.column,50),[]]}return[b.slice(0,c),b[c],b.slice(c+1)]}}function p(a,b,c,d,e,f){var g,h;b+="",("Error"!==a||b)&&(M.ignoreErrors.test(b)||(e&&e.length?(c=e[0].filename||c,e.reverse(),g={frames:e}):c&&(g={frames:[{filename:c,lineno:d,in_app:!0}]}),b=r(b,100),M.ignoreUrls&&M.ignoreUrls.test(c)||(!M.whitelistUrls||M.whitelistUrls.test(c))&&(h=d?b+" at "+d:b,t(q({exception:{type:a,value:b},stacktrace:g,culprit:c,message:h},f)))))}function q(a,b){return b?(k(b,function(b,c){a[b]=c}),a):a}function r(a,b){return a.length<=b?a:a.substr(0,b)+"โฆ"}function s(){var a={url:document.location.href,headers:{"User-Agent":navigator.userAgent}};return document.referrer&&(a.headers.Referer=document.referrer),a}function t(a){v()&&(a=q({project:I,logger:M.logger,site:M.site,platform:"javascript",request:s()},a),a.tags=q(M.tags,a.tags),a.extra=q(M.extra,a.extra),i(a.tags)&&delete a.tags,i(a.extra)&&delete a.extra,G&&(a.user=G),g(M.dataCallback)&&(a=M.dataCallback(a)),(!g(M.shouldSendCallback)||M.shouldSendCallback(a))&&(E=a.event_id||(a.event_id=x()),u(a)))}function u(a){var b=new Image,d=F+J+"&sentry_data="+encodeURIComponent(JSON.stringify(a));b.onload=function(){c("success",{data:a,src:d})},b.onerror=b.onabort=function(){c("failure",{data:a,src:d})},b.src=d}function v(){return L?F?!0:(y("error","Error: Raven has not been configured."),!1):!1}function w(a){for(var b,c=[],d=0,e=a.length;e>d;d++)b=a[d],h(b)?c.push(b.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):b&&b.source&&c.push(b.source);return new RegExp(c.join("|"),"i")}function x(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})}function y(b,c){a.console&&console[b]&&O.debug&&console[b](c)}function z(){var b=a.RavenConfig;b&&O.config(b.dsn,b.config).install()}var A={remoteFetching:!1,collectWindowErrors:!0,linesOfContext:7},B=[].slice,C="?";A.wrap=function(a){function b(){try{return a.apply(this,arguments)}catch(b){throw A.report(b),b}}return b},A.report=function(){function c(a){h(),o.push(a)}function d(a){for(var b=o.length-1;b>=0;--b)o[b]===a&&o.splice(b,1)}function e(){i(),o=[]}function f(a,b){var c=null;if(!b||A.collectWindowErrors){for(var d in o)if(j(o,d))try{o[d].apply(null,[a].concat(B.call(arguments,2)))}catch(e){c=e}if(c)throw c}}function g(a,b,c,d,e){var g=null;if(r)A.computeStackTrace.augmentStackTraceWithInitialElement(r,b,c,a),k();else if(e)g=A.computeStackTrace(e),f(g,!0);else{var h={url:b,line:c,column:d};h.func=A.computeStackTrace.guessFunctionName(h.url,h.line),h.context=A.computeStackTrace.gatherContext(h.url,h.line),g={message:a,url:document.location.href,stack:[h]},f(g,!0)}return m?m.apply(this,arguments):!1}function h(){n||(m=a.onerror,a.onerror=g,n=!0)}function i(){n&&(a.onerror=m,n=!1,m=b)}function k(){var a=r,b=p;p=null,r=null,q=null,f.apply(null,[a,!1].concat(b))}function l(b,c){var d=B.call(arguments,1);if(r){if(q===b)return;k()}var e=A.computeStackTrace(b);if(r=e,q=b,p=d,a.setTimeout(function(){q===b&&k()},e.incomplete?2e3:0),c!==!1)throw b}var m,n,o=[],p=null,q=null,r=null;return l.subscribe=c,l.unsubscribe=d,l.uninstall=e,l}(),A.computeStackTrace=function(){function b(b){if(!A.remoteFetching)return"";try{var c=function(){try{return new a.XMLHttpRequest}catch(b){return new a.ActiveXObject("Microsoft.XMLHTTP")}},d=c();return d.open("GET",b,!1),d.send(""),d.responseText}catch(e){return""}}function c(a){if(!h(a))return[];if(!j(v,a)){var c="";-1!==a.indexOf(document.domain)&&(c=b(a)),v[a]=c?c.split("\n"):[]}return v[a]}function d(a,b){var d,e=/function ([^(]*)\(([^)]*)\)/,g=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,h="",i=10,j=c(a);if(!j.length)return C;for(var k=0;i>k;++k)if(h=j[b-k]+h,!f(h)){if(d=g.exec(h))return d[1];if(d=e.exec(h))return d[1]}return C}function e(a,b){var d=c(a);if(!d.length)return null;var e=[],g=Math.floor(A.linesOfContext/2),h=g+A.linesOfContext%2,i=Math.max(0,b-g-1),j=Math.min(d.length,b+h-1);b-=1;for(var k=i;j>k;++k)f(d[k])||e.push(d[k]);return e.length>0?e:null}function g(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function i(a){return g(a).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function k(a,b){for(var d,e,f=0,g=b.length;g>f;++f)if((d=c(b[f])).length&&(d=d.join("\n"),e=a.exec(d)))return{url:b[f],line:d.substring(0,e.index).split("\n").length,column:e.index-d.lastIndexOf("\n",e.index)-1};return null}function l(a,b,d){var e,f=c(b),h=new RegExp("\\b"+g(a)+"\\b");return d-=1,f&&f.length>d&&(e=h.exec(f[d]))?e.index:null}function m(b){for(var c,d,e,f,h=[a.location.href],j=document.getElementsByTagName("script"),l=""+b,m=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,n=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,o=0;o<j.length;++o){var p=j[o];p.src&&h.push(p.src)}if(e=m.exec(l)){var q=e[1]?"\\s+"+e[1]:"",r=e[2].split(",").join("\\s*,\\s*");c=g(e[3]).replace(/;$/,";?"),d=new RegExp("function"+q+"\\s*\\(\\s*"+r+"\\s*\\)\\s*{\\s*"+c+"\\s*}")}else d=new RegExp(g(l).replace(/\s+/g,"\\s+"));if(f=k(d,h))return f;if(e=n.exec(l)){var s=e[1];if(c=i(e[2]),d=new RegExp("on"+s+"=[\\'\"]\\s*"+c+"\\s*[\\'\"]","i"),f=k(d,h[0]))return f;if(d=new RegExp(c),f=k(d,h))return f}return null}function n(a){if(!a.stack)return null;for(var b,c,g=/^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?((?:file|https?|chrome-extension):.*?):(\d+)(?::(\d+))?\)?\s*$/i,h=/^\s*(\S*)(?:\((.*?)\))?@((?:file|https?|chrome).*?):(\d+)(?::(\d+))?\s*$/i,i=a.stack.split("\n"),j=[],k=/^(.*) is undefined$/.exec(a.message),m=0,n=i.length;n>m;++m){if(b=h.exec(i[m]))c={url:b[3],func:b[1]||C,args:b[2]?b[2].split(","):"",line:+b[4],column:b[5]?+b[5]:null};else{if(!(b=g.exec(i[m])))continue;c={url:b[2],func:b[1]||C,line:+b[3],column:b[4]?+b[4]:null}}!c.func&&c.line&&(c.func=d(c.url,c.line)),c.line&&(c.context=e(c.url,c.line)),j.push(c)}return j.length?(j[0].line&&!j[0].column&&k?j[0].column=l(k[1],j[0].url,j[0].line):j[0].column||f(a.columnNumber)||(j[0].column=a.columnNumber+1),{name:a.name,message:a.message,url:document.location.href,stack:j}):null}function o(a){for(var b,c=a.stacktrace,f=/ line (\d+), column (\d+) in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i,g=c.split("\n"),h=[],i=0,j=g.length;j>i;i+=2)if(b=f.exec(g[i])){var k={line:+b[1],column:+b[2],func:b[3]||b[4],args:b[5]?b[5].split(","):[],url:b[6]};if(!k.func&&k.line&&(k.func=d(k.url,k.line)),k.line)try{k.context=e(k.url,k.line)}catch(l){}k.context||(k.context=[g[i+1]]),h.push(k)}return h.length?{name:a.name,message:a.message,url:document.location.href,stack:h}:null}function p(b){var f=b.message.split("\n");if(f.length<4)return null;var g,h,l,m,n=/^\s*Line (\d+) of linked script ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i,p=/^\s*Line (\d+) of function script\s*$/i,q=[],r=document.getElementsByTagName("script"),s=[];for(h in r)j(r,h)&&!r[h].src&&s.push(r[h]);for(h=2,l=f.length;l>h;h+=2){var t=null;if(g=n.exec(f[h]))t={url:g[2],func:g[3],line:+g[1]};else if(g=o.exec(f[h])){t={url:g[3],func:g[4]};var u=+g[1],v=s[g[2]-1];if(v&&(m=c(t.url))){m=m.join("\n");var w=m.indexOf(v.innerText);w>=0&&(t.line=u+m.substring(0,w).split("\n").length)}}else if(g=p.exec(f[h])){var x=a.location.href.replace(/#.*$/,""),y=g[1],z=new RegExp(i(f[h+1]));m=k(z,[x]),t={url:x,line:m?m.line:y,func:""}}if(t){t.func||(t.func=d(t.url,t.line));var A=e(t.url,t.line),B=A?A[Math.floor(A.length/2)]:null;t.context=A&&B.replace(/^\s*/,"")===f[h+1].replace(/^\s*/,"")?A:[f[h+1]],q.push(t)}}return q.length?{name:b.name,message:f[0],url:document.location.href,stack:q}:null}function q(a,b,c,f){var g={url:b,line:c};if(g.url&&g.line){a.incomplete=!1,g.func||(g.func=d(g.url,g.line)),g.context||(g.context=e(g.url,g.line));var h=/ '([^']+)' /.exec(f);if(h&&(g.column=l(h[1],g.url,g.line)),a.stack.length>0&&a.stack[0].url===g.url){if(a.stack[0].line===g.line)return!1;if(!a.stack[0].line&&a.stack[0].func===g.func)return a.stack[0].line=g.line,a.stack[0].context=g.context,!1}return a.stack.unshift(g),a.partial=!0,!0}return a.incomplete=!0,!1}function r(a,b){for(var c,e,f,g=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,h=[],i={},j=!1,k=r.caller;k&&!j;k=k.caller)if(k!==s&&k!==A.report){if(e={url:null,func:C,line:null,column:null},k.name?e.func=k.name:(c=g.exec(k.toString()))&&(e.func=c[1]),f=m(k)){e.url=f.url,e.line=f.line,e.func===C&&(e.func=d(e.url,e.line));var n=/ '([^']+)' /.exec(a.message||a.description);n&&(e.column=l(n[1],f.url,f.line))}i[""+k]?j=!0:i[""+k]=!0,h.push(e)}b&&h.splice(0,b);var o={name:a.name,message:a.message,url:document.location.href,stack:h};return q(o,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description),o}function s(a,b){var c=null;b=null==b?0:+b;try{if(c=o(a))return c}catch(d){if(u)throw d}try{if(c=n(a))return c}catch(d){if(u)throw d}try{if(c=p(a))return c}catch(d){if(u)throw d}try{if(c=r(a,b+1))return c}catch(d){if(u)throw d}return{}}function t(a){a=(null==a?0:+a)+1;try{throw new Error}catch(b){return s(b,a+1)}}var u=!1,v={};return s.augmentStackTraceWithInitialElement=q,s.guessFunctionName=d,s.gatherContext=e,s.ofCaller=t,s}();var D,E,F,G,H,I,J,K=a.Raven,L=!(!a.JSON||!a.JSON.stringify),M={logger:"javascript",ignoreErrors:[],ignoreUrls:[],whitelistUrls:[],includePaths:[],collectWindowErrors:!0,tags:{},extra:{}},N=!1,O={VERSION:"1.1.16",debug:!0,noConflict:function(){return a.Raven=K,O},config:function(a,b){if(F)return y("error","Error: Raven has already been configured"),O;if(!a)return O;var c=e(a),d=c.path.lastIndexOf("/"),f=c.path.substr(1,d);return b&&k(b,function(a,b){M[a]=b}),M.ignoreErrors.push("Script error."),M.ignoreErrors.push("Script error"),M.ignoreErrors.push("Javascript error: Script error on line 0"),M.ignoreErrors.push("Javascript error: Script error. on line 0"),M.ignoreErrors=w(M.ignoreErrors),M.ignoreUrls=M.ignoreUrls.length?w(M.ignoreUrls):!1,M.whitelistUrls=M.whitelistUrls.length?w(M.whitelistUrls):!1,M.includePaths=w(M.includePaths),H=c.user,I=c.path.substr(d+1),F="//"+c.host+(c.port?":"+c.port:"")+"/"+f+"api/"+I+"/store/",c.protocol&&(F=c.protocol+":"+F),M.fetchContext&&(A.remoteFetching=!0),M.linesOfContext&&(A.linesOfContext=M.linesOfContext),A.collectWindowErrors=!!M.collectWindowErrors,l(),O},install:function(){return v()&&!N&&(A.report.subscribe(m),N=!0),O},context:function(a,c,d){return g(a)&&(d=c||[],c=a,a=b),O.wrap(a,c).apply(this,d)},wrap:function(a,c){function d(){for(var b=[],d=arguments.length,e=!a||a&&a.deep!==!1;d--;)b[d]=e?O.wrap(a,arguments[d]):arguments[d];try{return c.apply(this,b)}catch(f){throw O.captureException(f,a),f}}if(f(c)&&!g(a))return a;if(g(a)&&(c=a,a=b),!g(c))return c;if(c.__raven__)return c;for(var e in c)j(c,e)&&(d[e]=c[e]);return d.__raven__=!0,d.__inner__=c,d},uninstall:function(){return A.report.uninstall(),N=!1,O},captureException:function(a,b){if(!(a instanceof Error))return O.captureMessage(a,b);D=a;try{A.report(a,b)}catch(c){if(a!==c)throw c}return O},captureMessage:function(a,b){return t(q({message:a+""},b)),O},setUserContext:function(a){return G=a,O},setExtraContext:function(a){return M.extra=a||{},O},setTagsContext:function(a){return M.tags=a||{},O},lastException:function(){return D},lastEventId:function(){return E}};O.setUser=O.setUserContext;var P="source protocol user pass host port path".split(" "),Q=/^(?:(\w+):)?\/\/(\w+)(:\w+)?@([\w\.-]+)(?::(\d+))?(\/.*)/;d.prototype=new Error,d.prototype.constructor=d,z(),a.Raven=O,"function"==typeof define&&define.amd&&define("raven",[],function(){return O})}(this),function(a,b,c){"use strict";if(c){var d=c.event.add;c.event.add=function(a,e,f,g,h){var i;return f&&f.handler?(i=f.handler,f.handler=b.wrap(f.handler)):(i=f,f=b.wrap(f)),f.guid=i.guid?i.guid:i.guid=c.guid++,d.call(this,a,e,f,g,h)};var e=c.fn.ready;c.fn.ready=function(a){return e.call(this,b.wrap(a))};var f=c.ajax;c.ajax=function(a,d){var e,g=["complete","error","success"];for("object"==typeof a&&(d=a,a=void 0),d=d||{};e=g.pop();)c.isFunction(d[e])&&(d[e]=b.wrap(d[e]));try{return f.call(this,a,d)}catch(h){throw b.captureException(h),h}}}}(this,Raven,window.jQuery),function(a,b){"use strict";var c=function(c){var d=a[c];a[c]=function(){var a=[].slice.call(arguments),c=a[0];return"function"==typeof c&&(a[0]=b.wrap(c)),d.apply?d.apply(this,a):d(a[0],a[1])}};c("setTimeout"),c("setInterval")}(this,Raven);
| 4,778.666667 | 14,270 | 0.639858 |
020b6144e9d51d2d945f29627efb4ab6b8c12ffc | 21,108 | js | JavaScript | server/controllers/Users.controller.js | jericoxnavarro/SureSafe | 0528a6360ae2b4960fbcb09e15e1ed02b39f81ab | [
"Apache-2.0"
] | null | null | null | server/controllers/Users.controller.js | jericoxnavarro/SureSafe | 0528a6360ae2b4960fbcb09e15e1ed02b39f81ab | [
"Apache-2.0"
] | null | null | null | server/controllers/Users.controller.js | jericoxnavarro/SureSafe | 0528a6360ae2b4960fbcb09e15e1ed02b39f81ab | [
"Apache-2.0"
] | null | null | null | const Users = require("../models/Users.model");
const Tracing = require("../models/Tracing.model");
const Data = require("../models/Data.model");
const Cases = require("../models/Cases.model");
const Admin = require("../models/Admin.model");
const Joi = require("@hapi/joi");
const bcrypt = require("bcryptjs");
const jwt = require("jsonwebtoken");
const Vonage = require("@vonage/server-sdk");
const passwordComplexity = require("joi-password-complexity");
const moment = require("moment");
const { ERROR, INFO } = require("../utils/logger");
const ilocosSur = require("../utils/IlocosSur.json");
const vonage = new Vonage({
apiKey: process.env.vonageKey,
apiSecret: process.env.vonageSecret,
});
exports.userCreate = async (req, res) => {
try {
const emailExist = await Users.findOne({
email: req.body.email.toLowerCase(),
});
if (emailExist)
return res.status(409).send({
title: "Email is Used!",
message: `Email is already in use. Please try use different email.`,
statusCode: 409,
});
const complexityOptions = {
min: 8,
max: 25,
lowerCase: 1,
upperCase: 1,
numeric: 1,
symbol: 1,
requirementCount: 4,
};
const errorPass = passwordComplexity(complexityOptions).validate(
req.body.password
);
if (errorPass.error)
return res.status(406).send({
title: "Invalid Password!",
message:
"Password must be atleast 8 characters, 1 number, 1 lowercase and uppercase, 1 symbol",
statusCode: 406,
});
// Hash password
const salt = await bcrypt.genSalt(10);
const hashedPassword = await bcrypt.hash(req.body.password, salt);
const user = new Users({
email: req.body.email.toLowerCase(),
password: hashedPassword,
agreement: true,
userState: {
status: "Covid Free",
exposure: "Not Exposed",
},
role: "User",
status: "new",
picture: req.files["picture"][0].path,
validId: req.files["validId"][0].path,
firstName: req.body.firstName,
lastName: req.body.lastName,
municipality: req.body.municipality,
barangay: req.body.barangay,
number: req.body.number,
});
const saveUser = await user.save();
const number =
req.body.number.charAt(0) === "0"
? `+63${req.body.number.substring(1)}`
: `+63${req.body.number}`;
const text =
"[SURESAFE] VERIFICATION:\n\nYour account is on verification process. We will send an SMS regarding your Account Status and QR Code. This may take time! Thank you for your patience! \n\n";
vonage.message.sendSms("Suresafe", number, text, (err, responseData) => {
if (err) {
console.log(err);
} else {
if (responseData.messages[0]["status"] === "0") {
console.log("Message sent successfully.");
} else {
console.log(
`Message failed with error: ${responseData.messages[0]["error-text"]}`
);
}
}
});
return res.status(201).json({
user: user._id,
title: "Successfully Created!",
message:
"Your accout is created. Please press ok to add your information.",
statusCode: 201,
data: saveUser,
});
} catch (err) {
console.log(err);
ERROR.error(`${err.message} Users Controller`);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.addQrCode = async (req, res) => {
try {
const update = await Users.updateOne(
{ _id: req.body.id },
{
qrcode: req.files["qrcode"][0].path,
}
);
return res.status(201).send({
title: "Successfully Updated!",
message: "User info Updated!",
statusCode: 201,
data: update,
});
} catch (err) {
console.log(err);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.updateStatus = async (req, res) => {
const { id, status } = req.body;
console.log("id", req.body);
try {
const userData = await Users.findOne({
_id: id,
});
if (userData) {
const number =
`${userData.number}`.charAt(0) === "0"
? `+63${`${userData.number}`.substring(1)}`
: `+63${userData.number}`;
if (status === "approve") {
const update = await Users.updateOne(
{ _id: id },
{
status,
}
);
vonage.message.sendSms(
"Suresafe",
number,
"[SURESAFE] VERIFIED:\n\nYour account is now Verified! \nYou can now use your account in SureSafe app. Thank you! \n\n"
);
vonage.message.sendSms(
"Suresafe",
number,
`[SURESAFE] QRCODE:\n\nYou can now download your own QR Code! \nDownload Here: https://api.suresafe.me/${userData.qrcode} \n\nYou can use this to any establishments using SureSafe!\n\n`
);
return res.status(201).send({
title: "Successfully Updated!",
message: "User info Updated!",
statusCode: 201,
data: update,
});
} else if (status === "denied") {
const deleteUser = await Users.deleteOne({ _id: id });
vonage.message.sendSms(
"Suresafe",
number,
"[SURESAFE] DENIED:\n\nYour account is Denied and has been deleted! \n Please try to register again. Try to make your Valid ID and Picture clear so the admins can verify it easily. Thank you! \n\n"
);
return res.status(201).send({
title: "Successfully Deleted!",
message: "User info Deleted!",
statusCode: 201,
data: deleteUser,
});
}
} else {
return res.status(404).send({
title: "Not Found",
message: "User Not Found!",
das: userData,
statusCode: 404,
});
}
} catch (err) {
console.log(err);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.addInfo = async (req, res) => {
const { _id, firstName, lastName, municipality, barangay } = req.body;
try {
const validation = Joi.object({
_id: Joi.string().required(),
firstName: Joi.string().required(),
lastName: Joi.string().required(),
municipality: Joi.string().required(),
barangay: Joi.string().required(),
});
const { error } = validation.validate(req.body);
if (error) {
console.log(error);
return res.status(401).send({
title: "Something went Wrong!",
message:
"Its look like your information is not accepted. Please try again.",
statusCode: 401,
});
}
if (!ilocosSur[municipality]) {
return res.status(401).send({
title: "Invalid Municipality!",
message: `${municipality} is not a municipality in Ilocos Sur`,
statusCode: 401,
});
} else if (!ilocosSur[municipality].barangay_list.includes(barangay)) {
return res.status(401).send({
title: "Invalid Barangay!",
message: `${barangay} is not a barangay in ${municipality}`,
statusCode: 401,
});
}
const update = await Users.updateOne(
{ _id },
{
firstName,
lastName,
municipality,
barangay,
}
);
INFO.info(`User ${_id} info is Updated!`);
return res.status(201).send({
title: "Successfully Updated!",
message: "User info Updated!",
statusCode: 201,
data: update,
});
} catch (err) {
ERROR.error(`${err.message} Users Controller`);
console.log(err);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.addNumber = async (req, res) => {
const { _id, number, date } = req.body;
try {
const validation = Joi.object({
_id: Joi.string().required(),
number: Joi.number().required(),
date: Joi.date().required(),
});
const { error } = validation.validate(req.body);
if (error)
return res.status(401).send({
title: "Something went Wrong!",
message:
"Its look like your information is not accepted. Please try again.",
statusCode: 401,
});
const code = Math.floor(1000 + Math.random() * 9000);
const time = moment(date).add(5, "m").toDate();
await Users.updateOne(
{ _id },
{
number,
verify: {
code,
time,
},
}
);
const from = "SureSafe";
const to = `63${number}`;
const text = `${code} is your SureSafe verification code. Valid for 5 minutes.`;
vonage.message.sendSms(from, to, text, (err, responseData) => {
if (err) {
ERROR.error(`${err.message} Users Controller`);
} else {
if (responseData.messages[0]["status"] === "0") {
console.log("Message sent successfully.");
} else {
ERROR.error(
`Message failed with error: ${responseData.messages[0]["error-text"]}`
);
}
}
});
return res.status(201).send({
title: "Check your number!",
message: `OTP has been sent to +63${number}. Press OK to enter your Code.`,
statusCode: 201,
});
} catch (err) {
ERROR.error(`${err.message} Users Controller`);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.checkOTP = async (req, res) => {
const { _id, code, date } = req.body;
try {
const validation = Joi.object({
_id: Joi.string().required(),
code: Joi.number().required(),
date: Joi.date().required(),
});
const { error } = validation.validate(req.body);
if (error)
return res.status(401).send({
title: "Something went Wrong!",
message:
"Its look like your information is not accepted. Please try again.",
statusCode: 401,
});
const user = await Users.findById(_id);
if (user) {
const userCode = user.verify.code;
const userTime = user.verify.time;
if (code == userCode) {
if (moment(userTime).isAfter(date)) {
const token = jwt.sign({ _id }, process.env.ACCESS_TOKEN_SECRET, {
expiresIn: "30d",
});
return res.status(202).send({
title: "Code Verified!",
message: "Code has been successfully verified!",
token: token,
loggedIN: "true",
verified: "true",
statusCode: 202,
});
} else {
return res.status(401).send({
title: "Code Expired!",
message: "Code is Expired! Please Try Again.",
verified: "false",
statusCode: 401,
});
}
} else {
return res.status(403).send({
title: "Invalid Code!",
message: "Wrong code! Please Try Again.",
verified: "false",
statusCode: 403,
});
}
} else {
return res.status(404).send({
title: "Invalid User!",
message: "Invalid User! Please Try Again.",
verified: "false",
statusCode: 404,
});
}
} catch (err) {
ERROR.error(`${err.message} Users Controller`);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.logIn = async (req, res) => {
try {
const validation = Joi.object({
email: Joi.string().required(),
password: Joi.string().required(),
});
// Request Validations
const { error } = validation.validate(req.body);
if (error)
return res.status(401).send({
title: "Something went Wrong!",
message:
"It's look like your information is not accepted. Please try again.",
statusCode: 401,
});
// Check if email exists
const user = await Users.findOne({ email: req.body.email.toLowerCase() });
if (!user)
return res.status(404).send({
title: `Email or Password is Invalid`,
message: "Email or Password is wrong. Please try again.",
statusCode: 404,
});
if (user.status === "new")
return res.status(404).send({
title: `Invalid Account`,
message:
"Account is not verified. Please wait for the admins to approve your account.",
statusCode: 404,
});
// Check if password valid
const validPass = await bcrypt.compare(req.body.password, user.password);
if (!validPass)
return res.status(403).send({
title: `Invalid Password`,
message: "Password is Invalid. Please try again.",
statusCode: 403,
});
// Create and assign token
const payload = {
_id: user._id,
};
const token = jwt.sign(payload, process.env.ACCESS_TOKEN_SECRET, {
expiresIn: "1d",
});
return res
.status(200)
.header("authToken", token)
.send({
title: `Logged In`,
message: `Successfully Logged In! Welcome back ${user.firstName} ${user.lastName}`,
statusCode: 200,
userID: user._id,
token: token,
verified: "true",
loggedIN: "true",
});
} catch (err) {
console.log(err);
ERROR.error(`${err.message} Users Controller`);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.getUser = async (req, res) => {
try {
const findUser = await Users.findOne({ _id: req.params.userID });
const { firstName, lastName, municipality, barangay, number, email, role } =
findUser;
function capitalize(words) {
var separateWord = words.toLowerCase().split(" ");
for (var i = 0; i < separateWord.length; i++) {
separateWord[i] =
separateWord[i].charAt(0).toUpperCase() +
separateWord[i].substring(1);
}
return separateWord.join(" ");
}
const brgy = capitalize(barangay.toLowerCase());
const muni = capitalize(municipality.toLowerCase());
const DATA = {
firstName: firstName,
lastName: lastName,
municipality: muni,
barangay: brgy,
number: `+63${number}`,
email: email.toLowerCase(),
role: role,
};
return res.status(200).json({
message: "User data retrived!",
data: DATA,
statusCode: 200,
});
} catch (err) {
ERROR.error(`${err.message} Users Controller`);
console.log(err);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.changeRole = async (req, res) => {
try {
const { _id, role, code } = req.body;
console.log("asghjfj");
const getAdmins = await Admin.find();
const codes = getAdmins[0]?.codes;
const findCode = codes.find((value) => value.code === code);
if (findCode) {
if (findCode.used) {
return res.status(400).send({
title: `Code is Invalid`,
message: `${code} is now used already.`,
statusCode: 400,
data: updateUser,
});
} else {
const updateUser = await Users.updateOne(
{ _id },
{
role,
}
);
const updatedCode = [];
for (let i = 0; i < codes.length; i++) {
if (codes[i].code === code) {
updatedCode.push({
code: codes[i].code,
used: true,
});
} else {
updatedCode.push({
code: codes[i].code,
used: codes[i].used,
});
}
}
await Users.updateOne(
{ _id: getAdmins[0]?._id },
{
codes: updatedCode,
}
);
if (updateUser) {
return res.status(201).send({
title: `Successfully Changed`,
message: `Your role is changed to ${role}. You can now add cases!`,
statusCode: 201,
data: updateUser,
});
}
}
} else {
return res.status(405).send({
title: `Code is Invalid`,
message: `${code} is not a valid code. Please Try Again.`,
statusCode: 405,
});
}
} catch (err) {
console.log(err);
}
};
exports.getNotifications = async (req, res) => {
try {
const { userID } = req.params;
const findUser = await Users.findOne({ _id: userID });
if (findUser) {
return res.status(201).send({
title: `Retrived Notifications`,
message: `Retrived Notifications`,
statusCode: 201,
data: findUser.notifications,
});
}
} catch (err) {}
};
exports.getStatus = async (req, res) => {
try {
const { userID } = req.params;
const findUser = await Users.findOne({ _id: userID });
const getData = await Data.find();
const getCases = await Cases.find();
const getUsers = await Users.find();
const getTracing = await Tracing.find();
let infected = 0;
let exposed = 0;
let recovered = 0;
let potential = 0;
let totalCases = 0;
let geotracing = getTracing.length;
let users = getUsers.length;
for (let i = 0; i < getCases.length; i++) {
if (getCases[i].status === "Infected") {
infected = 1 + infected;
totalCases = 1 + totalCases;
} else if (getCases[i].status === "Exposed") {
exposed = 1 + exposed;
totalCases = 1 + totalCases;
} else if (getCases[i].status === "Potential") {
potential = 1 + potential;
}
}
return res.status(201).send({
title: `Retrived Status`,
message: `Retrived Status`,
statusCode: 201,
data: {
userState: findUser.userState,
infected,
exposed,
recovered,
potential,
geotracing,
users,
total: totalCases,
logs: findUser.Logs.length,
visits: findUser.Visits.length,
sharedLogs: findUser.sharedLogs.length,
sharedVisits: findUser.sharedVisits.length,
},
});
} catch (err) {
console.log(err);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.getProfile = async (req, res) => {
try {
const findUser = await Users.findOne({ _id: req.params.userID });
const {
_id,
firstName,
lastName,
municipality,
barangay,
number,
email,
role,
lastLogs,
lastVisits,
} = findUser;
function capitalize(words) {
var separateWord = words.toLowerCase().split(" ");
for (var i = 0; i < separateWord.length; i++) {
separateWord[i] =
separateWord[i].charAt(0).toUpperCase() +
separateWord[i].substring(1);
}
return separateWord.join(" ");
}
const brgy = capitalize(barangay.toLowerCase());
const muni = capitalize(municipality.toLowerCase());
const DATA = {
userID: _id,
firstName: firstName,
lastName: lastName,
municipality: muni,
barangay: brgy,
number: `+63${number}`,
email: email.toLowerCase(),
role: role,
lastVisits: lastVisits ? lastVisits : "None",
lastLogs: lastLogs ? lastLogs : "None",
};
return res.status(200).json({
message: "User data retrived!",
data: DATA,
statusCode: 200,
});
} catch (err) {
console.log(err);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
exports.getNewUsers = async (req, res) => {
try {
const allUsers = await Users.find({ status: "approve" });
const findUsers = await Users.find({ status: "new" });
return res.status(200).json({
message: "Users data retrived!",
data: {
users: findUsers,
totalUser: allUsers.length,
totalNewUsers: findUsers.length,
},
statusCode: 200,
});
} catch (err) {
ERROR.error(`${err.message} Users Controller`);
console.log(err);
return res.status(400).send({
title: "Someting went wrong!",
message: "Someting went wrong. Please try again or try again later.",
statusCode: 400,
});
}
};
| 28.562923 | 207 | 0.562441 |
020b6c69af1a775b862ca3f4cb3e0eb2bf83fc18 | 866 | js | JavaScript | public/src/lib/transpiled-esm-npm/esm/renovation/ui/scheduler/appointment/overflow_indicator/utils.js | ahmadaothman/election | 76b4aa1485ff074e94316ba6a3a2e0bb7b19b4a3 | [
"MIT"
] | null | null | null | public/src/lib/transpiled-esm-npm/esm/renovation/ui/scheduler/appointment/overflow_indicator/utils.js | ahmadaothman/election | 76b4aa1485ff074e94316ba6a3a2e0bb7b19b4a3 | [
"MIT"
] | null | null | null | public/src/lib/transpiled-esm-npm/esm/renovation/ui/scheduler/appointment/overflow_indicator/utils.js | ahmadaothman/election | 76b4aa1485ff074e94316ba6a3a2e0bb7b19b4a3 | [
"MIT"
] | null | null | null | import { addToStyles } from "../../workspaces/utils";
export var getOverflowIndicatorStyles = viewModel => {
var {
color,
geometry: {
height,
left,
top,
width
}
} = viewModel;
var result = addToStyles([{
attr: "left",
value: "".concat(left, "px")
}, {
attr: "top",
value: "".concat(top, "px")
}, {
attr: "width",
value: "".concat(width, "px")
}, {
attr: "height",
value: "".concat(height, "px")
}]);
if (color) {
result = addToStyles([{
attr: "backgroundColor",
value: color
}, {
attr: "boxShadow",
value: "inset ".concat(width, "px 0 0 0 rgba(0, 0, 0, 0.3)")
}], result);
}
return result;
};
export var getOverflowIndicatorColor = (color, colors) => !colors.length || colors.filter(item => item !== color).length === 0 ? color : undefined; | 22.789474 | 147 | 0.54157 |
020b875f22d8aff734c161f1a6e3ad504735f016 | 1,022 | js | JavaScript | index.js | spring-media/puresql | 4c353a7b87cce6b88f65945c4c8820971091785a | [
"MIT"
] | null | null | null | index.js | spring-media/puresql | 4c353a7b87cce6b88f65945c4c8820971091785a | [
"MIT"
] | null | null | null | index.js | spring-media/puresql | 4c353a7b87cce6b88f65945c4c8820971091785a | [
"MIT"
] | null | null | null | /**
* puresql
* v 1.4.2
* Functional SQL abstraction for node.js (>6.0.0)
* Inspired by yesql (https://github.com/krisajenkins/yesql)
* Repository: https://github.com/neonerd/puresql
* Author: Andrej Sykora <as@andrejsykora.com>
* License: MIT License
*/
'use strict'
const file = require('./lib/file')
const query = require('./lib/query')
module.exports = {
// define a single query based on the passed sql string
defineQuery: function (sql) {
return query.makeQuery(sql)
},
// define multiple queries based on a single file
loadQueries: function (filePath) {
const queries = file.parseFile(filePath)
for (const key of Object.keys(queries)) {
queries[key] = query.makeQuery(queries[key])
}
return queries
},
// readymade adapters
// usage: require('puresql').adapters.mysql(mysqlConnection)
adapters: {
// mySQL using 'mysql' module
mysql2: require('./lib/adapters/mysql2'),
// dummy adapter for testing purposes
test: require('./lib/adapters/test')
}
}
| 25.55 | 62 | 0.681018 |
020b8bf190e2fb0c487fbc92ad2a6c4300312283 | 15,077 | js | JavaScript | js/src/widgets/toc.js | jeffreytakaki/imageviewer | d1bec0f77c8c821784b40e667c1e54301e125268 | [
"Apache-2.0"
] | 6 | 2016-04-05T14:39:16.000Z | 2022-03-22T20:42:05.000Z | js/src/widgets/toc.js | thegetty/mirador | 1ee6e1ca996a1acdc54d3d27c07c458f2ca8e140 | [
"Apache-2.0"
] | 8 | 2020-02-10T12:25:32.000Z | 2022-02-04T09:27:11.000Z | js/src/widgets/toc.js | ProjectMirador/mirador2 | e0ce205c360c23a9de39aebbd27789d0c764d047 | [
"Apache-2.0"
] | 4 | 2017-05-05T19:45:29.000Z | 2021-07-17T16:17:06.000Z | (function($) {
$.TableOfContents = function(options) {
jQuery.extend(true, this, {
element: null,
appendTo: null,
windowId: null,
structures: [],
manifestVersion: null,
previousSelectedElements: [],
selectedElements: [],
previousOpenElements: [],
openElements: [],
hoveredElement: [],
selectContext: null,
tocData: {},
active: null,
eventEmitter: null
}, options);
this.init();
var self = this;
window.render = function() {self.render();};
};
$.TableOfContents.prototype = {
init: function () {
var _this = this;
if (!_this.structures || _this.structures.length === 0) {
this.element = jQuery(this.emptyTemplate()).appendTo(this.appendTo);
} else {
this.element = jQuery(this.template({ ranges: this.getTplData() })).appendTo(this.appendTo);
this.tocData = _this.initTocData();
this.setSelectedElements($.getRangeIDByCanvasID(_this.structures, _this.canvasID));
this.element.find('.has-child ul').hide();
this.render();
}
this.bindEvents();
},
tabStateUpdated: function(data) {
if (data.tabs[data.selectedTabIndex].options.id === 'tocTab') {
this.element.show();
} else {
this.element.hide();
}
},
getTplData: function() {
var _this = this,
filteredStructures = _this.structures.map(function(structure) {
structure.id = structure['@id'];
return structure;
}),
ranges;
switch (_this.manifestVersion) {
case '1':
ranges = _this.extractV1RangeTrees(_this.structures);
break;
case '2':
ranges = _this.extractV2RangeTrees(_this.structures);
break;
// case '2.1':
// _this.extractV21RangeTrees(_this.structures);
}
if (ranges.length < 2) {
if (ranges[0].children) {
ranges = ranges[0].children;
}
}
return ranges;
},
initTocData: function() {
var _this = this,
tocData = {};
_this.structures.forEach(function(structure) {
var rangeID = structure['@id'],
attrString = '[data-rangeid="' + rangeID +'"]';
tocData[structure['@id']] = {
element: _this.element.find(attrString).closest('li')
};
});
return tocData;
},
extractV1RangeTrees: function(rangeList) {
var tree, parent;
// Recursively build tree/table of contents data structure
// Begins with the list of topmost categories
function unflatten(flatRanges, parent, tree) {
// To aid recursion, define the tree if it does not exist,
// but use the tree that is being recursively built
// by the call below.
tree = typeof tree !== 'undefined' ? tree : [];
parent = typeof parent !== 'undefined' ? parent : {'@id': "root", label: "Table of Contents" };
var children = jQuery.grep(flatRanges, function(child) { if (!child.within) { child.within = 'root'; } return child.within == parent['@id']; });
if ( children.length ) {
if ( parent['@id'] === 'root') {
// If there are children and their parent's
// id is a root, bind them to the tree object.
//
// This begins the construction of the object,
// and all non-top-level children are now
// bound the these base nodes set on the tree
// object.
children.forEach(function(child) {
child.level = 0;
});
tree = children;
} else {
// If the parent does not have a top-level id,
// bind the children to the parent node in this
// recursion level before handing it over for
// another spin.
//
// Because "child" is passed as
// the second parameter in the next call,
// in the next iteration "parent" will be the
// first child bound here.
children.forEach(function(child) {
child.level = parent.level+1;
});
parent.children = children;
}
// The function cannot continue to the return
// statement until this line stops being called,
// which only happens when "children" is empty.
jQuery.each( children, function( index, child ){ unflatten( flatRanges, child ); } );
}
return tree;
}
return unflatten(rangeList);
},
extractV2RangeTrees: function(rangeList) {
var tree, parent;
// Recursively build tree/table of contents data structure
// Begins with the list of topmost categories
function unflatten(flatRanges, parent, tree) {
// To aid recursion, define the tree if it does not exist,
// but use the tree that is being recursively built
// by the call below.
tree = typeof tree !== 'undefined' ? tree : [];
parent = typeof parent !== 'undefined' ? parent : {'@id': "root", label: "Table of Contents" };
var children = [];
if (parent.ranges) {
jQuery.each(parent.ranges, function(index, id) {
//make sure id is a string for grepping
id = typeof id === 'object' ? id['@id'] : id;
var child = jQuery.grep(flatRanges, function(range, index) {
if (range['@id'] === id) {
return range;
}
})[0];
if (child) {
children.push(child);
}
});
} else if (parent['@id'] === 'root') {
// we have created a dummy root node, get the top most range as only child
var top = jQuery.grep(flatRanges, function(range, index) {
//check if we have a viewingHint
if (range.hasOwnProperty('viewingHint') && range.viewingHint === 'top') {
//found the top most range
return range;
}
})[0];
if (top) {
children.push(top);
}
// if we still don't have children, loop through and look for a range with children
// if we still can't find one, then create a dummy range in which all ranges are its children
if (children.length === 0) {
jQuery.each(flatRanges, function(index, range) {
if (range.ranges) {
children.push(range);
return false;
}
});
if (children.length === 0) {
children.push({"ranges" : flatRanges});
}
}
}
if ( children.length ) {
if ( parent['@id'] === 'root') {
// If there are children and their parent's
// id is a root, bind them to the tree object.
//
// This begins the construction of the object,
// and all non-top-level children are now
// bound the these base nodes set on the tree
// object.
children.forEach(function(child) {
child.level = 0;
});
tree = children;
} else {
// If the parent does not have a top-level id,
// bind the children to the parent node in this
// recursion level before handing it over for
// another spin.
//
// Because "child" is passed as
// the second parameter in the next call,
// in the next iteration "parent" will be the
// first child bound here.
children.forEach(function(child) {
child.level = parent.level+1;
});
parent.children = children;
}
// The function cannot continue to the return
// statement until this line stops being called,
// which only happens when "children" is empty.
jQuery.each( children, function( index, child ){ unflatten( flatRanges, child ); } );
}
return tree;
}
return unflatten(rangeList);
},
render: function() {
var _this = this;
var toDeselect = _this.previousSelectedElements.map(function(rangeID) {
return _this.tocData[rangeID].element;
}),
toSelect = _this.selectedElements.map(function(rangeID) {
return _this.tocData[rangeID].element;
}),
toOpen = _this.openElements.filter(function(rangeID) {
return jQuery.inArray(rangeID, _this.previousOpenElements) === -1;
}).map(function(rangeID) {
return _this.tocData[rangeID].element;
}),
toClose = _this.previousOpenElements.filter(function(rangeID) {
return jQuery.inArray(rangeID, _this.openElements) === -1;
}).map(function(rangeID) {
return _this.tocData[rangeID].element;
});
if (_this.previousSelectedElements !== _this.selectedElements) {
// Deselect elements
toDeselect.forEach(function(element) {
element.removeClass('selected');
});
// Select new elements
toSelect.forEach(function(element) {
element.addClass('selected');
});
toClose.forEach(function(element) {
element.removeClass('open');
element.find('ul:first').slideFadeToggle();
});
toOpen.forEach(function(element) {
// TODO if you open a range below an open range, it scrolls back up to the first open range
// comment out scrolling for now
//element.addClass('open').find('ul:first').slideFadeToggle(250, 'swing', scroll);
element.addClass('open').find('ul:first').slideFadeToggle();
});
} else {
toOpen.forEach(function(element) {
element.addClass('open').find('ul:first').slideFadeToggle();
});
toClose.forEach(function(element) {
element.removeClass('open').find('ul:first').slideFadeToggle();
});
}
// Open newly opened sections
function scroll() {
var head = _this.element.find('.selected').first();
if (head.length > 0) {
_this.element.scrollTo(head, 400);
}
}
},
bindEvents: function() {
var _this = this;
// _this.eventEmitter.subscribe('focusChanged', function(_, focusFrame) {
// });
// _this.eventEmitter.subscribe('cursorFrameUpdated', function(_, cursorBounds) {
// });
_this.eventEmitter.subscribe('tabStateUpdated.' + _this.windowId, function(_, data) {
_this.tabStateUpdated(data);
});
_this.eventEmitter.subscribe(('currentCanvasIDUpdated.' + _this.windowId), function(event, canvasID) {
if (!_this.structures) { return; }
_this.setSelectedElements($.getRangeIDByCanvasID(_this.structures, canvasID));
_this.render();
});
_this.element.find('.toc-link').on('click', function(event) {
event.stopPropagation();
var rangeID = jQuery(this).data().rangeid,
canvasID = jQuery.grep(_this.structures, function(item) { return item['@id'] == rangeID; })[0].canvases[0];
_this.eventEmitter.publish('SET_CURRENT_CANVAS_ID.' + _this.windowId, canvasID);
});
_this.element.find('.toc-caret').on('click', function(event) {
event.stopPropagation();
var rangeID = jQuery(this).parent().data().rangeid;
_this.setOpenItem(rangeID);
_this.render();
});
},
setActive: function(active) {
var _this = this;
_this.active = active;
},
setOpenItem: function(rangeID) {
var _this = this,
alreadyOpen = jQuery.inArray(rangeID, _this.openElements) !== -1;
_this.previousOpenElements = _this.openElements;
_this.openElements = (function() {
if (alreadyOpen) {
return _this.openElements.filter(function(elementID) {
return elementID !== rangeID;
});
}
return _this.openElements.map(function(elementID) {return elementID;}).concat([rangeID]);
})();
},
// focusCursorFrame: function() {
// },
// hoverItem: function() {
// },
setSelectedElements: function(rangeIDs) {
var _this = this;
_this.previousSelectedElements = _this.selectedElements;
_this.selectedElements = rangeIDs;
_this.previousOpenElements = _this.openElements;
// Ensure that all new selected elements are added to
// the list of open elements,
// and all previously selected elements are removed.
_this.openElements = _this.openElements.filter(function(openElementID) {
return jQuery.inArray(openElementID, _this.previousSelectedElements) === -1;
}).concat(rangeIDs).filter(function(openElementID,index,openElements){
// this filters out any duplicates, which would cause a bug.
return index === openElements.indexOf(openElementID);
});
},
emptyTemplate: $.Handlebars.compile([
'<ul class="toc">',
'<li class="leaf-item open">',
'<h2><span>{{t "noIndex"}}</span></h2>',
'</ul>',
].join('')),
template: function(tplData) {
var template = $.Handlebars.compile([
'<ul class="toc">',
'{{#nestedRangeLevel ranges}}',
'<li class="{{#if children}}has-child{{else}}leaf-item{{/if}}">',
'{{{tocLevel id label level children}}}',
'{{#if children}}',
'<ul>',
'{{{nestedRangeLevel children}}}',
'</ul>',
'{{/if}}',
'<li>',
'{{/nestedRangeLevel}}',
'</ul>'
].join(''));
var previousTemplate;
$.Handlebars.registerHelper('nestedRangeLevel', function(children, options) {
var out = '';
if (options.fn !== undefined) {
previousTemplate = options.fn;
}
children.forEach(function(child) {
child.label = $.JsonLd.getTextValue(child.label);
out = out + previousTemplate(child);
});
return out;
});
$.Handlebars.registerHelper('tocLevel', function(id, label, level, children) {
var caret = '<i class="fa fa-caret-right toc-caret"></i>',
cert = '<i class="fa fa-certificate star"></i>';
return '<h' + (level+1) + '><a class="toc-link" data-rangeID="' + id + '">' + caret + cert + '<span>' + label + '</span></a></h' + (level+1) + '>';
});
return template(tplData);
},
hide: function() {
var _this = this;
jQuery(this.appendTo).hide();
_this.eventEmitter.publish('ADD_CLASS.'+this.windowId, 'focus-max-width');
},
show: function() {
var _this = this;
jQuery(this.appendTo).show({effect: "fade", duration: 300, easing: "easeInCubic"});
_this.eventEmitter.publish('REMOVE_CLASS.'+this.windowId, 'focus-max-width');
}
};
}(Mirador));
| 34.265909 | 155 | 0.557273 |
020bd7497f8ae7fa2781fe492bba6de81be20d83 | 12,428 | js | JavaScript | test/fields.test.js | JoeChapman/better-forms | c3c693a1ceeb6d6ecc384fa3149d8b22d92aa987 | [
"MIT"
] | null | null | null | test/fields.test.js | JoeChapman/better-forms | c3c693a1ceeb6d6ecc384fa3149d8b22d92aa987 | [
"MIT"
] | 1 | 2018-09-13T13:32:02.000Z | 2018-09-13T13:32:02.000Z | test/fields.test.js | JoeChapman/better-forms | c3c693a1ceeb6d6ecc384fa3149d8b22d92aa987 | [
"MIT"
] | 1 | 2016-05-03T18:16:08.000Z | 2016-05-03T18:16:08.000Z | 'use strict';
describe('Fields:', sandbox(function () {
var Field = require('../lib/field'),
FormError = require('../lib/error'),
fields = require('../lib/fields'),
instance;
it('has field children which are all extended from Field, and have types matching to their names', function () {
fields
.should.have.keys(
'text', 'string', 'number', 'color', 'date', 'datetime', 'datetime-local',
'month', 'week', 'search', 'time', 'tel', 'url', 'email', 'hidden', 'password',
'file', 'checkbox', 'radio', 'select'
);
for (var i in fields) {
(new fields[i]())
.should.be.instanceof(Field);
if (i !== 'select') {
fields[i].prototype.inputType
.should.equal(i === 'string' ? 'text' : i);
}
}
});
describe('.url()', function () {
beforeEach(function () {
instance = new fields.url();
});
describe('.widgetHtml()', function () {
it('adds a typeMismatch data-message', function () {
instance.message = { typeMismatch: 'Invalid url' };
instance.widgetHtml('string')
.should.equal('<input type="url" value="string" data-message-typeMismatch="Invalid url"/>');
});
});
});
describe('.tel()', function () {
beforeEach(function () {
instance = new fields.tel();
});
describe('.widgetHtml()', function () {
it('adds a typeMismatch data-message', function () {
instance.message = { typeMismatch: 'Invalid tel' };
instance.widgetHtml('string')
.should.equal('<input type="tel" value="string" data-message-typeMismatch="Invalid tel"/>');
});
});
});
describe('.email', function () {
beforeEach(function () {
instance = new fields.email();
});
it('will validate against the W3C email RegExp, returning a typeMismatch error if validation fails', function () {
instance.value = 'b';
instance.validate()
.should.be.an.instanceof(FormError);
instance.validate().message
.should.equal('Please enter a valid email');
});
it('will return a custom `typeMismatch` error message if supplied (and the value is not an email)', function () {
instance.value = 'b';
instance.message = { typeMismatch: 'Invalid email Foo' };
instance.validate()
.should.be.an.instanceof(FormError);
instance.validate().message
.should.equal('Invalid email Foo');
});
it('will also validate against maxlength, required and pattern', function () {
instance.maxlength = 10;
instance.required = true;
instance.pattern = /^a@a.a$/;
instance.value = '';
instance.message = {
valueMissing: 'valueMissing',
tooLong: 'tooLong',
patternMismatch: 'patternMismatch',
typeMismatch: 'typeMismatch'
};
instance.validate('')
.should.be.an.instanceof(FormError);
instance.validate('').message
.should.equal('valueMissing');
instance.validate('aaaaaaaaaaa')
.should.be.an.instanceof(FormError);
instance.validate('aaaaaaaaaaa').message
.should.equal('tooLong');
instance.validate('ab@ab.ab')
.should.be.an.instanceof(FormError);
instance.validate('ab@ab.ab').message
.should.equal('patternMismatch');
should.equal(instance.validate('a@a.a'), null);
});
describe('.widgetHtml()', function () {
it('adds a typeMismatch data-message', function () {
instance.message = { typeMismatch: 'Invalid email' };
instance.widgetHtml('string')
.should.equal('<input type="email" value="string" data-message-typeMismatch="Invalid email"/>');
});
});
describe('.getError()', function () {
it('will return typeMistch if the value is not a valid email address', function () {
instance.getError('aaaa', {}, {})
.should.equal('typeMismatch');
});
});
});
describe('.hidden', function () {
beforeEach(function () {
instance = new fields.hidden({ id: '_csrf' });
});
it('has its own set of availableAttributes', function () {
instance.availableAttributes
.should.deep.equal([
'disabled', 'form', 'formaction', 'formenctype', 'formmethod',
'formnovalidate', 'formtarget', 'selectiondirection', 'value',
'inputmode', 'list', 'readonly', 'name', 'aria-hidden'
]);
});
describe('.html()', function () {
it('only renders input', function () {
this.stub(instance, 'widgetHtml', function () { return 'widgetHtml'; });
instance.html()
.should.equal('widgetHtml');
});
});
describe('.widgetHtml()', function () {
it('adds checked attribute if value passed matches values attribute', function () {
instance.widgetHtml()
.should.equal('<input type="hidden" aria-hidden="true" name="_csrf" id="_csrf"/>');
});
});
});
describe('.file', function () {
beforeEach(function () {
instance = new fields.file();
});
it('has its own set of availableAttributes', function () {
instance.availableAttributes
.should.deep.equal(['type', 'autofocus', 'disabled', 'form', 'formaction',
'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'value',
'required', 'selectiondirection', 'accept', 'multiple', 'placeholder']);
});
});
describe('.select', function () {
beforeEach(function () {
instance = new fields.select({ id: 'select', label: 'label', choices: ['Mr', { 'Mrs': 'Mrs' }, 'Miss'], required: true });
});
describe('.widgetHtml()', function () {
it('adds choices to option elements', function () {
instance.widgetHtml()
.should.equal('<select required="true" name="select" id="select" data-message-valueMissing="This field is required"><option value="Mr">Mr</option><option value="Mrs">Mrs</option><option value="Miss">Miss</option></select>');
});
it('selects choice whose value matches the value argument', function () {
instance.widgetHtml('Mrs')
.should.equal('<select required="true" name="select" id="select" data-message-valueMissing="This field is required"><option value="Mr">Mr</option><option value="Mrs" selected="selected">Mrs</option><option value="Miss">Miss</option></select>');
});
});
describe('.validate()', function () {
it('will validate against missing values', function () {
instance.message = {
valueMissing: 'valueMissing'
};
instance.validate('')
.should.be.an.instanceof(FormError);
instance.validate('').message
.should.equal('valueMissing');
});
});
});
describe('.checkbox', function () {
beforeEach(function () {
instance = new fields.checkbox({ id: 'checkbox', label: 'label' });
});
describe('instance', function () {
it('has an availableAttributes array, with available attributes for the field', function () {
instance.availableAttributes
.should.deep.equal([
'autofocus', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod',
'formnovalidate', 'formtarget', 'required', 'selectiondirection', 'value',
'autocomplete', 'inputmode', 'list', 'readonly', 'validateif', 'name',
'checked', 'role'
]);
});
});
describe('.html()', function () {
it('renders input first', function () {
this.stub(instance, 'widgetHtml', function () { return 'widgetHtml'; });
this.stub(instance, 'labelHtml', function () { return 'labelHtml'; });
instance.html()
.should.equal('<div class=\"field\" data-type=\"checkbox\">widgetHtmllabelHtml</div>');
});
});
describe('.widgetHtml()', function () {
it('adds checked attribute if value passed matches values attribute', function () {
instance.widgetHtml(true)
.should.equal('<input type="checkbox" value="true" role="checkbox" name="checkbox" id="checkbox" checked="checked"/>');
});
});
describe('.parseBody()', function () {
it('compares POSTed string value to "true" if field.value is boolean', function () {
instance.parseBody({ body: { checkbox: 'true' } })
.should.equal(true);
should.not.exist(instance.parseBody({ body: { checkbox: 'aString' } }));
});
it('accepts POSTed true(bool) if field.value is boolean', function () {
instance.parseBody({ body: { checkbox: true } })
.should.equal(true);
should.not.exist(instance.parseBody({ body: { checkbox: null } }));
});
it('returns POSTed string value if field.value is not boolean', function () {
instance = new fields.checkbox({ id: 'checkbox', label: 'label', value: 'aString' });
should.not.exist(instance.parseBody({ body: { checkbox: 'true' } }));
instance.parseBody({ body: { checkbox: 'aString' } })
.should.equal('aString');
});
});
});
describe('.radio', function () {
beforeEach(function () {
instance = new fields.radio({ id: 'radio-foo', label: 'label', name: 'radio', value: 'foo' });
});
describe('instance', function () {
it('has an availableAttributes array, with available attributes for the field', function () {
instance.availableAttributes
.should.deep.equal([
'autofocus', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod',
'formnovalidate', 'formtarget', 'required', 'selectiondirection', 'value',
'autocomplete', 'inputmode', 'list', 'readonly', 'validateif', 'name',
'checked', 'role'
]);
});
});
describe('.html()', function () {
it('renders input first', function () {
this.stub(instance, 'widgetHtml', function () { return 'widgetHtml'; });
this.stub(instance, 'labelHtml', function () { return 'labelHtml'; });
instance.html()
.should.equal('<div class=\"field\" data-type=\"radio\">widgetHtmllabelHtml</div>');
});
});
describe('.widgetHtml()', function () {
it('adds checked attribute if value passed matches values attribute', function () {
instance.widgetHtml('foo')
.should.equal('<input type="radio" value="foo" name="radio" role="radio" id="radio-foo" checked="checked"/>');
});
});
describe('.parseBody()', function () {
it('compares POSTed string value to the body value', function () {
instance.parseBody({ body: { radio: 'foo' } })
.should.equal('foo');
});
});
});
}));
| 30.386308 | 264 | 0.505552 |
020c583f11f81814e889fe6cfc0f1b8d6967427f | 3,107 | js | JavaScript | node_modules/eslint-plugin-jsx-a11y/__tests__/src/rules/autocomplete-valid-test.js | dillonthompson/dillonthompson.github.io | c5344ace15bd31dba258a9c6b1a2278358fe243a | [
"MIT"
] | 67 | 2020-08-06T09:06:20.000Z | 2022-03-28T23:16:11.000Z | node_modules/eslint-plugin-jsx-a11y/__tests__/src/rules/autocomplete-valid-test.js | dillonthompson/dillonthompson.github.io | c5344ace15bd31dba258a9c6b1a2278358fe243a | [
"MIT"
] | 67 | 2020-12-19T08:45:19.000Z | 2021-01-17T11:50:17.000Z | node_modules/eslint-plugin-jsx-a11y/__tests__/src/rules/autocomplete-valid-test.js | dillonthompson/dillonthompson.github.io | c5344ace15bd31dba258a9c6b1a2278358fe243a | [
"MIT"
] | 47 | 2020-12-17T00:40:09.000Z | 2022-03-01T22:01:25.000Z | /* eslint-env jest */
/**
* @fileoverview Ensure autocomplete attribute is correct.
* @author Wilco Fiers
*/
// -----------------------------------------------------------------------------
// Requirements
// -----------------------------------------------------------------------------
import { RuleTester } from 'eslint';
import parserOptionsMapper from '../../__util__/parserOptionsMapper';
import { axeFailMessage } from '../../__util__/axeMapping';
import rule from '../../../src/rules/autocomplete-valid';
// -----------------------------------------------------------------------------
// Tests
// -----------------------------------------------------------------------------
const ruleTester = new RuleTester();
const invalidAutocomplete = [{
message: axeFailMessage('autocomplete-valid'),
type: 'JSXOpeningElement',
}];
const inappropriateAutocomplete = [{
message: axeFailMessage('autocomplete-appropriate'),
type: 'JSXOpeningElement',
}];
ruleTester.run('autocomplete-valid', rule, {
valid: [
// INAPPLICABLE
{ code: '<input type="text" />;' },
// // PASSED AUTOCOMPLETE
{ code: '<input type="text" autocomplete="name" />;' },
{ code: '<input type="text" autocomplete="" />;' },
{ code: '<input type="text" autocomplete="off" />;' },
{ code: '<input type="text" autocomplete="on" />;' },
{ code: '<input type="text" autocomplete="billing family-name" />;' },
{ code: '<input type="text" autocomplete="section-blue shipping street-address" />;' },
{ code: '<input type="text" autocomplete="section-somewhere shipping work email" />;' },
{ code: '<input type="text" autocomplete />;' },
{ code: '<input type="text" autocomplete={autocompl} />;' },
{ code: '<input type="text" autocomplete={autocompl || "name"} />;' },
{ code: '<input type="text" autocomplete={autocompl || "foo"} />;' },
{ code: '<Foo autocomplete="bar"></Foo>;' },
].map(parserOptionsMapper),
invalid: [
// FAILED "autocomplete-valid"
{ code: '<input type="text" autocomplete="foo" />;', errors: invalidAutocomplete },
{ code: '<input type="text" autocomplete="name invalid" />;', errors: invalidAutocomplete },
{ code: '<input type="text" autocomplete="invalid name" />;', errors: invalidAutocomplete },
{ code: '<input type="text" autocomplete="home url" />;', errors: invalidAutocomplete },
{ code: '<Bar autocomplete="baz"></Bar>;', errors: invalidAutocomplete, options: [{ inputComponents: ['Bar'] }] },
{ code: '<input type={isEmail ? "email" : "text"} autocomplete="none" />;', errors: invalidAutocomplete },
// FAILED "autocomplete-appropriate"
{ code: '<input type="date" autocomplete="email" />;', errors: inappropriateAutocomplete },
{ code: '<input type="number" autocomplete="url" />;', errors: inappropriateAutocomplete },
{ code: '<input type="month" autocomplete="tel" />;', errors: inappropriateAutocomplete },
{ code: '<Foo type="month" autocomplete="tel"></Foo>;', errors: inappropriateAutocomplete, options: [{ inputComponents: ['Foo'] }] },
].map(parserOptionsMapper),
});
| 47.075758 | 137 | 0.578693 |
020c67221e0f8e52b88b1fe302733988e1cf1f29 | 570 | js | JavaScript | src/client/assets.js | dobihakck/gameios | e52ed5bf1fe239d11e62c9463b67a4d86d45866f | [
"MIT"
] | null | null | null | src/client/assets.js | dobihakck/gameios | e52ed5bf1fe239d11e62c9463b67a4d86d45866f | [
"MIT"
] | 1 | 2021-05-09T23:46:49.000Z | 2021-05-09T23:46:49.000Z | src/client/assets.js | dobihakck/gameios | e52ed5bf1fe239d11e62c9463b67a4d86d45866f | [
"MIT"
] | 1 | 2021-08-07T07:02:56.000Z | 2021-08-07T07:02:56.000Z | const ASSET_NAMES = [
'ship.svg',
'bullet.svg',
'terrain.png',
'sprites.png',
];
const assets = {};
const downloadPromise = Promise.all(ASSET_NAMES.map(downloadAsset));
function downloadAsset(assetName) {
return new Promise(resolve => {
const asset = new Image();
asset.onload = () => {
console.log(`Downloaded ${assetName}`);
assets[assetName] = asset;
resolve();
};
asset.src = `/assets/${assetName}`;
});
}
export const downloadAssets = () => downloadPromise;
export const getAsset = assetName => assets[assetName];
| 21.111111 | 68 | 0.638596 |
020ca8be0de0ac25a386c0c752b099201989f751 | 632 | js | JavaScript | lib/breadcrumb.js | arlesondak/File-Explorer | 7dc82b32ac1c3c3d53f23682051d03749897e307 | [
"MIT"
] | null | null | null | lib/breadcrumb.js | arlesondak/File-Explorer | 7dc82b32ac1c3c3d53f23682051d03749897e307 | [
"MIT"
] | null | null | null | lib/breadcrumb.js | arlesondak/File-Explorer | 7dc82b32ac1c3c3d53f23682051d03749897e307 | [
"MIT"
] | null | null | null | // include node modules
const path = require('path');
const buildBreadCrumb = pathname => {
const pathArray = pathname.split('/').filter(element => element !== '');
let htmlSnippet = `<li class="breadcrumb-item"><a href="/">Home</a></li>`;;
let link = `/`;
pathArray.forEach((pathItem, i) => {
link = path.join(link, pathItem);
if(i !== pathArray.length - 1){
htmlSnippet += `<li class="breadcrumb-item"><a href="${link}">${pathItem}</a></li>`;
} else {
htmlSnippet += `<li class="breadcrumb-item active" aria-current="page">${pathItem}</li>`;
}
});
return htmlSnippet;
};
module.exports = buildBreadCrumb; | 27.478261 | 92 | 0.631329 |
020cc884ce445a28b11d12f06a663829f935ad39 | 1,824 | js | JavaScript | Scripts/view/queries/BuildActionRuleContextQuery.js | MishoMihaylov/BindKraft | 1e0f018a93f262fad07bf05081771d646cb0f58c | [
"MIT"
] | 13 | 2019-03-28T14:48:32.000Z | 2020-12-22T10:38:25.000Z | Scripts/view/queries/BuildActionRuleContextQuery.js | MishoMihaylov/BindKraft | 1e0f018a93f262fad07bf05081771d646cb0f58c | [
"MIT"
] | 31 | 2019-04-11T18:04:10.000Z | 2022-03-07T18:30:32.000Z | Scripts/view/queries/BuildActionRuleContextQuery.js | MishoMihaylov/BindKraft | 1e0f018a93f262fad07bf05081771d646cb0f58c | [
"MIT"
] | 5 | 2019-05-09T13:59:55.000Z | 2020-11-23T08:17:04.000Z |
/*CLASS*/ /*QUERY*/
function BuildActionRuleContextQuery(purpose,scope) {
BaseObject.apply(this,arguments);
this.ruleContext = IActionRuleContextConstructor.createEmptyContext(); // Create an empty context.
this.purpose = purpose || ActionRulePurposeEnum.unspecified;
this.scope = scope || "app";
}
BuildActionRuleContextQuery.Inherit(BaseObject,"BuildActionRuleContextQuery");
BuildActionRuleContextQuery.prototype.purpose = null;
BuildActionRuleContextQuery.prototype.scope = null;
BuildActionRuleContextQuery.prototype.ruleContext = null; // The created context goes here.
BuildActionRuleContextQuery.prototype.processContext = function(processor) {
var result;
if (BaseObject.is(processor,"IActionRuleContextConstructor")) {
result = processor.prepareActionRuleContext(this.ruleContext,this.purpose);
}
if (result !== true) {
switch (this.scope) {
case ActionRuleRegisterScopeEnum.first:
result = true;
break;
case ActionRuleRegisterScopeEnum.window:
if (BaseObject.is(processor,"BaseWindow")) {
result = true;
}
break;
case ActionRuleRegisterScopeEnum.view:
if (BaseObject.is(processor,"ITemplateRoot")) {
result = true;
}
break;
case ActionRuleRegisterScopeEnum.app:
default:
if (BaseObject.is(processor,"IApp")) {
result = true;
}
}
}
return result;
}.Description("Default implementation calling the IActionRuleContextConstructor.prepareActionRuleContext. Call this your onStructuralQuery or use automatic implementation that does.")
| 41.454545 | 184 | 0.638706 |
020d00febc82fb822609514ee27a67dbcf724cc2 | 454 | js | JavaScript | src/utils/formatTime.js | imSanjaySoni/nest-tab | 88e4faa34f6574a890cfcb9a14c088c9938c7695 | [
"MIT"
] | 20 | 2018-02-22T09:16:37.000Z | 2022-03-01T04:19:55.000Z | src/utils/formatTime.js | imSanjaySoni/nest-tab | 88e4faa34f6574a890cfcb9a14c088c9938c7695 | [
"MIT"
] | null | null | null | src/utils/formatTime.js | imSanjaySoni/nest-tab | 88e4faa34f6574a890cfcb9a14c088c9938c7695 | [
"MIT"
] | 11 | 2018-02-28T14:52:45.000Z | 2022-01-04T16:36:56.000Z | export function formatTime() {
const currentDate = new Date();
const currentHour = currentDate.getHours() % 12 === 0 ? "12" : currentDate.getHours() % 12;
const currentMinute =
currentDate.getMinutes() < 10 ? "0" + currentDate.getMinutes() : currentDate.getMinutes();
const ampm = currentDate.getHours() >= 12 ? "PM" : "AM";
const formattedTime = currentHour + " : " + currentMinute + " " + ampm;
return formattedTime;
} | 45.4 | 98 | 0.640969 |
020d36b0fb5adf6d4484bfeb0a76fab1a8ae31ad | 248 | js | JavaScript | services/BOs/especialidadBarrio.js | jorgearojas25/PSIHelp-services | 56b308af52767e7c813c2dd54617460c870510c6 | [
"MIT"
] | null | null | null | services/BOs/especialidadBarrio.js | jorgearojas25/PSIHelp-services | 56b308af52767e7c813c2dd54617460c870510c6 | [
"MIT"
] | null | null | null | services/BOs/especialidadBarrio.js | jorgearojas25/PSIHelp-services | 56b308af52767e7c813c2dd54617460c870510c6 | [
"MIT"
] | null | null | null | class Especialidad {
constructor(data) {
this.Nombre = data.Nombre;
this.Color = data.Color;
this.Icono = data.Icono;
this.Active = data.Active;
this.Fecha_creacion = data.Fecha_creacion;
}
}
module.exports = Especialidad;
| 20.666667 | 46 | 0.681452 |
020dde42eda2ebf34e7eb9abe8eb863943384826 | 372 | js | JavaScript | tencentcloud/date/date-api/src/routes/modules/commentsRouter.js | ZhengXingchi/wheels | 7b0f69a0af072f6b0f938deb2939a9867b798d35 | [
"Apache-2.0"
] | null | null | null | tencentcloud/date/date-api/src/routes/modules/commentsRouter.js | ZhengXingchi/wheels | 7b0f69a0af072f6b0f938deb2939a9867b798d35 | [
"Apache-2.0"
] | 25 | 2020-09-04T22:54:28.000Z | 2022-03-08T23:03:12.000Z | tencentcloud/date/yushan/yushan_backup/src/routes/modules/commentsRouter.js | ZhengXingchi/wheels | 7b0f69a0af072f6b0f938deb2939a9867b798d35 | [
"Apache-2.0"
] | null | null | null | import Router from 'koa-router'
import commentsController from '@/api/CommentsController'
const router = new Router()
router.prefix('/comments')
router.post('/reply',commentsController.addComment)
router.post('/update',commentsController.updateComment)
router.get('/accept',commentsController.setBest)
router.get('/hands',commentsController.setHands)
export default router | 41.333333 | 57 | 0.814516 |
020e1a5d15b5d2c17939d3c87117e623a4753b68 | 2,649 | js | JavaScript | src/scripts/getTweets/index.js | justKD/dumpbott | 38aed6c62f914452488dcca51b8638538d2dc89c | [
"MIT"
] | null | null | null | src/scripts/getTweets/index.js | justKD/dumpbott | 38aed6c62f914452488dcca51b8638538d2dc89c | [
"MIT"
] | null | null | null | src/scripts/getTweets/index.js | justKD/dumpbott | 38aed6c62f914452488dcca51b8638538d2dc89c | [
"MIT"
] | null | null | null | import { options } from "./options";
import { url } from "./url";
import { base, recordID } from "./table";
import { record } from "./record";
import { beenOneDay } from "./beenOneDay";
export let getTweets = [];
let localTweets = {};
const retrieveTweetsFromTwitter = () => {
console.log("attempting to retrieve tweets from twitter");
/* Attempt to fetch tweets from Twitter. */
try {
fetch(url(), options())
.then((response) => response.text())
.then((data) => {
try {
localTweets = JSON.parse(data);
console.log("success");
} catch (err) {
console.error(err);
}
});
} catch (err) {
console.error(err);
}
};
let attempts = 0;
const storeTweetsInAirtable = () => {
console.log("attempting to store tweets in airtable");
/* If there are tweets already loaded from twitter... */
if (Object.keys(localTweets).length > 0) {
getTweets = Object.keys(localTweets).map((key) => localTweets[key]["text"]);
try {
base("dumpbott").update(record(getTweets), (err) => {
if (!err) {
console.log("success");
} else {
console.log("error updating record");
console.error(err);
}
});
} catch (err) {
console.log("error updating record");
console.error(err);
}
} else {
/* ... else repeat check until max. */
if (attempts < 40) {
setTimeout(() => {
attempts++;
storeTweetsInAirtable();
}, 500);
} else {
console.error("unable to store tweets in airtable - tweets not found");
}
}
};
const retrieveTweetsFromAirtable = () => {
base("dumpbott").find(recordID, function (err, record) {
if (err) {
console.log("error retrieving airtable record");
console.error(err);
return;
}
if (
record.fields["date"] === undefined ||
record.fields["json"] === undefined
) {
console.log("neither field exists in airtable");
/* If neither relevant field is defined... */
retrieveTweetsFromTwitter();
storeTweetsInAirtable();
} else {
/* ... else check if it's been a day... */
const now = new Date();
const last = new Date(JSON.parse(record.fields["date"]));
if (beenOneDay(now, last)) {
console.log("its been longer than a day");
retrieveTweetsFromTwitter();
storeTweetsInAirtable();
} else {
/* ... else make the tweets available. */
getTweets = JSON.parse(record.fields["json"]);
console.log("retrieved tweets from airtable");
}
}
});
};
retrieveTweetsFromAirtable();
| 28.180851 | 80 | 0.571536 |
020ef1da63af3fa73afa0e1909e3aa26355f8373 | 844 | js | JavaScript | minigame/carrace/lib/patch-enhancement.js | aaixy/zzgl | 85a5d41543f3e3119c84063750c9436559fc72b5 | [
"MIT"
] | 112 | 2019-11-06T01:35:30.000Z | 2022-02-24T09:11:00.000Z | minigame/carrace/lib/patch-enhancement.js | 291273291/zzgl | 85a5d41543f3e3119c84063750c9436559fc72b5 | [
"MIT"
] | 1 | 2019-11-08T03:42:19.000Z | 2019-11-08T03:42:19.000Z | minigame/carrace/lib/patch-enhancement.js | 291273291/zzgl | 85a5d41543f3e3119c84063750c9436559fc72b5 | [
"MIT"
] | 44 | 2019-11-06T01:35:33.000Z | 2021-07-02T02:17:52.000Z | (function(window){
window.requestAnimFrame = (function() {
return window.requestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.oRequestAnimationFrame
|| window.msRequestAnimationFrame || function() {
//return setTimeout(arguments[0], 1000 / 60);
return -1;
} // return -1 if unsupported
})();
window.cancelRequestAnimFrame = (function() {
return window.cancelAnimationFrame
|| window.webkitCancelRequestAnimationFrame
|| window.mozCancelRequestAnimationFrame
|| window.oCancelRequestAnimationFrame
|| window.msCancelRequestAnimationFrame || function() {
return -1;
} // return -1 if unsupported
})();
Array.prototype.indexOf = function(o){
for(var i = 0, len = this.length; i < len; i++){
if(this[i] === o){
return i;
}
}
};
})(window); | 26.375 | 58 | 0.696682 |
020ef57ced9966bcaca28d1eb247c499a0028e78 | 7,215 | js | JavaScript | data/artifact/data.js | soajs/soajs.utilities | bffae634a543cb3e9cab9c8e4a66bd9a46d27973 | [
"Apache-2.0"
] | 12 | 2015-03-20T12:27:41.000Z | 2017-04-07T12:00:59.000Z | data/artifact/data.js | soajs/soajs.utilities | bffae634a543cb3e9cab9c8e4a66bd9a46d27973 | [
"Apache-2.0"
] | 1 | 2016-04-17T14:37:44.000Z | 2016-04-18T12:37:41.000Z | data/artifact/data.js | soajs/soajs.utilities | bffae634a543cb3e9cab9c8e4a66bd9a46d27973 | [
"Apache-2.0"
] | 5 | 2016-04-19T18:14:57.000Z | 2018-10-23T10:35:12.000Z | var soajs = require("soajs");
var mongo = new soajs.mongo(dbconfig);
var util = require("soajs.core.libs").utils;
var dbConfClone = util.cloneObj(dbconfig);
dbConfClone.name = "myContacts";
var mongoContacts = new soajs.mongo(dbConfClone);
var keySecurity = "soajs key lal massa";
function addRecipes(cb) {
var catalogs = require('./provision/catalogs/');
mongo.remove("catalogs", {"name": {"$in": ['Test Nginx Recipe', 'Test Service Recipe']}}, function (error) {
if (error) {
return cb(error);
}
mongo.insert("catalogs", catalogs, {upsert: true, multi: false, safe: true}, function (err, results) {
if (err) {
return cb(err);
}
console.log("Catalogs added");
return cb();
});
});
}
function generateExternalKey(opts, cb) {
var module = require("soajs").core.key;
var key = opts.key;
var tenant = {
id: opts.tenantId
};
var application = {
"package": opts.package
};
var config = {
algorithm: "aes256",
password: opts.secret.password
};
module.generateExternalKey(key, tenant, application, config, function (error, extKey) {
if (error) {
return cb(error);
}
module.getInfo(extKey, config, function (error, response) {
if (error) {
return cb(error);
}
if (response.key === key) {
return cb(null, extKey);
}
else {
return cb(new Error("Generated Key is invalid."))
}
});
});
}
/*
Services
*/
function addService(cb) {
var service = require('./provision/services/services');
service._id = new mongo.ObjectId(service._id);
var condition = {
"name": service.name
};
delete service.name;
mongo.update("services", condition, {"$set": service}, {upsert: true, multi: false, safe: true}, cb);
}
/*
Git Accounts
*/
function addGit(cb) {
var git = require('./provision/gitAccounts/soajsRepos');
var condition = {
"owner": git.owner,
"provider": git.provider,
"type": git.type,
"access": git.access
};
mongo.findOne("git_accounts", condition, function (error, record) {
if (error) {
return cb(error);
}
if (!record) {
mongo.insert('git_accounts', git, cb);
}
else {
var list = [];
git.repos.forEach(function (oneGitRepo) {
var found = false;
for (var i = 0; i < record.repos.length; i++) {
if (oneGitRepo.type === record.repos[i].type && oneGitRepo.name === record.repos[i].name) {
found = true;
break;
}
}
if (!found) {
record.repos.push(oneGitRepo);
}
});
mongo.save('git_accounts', record, cb);
}
});
}
/*
Environment
*/
function addEnv(cb) {
var test_env = require('./provision/environments/test.js');
mongo.findOne("environment", {"code": "DASHBOARD"}, function (err, result) {
if (err) {
return cb(err);
}
if (result) {
test_env.profile = result.profile;
test_env.deployer = result.deployer;
if(result.dbs && result.dbs.cluster && result.dbs.cluster.dash_cluster){
test_env.dbs.clusters.test_cluster = result.dbs.clusters.dash_cluster;
}
test_env.dbs.config.prefix = dbconfig.prefix;
test_env.services.config.cookie.secret = result.services.config.cookie.secret;
test_env.services.config.session.secret = result.services.config.session.secret;
keySecurity = result.services.config.key;
delete test_env.code;
mongo.update("environment", {"code": "TEST"}, {$set: test_env}, {
upsert: true,
multi: false,
safe: true
}, function(error){
if (error){
return cb(error)
}
addInfra(cb)
});
}
else {
test_env.dbs.config.prefix = dbconfig.prefix;
test_env.profile = __dirname + test_env.profile;
delete test_env.code;
mongo.update("environment", {"code": "TEST"}, {$set: test_env}, {
upsert: true,
multi: false,
safe: true
}, function(error){
if (error){
return cb(error)
}
addInfra(cb)
});
}
});
}
function addInfra(cb){
mongo.findOne("infra", {
"deployments.environments": {"$in": ["DASHBOARD"]}
}, (error, infraProvider) => {
if (error) {
return cb(error);
}
if(!infraProvider){
return cb(null, true);
}
var deployments = infraProvider.deployments;
deployments.forEach(function(deployment){
if(deployment.environments.indexOf("TEST") === -1){
deployment.environments.push("TEST");
}
});
console.log("TEST environment added");
mongo.save("infra", infraProvider, cb);
});
}
function modifyDashboardDefaults(cb) {
mongo.findOne("products", {"code": "DSBRD", "locked": true}, function (error, dsbrdProduct) {
if (error) {
return cb(error);
}
if (!dsbrdProduct) {
return cb(null);
}
dsbrdProduct.packages.forEach(function (onePackage) {
if (onePackage.code === "DSBRD_OWNER") {
if (!onePackage.acl.test) {
onePackage.acl.test = {};
}
}
});
mongo.save("products", dsbrdProduct, function (error) {
if (error) {
return cb(error);
}
mongo.findOne("tenants", {"code": "DBTN", "locked": true}, function (error, dbtnTenant) {
if (error) {
return cb(error);
}
dbtnTenant.applications.forEach(function (oneApplication) {
if (oneApplication.package == "DSBRD_OWNER") {
oneApplication.keys.forEach(function (oneKey) {
if (!oneKey.config.test) {
oneKey.config.test = {};
}
generateExternalKey({
key: oneKey.key,
tenantId: dbtnTenant._id,
package: oneApplication.package,
secret: keySecurity
}, function (error, externalKey) {
if (error) {
return cb(error);
}
for (var i = oneKey.extKeys.length - 1; i >= 0; i--) {
if (oneKey.extKeys[i].env === 'DEV') {
oneKey.extKeys.splice(i, 1);
}
}
oneKey.extKeys.push({
"extKey": externalKey,
"device": {},
"geo": {},
"env": "TEST",
"dashboardAccess": true
});
storeTenant(dbtnTenant);
});
});
}
});
});
});
});
function storeTenant(dbtnTenant) {
mongo.save("tenants", dbtnTenant, cb);
}
}
function addContacts(cb) {
var contacts = require('./provision/contacts/');
contacts.forEach(function (contact) {
contact._id = mongo.ObjectId(contact._id);
});
mongoContacts.remove("records", {}, function (error) {
if (error) {
return cb(error);
}
mongoContacts.insert("records", contacts, function (err) {
if (err) {
return cb(err);
}
return cb();
});
});
}
addRecipes(function (error) {
if (error) {
throw error;
}
addGit(function (error) {
if (error) {
throw error;
}
addEnv(function (error) {
if (error) {
throw error;
}
addService(function (error) {
if (error) {
throw error;
}
modifyDashboardDefaults(function (error) {
if (error) {
throw error;
}
addContacts(function (error) {
if (error) {
throw error;
}
console.log("done");
process.exit();
});
});
});
});
})
}); | 22.406832 | 109 | 0.582952 |
020efcc476285838b316e2e9f2b39dd6d53d458c | 13,623 | js | JavaScript | public/js/to_other_side/models/plateBorderModel.js | sindes255/ToOtherSideGame | 272153036d40232f8b5182b1f65ce713156803bf | [
"MIT"
] | null | null | null | public/js/to_other_side/models/plateBorderModel.js | sindes255/ToOtherSideGame | 272153036d40232f8b5182b1f65ce713156803bf | [
"MIT"
] | null | null | null | public/js/to_other_side/models/plateBorderModel.js | sindes255/ToOtherSideGame | 272153036d40232f8b5182b1f65ce713156803bf | [
"MIT"
] | null | null | null | {
"uvs": [[0.7381173372268677,0.794628381729126,0.7379107475280762,0.7273073792457581,0.7409346699714661,0.7266827821731567,0.7411430478096008,0.794619083404541,0.7439584732055664,0.7260581254959106,0.7441688179969788,0.7946098446846008,0.7377042174339294,0.6599863767623901,0.7407262325286865,0.6587463617324829,0.7437481880187988,0.6575063467025757,0.7413514852523804,0.8625555038452148,0.7383238077163696,0.8619494438171387,0.7415599226951599,0.9304919242858887,0.7385303974151611,0.9292705059051514,0.7443791627883911,0.863161563873291,0.7445894479751587,0.931713342666626,0.7352961897850037,0.8613433837890625,0.7350915670394897,0.7946376800537109,0.7322685718536377,0.8607373237609863,0.7320657968521118,0.7946469783782959,0.7355008125305176,0.9280490875244141,0.7324712872505188,0.926827609539032,0.734886884689331,0.7279320359230042,0.7346822023391724,0.6612263917922974,0.7318630218505859,0.7285566926002502,0.7316602468490601,0.6624664068222046,0.9412088394165039,0.17613081634044647,0.9433326721191406,0.17612430453300476,0.9435691833496094,0.25324058532714844,0.9414440393447876,0.25282180309295654,0.9438058137893677,0.3303568959236145,0.9416793584823608,0.3295127749443054,0.9454564452171326,0.17611777782440186,0.9456943273544312,0.25365936756134033,0.9459322094917297,0.3312009871006012,0.9393188953399658,0.25240299105644226,0.9390849471092224,0.17613732814788818,0.937193751335144,0.251984179019928,0.9369610548019409,0.1761438548564911,0.939552903175354,0.32866865396499634,0.9374264478683472,0.32782453298568726,0.938850998878479,0.0998716801404953,0.9409735202789307,0.0994398444890976,0.9386169910430908,0.02360602095723152,0.9407382011413574,0.02274886518716812,0.9367283582687378,0.100303515791893,0.9364957213401794,0.024463176727294922,0.9430960416793823,0.0990080013871193,0.945218563079834,0.09857616573572159,0.942859411239624,0.02189170941710472,0.9449806809425354,0.02103455364704132,0.4644845128059387,0.010801607742905617,0.464500367641449,0.005633438006043434,0.5385185480117798,0.0058604818768799305,0.5366805791854858,0.011023060418665409,0.6125367879867554,0.006087525747716427,0.6088765859603882,0.01124451495707035,0.46451622247695923,0.0004652685020118952,0.5403565764427185,0.0006979027530178428,0.6161969304084778,0.0009305370040237904,0.5348425507545471,0.016185639426112175,0.46446865797042847,0.01596977561712265,0.5330045223236084,0.021348219364881516,0.4644528031349182,0.021137945353984833,0.6052164435386658,0.0164015032351017,0.6015563011169434,0.021558493375778198,0.3940947651863098,0.015753913670778275,0.3922884464263916,0.01058015413582325,0.32372087240219116,0.01553804986178875,0.32009243965148926,0.010358699597418308,0.39590105414390564,0.02092767134308815,0.32734930515289307,0.020717399194836617,0.39048218727111816,0.0054063936695456505,0.38867586851119995,0.0002326342510059476,0.31646400690078735,0.005179349798709154,0.31283554434776306,0.0]],
"vertices": [0.02708551287651062,0.04121720790863037,-1.247362462208912e-07,0.022247314453125,0.02401721477508545,-1.3516027763671445e-07,0.027085483074188232,0.04121720790863037,0.4553261399269104,0.031056612730026245,0.06062591075897217,-1.2930991033499595e-07,0.027085572481155396,0.04121720790863037,-0.4553263783454895,0.022247374057769775,0.02401721477508545,-0.46101242303848267,0.022247225046157837,0.02401721477508545,0.4610121548175812,0.031056523323059082,0.06062591075897217,0.45065921545028687,0.031056642532348633,0.06062591075897217,-0.45065948367118835,-0.025842994451522827,-0.04180443286895752,-3.3344878147545387e-07,-0.025843024253845215,-0.04180443286895752,0.5175293684005737,-0.021892428398132324,-0.02957308292388916,-2.967305476886395e-07,-0.02584296464920044,-0.04180443286895752,-0.517530083656311,-0.02878984808921814,-0.055480122566223145,-3.7010391906733275e-07,-0.028789877891540527,-0.055480122566223145,0.5209925174713135,-0.0218924880027771,-0.02957308292388916,0.5128865838050842,-0.02189236879348755,-0.02957308292388916,-0.512887179851532,-0.028789818286895752,-0.055480122566223145,-0.5209932923316956,-0.00043714046478271484,-0.006217837333679199,-1.8087045816628233e-07,-0.00043717026710510254,-0.006217837333679199,0.4876716434955597,0.00823509693145752,0.0006607770919799805,-1.6394166379996022e-07,-0.00043708086013793945,-0.006217837333679199,-0.48767200112342834,-0.008972704410552979,-0.012331962585449219,-2.0807722478366486e-07,-0.008972764015197754,-0.012331962585449219,0.497702956199646,0.008235007524490356,0.0006607770919799805,0.47747981548309326,0.008235126733779907,0.0006607770919799805,-0.4774801433086395,-0.00897267460823059,-0.012331962585449219,-0.4977033734321594,-0.03123486042022705,-0.0698779821395874,0.5238659977912903,-0.031234830617904663,-0.0698779821395874,-3.5457338753985823e-07,-0.031234800815582275,-0.0698779821395874,-0.5238667130470276,0.016108274459838867,0.01013028621673584,0.4682268798351288,0.016108334064483643,0.01013028621673584,-1.4200384157447843e-07,0.016108393669128418,0.01013028621673584,-0.4682271480560303,0.02224719524383545,0.02401721477508545,0.9220244884490967,0.027085423469543457,0.04121720790863037,0.9106523990631104,0.031056493520736694,0.06062591075897217,0.9013185501098633,0.034594058990478516,0.0811389684677124,0.44650188088417053,0.0345940887928009,0.0811389684677124,-1.2275599203803722e-07,0.03459411859512329,0.0811389684677124,-0.44650211930274963,0.02224743366241455,0.02401721477508545,-0.9220247268676758,0.02708566188812256,0.04121720790863037,-0.9106526374816895,0.031056702136993408,0.06062591075897217,-0.9013187885284424,-0.028789907693862915,-0.055480122566223145,1.0419855117797852,-0.02584308385848999,-0.04180443286895752,1.0350590944290161,-0.021892547607421875,-0.02957308292388916,1.025773525238037,0.008234947919845581,0.0006607770919799805,0.9549597501754761,-0.00043720006942749023,-0.006217837333679199,0.9753434658050537,-0.00897282361984253,-0.012331962585449219,0.9954060912132263,-0.028789758682250977,-0.055480122566223145,-1.0419862270355225,-0.02584296464920044,-0.04180443286895752,-1.0350596904754639,-0.02189236879348755,-0.02957308292388916,-1.0257740020751953,0.008235156536102295,0.0006607770919799805,-0.9549601078033447,-0.00043702125549316406,-0.006217837333679199,-0.9753437638282776,-0.008972615003585815,-0.012331962585449219,-0.9954065084457397,-0.016436368227005005,-0.0195082426071167,0.5064743757247925,-0.01643630862236023,-0.0195082426071167,-2.468790967213863e-07,-0.016436278820037842,-0.0195082426071167,-0.5064748525619507,0.860278844833374,-0.0698779821395874,-1.0477324724197388,0.860278844833374,-0.0698779821395874,1.0477325916290283,-0.031234920024871826,-0.0698779821395874,1.0477323532104492,-0.031234771013259888,-0.0698779821395874,-1.0477330684661865,0.8085999488830566,-0.0009133815765380859,-0.926262617111206,0.8085995316505432,-0.0009133815765380859,0.9262636303901672,0.016108214855194092,0.01013028621673584,0.9364538788795471,0.016108453273773193,0.01013028621673584,-0.936454176902771,0.03459396958351135,0.0811389684677124,0.8930038809776306,0.034594178199768066,0.0811389684677124,-0.8930041193962097,0.7944496273994446,0.0811389684677124,0.8930047750473022,0.794450044631958,0.0811389684677124,-0.8930037617683411,0.7853714823722839,-0.03913772106170654,-0.8405001163482666,0.7853716611862183,-0.03913772106170654,0.8446362018585205,0.8021016120910645,-0.03913772106170654,0.8446363210678101,0.8021016120910645,-0.03913772106170654,-0.8405003547668457,0.8021016120910645,-0.14892780780792236,-0.8405003547668457,0.8021016120910645,-0.14892780780792236,0.8446363210678101,0.7853714823722839,-0.14892780780792236,-0.8405001163482666,0.7853716611862183,-0.14892780780792236,0.8446362018585205,0.7940965890884399,-0.03913772106170654,0.8144928216934204,0.03318062424659729,-0.03913772106170654,0.8144930601119995,0.03318071365356445,-0.03913772106170654,0.8702601194381714,0.7940965890884399,-0.03913772106170654,0.8702598810195923,0.7940965890884399,-0.14892780780792236,0.8702598810195923,0.03318071365356445,-0.14892780780792236,0.8702601194381714,0.7940965890884399,-0.14892780780792236,0.8144928216934204,0.03318062424659729,-0.14892780780792236,0.8144930601119995,0.8021016120910645,-0.14892780780792236,-0.7847331762313843,0.0411856472492218,-0.14892780780792236,-0.7847331762313843,0.8021015524864197,-0.14892780780792236,-0.8405002355575562,0.0411856472492218,-0.14892780780792236,-0.8405002355575562,0.0411856472492218,-0.03913772106170654,-0.8405002355575562,0.8021015524864197,-0.03913772106170654,-0.8405002355575562,0.8021016120910645,-0.03913772106170654,-0.7847331762313843,0.0411856472492218,-0.03913772106170654,-0.7847331762313843,0.049910545349121094,-0.14892780780792236,-0.8148765563964844,0.04991075396537781,-0.14892780780792236,0.8702597618103027,0.03318062424659729,-0.14892780780792236,-0.8148766756057739,0.03318062424659729,-0.14892780780792236,0.8702600002288818,0.03318062424659729,-0.03913772106170654,0.8702600002288818,0.03318062424659729,-0.03913772106170654,-0.8148766756057739,0.049910545349121094,-0.03913772106170654,-0.8148765563964844,0.04991075396537781,-0.03913772106170654,0.8702597618103027,0.782562255859375,-1.2044111490249634,-0.832145631313324,0.7825624942779541,-0.21222460269927979,0.7606871724128723,0.7963990569114685,-0.21222460269927979,0.7606873512268066,0.7963990569114685,-1.204411268234253,-0.8321458101272583,0.7963990569114685,-1.2931532859802246,-0.7565513253211975,0.7963990569114685,-0.3009665012359619,0.8362818360328674,0.782562255859375,-1.293153166770935,-0.7565510869026184,0.7825624942779541,-0.30096662044525146,0.8362817764282227,0.7977797985076904,-0.18754041194915771,-0.7598854899406433,0.7977797985076904,-1.2118215560913086,0.8125013709068298,0.7977797985076904,-1.3178374767303467,0.7640215158462524,0.7977797985076904,-0.2935563325881958,-0.8083653450012207,0.8090556263923645,-0.752689003944397,-0.12863309681415558,0.8090556263923645,-0.8833901882171631,0.002068141009658575,0.7940821051597595,-0.8833901882171631,0.0020681112073361874,0.7940821051597595,-0.7526889443397522,-0.12863312661647797,0.8090556263923645,-0.6219878196716309,0.0020680997986346483,0.8090556263923645,-0.7526890635490417,0.13276933133602142,0.7940821051597595,-0.752689003944397,0.13276927173137665,0.7940821051597595,-0.6219878196716309,0.0020680699963122606,0.8131517767906189,-0.752689003944397,-0.10689476132392883,0.8131517767906189,-0.6437261700630188,0.002068103291094303,0.8131517767906189,-0.8616518974304199,0.0020681375171989202,0.8131517767906189,-0.7526890635490417,0.11103101074695587,0.8165110349655151,-0.752689003944397,-0.08263015002012253,0.8165110349655151,-0.8373872637748718,0.002068133559077978,0.8165110349655151,-0.7526890635490417,0.08676639944314957,0.8165110349655151,-0.6679908037185669,0.0020681070163846016,0.012532919645309448,-0.6679908037185669,-0.0020681656897068024,0.012532919645309448,-0.7526890635490417,-0.08676644414663315,0.012532919645309448,-0.752689003944397,0.08263010531663895,0.6108502149581909,-0.913704514503479,-0.7869283556938171,0.034961819648742676,-0.752689003944397,-0.13276930153369904,0.034961819648742676,-0.8833901882171631,-0.0020681447349488735,0.7940965890884399,-1.3421440124511719,0.8144928812980652,0.8504990339279175,-0.012286663055419922,-1.024744987487793,0.8504987955093384,-0.012286663055419922,1.0247455835342407,-0.016436368227005005,-0.0195082426071167,1.012948989868164,-0.016436219215393066,-0.0195082426071167,-1.0129494667053223],
"name": "CubeGeometry.1",
"metadata": {
"type": "Geometry",
"version": 3,
"faces": 48,
"generator": "io_three",
"vertices": 140,
"materials": 1,
"uvs": 1
},
"materials": [{
"DbgName": "Material.002",
"colorDiffuse": [1.0,1.0,1.0],
"DbgColor": 15658734,
"visible": true,
"depthWrite": true,
"DbgIndex": 0,
"colorAmbient": [1.0,1.0,1.0],
"blending": "NormalBlending",
"doubleSided": true,
"transparent": false,
"wireframe": false,
"mapDiffuse": "../../../images/wooden_2.jpg",
"mapDiffuseWrap": ["RepeatWrapping","RepeatWrapping"],
"mapDiffuseAnisotropy": 1.0,
"depthTest": true,
"shading": "lambert",
"mapDiffuseRepeat": [1,1],
"opacity": 0.0,
"colorEmissive": [0.0,0.0,0.0]
}],
"faces": [11,0,4,5,1,0,0,1,2,3,11,1,5,32,31,0,3,2,4,5,11,4,40,39,5,0,1,6,7,2,11,5,39,64,32,0,2,7,8,4,11,0,1,6,2,0,0,3,9,10,11,2,6,33,34,0,10,9,11,12,11,1,31,30,6,0,3,5,13,9,11,6,30,63,33,0,9,13,14,11,11,0,2,7,3,0,0,10,15,16,11,3,7,36,37,0,16,15,17,18,11,2,34,35,7,0,10,12,19,15,11,7,35,65,36,0,15,19,20,17,11,0,3,8,4,0,0,16,21,1,11,4,8,41,40,0,1,21,22,6,11,3,37,38,8,0,16,18,23,21,11,8,38,66,41,0,21,23,24,22,11,9,13,14,10,0,25,26,27,28,11,10,14,42,43,0,28,27,29,30,11,13,28,27,14,0,26,31,32,27,11,14,27,59,42,0,27,32,33,29,11,9,10,15,11,0,25,28,34,35,11,11,15,54,55,0,35,34,36,37,11,10,43,44,15,0,28,30,38,34,11,15,44,138,54,0,34,38,39,36,11,9,11,16,12,0,25,35,40,41,11,12,16,50,49,0,41,40,42,43,11,11,55,56,16,0,35,37,44,40,11,16,56,139,50,0,40,44,45,42,11,9,12,17,13,0,25,41,46,26,11,13,17,29,28,0,26,46,47,31,11,12,49,48,17,0,41,43,48,46,11,17,48,60,29,0,46,48,49,47,11,18,22,23,19,0,50,51,52,53,11,19,23,47,46,0,53,52,54,55,11,22,55,54,23,0,51,56,57,52,11,23,54,138,47,0,52,57,58,54,11,18,19,24,20,0,50,53,59,60,11,20,24,30,31,0,60,59,61,62,11,19,46,45,24,0,53,55,63,59,11,24,45,63,30,0,59,63,64,61,11,18,20,25,21,0,50,60,65,66,11,21,25,51,52,0,66,65,67,68,11,20,31,32,25,0,60,62,69,65,11,25,32,64,51,0,65,69,70,67,11,18,21,26,22,0,50,66,71,51,11,22,26,56,55,0,51,71,72,56,11,21,52,53,26,0,66,68,73,71,11,26,53,139,56,0,71,73,74,72]
}
| 368.189189 | 8,547 | 0.833517 |
020f1ebb188f8ebe4c993beeda74976985d54f35 | 9,678 | js | JavaScript | ForumArchive/acc/post_24133_page_1.js | doc22940/Extensions | d8dbc9be08e0b8c0bd6b72e068ef73223d2799a8 | [
"Apache-2.0"
] | 136 | 2015-01-01T17:33:35.000Z | 2022-02-26T16:38:08.000Z | ForumArchive/acc/post_24133_page_1.js | doc22940/Extensions | d8dbc9be08e0b8c0bd6b72e068ef73223d2799a8 | [
"Apache-2.0"
] | 60 | 2015-06-20T00:39:16.000Z | 2021-09-02T22:55:27.000Z | ForumArchive/acc/post_24133_page_1.js | doc22940/Extensions | d8dbc9be08e0b8c0bd6b72e068ef73223d2799a8 | [
"Apache-2.0"
] | 141 | 2015-04-29T09:50:11.000Z | 2022-03-18T09:20:44.000Z | [{"Owner":"smatt","Date":"2016-07-28T16:26:06Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHello_co_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tI_t_d like to add _lt_strong_gt_water drops on the camera lens_lt_/strong_gt_ as an effect. How can it be done?_lt_br /_gt_\n\tMoving drops would be nice_co_ but _lt_strong_gt_static_lt_/strong_gt_ is more than enoughย _lt_img alt_eq__qt__dd_)_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/smile@2x.png 2x_qt_ title_eq__qt__dd_)_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\tThis screenshotย should explain my goal_lt_br /_gt_\n\tRiptideGP_dd_ย _lt_a href_eq__qt_http_dd_//prnt.sc/byopvq_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//prnt.sc/byopvq_lt_/a_gt__lt_br /_gt__lt_br /_gt_\n\tThanks for every answer_co_ Simon\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"JCPalmer","Date":"2016-07-28T17:06:14Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tYou would need 2 cameras_co_ a scene camera_co_ &_sm_ a drops camera which was ortho.\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"smatt","Date":"2016-07-28T17:25:12Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_blockquote class_eq__qt_ipsQuote_qt_ data-ipsquote_eq__qt__qt_ data-ipsquote-contentapp_eq__qt_forums_qt_ data-ipsquote-contentclass_eq__qt_forums_Topic_qt_ data-ipsquote-contentcommentid_eq__qt_137889_qt_ data-ipsquote-contentid_eq__qt_24133_qt_ data-ipsquote-contenttype_eq__qt_forums_qt_ data-ipsquote-timestamp_eq__qt_1469725574_qt_ data-ipsquote-userid_eq__qt_8492_qt_ data-ipsquote-username_eq__qt_JCPalmer_qt__gt_\n\t_lt_div class_eq__qt_ipsQuote_citation_qt__gt_\n\t\t14 minutes ago_co_ JCPalmer said_dd_\n\t_lt_/div_gt_\n\n\t_lt_div class_eq__qt_ipsQuote_contents_qt__gt_\n\t\t_lt_p_gt_\n\t\t\tYou would need 2 cameras_co_ a scene camera_co_ &_sm_ a drops camera which was ortho.\n\t\t_lt_/p_gt_\n\t_lt_/div_gt_\n_lt_/blockquote_gt_\n\n_lt_p_gt_\n\tWhy is there a need for a second camera? Couldn_t_t be the drops on the default _qt_FreeCamera_qt_?_lt_br /_gt__lt_br /_gt_\n\tIs it possible to put a bump mapping in front of the camera with zero alpha and PBR?ย _lt_img alt_eq__qt__dd_unsure_dd__qt_ data-emoticon_eq__qt__qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_unsure.png_qt_ title_eq__qt__dd_unsure_dd__qt_ /_gt__lt_/p_gt_\n\n_lt_p_gt_\n\t(I_t_m pretty new to Babylon.JSย _lt_img alt_eq__qt__sm_)_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_wink.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/wink@2x.png 2x_qt_ title_eq__qt__sm_)_qt_ width_eq__qt_20_qt_ /_gt_)\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"JCPalmer","Date":"2016-07-28T18:14:30Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tYes_co_ a post process could be used_co_ but you are going need to write a fragment shader.\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"smatt","Date":"2016-07-28T19:04:38Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_blockquote class_eq__qt_ipsQuote_qt_ data-ipsquote_eq__qt__qt_ data-ipsquote-contentapp_eq__qt_forums_qt_ data-ipsquote-contentclass_eq__qt_forums_Topic_qt_ data-ipsquote-contentcommentid_eq__qt_137902_qt_ data-ipsquote-contentid_eq__qt_24133_qt_ data-ipsquote-contenttype_eq__qt_forums_qt_ data-ipsquote-timestamp_eq__qt_1469729670_qt_ data-ipsquote-userid_eq__qt_8492_qt_ data-ipsquote-username_eq__qt_JCPalmer_qt__gt_\n\t_lt_div class_eq__qt_ipsQuote_citation_qt__gt_\n\t\t48 minutes ago_co_ JCPalmer said_dd_\n\t_lt_/div_gt_\n\n\t_lt_div class_eq__qt_ipsQuote_contents_qt__gt_\n\t\t_lt_p_gt_\n\t\t\tYes_co_ a post process could be used_co_ but you are going need to write a fragment shader.\n\t\t_lt_/p_gt_\n\t_lt_/div_gt_\n_lt_/blockquote_gt_\n\n_lt_p_gt_\n\tHas somebody already done this for Babylon.JS or know good resources for writing your own fragment shader?ย _lt_img alt_eq__qt__dd_)_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/smile@2x.png 2x_qt_ title_eq__qt__dd_)_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Nabroski","Date":"2016-07-28T19:15:58Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tHey man_co_ you already answered your question take a plane an place it like a filter of a real world camera before your lens_co_ then you can do anything you want with it_co_ sprites_co_ animate wrap UV_co_ its cheap_co_ quick and fast._lt_br /_gt_\n\t8 vertices_co_ 1 texure_co_ 2 lines of code.ย \n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"smatt","Date":"2016-07-28T19:30:21Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tThanks _lt_a contenteditable_eq__qt_false_qt_ data-ipshover_eq__qt__qt_ data-ipshover-target_eq__qt_http_dd_//www.html5gamedevs.com/profile/21965-nabroski/?do_eq_hovercard_qt_ data-mentionid_eq__qt_21965_qt_ href_eq__qt_http_dd_//www.html5gamedevs.com/profile/21965-nabroski/_qt_ rel_eq__qt__qt__gt_@Nabroski_lt_/a_gt_! Maybe I can get this to workย _lt_img alt_eq__qt__dd_unsure_dd__qt_ data-emoticon_eq__qt__qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_unsure.png_qt_ title_eq__qt__dd_unsure_dd__qt_ /_gt_ย \n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"smatt","Date":"2016-07-28T20:00:08Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tDid it! It is actually much easier than I thought.\n_lt_/p_gt_\n\n_lt_p_gt_\n\tJust add following line_dd_\n_lt_/p_gt_\n\n_lt_pre_gt_\n_lt_code_gt_var postProcess _eq_ new BABYLON.RefractionPostProcess(_qt_Refraction_qt__co_ _qt_textures/normalMap.jpg_qt__co_ new BABYLON.Color3(1.0_co_ 1.0_co_ 1.0)_co_ 0.5_co_ 0.5_co_ 1.0_co_ camera)_sm__lt_/code_gt__lt_/pre_gt_\n\n_lt_p_gt_\n\tResult is here_dd_ย _lt_a href_eq__qt_http_dd_//babylonjs-playground.com/#FCRJG_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//babylonjs-playground.com/#FCRJG_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tI got this line from_dd_ย _lt_a href_eq__qt_http_dd_//www.babylonjs.com/Demos/PPRef/_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//www.babylonjs.com/Demos/PPRef/_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tย \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Nabroski","Date":"2016-07-28T21:40:35Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tGute Arbeit!ย \n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"smatt","Date":"2016-07-29T10:14:26Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tTotally forgot to post a real rain example in here_dd_\n_lt_/p_gt_\n\n_lt_div class_eq__qt_ipsEmbeddedOther_qt__gt_\n\t_lt_iframe data-controller_eq__qt_core.front.core.autosizeiframe_qt_ scrolling_eq__qt_no_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/?app_eq_core&_sm_module_eq_system&_sm_controller_eq_embed&_sm_url_eq_https%3A%2F%2Ftwitter.com%2Fsimon_matt_%2Fstatus%2F758968147806330880_qt_ style_eq__qt_height_dd_540px_sm__qt__gt__lt_/iframe_gt_\n_lt_/div_gt_\n\n_lt_p_gt_\n\tย \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Pryme8","Date":"2016-07-29T13:58:39Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tyou could simulate this with animated sprites\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"smatt","Date":"2016-07-29T14:18:12Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\t_lt_a contenteditable_eq__qt_false_qt_ data-ipshover_eq__qt__qt_ data-ipshover-target_eq__qt_http_dd_//www.html5gamedevs.com/profile/19199-pryme8/?do_eq_hovercard_qt_ data-mentionid_eq__qt_19199_qt_ href_eq__qt_http_dd_//www.html5gamedevs.com/profile/19199-pryme8/_qt_ rel_eq__qt__qt__gt_@Pryme8_lt_/a_gt_ย I_t_m going to implement thisย _lt_img alt_eq__qt__dd_D_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_biggrin.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/biggrin@2x.png 2x_qt_ title_eq__qt__dd_D_qt_ width_eq__qt_20_qt_ /_gt__lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"V!nc3r","Date":"2016-07-29T14:24:40Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t_lt_p_gt_\n\tThis polycount post could be interesting _lt_a href_eq__qt_http_dd_//polycount.com/discussion/155940/animating-normal-maps-to-achieve-rain-drops-in-3ds-max-or-unity3d_qt_ rel_eq__qt_external nofollow_qt__gt_http_dd_//polycount.com/discussion/155940/animating-normal-maps-to-achieve-rain-drops-in-3ds-max-or-unity3d_lt_/a_gt_\n_lt_/p_gt_\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"}] | 9,678 | 9,678 | 0.846766 |
020f24356200361f9ff1b38d9f36c0453d538817 | 4,512 | js | JavaScript | ForumArchive/acc/post_39802_page_1.js | doc22940/Extensions | d8dbc9be08e0b8c0bd6b72e068ef73223d2799a8 | [
"Apache-2.0"
] | 136 | 2015-01-01T17:33:35.000Z | 2022-02-26T16:38:08.000Z | ForumArchive/acc/post_39802_page_1.js | doc22940/Extensions | d8dbc9be08e0b8c0bd6b72e068ef73223d2799a8 | [
"Apache-2.0"
] | 60 | 2015-06-20T00:39:16.000Z | 2021-09-02T22:55:27.000Z | ForumArchive/acc/post_39802_page_1.js | doc22940/Extensions | d8dbc9be08e0b8c0bd6b72e068ef73223d2799a8 | [
"Apache-2.0"
] | 141 | 2015-04-29T09:50:11.000Z | 2022-03-18T09:20:44.000Z | [{"Owner":"freetoplay","Date":"2018-09-03T20:37:30Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tIs there a way to change the position of the loading screen to static? Right now_co_ when the loading screen appears after the page load_co_ it is positioned outside of the layout_co_ probably due to it being fixed/absolute position_co_ instead of staying within the container. Is there a way to override the positioning in this case?\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Deltakosh","Date":"2018-09-04T16:27:53Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tYou can even provide yourย own _lt_span_gt__lt_img alt_eq__qt__dd_)_qt_ data-emoticon_eq__qt_true_qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_smile.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/smile@2x.png 2x_qt_ title_eq__qt__dd_)_qt_ width_eq__qt_20_qt__gt__lt_/span_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\t_lt_a href_eq__qt_https_dd_//doc.babylonjs.com/how_to/creating_a_custom_loading_screen_qt_ ipsnoembed_eq__qt_true_qt_ rel_eq__qt_external nofollow_qt__gt_https_dd_//doc.babylonjs.com/how_to/creating_a_custom_loading_screen_lt_/a_gt_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tYou can also keep the current one and override its css style (id is _qt_babylonjsLoadingDiv_qt_)\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"freetoplay","Date":"2018-10-26T02:20:42Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tHmm_co_ so after playing around with this for awhile_co_ I have not been able to set the positioning of the loading screen or disable it. _lt_span_gt__lt_img alt_eq__qt__dd_(_qt_ data-emoticon_eq__qt__qt_ height_eq__qt_20_qt_ src_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/default_sad.png_qt_ srcset_eq__qt_http_dd_//www.html5gamedevs.com/uploads/emoticons/sad@2x.png 2x_qt_ title_eq__qt__dd_(_qt_ width_eq__qt_20_qt_ /_gt__lt_/span_gt_ I have been unable to get the id of the CSS_co_ possibly because I am loading the scenes within a Vue component_co_ what should I do in this case?\n_lt_/p_gt_\n\n_lt_p_gt_\n\tMy code looks something like this to create the scene canvas_dd_\n_lt_/p_gt_\n\n_lt_p_gt_\n\tย \n_lt_/p_gt_\n\n_lt_pre_gt_\n_lt_code_gt_<_sm_template>_sm_\n <_sm_canvas ref_eq__qt_canvas_qt_ class_eq__qt_canvas_qt_ _dd_style_eq__qt_{height_dd_ height_co_ width_dd_ width_co_ outline_dd_ none_co_ display_dd_ _t_block_t_}_qt_>_sm_<_sm_/canvas>_sm_\n<_sm_/template>_sm_\n\n\n<_sm_script lang_eq__qt_ts_qt_>_sm_\nexport interface ISceneArgs {\n engine_dd_ BABYLON.Engine_sm_\n scene_dd_ BABYLON.Scene_sm_\n canvas_dd_ HTMLCanvasElement_sm_\n}\n\nexport default {\n name_dd_ _qt_SceneComponent_qt__co_\n data_dd_ function() {\n return {\n engine_dd_ null_co_\n scene_dd_ null\n }_sm_\n }_co_\n props_dd_ {\n onSceneMount_dd_ {\n type_dd_ Function_co_\n required_dd_ true\n }_co_\n height_dd_ {\n type_dd_ String_co_\n default_dd_ _qt_100%_qt_\n }_co_\n width_dd_ {\n type_dd_ String_co_\n default_dd_ _qt_100%_qt_\n }\n }_co_\n mounted() {\n this.setupScene()_sm_\n }_co_\n methods_dd_ {\n setupScene() {\n const canvas _eq_ this.$refs.canvas as HTMLCanvasElement_sm_\n this.engine _eq_ new BABYLON.Engine(\n canvas_co_\n true_co_\n { preserveDrawingBuffer_dd_ true }_co_\n false\n )_sm_\n const scene _eq_ new BABYLON.Scene(this.engine)_sm_\n this.scene _eq_ scene_sm_\n this.onSceneMount({\n scene_dd_ this.scene_co_\n engine_dd_ this.engine_co_\n canvas_dd_ this.$refs.canvas\n })_sm_\n }\n }_co_\n beforeDestroy() {\n window.removeEventListener(_qt_resize_qt__co_ this.handleResize)_sm_\n }\n}_sm_\n<_sm_/script>_sm__lt_/code_gt__lt_/pre_gt_\n\n_lt_p_gt_\n\tย \n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"},{"Owner":"Deltakosh","Date":"2018-10-26T16:15:52Z","Content":"_lt_div class_eq__qt_mages_qt__gt_\n\t\t\t\n_lt_p_gt_\n\tCan you share a LIVE example? something than I can try directly (I_t_m in a rush so I do not have a lot of time to setup a server and test it)\n_lt_/p_gt_\n\n\n\t\t\t\n\t\t_lt_/div_gt_\n\n\t\t_lt_div class_eq__qt_ipsI_qt__gt__lt_/div_gt__lt_/div_gt_"}] | 4,512 | 4,512 | 0.794548 |
020ff89083580873637d855b0847bb1113dcdb7d | 655 | js | JavaScript | src/main/webapp/app/src/module/utils/componentes/validationFactory.js | dfslima/portalCliente | 5ca90ffa1c1759d854c41fc841012d590eb40b4b | [
"MIT"
] | null | null | null | src/main/webapp/app/src/module/utils/componentes/validationFactory.js | dfslima/portalCliente | 5ca90ffa1c1759d854c41fc841012d590eb40b4b | [
"MIT"
] | null | null | null | src/main/webapp/app/src/module/utils/componentes/validationFactory.js | dfslima/portalCliente | 5ca90ffa1c1759d854c41fc841012d590eb40b4b | [
"MIT"
] | null | null | null | app.factory('validationFactory', function(){
var validationFactory = {};
validationFactory.lengthInputs = function(inputValue, minLength,
maxLength, nameInput, isRequired, $scope) {
return lengthInputs(inputValue, minLength, maxLength,
nameInput, isRequired, $scope);
};
validationFactory.validarCNPJ = function(cnpj) {
return validarCNPJ(cnpj);
};
validationFactory.showNameCustomer = function (customer) {
if(customer != undefined) {
if(customer.type == 2)
return customer.corporateName;
else
return customer.name;
}
};
return validationFactory;
}); | 22.586207 | 66 | 0.656489 |
0210ad32da344262c093ede99f117238e74f9a57 | 478 | js | JavaScript | doc/src/static/doxygen/namespaceoutcome__v2__xxx_1_1trait_1_1detail.js | chenxiaolong/outcome | 1f2d788c04c86d5b5bbf833aef564915d788403a | [
"Apache-2.0"
] | null | null | null | doc/src/static/doxygen/namespaceoutcome__v2__xxx_1_1trait_1_1detail.js | chenxiaolong/outcome | 1f2d788c04c86d5b5bbf833aef564915d788403a | [
"Apache-2.0"
] | null | null | null | doc/src/static/doxygen/namespaceoutcome__v2__xxx_1_1trait_1_1detail.js | chenxiaolong/outcome | 1f2d788c04c86d5b5bbf833aef564915d788403a | [
"Apache-2.0"
] | 3 | 2019-05-11T01:55:09.000Z | 2019-11-16T21:49:22.000Z | var namespaceoutcome__v2__xxx_1_1trait_1_1detail =
[
[ "has_error_code", "structoutcome__v2__xxx_1_1trait_1_1detail_1_1has__error__code.html", null ],
[ "has_error_payload", "structoutcome__v2__xxx_1_1trait_1_1detail_1_1has__error__payload.html", null ],
[ "has_exception_ptr", "structoutcome__v2__xxx_1_1trait_1_1detail_1_1has__exception__ptr.html", null ],
[ "no_error_payload", "structoutcome__v2__xxx_1_1trait_1_1detail_1_1no__error__payload.html", null ]
]; | 68.285714 | 107 | 0.82636 |
0211368dc51cf4dd8aaad610bc66f996f0896184 | 1,271 | js | JavaScript | src/components/About.js | dzole0311/gjoremilevski.com | 96fdc0eb7f7a74adb1fa07db65cd0ad3c8d03644 | [
"MIT"
] | null | null | null | src/components/About.js | dzole0311/gjoremilevski.com | 96fdc0eb7f7a74adb1fa07db65cd0ad3c8d03644 | [
"MIT"
] | null | null | null | src/components/About.js | dzole0311/gjoremilevski.com | 96fdc0eb7f7a74adb1fa07db65cd0ad3c8d03644 | [
"MIT"
] | null | null | null | import React from 'react'
class About extends React.Component {
render() {
return (
<section className="o-section o-section__about">
<div className="o-section__content">
<div className="o-section__content-inner">
<div className="m-intro">
<h2 className="m-title m-intro__title">About</h2>
<p className="m-intro__description">
I'm a web developer with a core focus on all things JavaScript. Key skills include JavaScript,
CSS3 (SCSS), Bootstrap, React, QGIS, ArcMap, Node.js and many more.
My interests revolve around general web application development, the geospatial industry (WebGIS, web mapping,
spatial analyses, drones) and product development. When not working or when I have some spare time by myself,
I try to keep up with the latest podcasts, read or go on a stroll around the city.
</p>
</div>
</div>
</div>
</section>
)
}
}
export default About
| 47.074074 | 142 | 0.513769 |
02115a6cb680968ca968dc047e142c13289133e9 | 62 | js | JavaScript | .eslintrc.js | joelvoss/jvdx | 3f277c154848f408e355fe35623931bffcdc1477 | [
"MIT"
] | 1 | 2019-11-29T21:23:36.000Z | 2019-11-29T21:23:36.000Z | .eslintrc.js | joelvoss/jvdx | 3f277c154848f408e355fe35623931bffcdc1477 | [
"MIT"
] | 4 | 2021-04-01T09:36:17.000Z | 2021-05-26T11:18:05.000Z | .eslintrc.js | joelvoss/jvdx | 3f277c154848f408e355fe35623931bffcdc1477 | [
"MIT"
] | 1 | 2020-10-09T08:45:18.000Z | 2020-10-09T08:45:18.000Z | module.exports = {
extends: ['./dist/configs/eslintrc'],
};
| 15.5 | 39 | 0.629032 |
0211b961320034fa363b4a591ac66e746bfdf96b | 5,822 | js | JavaScript | dist/commonjs js-only/System/Random.js | electricessence/TypeScript.NET | 3325eb115cd82bbb3b0a67ebadd49cd9c4eba617 | [
"MIT"
] | 270 | 2015-01-14T14:27:31.000Z | 2021-12-17T16:36:15.000Z | dist/commonjs js-only/System/Random.js | electricessence/TypeScript.NET | 3325eb115cd82bbb3b0a67ebadd49cd9c4eba617 | [
"MIT"
] | 66 | 2015-03-01T14:45:15.000Z | 2018-12-21T19:15:55.000Z | dist/commonjs js-only/System/Random.js | electricessence/TypeScript.NET | 3325eb115cd82bbb3b0a67ebadd49cd9c4eba617 | [
"MIT"
] | 56 | 2015-03-01T14:51:22.000Z | 2022-03-18T00:08:55.000Z | "use strict";
/*!
* @author electricessence / https://github.com/electricessence/
* Licensing: MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
var Integer_1 = require("./Integer");
var initialize_1 = require("./Collections/Array/initialize");
var shuffle_1 = require("./Collections/Array/shuffle");
var assert = Integer_1.Integer.assert;
/**
* This module only acts as a utility API for getting random numbers from Math.random().
* If you need repeatable seeded random numbers then you'll need a separate utility.
* Highly recommended: https://github.com/ckknight/random-js which has typings under @types/random-js.
*/
var Random;
(function (Random) {
function r(maxExclusive) {
if (maxExclusive === void 0) { maxExclusive = 1; }
return Math.floor(Math.random() * maxExclusive);
}
function nr(boundary, inclusive) {
var a = Math.abs(boundary);
if (a === 0 || a === 1 && !inclusive)
return 0;
if (inclusive)
boundary += boundary / a;
return r(boundary);
}
function arrayCopy(source) {
var len = source.length;
var result = initialize_1.initialize(len);
for (var i = 0; i < len; i++) {
result[i] = source[i];
}
return result;
}
/**
* Returns a random integer from 0 to the maxExclusive.
* Negative numbers are allowed.
*
* @param maxExclusive
* @returns {number}
*/
function integer(maxExclusive) {
return next(maxExclusive);
}
Random.integer = integer;
/**
* Returns a function that generates random floating point numbers up to the maxExclusive value.
* Useful for generating a random and memoizable set for use with other enumerables.
* @param maxExclusive
* @returns {()=>number}
*/
function generate(maxExclusive) {
if (maxExclusive === void 0) { maxExclusive = 1; }
return function () { return r(maxExclusive); };
}
Random.generate = generate;
(function (generate) {
/**
* Returns a function that generates random integers up to the boundary.
* Useful for generating a random and memoizable set for use with other enumerables.
* @param boundary
* @param inclusive
* @returns {()=>number}
*/
function integers(boundary, inclusive) {
return function () { return nr(boundary, inclusive); };
}
generate.integers = integers;
})(generate = Random.generate || (Random.generate = {}));
/**
* Returns a random integer from 0 to the boundary.
* Return value will be less than the boundary unless inclusive is set to true.
* Negative numbers are allowed.
*
* @param boundary
* @param inclusive
* @returns {number}
*/
function next(boundary, inclusive) {
assert(boundary, 'boundary');
return nr(boundary, inclusive);
}
Random.next = next;
(function (next) {
function integer(boundary, inclusive) {
return Random.next(boundary, inclusive);
}
next.integer = integer;
function float(boundary) {
if (boundary === void 0) { boundary = Number.MAX_VALUE; }
if (isNaN(boundary))
throw "'boundary' is not a number.";
return Math.random() * boundary;
}
next.float = float;
function inRange(min, max, inclusive) {
assert(min, 'min');
assert(max, 'max');
var range = max - min;
if (range === 0)
return min;
if (inclusive)
range += range / Math.abs(range);
return min + r(range);
}
next.inRange = inRange;
})(next = Random.next || (Random.next = {}));
/**
* Returns an array of random integers.
* @param count
* @param boundary
* @param inclusive
* @returns {number[]}
*/
function integers(count, boundary, inclusive) {
assert(count);
var s = [];
s.length = count;
for (var i = 0; i < count; i++) {
s[i] = nr(boundary, inclusive);
}
return s;
}
Random.integers = integers;
/**
* Shuffles an array.
* @param target
* @returns {T}
*/
function shuffle(target) {
return shuffle_1.shuffle(target);
}
Random.shuffle = shuffle;
/**
* Creates a copy of an array-like and returns it shuffled.
* @param source
* @returns {T[]}
*/
function copy(source) {
return shuffle_1.shuffle(arrayCopy(source));
}
Random.copy = copy;
/**
* Returns a distinct random set from the source array up to the maxCount or the full length of the array.
* @param source
* @param maxCount
* @returns {any}
*/
function select(source, maxCount) {
if (maxCount !== Infinity)
Integer_1.Integer.assertZeroOrGreater(maxCount);
switch (maxCount) {
case 0:
return [];
case 1:
return [select.one(source, true)];
default:
var result = shuffle_1.shuffle(arrayCopy(source));
if (maxCount < result.length)
result.length = maxCount;
return result;
}
}
Random.select = select;
(function (select) {
function one(source, throwIfEmpty) {
if (source && source.length)
return source[r(source.length)];
if (throwIfEmpty)
throw "Cannot select from an empty set.";
}
select.one = one;
})(select = Random.select || (Random.select = {}));
})(Random = exports.Random || (exports.Random = {})); | 32.892655 | 110 | 0.564411 |
02125f381c254c88edb458cc3cdcc5a8db9845d3 | 10,545 | js | JavaScript | index.js | mofron/mofron-comp-fileselector | c2a9f65a271c176ae1c33e32483297565d51c445 | [
"MIT"
] | null | null | null | index.js | mofron/mofron-comp-fileselector | c2a9f65a271c176ae1c33e32483297565d51c445 | [
"MIT"
] | null | null | null | index.js | mofron/mofron-comp-fileselector | c2a9f65a271c176ae1c33e32483297565d51c445 | [
"MIT"
] | null | null | null | /**
* @file mofron-comp-fileselector/index.js
* @brief file select button component for mofron
* @license MIT
*/
const FormItem = require("mofron-comp-formitem");
const Input = require("mofron-comp-input");
const Text = require("mofron-comp-text");
const Button = require("mofron-comp-button");
const Focus = require("mofron-event-focus");
const onCommon = require("mofron-event-oncommon");
const SyncHei = require("mofron-effect-synchei");
const comutl = mofron.util.common;
const ConfArg = mofron.class.ConfArg;
let read_files = null;
module.exports = class extends FormItem {
/**
* initialize component
*
* @param (mixed) text parameter
* key-value: component config
* @short text
* @type private
*/
constructor (prm) {
try {
super();
this.modname("FileSelector");
this.shortForm("text");
/* init config */
this.confmng().add("typeFilter", { type: "string", list: true, init:[] });
this.confmng().add("typeFilter_comp", { type: "Component" });
this.confmng().add("sizeFilter", { type: "number" });
this.confmng().add("sizeFilter_comp", { type: "Component" });
this.confmng().add("value", { type: "string", list: true });
this.confmng().add("base64Value", { type: "string", list: true });
/* set config */
if (undefined !== prm) {
this.config(prm);
}
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* initialize dom contents
*
* @type private
*/
initDomConts () {
try {
super.initDomConts();
let wrap = new mofron.class.Component({
style: { "display": "flex" },
child: [this.button(), this.filetxt()]
})
this.child([this.input(), wrap]);
} catch (e) {
console.error(e.stack);
throw e;
}
}
fileEvent (p1,p2,p3) {
try {
p2.preventDefault();
/* init file value */
p3.confmng().delete("value");
p3.confmng().delete("base64Value");
p3.filetxt("");
let flist = "";
let files = p1.childDom().getRawDom().files;
let reader = [];
for (let fidx in files) {
if (true === Number.isNaN(parseInt(fidx,10))) {
continue;
}
flist += files[fidx].name + ",";
/* check type filter */
let typ_fil = p3.typeFilter();
let ftype = files[fidx].name.split('.')[1];
for (let fidx in typ_fil.type) {
if (ftype !== typ_fil.type[fidx]) {
typ_fil.comp.visible(true);
return;
}
}
reader.push(new FileReader());
reader[fidx].readAsDataURL(files[fidx]);
reader[fidx].onload = () => {
try {
if (0 === reader[fidx].result.length) {
return;
}
let siz_fil = p3.sizeFilter();
p3.base64Value(reader[fidx].result.split(',')[1]);
p3.value(atob(reader[fidx].result.split(',')[1]));
/* change event */
let cevt = p3.changeEvent();
for (let cidx in cevt) {
cevt[cidx][0](p3, reader.result, cevt[cidx][1]);
}
} catch (e) {
console.error(e.stack);
throw e;
}
}
}
p3.filetxt(flist.substring(0,flist.length-1));
} catch (e) {
console.error(e.stack);
throw e;
}
}
typeFilter (tp, cmp) {
try {
if (undefined === tp) {
return {
type: this.confmng("typeFilter"),
comp: this.confmng("typeFilter_comp")
};
}
this.confmng("typeFilter", tp);
this.confmng("typeFilter_comp", cmp);
} catch (e) {
console.error(e.stack);
throw e;
}
}
sizeFilter (siz, cmp) {
try {
if (undefined === siz) {
return {
size: this.confmng("sizeFilter"),
comp: this.confmng("sizeFilter_comp")
};
}
this.confmng("sizeFilter", siz);
this.confmng("sizeFilter_comp", cmp);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* input tag setter/getter
*
* @param (mofron.class.Dom) input tag dom
* undefined: call as getter
* @return (mofron.class.Dom) input tag dom
* @type private
*/
input (prm) {
try {
if (true === comutl.isinc(prm, "Input")) {
prm.type("file");
prm.visible(false);
prm.event(
new onCommon(new ConfArg(this.fileEvent, this), "onchange")
);
}
return this.innerComp("input", prm, Input);
} catch (e) {
console.error(e.stack);
throw e;
}
}
contents (fnc) {
if (0 === this.input().childDom().getRawDom().length) {
return;
}
let file = this.input().childDom().getRawDom().files[0];
const reader = new FileReader();
reader.onload = () => {
fnc(reader.result);
};
reader.readAsText(file);
}
/**
* button component setter/getter
*
* @param (mofron-comp-button) button component
* undefined: call as getter
* @return (mofron-comp-button) button component
* @type parameter
*/
button (prm) {
try {
if (true === comutl.isinc(prm, "Button")) {
prm.clickEvent(
(c1,c2,c3) => {
c3.input().childDom().getRawDom().click();
},
this
);
let fcs_evt = (f1,f2,f3) => {
let fevt = f3.focusEvent();
for (let fidx in fevt) {
fevt[fidx][0].exec(f3,f2, fevt[fidx][1]);
}
}
let focus = new Focus(new ConfArg(fcs_evt, this));
prm.event(
new Focus(new ConfArg(fcs_evt, this))
);
}
return this.innerComp("button", prm, Button);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* file name text component setter/getter
*
* @param (mixed) string: file name text
* mofron-comp-text: file name text component
* undefined: call as getter
* @return (mofron-comp-text) file name text component
* @type parameter
*/
filetxt (prm, cnf) {
try {
if ("string" === typeof prm) {
this.filetxt().text(prm);
this.filetxt().config(cnf);
return;
} else if (true === comutl.isinc(prm, "Text")) {
prm.style({ "margin-left" : "0.2rem" });
prm.config(cnf);
}
return this.innerComp("filetxt", prm, Text);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* button text setter/getter
*
* @param (string) button text
* undefined: call as getter
* @return (string) button text
* @type parameter
*/
text (prm) {
try {
return this.button().text(prm);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* multiple selector setter/getter
*
* @param (boolean) true: multiple selector
* false: single selector
* undefined: call as getter
* @return (boolean) multiple selector
* @type parameter
*/
multiple (prm) {
try {
if (undefined === prm) {
/* getter */
let ret = this.input().attrs("multiple");
return (null === ret) ? false : true;
}
/* setter */
this.input().attrs(
{ multiple : (false !== prm ) ? true : null }
);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* accept file type
*
* @param (string) accept file types
* undefined: call as getter
* @return (mixed) string: accept file types
* null: not set
* @type parameter
*/
accept (prm) {
try {
this.input().attrs(
(undefined === prm) ? "accept" : { multiple : prm }
);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* base64 value setter/getter
*
* @param (string) base64 value
* @return (string) base64 value
* @type function
*/
base64Value (prm) {
try {
return this.confmng("base64Value", prm);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* selected value setter/getter
*
* @param (string) value string
* @return (string) value string
* @type function
*/
value (prm) {
try {
return this.confmng("value", prm);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* selector button height setter/gertter
*
* @param (string(size)) button height
* undefined: call as getter
* @param (key-value) style option
* @return (string(size)) button height
* @type parameter
*/
height (prm, opt) {
try {
return this.button().height(prm, opt);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* selector button width setter/gertter
*
* @param (string(size)) button width
* undefined: call as getter
* @param (key-value) style option
* @return (mixed) string(size) button width
* null: not set
* @type parameter
*/
width (prm, opt) {
try {
return this.button().width(prm, opt);
} catch (e) {
console.error(e.stack);
throw e;
}
}
}
/* end of file */
| 27.038462 | 79 | 0.461166 |
021318f9381fc061d3b1b77840d74cb36dd4118a | 2,226 | js | JavaScript | src/index.js | ideyuta/ghost-writer | 6b0406aff4fdd888089588978d58277ab4f94b4a | [
"MIT"
] | 10 | 2016-02-22T01:40:44.000Z | 2017-06-06T17:05:28.000Z | src/index.js | ideyuta/ghost-writer | 6b0406aff4fdd888089588978d58277ab4f94b4a | [
"MIT"
] | null | null | null | src/index.js | ideyuta/ghost-writer | 6b0406aff4fdd888089588978d58277ab4f94b4a | [
"MIT"
] | null | null | null | import romaji from 'romaji';
/**
* ghostWriter
*
* @param {Array|string} rawStruct - ghost raw struct
* @return {Function}
*/
export default function ghostWriter(rawStruct) {
const g = ghost(rawStruct);
let count = -2;
/**
* writer
*
* @param {Function} cb - callback function
* @param {number} [msec] - interval milliseconds
* @return {string|null}
*/
function writer(cb, msec = 100) {
count++;
if (count < g.length - 1) {
setTimeout(writer.bind(undefined, cb, msec), msec);
}
if (count >= 0) {
return cb(g[count]);
}
}
return writer;
}
/**
* Ghost
*
* @param {Array|String} rawStruct - ghost raw struct
* @return {string[]} ghostruct
*/
export function ghost(rawStruct) {
const ghostruct = [];
parser(rawStruct);
/**
* parser
*
* @param {Array|String} struct - ghost raw struct
*/
function parser(struct) {
if (Array.isArray(struct)) {
struct.forEach(element => {
if (Array.isArray(element.i)) {
const length = ghostruct.length;
parser(element.i);
const preEl = ghostruct[length - 1] || '';
ghostruct.push(preEl + element.o);
} else {
const strings = element.i.split('');
strings.forEach(s => {
ghostruct.push(ghostruct.length > 0 ? ghostruct[ghostruct.length - 1] + s : s);
});
const preEl = ghostruct[ghostruct.length - 1];
ghostruct.push(preEl.substr(0, preEl.length - strings.length) + element.o);
}
});
} else if (typeof struct === 'string') {
struct.split('').forEach((element, key) => {
ghostruct.push(key > 0 ? ghostruct[key - 1] + element : element);
});
}
}
return Array.isArray(rawStruct) ? hiraganize(ghostruct) : ghostruct;
}
/**
* Hiraganaize
*
* @param {Array} struct - ghostruct
* @return {Array} struct - ghostruct
*/
function hiraganize(struct) {
return struct.map(el => {
const els = el.split('');
let hiragana = romaji.toHiragana(el);
if (els[els.length - 1] === 'n') {
const tmp = hiragana.split('');
tmp.pop();
tmp.push('n');
hiragana = tmp.join('');
}
return hiragana;
});
}
| 23.680851 | 91 | 0.569632 |
02135185ced88620d9348fc1bc4a9c8e962b85b6 | 3,668 | js | JavaScript | src/structures/SilvanoClient.js | Vectrixed/selfbot | 9694b0fab514f3a25fd21b99a36454b3cd0e816e | [
"MIT"
] | null | null | null | src/structures/SilvanoClient.js | Vectrixed/selfbot | 9694b0fab514f3a25fd21b99a36454b3cd0e816e | [
"MIT"
] | null | null | null | src/structures/SilvanoClient.js | Vectrixed/selfbot | 9694b0fab514f3a25fd21b99a36454b3cd0e816e | [
"MIT"
] | null | null | null | const { stripIndents } = require('common-tags');
const { Client, Collection, Message } = require('discord.js');
const fs = Promise.promisifyAll(require('fs'));
const path = require('path');
const Command = require('./Command');
const { colors } = require('../../config');
const Log = require('../util/Log');
Message.prototype.editEmbed = function(text) { // eslint-disable-line func-names
this.edit({
embed: {
color: colors.EMBEDS,
description: text,
},
});
};
module.exports = class SilvanoClient extends Client {
constructor(options) {
super(options);
if (!('prefix' in options)) throw new Error('Field `prefix` can not be missing from Client constructor.');
if (!('commandsDir' in options)) throw new Error('Field `commandsDir` can not be missing from Client constructor.');
this.prefix = options.prefix;
this.commandsDir = options.commandsDir;
this.commands = new Collection();
this
.on('ready', () => {
Log.success(`Michiko is now serving ${this.user.username}#${this.user.discriminator} (ID: ${this.user.id})`);
})
.on('message', this.handleMessage)
.on('messageUpdate', (oldMessage, newMessage) => {
if (oldMessage.content !== newMessage.content) this.handleMessage(newMessage);
})
.on('disconnect', event => {
Log.warn(stripIndents`
Michiko has lost connection to the Discord gateway.
Exit code: ${event.code}
`);
})
.on('reconnecting', () => {
Log.info('Michiko is attempting to reconnect to the Discord gateway...');
})
.on('warn', info => {
Log.warn(info);
})
.on('error', error => {
Log.error(stripIndents`
Michiko has encountered an error:
${error.message}
${error.stack}
`);
});
this.registerCommandsIn(this.commandsDir);
}
handleMessage(message) {
if (message.author.id !== this.user.id) return;
if (!message.content.startsWith(this.prefix)) return;
const [commandName, ...args] = message.content.substr(this.prefix.length).split(' ');
const command = this.commands.get(commandName);
if (command) {
command.run(message, args).catch(error => {
message.editCode('', error);
});
}
}
registerCommandsIn(dir) {
fs.readdirAsync(dir).then(files => {
for (const file of files) {
const pathToFile = path.join(dir, file);
if (fs.statSync(pathToFile).isDirectory()) {
this.registerCommandsIn(pathToFile);
continue;
}
if (!pathToFile.endsWith('.js')) continue;
const CommandClass = require(pathToFile);
if (typeof CommandClass !== 'function') {
Log.warn(`${pathToFile} is not a command class. Skipping`);
continue;
}
const command = new CommandClass(this);
if (!(command instanceof Command)) {
Log.warn(`${pathToFile} is not a command class. Skipping`);
continue;
}
if (this.commands.has(command.name)) {
Log.warn(`A command with the name ${command.name} already exists. Skipping ${pathToFile}`);
continue;
}
this.commands.set(command.name, command);
if (command.name.includes('-')) {
this.commands.set(command.name.replace(/-/g, ''), command);
}
if ('aliases' in command) {
for (const alias of command.aliases) {
if (this.commands.has(alias)) {
Log.warn(`A command with the name ${command.name} already exists. Skipping ${pathToFile}`);
continue;
}
this.commands.set(alias, command);
if (alias.includes('-')) {
this.commands.set(alias.replace(/-/g, ''), command);
}
}
}
}
}).catch(error => {
Log.error(stripIndents`
Error when loading commands: ${error.message}
${error.stack}
`);
});
}
};
| 27.17037 | 118 | 0.633043 |
0213d09146200434325d2b994941e942b79c58d3 | 426 | js | JavaScript | src/components/bottom-cta/become-partner-bottom-cta.js | abeuscher/contentstackjobapp | 79452eef2472e5d9f6f2c842f4bceb4cfa123a77 | [
"MIT"
] | null | null | null | src/components/bottom-cta/become-partner-bottom-cta.js | abeuscher/contentstackjobapp | 79452eef2472e5d9f6f2c842f4bceb4cfa123a77 | [
"MIT"
] | null | null | null | src/components/bottom-cta/become-partner-bottom-cta.js | abeuscher/contentstackjobapp | 79452eef2472e5d9f6f2c842f4bceb4cfa123a77 | [
"MIT"
] | null | null | null | import { useStaticQuery, graphql } from "gatsby"
import React from "react"
import BottomCTA from "./bottom-cta"
export default function BizBottomCTA() {
const data = useStaticQuery(graphql`
query BecomePartnerBottomCtaQuery {
csBecomeAPartner {
bottom_cta {
header
copy
}
}
}
`)
return (
<BottomCTA data={data.csBecomeAPartner.bottom_cta} />
)
}
| 20.285714 | 57 | 0.622066 |
0213f891236b49949234159b897b7152b265c8c8 | 1,091 | js | JavaScript | examples/express/app.js | msurdi/html-string | b3950ed9bd93ff792af8f4bdca83455bd2ef5b61 | [
"MIT"
] | null | null | null | examples/express/app.js | msurdi/html-string | b3950ed9bd93ff792af8f4bdca83455bd2ef5b61 | [
"MIT"
] | 2 | 2020-08-01T16:41:47.000Z | 2021-05-10T13:44:34.000Z | examples/express/app.js | msurdi/html-string | b3950ed9bd93ff792af8f4bdca83455bd2ef5b61 | [
"MIT"
] | null | null | null | const express = require("express");
const html = require("html-string");
const app = express();
const TodoItem = ({ title, completed }) => html`
<li>${title}:safe ${completed ? "โ
" : "โ"}</li>
`;
const TodoList = ({ todos, completedCount, extraAttrs = {} }) => html`
<ul ${extraAttrs}:attrs>
${todos.map((todo) => TodoItem(todo))}
</ul>
${completedCount && html` <p>${completedCount} tasks completed</p> `}
`;
const todos = [
{ title: "Read this", completed: true },
{ title: "Use this", completed: false },
// Title will be shown in bold (thus, unescaped) because the TodoItem template has the :safe modifier for the ${title} value.
{ title: "<b>important task</b>", completed: false },
];
const completedCount = todos.filter((todo) => todo.completed).length;
const template = TodoList({
todos,
completedCount,
extraAttrs: { id: "tasks", dataCustom: "value", dataSomeBool: true },
});
app.get("/", (req, res) => res.send(template.render()));
// eslint-disable-next-line no-console
app.listen(8080, () => console.log("App ready at http://localhost:8080"));
| 30.305556 | 127 | 0.643446 |
02144c4d1c8b01da1e30a6ed1b069f42960a759b | 4,723 | js | JavaScript | olx-clone/assets/images/svg/svg.js | anindita0024/OLX-clone | dd4f453b6049682903ecf2d7be8f5544cf6ebf95 | [
"MIT"
] | 1 | 2021-09-18T07:13:56.000Z | 2021-09-18T07:13:56.000Z | olx-clone/assets/images/svg/svg.js | anindita0024/OLX-clone | dd4f453b6049682903ecf2d7be8f5544cf6ebf95 | [
"MIT"
] | null | null | null | olx-clone/assets/images/svg/svg.js | anindita0024/OLX-clone | dd4f453b6049682903ecf2d7be8f5544cf6ebf95 | [
"MIT"
] | 2 | 2021-11-14T05:17:15.000Z | 2021-11-14T05:34:05.000Z | /**
* ? olx-logo.svg ----- login page signup page
*/
/**
* ! olx brand name header-component
<svg
width="48px"
height="48px"
viewBox="0 0 1024 1024"
data-aut-id="icon"
className
fillRule="evenodd"
>
<path
className="rui-77aaa"
d="M661.333 256v512h-128v-512h128zM277.333 298.667c117.824 0 213.333 95.531 213.333 213.333s-95.509 213.333-213.333 213.333c-117.824 0-213.333-95.531-213.333-213.333s95.509-213.333 213.333-213.333zM794.496 384l37.504 37.504 37.504-37.504h90.496v90.496l-37.504 37.504 37.504 37.504v90.496h-90.496l-37.504-37.504-37.504 37.504h-90.496v-90.496l37.504-37.504-37.504-37.504v-90.496h90.496zM277.333 426.667c-47.061 0-85.333 38.293-85.333 85.333s38.272 85.333 85.333 85.333c47.061 0 85.333-38.293 85.333-85.333s-38.272-85.333-85.333-85.333z"
/>
</svg>;
*/
/**
* ! search icon header-component
<svg
width="25px"
height="25px"
viewBox="0 0 1024 1024"
data-aut-id="icon"
className
fillRule="evenodd"
>
<path
className="rui-77aaa"
d="M448 725.333c-152.917 0-277.333-124.416-277.333-277.333s124.416-277.333 277.333-277.333c152.917 0 277.333 124.416 277.333 277.333s-124.416 277.333-277.333 277.333v0zM884.437 824.107v0.021l-151.915-151.936c48.768-61.781 78.144-139.541 78.144-224.192 0-199.979-162.688-362.667-362.667-362.667s-362.667 162.688-362.667 362.667c0 199.979 162.688 362.667 362.667 362.667 84.629 0 162.411-29.376 224.171-78.144l206.144 206.144h60.352v-60.331l-54.229-54.229z"
/>
</svg>;
*/
/**
* ! arrow-down header-component
<svg
width="24px"
height="24px"
viewBox="0 0 1024 1024"
data-aut-id="icon"
className
fillRule="evenodd"
>
<path
className="rui-77aaa"
d="M85.392 277.333h60.331l366.336 366.336 366.336-366.336h60.331v60.331l-408.981 409.003h-35.307l-409.045-409.003z"
/>
</svg>
*/
/**
* ! sell-icon header-component
<svg
width={104}
height={48}
viewBox="0 0 1603 768"
className="_3V9PS"
>
<g>
<path
className="all"
d="M434.442 16.944h718.82c202.72 0 367.057 164.337 367.057 367.058s-164.337 367.057-367.057 367.057h-718.82c-202.721 0-367.058-164.337-367.058-367.058s164.337-367.058 367.058-367.058z"
/>
<path
className="left"
d="M427.241 669.489c-80.917 0-158.59-25.926-218.705-73.004l-0.016-0.014c-69.113-54.119-108.754-131.557-108.754-212.474 0-41.070 9.776-80.712 29.081-117.797 25.058-48.139 64.933-89.278 115.333-118.966l-52.379-67.581c-64.73 38.122-115.955 90.98-148.159 152.845-24.842 47.745-37.441 98.726-37.441 151.499 0 104.027 50.962 203.61 139.799 273.175h0.016c77.312 60.535 177.193 93.887 281.22 93.887h299.699l25.138-40.783-25.138-40.783h-299.698z"
/>
<path
className="top"
d="M1318.522 38.596v0c-45.72-14.369-93.752-21.658-142.762-21.658h-748.511c-84.346 0-165.764 21.683-235.441 62.713l3.118 51.726 49.245 15.865c54.16-31.895 117.452-48.739 183.073-48.739h748.511c38.159 0 75.52 5.657 111.029 16.829v0c44.91 14.111 86.594 37.205 120.526 66.792l66.163-57.68c-43.616-38.010-97.197-67.703-154.957-85.852z"
/>
<path
className="right"
d="M1473.479 124.453l-55.855 9.91-10.307 47.76c61.844 53.929 95.92 125.617 95.92 201.88 0 25.235-3.772 50.26-11.214 74.363-38.348 124.311-168.398 211.129-316.262 211.129h-448.812l25.121 40.783-25.121 40.783h448.812c190.107 0 357.303-111.638 406.613-271.498 9.572-31.009 14.423-63.162 14.423-95.559 0-98.044-43.805-190.216-123.317-259.551z"
/>
</g>
</svg>
*/
/**
* ! plus-icon header-component
<svg
width="16px"
height="16px"
viewBox="0 0 1024 1024"
data-aut-id="icon"
className
fillRule="evenodd"
>
<path
className="rui-367TP"
d="M414.898 123.739v291.218h-291.218l-97.014 97.014 97.014 97.131h291.218v291.16l97.073 97.071 97.073-97.071v-291.16h291.16l97.131-97.131-97.131-97.014h-291.16v-291.218l-97.073-97.073z"
/>
</svg>
*/
/**
* ! favorite-icon post components
<svg
width="24px"
height="24px"
viewBox="0 0 1024 1024"
data-aut-id="icon"
className
fillRule="evenodd"
>
<path
className="rui-77aaa"
d="M830.798 448.659l-318.798 389.915-317.828-388.693c-20.461-27.171-31.263-59.345-31.263-93.033 0-85.566 69.605-155.152 155.152-155.152 72.126 0 132.752 49.552 150.051 116.364h87.777c17.299-66.812 77.905-116.364 150.051-116.364 85.547 0 155.152 69.585 155.152 155.152 0 33.687-10.802 65.862-30.293 91.811zM705.939 124.121c-80.853 0-152.204 41.425-193.939 104.204-41.736-62.778-113.086-104.204-193.939-104.204-128.33 0-232.727 104.378-232.727 232.727 0 50.657 16.194 98.948 47.806 140.897l328.766 402.133h100.189l329.716-403.355c30.662-40.727 46.856-89.018 46.856-139.675 0-128.349-104.398-232.727-232.727-232.727z"
/>
</svg>
*/
| 34.224638 | 628 | 0.67436 |
0214b436fb32f150d1d0ae1df66c98ec403e2d14 | 1,812 | js | JavaScript | src/client/manipulation/execute/dom/sort.test.js | mybrainpal/brainjs | 9a67baee16eb9f7da738d86fbc303cf318120252 | [
"Apache-2.0"
] | null | null | null | src/client/manipulation/execute/dom/sort.test.js | mybrainpal/brainjs | 9a67baee16eb9f7da738d86fbc303cf318120252 | [
"Apache-2.0"
] | null | null | null | src/client/manipulation/execute/dom/sort.test.js | mybrainpal/brainjs | 9a67baee16eb9f7da738d86fbc303cf318120252 | [
"Apache-2.0"
] | null | null | null | /**
* Proudly created by ohad on 18/12/2016.
*/
let expect = require('chai').expect,
$ = require('../../../common/util/dom'),
BaseError = require('../../../common/log/base.error'),
SortExecutor = require('./sort'),
tinysort = require('tinysort');
describe('SortExecutor', function () {
let ul, li1, li2, li3;
beforeEach(() => {
ul = document.createElement('ul');
ul.setAttribute('id', 'ul');
$('body').appendChild(ul);
li2 = document.createElement('li');
li2.textContent = '2';
ul.appendChild(li2);
li1 = document.createElement('li');
li1.textContent = '1';
ul.appendChild(li1);
li3 = document.createElement('li');
li3.textContent = '3';
ul.appendChild(li3);
});
afterEach(() => {
ul.parentNode.removeChild(ul);
});
it('Sort elements', () => {
SortExecutor.execute({targets: '#ul>li'});
expect(ul.children[0]).to.equal(li1);
expect(ul.children[1]).to.equal(li2);
expect(ul.children[2]).to.equal(li3);
});
it('don\'t sort a single element', () => {
SortExecutor.execute({targets: '#ul:first-child'});
expect(ul.children[0]).to.equal(li2);
expect(ul.children[1]).to.equal(li1);
expect(ul.children[2]).to.equal(li3);
expect(ul.parentNode).to.equal($('body'));
});
it('don\'t sort zero elements', () => {
SortExecutor.execute({targets: '#ul>a'});
expect(ul.children[0]).to.equal(li2);
expect(ul.children[1]).to.equal(li1);
expect(ul.children[2]).to.equal(li3);
expect(ul.parentNode).to.equal($('body'));
});
it('Preconditions', () => {
expect(() => {SortExecutor.preconditions({})}).to.throw(BaseError);
expect(() => {SortExecutor.preconditions({targets: '#ul>a'})}).to.throw(BaseError);
});
}); | 34.188679 | 87 | 0.57947 |
0215e2d07e20d2b47f14ff82b3cf3f23c0b719a5 | 1,112 | js | JavaScript | test/form/samples/conditional-expression-paths/main.js | guybedford/rollup | fcba17ec6d5ce538dee65f745a650e812cf8df8b | [
"MIT"
] | null | null | null | test/form/samples/conditional-expression-paths/main.js | guybedford/rollup | fcba17ec6d5ce538dee65f745a650e812cf8df8b | [
"MIT"
] | null | null | null | test/form/samples/conditional-expression-paths/main.js | guybedford/rollup | fcba17ec6d5ce538dee65f745a650e812cf8df8b | [
"MIT"
] | null | null | null | var unknownValue = globalFunction();
// unknown branch without side-effects
var foo1 = { x: () => {} };
var bar1 = { x: () => {} };
var a1 = (unknownValue ? foo1 : bar1).x.y;
var b1 = (unknownValue ? foo1 : bar1).x();
foo1.x();
bar1.x();
// unknown branch with side-effect
var foo2 = { x: () => {} };
var bar2 = { x: () => console.log( 'effect' ) };
var a2 = (unknownValue ? foo2 : bar2).x.y.z;
var b2 = (unknownValue ? foo2 : bar2).x();
foo2.x();
bar2.x();
// no side-effects
var foo3 = { x: () => {}, y: {} };
var bar3 = { x: () => console.log( 'effect' ) };
var a3 = (true ? foo3 : bar3).y.z;
var b3 = (false ? bar3 : foo3).y.z;
var c3 = (true ? foo3 : bar3).x();
var d3 = (false ? bar3 : foo3).x();
var e3 = (true ? foo3 : bar3).y.z = 1;
var f3 = (false ? bar3 : foo3).y.z = 1;
// known side-effect
var foo4 = { x: () => {}, y: {} };
var bar4 = { x: () => console.log( 'effect' ) };
var a4 = (true ? bar4 : foo4).y.z;
var b4 = (false ? foo4 : bar4).y.z;
var c4 = (true ? bar4 : foo4).x();
var d4 = (false ? foo4 : bar4).x();
var e4 = (true ? bar4 : foo4).y.z = 1;
var f4 = (false ? foo4 : bar4).y.z = 1;
| 29.263158 | 48 | 0.530576 |
0216110dc2c71c3f54beaa66d7820ad4ad037c08 | 19 | js | JavaScript | crates/swc_ecma_codegen/tests/test262-min/5021396f85a70480.js | mengxy/swc | bcc3ae86ae0732979f9fbfef370ae729ba9af080 | [
"Apache-2.0"
] | 21,008 | 2017-04-01T04:06:55.000Z | 2022-03-31T23:11:05.000Z | ecmascript/codegen/tests/test262-min/5021396f85a70480.js | sventschui/swc | cd2a2777d9459ba0f67774ed8a37e2b070b51e81 | [
"Apache-2.0",
"MIT"
] | 2,309 | 2018-01-14T05:54:44.000Z | 2022-03-31T15:48:40.000Z | ecmascript/codegen/tests/test262-min/5021396f85a70480.js | sventschui/swc | cd2a2777d9459ba0f67774ed8a37e2b070b51e81 | [
"Apache-2.0",
"MIT"
] | 768 | 2018-01-14T05:15:43.000Z | 2022-03-30T11:29:42.000Z | switch(a){case 1:}
| 9.5 | 18 | 0.631579 |
02161541843ed2677831f3c1531b7629873724a0 | 4,292 | js | JavaScript | app/routes/encuestas.js | slcosentino/ar-vota | 2ff3c59596ae72f1aead5397b21feecb2faec543 | [
"MIT"
] | null | null | null | app/routes/encuestas.js | slcosentino/ar-vota | 2ff3c59596ae72f1aead5397b21feecb2faec543 | [
"MIT"
] | null | null | null | app/routes/encuestas.js | slcosentino/ar-vota | 2ff3c59596ae72f1aead5397b21feecb2faec543 | [
"MIT"
] | null | null | null | var express = require('express');
var router = express.Router();
var passport = require('passport');
var authentication = require('../middlewares/authentication');
var Encuesta = require('../models/EncuestaSchema');
var Topico = require('../models/TopicoSchema');
var EncuestaNueva = require('../models/EncuestaNuevaSchema');
var UsuarioEncuesta = require('../models/UsuarioEncuestaSchema');
router.get('/', authentication.isLoggedInAdmin, function(req, res, next) {
Encuesta.find(function(err, encuestas){
if (!err) {
res.json(encuestas);
} else {
return next(err);
}
});
});
router.post('/', authentication.isLoggedInAdmin, function(req, res, next) {
var encuesta = new Encuesta();
encuesta.topico = req.body.topico;
encuesta.titulo = req.body.titulo;
var preguntas = req.body.preguntas;
if (preguntas.length <= 0) {
res.status(401).json({message: 'Debe agregar al menos una pregunta'});
return;
}
for (var i = 0 ; i < preguntas.length ; i++) {
if (preguntas[i].respuestas.length <= 1) {
res.status(401).json({message: 'Debe agregar al menos dos respuestas'});
return;
}
}
encuesta.preguntas = preguntas;
encuesta.save(function(err) {
if (!err) {
res.json(encuesta);
} else {
res.status(401).json({message: 'Error al crear la encuesta, verifique los campos'});
}
});
});
router.get('/topicos', authentication.isLoggedInAdmin, function(req, res, next) {
Topico.find('-_id', function(err, topicos){
if (!err) {
res.json(topicos);
} else {
return next(err);
}
});
});
router.post('/nuevas', authentication.isLoggedInAdmin, function(req, res, next) {
var id_encuesta = req.body.id_encuesta;
Encuesta.findOne({_id: id_encuesta}, function(err, encuesta) {
if (err) {
res.status(400).json({message: 'No se encuentra la encuesta'});
}
var encuesta = encuesta.toObject();
var titulo = encuesta['titulo'];
var topico = encuesta['topico'];
encuestaNueva = new EncuestaNueva();
encuestaNueva.id_encuesta = id_encuesta;
encuestaNueva.titulo = titulo;
encuestaNueva.topico = topico;
encuestaNueva.save(function(err) {
if (!err) {
Encuesta.findOneAndUpdate({_id: id_encuesta}, {$set: {enviada: true}}, function(err, encuesta) {
if (!err) {
res.json(encuesta);
} else {
res.status(500).json({message: 'Intente de nuevo'});
}
});
} else {
res.status(500).json({message: 'Error al guardar encuestaNueva, intente de nuevo'});
}
});
});
});
router.get('/enviadas', authentication.isLoggedInAdmin, function(req, res, next) {
Encuesta.find({enviada: true},function(err, encuestas){
if (!err) {
res.json(encuestas);
} else {
return next(err);
}
});
});
router.get('/:id_encuesta', authentication.isLoggedInAdmin, function(req, res, next) {
var id_encuesta = req.params.id_encuesta;
Encuesta.findOne({_id: id_encuesta},'-__v', function(err, encuesta) {
if (!err) {
var encuestaObject = encuesta.toObject();
UsuarioEncuesta.count({id_encuesta: id_encuesta}, function(err, total) {
if (!err){
encuestaObject.total = total;
res.json(encuestaObject);
} else {
res.status(500).json({message: 'Intente de nuevo'});
}
});
} else {
res.status(400).json({message: 'No se encuentra la encuesta'});
}
});
});
router.put('/:id_encuesta', authentication.isLoggedInAdmin, function(req, res, next) {
var id_encuesta = req.params.id_encuesta;
var preguntas = req.body.preguntas;
if (preguntas.length <= 0) {
res.status(401).json({message: 'Debe agregar al menos una pregunta'});
return;
}
for (var i = 0 ; i < preguntas.length ; i++) {
if (preguntas[i].respuestas.length <= 1) {
res.status(401).json({message: 'Debe agregar al menos dos respuestas'});
return;
}
}
encuesta.preguntas = preguntas;
Encuesta.findOneAndUpdate({_id: id_encuesta}, req.body, function(err, encuesta) {
if (!err) {
res.json(encuesta);
} else {
res.status(400).json({message: 'No se pudo actualizar la encuesta'});
}
});
});
module.exports = router;
| 27.87013 | 105 | 0.626048 |
02162370c13f61738c70a18a26b3f92f76f417b5 | 1,092 | js | JavaScript | es6/directives/disable-form.js | CWSpear/angular-common | cabc59aaa3644782c7f2256e5978b629e46c8320 | [
"MIT"
] | null | null | null | es6/directives/disable-form.js | CWSpear/angular-common | cabc59aaa3644782c7f2256e5978b629e46c8320 | [
"MIT"
] | null | null | null | es6/directives/disable-form.js | CWSpear/angular-common | cabc59aaa3644782c7f2256e5978b629e46c8320 | [
"MIT"
] | null | null | null | (function () {
'use strict';
angular
.module('CWSpearCommon')
.directive('disableForm', disableForm);
function disableForm() {
var directive = {
link: linkFn
};
return directive;
function linkFn(scope, elem, attrs) {
var disabled = scope.$eval(attrs.disableForm);
disable(disabled);
scope.$watch(attrs.disableForm, (val, oldVal) => {
if (val == oldVal) return;
disable(val);
});
scope.$watch(() => _.keys(((elem || [])[0] || {}).elements || []).join(''), (val, oldVal) => {
if (val == oldVal) return;
disable(disabled);
});
function disable(disabled) {
_.each(elem[0].elements, element => {
// let elements with their own ng-disabled override this directive
if (!element.attributes['ng-disabled'])
element.disabled = disabled;
});
}
}
}
})();
| 26.634146 | 106 | 0.456044 |
021626ddcc3af30adb145466f04c735b054b9ef8 | 5,489 | js | JavaScript | assets/js/39.803871e2.js | webchenjie/webchenjie.github.io | 14441922a74f8627a26a0c4d29ddf33bebe2378d | [
"MIT"
] | 2 | 2020-06-22T08:12:40.000Z | 2020-07-04T05:18:15.000Z | assets/js/39.803871e2.js | webchenjie/webchenjie.github.io | 14441922a74f8627a26a0c4d29ddf33bebe2378d | [
"MIT"
] | null | null | null | assets/js/39.803871e2.js | webchenjie/webchenjie.github.io | 14441922a74f8627a26a0c4d29ddf33bebe2378d | [
"MIT"
] | null | null | null | (window.webpackJsonp=window.webpackJsonp||[]).push([[39],{549:function(e,s,a){"use strict";a.r(s);var n=a(3),t=Object(n.a)({},(function(){var e=this,s=e.$createElement,a=e._self._c||s;return a("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[a("h2",{attrs:{id:"nodejs-ๆฏไปไน"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#nodejs-ๆฏไปไน"}},[e._v("#")]),e._v(" nodejs ๆฏไปไน๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. nodejs ๆฏๅบไบ Chrome V8 ๅผๆ็ javascript ่ฟ่กๆถ\n2. nodejs ๅบ็ฐไนๅ๏ผjs ๅช่ฝๅจๆต่งๅจ่ฟ่ก\n3. nodejs ๅบ็ฐไนๅ๏ผjs ๅฏไปฅๅจไปปไฝๅฎ่ฃ
nodejs ็็ฏๅข่ฟ่ก\n")])])]),a("h2",{attrs:{id:"nodejs-ๅๅ็ซฏ-js-็ๅบๅซๆฏไปไน"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#nodejs-ๅๅ็ซฏ-js-็ๅบๅซๆฏไปไน"}},[e._v("#")]),e._v(" nodejs ๅๅ็ซฏ js ็ๅบๅซๆฏไปไน๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. ่ฏญๆณ\n ้ฝๆฏไฝฟ็จ ES ่ฏญๆณ\n ๅ็ซฏ js ไฝฟ็จ web API๏ผๅฆ DOMใBOM ็ญ\n nodejs ไฝฟ็จ node API๏ผๅฆ httpใquerystring ็ญ\n2. ๅบ็จ\n ๅ็ซฏ js ็จไบ็ฝ้กต๏ผๅจๆต่งๅจ่ฟ่ก\n nodejs ๅฏ็จไบๆๅก็ซฏ๏ผๅฆๅผๅ web server\n nodejs ไนๅฏ็จไบๆฌๆบ๏ผๅฆ webpack ็ญๆฌๆบ็ๅทฅๅ
ท\n")])])]),a("h2",{attrs:{id:"nodejs-ๅฆไฝ่ฐ่ฏ"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#nodejs-ๅฆไฝ่ฐ่ฏ"}},[e._v("#")]),e._v(" nodejs ๅฆไฝ่ฐ่ฏ๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. ๅฏๅจ nodejs ๆๅกๆถ๏ผไฝฟ็จ inspect๏ผๅฆ node --inspect-brk index.js\n2. ไปฃ็ ไธญไฝฟ็จ debugger ๆญ็น\n3. ไฝฟ็จ chrome ่ฐ่ฏ๏ผchrome://inspect\n")])])]),a("h2",{attrs:{id:"ๅฆไฝ่ทๅๅฝๅๆไปถๅๅฝๅ็ฎๅฝ็่ทฏๅพ"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#ๅฆไฝ่ทๅๅฝๅๆไปถๅๅฝๅ็ฎๅฝ็่ทฏๅพ"}},[e._v("#")]),e._v(" ๅฆไฝ่ทๅๅฝๅๆไปถๅๅฝๅ็ฎๅฝ็่ทฏๅพ๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. __filename\n2. __dirname\n3. ไธคไธช้ฝๆฏๅ
จๅฑๅ้\n")])])]),a("h2",{attrs:{id:"commonjs-ๅ-es6-module-็ๅบๅซ"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#commonjs-ๅ-es6-module-็ๅบๅซ"}},[e._v("#")]),e._v(" commonjs ๅ ES6 Module ็ๅบๅซ๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. ่ฏญๆณไธๅ\n2. commonjs ๆฏๅจๆๅผๅ
ฅ๏ผๆง่กๆถๅผๅ
ฅ\n3. ES6 Module ๆฏ้ๆๅผๅ
ฅ๏ผ็ผ่ฏๆถๅผๅ
ฅ๏ผ้่ฆๆพๅจๆๅคๅฑ้กถ้จๅผๅ
ฅ๏ผwebpack tree shaking ๅชๆฏๆ ES6 Module\n")])])]),a("h2",{attrs:{id:"path-resolve-ๅ-path-join-็ๅบๅซ"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#path-resolve-ๅ-path-join-็ๅบๅซ"}},[e._v("#")]),e._v(" path.resolve ๅ path.join ็ๅบๅซ๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. ไธค่
้ฝๆฏ็จไบๆผๆฅๆไปถ่ทฏๅพ\n2. path.resolve ่ทๅ็ปๅฏน่ทฏๅพ\n3. path.join ่ทๅ็ธๅฏน่ทฏๅพๆๆผๆฅ่ทฏๅพ\n")])])]),a("h2",{attrs:{id:"event-loop-ๅจๆต่งๅจๅ-nodejs-ไธญ็ๅบๅซ"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#event-loop-ๅจๆต่งๅจๅ-nodejs-ไธญ็ๅบๅซ"}},[e._v("#")]),e._v(" event loop ๅจๆต่งๅจๅ nodejs ไธญ็ๅบๅซ๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. ๆต่งๅจ js ็ๅผๆญฅ\n 1. ๅฎไปปๅก๏ผsetTimeoutใsetIntervalใajax ็ญ\n 2. ๅพฎไปปๅก๏ผpromiseใasync/await\n 3. ๅพฎไปปๅกๆฏๅฎไปปๅกๆดๆฉๆง่ก\n2. ๆต่งๅจ็ event loop\n 1. call stack ็ฉบ้ฒๆถ๏ผๅฐ่งฆๅ event loop ๆบๅถ๏ผๆง่กๅฎไปปๅก\n 2. ่่งฆๅ event loop ไนๅ๏ผไผๆ็ฐๆ็ๅพฎไปปๅก้ฝๆง่กๅฎ\n 3. ๆไปฅๅพฎไปปๅกๆฏๅฎไปปๅกๆง่กๆถๆบๆดๆฉ\n3. nodejs ็ๅผๆญฅ\n 1. ๅฎไปปๅก๏ผsetTimeoutใsetIntervalใsetImmediateใI/O ๆไปถใ็ฝ็ปใsocket ่ฟๆฅ๏ผๅฆ่ฟๆฅ mysql\n 2. ๅพฎไปปๅก๏ผpromiseใasync/awaitใprocess.nextTick\n4. nodejs ็ event loop\n 1. ๅ ไธบ nodejs ไธญ็ๅพฎไปปๅกไธๅค๏ผๅฎไปปๅก็ฑปๅ่พๅค๏ผๅฆๆๅฎไปปๅก้ฝๆพๅจ callback queue ไธญๅฐฑไธๅฅฝ็ฎก็\n 2. nodejs ไบไปถๅพช็ฏ็ๅไธบ 6 ไธช้ถๆฎต๏ผๅฎไปปๅก๏ผ\n 1. timer โโ> I/O โโ> idle๏ผprepare โโ> poll โโ> check โโ> close callback\n 2. timer๏ผๆง่ก setTimeout ไปฅๅ setInterval ็ๅ่ฐ\n 3. I/O๏ผcallback ๅค็็ฝ็ปใๆตใTCP ็้่ฏฏๅ่ฐ\n 4. idle๏ผprepare๏ผ้ฒ็ฝฎ้ถๆฎต๏ผnode ๅ
้จไฝฟ็จ\n 5. poll๏ผๆง่ก poll ไธญ็ I/O ้ๅ๏ผๆฃๆฅๅฎๆถๅจๆฏๅฆๅฐๆถ้ด\n 6. check๏ผๅญๆพ setImmediate ๅ่ฐ\n 7. close callback๏ผๅ
ณ้ญๅ่ฐ๏ผไพๅฆ socket.on('close')\n 3. ๅๅไธ่ฟๆฏๅ
ๆง่กๅพฎไฟกไปปๅกๅๆง่กๅฎไปปๅก๏ผ่ๅฎไปปๅก็ๆง่ก้กบๅบ้่ฟไธ้ข็ 6 ไธช้ถๆฎตๆง่ก\n 4. ๅพฎไปปๅกไธญ๏ผprocess.nextTick ไผๅ
็บงๆ้ซ๏ผๆๆฉ่ขซๆง่ก ๏ผprocess.nextTick ็ฐๅทฒไธๆจ่ไฝฟ็จ๏ผๅ ไธบไผ้ปๅก IO๏ผ\n 5. ็ป่\n 1. setTimeout ๆฏ setImmediate ๆง่กๆดๆฉ\n 2. process.nextTick ๆฏ promise.then ๆง่กๆดๆฉ\n 3. ๅปบ่ฎฎ็จ setImmediate ไปฃๆฟ process.nextTick\n 6. ๅบๅซ\n 1. nodejs ๅผๆญฅ API ๆดๅค๏ผๅฎไปปๅก็ฑปๅไนๆดๅค\n 2. nodejs ็ event loop ๅไธบ 6 ไธช้ถๆฎต๏ผ่ฆๆ็
ง้กบๅบๆง่ก\n 3. ๅพฎไปปๅกไธญ process.nextTick ไผๅ
็บงๆด้ซ\n")])])]),a("h2",{attrs:{id:"session-ๅฆไฝๅฎ็ฐ็ปๅฝ"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#session-ๅฆไฝๅฎ็ฐ็ปๅฝ"}},[e._v("#")]),e._v(" session ๅฆไฝๅฎ็ฐ็ปๅฝ๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. cookie ๅฆไฝๅฎ็ฐ็ปๅฝๆ ก้ช\n 1. ๅ็ซฏ็ปๅฝๆๅๅ๏ผๆๅก็ซฏไผ่ฎพ็ฝฎ cookie๏ผๅฝๅ็ซฏ่ฟ่กๅ
ถไปๆไฝๆถไผๅธฆไธ cookie๏ผๆๅก็ซฏ่ฟ่กๆ ก้ช\n2. session ๅ cookie ็ๅ
ณ็ณป\n 1. ๅฝๅจ cookie ไธญๅญๅจๆๆไฟกๆฏๆถไผไธๅฎๅ
จ๏ผๅๆขๆๅญๅจ userId๏ผๅฏนๅบๅฐๆๅก็ซฏๅๆฏ็จๆทไฟกๆฏ\n3. session ไธบไฝ้่ฆๅญๅจๅจ redis ไธญ\n 1. ่ฟ็จๆๅ
ๅญ้ๅถ\n 2. ่ฟ็จ็ๅ
ๅญๆฏ็ธไบ้็ฆป็\n 3. ๅญๅจๅฐ redis ไธญ๏ผๅฏ่งฃๅณ่ฟไบ้ฎ้ข\n")])])]),a("h2",{attrs:{id:"ๆ่ฟฐ-koa2-ๅ-express-็ไธญ้ดไปถๆบๅถ"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#ๆ่ฟฐ-koa2-ๅ-express-็ไธญ้ดไปถๆบๅถ"}},[e._v("#")]),e._v(" ๆ่ฟฐ koa2 ๅ express ็ไธญ้ดไปถๆบๅถ๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. ไปไปฃ็ ๆฅ็๏ผไธญ้ดไปถๅฐฑๆฏไธไธชๅฝๆฐ\n2. ไปไธๅกๆฅ็๏ผไธญ้ดไปถๅๆฏไธไธช็ฌ็ซ็ๆจกๅ\n3. ๆจกๅๆๅ๏ผๆจกๅๆต่ฝฌ๏ผๅณๅฏๅฎๆๅคๆ็ๅ่ฝ\n")])])]),a("h2",{attrs:{id:"nodejs-ๅฆไฝ่ฏปๅๅคงๆไปถ"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#nodejs-ๅฆไฝ่ฏปๅๅคงๆไปถ"}},[e._v("#")]),e._v(" nodejs ๅฆไฝ่ฏปๅๅคงๆไปถ๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. stream โโ ๆต\n2. 1G ๅคงๅฐ็ access.log\n3. ๅๆๅ
ถไธญ็ Chrome ๆต่งๅจๅ ๆฏ\n4. ่่ cpu ๅๅ
ๅญ็้ๅถ\n")])])]),a("h2",{attrs:{id:"nodejs-็บฟไธไธบไฝๅผๅฏๅค่ฟ็จ-pm2"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#nodejs-็บฟไธไธบไฝๅผๅฏๅค่ฟ็จ-pm2"}},[e._v("#")]),e._v(" nodejs ็บฟไธไธบไฝๅผๅฏๅค่ฟ็จ๏ผ๏ผpm2๏ผ")]),e._v(" "),a("div",{staticClass:"language- extra-class"},[a("pre",[a("code",[e._v("1. ้ซๆไฝฟ็จๅคๆ ธ CPU\n2. ๅ
ๅๅฉ็จๆๅกๅจๅ
ๅญ\n3. ๆ็ป๏ผๅๆฆจๆๅกๅจ๏ผไธๆตช่ดน่ตๆบ\n")])])]),a("div",{staticClass:"custom-block tip"},[a("p",[e._v("ไฝ่
๏ผchenjie "),a("br"),e._v("\n้พๆฅ๏ผhttps://webchenjie.cn "),a("br"),e._v("\nๆฅๆบ๏ผChenJieBlog")])])])}),[],!1,null,null,null);s.default=t.exports}}]); | 5,489 | 5,489 | 0.65859 |
0217c4d8a44cf6c813da712ec87c27f685844bb0 | 1,936 | js | JavaScript | commands/botinfo.js | Purgador/walterio | e937df6ff0395dfffaa69c7e137d519b0cdafdca | [
"MIT"
] | null | null | null | commands/botinfo.js | Purgador/walterio | e937df6ff0395dfffaa69c7e137d519b0cdafdca | [
"MIT"
] | null | null | null | commands/botinfo.js | Purgador/walterio | e937df6ff0395dfffaa69c7e137d519b0cdafdca | [
"MIT"
] | 1 | 2020-10-23T05:02:42.000Z | 2020-10-23T05:02:42.000Z | const moment = require("moment");
require('moment-duration-format');
module.exports = async (client, message, args, ops) => {
const actividad = moment.duration(client.uptime).format(" D [d], H [hrs], m [m], s [s]"),
servers = client.guilds.cache.size,
lang = ops.lang.commands.botinfo,
users = client.users.cache.size,
canales = client.channels.cache.size,
voz = client.voice.connections.size,
emojis = client.emojis.cache.size,
version = require('../package.json').version,
discordjs = require('discord.js').version,
cpu = `${Math.round(process.cpuUsage().user / 1024 / 1024)}%`,
memory = `${Math.round((process.memoryUsage().heapUsed / 1024 / 1024).toString().slice(0,6))} MB`,
invite = await client.generateInvite(["ADMINISTRATOR"]),
main = new ops.Discord.MessageEmbed()
.setAuthor(client.user.username, client.user.displayAvatarURL({dynamic:true}))
.addField('โ๏ธ ' + lang.statistics, `>>> **EL RISAS, OswaldoYT** ${lang.owner}\n**${servers.toLocaleString()}** ${lang.guilds}\n**${users.toLocaleString()}** ${lang.users}\n**${canales.toLocaleString()}** ${lang.channels}\n**${emojis.toLocaleString()}** Emojis\n**${client.comandos.size.toLocaleString()}** ${lang.commands}\n**${client.eventos.size.toLocaleString()}** ${lang.events}\n**${actividad}** ${lang.uptime}\n**${Math.round(message.client.ws.ping)}ms** Ping\n**${voz}** ${lang.connections.toLocaleString()}\n**${version}** ${lang.version}\n**${discordjs}** Discord.JS\n**${ops.prefix}** Prefix\n**${memory}** ${lang.usage}\n**${cpu}** CPU`, true)
.addField('๐ง LINKS', `>>> [Invite](${invite})\n[Discord](https://invite.gg/bahiano)`, true)
.setColor(0x00ffff)
.setFooter(ops.lang.events.message.isMentioned.footer + require("../package.json").version, client.user.displayAvatarURL({dynamic:true}))
.setTimestamp()
message.channel.send(main)
}
| 66.758621 | 662 | 0.64876 |
021803bebb3b91ef0f90fcee9dda2bc5ed4855ea | 5,749 | js | JavaScript | utils/testSetup.js | vaporyorg/safe-react-e2e-tests | d501db3c23f2b85c284fc795740bae57d41ad042 | [
"Unlicense"
] | 2 | 2021-09-07T15:51:56.000Z | 2022-02-07T16:37:27.000Z | utils/testSetup.js | vaporyorg/safe-react-e2e-tests | d501db3c23f2b85c284fc795740bae57d41ad042 | [
"Unlicense"
] | 2 | 2021-03-18T11:26:36.000Z | 2021-03-18T11:26:36.000Z | utils/testSetup.js | vaporyorg/safe-react-e2e-tests | d501db3c23f2b85c284fc795740bae57d41ad042 | [
"Unlicense"
] | 1 | 2020-09-02T15:23:41.000Z | 2020-09-02T15:23:41.000Z | import puppeteer from 'puppeteer'
import * as dappeteer from '@dasanra/dappeteer'
import config from './config'
import { accountsSelectors } from './selectors/accounts'
import { topBar } from './selectors/topBar'
import { homePage } from './selectors/welcomePage'
import { loadSafeForm } from './selectors/loadSafeForm'
import * as gFunc from './selectorsHelpers'
import { assertElementPresent, clearInput, clickAndType, clickByText, clickElement } from './selectorsHelpers'
const TESTING_ENV = process.env.TESTING_ENV || 'dev'
const { SLOWMO, ENVIRONMENT } = config
let envUrl
if (TESTING_ENV === 'PR') {
const pullRequestNumber = process.env.PR
if (!pullRequestNumber) {
throw Error('You have to define PR env variable')
}
envUrl = ENVIRONMENT[TESTING_ENV.toUpperCase()](pullRequestNumber)
} else {
envUrl = ENVIRONMENT[TESTING_ENV.toLowerCase()]
}
export const init = async () => {
const browser = await dappeteer.launch(puppeteer, {
defaultViewport: null, // this extends the page to the size of the browser
slowMo: SLOWMO, // Miliseconds it will wait for every action performed. It's 1 by default. change it in the .env file
args: ['--start-maximized', envUrl] // maximized browser, URL for the base page
})
const metamask = await dappeteer.getMetamask(browser, {
seed: accountsSelectors.wallet.seed,
password: accountsSelectors.wallet.password
})
await metamask.switchNetwork('rinkeby')
const [gnosisPage, MMpage] = await browser.pages() // get a grip on both tabs
// Reload Gnosis Safe to ensure Metamask info is loaded
await gnosisPage.reload({ waitUntil: ['networkidle0', 'domcontentloaded'] })
gnosisPage.setDefaultTimeout(60000)
MMpage.setDefaultTimeout(60000)
return [
browser,
metamask,
gnosisPage,
MMpage
]
}
/**
* This function returns a clean environment with one wallet already connected to Safe Multisig
*
* @param {boolean} importMultipleAccounts by default is false so only 1 accounts is imported to Metamask
* if more than one account is needed this parameter should be used with `true`
*/
export const initWithWalletConnected = async (importMultipleAccounts = false) => {
const [browser, metamask, gnosisPage, MMpage] = await init()
if (importMultipleAccounts) {
await gFunc.importAccounts(metamask)
await MMpage.waitForTimeout(1000)
}
await gnosisPage.bringToFront()
// if (ENV !== ENVIRONMENT.local) { // for local env there is no Cookies to accept
await clickElement(homePage.accept_cookies, gnosisPage)
// }
await clickElement(topBar.not_connected_network, gnosisPage)
await clickElement(topBar.connect_btn, gnosisPage)
await clickElement(homePage.metamask_option, gnosisPage) // Clicking the MM icon in the onboardjs
// FIXME remove MMpage.reload() when updated version of dappeteer
await MMpage.reload()
// --- end of FIXME
await metamask.approve({ allAccounts: true })
await gnosisPage.bringToFront()
await assertElementPresent(topBar.connected_network.selector, gnosisPage, 'css')
return [
browser,
metamask,
gnosisPage,
MMpage,
]
}
/**
* This method returns a clean environment with a connected account and one imported Safe Multisig wallet.
* With default configuration the connected account is an owner of the Safe
*
* @param {boolean} importMultipleAccounts by default is false so only 1 accounts is imported to Metamask
* if more than one account is needed this parameter should be used with `true`
*/
export const initWithDefaultSafe = async (importMultipleAccounts = false) => {
const [browser, metamask, gnosisPage, MMpage] = await initWithWalletConnected(importMultipleAccounts)
// Open load safe form
await clickByText('p', 'Load existing Safe', gnosisPage)
await assertElementPresent(loadSafeForm.form.selector, gnosisPage, 'css')
await clickAndType(loadSafeForm.safe_name_field, gnosisPage, accountsSelectors.safeNames.load_safe_name)
await clickAndType(loadSafeForm.safe_address_field, gnosisPage, accountsSelectors.testAccountsHash.safe1)
await clickElement(loadSafeForm.submit_btn, gnosisPage)
// Second step, review owners
await assertElementPresent(loadSafeForm.step_two.selector, gnosisPage, 'css')
const keys = Object.keys(accountsSelectors.accountNames)
for (let i = 0; i < 2/* keys.length */; i++) { // only names on the first 2 owners
const selector = loadSafeForm.owner_name(i)
const name = accountsSelectors.accountNames[keys[i]]
await clearInput(selector, gnosisPage, 'css')
await clickAndType({ selector: selector, type: 'css' }, gnosisPage, name)
}
await clickElement(loadSafeForm.submit_btn, gnosisPage)
// Third step, review information and submit
await assertElementPresent(loadSafeForm.step_three.selector, gnosisPage, 'css')
await gnosisPage.waitForTimeout(2000)
await clickElement(loadSafeForm.submit_btn, gnosisPage)
return [
browser,
metamask,
gnosisPage,
MMpage,
]
}
/**
* This method returns a clean environment with a connected account and one imported Safe Multisig wallet.
* With default configuration the connected account is an owner of the Safe
*
* @param {boolean} importMultipleAccounts by default is false so only 1 accounts is imported to Metamask
* if more than one account is needed this parameter should be used with `true`
*/
export const initWithDefaultSafeDirectNavigation = async (importMultipleAccounts = false) => {
const [browser, metamask, gnosisPage, MMpage] = await initWithWalletConnected(importMultipleAccounts)
await gnosisPage.goto(envUrl + '#/safes/' + accountsSelectors.testAccountsHash.safe1)
await gnosisPage.waitForTimeout(2000)
return [
browser,
metamask,
gnosisPage,
MMpage,
]
}
| 37.575163 | 121 | 0.750739 |
021833871897edb320c66a56507e6268d7940e62 | 7,242 | js | JavaScript | public/blog/wp-content/plugins/smart-slider-3/nextend/media/dist/nextend-litebox.min.js | Kanuj910/SaveOnCoupon | 4bc5fa46df686377bb8f71ac36c772f9c29ef40b | [
"MIT"
] | null | null | null | public/blog/wp-content/plugins/smart-slider-3/nextend/media/dist/nextend-litebox.min.js | Kanuj910/SaveOnCoupon | 4bc5fa46df686377bb8f71ac36c772f9c29ef40b | [
"MIT"
] | null | null | null | public/blog/wp-content/plugins/smart-slider-3/nextend/media/dist/nextend-litebox.min.js | Kanuj910/SaveOnCoupon | 4bc5fa46df686377bb8f71ac36c772f9c29ef40b | [
"MIT"
] | 1 | 2021-08-28T08:04:55.000Z | 2021-08-28T08:04:55.000Z | !function(t,e,o,i){function n(){return null!=navigator.userAgent.match(/iPhone/i)||null!=navigator.userAgent.match(/iPod/i)}function l(){return null!=navigator.userAgent.match(/iPad/i)&&!n()}function a(e,o){this.element=e,this.$element=t(this.element),this.options=t.extend({},p,o),this._defaults=p,this._name=c,this.init()}function s(){return e.innerHeight?e.innerHeight:t(e).height()}function r(e){t(e).each(function(){var e=new Image;e.src=this,e.width>0&&t("<img />").attr("src",this).addClass("litebox-preload").appendTo("body").hide()})}var c="liteBox",p={revealSpeed:400,background:"rgba(0,0,0,.8)",overlayClose:!0,escKey:!0,navKey:!0,closeTip:"tip-l-fade",closeTipText:"Close",prevTip:"tip-t-fade",prevTipText:"Previous",nextTip:"tip-t-fade",nextTipText:"Next",autoplay:!1,callbackInit:function(){},callbackBeforeOpen:function(){},callbackAfterOpen:function(){},callbackBeforeClose:function(){},callbackAfterClose:function(){},callbackError:function(){},callbackPrev:function(){},callbackNext:function(){},errorMessage:"Error loading content."};a.prototype={init:function(){var t=this,e=!1;this.$element.on("click n2click",function(o){nextend.shouldPreventClick||e===!1&&(o.preventDefault(),t.openLitebox(),e=setTimeout(function(){e=!1},300))}),this.options.callbackInit.call(this)},openLitebox:function(){var e=this;this.options.callbackBeforeOpen.call(this),e.buildLitebox();var o=this.$element;if(e.populateLitebox(o),e.options.overlayClose&&$litebox.on("click",function(o){(o.target===this||t(o.target).hasClass("litebox-container")||t(o.target).hasClass("litebox-error"))&&e.closeLitebox()}),$close.on("click",function(){e.closeLitebox()}),this.$element.attr("data-litebox-group")){var e=this,i=this.$element.attr("data-litebox-group"),a=t('[data-litebox-group="'+this.$element.attr("data-litebox-group")+'"]'),s=[];t('[data-litebox-group="'+i+'"]').each(function(){var e=t(this).attr("href")||t(this).data("href");s.push(e)}),r(s),t(".litebox-nav").show(),$prevNav.off("click").on("click",function(){e.options.callbackPrev.call(this);var i=a.index(o);o=a.eq(i-1),t(o).length||(o=a.last()),e.populateLitebox(o)}),$nextNav.off("click").on("click",function(){e.options.callbackNext.call(this);var i=a.index(o);o=a.eq(i+1),t(o).length||(o=a.first()),e.populateLitebox(o),e.startAutoplay()})}var c=27,p=37,d=39;t("body").on("keydown.litebox",function(o){e.options.escKey&&o.keyCode==c&&(o.stopImmediatePropagation(),e.closeLitebox()),e.options.navKey&&o.keyCode==p&&(o.stopImmediatePropagation(),t(".litebox-prev").trigger("click")),e.options.navKey&&o.keyCode==d&&(o.stopImmediatePropagation(),t(".litebox-next").trigger("click"))}),this.startAutoplay(),this.options.callbackAfterOpen.call(this),(l()||n())&&t(".litebox-container").addClass("litebox-iframe-holder")},startAutoplay:function(){if(this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.options.autoplay){this.timeout=setTimeout(function(){t(".litebox-next").trigger("click")},this.options.autoplay)}},buildLitebox:function(){$litebox=t("<div>",{"class":"litebox-overlay"}),$close=t("<div>",{"class":"litebox-close "+this.options.closeTip,"data-tooltip":this.options.closeTipText}),$text=t("<div>",{"class":"litebox-text"}),$error=t('<div class="litebox-error"><span>'+this.options.errorMessage+"</span></div>"),$prevNav=t("<div>",{"class":"litebox-nav litebox-prev "+this.options.prevTip,"data-tooltip":this.options.prevTipText}),$nextNav=t("<div>",{"class":"litebox-nav litebox-next "+this.options.nextTip,"data-tooltip":this.options.nextTipText}),$container=t("<div>",{"class":"litebox-container"}),$loader=t("<div>",{"class":"litebox-loader"}),t(o.fullscreenElement||o.msFullscreenElement||o.mozFullScreenElement||o.webkitFullscreenElement||o.body).prepend($litebox.css({"background-color":this.options.background})),$litebox.append($close,$text,$prevNav,$nextNav,$container),$litebox.fadeIn(this.options.revealSpeed)},populateLitebox:function(e){var o=this,i=e.attr("href")||e.data("href"),n=t(".litebox-content");this.options.autoplay=e.data("autoplay")||this.options.autoplay,$litebox.append($loader);var l=e.data("title");if("undefined"==typeof l||""==l)t(".litebox-text").removeClass("active"),t(".litebox-text").html();else{l="<b>"+l+"</b>";var a=e.data("description");"undefined"!=typeof a&&""!=a&&(l+=" - "+a),t(".litebox-text").html(l),t(".litebox-text").addClass("active")}if(null!==i.match(/\.(jpeg|jpg|gif|png|bmp)/i)){var s=t("<img>",{src:i,"class":"litebox-content"});o.transitionContent("image",n,s),t("img.litebox-content").n2imagesLoaded(function(){$loader.remove()}),s.error(function(){o.liteboxError(),$loader.remove()})}else if(videoURL=i.match(/(youtube|youtu|vimeo|dailymotion|kickstarter)\.(com|be)\/((watch\?v=([-\w]+))|(video\/([-\w]+))|(projects\/([-\w]+)\/([-\w]+))|([-\w]+))/)){var r="";if("youtube"==videoURL[1]&&(r="https://www.youtube.com/embed/"+videoURL[5]+"?fs=1&wmode=opaque&autoplay=1;rel=0"),"youtu"==videoURL[1]&&(r="https://www.youtube.com/embed/"+videoURL[3]+"?fs=1&wmode=opaque&autoplay=1;rel=0"),"vimeo"==videoURL[1]&&(r="https://player.vimeo.com/video/"+videoURL[3]+"?autoplay=1"),"dailymotion"==videoURL[1]&&(r="https://www.dailymotion.com/embed/video/"+videoURL[7]),"kickstarter"==videoURL[1]&&(r="https://www.kickstarter.com/projects/"+videoURL[9]+"/"+videoURL[10]+"/widget/video.html"),r){var c=t("<iframe>",{frameborder:"0",vspace:"0",hspace:"0",scrolling:"no",allowfullscreen:"","class":"litebox-content",style:"background: #000",seamless:"seamless"});o.transitionContent("embed",n,c),c.attr("src",r),c.load(function(){$loader.remove()})}}else if("#"==i.substring(0,1))t(i).length?($html=t("<div>",{"class":"litebox-content litebox-inline-html"}),$html.append(t(i).clone()),o.transitionContent("inline",n,$html)):o.liteboxError(),$loader.remove();else{var c=t("<iframe>",{src:i,frameborder:"0",vspace:"0",hspace:"0",scrolling:"auto","class":"litebox-content",allowfullscreen:""});o.transitionContent("iframe",n,c),c.load(function(){$loader.remove()})}},transitionContent:function(o,i,n){var l=this;"inline"!=o&&$container.removeClass("litebox-scroll"),i.remove(),$container.append(n),"inline"==o&&$container.addClass("litebox-scroll"),l.centerContent(),t(e).on("resize",function(){l.centerContent()})},centerContent:function(){$litebox.css({height:s()}),$container.css({"line-height":$container.height()+"px"}),"undefined"!=typeof $html&&t(".litebox-inline-html").outerHeight()<$container.height()&&t(".litebox-inline-html").css({"margin-top":"-"+t(".litebox-inline-html").outerHeight()/2+"px",top:"50%"})},closeLitebox:function(){this.options.callbackBeforeClose.call(this),this.timeout&&(clearTimeout(this.timeout),this.timeout=null),$litebox.fadeOut(this.options.revealSpeed,function(){t(".litebox-nav").hide(),$litebox.empty().remove(),t(".litebox-preload").remove()}),t(".tipsy").fadeOut(this.options.revealSpeed,function(){t(this).remove()}),t(".litebox-prev").off("click"),t(".litebox-next").off("click"),t("body").off(".litebox"),this.options.callbackAfterClose.call(this)},liteboxError:function(){this.options.callbackError.call(this),$container.append($error)}},t.fn[c]=function(e){return this.each(function(){t.data(this,c)||t.data(this,c,new a(this,e))})}}(n2,window,document); | 7,242 | 7,242 | 0.709058 |
0219c4150ebbf88fdda88de67eca6af8c3895bf9 | 618 | js | JavaScript | app/assets/javascripts/clusters/agents/graphql/cache_update.js | manuelruicosta/gitlabhq | c05f1d2fbb29328134808cab61bffc55e0ad53da | [
"MIT"
] | null | null | null | app/assets/javascripts/clusters/agents/graphql/cache_update.js | manuelruicosta/gitlabhq | c05f1d2fbb29328134808cab61bffc55e0ad53da | [
"MIT"
] | null | null | null | app/assets/javascripts/clusters/agents/graphql/cache_update.js | manuelruicosta/gitlabhq | c05f1d2fbb29328134808cab61bffc55e0ad53da | [
"MIT"
] | null | null | null | import produce from 'immer';
export const hasErrors = ({ errors = [] }) => errors?.length;
export function addAgentTokenToStore(store, clusterAgentTokenCreate, query, variables) {
if (!hasErrors(clusterAgentTokenCreate)) {
const { token } = clusterAgentTokenCreate;
const sourceData = store.readQuery({
query,
variables,
});
const data = produce(sourceData, (draftData) => {
draftData.project.clusterAgent.tokens.nodes.unshift(token);
draftData.project.clusterAgent.tokens.count += 1;
});
store.writeQuery({
query,
variables,
data,
});
}
}
| 24.72 | 88 | 0.65534 |
021a265c373bc7625b19d634726386cc301808ff | 891 | js | JavaScript | JS-Advanced/Syntax-Functions-and-Statements/Exercise/roadRadar.js | Aykut5645/Software-University | 1990afd1d09c60b043c9771c516bc314c4922736 | [
"MIT"
] | null | null | null | JS-Advanced/Syntax-Functions-and-Statements/Exercise/roadRadar.js | Aykut5645/Software-University | 1990afd1d09c60b043c9771c516bc314c4922736 | [
"MIT"
] | null | null | null | JS-Advanced/Syntax-Functions-and-Statements/Exercise/roadRadar.js | Aykut5645/Software-University | 1990afd1d09c60b043c9771c516bc314c4922736 | [
"MIT"
] | null | null | null | function foo(speed, roadType) {
//speed = Number(speed);
let speedLimits = {
residential: 20,
city: 50,
interstate: 90,
motorway: 130
};
if (speedLimits[roadType] < speed) {
return speed - speedLimits[roadType] <= 20
? `The speed is ${speed - speedLimits[roadType]} km/h faster than the allowed speed of ${speedLimits[roadType]} - speeding`
: speed - speedLimits[roadType] <= 40
? `The speed is ${speed - speedLimits[roadType]} km/h faster than the allowed speed of ${speedLimits[roadType]} - excessive speeding`
: `The speed is ${speed - speedLimits[roadType]} km/h faster than the allowed speed of ${speedLimits[roadType]} - reckless driving`;
} else {
return `Driving ${speed} km/h in a ${speedLimits[roadType]} zone`;
}
}
console.log(
foo(40, 'city')
); | 38.73913 | 149 | 0.604938 |
021aa4fb6a7d67ca288de57ffd7dc74e45a6fafa | 1,827 | js | JavaScript | build/engine/modules/mouse.js | Alcom1/Operation-Recycling-Bin | 77cec50bcbb34103a1c0a5744d989773a9e82712 | [
"MIT"
] | 2 | 2020-10-17T23:29:07.000Z | 2020-12-28T15:21:15.000Z | build/engine/modules/mouse.js | Alcom1/Operation-Recycling-Bin | 77cec50bcbb34103a1c0a5744d989773a9e82712 | [
"MIT"
] | 8 | 2020-12-28T01:44:02.000Z | 2022-02-13T22:55:07.000Z | build/engine/modules/mouse.js | Alcom1/Operation-Recycling-Bin | 77cec50bcbb34103a1c0a5744d989773a9e82712 | [
"MIT"
] | 1 | 2020-12-23T01:20:44.000Z | 2020-12-23T01:20:44.000Z | import Vect from "../utilities/vect.js";
export var MouseState;
(function(MouseState2) {
MouseState2[MouseState2["ISRELEASED"] = 0] = "ISRELEASED";
MouseState2[MouseState2["WASPRESSED"] = 1] = "WASPRESSED";
MouseState2[MouseState2["ISPRESSED"] = 2] = "ISPRESSED";
MouseState2[MouseState2["WASRELEASED"] = 3] = "WASRELEASED";
})(MouseState || (MouseState = {}));
export default class MouseModule {
constructor(element) {
this.mousePos = new Vect(0, 0);
this.mousePressed = false;
this.afterPressed = false;
this.mouseType = "";
this.resolution = new Vect(0, 0);
this.mouseElement = element;
this.mouseElement.style.touchAction = "none";
this.mouseElement.onpointermove = (e) => this.updatePos(e);
this.mouseElement.onpointerdown = (e) => {
this.mousePressed = true;
this.updatePos(e);
};
this.mouseElement.onpointerup = () => this.mousePressed = false;
this.mouseElement.onpointercancel = () => this.mousePressed = false;
}
update() {
this.afterPressed = this.mousePressed;
}
updatePos(e) {
e.preventDefault();
this.mouseType = e.pointerType;
this.mousePos = new Vect(e.offsetX * (this.resolution.x / e.target.clientWidth), e.offsetY * (this.resolution.y / e.target.clientHeight));
}
getPos() {
return this.mousePos;
}
getMouseState() {
if (this.mousePressed && !this.afterPressed) {
return 1;
} else if (this.mousePressed) {
return 2;
} else if (!this.mousePressed && this.afterPressed) {
return 3;
} else {
return 0;
}
}
getMouseType() {
return this.mouseType;
}
setCursorURL(url) {
this.mouseElement.style.cursor = "url(" + url + "), auto";
}
setResolution(resx, resy) {
this.resolution = new Vect(resx, resy);
}
}
//# sourceMappingURL=mouse.js.map
| 30.966102 | 142 | 0.648057 |
021b344a7fac47078f676c4f60af7da463963e40 | 25,246 | js | JavaScript | utils.test.js | mikejarrett/cdxgen | e4ccf1f6b37b02e3ec04b4f19f12a24d313c3d53 | [
"Apache-2.0"
] | null | null | null | utils.test.js | mikejarrett/cdxgen | e4ccf1f6b37b02e3ec04b4f19f12a24d313c3d53 | [
"Apache-2.0"
] | null | null | null | utils.test.js | mikejarrett/cdxgen | e4ccf1f6b37b02e3ec04b4f19f12a24d313c3d53 | [
"Apache-2.0"
] | null | null | null | const utils = require("./utils");
const fs = require("fs");
const ssri = require("ssri");
test("SSRI test", () => {
// gopkg.lock hash
ss = ssri.parse(
"2ca532a6bc655663344004ba102436d29031018eab236247678db1d8978627bf"
);
expect(ss).toEqual(null);
ss = ssri.parse(
"sha256-2ca532a6bc655663344004ba102436d29031018eab236247678db1d8978627bf"
);
expect(ss.sha256[0].digest).toStrictEqual(
"2ca532a6bc655663344004ba102436d29031018eab236247678db1d8978627bf"
);
ss = ssri.parse(
"sha256-" +
Buffer.from(
"2ca532a6bc655663344004ba102436d29031018eab236247678db1d8978627bf",
"hex"
).toString("base64")
);
expect(ss.sha256[0].digest).toStrictEqual(
"LKUyprxlVmM0QAS6ECQ20pAxAY6rI2JHZ42x2JeGJ78="
);
});
test("Parse requires dist string", () => {
expect(utils.parsePyRequiresDist("lazy-object-proxy (>=1.4.0)")).toEqual({
name: "lazy-object-proxy",
version: "1.4.0",
});
expect(utils.parsePyRequiresDist("wrapt (<1.13,>=1.11)")).toEqual({
name: "wrapt",
version: "1.13",
});
expect(
utils.parsePyRequiresDist(
'typed-ast (<1.5,>=1.4.0) ; implementation_name == "cpython" and python_version < "3.8"'
)
).toEqual({ name: "typed-ast", version: "1.5" });
expect(utils.parsePyRequiresDist("asgiref (<4,>=3.2.10)")).toEqual({
name: "asgiref",
version: "4",
});
expect(utils.parsePyRequiresDist("pytz")).toEqual({
name: "pytz",
version: "",
});
expect(utils.parsePyRequiresDist("sqlparse (>=0.2.2)")).toEqual({
name: "sqlparse",
version: "0.2.2",
});
expect(
utils.parsePyRequiresDist("argon2-cffi (>=16.1.0) ; extra == 'argon2'")
).toEqual({ name: "argon2-cffi", version: "16.1.0" });
expect(utils.parsePyRequiresDist("bcrypt ; extra == 'bcrypt'")).toEqual({
name: "bcrypt",
version: "",
});
});
test("finds license id from name", () => {
expect(utils.findLicenseId("Apache License Version 2.0")).toEqual(
"Apache-2.0"
);
expect(
utils.findLicenseId("GNU General Public License (GPL) version 2.0")
).toEqual("GPL-2.0-only");
});
test("parse gradle dependencies", () => {
expect(utils.parseGradleDep(null)).toEqual([]);
let dep_list = utils.parseGradleDep(
fs.readFileSync("./test/gradle-dep.out", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(33);
expect(dep_list[0]).toEqual({
group: "org.ethereum",
name: "solcJ-all",
qualifiers: {
type: "jar",
},
version: "0.4.25",
});
dep_list = utils.parseGradleDep(
fs.readFileSync("./test/data/gradle-android-dep.out", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(103);
expect(dep_list[0]).toEqual({
group: "com.android.support.test",
name: "runner",
qualifiers: {
type: "jar",
},
version: "1.0.2",
});
dep_list = utils.parseGradleDep(
fs.readFileSync("./test/data/gradle-out1.dep", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(89);
expect(dep_list[0]).toEqual({
group: "org.springframework.boot",
name: "spring-boot-starter",
version: "2.2.0.RELEASE",
qualifiers: { type: "jar" },
});
});
test("parse gradle projects", () => {
expect(utils.parseGradleProjects(null)).toEqual([]);
let proj_list = utils.parseGradleProjects(
fs.readFileSync("./test/data/gradle-projects.out", (encoding = "utf-8"))
);
expect(proj_list.length).toEqual(9);
});
test("parse maven tree", () => {
expect(utils.parseMavenTree(null)).toEqual([]);
let dep_list = utils.parseMavenTree(
fs.readFileSync("./test/data/sample-mvn-tree.txt", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(61);
expect(dep_list[0]).toEqual({
group: "com.pogeyan.cmis",
name: "copper-server",
version: "1.15.2",
qualifiers: { type: "jar" },
});
});
// Slow test
/*
test("get maven metadata", async () => {
let data = await utils.getMvnMetadata([
{
group: "com.squareup.okhttp3",
name: "okhttp",
version: "3.8.1",
},
]);
expect(data).toEqual([
{
description: "",
group: "com.squareup.okhttp3",
name: "okhttp",
version: "3.8.1",
},
]);
data = await utils.getMvnMetadata([
{
group: "com.fasterxml.jackson.core",
name: "jackson-databind",
version: "2.8.5",
},
{
group: "com.github.jnr",
name: "jnr-posix",
version: "3.0.47",
},
]);
expect(data).toEqual([
{
group: "com.fasterxml.jackson.core",
name: "jackson-databind",
version: "2.8.5",
description:
"General data-binding functionality for Jackson: works on core streaming API",
repository: { url: "http://github.com/FasterXML/jackson-databind" },
},
{
group: "com.github.jnr",
name: "jnr-posix",
version: "3.0.47",
license: ["EPL-2.0", "GPL-2.0-only", "LGPL-2.1-only"],
description: "\n Common cross-project/cross-platform POSIX APIs\n ",
repository: { url: "git@github.com:jnr/jnr-posix.git" },
},
]);
});
*/
test("get py metadata", async () => {
jest.setTimeout(120000);
const data = await utils.getPyMetadata([
{
group: "",
name: "Flask",
version: "1.1.0",
},
false,
]);
expect(data).toEqual([
{
_integrity:
"sha256-a31adc27de06034c657a8dc091cc5fcb0227f2474798409bff0e9674de31a026",
description: "A simple framework for building complex web applications.",
group: "",
homepage: {
url: "https://palletsprojects.com/p/flask",
},
license: "BSD-3-Clause",
name: "Flask",
version: "1.1.0",
},
]);
});
test("parseGoModData", async () => {
jest.setTimeout(120000);
let dep_list = await utils.parseGoModData(null);
expect(dep_list).toEqual([]);
const gosumMap = {
"google.golang.org/grpc/v1.21.0":
"sha256-oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=",
"github.com/aws/aws-sdk-go/v1.38.47": "sha256-fake-sha-for-aws-go-sdk=",
"github.com/spf13/cobra/v1.0.0":
"sha256-/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=",
"github.com/spf13/viper/v1.0.2":
"sha256-A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM=",
"github.com/stretchr/testify/v1.6.1":
"sha256-6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=",
};
dep_list = await utils.parseGoModData(
fs.readFileSync("./test/gomod/go.mod", (encoding = "utf-8")),
gosumMap
);
expect(dep_list.length).toEqual(4);
expect(dep_list[0]).toEqual({
group: "github.com/aws",
name: "aws-sdk-go",
license: undefined,
version: "v1.38.47",
_integrity: "sha256-fake-sha-for-aws-go-sdk=",
});
expect(dep_list[1]).toEqual({
group: "github.com/spf13",
name: "cobra",
license: undefined,
version: "v1.0.0",
_integrity: "sha256-/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=",
});
expect(dep_list[2]).toEqual({
group: "google.golang.org",
name: "grpc",
license: undefined,
version: "v1.21.0",
_integrity: "sha256-oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=",
});
expect(dep_list[3]).toEqual({
group: "github.com/spf13",
name: "viper",
license: undefined,
version: "v1.0.2",
_integrity: "sha256-A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM=",
});
dep_list.forEach((d) => {
expect(d.license);
});
});
test("parseGoSumData", async () => {
jest.setTimeout(120000);
let dep_list = await utils.parseGoModData(null);
expect(dep_list).toEqual([]);
dep_list = await utils.parseGosumData(
fs.readFileSync("./test/gomod/go.sum", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(4);
expect(dep_list[0]).toEqual({
group: "google.golang.org",
name: "grpc",
license: undefined,
version: "v1.21.0",
_integrity: "sha256-oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=",
});
expect(dep_list[1]).toEqual({
group: "github.com/spf13",
name: "cobra",
license: undefined,
version: "v1.0.0",
_integrity: "sha256-/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=",
});
expect(dep_list[2]).toEqual({
group: "github.com/spf13",
name: "viper",
license: undefined,
version: "v1.0.2",
_integrity: "sha256-A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM=",
});
expect(dep_list[3]).toEqual({
group: "github.com/stretchr",
name: "testify",
license: undefined,
version: "v1.6.1",
_integrity: "sha256-6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=",
});
dep_list.forEach((d) => {
expect(d.license);
});
});
test("parse go list dependencies", async () => {
let dep_list = await utils.parseGoListDep(
fs.readFileSync("./test/data/golist-dep.txt", (encoding = "utf-8")),
{}
);
expect(dep_list.length).toEqual(8);
expect(dep_list[0]).toEqual({
group: "github.com/badoux",
name: "checkmail",
version: "v0.0.0-20181210160741-9661bd69e9ad",
});
});
test("parse go mod why dependencies", () => {
let pkg_name = utils.parseGoModWhy(
fs.readFileSync("./test/data/gomodwhy.txt", (encoding = "utf-8"))
);
expect(pkg_name).toEqual("github.com/mailgun/mailgun-go/v4");
pkg_name = utils.parseGoModWhy(
fs.readFileSync("./test/data/gomodwhynot.txt", (encoding = "utf-8"))
);
expect(pkg_name).toBeUndefined();
});
test("parseGopkgData", async () => {
jest.setTimeout(120000);
let dep_list = await utils.parseGopkgData(null);
expect(dep_list).toEqual([]);
dep_list = await utils.parseGopkgData(
fs.readFileSync("./test/gopkg/Gopkg.lock", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(36);
expect(dep_list[0]).toEqual({
group: "cloud.google.com",
name: "go",
version: "v0.39.0",
_integrity: "sha256-LKUyprxlVmM0QAS6ECQ20pAxAY6rI2JHZ42x2JeGJ78=",
});
dep_list.forEach((d) => {
expect(d.license);
});
});
test("parse go version data", async () => {
let dep_list = await utils.parseGoVersionData(
fs.readFileSync("./test/data/goversion.txt", (encoding = "utf-8")),
{}
);
expect(dep_list.length).toEqual(125);
expect(dep_list[0]).toEqual({
group: "github.com/ShiftLeftSecurity",
name: "atlassian-connect-go",
version: "v0.0.2",
_integrity: "",
license: undefined,
});
dep_list = await utils.parseGoVersionData(
fs.readFileSync("./test/data/goversion2.txt", (encoding = "utf-8")),
{}
);
expect(dep_list.length).toEqual(149);
expect(dep_list[0]).toEqual({
group: "cloud.google.com",
name: "go",
version: "v0.79.0",
_integrity: "sha256-oqqswrt4x6b9OGBnNqdssxBl1xf0rSUNjU2BR4BZar0=",
license: undefined,
});
});
test("parse cargo lock", async () => {
expect(await utils.parseCargoData(null)).toEqual([]);
dep_list = await utils.parseCargoData(
fs.readFileSync("./test/Cargo.lock", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(224);
expect(dep_list[0]).toEqual({
group: "",
name: "abscissa_core",
version: "0.5.2",
_integrity:
"sha384-6a07677093120a02583717b6dd1ef81d8de1e8d01bd226c83f0f9bdf3e56bb3a",
});
});
test("parse cargo toml", async () => {
expect(await utils.parseCargoTomlData(null)).toEqual([]);
dep_list = await utils.parseCargoTomlData(
fs.readFileSync("./test/data/Cargo1.toml", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(4);
expect(dep_list).toEqual([
{ group: "", name: "unwind", version: "0.0.0" },
{ name: "libc", version: "0.2.79" },
{ name: "compiler_builtins", version: "0.1.0" },
{ name: "cfg-if", version: "0.1.8" },
]);
});
test("get crates metadata", async () => {
const dep_list = await utils.getCratesMetadata([
{
group: "",
name: "abscissa_core",
version: "0.5.2",
_integrity:
"sha256-6a07677093120a02583717b6dd1ef81d8de1e8d01bd226c83f0f9bdf3e56bb3a",
},
]);
expect(dep_list.length).toEqual(1);
expect(dep_list[0]).toEqual({
group: "",
name: "abscissa_core",
version: "0.5.2",
_integrity:
"sha256-6a07677093120a02583717b6dd1ef81d8de1e8d01bd226c83f0f9bdf3e56bb3a",
description:
"Application microframework with support for command-line option parsing,\nconfiguration, error handling, logging, and terminal interactions.\nThis crate contains the framework's core functionality.\n",
license: ["Apache-2.0"],
repository: {
url: "https://github.com/iqlusioninc/abscissa/tree/main/core/",
},
homepage: { url: "https://github.com/iqlusioninc/abscissa/" },
});
});
test("parse cs pkg data", async () => {
expect(await utils.parseCsPkgData(null)).toEqual([]);
const dep_list = await utils.parseCsPkgData(
fs.readFileSync("./test/data/packages.config", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(21);
expect(dep_list[0]).toEqual({
group: "",
name: "Antlr",
version: "3.5.0.2",
});
});
test("parse cs pkg data 2", async () => {
expect(await utils.parseCsPkgData(null)).toEqual([]);
const dep_list = await utils.parseCsPkgData(
fs.readFileSync("./test/data/packages2.config", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(1);
expect(dep_list[0]).toEqual({
group: "",
name: "EntityFramework",
version: "6.2.0",
});
});
test("parse cs proj", async () => {
expect(await utils.parseCsProjData(null)).toEqual([]);
const dep_list = await utils.parseCsProjData(
fs.readFileSync("./test/sample.csproj", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(5);
expect(dep_list[0]).toEqual({
group: "",
name: "Microsoft.AspNetCore.Mvc.NewtonsoftJson",
version: "3.1.1",
});
});
test("parse project.assets.json", async () => {
expect(await utils.parseCsProjAssetsData(null)).toEqual([]);
const dep_list = await utils.parseCsProjAssetsData(
fs.readFileSync("./test/data/project.assets.json", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(142);
expect(dep_list[0]).toEqual({
group: "",
name: "Castle.Core",
version: "4.4.1",
_integrity:
"sha512-zanbjWC0Y05gbx4eGXkzVycOQqVOFVeCjVsDSyuao9P4mtN1w3WxxTo193NGC7j3o2u3AJRswaoC6hEbnGACnQ==",
});
});
test("parse packages.lock.json", async () => {
expect(await utils.parseCsPkgLockData(null)).toEqual([]);
const dep_list = await utils.parseCsPkgLockData(
fs.readFileSync("./test/data/packages.lock.json", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(14);
expect(dep_list[0]).toEqual({
group: "",
name: "Antlr",
version: "3.5.0.2",
});
});
test("parse .net cs proj", async () => {
expect(await utils.parseCsProjData(null)).toEqual([]);
const dep_list = await utils.parseCsProjData(
fs.readFileSync("./test/data/sample-dotnet.csproj", (encoding = "utf-8"))
);
expect(dep_list.length).toEqual(19);
expect(dep_list[0]).toEqual({
group: "",
name: "Antlr3.Runtime",
version: "3.5.0.2",
});
});
test("get nget metadata", async () => {
const dep_list = await utils.getNugetMetadata([
{
group: "",
name: "Castle.Core",
version: "4.4.0",
},
]);
expect(dep_list.length).toEqual(1);
expect(dep_list[0]).toEqual({
group: "",
name: "Castle.Core",
version: "4.4.0",
description:
"Castle Core, including DynamicProxy, Logging Abstractions and DictionaryAdapter",
homepage: {
url: "https://www.nuget.org/packages/Castle.Core/4.4.0/",
},
license: "http://www.apache.org/licenses/LICENSE-2.0.html",
repository: {
url: "http://www.castleproject.org/",
},
});
});
test("parsePomFile", () => {
const data = utils.parsePom("./test/pom.xml");
expect(data.length).toEqual(13);
});
test("parsePomMetadata", async () => {
const deps = utils.parsePom("./test/pom.xml");
const data = await utils.getMvnMetadata(deps);
expect(data.length).toEqual(deps.length);
});
test("get repo license", async () => {
let license = await utils.getRepoLicense(
"https://github.com/ShiftLeftSecurity/sast-scan"
);
expect(license).toEqual({
id: "GPL-3.0-or-later",
url: "https://github.com/ShiftLeftSecurity/sast-scan/blob/master/LICENSE",
});
license = await utils.getRepoLicense("https://github.com/AppThreat/cdxgen", {
group: "",
name: "cdxgen",
});
expect(license).toEqual({
id: "Apache-2.0",
url: "https://github.com/AppThreat/cdxgen/blob/master/LICENSE",
});
license = await utils.getRepoLicense("https://cloud.google.com/go", {
group: "cloud.google.com",
name: "go",
});
expect(license).toEqual("Apache-2.0");
license = await utils.getRepoLicense(undefined, {
group: "github.com/ugorji",
name: "go",
});
expect(license).toEqual({
id: "MIT",
url: "https://github.com/ugorji/go/blob/master/LICENSE",
});
});
test("get go pkg license", async () => {
let license = await utils.getGoPkgLicense({
group: "github.com/Azure/azure-amqp-common-go",
name: "v2",
});
expect(license).toEqual([
{
id: "MIT",
url: "https://pkg.go.dev/github.com/Azure/azure-amqp-common-go/v2?tab=licenses",
},
]);
license = await utils.getGoPkgLicense({
group: "go.opencensus.io",
name: "go.opencensus.io",
});
expect(license).toEqual([
{
id: "Apache-2.0",
url: "https://pkg.go.dev/go.opencensus.io?tab=licenses",
},
]);
license = await utils.getGoPkgLicense({
group: "github.com/DataDog",
name: "zstd",
});
expect(license).toEqual([
{
id: "BSD-3-Clause",
url: "https://pkg.go.dev/github.com/DataDog/zstd?tab=licenses",
},
]);
});
test("get licenses", () => {
let licenses = utils.getLicenses({ license: "MIT" });
expect(licenses).toEqual([
{
license: {
id: "MIT",
url: "https://opensource.org/licenses/MIT",
},
},
]);
licenses = utils.getLicenses({ license: ["MIT", "GPL-3.0-or-later"] });
expect(licenses).toEqual([
{
license: {
id: "MIT",
url: "https://opensource.org/licenses/MIT",
},
},
{
license: {
id: "GPL-3.0-or-later",
url: "https://opensource.org/licenses/GPL-3.0-or-later",
},
},
]);
licenses = utils.getLicenses({
license: {
id: "MIT",
url: "https://opensource.org/licenses/MIT",
},
});
expect(licenses).toEqual([
{
license: {
id: "MIT",
url: "https://opensource.org/licenses/MIT",
},
},
]);
});
test("parsePkgLock", async () => {
const deps = await utils.parsePkgLock("./test/package-lock.json");
expect(deps.length).toEqual(759);
expect(deps[0]._integrity).toEqual(
"sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
);
});
test("parseNodeShrinkwrap", async () => {
const deps = await utils.parseNodeShrinkwrap("./test/shrinkwrap-deps.json");
expect(deps.length).toEqual(496);
expect(deps[0]._integrity).toEqual(
"sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g=="
);
});
test("parseSetupPyFile", async () => {
let deps = await utils.parseSetupPyFile(`install_requires=[
'colorama>=0.4.3',
'libsast>=1.0.3',
],`);
expect(deps.length).toEqual(2);
expect(deps[0].name).toEqual("colorama");
expect(deps[0].description).toEqual("Cross-platform colored terminal text.");
deps = await utils.parseSetupPyFile(
`install_requires=['colorama>=0.4.3','libsast>=1.0.3',],`
);
expect(deps.length).toEqual(2);
expect(deps[0].name).toEqual("colorama");
expect(deps[0].description).toEqual("Cross-platform colored terminal text.");
deps = await utils.parseSetupPyFile(
`install_requires=['colorama>=0.4.3','libsast>=1.0.3']`
);
expect(deps.length).toEqual(2);
expect(deps[0].name).toEqual("colorama");
expect(deps[0].description).toEqual("Cross-platform colored terminal text.");
deps = await utils.parseSetupPyFile(
`install_requires=['colorama>=0.4.3', 'libsast>=1.0.3']`
);
expect(deps.length).toEqual(2);
expect(deps[0].name).toEqual("colorama");
expect(deps[0].description).toEqual("Cross-platform colored terminal text.");
deps = await utils.parseSetupPyFile(`install_requires=[
'colorama>=0.4.3',
'libsast>=1.0.3',
]`);
expect(deps.length).toEqual(2);
expect(deps[0].name).toEqual("colorama");
expect(deps[0].description).toEqual("Cross-platform colored terminal text.");
});
test("parsePnpmLock", async () => {
const deps = await utils.parsePnpmLock("./test/pnpm-lock.yaml");
expect(deps.length).toEqual(1610);
expect(deps[0]).toEqual({
_integrity:
"sha512-IGhtTmpjGbYzcEDOw7DcQtbQSXcG9ftmAXtWTu9V936vDye4xjjekktFAtgZsWpzTj/X01jocB46mTywm/4SZw==",
group: "@babel",
name: "code-frame",
version: "7.10.1",
});
});
test("parseYarnLock", async () => {
let deps = await utils.parseYarnLock("./test/yarn.lock");
expect(deps.length).toEqual(56);
expect(deps[0]).toEqual({
group: "",
name: "asap",
version: "2.0.5",
_integrity: "sha256-522765b50c3510490e52d7dcfe085ef9ba96958f",
});
deps = await utils.parseYarnLock("./test/data/yarn_locks/yarn.lock");
expect(deps.length).toEqual(2029);
expect(deps[0]).toEqual({
group: "babel",
name: "cli",
version: "7.10.1",
_integrity: "sha256-b6e5cd43a17b8f639442ab027976408ebe6d79a0",
});
deps.forEach((d) => {
expect(d.name).toBeDefined();
expect(d.version).toBeDefined();
});
deps = await utils.parseYarnLock("./test/data/yarn_locks/yarn-multi.lock");
expect(deps.length).toEqual(1909);
expect(deps[0]).toEqual({
_integrity: "sha256-24e0a6faa1d231ab44807af237c6227410c75c4d",
group: "apollo",
name: "client",
version: "3.2.5",
});
});
test("parseComposerLock", () => {
let deps = utils.parseComposerLock("./test/data/composer.lock");
expect(deps.length).toEqual(1);
expect(deps[0]).toEqual({
group: "quickbooks",
name: "v3-php-sdk",
scope: "required",
version: "4.0.6.1",
repository: {
type: "git",
url: "https://github.com/intuit/QuickBooks-V3-PHP-SDK.git",
reference: "fe42e409bcdc431614f1cfc80cfc4191b926f3ed",
},
license: ["Apache-2.0"],
description: "The Official PHP SDK for QuickBooks Online Accounting API",
});
deps = utils.parseComposerLock("./test/data/composer-2.lock");
expect(deps.length).toEqual(73);
expect(deps[0]).toEqual({
group: "amphp",
name: "amp",
scope: "required",
version: "2.4.4",
repository: {
type: "git",
url: "https://github.com/amphp/amp.git",
reference: "1e58d53e4af390efc7813e36cd215bd82cba4b06",
},
license: ["MIT"],
description: "A non-blocking concurrency framework for PHP applications.",
});
});
test("parseGemfileLockData", async () => {
let deps = await utils.parseGemfileLockData(
fs.readFileSync("./test/data/Gemfile.lock", (encoding = "utf-8"))
);
expect(deps.length).toEqual(140);
expect(deps[0]).toEqual({
name: "actioncable",
version: "6.0.0",
});
});
test("parseGemspecData", async () => {
let deps = await utils.parseGemspecData(
fs.readFileSync("./test/data/xmlrpc.gemspec", (encoding = "utf-8"))
);
expect(deps.length).toEqual(1);
expect(deps[0]).toEqual({
name: "xmlrpc",
version: "0.3.0",
description:
"XMLRPC is a lightweight protocol that enables remote procedure calls over HTTP.",
});
});
test("parse requirements.txt with comments", async () => {
jest.setTimeout(120000);
let deps = await utils.parseReqFile(
fs.readFileSync(
"./test/data/requirements.comments.txt",
(encoding = "utf-8")
)
);
expect(deps.length).toEqual(31);
});
test("parse wheel metadata", () => {
let deps = utils.parseBdistMetadata(
fs.readFileSync("./test/data/METADATA", (encoding = "utf-8"))
);
expect(deps.length).toEqual(1);
expect(deps[0]).toEqual({
version: "1.26.1",
name: "yamllint",
description: "A linter for YAML files.",
homepage: { url: "https://github.com/adrienverge/yamllint" },
license: "GPLv3",
repository: { url: "https://github.com/adrienverge/yamllint" },
});
});
test("parse wheel", async () => {
let metadata = await utils.readZipEntry(
"./test/data/appthreat_depscan-2.0.2-py3-none-any.whl",
"METADATA"
);
expect(metadata);
const parsed = utils.parseBdistMetadata(metadata);
expect(parsed[0]).toEqual({
version: "2.0.2",
name: "appthreat-depscan",
description:
"Fully open-source security audit for project dependencies based on known vulnerabilities and advisories.",
homepage: { url: "https://github.com/appthreat/dep-scan" },
license: "UNKNOWN",
});
});
test("parse pipfile.lock with hashes", async () => {
jest.setTimeout(120000);
let deps = await utils.parsePiplockData(
JSON.parse(
fs.readFileSync("./test/data/Pipfile.lock", (encoding = "utf-8"))
)
);
expect(deps.length).toEqual(46);
});
test("parse scala sbt list", async () => {
let deps = utils.parseKVDep(
fs.readFileSync("./test/data/sbt-dl.list", { encoding: "utf-8" })
);
expect(deps.length).toEqual(57);
});
test("parse scala sbt lock", async () => {
let deps = utils.parseSbtLock("./test/data/build.sbt.lock");
expect(deps.length).toEqual(117);
});
| 28.623583 | 208 | 0.634675 |
021b65eb6269d6997ed046ecfa618c488ddbb198 | 3,214 | js | JavaScript | src/g2g.js | g2gml/g2gml | 5f08542e619fe6712bfee065d575bcbcb3da5a84 | [
"MIT"
] | 6 | 2018-12-04T04:38:07.000Z | 2019-03-18T12:07:27.000Z | src/g2g.js | g2gml/g2g | 5f08542e619fe6712bfee065d575bcbcb3da5a84 | [
"MIT"
] | 12 | 2018-07-18T12:06:02.000Z | 2019-05-27T11:30:59.000Z | src/g2g.js | g2gml/g2gml | 5f08542e619fe6712bfee065d575bcbcb3da5a84 | [
"MIT"
] | 2 | 2020-03-21T11:03:52.000Z | 2021-06-01T15:02:04.000Z | #!/usr/bin/env node
var fs = require('fs');
var common = require('./common.js');
var path = require('path');
var g2gmlToSparql = require('./g2g_to_sparql.js');
var commander = require('commander').version(require("../package.json").version)
.arguments('<g2gml_file> <data_source>')
.action(function (g2gml_file, data_source) {
g2gPath = g2gml_file;
dataSrc = data_source;
})
.option('-f, --format [format]', 'format of results <rq|pg|json|pgx|neo|dot|aws|all (default: pg)>', /^(rq|pg|json|pgx|neo|dot|aws|all)$/i)
.option('-o, --output_dir [prefix]', 'directory where results are output (default: output/<input_prefix>)')
.option('--paginate [page_count]', 'count of rows in each page for pagination mode (default: 10000, negative means no pagination)', parseInt);
commander.parse(process.argv)
if(commander.args.length === 0) {
console.error("Error: no arguments are given!");
commander.help();
}
var pageSize = commander.paginate || 10000;
var inputName = common.removeExtension(path.basename(g2gPath));
var dstDir = commander.output_dir || './output/' + inputName;
if(commander.format === true) {
console.error('Error: invalid format!');
commander.help();
}
var dstFormat = commander.format || 'pg';
const SPARQL_DIR = dstDir + '/sparql/';
var pgPath = dstDir + '/' + inputName + '.pg';
common.mkdirPath(dstDir);
common.removeRecursive(SPARQL_DIR);
common.mkdirPath(SPARQL_DIR);
function afterSparql(err) {
if(err) return;
if(dstFormat != 'rq') {
common.runSpawnSync('sparql_to_pg', afterPg, dataSrc, SPARQL_DIR, dstDir + "/tsv/", pgPath, pageSize);
} else {
console.log('Done.');
}
}
function afterPg(err) {
if(err) throw err;
// TODO: output this log only if pg has been sucessfully created
console.log('"' + pgPath + '" has been created.');
var neoDir = dstDir + "/neo/";
var pgxDir = dstDir + "/pgx/";
var awsDir = dstDir + "/aws/";
switch(dstFormat) {
case 'neo':
common.mkdirPath(neoDir);
common.runSpawnSync('pg2neo', (err) => {if(err) throw err;}, pgPath, '-o', neoDir);
break;
case 'pgx':
common.mkdirPath(pgxDir);
common.runSpawnSync('pg2pgx', (err) => {if(err) throw err;}, pgPath, '-o', pgxDir);
break;
case 'aws':
common.mkdirPath(awsDir);
common.runSpawnSync('pg2aws', (err) => {if(err) throw err;}, pgPath, '-o', awsDir);
break;
case 'dot':
common.runSpawnSync('pg2dot', (err) => {if(err) throw err;}, pgPath, '-o', dstDir);
break;
case 'json':
common.runSpawnSync('pg2json', (err) => {if(err) throw err;}, pgPath, '-o', dstDir);
break;
case 'pg':
console.log('Done.');
break;
case 'all':
common.mkdirPath(neoDir);
common.runSpawnSync('pg2neo', (err) => {if(err) throw err;}, pgPath, '-o', neoDir);
common.mkdirPath(pgxDir);
common.runSpawnSync('pg2pgx', (err) => {if(err) throw err;}, pgPath, '-o', pgxDir);
common.mkdirPath(awsDir);
common.runSpawnSync('pg2aws', (err) => {if(err) throw err;}, pgPath, '-o', awsDir);
common.runSpawnSync('pg2dot', (err) => {if(err) throw err;}, pgPath, '-o', dstDir);
break;
}
}
common.runSpawnSync('g2g_to_sparql', afterSparql, g2gPath, SPARQL_DIR);
| 34.191489 | 146 | 0.644368 |
021c24799c3cb2ee4aa916ed7ca3264e07f9cf28 | 1,209 | js | JavaScript | App/Core/Js/IpgSortableTableHeader.js | Hem/Bootstrap3x | f9e35bee9563cbb0a8d065ad1965319e33e0f50d | [
"MIT"
] | null | null | null | App/Core/Js/IpgSortableTableHeader.js | Hem/Bootstrap3x | f9e35bee9563cbb0a8d065ad1965319e33e0f50d | [
"MIT"
] | null | null | null | App/Core/Js/IpgSortableTableHeader.js | Hem/Bootstrap3x | f9e35bee9563cbb0a8d065ad1965319e33e0f50d | [
"MIT"
] | null | null | null | ๏ปฟ(function() {
'use strict';
var appName = 'app';
var ctrlName = 'ipgSortableTableHeaderCtrl';
var directiveName = 'ipgSortableTableHeader';
var directive = [
function() {
return {
restrict: 'AE',
replace: true,
controller: ctrlName,
scope: {
headerText: '@headerText',
fieldName: '@fieldName',
sortBy: '=',
reverse: '='
},
templateUrl: '~/App/Core/Views/IpgSortableTableHeader.html'
};
}
];
var ctrl = [
'$scope', '$element',
function($scope, $element) {
$element.on('click', function() {
if ($scope.sortBy !== $scope.fieldName) {
$scope.reverse = false;
} else {
$scope.reverse = !$scope.reverse;
}
$scope.sortBy = $scope.fieldName;
$scope.$apply();
});
}
];
angular.module(appName).controller(ctrlName, ctrl);
angular.module(appName).directive(directiveName, directive);
})(); | 27.477273 | 75 | 0.443342 |
021c5d39c1c05079e5e326271a2a24d1f5c5acc3 | 989 | js | JavaScript | webpack.config.js | searchsam/conducir | 5f8e216dac69d0574782420e43bc365a1216f744 | [
"Apache-2.0"
] | null | null | null | webpack.config.js | searchsam/conducir | 5f8e216dac69d0574782420e43bc365a1216f744 | [
"Apache-2.0"
] | null | null | null | webpack.config.js | searchsam/conducir | 5f8e216dac69d0574782420e43bc365a1216f744 | [
"Apache-2.0"
] | null | null | null | import path from "path";
import webpack from "webpack";
import HtmlWebpackPlugin from "html-webpack-plugin";
import MiniCssExtractPlugin from "mini-css-extract-plugin";
export default {
mode: "production",
devtool: "source-map",
entry: [path.resolve(__dirname, "./client/src/app/index.js")],
target: "web",
output: {
path: path.resolve(__dirname, "./client/dist"),
publicPath: "/",
filename: "bundle.js"
},
plugins: [
new MiniCssExtractPlugin(),
new HtmlWebpackPlugin({
template: "./client/src/app/index.html",
inject: true
})
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ["babel-loader"]
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.[s]css$/,
use: [
MiniCssExtractPlugin.loader,
"style-loader",
"css-loader",
"sass-loader"
]
}
]
}
};
| 21.977778 | 64 | 0.539939 |
021c9e4418363f1983ab4daf4f7a8fcf5d9294d1 | 299 | js | JavaScript | src/components/link.js | maurer2/catsby-playground | 6bab34b7199d9e3fc5aeaa41113618d0c05c09a3 | [
"MIT"
] | null | null | null | src/components/link.js | maurer2/catsby-playground | 6bab34b7199d9e3fc5aeaa41113618d0c05c09a3 | [
"MIT"
] | null | null | null | src/components/link.js | maurer2/catsby-playground | 6bab34b7199d9e3fc5aeaa41113618d0c05c09a3 | [
"MIT"
] | null | null | null | import React from 'react';
import { Link as GatsbyLink } from 'gatsby';
import isAbsoluteUrl from 'is-absolute-url';
const Link = ({ to, ...props }) => (isAbsoluteUrl(to) ? (
<a href={to} {...props}>
{props.children}
</a>
) : (
<GatsbyLink to={to} {...props} />
));
export default Link;
| 21.357143 | 57 | 0.605351 |
021cb8a814353f42e4cd6b260498a1aa5b480d89 | 3,092 | js | JavaScript | src/api/matricula.js | Lercc/prueba | 4bd9d8f923e7579dcc6ffd6378ad2456c757738d | [
"MIT"
] | null | null | null | src/api/matricula.js | Lercc/prueba | 4bd9d8f923e7579dcc6ffd6378ad2456c757738d | [
"MIT"
] | null | null | null | src/api/matricula.js | Lercc/prueba | 4bd9d8f923e7579dcc6ffd6378ad2456c757738d | [
"MIT"
] | null | null | null | import axios from 'axios';
import store from '../store';
import qs from 'qs'
// const API_URL = `https://aula-virtual-eltambo.teampixeland.com/public/api`
const API_URL = store.state.apiRest.url
/**
* MATRICULA
*/
// CREAR MATRICULA
// REQUEST `students/*/cycles/*/enrollments`
function crearEnrollment(pIdEstudiante, pIdCiclo, pFormData) {
const REQUEST = `students/${pIdEstudiante}/cycles/${pIdCiclo}/enrollments`
const headers = { Authorization : `Bearer ${store.state.usuario.token}`}
return axios.post(`${API_URL}/${REQUEST}`, pFormData, { headers })
}
// OBTENER MATRICULAS
// REQUEST `students/*/enrollments`
function getEnrollments() {
const REQUEST = `students/${store.state.estudiante.estudiante.id}/enrollments`
const headers = { Authorization : `Bearer ${store.state.usuario.token}`}
return axios.get(`${API_URL}/${REQUEST}`, { headers })
}
//OBTENER MATRICULAS DEL ESTUDIANTE FILTRADO POR PรGINA
function getAllStudentEnrollments(pPage) {
const REQUEST = `students/${store.state.estudiante.estudiante.id}/enrollments?page=${pPage}`
const headers = { Authorization : `Bearer ${store.state.usuario.token}`}
return axios.get(`${API_URL}/${REQUEST}`, { headers })
}
// OBTENER TODAS MATRICULAS POR PAGINa
function getAllEnrollments(pPage) {
const REQUEST = `enrollments?page=${pPage}`
const headers = { Authorization : `Bearer ${store.state.usuario.token}`}
return axios.get(`${API_URL}/${REQUEST}`, { headers })
}
// ACTUALIZAR MATRICULA
// REQUEST `students/*/cycles/*/enrollments`
function updateEnrollment(pIdEstudiante, pIdCiclo, pIdMatricula, pData) {
const REQUEST = `students/${pIdEstudiante}/cycles/${pIdCiclo}/enrollments/${pIdMatricula}`
const data = qs.stringify(pData)
const headers = {
'content-type': 'application/x-www-form-urlencoded',
Authorization : `Bearer ${store.state.usuario.token}`
}
return axios.put(`${API_URL}/${REQUEST}`, data, { headers })
}
//OBTENER TODAS LAS MATRICULAS POR CRITERIO
function getAllEnrollmentsFilter(query,value,pPage){
const REQUEST = `enrollments?${query}=${value}&page=${pPage}`
const headers = { Authorization : `Bearer ${store.state.usuario.token}`}
return axios.get(`${API_URL}/${REQUEST}`, { headers })
}
/**
* VAUCHER
*/
// CREAR VAUCHER
//REQUEST `voucher`
function crearVoucher(pFormData) {
const REQUEST = `vouchers`
const headers = {
'Content-Type': 'multipart/form-data',
Authorization : `Bearer ${store.state.usuario.token}`
}
return axios.post(`${API_URL}/${REQUEST}`, pFormData, { headers })
}
// OBTENER VAUCHER POR MATRICULAS
//REQUEST `voucher`
function getVouchersPerEnrollments(pIdEnrollment) {
const REQUEST = `vouchers?matricula_id=${pIdEnrollment}`
const headers = { Authorization : `Bearer ${store.state.usuario.token}` }
return axios.get(`${API_URL}/${REQUEST}`, { headers })
}
//Exportamos la funcion para poder usarla mรกs tarde
export { crearEnrollment,
crearVoucher,
getEnrollments,
getAllEnrollments,
getVouchersPerEnrollments,
updateEnrollment,
getAllEnrollmentsFilter,
getAllStudentEnrollments }
| 33.978022 | 94 | 0.719276 |
021cec0aff79927ce4980f0202af5561dde4d911 | 12,455 | js | JavaScript | zm-admin-help-common/WebRoot/help/en_US/admin/html/whxdata/whtdata0_xml.js | hernad/zimbra9 | cf61ffa40d9600ab255ef4516ca25029fff6603b | [
"Apache-2.0"
] | null | null | null | zm-admin-help-common/WebRoot/help/en_US/admin/html/whxdata/whtdata0_xml.js | hernad/zimbra9 | cf61ffa40d9600ab255ef4516ca25029fff6603b | [
"Apache-2.0"
] | null | null | null | zm-admin-help-common/WebRoot/help/en_US/admin/html/whxdata/whtdata0_xml.js | hernad/zimbra9 | cf61ffa40d9600ab255ef4516ca25029fff6603b | [
"Apache-2.0"
] | null | null | null | /*
* ***** BEGIN LICENSE BLOCK *****
*
* Zimbra Collaboration Suite Web Client
* Copyright (C) 2014, 2016 Synacor, Inc.
*
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at: https://www.zimbra.com/license
* The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15
* have been added to cover use of software over a computer network and provide for limited attribution
* for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights and limitations under the License.
* The Original Code is Zimbra Open Source Web Client.
* The Initial Developer of the Original Code is Zimbra, Inc. All rights to the Original Code were
* transferred by Zimbra, Inc. to Synacor, Inc. on September 14, 2015.
*
* All portions of the code are Copyright (C) 2014, 2016 Synacor, Inc. All Rights Reserved.
*
* ***** END LICENSE BLOCK *****
*/
gXMLBuffer ="<?xml version='1.0' encoding='utf-8' ?> <tocdata> <book name=\"Getting Started\" > <item name=\"About Zimbra Collaboration Suite\" url=\"getting_started/about_zcs.htm\" /> <item name=\"Navigating the Administration Console\" url=\"getting_started/about_the_administration_console.htm\" /> <item name=\"Global Administrator's Tasks from Admin Console\" url=\"getting_started/tasks_performed_from_aministration_console.htm\" /> <item name=\"Setting Up the Global Admin Account\" url=\"basic_administration_tasks/adminisrator_s_mailbox.htm\" /> </book> <book name=\"Global Settings\" > <item name=\"Managing Global Settings\" url=\"managing_global_settings/global_settings.htm\" /> <item name=\"General Information for Global Settings\" url=\"managing_global_settings/general_information_for_global_settings.htm\" /> <item name=\"Configuring the MTA Tab for Global Settings\" url=\"managing_global_settings/configuring_the_mta_tab_for_global_settings.htm\" /> <item name=\"Global Attachment Settings\" url=\"managing_global_settings/global_attachment_settings.htm\" /> <item name=\"Blocking messages with specific extensions\" url=\"managing_global_settings/blocking_messages_with_specific_extensions.htm\" /> <item name=\"Configure MTA Protocol and DNS Checks\" url=\"managing_global_settings/mta_smtp_restrictions.htm\" /> <item name=\"Relay MTA for External Delivery\" url=\"managing_global_settings/relay_mta_for_external_delivery.htm\" /> <item name=\"Configuring IMAP\" url=\"managing_global_settings/configuring_imap.htm\" /> <item name=\"Configuring POP\" url=\"managing_global_settings/configuring_pop.htm\" /> <item name=\"Proxy Server\" url=\"managing_global_settings/imap_and_pop_proxy_server.htm\" /> <item name=\"Anti-Virus Protection\" url=\"managing_global_settings/anti-virus_configuration_options.htm\" /> <item name=\"Anti-Spam Protection\" url=\"managing_global_settings/anti-spam_protection.htm\" /> <item name=\"Customizing UI Themes\" url=\"cos/customizing_ui_themes.htm\" /> <item name=\"Defining Theme for the Zimbra Web Client UI\" url=\"ui_themes/defining_theme_for_the_zimbra_web_client_ui.htm\" /> <item name=\"Making Free/Busy Available\" url=\"managing_global_settings/making_free_busy_view__available_.htm\" /> </book> <book name=\"Managing Domains\" > <item name=\"Configuring Global Address List (GAL)\" url=\"managing_domains/using_the_global_address_list_(gal).htm\" /> <item name=\"How to Configure GAL\" url=\"managing_domains/how_to_configure_gal.htm\" /> <item name=\"Configuring Authentication Settings\" url=\"managing_domains/authentication_settings.htm\" /> <item name=\"How to Configure Authentication\" url=\"managing_domains/how_to_configure_authentication_mode.htm\" /> <item name=\"Configuring Virtual Hosts\" url=\"managing_domains/configuring_virtual_hosts.htm\" /> <item name=\"Viewing Accounts by Domain\" url=\"managing_domains/viewing_accounts_by_domain.htm\" /> <item name=\"Adding a New Domain\" url=\"managing_domains/creating_a_domain.htm\" /> <item name=\"Changing a Domain Name\" url=\"managing_domains/changing_a_domain_name.htm\" /> <item name=\"Changing Domain Status\" url=\"managing_domains/changing_domain_status.htm\" /> <item name=\"Suspending a Domain\" url=\"managing_domains/suspending_a_domain.htm\" /> <item name=\"Creating a Domain Alias\" url=\"managing_domains/creating_a_domain_alias.htm\" /> </book> <book name=\"Managing Servers\" > <item name=\"Managing Servers\" url=\"managing_servers/managing_servers.htm\" /> <item name=\"Configuring the MTA Tab for Servers\" url=\"managing_servers/configuring_the_mta_tab_for_servers.htm\" /> <item name=\"Stopping Mailbox Service on a Server\" url=\"managing_servers/stopping_mailbox_service_on_a_server.htm\" /> <item name=\"Assigning Accounts to Different Servers\" url=\"cos/assigning_accounts_to_different_servers.htm\" /> </book> <book name=\"Managing COS\" > <item name=\"Managing Classes of Service\" url=\"cos/class_of_service.htm\" /> <item name=\"Creating or Deleting Classes of Service\" url=\"cos/creating_classes_of_service.htm\" /> <item name=\"Override COS Settings\" url=\"cos/override_cos_settings.htm\" /> </book> <book name=\"Managing Accounts\" > <item name=\"Setting the Default ZWC Login Version\" url=\"managing_accounts/setting_the_devault_zwc_login_version.htm\" /> <item name=\"Managing Addresses\" url=\"managing_accounts/managing_accounts_alliases,_dl,_resources.htm\" /> <item name=\"Re-Indexing a Mailbox\" url=\"managing_accounts/re-indexing_a_mailbox.htm\" /> <item name=\"Viewing User's Mailbox Content\" url=\"monitoring/viewing_user_s_mailbox_content.htm\" /> <item name=\"Changing Quota Settings\" url=\"managing_accounts/changing_quota_settings.htm\" /> <item name=\"Purging Mail Messages\" url=\"managing_accounts/purging_mail_messages.htm\" /> <item name=\"Deleting Accounts\" url=\"managing_accounts/deleting_accounts.htm\" /> <book name=\"Accounts\" > <item name=\"Provisioning Account\" url=\"managing_accounts/create_an_account.htm\" /> <item name=\"Editing Accounts\" url=\"managing_accounts/editing_accounts.htm\" /> <item name=\"Forwarding Mail\" url=\"managing_accounts/forwarding_mail.htm\" /> <item name=\"Changing Account Status\" url=\"managing_accounts/changing_account_status.htm\" /> <item name=\"Renaming an Account\" url=\"managing_accounts/renaming_an_account.htm\" /> <item name=\"Managing Alias Addresses\" url=\"managing_accounts/creating_a_mail_aliases.htm\" /> <item name=\"Setting Time Zones for Accounts\" url=\"managing_accounts/setting_time_zones_for_accounts.htm\" /> </book> <book name=\"Distribution Lists\" > <item name=\"Creating Distribution Lists\" url=\"managing_accounts/distribution_lists.htm\" /> <item name=\"Managing Shared Items with Distribution Lists\" url=\"managing_accounts/managing_shared_items_with_distribution_lists.htm\" /> <item name=\"Adding Distribution Lists to an Account\" url=\"managing_accounts/adding_distribution_lists_to_an_account.htm\" /> <item name=\"Deleting Distribution Lists\" url=\"managing_accounts/delete_distribution_lists.htm\" /> </book> <book name=\"Setting Password Rules\" > <item name=\"Password Options when Authentication is Internal\" url=\"passwords/password_options.htm\" /> <item name=\"Setting Password Rules\" url=\"passwords/setting_password_rules.htm\" /> <item name=\"Setting and Changing Passwords\" url=\"passwords/setting_passwords.htm\" /> <item name=\"Changing Passwords from the Admin Console\" url=\"passwords/changing_a_password.htm\" /> <item name=\"Prevent Users from Changing Passwords\" url=\"managing_accounts/restricting_passwords.htm\" /> <item name=\"Setting Account Lockout Rules\" url=\"passwords/setting_account_lockout_rules.htm\" /> </book> <book name=\"User Features and Preferences Options\" > <item name=\"ZWC Features to Enable\" url=\"managing_accounts/user_interface_features.htm\" /> <item name=\"User Preferences\" url=\"managing_accounts/preferences.htm\" /> <item name=\"Account Advanced Features\" url=\"managing_accounts/account_advanced_features.htm\" /> <item name=\"Enabling the Calendar Feature\" url=\"managing_accounts/enabling_the_calendar_feature.htm\" /> <item name=\"Enabling Mail Forwarding\" url=\"managing_accounts/forwarding_mail.htm\" /> <item name=\"Autocomplete on GAL\" url=\"managing_domains/autocomplete_on_gal.htm\" /> <item name=\"About Session Idle Timeout and Auth Token Lifetime\" url=\"managing_servers/session_timeout.htm\" /> </book> </book> <book name=\"Managing Resources\" > <item name=\"Managing a Resource Account\" url=\"managing_accounts/managing_resource.htm\" /> <item name=\"Making a Resource Unavailable\" url=\"managing_accounts/taking_a_resource_out_of_service.htm\" /> <item name=\"Monitoring a Resource Account Calendar\" url=\"managing_accounts/monitoring_a_resource_account_calendar.htm\" /> </book> <book name=\"Managing Zimlets\" > <item name=\"About Zimlets\" url=\"zimlets/about_zimlets.htm\" /> <item name=\"Adding Zimlets to COS and Accounts\" url=\"zimlets/adding_zimlets_to_cos_and_accounts.htm\" /> <item name=\"Flushing the Server Cache\" url=\"managing_servers/flushing_the_server_cache.htm\" /> </book> <book name=\"Monitoring Tools\" > <item name=\"Monitoring Servers\" url=\"managing_servers/monitoring_zimbra_collaboration_suite.htm\" /> <item name=\"View Server Status\" url=\"monitoring/view_server_status.htm\" /> <item name=\"Checking Usage Statistics\" url=\"monitoring/checking_usage_statistics.htm\" /> <item name=\"Creating Advanced Server Statistics\" url=\"monitoring/creating_advanced_server_statistics.htm\" /> <item name=\"Daily Mail Reports\" url=\"monitoring/daily_mail_reports.htm\" /> <item name=\"About MTA Queues\" url=\"monitoring/about_mta_queues.htm\" /> <item name=\"Monitoring Zimbra Mail Queues\" url=\"monitoring/monitoring_zimbra_mta_mail_queues.htm\" /> <item name=\"Disk Space Availability Alert\" url=\"monitoring/disk_space_avability_alert.htm\" /> <item name=\"Mailbox usage\" url=\"managing_accounts/mailbox_usage.htm\" /> <item name=\"Viewing Mailbox Quotas\" url=\"managing_servers/viewing_mailbox_quotas.htm\" /> <item name=\"Managing Certificates from the Administration Console\" url=\"tools/creating_certificates.htm\" /> <item name=\"Installing Certificates\" url=\"tools/installing_certificates.htm\" /> <item name=\"Getting the Latest ZCS Software Updates\" url=\"monitoring/getting_latest_software_updates.htm\" /> </book> <book name=\"Searching from the Admin Console\" > <item name=\"Using Search\" url=\"search/search.htm\" /> <item name=\"Zimbra Search\" url=\"search/help_search.htm\" /> <item name=\"Advanced Search\" url=\"search/advanced_search.htm\" /> </book> <book name=\"Working with Themes\" > <item name=\"Customizing UI Themes\" url=\"cos/customizing_ui_themes.htm\" /> <item name=\"Flushing the Server Cache\" url=\"managing_servers/flushing_the_server_cache.htm\" /> <item name=\"Quick Custom Color\" url=\"ui_themes/how_to_customize_theme_colors_and_logos.htm\" /> <item name=\"How to Customize Themes from Admin Console\" url=\"ui_themes/customizing_themes_and_logos.htm\" /> <item name=\"Restricting User Interface Theme Choice\" url=\"ui_themes/restricting_user_interface_theme_choice.htm\" /> <item name=\"Making UI Themes Available by COS\" url=\"ui_themes/defining_theme_for_the_zimbra_web_client_ui.htm\" /> <item name=\"Making UI Themes Available by Account\" url=\"ui_themes/making_ui_themes_available_by_account.htm\" /> </book> <book name=\"Using the Admin Console\" > <item name=\"Enhancing the Zimbra Admin Console User Interface\" url=\"admin_console_misc/enhancing_the_zimbra_admin_console_user_interface.htm\" /> <item name=\"Chaning Authentication Required dialog\" url=\"managing_domains/authentication_required_dialog.htm\" /> </book> </tocdata>"; | 498.2 | 11,177 | 0.743637 |
021d89f5bbdb6483eb5a31c0ae0f60c1317fa683 | 3,218 | js | JavaScript | 2-resources/_External-learning-resources/01-Typescript/Learning-Typescript-2/Chapter03/demos/promises/view.js | eengineergz/Lambda | 1fe511f7ef550aed998b75c18a432abf6ab41c5f | [
"MIT"
] | 18 | 2016-11-30T02:14:17.000Z | 2021-11-08T13:11:59.000Z | 2-resources/_External-learning-resources/01-Typescript/Learning-Typescript-2/Chapter03/demos/promises/view.js | eengineergz/Lambda | 1fe511f7ef550aed998b75c18a432abf6ab41c5f | [
"MIT"
] | 1 | 2020-12-01T04:49:17.000Z | 2020-12-01T04:49:17.000Z | 2-resources/_External-learning-resources/01-Typescript/Learning-Typescript-2/Chapter03/demos/promises/view.js | eengineergz/Lambda | 1fe511f7ef550aed998b75c18a432abf6ab41c5f | [
"MIT"
] | 9 | 2017-01-25T15:14:08.000Z | 2021-05-30T09:18:24.000Z | var ViewAsync = (function () {
function ViewAsync(config) {
this._container = config.container;
this._templateUrl = config.templateUrl;
this._serviceUrl = config.serviceUrl;
this._args = config.args;
}
ViewAsync.prototype._loadJsonAsync = function (url, args) {
return Q.Promise(function (resolve, reject) {
$.ajax({
url: url,
type: "GET",
dataType: "json",
data: args,
success: function (json) {
resolve(json);
},
error: function (e) {
reject(e);
}
});
});
};
ViewAsync.prototype._loadHbsAsync = function (url) {
return Q.Promise(function (resolve, reject) {
$.ajax({
url: url,
type: "GET",
dataType: "text",
success: function (hbs) {
resolve(hbs);
},
error: function (e) {
reject(e);
}
});
});
};
ViewAsync.prototype._compileHbsAsync = function (hbs) {
return Q.Promise(function (resolve, reject) {
try {
var template = Handlebars.compile(hbs);
resolve(template);
}
catch (e) {
reject(e);
}
});
};
ViewAsync.prototype._jsonToHtmlAsync = function (template, json) {
return Q.Promise(function (resolve, reject) {
try {
var html = template(json);
resolve(html);
}
catch (e) {
reject(e);
}
});
};
ViewAsync.prototype._appendHtmlAsync = function (html, container) {
return Q.Promise(function (resolve, reject) {
try {
var $container = $(container);
if ($container.length === 0) {
throw new Error("Container not found!");
}
$container.html(html);
resolve($container);
}
catch (e) {
reject(e);
}
});
};
ViewAsync.prototype.renderAsync = function () {
var _this = this;
return Q.Promise(function (resolve, reject) {
try {
var getJson = _this._loadJsonAsync(_this._serviceUrl, _this._args);
var getTemplate = _this._loadHbsAsync(_this._templateUrl).then(_this._compileHbsAsync);
Q.all([getJson, getTemplate]).then(function (results) {
var json = results[0];
var template = results[1];
_this._jsonToHtmlAsync(template, json).then(function (html) {
return _this._appendHtmlAsync(html, _this._container);
}).then(function ($container) {
resolve($container);
});
});
}
catch (error) {
reject(error);
}
});
};
return ViewAsync;
})();
| 32.505051 | 103 | 0.442511 |
021de3f1b1960b27b924f91a16bec64b053eadbf | 3,247 | js | JavaScript | bot.js | xthecoolboy/DiscordBot-2 | 0cbaef9cb882f3dba5852d9c74b8c5708e267dbb | [
"Apache-2.0"
] | null | null | null | bot.js | xthecoolboy/DiscordBot-2 | 0cbaef9cb882f3dba5852d9c74b8c5708e267dbb | [
"Apache-2.0"
] | null | null | null | bot.js | xthecoolboy/DiscordBot-2 | 0cbaef9cb882f3dba5852d9c74b8c5708e267dbb | [
"Apache-2.0"
] | null | null | null | if (process.version.slice(1).split('.')[0] < 8) throw new Error('Node 8.0.0 or higher is required.');
const Discord = require('discord.js');
const { promisify } = require('util');
const readdir = promisify(require('fs').readdir);
const Enmap = require('enmap');
const EnmapLevel = require('enmap-level');
const YouTube = require('simple-youtube-api');
const ytdl = require('ytdl-core');
//const pg = require('pg'); // Coming soon!
const client = new Discord.Client();
try {
client.config = require('./config.js');
} catch (err) {
console.error('Unable to load config.js \n', err);
process.exit(1);
}
if (client.config.debug === 'true') {
console.warn('RUNNING IN DEBUG MODE. SOME PRIVATE INFORMATION (SUCH AS THE TOKEN) MAY BE LOGGED TO CONSOLE');
client.on('error', (e) => console.log(e));
client.on('warn', (e) => console.log(e));
client.on('debug', (e) => console.log(e));
}
var allowedStatuses = ['online', 'idle', 'invisible', 'dnd'];
if (!allowedStatuses.includes(client.config.status)) {
console.error('Bot status must be one of online/idle/invisible/dnd');
process.exit(1);
}
require('./modules/functions.js')(client);
require('./modules/music.js')(client);
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
client.settings = new Enmap({ provider: new EnmapLevel({ name: 'settings' }) });
client.tags = new Enmap({ provider: new EnmapLevel({ name: 'tags' }) });
client.points = new Enmap({ provider: new EnmapLevel({ name: 'points' }) });
//client.warnings = new Enmap({ provider: new EnmapLevel({ name: 'warnings' }) }); // Coming soon (format: `${guild.id}-${user.id}`)
client.talkedRecently = new Set();
if (client.config.musicEnabled === 'true') {
client.musicQueue = new Map();
client.YouTube = new YouTube(client.config.googleAPIToken);
client.ytdl = ytdl;
}
const init = async () => {
const cmdFiles = await readdir('./commands/');
client.commandsNumber = cmdFiles.length;
client.log('log', `Loading a total of ${client.commandsNumber} commands.`, 'LOAD');
cmdFiles.forEach(f => {
try {
const props = require(`./commands/${f}`);
if (f.split('.').slice(-1)[0] !== 'js') return;
client.log('log', `Loading Command: ${props.help.name}.`, 'LOAD');
client.commands.set(props.help.name, props);
props.conf.aliases.forEach(alias => {
client.aliases.set(alias, props.help.name);
});
} catch (e) {
client.log('ERROR', `Unable to load command ${f}: ${e}`);
}
});
const evtFiles = await readdir('./events/');
client.log('log', `Loading a total of ${evtFiles.length} events.`, 'LOAD');
evtFiles.forEach(file => {
const eventName = file.split('.')[0];
client.log('log', `Loading Event: ${eventName}.`, 'LOAD');
const event = require(`./events/${file}`);
client.on(eventName, event.bind(null, client));
delete require.cache[require.resolve(`./events/${file}`)];
});
var token = client.config.token;
process.on('unhandledRejection', err => {
if (err.code === 'ENOTFOUND' || err.code === 'ECONNRESET' || err.code === 'ETIMEDOUT') {
client.log('ERROR', `Bot connection error: ${err.code}`);
} else {
client.log('ERROR', `Uncaught Promise Error: \n${err.stack}`);
}
});
client.login(process.env.TOKEN);
};
init();
| 32.47 | 132 | 0.653218 |
021e70095a3b1a4a2119ed54290261409d7913c7 | 5,581 | js | JavaScript | public/theme/quiz3.js | raqaelf/php_tutor | ba4ae5bc50783e6c53220033b2ed7f4b453eecff | [
"MIT"
] | null | null | null | public/theme/quiz3.js | raqaelf/php_tutor | ba4ae5bc50783e6c53220033b2ed7f4b453eecff | [
"MIT"
] | 2 | 2021-05-10T21:29:39.000Z | 2022-02-13T02:36:20.000Z | public/theme/quiz3.js | raqaelf/php_tutor | ba4ae5bc50783e6c53220033b2ed7f4b453eecff | [
"MIT"
] | 1 | 2020-02-24T20:34:20.000Z | 2020-02-24T20:34:20.000Z | var _0x321c=["\x64\x65\x66\x61\x75\x6C\x74","\x61\x70\x70\x6C\x79\x54\x68\x65\x6D\x65","\x53\x74\x79\x6C\x65\x73\x4D\x61\x6E\x61\x67\x65\x72","\x50\x72\x65\x2D\x54\x65\x73\x74\x20\x55\x6E\x69\x74\x20\x33","\x62\x6F\x74\x74\x6F\x6D","\x74\x6F\x70","\x53\x74\x61\x72\x74","\x68\x74\x6D\x6C","\x43\x6F\x6E\x67\x72\x61\x74\x75\x6C\x61\x74\x69\x6F\x6E\x21\x20\x3C\x62\x72\x2F\x3E\x59\x6F\x75\x27\x76\x65\x20\x70\x61\x73\x73\x65\x64\x20\x74\x68\x65\x20\x73\x65\x63\x6F\x6E\x64\x20\x75\x6E\x69\x74\x20\x6F\x66\x20\x74\x68\x69\x73\x20\x50\x72\x65\x2D\x54\x65\x73\x74\x3C\x62\x72\x2F\x3E","\x59\x6F\x75\x20\x68\x61\x76\x65\x20\x33\x30\x20\x2D\x20\x31\x32\x30\x20\x73\x65\x63\x6F\x6E\x64\x73\x20\x66\x6F\x72\x20\x65\x76\x65\x72\x79\x20\x71\x75\x65\x73\x74\x69\x6F\x6E\x2E\x20\x3C\x62\x72\x2F\x3E","\x50\x6C\x65\x61\x73\x65\x2C\x20\x63\x6C\x69\x63\x6B\x20\x27\x53\x74\x61\x72\x74\x27\x20\x62\x75\x74\x74\x6F\x6E\x20\x62\x65\x6C\x6F\x77\x20\x77\x68\x65\x6E\x20\x79\x6F\x75\x20\x61\x72\x65\x20\x72\x65\x61\x64\x79\x2E","\x72\x61\x64\x69\x6F\x67\x72\x6F\x75\x70","\x6F\x6E\x65","\x42\x65\x72\x69\x6B\x75\x74\x20\x6D\x65\x72\x75\x70\x61\x6B\x61\x6E\x20\x74\x69\x70\x65\x20\x64\x61\x74\x61\x20\x79\x61\x6E\x67\x20\x74\x69\x64\x61\x6B\x20\x73\x75\x70\x70\x6F\x72\x74\x20\x64\x61\x6C\x61\x6D\x20\x62\x61\x68\x61\x73\x61\x20\x50\x48\x50\x20\x76\x35\x20\x61\x64\x61\x6C\x61\x68","\x72\x61\x6E\x64\x6F\x6D","\x53\x74\x72\x69\x6E\x67","\x49\x6E\x74\x65\x67\x65\x72","\x52\x65\x61\x6C","\x4E\x55\x4C\x4C","\x74\x77\x6F","\x54\x69\x70\x65\x20\x64\x61\x74\x61\x20\x79\x61\x6E\x67\x20\x74\x65\x70\x61\x74\x20\x75\x6E\x74\x75\x6B\x20\x6D\x65\x6E\x79\x69\x6D\x70\x61\x6E\x20\x6B\x6F\x6E\x73\x74\x61\x6E\x74\x61\x20\u03A0\x20\x28\x70\x68\x69\x29\x20\x64\x61\x6C\x61\x6D\x20\x62\x61\x68\x61\x73\x61\x20\x50\x48\x50\x20\x61\x64\x61\x6C\x61\x68","\x46\x6C\x6F\x61\x74","\x41\x72\x72\x61\x79","\x74\x68\x72\x65\x65","\x54\x69\x70\x65\x20\x64\x61\x74\x61\x20\x79\x61\x6E\x67\x20\x68\x61\x6E\x79\x61\x20\x6D\x65\x6D\x69\x6C\x69\x6B\x69\x20\x6B\x65\x6D\x75\x6E\x67\x6B\x69\x6E\x61\x6E\x20\x32\x20\x6E\x69\x6C\x61\x69\x20\x75\x6E\x74\x75\x6B\x20\x64\x69\x73\x69\x6D\x70\x61\x6E\x2C\x20\x6D\x65\x72\x75\x70\x61\x6B\x61\x6E\x20\x74\x69\x70\x65\x20\x64\x61\x74\x61\x2E\x2E","\x42\x6F\x6F\x6C\x65\x61\x6E","\x43\x68\x61\x72\x61\x63\x74\x65\x72","\x66\x6F\x75\x72","\x46\x75\x6E\x67\x73\x69\x20\x64\x61\x6C\x61\x6D\x20\x50\x48\x50\x20\x79\x61\x6E\x67\x20\x64\x69\x67\x75\x6E\x61\x6B\x61\x6E\x20\x75\x6E\x74\x75\x6B\x20\x6D\x65\x6E\x67\x68\x69\x74\x75\x6E\x67\x20\x6A\x75\x6D\x6C\x61\x68\x20\x6B\x61\x72\x61\x6B\x74\x65\x72\x20\x70\x61\x64\x61\x20\x73\x65\x62\x75\x61\x68\x20\x53\x74\x72\x69\x6E\x67\x20\x64\x61\x6C\x61\x6D\x20\x50\x48\x50\x20\x61\x64\x61\x6C\x61\x68","\x73\x74\x72\x6C\x65\x6E\x28\x29","\x73\x74\x72\x5F\x77\x6F\x72\x64\x5F\x63\x6F\x75\x6E\x74\x28\x29","\x73\x74\x72\x72\x65\x76\x28\x29","\x73\x74\x72\x5F\x72\x65\x76\x28\x29","\x66\x69\x76\x65","\x55\x6E\x74\x75\x6B\x20\x6D\x65\x6E\x67\x68\x69\x74\x75\x6E\x67\x20\x6A\x75\x6D\x6C\x61\x68\x20\x6B\x61\x74\x61\x20\x79\x61\x6E\x67\x20\x61\x64\x61\x20\x70\x61\x64\x61\x20\x6B\x61\x6C\x69\x6D\x61\x74\x2C\x20\x64\x69\x67\x75\x6E\x61\x6B\x61\x6E\x20\x66\x75\x6E\x67\x73\x69\x3F","\x73\x75\x72\x76\x65\x79","\x76\x61\x6C\x75\x65","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x75\x69\x64","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x64\x69\x73\x70\x6C\x61\x79","\x73\x74\x79\x6C\x65","\x66\x6F\x72\x6D","\x62\x6C\x6F\x63\x6B","\x73\x63\x6F\x72\x65\x70\x72\x65\x74\x65\x73\x74","\x67\x65\x74\x43\x6F\x72\x72\x65\x63\x74\x65\x64\x41\x6E\x73\x77\x65\x72\x43\x6F\x75\x6E\x74","\x62\x74\x6F\x61","\x75\x69\x64\x6E\x65\x77","\x75\x6E\x69\x74\x49\x44","\x61\x64\x64","\x6F\x6E\x43\x6F\x6D\x70\x6C\x65\x74\x65","\x23\x73\x75\x72\x76\x65\x79\x45\x6C\x65\x6D\x65\x6E\x74"];Survey[_0x321c[2]][_0x321c[1]](_0x321c[0]);var json={title:_0x321c[3],showProgressBar:_0x321c[4],showTimerPanel:_0x321c[5],firstPageIsStarted:true,startSurveyText:_0x321c[6],pages:[{questions:[{type:_0x321c[7],html:_0x321c[8]+ _0x321c[9]+ _0x321c[10]}]},{maxTimeToFinish:60,questions:[{type:_0x321c[11],name:_0x321c[12],title:_0x321c[13],choicesOrder:_0x321c[14],choices:[_0x321c[15],_0x321c[16],_0x321c[17],_0x321c[18]],correctAnswer:_0x321c[17]}]},{maxTimeToFinish:30,questions:[{type:_0x321c[11],name:_0x321c[19],title:_0x321c[20],choicesOrder:_0x321c[14],choices:[_0x321c[16],_0x321c[17],_0x321c[21],_0x321c[22]],correctAnswer:_0x321c[21]}]},{maxTimeToFinish:30,questions:[{type:_0x321c[11],name:_0x321c[23],title:_0x321c[24],choicesOrder:_0x321c[14],choices:[_0x321c[16],_0x321c[25],_0x321c[26],_0x321c[21]],correctAnswer:_0x321c[25]}]},{maxTimeToFinish:60,questions:[{type:_0x321c[11],name:_0x321c[27],title:_0x321c[28],choicesOrder:_0x321c[14],choices:[_0x321c[29],_0x321c[30],_0x321c[31],_0x321c[32]],correctAnswer:_0x321c[29]}]},{maxTimeToFinish:60,questions:[{type:_0x321c[11],name:_0x321c[33],title:_0x321c[34],choicesOrder:_0x321c[14],choices:[_0x321c[29],_0x321c[30],_0x321c[31],_0x321c[32]],correctAnswer:_0x321c[30]}]}]};window[_0x321c[35]]= new Survey.Model(json);survey[_0x321c[50]][_0x321c[49]](function(_0xefb5x2){var _0xefb5x3=document[_0x321c[39]](_0x321c[38])[_0x321c[37]](_0x321c[36]);var _0xefb5x4=3;document[_0x321c[39]](_0x321c[42])[_0x321c[41]][_0x321c[40]]= _0x321c[43];document[_0x321c[39]](_0x321c[44])[_0x321c[36]]= window[_0x321c[46]](_0xefb5x2[_0x321c[45]]());document[_0x321c[39]](_0x321c[47])[_0x321c[36]]= window[_0x321c[46]](_0xefb5x3);document[_0x321c[39]](_0x321c[48])[_0x321c[36]]= _0xefb5x4});$(_0x321c[51]).Survey({model:survey})
| 2,790.5 | 5,580 | 0.732306 |
021e8356cad893c6d8876910e1a840c0aca9691f | 1,712 | js | JavaScript | src/components/Login/RegistrationBlock/RegistrationBlockBody/PasswordField/PasswordField.js | Legabog/social-network-v2-legabog | cfba78f9aa0763f12c2692184cd1c9705786f91c | [
"MIT"
] | null | null | null | src/components/Login/RegistrationBlock/RegistrationBlockBody/PasswordField/PasswordField.js | Legabog/social-network-v2-legabog | cfba78f9aa0763f12c2692184cd1c9705786f91c | [
"MIT"
] | null | null | null | src/components/Login/RegistrationBlock/RegistrationBlockBody/PasswordField/PasswordField.js | Legabog/social-network-v2-legabog | cfba78f9aa0763f12c2692184cd1c9705786f91c | [
"MIT"
] | null | null | null | import React, { useState } from "react";
import ErrorIcon from "@material-ui/icons/Error";
import "./PasswordField.css";
import RegistrationFormPasswordError from "../../../../common/RegistrationFormErrors/RegistrationFormPasswordError/RegistrationFormPasswordError";
const PasswordField = (props) => {
const [displayPasswordError, setDisplayPasswordError] = useState("none");
const toggleDisplayPasswordError = (display) => {
setDisplayPasswordError(display);
};
const focusInput = (id) => {
document.getElementById(`${id}`).focus();
};
return (
<div className="password__field">
<input
type="password"
id="regpassword"
className="passwordinput"
datatype="text"
name="password"
placeholder="Password"
value={props.password}
onChange={props.inputPasswordHandler}
onBlur={() => {
props.checkPasswordField(true);
toggleDisplayPasswordError("none");
}}
onFocus={() => {
props.checkPasswordField(false);
}}
style={{
border:
props.checkedPassword && props.passwordValidator()
? "1px solid red"
: null,
}}
/>
<ErrorIcon
className="error__icon"
style={{
display:
props.checkedPassword && props.passwordValidator() ? null : "none",
}}
onClick={() => {
toggleDisplayPasswordError();
focusInput("regpassword");
}}
/>
<RegistrationFormPasswordError display={displayPasswordError} />
</div>
);
};
export default PasswordField;
| 29.016949 | 147 | 0.575935 |
021fc198f8bb9536536eb00118125176dae56dd8 | 2,840 | js | JavaScript | src/store/reducers/staff.js | jinisminho/canteen-reactjs | 14a39be16c0e9fdc563533f5ff8fbbe1fe1c05bd | [
"MIT"
] | null | null | null | src/store/reducers/staff.js | jinisminho/canteen-reactjs | 14a39be16c0e9fdc563533f5ff8fbbe1fe1c05bd | [
"MIT"
] | null | null | null | src/store/reducers/staff.js | jinisminho/canteen-reactjs | 14a39be16c0e9fdc563533f5ff8fbbe1fe1c05bd | [
"MIT"
] | null | null | null | //This class used to set state for staff actions
import * as actionTypes from "../actions/actionTypes";
import { updateObject } from "../ultility";
import { updateCategoryStart } from "../actions/category";
//Get Staff Data
const getStaffStart = (state, action) => {
return updateObject(state, {
error: null,
loading: true,
deleteSuccess: false,
updateSuccess: false,
addSuccess: false
});
};
const getStaffSuccess = (state, action) => {
return updateObject(state, {
data: action.data,
total: action.total,
error: null,
loading: false,
page: action.page + 1,
sizePerPage: action.sizePerPage
});
};
const getStaffFail = (state, action) => {
return updateObject(state, {
error: action.error,
loading: false,
total: 0,
page: 1,
sizePerPage: 20
});
};
// update staff - change status isActive
const updateStaffStart = (state, action) => {
return updateObject(state, {
error: null,
loading: false,
updateSuccess: false
});
};
const updateStaffSuccess = (state, action) => {
return updateObject(state, {
error: null,
loading: false,
updateSuccess: true
});
};
const updateStaffFail = (state, action) => {
return updateObject(state, {
error: action.error,
loading: false,
total: 0,
page: 1,
sizePerPage: 20
});
};
// add Staff
const addStaffStart = (state, action) => {
return updateObject(state, {
error: null,
loading: true,
addSuccess: false,
})
}
const addStaffSuccess = (state, action) => {
return updateObject(state, {
error: null,
loading: false,
addSuccess: true
})
}
const addStaffFail = (state, action) => {
return updateObject(state, {
error: action.error,
loading: false,
total: 0,
page: 1,
sizePerPage: 20,
})
}
export default function reducer(
state = {
data: null,
total: 0,
error: null,
loading: false,
page: 1,
sizePerPage: 20,
updateSuccess: false,
addSuccess: false
},
action
) {
switch (action.type) {
case actionTypes.GET_STAFF_START:
return getStaffStart(state, action);
case actionTypes.GET_STAFF_FAILED:
return getStaffFail(state, action);
case actionTypes.GET_STAFF_SUCCESS:
return getStaffSuccess(state, action);
case actionTypes.UPDATE_STAFF_START:
return updateStaffStart(state, action);
case actionTypes.UPDATE_STAFF_FAILED:
return updateStaffFail(state, action);
case actionTypes.UPDATE_STAFF_SUCCESS:
return updateStaffSuccess(state, action);
case actionTypes.ADD_STAFF_START:
return addStaffStart(state, action);
case actionTypes.ADD_STAFF_FAILED:
return addStaffFail(state, action);
case actionTypes.ADD_STAFF_SUCCESS:
return addStaffSuccess(state, action);
}
return state;
}
| 21.353383 | 58 | 0.659859 |
021ffd34dcd16c648fc638e6ec06c8692bfb1685 | 16,228 | js | JavaScript | docs/html/navtreeindex3.js | bzfmuelh/PySCIPOpt | 91dceda925f3ecd4492d001b821ea1445f423e89 | [
"MIT"
] | null | null | null | docs/html/navtreeindex3.js | bzfmuelh/PySCIPOpt | 91dceda925f3ecd4492d001b821ea1445f423e89 | [
"MIT"
] | null | null | null | docs/html/navtreeindex3.js | bzfmuelh/PySCIPOpt | 91dceda925f3ecd4492d001b821ea1445f423e89 | [
"MIT"
] | null | null | null | var NAVTREEINDEX3 =
{
"lp_8pxi.html#a807cbe5329d11dce46ae9f2f2ad65bdd":[5,0,2,0,8,21],
"lp_8pxi.html#a8a72d0cd552b5dd62366168e57c46fc4":[5,0,2,0,8,13],
"lp_8pxi.html#a978d05e96db1b76e64f3c9d84076f0d5":[5,0,2,0,8,1],
"lp_8pxi.html#a9965dea612658492db887b701d1b8744":[5,0,2,0,8,26],
"lp_8pxi.html#a9bf0f9d6c9320b090f328d04c6f52e1a":[5,0,2,0,8,9],
"lp_8pxi.html#a9cb2b9dbed4fb315a29623c927b9968f":[5,0,2,0,8,15],
"lp_8pxi.html#aaf25140900030fd2428136e62e7b41b4":[5,0,2,0,8,11],
"lp_8pxi.html#ab74e6bf80237ddc4109968cedc58c151":[5,0,2,0,8,30],
"lp_8pxi.html#acaf2393100f1bf942cd273364aeb7ced":[5,0,2,0,8,17],
"lp_8pxi.html#ad1a5191f0b2784849292b031e555a14b":[5,0,2,0,8,27],
"lp_8pxi.html#ae277c2147fd677b6759fad8d1231890d":[5,0,2,0,8,18],
"lp_8pxi.html#af2d376a75ffce0cb314508fca73b3986":[5,0,2,0,8,7],
"lp_8pxi.html#afe92c4b719f18c87aea603f3ce2fab9d":[5,0,2,0,8,12],
"lp_8pxi_source.html":[5,0,2,0,8],
"maindoc_8py.html":[5,0,0,0],
"maindoc_8py_source.html":[5,0,0,0],
"markowitz__soco_8py.html":[5,0,1,0,14],
"markowitz__soco_8py.html#a2219b323d7e85f5d9627aef37500bcd1":[5,0,1,0,14,0],
"markowitz__soco_8py.html#a514f1b439f404f86f77090fa9edc96ce":[5,0,1,0,14,3],
"markowitz__soco_8py.html#a56726fe52fcec3ec46d4dd913395d5ca":[5,0,1,0,14,5],
"markowitz__soco_8py.html#a66cc12e3c6d68de3fef6de89cf033f67":[5,0,1,0,14,1],
"markowitz__soco_8py.html#aaef6c514c1aa86e66e47a17b0164f54d":[5,0,1,0,14,6],
"markowitz__soco_8py.html#ab1551d8043c2aa4410fb7dbb1fe3be7b":[5,0,1,0,14,4],
"markowitz__soco_8py.html#abc1de55a1ded540ae925d455d78d4573":[5,0,1,0,14,2],
"markowitz__soco_8py.html#addae018e9274387c415a32c60c4c6887":[5,0,1,0,14,7],
"markowitz__soco_8py_source.html":[5,0,1,0,14],
"mctransp_8py.html":[5,0,1,0,15],
"mctransp_8py.html#a16e4ef534cec559430e07e05eb71c719":[5,0,1,0,15,6],
"mctransp_8py.html#a1aabac6d068eef6a7bad3fdf50a05cc8":[5,0,1,0,15,8],
"mctransp_8py.html#a36238ae2a3da359bc73b0eee5fa03b50":[5,0,1,0,15,2],
"mctransp_8py.html#a56726fe52fcec3ec46d4dd913395d5ca":[5,0,1,0,15,10],
"mctransp_8py.html#a66cc12e3c6d68de3fef6de89cf033f67":[5,0,1,0,15,4],
"mctransp_8py.html#aad05f78187c942f9dd521605fa81f1ba":[5,0,1,0,15,9],
"mctransp_8py.html#aaef6c514c1aa86e66e47a17b0164f54d":[5,0,1,0,15,12],
"mctransp_8py.html#acdfd6d08bb395a85e6e7c2e62278bbfc":[5,0,1,0,15,0],
"mctransp_8py.html#addae018e9274387c415a32c60c4c6887":[5,0,1,0,15,11],
"mctransp_8py.html#ae0323a9039add2978bf5b49550572c7c":[5,0,1,0,15,7],
"mctransp_8py.html#ae5ec3c2a2687b0518747af256bb4e4a2":[5,0,1,0,15,3],
"mctransp_8py.html#aeb9806a56e1e80b69cc9a606b36cfe4b":[5,0,1,0,15,5],
"mctransp_8py.html#af7d00d60fd25f05584d1dadf52ba05a1":[5,0,1,0,15,1],
"mctransp_8py_source.html":[5,0,1,0,15],
"md_CONTRIBUTING.html":[3],
"md_INSTALL.html":[2],
"md_README.html":[1],
"mkp_8py.html":[5,0,1,0,16],
"mkp_8py.html#a21ad0bd836b90d08f4cf640b4c298e7c":[5,0,1,0,16,6],
"mkp_8py.html#a4124bc0a9335c27f086f24ba207a4912":[5,0,1,0,16,5],
"mkp_8py.html#a56726fe52fcec3ec46d4dd913395d5ca":[5,0,1,0,16,7],
"mkp_8py.html#a66cc12e3c6d68de3fef6de89cf033f67":[5,0,1,0,16,2],
"mkp_8py.html#a9b52e3f1dbaa1ebafec9d153340469b5":[5,0,1,0,16,1],
"mkp_8py.html#aaef6c514c1aa86e66e47a17b0164f54d":[5,0,1,0,16,8],
"mkp_8py.html#abd7047a06860455d0d9492a6fd776174":[5,0,1,0,16,0],
"mkp_8py.html#acc13284917caa7c84268469fe3176016":[5,0,1,0,16,4],
"mkp_8py.html#addae018e9274387c415a32c60c4c6887":[5,0,1,0,16,9],
"mkp_8py.html#aeb9806a56e1e80b69cc9a606b36cfe4b":[5,0,1,0,16,3],
"mkp_8py_source.html":[5,0,1,0,16],
"pages.html":[],
"pfs_8py.html":[5,0,1,0,17],
"pfs_8py.html#a3691308f2a4c2f6983f2880d32e29c84":[5,0,1,0,17,8],
"pfs_8py.html#a56726fe52fcec3ec46d4dd913395d5ca":[5,0,1,0,17,6],
"pfs_8py.html#a633de4b0c14ca52ea2432a3c8a5c4c31":[5,0,1,0,17,9],
"pfs_8py.html#a742204794ea328ba293fe59cec79b990":[5,0,1,0,17,4],
"pfs_8py.html#a76f11d9a0a47b94f72c2d0e77fb32240":[5,0,1,0,17,3],
"pfs_8py.html#a8415306ce2685bbea2c44c8a7eb78a42":[5,0,1,0,17,2],
"pfs_8py.html#a9336ebf25087d91c818ee6e9ec29f8c1":[5,0,1,0,17,7],
"pfs_8py.html#aac311dd32c75ec74aba4cbcf23ee996e":[5,0,1,0,17,1],
"pfs_8py.html#ab01b844ccbff0188a6f4c62e8bc2cbfa":[5,0,1,0,17,0],
"pfs_8py.html#acef5d95bc8d00ad4e351a5f49428b9c3":[5,0,1,0,17,5],
"pfs_8py.html#ad5acaffa11ff68098dc3a4b0b1c41048":[5,0,1,0,17,10],
"pfs_8py_source.html":[5,0,1,0,17],
"piecewise_8py.html":[5,0,1,0,18],
"piecewise_8py.html#a0867f43e27585e019c13f7f4b7c4ab6b":[5,0,1,0,18,11],
"piecewise_8py.html#a234f7afa24214aa7ff71bc79638eaf5b":[5,0,1,0,18,5],
"piecewise_8py.html#a25ed1bcb423b0b7200f485fc5ff71c8e":[5,0,1,0,18,12],
"piecewise_8py.html#a2687206d2d8f2b9891acedf7fdd87663":[5,0,1,0,18,8],
"piecewise_8py.html#a319c6f016c894f5c46548624cc6318e2":[5,0,1,0,18,4],
"piecewise_8py.html#a3b98e2dffc6cb06a89dcb0d5c60a0206":[5,0,1,0,18,14],
"piecewise_8py.html#a4323eba0072ae9a228e96ba7743c7c8e":[5,0,1,0,18,0],
"piecewise_8py.html#a4d0018e0446c5eb297cfdb2bec294bd7":[5,0,1,0,18,6],
"piecewise_8py.html#a508cc3106d2c29fe07dc87cbe3ea6927":[5,0,1,0,18,9],
"piecewise_8py.html#a59136c0efd5580601cc73ef4bd2b2f05":[5,0,1,0,18,1],
"piecewise_8py.html#a6277e2a7446059985dc9bcf0a4ac1a8f":[5,0,1,0,18,13],
"piecewise_8py.html#a811807a37793cc28ce40594f659a26d5":[5,0,1,0,18,3],
"piecewise_8py.html#a9d3d9048db16a7eee539e93e3618cbe7":[5,0,1,0,18,15],
"piecewise_8py.html#aa8493aef72f3de4146df8db8e5b2daff":[5,0,1,0,18,7],
"piecewise_8py.html#aad57484016654da87125db86f4227ea3":[5,0,1,0,18,16],
"piecewise_8py.html#ac51b57a703ba1c5869228690c93e1701":[5,0,1,0,18,10],
"piecewise_8py.html#ac607326c8553151a4b786bc665598b3c":[5,0,1,0,18,2],
"piecewise_8py_source.html":[5,0,1,0,18],
"presol_8pxi.html":[5,0,2,0,10],
"presol_8pxi.html#a54f4d99648062d0417399235adc12e54":[5,0,2,0,10,3],
"presol_8pxi.html#aba7e7ae733020abb70ad7417e97a80dc":[5,0,2,0,10,2],
"presol_8pxi.html#af27ac040fad3ab66e952c1d3b0aecabd":[5,0,2,0,10,1],
"presol_8pxi_source.html":[5,0,2,0,10],
"pricer_8pxi.html":[5,0,2,0,11],
"pricer_8pxi.html#a03cd5c4d963cd32c01a6a2aa87bd450f":[5,0,2,0,11,6],
"pricer_8pxi.html#a73aa759c6636d6ef096bc821c6d74521":[5,0,2,0,11,8],
"pricer_8pxi.html#a9fe6bac4bd6205dce1a8a4b8dcd784a9":[5,0,2,0,11,9],
"pricer_8pxi.html#aac1984fcb32b502745196cbbe87194b9":[5,0,2,0,11,5],
"pricer_8pxi.html#acc0d1636f3d65e59038a2899e8f3c92d":[5,0,2,0,11,2],
"pricer_8pxi.html#ad7756107baa24340ea64152e552743fe":[5,0,2,0,11,7],
"pricer_8pxi.html#aedb29b178d4dc595208e663346697217":[5,0,2,0,11,10],
"pricer_8pxi.html#aedddd7942d77058da4c74e63a1b080e8":[5,0,2,0,11,3],
"pricer_8pxi.html#aefd227771d7bd66c5cb93ef46bf32b66":[5,0,2,0,11,4],
"pricer_8pxi.html#af47e20fc251943ce6b7dc2d75a05b82d":[5,0,2,0,11,1],
"pricer_8pxi_source.html":[5,0,2,0,11],
"prodmix__soco_8py.html":[5,0,1,0,19],
"prodmix__soco_8py.html#a16e4ef534cec559430e07e05eb71c719":[5,0,1,0,19,3],
"prodmix__soco_8py.html#a4124bc0a9335c27f086f24ba207a4912":[5,0,1,0,19,4],
"prodmix__soco_8py.html#a56726fe52fcec3ec46d4dd913395d5ca":[5,0,1,0,19,8],
"prodmix__soco_8py.html#a66cc12e3c6d68de3fef6de89cf033f67":[5,0,1,0,19,2],
"prodmix__soco_8py.html#a6922b3979aa98c898f1c66bdec768989":[5,0,1,0,19,7],
"prodmix__soco_8py.html#a6d01f55fa703a97f258de3078541b09b":[5,0,1,0,19,0],
"prodmix__soco_8py.html#a9336ebf25087d91c818ee6e9ec29f8c1":[5,0,1,0,19,9],
"prodmix__soco_8py.html#aa571c8173dde514963e974e8c1da1945":[5,0,1,0,19,6],
"prodmix__soco_8py.html#ab359f279353858b55ac4fe6fcfcd33c3":[5,0,1,0,19,1],
"prodmix__soco_8py.html#ac483f6ce851c9ecd9fb835ff7551737c":[5,0,1,0,19,5],
"prodmix__soco_8py.html#ac7f01b5df0ebd2339035b77990cda224":[5,0,1,0,19,10],
"prodmix__soco_8py_source.html":[5,0,1,0,19],
"propagator_8pxi.html":[5,0,2,0,12],
"propagator_8pxi.html#a21a8b0de390a2cd4cc600ff530785be1":[5,0,2,0,12,5],
"propagator_8pxi.html#a269678d19fe24fd92c0f4710a86c76a5":[5,0,2,0,12,10],
"propagator_8pxi.html#a40a1eda45e2deebccdc36d0b457782e8":[5,0,2,0,12,4],
"propagator_8pxi.html#a42830dd46d2a1c45f618205a831302ad":[5,0,2,0,12,11],
"propagator_8pxi.html#a58eefad3f7955cf8ac676ecaf26e2062":[5,0,2,0,12,16],
"propagator_8pxi.html#a5c114a6981d336a2fdf9d531b66f6f82":[5,0,2,0,12,12],
"propagator_8pxi.html#a617046ffb3311feaa80417354ad53828":[5,0,2,0,12,3],
"propagator_8pxi.html#a745fe964ab063a9582a13629ff6d798f":[5,0,2,0,12,1],
"propagator_8pxi.html#ab03193307475fc899ce71e39a3c00114":[5,0,2,0,12,8],
"propagator_8pxi.html#ab817851e1ff98f713358ea03223cf91d":[5,0,2,0,12,15],
"propagator_8pxi.html#ac0c5a1cb9c88ab8001cd722cc8e4b267":[5,0,2,0,12,2],
"propagator_8pxi.html#ac8e3924424c195f904856c97ae5378d6":[5,0,2,0,12,7],
"propagator_8pxi.html#add51fa88fcfc16b6d59f8f582027a8d6":[5,0,2,0,12,6],
"propagator_8pxi.html#ae8e0fe905678f90abcaf1807af4d50be":[5,0,2,0,12,14],
"propagator_8pxi.html#aedb29b178d4dc595208e663346697217":[5,0,2,0,12,13],
"propagator_8pxi.html#aefe8cb411092506f0d983799209ae515":[5,0,2,0,12,9],
"propagator_8pxi_source.html":[5,0,2,0,12],
"puzzle_8py.html":[5,0,1,1,2],
"puzzle_8py.html#a25ed1bcb423b0b7200f485fc5ff71c8e":[5,0,1,1,2,3],
"puzzle_8py.html#a2fb1c5cf58867b5bbc9a1b145a86f3a0":[5,0,1,1,2,2],
"puzzle_8py.html#a508cc3106d2c29fe07dc87cbe3ea6927":[5,0,1,1,2,0],
"puzzle_8py.html#a9336ebf25087d91c818ee6e9ec29f8c1":[5,0,1,1,2,1],
"puzzle_8py.html#ab74e6bf80237ddc4109968cedc58c151":[5,0,1,1,2,4],
"puzzle_8py_source.html":[5,0,1,1,2],
"rcs_8py.html":[5,0,1,0,20],
"rcs_8py.html#a055e39d61bf29ec97b4db0a5dcd4c80f":[5,0,1,0,20,1],
"rcs_8py.html#a3691308f2a4c2f6983f2880d32e29c84":[5,0,1,0,20,13],
"rcs_8py.html#a4124bc0a9335c27f086f24ba207a4912":[5,0,1,0,20,9],
"rcs_8py.html#a4baee84af7a92177c9064ddc2fc010ce":[5,0,1,0,20,4],
"rcs_8py.html#a56726fe52fcec3ec46d4dd913395d5ca":[5,0,1,0,20,11],
"rcs_8py.html#a66ea1f5d479ccabe037195d19593262e":[5,0,1,0,20,2],
"rcs_8py.html#a8135edf0904e63ed84a63c76e155aa57":[5,0,1,0,20,10],
"rcs_8py.html#a9336ebf25087d91c818ee6e9ec29f8c1":[5,0,1,0,20,12],
"rcs_8py.html#ac483f6ce851c9ecd9fb835ff7551737c":[5,0,1,0,20,7],
"rcs_8py.html#acb95449a94688af33f6e9bb090cf2936":[5,0,1,0,20,5],
"rcs_8py.html#adf1f3edb9115acb0a1e04209b7a9937b":[5,0,1,0,20,6],
"rcs_8py.html#ae0323a9039add2978bf5b49550572c7c":[5,0,1,0,20,8],
"rcs_8py.html#ae26507f6b763940748fd0557c346a171":[5,0,1,0,20,0],
"rcs_8py.html#aeb9806a56e1e80b69cc9a606b36cfe4b":[5,0,1,0,20,3],
"rcs_8py_source.html":[5,0,1,0,20],
"read__tsplib_8py.html":[5,0,1,0,21],
"read__tsplib_8py.html#a2b61cd81ad06ecf064eb62caca2e8a83":[5,0,1,0,21,7],
"read__tsplib_8py.html#a2daed7ee839f51ee46cc0ccc7db4e53d":[5,0,1,0,21,9],
"read__tsplib_8py.html#a2fb1c5cf58867b5bbc9a1b145a86f3a0":[5,0,1,0,21,15],
"read__tsplib_8py.html#a305b277ecdf7f19d7e5a72d2028db567":[5,0,1,0,21,10],
"read__tsplib_8py.html#a33865a2f7dd8e7688565b5e28ac1601c":[5,0,1,0,21,5],
"read__tsplib_8py.html#a43d1e4fd1f3d914866e6e73989e48ae3":[5,0,1,0,21,11],
"read__tsplib_8py.html#a88e3a38f270249add266aa2780114177":[5,0,1,0,21,2],
"read__tsplib_8py.html#a9336ebf25087d91c818ee6e9ec29f8c1":[5,0,1,0,21,14],
"read__tsplib_8py.html#aaf6a3698f4027c36fee95e42f5864e42":[5,0,1,0,21,1],
"read__tsplib_8py.html#ab90364b5487bd13b5c43240fec3ae35c":[5,0,1,0,21,4],
"read__tsplib_8py.html#abd69475a428eb2a524cbf6ba33ae22d5":[5,0,1,0,21,3],
"read__tsplib_8py.html#ac0055fa4cdc19a2690bfee3643413a7d":[5,0,1,0,21,12],
"read__tsplib_8py.html#acdb504e9220eb22cb126f2f8b92b366a":[5,0,1,0,21,6],
"read__tsplib_8py.html#add2b964de67d04e5dd9dec62d300b9f7":[5,0,1,0,21,0],
"read__tsplib_8py.html#ae0323a9039add2978bf5b49550572c7c":[5,0,1,0,21,13],
"read__tsplib_8py.html#af192721cc650deed1513905f193f6d1d":[5,0,1,0,21,8],
"read__tsplib_8py_source.html":[5,0,1,0,21],
"relax_8pxi.html":[5,0,2,0,13],
"relax_8pxi.html#a00209e1c5706fb67b080ee64adb3ddbd":[5,0,2,0,13,7],
"relax_8pxi.html#a099bd5646e93cbaca89d1735d1130d71":[5,0,2,0,13,4],
"relax_8pxi.html#a54eace03f13e0ce322c86e5f72c820ce":[5,0,2,0,13,3],
"relax_8pxi.html#a88a4e83762f43f8a9343ff982dc2f2c3":[5,0,2,0,13,8],
"relax_8pxi.html#aa7fb1166b6738f5e97ee207474f38932":[5,0,2,0,13,2],
"relax_8pxi.html#abca4daf086e9e25be7f0be54559befe1":[5,0,2,0,13,5],
"relax_8pxi.html#abed1e838c9a55855ae57a39db58e503b":[5,0,2,0,13,1],
"relax_8pxi.html#ad0d4866f781d2cff895c1cf32f213232":[5,0,2,0,13,6],
"relax_8pxi_source.html":[5,0,2,0,13],
"scip_8pxd.html":[5,0,2,0,14],
"scip_8pxd.html#a00770fbfbc98bc3649245f96b69946d8":[5,0,2,0,14,135],
"scip_8pxd.html#a00df5c3b11bd486091f72ab8cf5fea26":[5,0,2,0,14,6],
"scip_8pxd.html#a01dbd88c58842366d22b830bd4615f3e":[5,0,2,0,14,113],
"scip_8pxd.html#a01e9d5cdf300ca66130eea1bc026b482":[5,0,2,0,14,167],
"scip_8pxd.html#a022ef50379f61f2e955adb449639d549":[5,0,2,0,14,74],
"scip_8pxd.html#a025696ecaa053237486559b3e1a3dbc9":[5,0,2,0,14,46],
"scip_8pxd.html#a03814fa1fbd4db32b9ebc7489141ac17":[5,0,2,0,14,150],
"scip_8pxd.html#a048cdfc5660ec532680cf8c00e8ec7f8":[5,0,2,0,14,92],
"scip_8pxd.html#a06bf3913509de7fe91f91b1a5bdac1e2":[5,0,2,0,14,45],
"scip_8pxd.html#a0783f0ccc285c36153d527a6ce6abe8a":[5,0,2,0,14,204],
"scip_8pxd.html#a07bb3f62d2b590d5e4f09858d38504a5":[5,0,2,0,14,28],
"scip_8pxd.html#a07d78d495914ba0a92aebfb14e60fbfc":[5,0,2,0,14,60],
"scip_8pxd.html#a080ae4f36bbcafa19a0bba2638d459d0":[5,0,2,0,14,161],
"scip_8pxd.html#a096bde05a33db9075661dc6003bda709":[5,0,2,0,14,163],
"scip_8pxd.html#a0997a2af675ce527a1a10dec7061c499":[5,0,2,0,14,47],
"scip_8pxd.html#a0a27150206ede62b2cfcdd08311a0c8c":[5,0,2,0,14,38],
"scip_8pxd.html#a0f17f6a25c3bf5cd971d97453e2a28c4":[5,0,2,0,14,123],
"scip_8pxd.html#a11540453d4ec7a25e66fd6e7795d6136":[5,0,2,0,14,177],
"scip_8pxd.html#a12ed8a8ebd12ac2e210d6587f58a6c74":[5,0,2,0,14,184],
"scip_8pxd.html#a15e7177387f4e91a1e5044d62a52a972":[5,0,2,0,14,85],
"scip_8pxd.html#a197e810cb9e6cf788098a5f30aff7952":[5,0,2,0,14,43],
"scip_8pxd.html#a19a3f1c966cdd07875040e0b9dc8b6a3":[5,0,2,0,14,73],
"scip_8pxd.html#a1e696fa6537f9bd25165258aabe0f58d":[5,0,2,0,14,33],
"scip_8pxd.html#a1f978fa51f66bac6c22f3121594b18ef":[5,0,2,0,14,54],
"scip_8pxd.html#a1fecde7e924d6b5a5789717f7af7b177":[5,0,2,0,14,9],
"scip_8pxd.html#a20cb546b1f2f24276134a6829341547c":[5,0,2,0,14,114],
"scip_8pxd.html#a215c4bced2a5334e731a5a9ae349a5c0":[5,0,2,0,14,146],
"scip_8pxd.html#a2169d26fa56db326fb5bcfa2e9a68101":[5,0,2,0,14,201],
"scip_8pxd.html#a241bd83b4d4358ee226b483494af38d9":[5,0,2,0,14,64],
"scip_8pxd.html#a2733c06f47d2bf99a8c0ab15eeeecaa4":[5,0,2,0,14,34],
"scip_8pxd.html#a28be3c2bb41e29dcb3f52598e3ce7c4c":[5,0,2,0,14,87],
"scip_8pxd.html#a29403576259762b807c1d86d3c2f95bb":[5,0,2,0,14,19],
"scip_8pxd.html#a295d654ee75a33ed6cea556552816beb":[5,0,2,0,14,98],
"scip_8pxd.html#a2ad744c63f6af21200ed3c10b28b9528":[5,0,2,0,14,168],
"scip_8pxd.html#a2c1afb357a10f5d8a823cb78ce6f1ff6":[5,0,2,0,14,132],
"scip_8pxd.html#a2c348ea4913444973405944e83f129d8":[5,0,2,0,14,205],
"scip_8pxd.html#a2ddbde7cfae870aad55738528f39911a":[5,0,2,0,14,118],
"scip_8pxd.html#a2e19f1912961df4563141b0d92d8ea2e":[5,0,2,0,14,77],
"scip_8pxd.html#a317558aba23fd78914094e08e4be165d":[5,0,2,0,14,112],
"scip_8pxd.html#a354e7f237ea3dcc090351f2ada28fefb":[5,0,2,0,14,122],
"scip_8pxd.html#a36d57cbfb61db6a2a8d5b943b8bfd6eb":[5,0,2,0,14,145],
"scip_8pxd.html#a373a10974a45d6c577dbdab5a98e864e":[5,0,2,0,14,96],
"scip_8pxd.html#a39fa4a28d630c1935b9f5dd533de6b7b":[5,0,2,0,14,105],
"scip_8pxd.html#a39fbb211b5a28143f41f7c81b268f103":[5,0,2,0,14,187],
"scip_8pxd.html#a3b17d20bb2c21eb901df97e39fd7c0db":[5,0,2,0,14,108],
"scip_8pxd.html#a3b733d904af717b9aa8d49d8b3a32346":[5,0,2,0,14,101],
"scip_8pxd.html#a3b9939f7fb8acdf1c6010279bc7a1784":[5,0,2,0,14,138],
"scip_8pxd.html#a3d063a6d327b36c2b715acc806e40d99":[5,0,2,0,14,71],
"scip_8pxd.html#a3ed42c39df46644eb0b8ad9812da2f06":[5,0,2,0,14,35],
"scip_8pxd.html#a40e6e550876f25ce21f0ea516c2256e3":[5,0,2,0,14,56],
"scip_8pxd.html#a42597b3e8d8bfed18fdab26b6dbaf39d":[5,0,2,0,14,82],
"scip_8pxd.html#a44733d9d64b62bf13c600578c41f01e5":[5,0,2,0,14,94],
"scip_8pxd.html#a472c394cd04acaaece26c4b73084874e":[5,0,2,0,14,12],
"scip_8pxd.html#a480a268c6831be1e69d61d3adb8d4721":[5,0,2,0,14,199],
"scip_8pxd.html#a486ea5f11edcdb02bde21523e01e74ab":[5,0,2,0,14,208],
"scip_8pxd.html#a48a183a2e6df112d8d3b6864d19b34e6":[5,0,2,0,14,42],
"scip_8pxd.html#a49ccce825b510626b1dd5b43c9664dbd":[5,0,2,0,14,183],
"scip_8pxd.html#a4aee8fa2ff0805e0a5110bac59dc9a85":[5,0,2,0,14,124],
"scip_8pxd.html#a4b3d6b264c334c37c199f319cfac2b4e":[5,0,2,0,14,207],
"scip_8pxd.html#a4c97381448c8d251c324ed0e95b75756":[5,0,2,0,14,53],
"scip_8pxd.html#a508aac2bcc04431c85c897c6ca7a61a8":[5,0,2,0,14,144]
};
| 63.889764 | 76 | 0.78913 |
0220d32becba6e4887779ebd12efd4f57c69eae8 | 1,893 | js | JavaScript | files/qoopido.js/3.5.5/base.js | ppavlov/jsdelivr | 46792341a2ab74902e2455daa6137f961087d921 | [
"MIT"
] | 5 | 2015-02-20T16:11:30.000Z | 2017-05-15T11:50:44.000Z | files/qoopido.js/3.5.5/base.js | ppavlov/jsdelivr | 46792341a2ab74902e2455daa6137f961087d921 | [
"MIT"
] | null | null | null | files/qoopido.js/3.5.5/base.js | ppavlov/jsdelivr | 46792341a2ab74902e2455daa6137f961087d921 | [
"MIT"
] | 4 | 2015-07-14T16:16:05.000Z | 2021-03-10T08:15:54.000Z | /*!
* Qoopido.js library v3.5.5, 2014-9-30
* https://github.com/dlueth/qoopido.js
* (c) 2014 Dirk Lueth
* Dual licensed under MIT and GPL
*/
!function(e,t,r,o,n,c){"use strict";function i(e,t,i,u){var s,f=e.split("/");return d[e]?d[e]:(s=function(){if(i)for(var s,g,y=f.slice(0,-1).join("/"),j=0;(s=i[j])!==c;j++)g=l.test(s),g&&(s=p(y+"/"+s)),!d[s]&&arguments[j]&&(d[s]=arguments[j]),g&&!d[s]&&"undefined"!=typeof console&&console.error("".concat("[Qoopido.js] ",e,": Could not load dependency ",s));return d[e]=t(d,a,f,r,o,n,c),u&&u(d[e]),d[e]},void("undefined"!=typeof module&&module.exports?module.exports=define(s):"function"==typeof define&&define.amd?i?define(i,s):define(s):s()))}function u(e,t,r){i(e,t,r,function(t){d[e]=t.create()})}function p(e){for(var t;(t=e.replace(g,""))!==e;)e=t;return e.replace(y,"")}var s=t.qoopido||(t.qoopido={register:i,registerSingleton:u}),a=s.shared||(s.shared={}),d=s.modules||(s.modules={}),f=[],l=new RegExp("^\\.+\\/"),g=new RegExp("(?:\\/|)[^\\/]*\\/\\.\\."),y=new RegExp("(^\\/)|\\.\\/","g");Object.create||f.push("./polyfill/object/create"),Object.getOwnPropertyNames||f.push("./polyfill/object/getownpropertynames"),Object.getOwnPropertyDescriptor&&function(){try{return Object.getOwnPropertyDescriptor({x:0},"x"),!0}catch(e){return!1}}()||f.push("./polyfill/object/getownpropertydescriptor"),i("base",e,f)}(function(e,t,r,o,n,c,i){"use strict";function u(e){for(var t,r={},o=Object.getOwnPropertyNames(e),n=0;(t=o[n])!==i;n++)r[t]=Object.getOwnPropertyDescriptor(e,t);return r}function p(){throw new Error("[Qoopido.js] Operation prohibited")}return{create:function(){var e,t=Object.create(this,u(this));return t._constructor&&(e=t._constructor.apply(t,arguments)),t.create=t.extend=p,e||t},extend:function(e,t){var r;return e=e||{},t=t===!0,e._parent=this,r=Object.create(this,u(e)),t===!0&&(r.extend=p),r}}},this,navigator,window,document); | 270.428571 | 1,752 | 0.65663 |
02212117d3e2e0965096c44761e1a4d207fcb6de | 2,745 | js | JavaScript | src/server/controllers/SessionController.js | LIGL06/RunaTest | 6545bfd589d6cf7f619b94a8f620ac1d6df876a8 | [
"MIT"
] | null | null | null | src/server/controllers/SessionController.js | LIGL06/RunaTest | 6545bfd589d6cf7f619b94a8f620ac1d6df876a8 | [
"MIT"
] | null | null | null | src/server/controllers/SessionController.js | LIGL06/RunaTest | 6545bfd589d6cf7f619b94a8f620ac1d6df876a8 | [
"MIT"
] | null | null | null | import jwt from 'jsonwebtoken';
import Router from 'koa-router';
import moment from 'moment-timezone';
import bcrypt from 'bcrypt';
import {
logger
} from '../modules';
import User from '../models/User';
require('dotenv')
.config();
const SessionController = Router({
prefix: '/session'
});
SessionController.post('/register', async (ctx) => {
const payload = {
...ctx.request.body
};
const [user] = await User.get({
email: payload.email
});
if (!user) {
await new Promise((resolve, reject) => {
bcrypt.hash(payload.password, 10, async (err, hash) => {
if (err) reject(err);
const userFields = {
legalName: payload.legalName,
legalRfc: payload.legalRfc,
password: hash,
email: payload.email,
created_at: moment.tz('America/Monterrey')
.format('YYYY-MM-DD HH:mm:ss'),
admin: false
};
try {
await User.create(userFields);
logger.info('New user registration', {
...userFields
});
ctx.body = {
...userFields
};
resolve();
} catch {
reject(new Error('Create User Error'));
}
});
});
} else {
ctx.status = 401;
ctx.body = {
error: 'Usuario registrado'
};
}
});
SessionController.post('/login', async (ctx) => {
const payload = {
...ctx.request.body
};
if (!ctx.request.body.password) {
ctx.status = 401;
ctx.body = {
error: 'No password sent'
};
return;
}
let status = false;
const [user] = await User.get({
email: payload.email
});
if (!user) {
ctx.status = 401;
ctx.body = {
error: 'Invalid credentials'
};
return;
}
const session = {
user: {
id: user.id,
legalName: user.legalName,
legalRfc: user.legalRfc,
email: user.email,
admin: user.admin
}
};
await new Promise((resolve, reject) => {
bcrypt.compare(payload.password, user.password).then((res) => {
if (res) {
status = true;
jwt.sign(session, process.env.JWT_SIGN, {
expiresIn: '2h'
}, (err, token) => {
if (err) reject(err);
logger.info(`Session created: ${ session.user.legalName }, ${ session.user.legalRfc }`);
ctx.body = {
session,
token
};
resolve();
});
} else {
ctx.status = 401;
ctx.body = {
error: 'Invalid credentials'
};
resolve();
}
});
});
});
export default SessionController;
| 23.461538 | 99 | 0.502004 |
02213fc61ba952803797dd80987d466ffb875cce | 5,247 | js | JavaScript | js/filter.js | scottchen625/CareLoveFinal | c2bfdc6bc31756d4a904b6de31dc09b2db73516c | [
"MIT"
] | null | null | null | js/filter.js | scottchen625/CareLoveFinal | c2bfdc6bc31756d4a904b6de31dc09b2db73516c | [
"MIT"
] | null | null | null | js/filter.js | scottchen625/CareLoveFinal | c2bfdc6bc31756d4a904b6de31dc09b2db73516c | [
"MIT"
] | null | null | null | $(document).ready(function() {
localStorage.setItem('filterPageVisited', 1);
var minAgeWarning = document.getElementById("min-age-warning");
minAgeWarning.style.display = "none";
var minMaxWarning = document.getElementById("min-max-warning");
minMaxWarning.style.display = "none";
});
$("#searchButton").click(function() {
var minMaxWarning = document.getElementById("min-max-warning");
var minAgeWarning = document.getElementById("min-age-warning");
minMaxWarning.style.display = "none";
minAgeWarning.style.display = "none";
var minAge = document.getElementById("minAge").value;
var maxAge = document.getElementById("maxAge").value;
if (document.getElementById("priceOption1").checked) {
var priceRange = document.getElementById("priceOption1").value;
}
else if (document.getElementById("priceOption2").checked) {
var priceRange = document.getElementById("priceOption2").value;
}
else if (document.getElementById("priceOption3").checked) {
var priceRange = document.getElementById("priceOption3").value;
}
else if (document.getElementById("priceOption4").checked) {
var priceRange = document.getElementById("priceOption4").value;
}
else {
var priceRange = document.getElementById("priceOption5").value;
}
if (document.getElementById("locationOption1").checked) {
var locationDistance = document.getElementById("locationOption1").value;
}
else if (document.getElementById("locationOption2").checked) {
var locationDistance = document.getElementById("locationOption2").value;
}
else if (document.getElementById("locationOption3").checked) {
var locationDistance = document.getElementById("locationOption3").value;
}
else if (document.getElementById("locationOption4").checked) {
var locationDistance = document.getElementById("locationOption4").value;
}
else {
var locationDistance = document.getElementById("locationOption5").value;
}
if(document.getElementById("GenderMale").checked) {
var gender = document.getElementById("GenderMale").value;
}
else if (document.getElementById("GenderFemale").checked) {
var gender = document.getElementById("GenderFemale").value;
}
else {
var gender = document.getElementById("GenderBoth").value;
}
localStorage.setItem('minAge', minAge);
localStorage.setItem('maxAge', maxAge);
localStorage.setItem('priceRange', priceRange);
localStorage.setItem('locationDistance', locationDistance);
localStorage.setItem('gender', gender);
if(minAge >= 18 && maxAge >= 18) {
if(minAge > maxAge) {
minMaxWarning.style.display = "block";
} else {
window.location.href = "home.html";
}
} else {
minAgeWarning.style.display = "block";
if(minAge > maxAge) {
minMaxWarning.style.display = "block";
}
}
});
$("#filterBackButton").click(function() {
var minMaxWarning = document.getElementById("min-max-warning");
var minAgeWarning = document.getElementById("min-age-warning");
minMaxWarning.style.display = "none";
minAgeWarning.style.display = "none";
var minAge = document.getElementById("minAge").value;
var maxAge = document.getElementById("maxAge").value;
if (document.getElementById("priceOption1").checked) {
var priceRange = document.getElementById("priceOption1").value;
}
else if (document.getElementById("priceOption2").checked) {
var priceRange = document.getElementById("priceOption2").value;
}
else if (document.getElementById("priceOption3").checked) {
var priceRange = document.getElementById("priceOption3").value;
}
else if (document.getElementById("priceOption4").checked) {
var priceRange = document.getElementById("priceOption4").value;
}
else {
var priceRange = document.getElementById("priceOption5").value;
}
if (document.getElementById("locationOption1").checked) {
var locationDistance = document.getElementById("locationOption1").value;
}
else if (document.getElementById("locationOption2").checked) {
var locationDistance = document.getElementById("locationOption2").value;
}
else if (document.getElementById("locationOption3").checked) {
var locationDistance = document.getElementById("locationOption3").value;
}
else if (document.getElementById("locationOption4").checked) {
var locationDistance = document.getElementById("locationOption4").value;
}
else {
var locationDistance = document.getElementById("locationOption5").value;
}
if(document.getElementById("GenderMale").checked) {
var gender = document.getElementById("GenderMale").value;
}
else if (document.getElementById("GenderFemale").checked) {
var gender = document.getElementById("GenderFemale").value;
}
else {
var gender = document.getElementById("GenderBoth").value;
}
localStorage.setItem('minAge', minAge);
localStorage.setItem('maxAge', maxAge);
localStorage.setItem('priceRange', priceRange);
localStorage.setItem('locationDistance', locationDistance);
localStorage.setItem('gender', gender);
if(minAge >= 18 && maxAge >= 18) {
if(minAge > maxAge) {
minMaxWarning.style.display = "block";
} else {
window.location.href = "home.html";
}
} else {
minAgeWarning.style.display = "block";
if(minAge > maxAge) {
minMaxWarning.style.display = "block";
}
}
}); | 33.208861 | 76 | 0.731084 |
02227b4d543996d4570f5d05bc379afe7e95a11e | 3,032 | js | JavaScript | node_modules/gulp-autoprefixer/node_modules/autoprefixer/node_modules/postcss/lib/at-rule.js | ranchodeluxemedia/old-bones | af7fc12a41d42a03287aa89901f38011777736ce | [
"WTFPL"
] | 62 | 2015-01-03T07:36:55.000Z | 2022-03-04T02:03:02.000Z | node_modules/gulp-autoprefixer/node_modules/autoprefixer/node_modules/postcss/lib/at-rule.js | ranchodeluxemedia/old-bones | af7fc12a41d42a03287aa89901f38011777736ce | [
"WTFPL"
] | 17 | 2015-02-27T14:28:38.000Z | 2022-01-10T14:01:10.000Z | node_modules/gulp-autoprefixer/node_modules/autoprefixer/node_modules/postcss/lib/at-rule.js | ranchodeluxemedia/old-bones | af7fc12a41d42a03287aa89901f38011777736ce | [
"WTFPL"
] | 7 | 2015-04-29T00:37:02.000Z | 2022-02-19T15:27:16.000Z | var Container = require('./container');
// CSS at-rule like โthis.keyframes name { }โ.
//
// Can contain declarations (like this.font-face or this.page) ot another rules.
var AtRule = (function(super$0){var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,Object.getOwnPropertyDescriptor(s,p));}}return t};"use strict";MIXIN$0(AtRule, super$0);
function AtRule(defaults) {
this.type = 'atrule';
super$0.call(this, defaults);
}AtRule.prototype = Object.create(super$0.prototype, {"constructor": {"value": AtRule, "configurable": true, "writable": true} });DP$0(AtRule, "prototype", {"configurable": false, "enumerable": false, "writable": false});
// Different style for this.encoding and this.page at-rules.
AtRule.prototype.styleType = function() {
return this.type + ((this.rules || this.decls) ? '-body' : '-bodiless');
}
AtRule.prototype.defaultStyle = function(type) {
if ( type == 'atrule-body' ) {
return { between: ' ', after: this.defaultAfter() };
} else {
return { between: '' };
}
}
// Load into at-rule mixin for selected content type
AtRule.prototype.addMixin = function(type) {
var mixin = type == 'rules' ? Container.WithRules : Container.WithDecls;
if ( !mixin ) return;
for ( var name in mixin.prototype ) {
if ( name == 'constructor' ) continue;
var value = mixin.prototype[name];
var container = Container.prototype[name] == value;
var detector = name == 'append' || name == 'prepend';
if ( container && !detector ) continue;
this[name] = value;
}
mixin.apply(this);
}
// Stringify at-rule
AtRule.prototype.stringify = function(builder, last) {
var style = this.style();
var name = '@' + this.name;
var params = this.params ? this.stringifyRaw('params') : '';
if ( typeof(this.afterName) != 'undefined' ) {
name += this.afterName;
} else if ( params ) {
name += ' ';
}
if ( this.rules || this.decls ) {
this.stringifyBlock(builder, name + params + style.between + '{');
} else {
if ( this.before ) builder(this.before);
var semicolon = (!last || this.semicolon) ? ';' : '';
builder(name + params + style.between + semicolon, this);
}
}
// Hack to detect container type by child type
AtRule.prototype.append = function(child) {
var mixin = child.type == 'decl' ? 'decls' : 'rules';
this.addMixin(mixin);
return this.append(child);
}
// Hack to detect container type by child type
AtRule.prototype.prepend = function(child) {
var mixin = child.type == 'decl' ? 'decls' : 'rules';
this.addMixin(mixin);
return this.prepend(child);
}
;return AtRule;})(Container);
module.exports = AtRule;
| 36.97561 | 230 | 0.579815 |