From d7ad3fbadc5dfb0160647744bfbb1831ed42ba36 Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Thu, 12 Oct 2023 11:19:26 +0200 Subject: [PATCH] Compatibility with Asciidoctor.js 3.x --- .github/workflows/build.yml | 4 +- dist/index.cjs | 1226 +- dist/index.esm.js | 1228 +- dist/index.umd.js | 1232 +- package-lock.json | 7578 +-- package.json | 25 +- tasks/build.js | 2 +- tasks/builder.js | 19 +- .../bin/{mock-server.js => mock-server.cjs} | 0 test/browser/index.esm.html | 3 +- test/browser/index.umd.html | 3 +- .../{mock-server.js => mock-server.cjs} | 6 +- test/browser/rollup.config.js | 13 + test/browser/{run.js => run.cjs} | 4 +- test/browser/spec.esm.js | 4 +- test/browser/spec.umd.js | 45736 +++++++++++++++- test/browser/{util.js => util.cjs} | 2 +- test/shared/{spec.js => spec.cjs} | 0 test/{spec.js => spec.cjs} | 5 +- 19 files changed, 49672 insertions(+), 7418 deletions(-) rename test/browser/bin/{mock-server.js => mock-server.cjs} (100%) rename test/browser/{mock-server.js => mock-server.cjs} (92%) create mode 100644 test/browser/rollup.config.js rename test/browser/{run.js => run.cjs} (96%) rename test/browser/{util.js => util.cjs} (98%) rename test/shared/{spec.js => spec.cjs} (100%) rename test/{spec.js => spec.cjs} (90%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 367148e..3bcb779 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,8 +15,8 @@ jobs: os: - ubuntu-latest node-version: - - 12.x - - 14.x + - 16 + - 18 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 diff --git a/dist/index.cjs b/dist/index.cjs index ad4bb74..142d6c9 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -3,172 +3,161 @@ const AsciidoctorDocBook = {}; function register () { -/* Generated by Opal 0.11.99.dev */ -(function(Opal) { - function $rb_minus(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); - } - function $rb_gt(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); - } - function $rb_plus(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); - } - var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; +Opal.queue(function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $hash2 = Opal.hash2, $regexp = Opal.regexp, $def = Opal.def, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $rb_plus = Opal.rb_plus, $send = Opal.send, $alias = Opal.alias, $rb_gt = Opal.rb_gt, $return_val = Opal.return_val, $rb_minus = Opal.rb_minus, $to_ary = Opal.to_ary, $gvars = Opal.gvars, $not = Opal.not, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; - Opal.add_stubs(['$register_for', '$default=', '$-', '$init_backend_traits', '$attr?', '$<<', '$attr', '$==', '$doctype', '$common_attributes', '$id', '$noheader', '$document_info_tag', '$empty?', '$docinfo', '$blocks?', '$content', '$join', '$document', '$[]', '$sectname', '$special', '$option?', '$title', '$role', '$reftext', '$title_tag', '$enclose_content', '$title?', '$each', '$items', '$text', '$style', '$text?', '$level', '$image_uri', '$alt', '$!', '$key?', '$attributes', '$to_i', '$index', '$subs', '$delete_at', '$>', '$insert', '$unshift', '$asciimath_available?', '$to_mathml', '$parse', '$===', '$parent', '$warn', '$logger', '$context', '$error', '$content_model', '$blockquote_tag', '$has_role?', '$include?', '$columns', '$to_h', '$rows', '$colspan', '$column', '$+', '$rowspan', '$type', '$target', '$inspect', '$icon_uri', '$map', '$size', '$chop', '$private', '$gsub', '$strip', '$squeeze', '$firstname', '$sub_replacements', '$middlename', '$lastname', '$email', '$notitle', '$subtitle?', '$doctitle', '$main', '$subtitle', '$=~', '$header?', '$authors', '$author_tag', '$initials', '$cover_tag', '$new', '$load_asciimath', '$nil?', '$require_library']); + Opal.add_stubs('register_for,default=,init_backend_traits,attr?,<<,attr,==,doctype,size,id,noheader,document_info_tag,apply_reftext_subs,+,map,empty?,docinfo,blocks?,content,id=,insert,common_attributes,join,content_only,document,[],sectname,option?,special,title,role,reftext,title_tag,enclose_content,skip,title?,each,items,text,style,text?,level,image_uri,alt,!,key?,attributes,to_i,index,subs,delete_at,>,unshift,asciimath_available?,to_mathml,parse,parent,warn,logger,context,error,content_model,blockquote_tag,has_role?,include?,columns,to_h,rows,colspan,column,-,rowspan,type,target,nil_or_empty?,get_root_document,generate_document_id,inspect,icon_uri,chop,private,gsub,strip,squeeze,firstname,sub_replacements,middlename,lastname,email,notitle,subtitle?,doctitle,main,subtitle,=~,header?,authors,author_tag,initials,cover_tag,nested?,parent_document,new,load_asciimath,nil?,require_library'); return (function($base, $parent_nesting) { var self = $module($base, 'Asciidoctor'); - var $nesting = [self].concat($parent_nesting); + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); - (function($base, $super, $parent_nesting) { + return (function($base, $super, $parent_nesting) { var self = $klass($base, $super, 'DocBook5Converter'); - var $nesting = [self].concat($parent_nesting), $DocBook5Converter_initialize$1, $DocBook5Converter_convert_document$2, $DocBook5Converter_convert_section$3, $DocBook5Converter_convert_admonition$4, $DocBook5Converter_convert_colist$5, $DocBook5Converter_convert_dlist$7, $DocBook5Converter_convert_example$12, $DocBook5Converter_convert_floating_title$13, $DocBook5Converter_convert_image$14, $DocBook5Converter_convert_listing$15, $DocBook5Converter_convert_literal$16, $DocBook5Converter_convert_stem$17, $DocBook5Converter_convert_olist$18, $DocBook5Converter_convert_open$20, $DocBook5Converter_convert_page_break$21, $DocBook5Converter_convert_paragraph$22, $DocBook5Converter_convert_preamble$23, $DocBook5Converter_convert_quote$24, $DocBook5Converter_convert_thematic_break$26, $DocBook5Converter_convert_sidebar$27, $DocBook5Converter_convert_table$28, $DocBook5Converter_convert_ulist$34, $DocBook5Converter_convert_verse$37, $DocBook5Converter_convert_inline_anchor$39, $DocBook5Converter_convert_inline_break$40, $DocBook5Converter_convert_inline_button$41, $DocBook5Converter_convert_inline_callout$42, $DocBook5Converter_convert_inline_footnote$43, $DocBook5Converter_convert_inline_image$44, $DocBook5Converter_convert_inline_indexterm$45, $DocBook5Converter_convert_inline_kbd$47, $DocBook5Converter_convert_inline_menu$48, $DocBook5Converter_convert_inline_quoted$49, $DocBook5Converter_common_attributes$50, $DocBook5Converter_author_tag$51, $DocBook5Converter_document_info_tag$52, $DocBook5Converter_enclose_content$55, $DocBook5Converter_title_tag$56, $DocBook5Converter_cover_tag$57, $DocBook5Converter_blockquote_tag$58, $DocBook5Converter_asciimath_available$ques$59, $DocBook5Converter_load_asciimath$60, $writer = nil; + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; - self.$$prototype.asciimath_status = nil; + $proto.asciimath_status = nil; self.$register_for("docbook5"); - - $writer = [$hash2(["list", "entry", "term", "item"], {"list": "variablelist", "entry": "varlistentry", "term": "term", "item": "listitem"})]; - $send(Opal.const_set($nesting[0], 'DLIST_TAGS', $hash2(["qanda", "glossary"], {"qanda": $hash2(["list", "entry", "label", "term", "item"], {"list": "qandaset", "entry": "qandaentry", "label": "question", "term": "simpara", "item": "answer"}), "glossary": $hash2(["list", "entry", "term", "item"], {"list": nil, "entry": "glossentry", "term": "glossterm", "item": "glossdef"})})), 'default=', Opal.to_a($writer)); - $writer[$rb_minus($writer["length"], 1)]; - $writer = [["", "", true]]; - $send(Opal.const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript"], {"monospaced": ["", ""], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["", "", true], "single": ["", "", true], "mark": ["", ""], "superscript": ["", ""], "subscript": ["", ""]})), 'default=', Opal.to_a($writer)); - $writer[$rb_minus($writer["length"], 1)]; Opal.const_set($nesting[0], 'MANPAGE_SECTION_TAGS', $hash2(["section", "synopsis"], {"section": "refsection", "synopsis": "refsynopsisdiv"})); - Opal.const_set($nesting[0], 'TABLE_PI_NAMES', ["dbhtml", "dbfo", "dblatex"]); - Opal.const_set($nesting[0], 'CopyrightRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?)(?: ((?:\\d{4}\\-)?\\d{4}))?$")); - Opal.const_set($nesting[0], 'ImageMacroRx', new RegExp("" + "^image::?(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); - - Opal.def(self, '$initialize', $DocBook5Converter_initialize$1 = function $$initialize(backend, opts) { + $const_set($nesting[0], 'DLIST_TAGS', $hash2(["qanda", "glossary"], {"qanda": $hash2(["list", "entry", "label", "term", "item"], {"list": "qandaset", "entry": "qandaentry", "label": "question", "term": "simpara", "item": "answer"}), "glossary": $hash2(["list", "entry", "term", "item"], {"list": nil, "entry": "glossentry", "term": "glossterm", "item": "glossdef"})}))['$default=']($hash2(["list", "entry", "term", "item"], {"list": "variablelist", "entry": "varlistentry", "term": "term", "item": "listitem"})); + $const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript"], {"monospaced": ["", ""], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["", "", true], "single": ["", "", true], "mark": ["", ""], "superscript": ["", ""], "subscript": ["", ""]}))['$default='](["", "", true]); + $const_set($nesting[0], 'MANPAGE_SECTION_TAGS', $hash2(["section", "synopsis"], {"section": "refsection", "synopsis": "refsynopsisdiv"})); + $const_set($nesting[0], 'TABLE_PI_NAMES', ["dbhtml", "dbfo", "dblatex"]); + $const_set($nesting[0], 'CopyrightRx', $regexp(["^(", $$('CC_ANY'), "+?)(?: ((?:\\d{4}-)?\\d{4}))?$"])); + $const_set($nesting[0], 'ImageMacroRx', $regexp(["^image::?(\\S|\\S", $$('CC_ANY'), "*?\\S)\\[(", $$('CC_ANY'), "+)?\\]$"])); + + $def(self, '$initialize', function $$initialize(backend, opts) { var self = this; - - if (opts == null) { - opts = $hash2([], {}); - } self.backend = backend; + if (opts == null) opts = $hash2([], {}); + self.backend = backend; return self.$init_backend_traits($hash2(["basebackend", "filetype", "outfilesuffix", "supports_templates"], {"basebackend": "docbook", "filetype": "xml", "outfilesuffix": ".xml", "supports_templates": true})); - }, $DocBook5Converter_initialize$1.$$arity = -2); + }, -2); - Opal.def(self, '$convert_document', $DocBook5Converter_convert_document$2 = function $$convert_document(node) { - var self = this, result = nil, lang_attribute = nil, root_tag_name = nil, docinfo_content = nil; + $def(self, '$convert_document', function $$convert_document(node) { + var $a, $b, self = this, result = nil, lang_attribute = nil, root_tag_name = nil, manpage = nil, root_tag_idx = nil, id = nil, docinfo_content = nil; result = [""]; if ($truthy(node['$attr?']("toc"))) { - result['$<<']((function() {if ($truthy(node['$attr?']("toclevels"))) { - return "" + "" - } else { - return "" - } })());} if ($truthy(node['$attr?']("sectnums"))) { - result['$<<']((function() {if ($truthy(node['$attr?']("sectnumlevels"))) { - return "" + "" - } else { - return "" - } })());} lang_attribute = (function() {if ($truthy(node['$attr?']("nolang"))) { - return "" - } else { - return "" + " xml:lang=\"" + (node.$attr("lang", "en")) + "\"" - } })(); - if ((root_tag_name = node.$doctype())['$==']("manpage")) { - root_tag_name = "refentry";} result['$<<']("" + "<" + (root_tag_name) + " xmlns=\"http://docbook.org/ns/docbook\" xmlns:xl=\"http://www.w3.org/1999/xlink\" version=\"5.0\"" + (lang_attribute) + (self.$common_attributes(node.$id())) + ">"); - if ($truthy(node.$noheader())) ; else { + result['$<<'](($truthy(node['$attr?']("toclevels")) ? ("") : (""))); + } if ($truthy(node['$attr?']("sectnums"))) { + result['$<<'](($truthy(node['$attr?']("sectnumlevels")) ? ("") : (""))); + } lang_attribute = ($truthy(node['$attr?']("nolang")) ? ("") : (" xml:lang=\"" + (node.$attr("lang", "en")) + "\"")); + if ($eqeq((root_tag_name = node.$doctype()), "manpage")) { + + manpage = true; + root_tag_name = "article"; + } root_tag_idx = result.$size(); + id = node.$id(); + if (!$truthy(node.$noheader())) { result['$<<'](self.$document_info_tag(node)); - } if ($truthy((docinfo_content = node.$docinfo("header"))['$empty?']())) ; else { + } if ($truthy(manpage)) { + + result['$<<'](""); + result['$<<'](""); + if ($truthy(node['$attr?']("mantitle"))) { + result['$<<']("" + (node.$apply_reftext_subs(node.$attr("mantitle"))) + ""); + } if ($truthy(node['$attr?']("manvolnum"))) { + result['$<<']("" + (node.$attr("manvolnum")) + ""); + } result['$<<']("" + (node.$attr("mansource", " ")) + ""); + result['$<<']("" + (node.$attr("manmanual", " ")) + ""); + result['$<<'](""); + result['$<<'](""); + if ($truthy(node['$attr?']("mannames"))) { + result = $rb_plus(result, $send(node.$attr("mannames"), 'map', [], function $$1(n){ + + if (n == null) n = nil; + return "" + (n) + "";})); + } if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<']("" + (node.$attr("manpurpose")) + ""); + } result['$<<'](""); + } if (!$truthy((docinfo_content = node.$docinfo("header"))['$empty?']())) { result['$<<'](docinfo_content); } if ($truthy(node['$blocks?']())) { - result['$<<'](node.$content());} if ($truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) ; else { + result['$<<'](node.$content()); + } if (!$truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { result['$<<'](docinfo_content); - } result['$<<']("" + ""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_document$2.$$arity = 1); - Opal.alias(self, "convert_embedded", "content_only"); - - Opal.def(self, '$convert_section', $DocBook5Converter_convert_section$3 = function $$convert_section(node) { - var $a, self = this, tag_name = nil, title_el = nil; + } if ($truthy(manpage)) { + result['$<<'](""); + } if (!$truthy(id)) { + $a = [node.$id(), nil], (id = $a[0]), ($b = [$a[1]], $send(node, 'id=', $b), $b[$b.length - 1]); + } result.$insert(root_tag_idx, "<" + (root_tag_name) + " xmlns=\"http://docbook.org/ns/docbook\" xmlns:xl=\"http://www.w3.org/1999/xlink\" version=\"5.0\"" + (lang_attribute) + (self.$common_attributes(id)) + ">"); + result['$<<'](""); + return result.$join($$('LF')); + }); + $alias(self, "convert_embedded", "content_only"); + + $def(self, '$convert_section', function $$convert_section(node) { + var self = this, tag_name = nil, $ret_or_1 = nil, title_el = nil; - if (node.$document().$doctype()['$==']("manpage")) { - tag_name = ($truthy($a = $$($nesting, 'MANPAGE_SECTION_TAGS')['$[]']((tag_name = node.$sectname()))) ? $a : tag_name); + if ($eqeq(node.$document().$doctype(), "manpage")) { + tag_name = ($truthy(($ret_or_1 = $$('MANPAGE_SECTION_TAGS')['$[]']((tag_name = node.$sectname())))) ? ($ret_or_1) : (tag_name)); } else { tag_name = node.$sectname(); - } title_el = (function() {if ($truthy(($truthy($a = node.$special()) ? node['$option?']("untitled") : $a))) { - return "" - } else { - return "" + "" + (node.$title()) + "\n" - } })(); - return "" + "<" + (tag_name) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (title_el) + (node.$content()) + "\n" + ""; - }, $DocBook5Converter_convert_section$3.$$arity = 1); + } title_el = (($truthy(node.$special()) && (($truthy(node['$option?']("notitle")) || ($truthy(node['$option?']("untitled")))))) ? ("") : ("" + (node.$title()) + "\n")); + return "<" + (tag_name) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (title_el) + (node.$content()) + "\n" + ""; + }); - Opal.def(self, '$convert_admonition', $DocBook5Converter_convert_admonition$4 = function $$convert_admonition(node) { + $def(self, '$convert_admonition', function $$convert_admonition(node) { var self = this, tag_name = nil; - return "" + "<" + ((tag_name = node.$attr("name"))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - }, $DocBook5Converter_convert_admonition$4.$$arity = 1); - Opal.alias(self, "convert_audio", "skip"); + return "<" + ((tag_name = node.$attr("name"))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + }); + $alias(self, "convert_audio", "skip"); - Opal.def(self, '$convert_colist', $DocBook5Converter_convert_colist$5 = function $$convert_colist(node) { - var $$6, self = this, result = nil; + $def(self, '$convert_colist', function $$convert_colist(node) { + var self = this, result = nil; result = []; - result['$<<']("" + ""); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$6 = function(item){var self = $$6.$$s || this; - - + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$2(item){ - if (item == null) { - item = nil; - } result['$<<']("" + ""); - result['$<<']("" + "" + (item.$text()) + ""); + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$6.$$s = self, $$6.$$arity = 1, $$6)); + result['$<<'](item.$content()); + } return result['$<<']("");}); result['$<<'](""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_colist$5.$$arity = 1); + return result.$join($$('LF')); + }); - Opal.def(self, '$convert_dlist', $DocBook5Converter_convert_dlist$7 = function $$convert_dlist(node) { - var $$8, $$10, self = this, result = nil, tag_name = nil, tags = nil, list_tag = nil, entry_tag = nil, label_tag = nil, term_tag = nil, item_tag = nil; + $def(self, '$convert_dlist', function $$convert_dlist(node) { + var self = this, result = nil, tag_name = nil, tags = nil, list_tag = nil, entry_tag = nil, label_tag = nil, term_tag = nil, item_tag = nil; result = []; - if (node.$style()['$==']("horizontal")) { - - result['$<<']("" + "<" + ((tag_name = (function() {if ($truthy(node['$title?']())) { - return "table" - } else { - return "informaltable" - } })())) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + " tabstyle=\"horizontal\" frame=\"none\" colsep=\"0\" rowsep=\"0\">\n" + (self.$title_tag(node)) + "\n" + "\n" + "\n" + ""); - $send(node.$items(), 'each', [], ($$8 = function(terms, dd){var self = $$8.$$s || this, $$9; - + if ($eqeq(node.$style(), "horizontal")) { + result['$<<']("<" + ((tag_name = ($truthy(node['$title?']()) ? ("table") : ("informaltable")))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + " tabstyle=\"horizontal\" frame=\"none\" colsep=\"0\" rowsep=\"0\">\n" + (self.$title_tag(node)) + "\n" + "\n" + "\n" + ""); + $send(node.$items(), 'each', [], function $$3(terms, dd){ - if (terms == null) { - terms = nil; - } - if (dd == null) { - dd = nil; - } result['$<<']("" + "\n" + ""); - $send(terms, 'each', [], ($$9 = function(dt){var self = $$9.$$s || this; - - + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<']("\n" + ""); + $send(terms, 'each', [], function $$4(dt){ - if (dt == null) { - dt = nil; - } return result['$<<']("" + "" + (dt.$text()) + "");}, $$9.$$s = self, $$9.$$arity = 1, $$9)); - result['$<<']("" + "\n" + ""); + if (dt == null) dt = nil; + return result['$<<']("" + (dt.$text()) + "");}); + result['$<<']("\n" + ""); if ($truthy(dd)) { if ($truthy(dd['$text?']())) { - result['$<<']("" + "" + (dd.$text()) + "");} if ($truthy(dd['$blocks?']())) { - result['$<<'](dd.$content());}} return result['$<<']("" + "\n" + "");}, $$8.$$s = self, $$8.$$arity = 2, $$8)); - result['$<<']("" + "\n" + "\n" + ""); + result['$<<']("" + (dd.$text()) + ""); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } return result['$<<']("\n" + "");}); + result['$<<']("\n" + "\n" + ""); } else { - tags = $$($nesting, 'DLIST_TAGS')['$[]'](node.$style()); + tags = $$('DLIST_TAGS')['$[]'](node.$style()); list_tag = tags['$[]']("list"); entry_tag = tags['$[]']("entry"); label_tag = tags['$[]']("label"); @@ -176,149 +165,119 @@ function register () { item_tag = tags['$[]']("item"); if ($truthy(list_tag)) { - result['$<<']("" + "<" + (list_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"); + result['$<<']("<" + (list_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");}} $send(node.$items(), 'each', [], ($$10 = function(terms, dd){var self = $$10.$$s || this, $$11; - - + result['$<<']("" + (node.$title()) + ""); + } } $send(node.$items(), 'each', [], function $$5(terms, dd){ - if (terms == null) { - terms = nil; - } - if (dd == null) { - dd = nil; - } result['$<<']("" + "<" + (entry_tag) + ">"); + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<']("<" + (entry_tag) + ">"); if ($truthy(label_tag)) { - result['$<<']("" + "<" + (label_tag) + ">");} $send(terms, 'each', [], ($$11 = function(dt){var self = $$11.$$s || this; - - + result['$<<']("<" + (label_tag) + ">"); + } $send(terms, 'each', [], function $$6(dt){ - if (dt == null) { - dt = nil; - } return result['$<<']("" + "<" + (term_tag) + ">" + (dt.$text()) + "");}, $$11.$$s = self, $$11.$$arity = 1, $$11)); + if (dt == null) dt = nil; + return result['$<<']("<" + (term_tag) + ">" + (dt.$text()) + "");}); if ($truthy(label_tag)) { - result['$<<']("" + "");} result['$<<']("" + "<" + (item_tag) + ">"); + result['$<<'](""); + } result['$<<']("<" + (item_tag) + ">"); if ($truthy(dd)) { if ($truthy(dd['$text?']())) { - result['$<<']("" + "" + (dd.$text()) + "");} if ($truthy(dd['$blocks?']())) { - result['$<<'](dd.$content());}} result['$<<']("" + ""); - return result['$<<']("" + "");}, $$10.$$s = self, $$10.$$arity = 2, $$10)); + result['$<<']("" + (dd.$text()) + ""); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } result['$<<'](""); + return result['$<<']("");}); if ($truthy(list_tag)) { - result['$<<']("" + "");} } return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_dlist$7.$$arity = 1); + result['$<<'](""); + } } return result.$join($$('LF')); + }); - Opal.def(self, '$convert_example', $DocBook5Converter_convert_example$12 = function $$convert_example(node) { + $def(self, '$convert_example', function $$convert_example(node) { var self = this; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + (self.$enclose_content(node)) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + (self.$enclose_content(node)) + "\n" + "" } else { - return "" + "\n" + (self.$enclose_content(node)) + "\n" + "" + return "\n" + (self.$enclose_content(node)) + "\n" + "" } - }, $DocBook5Converter_convert_example$12.$$arity = 1); + }); - Opal.def(self, '$convert_floating_title', $DocBook5Converter_convert_floating_title$13 = function $$convert_floating_title(node) { + $def(self, '$convert_floating_title', function $$convert_floating_title(node) { var self = this; - return "" + "" + (node.$title()) + "" - }, $DocBook5Converter_convert_floating_title$13.$$arity = 1); + return "" + (node.$title()) + "" + }); - Opal.def(self, '$convert_image', $DocBook5Converter_convert_image$14 = function $$convert_image(node) { + $def(self, '$convert_image', function $$convert_image(node) { var self = this, width_attribute = nil, depth_attribute = nil, scale_attribute = nil, align_attribute = nil, mediaobject = nil; if ($truthy(node['$attr?']("scaledwidth"))) { - width_attribute = "" + " width=\"" + (node.$attr("scaledwidth")) + "\""; + width_attribute = " width=\"" + (node.$attr("scaledwidth")) + "\""; depth_attribute = ""; scale_attribute = ""; } else if ($truthy(node['$attr?']("scale"))) { - scale_attribute = "" + " scale=\"" + (node.$attr("scale")) + "\""; + scale_attribute = " scale=\"" + (node.$attr("scale")) + "\""; } else { - width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { - return "" + " contentwidth=\"" + (node.$attr("width")) + "\"" - } else { - return "" - } })(); - depth_attribute = (function() {if ($truthy(node['$attr?']("height"))) { - return "" + " contentdepth=\"" + (node.$attr("height")) + "\"" - } else { - return "" - } })(); + width_attribute = ($truthy(node['$attr?']("width")) ? (" contentwidth=\"" + (node.$attr("width")) + "\"") : ("")); + depth_attribute = ($truthy(node['$attr?']("height")) ? (" contentdepth=\"" + (node.$attr("height")) + "\"") : ("")); scale_attribute = ""; - } align_attribute = (function() {if ($truthy(node['$attr?']("align"))) { - return "" + " align=\"" + (node.$attr("align")) + "\"" - } else { - return "" - } })(); - mediaobject = "" + "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; + } align_attribute = ($truthy(node['$attr?']("align")) ? (" align=\"" + (node.$attr("align")) + "\"") : ("")); + mediaobject = "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + (mediaobject) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + (mediaobject) + "\n" + "" } else { - return "" + "\n" + (mediaobject) + "\n" + "" - } }, $DocBook5Converter_convert_image$14.$$arity = 1); + return "\n" + (mediaobject) + "\n" + "" + } }); - Opal.def(self, '$convert_listing', $DocBook5Converter_convert_listing$15 = function $$convert_listing(node) { + $def(self, '$convert_listing', function $$convert_listing(node) { var self = this, informal = nil, common_attrs = nil, attrs = nil, numbering_attrs = nil, wrapped_content = nil; informal = node['$title?']()['$!'](); common_attrs = self.$common_attributes(node.$id(), node.$role(), node.$reftext()); - if (node.$style()['$==']("source")) { + if ($eqeq(node.$style(), "source")) { if ($truthy((attrs = node.$attributes())['$key?']("linenums"))) { - numbering_attrs = (function() {if ($truthy(attrs['$key?']("start"))) { - return "" + " linenumbering=\"numbered\" startinglinenumber=\"" + (attrs['$[]']("start").$to_i()) + "\"" - } else { - return " linenumbering=\"numbered\"" - } })(); + numbering_attrs = ($truthy(attrs['$key?']("start")) ? (" linenumbering=\"numbered\" startinglinenumber=\"" + (attrs['$[]']("start").$to_i()) + "\"") : (" linenumbering=\"numbered\"")); } else { numbering_attrs = " linenumbering=\"unnumbered\""; } if ($truthy(attrs['$key?']("language"))) { - wrapped_content = "" + "" + (node.$content()) + ""; + wrapped_content = "" + (node.$content()) + ""; } else { - wrapped_content = "" + "" + (node.$content()) + ""; + wrapped_content = "" + (node.$content()) + ""; } } else { - wrapped_content = "" + "" + (node.$content()) + ""; + wrapped_content = "" + (node.$content()) + ""; } if ($truthy(informal)) { return wrapped_content } else { - return "" + "\n" + "" + (node.$title()) + "\n" + "\n" + (wrapped_content) + "\n" + "\n" + "" - } }, $DocBook5Converter_convert_listing$15.$$arity = 1); + return "\n" + "" + (node.$title()) + "\n" + "\n" + (wrapped_content) + "\n" + "\n" + "" + } }); - Opal.def(self, '$convert_literal', $DocBook5Converter_convert_literal$16 = function $$convert_literal(node) { + $def(self, '$convert_literal', function $$convert_literal(node) { var self = this; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + "\n" + "" + (node.$content()) + "\n" + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + "\n" + "" + (node.$content()) + "\n" + "\n" + "" } else { - return "" + "" + (node.$content()) + "" + return "" + (node.$content()) + "" } - }, $DocBook5Converter_convert_literal$16.$$arity = 1); - Opal.alias(self, "convert_pass", "content_only"); + }); + $alias(self, "convert_pass", "content_only"); - Opal.def(self, '$convert_stem', $DocBook5Converter_convert_stem$17 = function $$convert_stem(node) { - var $a, self = this, idx = nil, equation = nil, equation_data = nil; + $def(self, '$convert_stem', function $$convert_stem(node) { + var self = this, idx = nil, equation = nil, equation_data = nil; if ($truthy((idx = node.$subs().$index("specialcharacters")))) { node.$subs().$delete_at(idx); - equation = ($truthy($a = node.$content()) ? $a : ""); + equation = node.$content(); if ($truthy($rb_gt(idx, 0))) { node.$subs().$insert(idx, "specialcharacters"); @@ -326,479 +285,373 @@ function register () { node.$subs().$unshift("specialcharacters"); } } else { - equation = ($truthy($a = node.$content()) ? $a : ""); - } if (node.$style()['$==']("asciimath")) { - equation_data = (function() {if ($truthy(self['$asciimath_available?']())) { - - return $$$('::', 'AsciiMath').$parse(equation).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"})); - } else { - return "" + "" - } })(); + equation = node.$content(); + } if ($eqeq(node.$style(), "asciimath")) { + equation_data = ($truthy(self['$asciimath_available?']()) ? ($$$('AsciiMath').$parse(equation).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) : ("")); } else { - equation_data = "" + "\n" + ""; + equation_data = "\n" + ""; } if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + (equation_data) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + (equation_data) + "\n" + "" } else { - return "" + "\n" + (equation_data) + "\n" + "" - } }, $DocBook5Converter_convert_stem$17.$$arity = 1); + return "\n" + (equation_data) + "\n" + "" + } }); - Opal.def(self, '$convert_olist', $DocBook5Converter_convert_olist$18 = function $$convert_olist(node) { - var $$19, self = this, result = nil, num_attribute = nil, start_attribute = nil; + $def(self, '$convert_olist', function $$convert_olist(node) { + var self = this, result = nil, num_attribute = nil, start_attribute = nil; result = []; - num_attribute = (function() {if ($truthy(node.$style())) { - return "" + " numeration=\"" + (node.$style()) + "\"" - } else { - return "" - } })(); - start_attribute = (function() {if ($truthy(node['$attr?']("start"))) { - return "" + " startingnumber=\"" + (node.$attr("start")) + "\"" - } else { - return "" - } })(); - result['$<<']("" + ""); + num_attribute = ($truthy(node.$style()) ? (" numeration=\"" + (node.$style()) + "\"") : ("")); + start_attribute = ($truthy(node['$attr?']("start")) ? (" startingnumber=\"" + (node.$attr("start")) + "\"") : ("")); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$19 = function(item){var self = $$19.$$s || this; + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$7(item){var self = $$7.$$s == null ? this : $$7.$$s; - - if (item == null) { - item = nil; - } result['$<<']("" + ""); - result['$<<']("" + "" + (item.$text()) + ""); + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$19.$$s = self, $$19.$$arity = 1, $$19)); + result['$<<'](item.$content()); + } return result['$<<']("");}, {$$s: self}); result['$<<'](""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_olist$18.$$arity = 1); + return result.$join($$('LF')); + }); - Opal.def(self, '$convert_open', $DocBook5Converter_convert_open$20 = function $$convert_open(node) { - var $a, $b, self = this, $case = nil, id = nil, reftext = nil, role = nil, content_spacer = nil; + $def(self, '$convert_open', function $$convert_open(node) { + var self = this, id = nil, reftext = nil, role = nil, content_spacer = nil; - return (function() {$case = node.$style(); - if ("abstract"['$===']($case)) {if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) { - - self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); - return ""; - } else { - return "" + "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - }} - else if ("partintro"['$===']($case)) {if ($truthy(($truthy($a = (($b = node.$level()['$=='](0)) ? node.$parent().$context()['$==']("section") : node.$level()['$=='](0))) ? node.$document().$doctype()['$==']("book") : $a))) { - return "" + "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - } else { - - self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); - return ""; - }} - else { - if ($truthy((id = node.$id()))) { - reftext = node.$reftext();} role = node.$role(); - if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + "" + ((content_spacer = (function() {if (node.$content_model()['$==']("compound")) { - return $$($nesting, 'LF') - } else { - return "" - } })())) + (node.$content()) + (content_spacer) + "\n" + "" - } else if ($truthy(($truthy($a = id) ? $a : role))) { - if (node.$content_model()['$==']("compound")) { - return "" + "\n" + (node.$content()) + "\n" + "" - } else { - return "" + "" + (node.$content()) + "" - } - } else { - return self.$enclose_content(node) - }}})() - }, $DocBook5Converter_convert_open$20.$$arity = 1); + + switch (node.$style()) { + case "abstract": + if (($eqeq(node.$parent(), node.$document()) && ($eqeq(node.$document().$doctype(), "book")))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + } + case "partintro": + if ((($eqeq(node.$level(), 0) && ($eqeq(node.$parent().$context(), "section"))) && ($eqeq(node.$document().$doctype(), "book")))) { + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + } else { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } + default: + + if ($truthy((id = node.$id()))) { + reftext = node.$reftext(); + } role = node.$role(); + if ($truthy(node['$title?']())) { + return "\n" + "" + (node.$title()) + "\n" + "" + ((content_spacer = ($eqeq(node.$content_model(), "compound") ? ($$('LF')) : ("")))) + (node.$content()) + (content_spacer) + "\n" + "" + } else if (($truthy(id) || ($truthy(role)))) { + if ($eqeq(node.$content_model(), "compound")) { + return "\n" + (node.$content()) + "\n" + "" + } else { + return "" + (node.$content()) + "" + } + } else { + return self.$enclose_content(node) + } } + }); - Opal.def(self, '$convert_page_break', $DocBook5Converter_convert_page_break$21 = function $$convert_page_break(node) { - - return "" - }, $DocBook5Converter_convert_page_break$21.$$arity = 1); + $def(self, '$convert_page_break', $return_val("")); - Opal.def(self, '$convert_paragraph', $DocBook5Converter_convert_paragraph$22 = function $$convert_paragraph(node) { + $def(self, '$convert_paragraph', function $$convert_paragraph(node) { var self = this; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + "" + (node.$content()) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + "" + (node.$content()) + "\n" + "" } else { - return "" + "" + (node.$content()) + "" + return "" + (node.$content()) + "" } - }, $DocBook5Converter_convert_paragraph$22.$$arity = 1); + }); - Opal.def(self, '$convert_preamble', $DocBook5Converter_convert_preamble$23 = function $$convert_preamble(node) { + $def(self, '$convert_preamble', function $$convert_preamble(node) { var self = this; - if (node.$document().$doctype()['$==']("book")) { - return "" + "\n" + (self.$title_tag(node, false)) + (node.$content()) + "\n" + "" + if ($eqeq(node.$document().$doctype(), "book")) { + return "\n" + (self.$title_tag(node, false)) + (node.$content()) + "\n" + "" } else { return node.$content() } - }, $DocBook5Converter_convert_preamble$23.$$arity = 1); + }); - Opal.def(self, '$convert_quote', $DocBook5Converter_convert_quote$24 = function $$convert_quote(node) { - var $a, $$25, self = this; + $def(self, '$convert_quote', function $$convert_quote(node) { + var self = this, $ret_or_1 = nil; - return $send(self, 'blockquote_tag', [node, ($truthy($a = node['$has_role?']("epigraph")) ? "epigraph" : $a)], ($$25 = function(){var self = $$25.$$s || this; + return $send(self, 'blockquote_tag', [node, ($truthy(($ret_or_1 = node['$has_role?']("epigraph"))) ? ("epigraph") : ($ret_or_1))], function $$8(){var self = $$8.$$s == null ? this : $$8.$$s; - return self.$enclose_content(node)}, $$25.$$s = self, $$25.$$arity = 0, $$25)) - }, $DocBook5Converter_convert_quote$24.$$arity = 1); + return self.$enclose_content(node)}, {$$s: self}) + }); - Opal.def(self, '$convert_thematic_break', $DocBook5Converter_convert_thematic_break$26 = function $$convert_thematic_break(node) { - - return "" - }, $DocBook5Converter_convert_thematic_break$26.$$arity = 1); + $def(self, '$convert_thematic_break', $return_val("")); - Opal.def(self, '$convert_sidebar', $DocBook5Converter_convert_sidebar$27 = function $$convert_sidebar(node) { + $def(self, '$convert_sidebar', function $$convert_sidebar(node) { var self = this; - return "" + "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - }, $DocBook5Converter_convert_sidebar$27.$$arity = 1); + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + }); - Opal.def(self, '$convert_table', $DocBook5Converter_convert_table$28 = function $$convert_table(node) { - var $$29, $$30, $$31, self = this, has_body = nil, result = nil, pgwide_attribute = nil, frame = nil, grid = nil, tag_name = nil, col_width_key = nil, width = nil; + $def(self, '$convert_table', function $$convert_table(node) { + var self = this, has_body = nil, result = nil, pgwide_attribute = nil, frame = nil, grid = nil, tag_name = nil, width = nil, col_width_key = nil; has_body = false; result = []; - pgwide_attribute = (function() {if ($truthy(node['$option?']("pgwide"))) { - return " pgwide=\"1\"" - } else { - return "" - } })(); - if ((frame = node.$attr("frame", "all", "table-frame"))['$==']("ends")) { - frame = "topbot";} grid = node.$attr("grid", nil, "table-grid"); - result['$<<']("" + "<" + ((tag_name = (function() {if ($truthy(node['$title?']())) { - return "table" - } else { - return "informaltable" - } })())) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + (pgwide_attribute) + " frame=\"" + (frame) + "\" rowsep=\"" + ((function() {if ($truthy(["none", "cols"]['$include?'](grid))) { - return 0 - } else { - return 1 - } })()) + "\" colsep=\"" + ((function() {if ($truthy(["none", "rows"]['$include?'](grid))) { - return 0 - } else { - return 1 - } })()) + "\"" + ((function() {if ($truthy(node['$attr?']("orientation", "landscape", "table-orientation"))) { - return " orient=\"land\"" - } else { - return "" - } })()) + ">"); + pgwide_attribute = ($truthy(node['$option?']("pgwide")) ? (" pgwide=\"1\"") : ("")); + if ($eqeq((frame = node.$attr("frame", "all", "table-frame")), "ends")) { + frame = "topbot"; + } grid = node.$attr("grid", nil, "table-grid"); + result['$<<']("<" + ((tag_name = ($truthy(node['$title?']()) ? ("table") : ("informaltable")))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + (pgwide_attribute) + " frame=\"" + (frame) + "\" rowsep=\"" + (($truthy(["none", "cols"]['$include?'](grid)) ? (0) : (1))) + "\" colsep=\"" + (($truthy(["none", "rows"]['$include?'](grid)) ? (0) : (1))) + "\"" + (($truthy(node['$attr?']("orientation", "landscape", "table-orientation")) ? (" orient=\"land\"") : (""))) + ">"); if ($truthy(node['$option?']("unbreakable"))) { result['$<<'](""); } else if ($truthy(node['$option?']("breakable"))) { - result['$<<']("");} if (tag_name['$==']("table")) { - result['$<<']("" + "" + (node.$title()) + "");} col_width_key = (function() {if ($truthy((width = (function() {if ($truthy(node['$attr?']("width"))) { - - return node.$attr("width"); - } else { - return nil - } })()))) { - - $send($$($nesting, 'TABLE_PI_NAMES'), 'each', [], ($$29 = function(pi_name){var self = $$29.$$s || this; - + result['$<<'](""); + } if ($eqeq(tag_name, "table")) { + result['$<<']("" + (node.$title()) + ""); + } if ($truthy((width = ($truthy(node['$attr?']("width")) ? (node.$attr("width")) : (nil))))) { + $send($$('TABLE_PI_NAMES'), 'each', [], function $$9(pi_name){ - if (pi_name == null) { - pi_name = nil; - } return result['$<<']("" + "");}, $$29.$$s = self, $$29.$$arity = 1, $$29)); - return "colabswidth"; + if (pi_name == null) pi_name = nil; + return result['$<<']("");}); + col_width_key = "colabswidth"; } else { - return "colpcwidth" - } })(); - result['$<<']("" + ""); - $send(node.$columns(), 'each', [], ($$30 = function(col){var self = $$30.$$s || this; - - + col_width_key = "colpcwidth"; + } result['$<<'](""); + $send(node.$columns(), 'each', [], function $$10(col){ - if (col == null) { - col = nil; - } return result['$<<']("" + "");}, $$30.$$s = self, $$30.$$arity = 1, $$30)); - $send(node.$rows().$to_h(), 'each', [], ($$31 = function(tsec, rows){var self = $$31.$$s || this, $$32; - - - - if (tsec == null) { - tsec = nil; - } - if (rows == null) { - rows = nil; - } if ($truthy(rows['$empty?']())) { - return nil;} if (tsec['$==']("body")) { - has_body = true;} result['$<<']("" + ""); - $send(rows, 'each', [], ($$32 = function(row){var self = $$32.$$s || this, $$33; - + if (col == null) col = nil; + return result['$<<']("");}); + $send(node.$rows().$to_h(), 'each', [], function $$11(tsec, rows){ + if (tsec == null) tsec = nil; + if (rows == null) rows = nil; + if ($truthy(rows['$empty?']())) { + return nil + } if ($eqeq(tsec, "body")) { + has_body = true; + } result['$<<'](""); + $send(rows, 'each', [], function $$12(row){ - if (row == null) { - row = nil; - } result['$<<'](""); - $send(row, 'each', [], ($$33 = function(cell){var self = $$33.$$s || this, halign_attribute = nil, valign_attribute = nil, colspan_attribute = nil, colnum = nil, rowspan_attribute = nil, entry_start = nil, cell_content = nil, $case = nil, entry_end = nil; + if (row == null) row = nil; + result['$<<'](""); + $send(row, 'each', [], function $$13(cell){var colspan_attribute = nil, colnum = nil, rowspan_attribute = nil, entry_start = nil, cell_content = nil, entry_end = nil; - - if (cell == null) { - cell = nil; - } halign_attribute = (function() {if ($truthy(cell['$attr?']("halign"))) { - return "" + " align=\"" + (cell.$attr("halign")) + "\"" - } else { - return "" - } })(); - valign_attribute = (function() {if ($truthy(cell['$attr?']("valign"))) { - return "" + " valign=\"" + (cell.$attr("valign")) + "\"" - } else { - return "" - } })(); - colspan_attribute = (function() {if ($truthy(cell.$colspan())) { - return "" + " namest=\"col_" + ((colnum = cell.$column().$attr("colnumber"))) + "\" nameend=\"col_" + ($rb_minus($rb_plus(colnum, cell.$colspan()), 1)) + "\"" - } else { - return "" - } })(); - rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) { - return "" + " morerows=\"" + ($rb_minus(cell.$rowspan(), 1)) + "\"" - } else { - return "" - } })(); - entry_start = "" + ""; - if (tsec['$==']("head")) { + if (cell == null) cell = nil; + colspan_attribute = ($truthy(cell.$colspan()) ? (" namest=\"col_" + ((colnum = cell.$column().$attr("colnumber"))) + "\" nameend=\"col_" + ($rb_minus($rb_plus(colnum, cell.$colspan()), 1)) + "\"") : ("")); + rowspan_attribute = ($truthy(cell.$rowspan()) ? (" morerows=\"" + ($rb_minus(cell.$rowspan(), 1)) + "\"") : ("")); + entry_start = ""; + if ($eqeq(tsec, "head")) { cell_content = cell.$text(); - } else { - $case = cell.$style(); - if ("asciidoc"['$===']($case)) {cell_content = cell.$content();} - else if ("literal"['$===']($case)) {cell_content = "" + "" + (cell.$text()) + "";} - else if ("header"['$===']($case)) {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { - return "" - } else { - return "" + "" + (cell_content.$join("")) + "" - } })();} - else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { - return "" - } else { - return "" + "" + (cell_content.$join("")) + "" - } })();} - } entry_end = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) { - return "" + "" - } else { - return "" - } })(); - return result['$<<']("" + (entry_start) + (cell_content) + (entry_end));}, $$33.$$s = self, $$33.$$arity = 1, $$33)); - return result['$<<']("");}, $$32.$$s = self, $$32.$$arity = 1, $$32)); - return result['$<<']("" + "");}, $$31.$$s = self, $$31.$$arity = 2, $$31)); + } else + switch (cell.$style()) { + case "asciidoc": + cell_content = cell.$content(); + break; + case "literal": + cell_content = "" + (cell.$text()) + ""; + break; + case "header": + cell_content = ($truthy((cell_content = cell.$content())['$empty?']()) ? ("") : ("" + (cell_content.$join("")) + "")); + break; + default: + cell_content = ($truthy((cell_content = cell.$content())['$empty?']()) ? ("") : ("" + (cell_content.$join("")) + "")); + } entry_end = ($truthy(node.$document()['$attr?']("cellbgcolor")) ? ("") : ("")); + return result['$<<']("" + (entry_start) + (cell_content) + (entry_end));}); + return result['$<<']("");}); + return result['$<<']("");}); result['$<<'](""); - result['$<<']("" + ""); - if ($truthy(has_body)) ; else { + result['$<<'](""); + if (!$truthy(has_body)) { self.$logger().$warn("tables must have at least one body row"); - } return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_table$28.$$arity = 1); - Opal.alias(self, "convert_toc", "skip"); + } return result.$join($$('LF')); + }); + $alias(self, "convert_toc", "skip"); - Opal.def(self, '$convert_ulist', $DocBook5Converter_convert_ulist$34 = function $$convert_ulist(node) { - var $$35, $$36, self = this, result = nil, mark_type = nil, checklist = nil, mark_attribute = nil; + $def(self, '$convert_ulist', function $$convert_ulist(node) { + var self = this, result = nil, mark_type = nil, checklist = nil, mark_attribute = nil; result = []; - if (node.$style()['$==']("bibliography")) { + if ($eqeq(node.$style(), "bibliography")) { - result['$<<']("" + ""); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$35 = function(item){var self = $$35.$$s || this; - - + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$14(item){ - if (item == null) { - item = nil; - } result['$<<'](""); - result['$<<']("" + "" + (item.$text()) + ""); + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$35.$$s = self, $$35.$$arity = 1, $$35)); + result['$<<'](item.$content()); + } return result['$<<']("");}); result['$<<'](""); } else { - mark_type = (function() {if ($truthy((checklist = node['$option?']("checklist")))) { - return "none" - } else { - return node.$style() - } })(); - mark_attribute = (function() {if ($truthy(mark_type)) { - return "" + " mark=\"" + (mark_type) + "\"" - } else { - return "" - } })(); - result['$<<']("" + ""); + mark_type = ($truthy((checklist = node['$option?']("checklist"))) ? ("none") : (node.$style())); + mark_attribute = ($truthy(mark_type) ? (" mark=\"" + (mark_type) + "\"") : ("")); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$36 = function(item){var self = $$36.$$s || this, $a, text_marker = nil; + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$15(item){var self = $$15.$$s == null ? this : $$15.$$s, text_marker = nil, $ret_or_1 = nil; - - if (item == null) { - item = nil; - } if ($truthy(($truthy($a = checklist) ? item['$attr?']("checkbox") : $a))) { - text_marker = (function() {if ($truthy(item['$attr?']("checked"))) { - return "✓ " - } else { - return "❏ " - } })();} result['$<<']("" + ""); - result['$<<']("" + "" + (($truthy($a = text_marker) ? $a : "")) + (item.$text()) + ""); + if (item == null) item = nil; + if (($truthy(checklist) && ($truthy(item['$attr?']("checkbox"))))) { + text_marker = ($truthy(item['$attr?']("checked")) ? ("✓ ") : ("❏ ")); + } result['$<<'](""); + result['$<<']("" + (($truthy(($ret_or_1 = text_marker)) ? ($ret_or_1) : (""))) + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$36.$$s = self, $$36.$$arity = 1, $$36)); + result['$<<'](item.$content()); + } return result['$<<']("");}, {$$s: self}); result['$<<'](""); - } return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_ulist$34.$$arity = 1); + } return result.$join($$('LF')); + }); - Opal.def(self, '$convert_verse', $DocBook5Converter_convert_verse$37 = function $$convert_verse(node) { - var $a, $$38, self = this; - - return $send(self, 'blockquote_tag', [node, ($truthy($a = node['$has_role?']("epigraph")) ? "epigraph" : $a)], ($$38 = function(){var self = $$38.$$s || this; + $def(self, '$convert_verse', function $$convert_verse(node) { + var self = this, $ret_or_1 = nil; - return "" + "" + (node.$content()) + ""}, $$38.$$s = self, $$38.$$arity = 0, $$38)) - }, $DocBook5Converter_convert_verse$37.$$arity = 1); - Opal.alias(self, "convert_video", "skip"); + return $send(self, 'blockquote_tag', [node, ($truthy(($ret_or_1 = node['$has_role?']("epigraph"))) ? ("epigraph") : ($ret_or_1))], function $$16(){ + return "" + (node.$content()) + ""}) + }); + $alias(self, "convert_video", "skip"); - Opal.def(self, '$convert_inline_anchor', $DocBook5Converter_convert_inline_anchor$39 = function $$convert_inline_anchor(node) { - var $a, self = this, $case = nil, id = nil, path = nil, linkend = nil, text = nil; + $def(self, '$convert_inline_anchor', function $$convert_inline_anchor(node) { + var $a, self = this, id = nil, $ret_or_2 = nil, path = nil, linkend = nil, root_doc = nil, text = nil; - return (function() {$case = node.$type(); - if ("ref"['$===']($case)) {return "" + ""} - else if ("xref"['$===']($case)) {if ($truthy((path = node.$attributes()['$[]']("path")))) { - return "" + "" + (($truthy($a = node.$text()) ? $a : path)) + "" - } else { - - linkend = ($truthy($a = node.$attributes()['$[]']("fragment")) ? $a : node.$target()); - if ($truthy((text = node.$text()))) { - return "" + "" + (text) + "" - } else { - return "" + "" - } }} - else if ("link"['$===']($case)) {return "" + "" + (node.$text()) + ""} - else if ("bibref"['$===']($case)) {return "" + "" + (text)} - else { - self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect())); - return nil;}})() - }, $DocBook5Converter_convert_inline_anchor$39.$$arity = 1); + + switch (node.$type()) { + case "ref": + return "" + case "xref": + if ($truthy((path = node.$attributes()['$[]']("path")))) { + return "" + (($truthy(($ret_or_2 = node.$text())) ? ($ret_or_2) : (path))) + "" + } else { + + if ($truthy((linkend = node.$attributes()['$[]']("refid"))['$nil_or_empty?']())) { + + root_doc = self.$get_root_document(node); + linkend = ($truthy(($ret_or_2 = root_doc.$id())) ? ($ret_or_2) : (($a = [self.$generate_document_id(root_doc)], $send(root_doc, 'id=', $a), $a[$a.length - 1]))); + } if ($truthy((text = node.$text()))) { + return "" + (text) + "" + } else { + return "" + } } + case "link": + return "" + (node.$text()) + "" + case "bibref": + return "" + (text) + default: + + self.$logger().$warn("unknown anchor type: " + (node.$type().$inspect())); + return nil; + } + }); - Opal.def(self, '$convert_inline_break', $DocBook5Converter_convert_inline_break$40 = function $$convert_inline_break(node) { - + $def(self, '$convert_inline_break', function $$convert_inline_break(node) { + return "" + (node.$text()) + "" - }, $DocBook5Converter_convert_inline_break$40.$$arity = 1); + }); - Opal.def(self, '$convert_inline_button', $DocBook5Converter_convert_inline_button$41 = function $$convert_inline_button(node) { - - return "" + "" + (node.$text()) + "" - }, $DocBook5Converter_convert_inline_button$41.$$arity = 1); + $def(self, '$convert_inline_button', function $$convert_inline_button(node) { + + return "" + (node.$text()) + "" + }); - Opal.def(self, '$convert_inline_callout', $DocBook5Converter_convert_inline_callout$42 = function $$convert_inline_callout(node) { + $def(self, '$convert_inline_callout', function $$convert_inline_callout(node) { var self = this; - return "" + "" - }, $DocBook5Converter_convert_inline_callout$42.$$arity = 1); + return "" + }); - Opal.def(self, '$convert_inline_footnote', $DocBook5Converter_convert_inline_footnote$43 = function $$convert_inline_footnote(node) { + $def(self, '$convert_inline_footnote', function $$convert_inline_footnote(node) { var self = this; - if (node.$type()['$==']("xref")) { - return "" + "" + if ($eqeq(node.$type(), "xref")) { + return "" } else { - return "" + "" + (node.$text()) + "" + return "" + (node.$text()) + "" } - }, $DocBook5Converter_convert_inline_footnote$43.$$arity = 1); + }); - Opal.def(self, '$convert_inline_image', $DocBook5Converter_convert_inline_image$44 = function $$convert_inline_image(node) { - var width_attribute = nil, depth_attribute = nil; + $def(self, '$convert_inline_image', function $$convert_inline_image(node) { + var self = this, width_attribute = nil, depth_attribute = nil; - width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { - return "" + " contentwidth=\"" + (node.$attr("width")) + "\"" - } else { - return "" - } })(); - depth_attribute = (function() {if ($truthy(node['$attr?']("height"))) { - return "" + " contentdepth=\"" + (node.$attr("height")) + "\"" - } else { - return "" - } })(); - return "" + "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; - }, $DocBook5Converter_convert_inline_image$44.$$arity = 1); + width_attribute = ($truthy(node['$attr?']("width")) ? (" contentwidth=\"" + (node.$attr("width")) + "\"") : ("")); + depth_attribute = ($truthy(node['$attr?']("height")) ? (" contentdepth=\"" + (node.$attr("height")) + "\"") : ("")); + return "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; + }); - Opal.def(self, '$convert_inline_indexterm', $DocBook5Converter_convert_inline_indexterm$45 = function $$convert_inline_indexterm(node) { - var $$46, self = this, see = nil, rel = nil, see_also_list = nil, numterms = nil, terms = nil; + $def(self, '$convert_inline_indexterm', function $$convert_inline_indexterm(node) { + var see = nil, rel = nil, see_also_list = nil, numterms = nil, terms = nil; if ($truthy((see = node.$attr("see")))) { - rel = "" + "\n" + (see) + ""; + rel = "\n" + (see) + ""; } else if ($truthy((see_also_list = node.$attr("see-also")))) { - rel = $send(see_also_list, 'map', [], ($$46 = function(see_also){var self = $$46.$$s || this; - - + rel = $send(see_also_list, 'map', [], function $$17(see_also){ - if (see_also == null) { - see_also = nil; - } return "" + "\n" + (see_also) + "";}, $$46.$$s = self, $$46.$$arity = 1, $$46)).$join(); + if (see_also == null) see_also = nil; + return "\n" + (see_also) + "";}).$join(); } else { rel = ""; - } if (node.$type()['$==']("visible")) { - return "" + "\n" + "" + (node.$text()) + "" + (rel) + "\n" + "" + (node.$text()) + } if ($eqeq(node.$type(), "visible")) { + return "\n" + "" + (node.$text()) + "" + (rel) + "\n" + "" + (node.$text()) } else if ($truthy($rb_gt((numterms = (terms = node.$attr("terms")).$size()), 2))) { - return "" + "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "" + (rel) + "\n" + "" + ((function() {if ($truthy(node.$document()['$option?']("indexterm-promotion"))) { - return "" + "\n" + "\n" + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "\n" + "\n" + "\n" + "" + (terms['$[]'](2)) + "\n" + "" - } else { - return "" - } })()) + return "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "" + (rel) + "\n" + "" + (($truthy(node.$document()['$option?']("indexterm-promotion")) ? ("\n" + "\n" + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "\n" + "\n" + "\n" + "" + (terms['$[]'](2)) + "\n" + "") : (""))) } else if ($truthy($rb_gt(numterms, 1))) { - return "" + "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (rel) + "\n" + "" + ((function() {if ($truthy(node.$document()['$option?']("indexterm-promotion"))) { - return "" + "\n" + "\n" + "" + (terms['$[]'](1)) + "\n" + "" - } else { - return "" - } })()) + return "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (rel) + "\n" + "" + (($truthy(node.$document()['$option?']("indexterm-promotion")) ? ("\n" + "\n" + "" + (terms['$[]'](1)) + "\n" + "") : (""))) } else { - return "" + "\n" + "" + (terms['$[]'](0)) + "" + (rel) + "\n" + "" - } }, $DocBook5Converter_convert_inline_indexterm$45.$$arity = 1); + return "\n" + "" + (terms['$[]'](0)) + "" + (rel) + "\n" + "" + } }); - Opal.def(self, '$convert_inline_kbd', $DocBook5Converter_convert_inline_kbd$47 = function $$convert_inline_kbd(node) { + $def(self, '$convert_inline_kbd', function $$convert_inline_kbd(node) { var keys = nil; - if ((keys = node.$attr("keys")).$size()['$=='](1)) { - return "" + "" + (keys['$[]'](0)) + "" + if ($eqeq((keys = node.$attr("keys")).$size(), 1)) { + return "" + (keys['$[]'](0)) + "" } else { - return "" + "" + (keys.$join("")) + "" + return "" + (keys.$join("")) + "" } - }, $DocBook5Converter_convert_inline_kbd$47.$$arity = 1); + }); - Opal.def(self, '$convert_inline_menu', $DocBook5Converter_convert_inline_menu$48 = function $$convert_inline_menu(node) { + $def(self, '$convert_inline_menu', function $$convert_inline_menu(node) { var menu = nil, submenus = nil, menuitem = nil; menu = node.$attr("menu"); if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { if ($truthy((menuitem = node.$attr("menuitem")))) { - return "" + "" + (menu) + " " + (menuitem) + "" + return "" + (menu) + " " + (menuitem) + "" } else { - return "" + "" + (menu) + "" + return "" + (menu) + "" } } else { - return "" + "" + (menu) + " " + (submenus.$join(" ")) + " " + (node.$attr("menuitem")) + "" - } }, $DocBook5Converter_convert_inline_menu$48.$$arity = 1); + return "" + (menu) + " " + (submenus.$join(" ")) + " " + (node.$attr("menuitem")) + "" + } }); - Opal.def(self, '$convert_inline_quoted', $DocBook5Converter_convert_inline_quoted$49 = function $$convert_inline_quoted(node) { + $def(self, '$convert_inline_quoted', function $$convert_inline_quoted(node) { var $a, $b, self = this, type = nil, equation = nil, open = nil, close = nil, supports_phrase = nil, text = nil, quoted_text = nil; - if ((type = node.$type())['$==']("asciimath")) { + if ($eqeq((type = node.$type()), "asciimath")) { if ($truthy(self['$asciimath_available?']())) { - return "" + "" + ($$$('::', 'AsciiMath').$parse(node.$text()).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) + "" + return "" + ($$$('AsciiMath').$parse(node.$text()).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) + "" } else { - return "" + "" + return "" } - } else if (type['$==']("latexmath")) { - return "" + "" + } else if ($eqeq(type, "latexmath")) { + return "" } else { - $b = $$($nesting, 'QUOTE_TAGS')['$[]'](type), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (supports_phrase = ($a[2] == null ? nil : $a[2])), $b; + $b = $$('QUOTE_TAGS')['$[]'](type), $a = $to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (supports_phrase = ($a[2] == null ? nil : $a[2])); text = node.$text(); if ($truthy(node.$role())) { if ($truthy(supports_phrase)) { @@ -809,43 +662,37 @@ function register () { } else { quoted_text = "" + (open) + (text) + (close); } if ($truthy(node.$id())) { - return "" + "" + (quoted_text) + return "" + (quoted_text) } else { return quoted_text } } - }, $DocBook5Converter_convert_inline_quoted$49.$$arity = 1); + }); self.$private(); - Opal.def(self, '$common_attributes', $DocBook5Converter_common_attributes$50 = function $$common_attributes(id, role, reftext) { - var $a, attrs = nil; + $def(self, '$common_attributes', function $$common_attributes(id, role, reftext) { + var attrs = nil; - - if (role == null) { - role = nil; - } - if (reftext == null) { - reftext = nil; - } if ($truthy(id)) { - attrs = "" + " xml:id=\"" + (id) + "\"" + ((function() {if ($truthy(role)) { - return "" + " role=\"" + (role) + "\"" - } else { - return "" - } })()); + if (role == null) role = nil; + if (reftext == null) reftext = nil; + if ($truthy(id)) { + attrs = " xml:id=\"" + (id) + "\"" + (($truthy(role) ? (" role=\"" + (role) + "\"") : (""))); } else if ($truthy(role)) { - attrs = "" + " role=\"" + (role) + "\""; + attrs = " role=\"" + (role) + "\""; } else { attrs = ""; } if ($truthy(reftext)) { - if ($truthy(($truthy($a = reftext['$include?']("<")) ? (reftext = reftext.$gsub($$($nesting, 'XmlSanitizeRx'), ""))['$include?'](" ") : $a))) { - reftext = reftext.$squeeze(" ").$strip();} if ($truthy(reftext['$include?']("\""))) { - reftext = reftext.$gsub("\"", """);} return "" + (attrs) + " xreflabel=\"" + (reftext) + "\""; + if (($truthy(reftext['$include?']("<")) && ($truthy((reftext = reftext.$gsub($$('XmlSanitizeRx'), ""))['$include?'](" "))))) { + reftext = reftext.$squeeze(" ").$strip(); + } if ($truthy(reftext['$include?']("\""))) { + reftext = reftext.$gsub("\"", """); + } return "" + (attrs) + " xreflabel=\"" + (reftext) + "\""; } else { return attrs - } }, $DocBook5Converter_common_attributes$50.$$arity = -2); + } }, -2); - Opal.def(self, '$author_tag', $DocBook5Converter_author_tag$51 = function $$author_tag(doc, author) { + $def(self, '$author_tag', function $$author_tag(doc, author) { var result = nil; @@ -853,190 +700,193 @@ function register () { result['$<<'](""); result['$<<'](""); if ($truthy(author.$firstname())) { - result['$<<']("" + "" + (doc.$sub_replacements(author.$firstname())) + "");} if ($truthy(author.$middlename())) { - result['$<<']("" + "" + (doc.$sub_replacements(author.$middlename())) + "");} if ($truthy(author.$lastname())) { - result['$<<']("" + "" + (doc.$sub_replacements(author.$lastname())) + "");} result['$<<'](""); + result['$<<']("" + (doc.$sub_replacements(author.$firstname())) + ""); + } if ($truthy(author.$middlename())) { + result['$<<']("" + (doc.$sub_replacements(author.$middlename())) + ""); + } if ($truthy(author.$lastname())) { + result['$<<']("" + (doc.$sub_replacements(author.$lastname())) + ""); + } result['$<<'](""); if ($truthy(author.$email())) { - result['$<<']("" + "" + (author.$email()) + "");} result['$<<'](""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_author_tag$51.$$arity = 2); + result['$<<']("" + (author.$email()) + ""); + } result['$<<'](""); + return result.$join($$('LF')); + }); - Opal.def(self, '$document_info_tag', $DocBook5Converter_document_info_tag$52 = function $$document_info_tag(doc) { - var $a, $$53, $b, $$54, self = this, result = nil, title = nil, date = nil, authors = nil, author = nil, back_cover_tag = nil, front_cover_tag = nil, docinfo_content = nil; + $def(self, '$document_info_tag', function $$document_info_tag(doc) { + var $a, self = this, result = nil, title = nil, date = nil, authors = nil, author = nil, back_cover_tag = nil, front_cover_tag = nil, docinfo_content = nil; result = [""]; - if ($truthy(doc.$notitle())) ; else if ($truthy((title = doc.$doctitle($hash2(["partition", "use_fallback"], {"partition": true, "use_fallback": true})))['$subtitle?']())) { - result['$<<']("" + "" + (title.$main()) + "\n" + "" + (title.$subtitle()) + ""); - } else { - result['$<<']("" + "" + (title) + ""); - } if ($truthy((date = (function() {if ($truthy(doc['$attr?']("revdate"))) { - - return doc.$attr("revdate"); - } else { - - if ($truthy(doc['$attr?']("reproducible"))) { - return nil + if (!$truthy(doc.$notitle())) { + if ($truthy((title = doc.$doctitle($hash2(["partition", "use_fallback"], {"partition": true, "use_fallback": true})))['$subtitle?']())) { + result['$<<']("" + (title.$main()) + "\n" + "" + (title.$subtitle()) + ""); } else { - - return doc.$attr("docdate"); - } } })()))) { - result['$<<']("" + "" + (date) + "");} if ($truthy(doc['$attr?']("copyright"))) { + result['$<<']("" + (title) + ""); + } + } if ($truthy((date = ($truthy(doc['$attr?']("revdate")) ? (doc.$attr("revdate")) : (($truthy(doc['$attr?']("reproducible")) ? (nil) : (doc.$attr("docdate")))))))) { + result['$<<']("" + (date) + ""); + } if ($truthy(doc['$attr?']("copyright"))) { - $$($nesting, 'CopyrightRx')['$=~'](doc.$attr("copyright")); + $$('CopyrightRx')['$=~'](doc.$attr("copyright")); result['$<<'](""); - result['$<<']("" + "" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + ""); + result['$<<']("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + ""); if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { - result['$<<']("" + "" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "");} result['$<<']("");} if ($truthy(doc['$header?']())) { + result['$<<']("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + ""); + } result['$<<'](""); + } if ($truthy(doc['$header?']())) { - if ($truthy((authors = doc.$authors())['$empty?']())) ; else if ($truthy($rb_gt(authors.$size(), 1))) { - - result['$<<'](""); - $send(authors, 'each', [], ($$53 = function(author){var self = $$53.$$s || this; + if (!$truthy((authors = doc.$authors())['$empty?']())) { + if ($truthy($rb_gt(authors.$size(), 1))) { + + result['$<<'](""); + $send(authors, 'each', [], function $$18(author){var self = $$18.$$s == null ? this : $$18.$$s; - + + if (author == null) author = nil; + return result['$<<'](self.$author_tag(doc, author));}, {$$s: self}); + result['$<<'](""); + } else { - if (author == null) { - author = nil; - } return result['$<<'](self.$author_tag(doc, author));}, $$53.$$s = self, $$53.$$arity = 1, $$53)); - result['$<<'](""); - } else { + result['$<<'](self.$author_tag(doc, (author = authors['$[]'](0)))); + if ($truthy(author.$initials())) { + result['$<<']("" + (author.$initials()) + ""); + } } + } if (($truthy(doc['$attr?']("revdate")) && (($truthy(doc['$attr?']("revnumber")) || ($truthy(doc['$attr?']("revremark"))))))) { - result['$<<'](self.$author_tag(doc, (author = authors['$[]'](0)))); - if ($truthy(author.$initials())) { - result['$<<']("" + "" + (author.$initials()) + "");} } if ($truthy(($truthy($a = doc['$attr?']("revdate")) ? ($truthy($b = doc['$attr?']("revnumber")) ? $b : doc['$attr?']("revremark")) : $a))) { - - result['$<<']("" + "\n" + ""); + result['$<<']("\n" + ""); if ($truthy(doc['$attr?']("revnumber"))) { - result['$<<']("" + "" + (doc.$attr("revnumber")) + "");} if ($truthy(doc['$attr?']("revdate"))) { - result['$<<']("" + "" + (doc.$attr("revdate")) + "");} if ($truthy(doc['$attr?']("authorinitials"))) { - result['$<<']("" + "" + (doc.$attr("authorinitials")) + "");} if ($truthy(doc['$attr?']("revremark"))) { - result['$<<']("" + "" + (doc.$attr("revremark")) + "");} result['$<<']("" + "\n" + "");} if ($truthy(($truthy($a = doc['$attr?']("front-cover-image")) ? $a : doc['$attr?']("back-cover-image")))) { + result['$<<']("" + (doc.$attr("revnumber")) + ""); + } if ($truthy(doc['$attr?']("revdate"))) { + result['$<<']("" + (doc.$attr("revdate")) + ""); + } if ($truthy(doc['$attr?']("authorinitials"))) { + result['$<<']("" + (doc.$attr("authorinitials")) + ""); + } if ($truthy(doc['$attr?']("revremark"))) { + result['$<<']("" + (doc.$attr("revremark")) + ""); + } result['$<<']("\n" + ""); + } if (($truthy(doc['$attr?']("front-cover-image")) || ($truthy(doc['$attr?']("back-cover-image"))))) { if ($truthy((back_cover_tag = self.$cover_tag(doc, "back")))) { result['$<<'](self.$cover_tag(doc, "front", true)); result['$<<'](back_cover_tag); } else if ($truthy((front_cover_tag = self.$cover_tag(doc, "front")))) { - result['$<<'](front_cover_tag);}} if ($truthy(doc['$attr?']("orgname"))) { - result['$<<']("" + "" + (doc.$attr("orgname")) + "");} if ($truthy((docinfo_content = doc.$docinfo())['$empty?']())) ; else { + result['$<<'](front_cover_tag); + } + } if ($truthy(doc['$attr?']("orgname"))) { + result['$<<']("" + (doc.$attr("orgname")) + ""); + } if (!$truthy((docinfo_content = doc.$docinfo())['$empty?']())) { result['$<<'](docinfo_content); - }} result['$<<'](""); - if (doc.$doctype()['$==']("manpage")) { - - result['$<<'](""); - if ($truthy(doc['$attr?']("mantitle"))) { - result['$<<']("" + "" + (doc.$attr("mantitle")) + "");} if ($truthy(doc['$attr?']("manvolnum"))) { - result['$<<']("" + "" + (doc.$attr("manvolnum")) + "");} result['$<<']("" + "" + (doc.$attr("mansource", " ")) + ""); - result['$<<']("" + "" + (doc.$attr("manmanual", " ")) + ""); - result['$<<'](""); - result['$<<'](""); - if ($truthy(doc['$attr?']("mannames"))) { - result = $rb_plus(result, $send(doc.$attr("mannames"), 'map', [], ($$54 = function(n){var self = $$54.$$s || this; - - - - if (n == null) { - n = nil; - } return "" + "" + (n) + "";}, $$54.$$s = self, $$54.$$arity = 1, $$54)));} if ($truthy(doc['$attr?']("manpurpose"))) { - result['$<<']("" + "" + (doc.$attr("manpurpose")) + "");} result['$<<']("");} return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_document_info_tag$52.$$arity = 1); + } } result['$<<'](""); + return result.$join($$('LF')); + }); - Opal.def(self, '$enclose_content', $DocBook5Converter_enclose_content$55 = function $$enclose_content(node) { - - if (node.$content_model()['$==']("compound")) { + $def(self, '$get_root_document', function $$get_root_document(node) { + + + while ($truthy((node = node.$document())['$nested?']())) { + node = node.$parent_document(); + } return node; + }); + + $def(self, '$generate_document_id', function $$generate_document_id(doc) { + + return "__" + (doc.$doctype()) + "-root__" + }); + + $def(self, '$enclose_content', function $$enclose_content(node) { + + if ($eqeq(node.$content_model(), "compound")) { return node.$content() } else { - return "" + "" + (node.$content()) + "" + return "" + (node.$content()) + "" } - }, $DocBook5Converter_enclose_content$55.$$arity = 1); + }); - Opal.def(self, '$title_tag', $DocBook5Converter_title_tag$56 = function $$title_tag(node, optional) { - var $a; - + $def(self, '$title_tag', function $$title_tag(node, optional) { - if (optional == null) { - optional = true; - } if ($truthy(($truthy($a = optional['$!']()) ? $a : node['$title?']()))) { - return "" + "" + (node.$title()) + "\n" + if (optional == null) optional = true; + if (($not(optional) || ($truthy(node['$title?']())))) { + return "" + (node.$title()) + "\n" } else { return "" - } }, $DocBook5Converter_title_tag$56.$$arity = -2); + } }, -2); - Opal.def(self, '$cover_tag', $DocBook5Converter_cover_tag$57 = function $$cover_tag(doc, face, use_placeholder) { + $def(self, '$cover_tag', function $$cover_tag(doc, face, use_placeholder) { var $a, cover_image = nil, width_attr = nil, depth_attr = nil, attrlist = nil, attrs = nil; - - if (use_placeholder == null) { - use_placeholder = false; - } if ($truthy((cover_image = doc.$attr("" + (face) + "-cover-image")))) { + if (use_placeholder == null) use_placeholder = false; + if ($truthy((cover_image = doc.$attr("" + (face) + "-cover-image")))) { width_attr = ""; depth_attr = ""; - if ($truthy(($truthy($a = cover_image['$include?'](":")) ? $$($nesting, 'ImageMacroRx')['$=~'](cover_image) : $a))) { + if (($truthy(cover_image['$include?'](":")) && ($truthy($$('ImageMacroRx')['$=~'](cover_image))))) { attrlist = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)); cover_image = doc.$image_uri((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))); if ($truthy(attrlist)) { - attrs = $$($nesting, 'AttributeList').$new(attrlist).$parse(["alt", "width", "height"]); + attrs = $$('AttributeList').$new(attrlist).$parse(["alt", "width", "height"]); if ($truthy(attrs['$key?']("scaledwidth"))) { - width_attr = "" + " width=\"" + (attrs['$[]']("scaledwidth")) + "\""; + width_attr = " width=\"" + (attrs['$[]']("scaledwidth")) + "\""; } else { if ($truthy(attrs['$key?']("width"))) { - width_attr = "" + " contentwidth=\"" + (attrs['$[]']("width")) + "\"";} if ($truthy(attrs['$key?']("height"))) { - depth_attr = "" + " contentdepth=\"" + (attrs['$[]']("height")) + "\"";} }}} return "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + width_attr = " contentwidth=\"" + (attrs['$[]']("width")) + "\""; + } if ($truthy(attrs['$key?']("height"))) { + depth_attr = " contentdepth=\"" + (attrs['$[]']("height")) + "\""; + } } } } return "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; } else if ($truthy(use_placeholder)) { - return "" + "" + return "" } else { return nil - } }, $DocBook5Converter_cover_tag$57.$$arity = -3); + } }, -3); - Opal.def(self, '$blockquote_tag', $DocBook5Converter_blockquote_tag$58 = function $$blockquote_tag(node, tag_name) { - var $a, $iter = $DocBook5Converter_blockquote_tag$58.$$p, $yield = $iter || nil, self = this, start_tag = nil, end_tag = nil, result = nil; + $def(self, '$blockquote_tag', function $$blockquote_tag(node, tag_name) { + var $a, $yield = $$blockquote_tag.$$p || nil, self = this, start_tag = nil, end_tag = nil, result = nil; - if ($iter) $DocBook5Converter_blockquote_tag$58.$$p = null; - + $$blockquote_tag.$$p = null; - if (tag_name == null) { - tag_name = nil; - } if ($truthy(tag_name)) { - $a = ["" + "<" + (tag_name), "" + ""], (start_tag = $a[0]), (end_tag = $a[1]), $a; + if (tag_name == null) tag_name = nil; + if ($truthy(tag_name)) { + $a = ["<" + (tag_name), ""], (start_tag = $a[0]), (end_tag = $a[1]); } else { - $a = [""], (start_tag = $a[0]), (end_tag = $a[1]), $a; + $a = [""], (start_tag = $a[0]), (end_tag = $a[1]); } result = ["" + (start_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"]; if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} if ($truthy(($truthy($a = node['$attr?']("attribution")) ? $a : node['$attr?']("citetitle")))) { + result['$<<']("" + (node.$title()) + ""); + } if (($truthy(node['$attr?']("attribution")) || ($truthy(node['$attr?']("citetitle"))))) { result['$<<'](""); if ($truthy(node['$attr?']("attribution"))) { - result['$<<'](node.$attr("attribution"));} if ($truthy(node['$attr?']("citetitle"))) { - result['$<<']("" + "" + (node.$attr("citetitle")) + "");} result['$<<']("");} result['$<<'](Opal.yieldX($yield, [])); + result['$<<'](node.$attr("attribution")); + } if ($truthy(node['$attr?']("citetitle"))) { + result['$<<']("" + (node.$attr("citetitle")) + ""); + } result['$<<'](""); + } result['$<<'](Opal.yieldX($yield, [])); result['$<<'](end_tag); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_blockquote_tag$58.$$arity = -2); + return result.$join($$('LF')); + }, -2); - Opal.def(self, '$asciimath_available?', $DocBook5Converter_asciimath_available$ques$59 = function() { - var $a, self = this; + $def(self, '$asciimath_available?', function $DocBook5Converter_asciimath_available$ques$19() { + var self = this, $ret_or_1 = nil; - return (self.asciimath_status = ($truthy($a = self.asciimath_status) ? $a : self.$load_asciimath()))['$==']("loaded") - }, $DocBook5Converter_asciimath_available$ques$59.$$arity = 0); - return (Opal.def(self, '$load_asciimath', $DocBook5Converter_load_asciimath$60 = function $$load_asciimath() { + return (self.asciimath_status = ($truthy(($ret_or_1 = self.asciimath_status)) ? ($ret_or_1) : (self.$load_asciimath())))['$==']("loaded") + }); + return $def(self, '$load_asciimath', function $$load_asciimath() { var $a, $b, $c, $d; if ($truthy(((($a = $$$('::', 'AsciiMath', 'skip_raise')) && ($b = $a, $b) && ($c = $b) && ((($d = $c.$parse) && !$d.$$stub) || $c['$respond_to_missing?']('parse'))) ? 'method' : nil))) { return "loaded" - } else if ($truthy($$($nesting, 'Helpers').$require_library("asciimath", true, "warn")['$nil?']())) { + } else if ($truthy($$('Helpers').$require_library("asciimath", true, "warn")['$nil?']())) { return "unavailable" } else { return "loaded" } - }, $DocBook5Converter_load_asciimath$60.$$arity = 0), nil) && 'load_asciimath'; - })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting); + }); + })($$('Converter'), $$$($$('Converter'), 'Base'), $nesting) })($nesting[0], $nesting) -})(Opal); +}); } diff --git a/dist/index.esm.js b/dist/index.esm.js index bffa187..6de1ae6 100644 --- a/dist/index.esm.js +++ b/dist/index.esm.js @@ -1,172 +1,161 @@ const AsciidoctorDocBook = {}; function register () { -/* Generated by Opal 0.11.99.dev */ -(function(Opal) { - function $rb_minus(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); - } - function $rb_gt(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); - } - function $rb_plus(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); - } - var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; +Opal.queue(function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $hash2 = Opal.hash2, $regexp = Opal.regexp, $def = Opal.def, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $rb_plus = Opal.rb_plus, $send = Opal.send, $alias = Opal.alias, $rb_gt = Opal.rb_gt, $return_val = Opal.return_val, $rb_minus = Opal.rb_minus, $to_ary = Opal.to_ary, $gvars = Opal.gvars, $not = Opal.not, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; - Opal.add_stubs(['$register_for', '$default=', '$-', '$init_backend_traits', '$attr?', '$<<', '$attr', '$==', '$doctype', '$common_attributes', '$id', '$noheader', '$document_info_tag', '$empty?', '$docinfo', '$blocks?', '$content', '$join', '$document', '$[]', '$sectname', '$special', '$option?', '$title', '$role', '$reftext', '$title_tag', '$enclose_content', '$title?', '$each', '$items', '$text', '$style', '$text?', '$level', '$image_uri', '$alt', '$!', '$key?', '$attributes', '$to_i', '$index', '$subs', '$delete_at', '$>', '$insert', '$unshift', '$asciimath_available?', '$to_mathml', '$parse', '$===', '$parent', '$warn', '$logger', '$context', '$error', '$content_model', '$blockquote_tag', '$has_role?', '$include?', '$columns', '$to_h', '$rows', '$colspan', '$column', '$+', '$rowspan', '$type', '$target', '$inspect', '$icon_uri', '$map', '$size', '$chop', '$private', '$gsub', '$strip', '$squeeze', '$firstname', '$sub_replacements', '$middlename', '$lastname', '$email', '$notitle', '$subtitle?', '$doctitle', '$main', '$subtitle', '$=~', '$header?', '$authors', '$author_tag', '$initials', '$cover_tag', '$new', '$load_asciimath', '$nil?', '$require_library']); + Opal.add_stubs('register_for,default=,init_backend_traits,attr?,<<,attr,==,doctype,size,id,noheader,document_info_tag,apply_reftext_subs,+,map,empty?,docinfo,blocks?,content,id=,insert,common_attributes,join,content_only,document,[],sectname,option?,special,title,role,reftext,title_tag,enclose_content,skip,title?,each,items,text,style,text?,level,image_uri,alt,!,key?,attributes,to_i,index,subs,delete_at,>,unshift,asciimath_available?,to_mathml,parse,parent,warn,logger,context,error,content_model,blockquote_tag,has_role?,include?,columns,to_h,rows,colspan,column,-,rowspan,type,target,nil_or_empty?,get_root_document,generate_document_id,inspect,icon_uri,chop,private,gsub,strip,squeeze,firstname,sub_replacements,middlename,lastname,email,notitle,subtitle?,doctitle,main,subtitle,=~,header?,authors,author_tag,initials,cover_tag,nested?,parent_document,new,load_asciimath,nil?,require_library'); return (function($base, $parent_nesting) { var self = $module($base, 'Asciidoctor'); - var $nesting = [self].concat($parent_nesting); + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); - (function($base, $super, $parent_nesting) { + return (function($base, $super, $parent_nesting) { var self = $klass($base, $super, 'DocBook5Converter'); - var $nesting = [self].concat($parent_nesting), $DocBook5Converter_initialize$1, $DocBook5Converter_convert_document$2, $DocBook5Converter_convert_section$3, $DocBook5Converter_convert_admonition$4, $DocBook5Converter_convert_colist$5, $DocBook5Converter_convert_dlist$7, $DocBook5Converter_convert_example$12, $DocBook5Converter_convert_floating_title$13, $DocBook5Converter_convert_image$14, $DocBook5Converter_convert_listing$15, $DocBook5Converter_convert_literal$16, $DocBook5Converter_convert_stem$17, $DocBook5Converter_convert_olist$18, $DocBook5Converter_convert_open$20, $DocBook5Converter_convert_page_break$21, $DocBook5Converter_convert_paragraph$22, $DocBook5Converter_convert_preamble$23, $DocBook5Converter_convert_quote$24, $DocBook5Converter_convert_thematic_break$26, $DocBook5Converter_convert_sidebar$27, $DocBook5Converter_convert_table$28, $DocBook5Converter_convert_ulist$34, $DocBook5Converter_convert_verse$37, $DocBook5Converter_convert_inline_anchor$39, $DocBook5Converter_convert_inline_break$40, $DocBook5Converter_convert_inline_button$41, $DocBook5Converter_convert_inline_callout$42, $DocBook5Converter_convert_inline_footnote$43, $DocBook5Converter_convert_inline_image$44, $DocBook5Converter_convert_inline_indexterm$45, $DocBook5Converter_convert_inline_kbd$47, $DocBook5Converter_convert_inline_menu$48, $DocBook5Converter_convert_inline_quoted$49, $DocBook5Converter_common_attributes$50, $DocBook5Converter_author_tag$51, $DocBook5Converter_document_info_tag$52, $DocBook5Converter_enclose_content$55, $DocBook5Converter_title_tag$56, $DocBook5Converter_cover_tag$57, $DocBook5Converter_blockquote_tag$58, $DocBook5Converter_asciimath_available$ques$59, $DocBook5Converter_load_asciimath$60, $writer = nil; + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; - self.$$prototype.asciimath_status = nil; + $proto.asciimath_status = nil; self.$register_for("docbook5"); - - $writer = [$hash2(["list", "entry", "term", "item"], {"list": "variablelist", "entry": "varlistentry", "term": "term", "item": "listitem"})]; - $send(Opal.const_set($nesting[0], 'DLIST_TAGS', $hash2(["qanda", "glossary"], {"qanda": $hash2(["list", "entry", "label", "term", "item"], {"list": "qandaset", "entry": "qandaentry", "label": "question", "term": "simpara", "item": "answer"}), "glossary": $hash2(["list", "entry", "term", "item"], {"list": nil, "entry": "glossentry", "term": "glossterm", "item": "glossdef"})})), 'default=', Opal.to_a($writer)); - $writer[$rb_minus($writer["length"], 1)]; - $writer = [["", "", true]]; - $send(Opal.const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript"], {"monospaced": ["", ""], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["", "", true], "single": ["", "", true], "mark": ["", ""], "superscript": ["", ""], "subscript": ["", ""]})), 'default=', Opal.to_a($writer)); - $writer[$rb_minus($writer["length"], 1)]; Opal.const_set($nesting[0], 'MANPAGE_SECTION_TAGS', $hash2(["section", "synopsis"], {"section": "refsection", "synopsis": "refsynopsisdiv"})); - Opal.const_set($nesting[0], 'TABLE_PI_NAMES', ["dbhtml", "dbfo", "dblatex"]); - Opal.const_set($nesting[0], 'CopyrightRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?)(?: ((?:\\d{4}\\-)?\\d{4}))?$")); - Opal.const_set($nesting[0], 'ImageMacroRx', new RegExp("" + "^image::?(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); - - Opal.def(self, '$initialize', $DocBook5Converter_initialize$1 = function $$initialize(backend, opts) { + $const_set($nesting[0], 'DLIST_TAGS', $hash2(["qanda", "glossary"], {"qanda": $hash2(["list", "entry", "label", "term", "item"], {"list": "qandaset", "entry": "qandaentry", "label": "question", "term": "simpara", "item": "answer"}), "glossary": $hash2(["list", "entry", "term", "item"], {"list": nil, "entry": "glossentry", "term": "glossterm", "item": "glossdef"})}))['$default=']($hash2(["list", "entry", "term", "item"], {"list": "variablelist", "entry": "varlistentry", "term": "term", "item": "listitem"})); + $const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript"], {"monospaced": ["", ""], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["", "", true], "single": ["", "", true], "mark": ["", ""], "superscript": ["", ""], "subscript": ["", ""]}))['$default='](["", "", true]); + $const_set($nesting[0], 'MANPAGE_SECTION_TAGS', $hash2(["section", "synopsis"], {"section": "refsection", "synopsis": "refsynopsisdiv"})); + $const_set($nesting[0], 'TABLE_PI_NAMES', ["dbhtml", "dbfo", "dblatex"]); + $const_set($nesting[0], 'CopyrightRx', $regexp(["^(", $$('CC_ANY'), "+?)(?: ((?:\\d{4}-)?\\d{4}))?$"])); + $const_set($nesting[0], 'ImageMacroRx', $regexp(["^image::?(\\S|\\S", $$('CC_ANY'), "*?\\S)\\[(", $$('CC_ANY'), "+)?\\]$"])); + + $def(self, '$initialize', function $$initialize(backend, opts) { var self = this; - - if (opts == null) { - opts = $hash2([], {}); - } self.backend = backend; + if (opts == null) opts = $hash2([], {}); + self.backend = backend; return self.$init_backend_traits($hash2(["basebackend", "filetype", "outfilesuffix", "supports_templates"], {"basebackend": "docbook", "filetype": "xml", "outfilesuffix": ".xml", "supports_templates": true})); - }, $DocBook5Converter_initialize$1.$$arity = -2); + }, -2); - Opal.def(self, '$convert_document', $DocBook5Converter_convert_document$2 = function $$convert_document(node) { - var self = this, result = nil, lang_attribute = nil, root_tag_name = nil, docinfo_content = nil; + $def(self, '$convert_document', function $$convert_document(node) { + var $a, $b, self = this, result = nil, lang_attribute = nil, root_tag_name = nil, manpage = nil, root_tag_idx = nil, id = nil, docinfo_content = nil; result = [""]; if ($truthy(node['$attr?']("toc"))) { - result['$<<']((function() {if ($truthy(node['$attr?']("toclevels"))) { - return "" + "" - } else { - return "" - } })());} if ($truthy(node['$attr?']("sectnums"))) { - result['$<<']((function() {if ($truthy(node['$attr?']("sectnumlevels"))) { - return "" + "" - } else { - return "" - } })());} lang_attribute = (function() {if ($truthy(node['$attr?']("nolang"))) { - return "" - } else { - return "" + " xml:lang=\"" + (node.$attr("lang", "en")) + "\"" - } })(); - if ((root_tag_name = node.$doctype())['$==']("manpage")) { - root_tag_name = "refentry";} result['$<<']("" + "<" + (root_tag_name) + " xmlns=\"http://docbook.org/ns/docbook\" xmlns:xl=\"http://www.w3.org/1999/xlink\" version=\"5.0\"" + (lang_attribute) + (self.$common_attributes(node.$id())) + ">"); - if ($truthy(node.$noheader())) ; else { + result['$<<'](($truthy(node['$attr?']("toclevels")) ? ("") : (""))); + } if ($truthy(node['$attr?']("sectnums"))) { + result['$<<'](($truthy(node['$attr?']("sectnumlevels")) ? ("") : (""))); + } lang_attribute = ($truthy(node['$attr?']("nolang")) ? ("") : (" xml:lang=\"" + (node.$attr("lang", "en")) + "\"")); + if ($eqeq((root_tag_name = node.$doctype()), "manpage")) { + + manpage = true; + root_tag_name = "article"; + } root_tag_idx = result.$size(); + id = node.$id(); + if (!$truthy(node.$noheader())) { result['$<<'](self.$document_info_tag(node)); - } if ($truthy((docinfo_content = node.$docinfo("header"))['$empty?']())) ; else { + } if ($truthy(manpage)) { + + result['$<<'](""); + result['$<<'](""); + if ($truthy(node['$attr?']("mantitle"))) { + result['$<<']("" + (node.$apply_reftext_subs(node.$attr("mantitle"))) + ""); + } if ($truthy(node['$attr?']("manvolnum"))) { + result['$<<']("" + (node.$attr("manvolnum")) + ""); + } result['$<<']("" + (node.$attr("mansource", " ")) + ""); + result['$<<']("" + (node.$attr("manmanual", " ")) + ""); + result['$<<'](""); + result['$<<'](""); + if ($truthy(node['$attr?']("mannames"))) { + result = $rb_plus(result, $send(node.$attr("mannames"), 'map', [], function $$1(n){ + + if (n == null) n = nil; + return "" + (n) + "";})); + } if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<']("" + (node.$attr("manpurpose")) + ""); + } result['$<<'](""); + } if (!$truthy((docinfo_content = node.$docinfo("header"))['$empty?']())) { result['$<<'](docinfo_content); } if ($truthy(node['$blocks?']())) { - result['$<<'](node.$content());} if ($truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) ; else { + result['$<<'](node.$content()); + } if (!$truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { result['$<<'](docinfo_content); - } result['$<<']("" + ""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_document$2.$$arity = 1); - Opal.alias(self, "convert_embedded", "content_only"); - - Opal.def(self, '$convert_section', $DocBook5Converter_convert_section$3 = function $$convert_section(node) { - var $a, self = this, tag_name = nil, title_el = nil; + } if ($truthy(manpage)) { + result['$<<'](""); + } if (!$truthy(id)) { + $a = [node.$id(), nil], (id = $a[0]), ($b = [$a[1]], $send(node, 'id=', $b), $b[$b.length - 1]); + } result.$insert(root_tag_idx, "<" + (root_tag_name) + " xmlns=\"http://docbook.org/ns/docbook\" xmlns:xl=\"http://www.w3.org/1999/xlink\" version=\"5.0\"" + (lang_attribute) + (self.$common_attributes(id)) + ">"); + result['$<<'](""); + return result.$join($$('LF')); + }); + $alias(self, "convert_embedded", "content_only"); + + $def(self, '$convert_section', function $$convert_section(node) { + var self = this, tag_name = nil, $ret_or_1 = nil, title_el = nil; - if (node.$document().$doctype()['$==']("manpage")) { - tag_name = ($truthy($a = $$($nesting, 'MANPAGE_SECTION_TAGS')['$[]']((tag_name = node.$sectname()))) ? $a : tag_name); + if ($eqeq(node.$document().$doctype(), "manpage")) { + tag_name = ($truthy(($ret_or_1 = $$('MANPAGE_SECTION_TAGS')['$[]']((tag_name = node.$sectname())))) ? ($ret_or_1) : (tag_name)); } else { tag_name = node.$sectname(); - } title_el = (function() {if ($truthy(($truthy($a = node.$special()) ? node['$option?']("untitled") : $a))) { - return "" - } else { - return "" + "" + (node.$title()) + "\n" - } })(); - return "" + "<" + (tag_name) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (title_el) + (node.$content()) + "\n" + ""; - }, $DocBook5Converter_convert_section$3.$$arity = 1); + } title_el = (($truthy(node.$special()) && (($truthy(node['$option?']("notitle")) || ($truthy(node['$option?']("untitled")))))) ? ("") : ("" + (node.$title()) + "\n")); + return "<" + (tag_name) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (title_el) + (node.$content()) + "\n" + ""; + }); - Opal.def(self, '$convert_admonition', $DocBook5Converter_convert_admonition$4 = function $$convert_admonition(node) { + $def(self, '$convert_admonition', function $$convert_admonition(node) { var self = this, tag_name = nil; - return "" + "<" + ((tag_name = node.$attr("name"))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - }, $DocBook5Converter_convert_admonition$4.$$arity = 1); - Opal.alias(self, "convert_audio", "skip"); + return "<" + ((tag_name = node.$attr("name"))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + }); + $alias(self, "convert_audio", "skip"); - Opal.def(self, '$convert_colist', $DocBook5Converter_convert_colist$5 = function $$convert_colist(node) { - var $$6, self = this, result = nil; + $def(self, '$convert_colist', function $$convert_colist(node) { + var self = this, result = nil; result = []; - result['$<<']("" + ""); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$6 = function(item){var self = $$6.$$s || this; - - + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$2(item){ - if (item == null) { - item = nil; - } result['$<<']("" + ""); - result['$<<']("" + "" + (item.$text()) + ""); + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$6.$$s = self, $$6.$$arity = 1, $$6)); + result['$<<'](item.$content()); + } return result['$<<']("");}); result['$<<'](""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_colist$5.$$arity = 1); + return result.$join($$('LF')); + }); - Opal.def(self, '$convert_dlist', $DocBook5Converter_convert_dlist$7 = function $$convert_dlist(node) { - var $$8, $$10, self = this, result = nil, tag_name = nil, tags = nil, list_tag = nil, entry_tag = nil, label_tag = nil, term_tag = nil, item_tag = nil; + $def(self, '$convert_dlist', function $$convert_dlist(node) { + var self = this, result = nil, tag_name = nil, tags = nil, list_tag = nil, entry_tag = nil, label_tag = nil, term_tag = nil, item_tag = nil; result = []; - if (node.$style()['$==']("horizontal")) { - - result['$<<']("" + "<" + ((tag_name = (function() {if ($truthy(node['$title?']())) { - return "table" - } else { - return "informaltable" - } })())) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + " tabstyle=\"horizontal\" frame=\"none\" colsep=\"0\" rowsep=\"0\">\n" + (self.$title_tag(node)) + "\n" + "\n" + "\n" + ""); - $send(node.$items(), 'each', [], ($$8 = function(terms, dd){var self = $$8.$$s || this, $$9; - + if ($eqeq(node.$style(), "horizontal")) { + result['$<<']("<" + ((tag_name = ($truthy(node['$title?']()) ? ("table") : ("informaltable")))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + " tabstyle=\"horizontal\" frame=\"none\" colsep=\"0\" rowsep=\"0\">\n" + (self.$title_tag(node)) + "\n" + "\n" + "\n" + ""); + $send(node.$items(), 'each', [], function $$3(terms, dd){ - if (terms == null) { - terms = nil; - } - if (dd == null) { - dd = nil; - } result['$<<']("" + "\n" + ""); - $send(terms, 'each', [], ($$9 = function(dt){var self = $$9.$$s || this; - - + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<']("\n" + ""); + $send(terms, 'each', [], function $$4(dt){ - if (dt == null) { - dt = nil; - } return result['$<<']("" + "" + (dt.$text()) + "");}, $$9.$$s = self, $$9.$$arity = 1, $$9)); - result['$<<']("" + "\n" + ""); + if (dt == null) dt = nil; + return result['$<<']("" + (dt.$text()) + "");}); + result['$<<']("\n" + ""); if ($truthy(dd)) { if ($truthy(dd['$text?']())) { - result['$<<']("" + "" + (dd.$text()) + "");} if ($truthy(dd['$blocks?']())) { - result['$<<'](dd.$content());}} return result['$<<']("" + "\n" + "");}, $$8.$$s = self, $$8.$$arity = 2, $$8)); - result['$<<']("" + "\n" + "\n" + ""); + result['$<<']("" + (dd.$text()) + ""); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } return result['$<<']("\n" + "");}); + result['$<<']("\n" + "\n" + ""); } else { - tags = $$($nesting, 'DLIST_TAGS')['$[]'](node.$style()); + tags = $$('DLIST_TAGS')['$[]'](node.$style()); list_tag = tags['$[]']("list"); entry_tag = tags['$[]']("entry"); label_tag = tags['$[]']("label"); @@ -174,149 +163,119 @@ function register () { item_tag = tags['$[]']("item"); if ($truthy(list_tag)) { - result['$<<']("" + "<" + (list_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"); + result['$<<']("<" + (list_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");}} $send(node.$items(), 'each', [], ($$10 = function(terms, dd){var self = $$10.$$s || this, $$11; - - + result['$<<']("" + (node.$title()) + ""); + } } $send(node.$items(), 'each', [], function $$5(terms, dd){ - if (terms == null) { - terms = nil; - } - if (dd == null) { - dd = nil; - } result['$<<']("" + "<" + (entry_tag) + ">"); + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<']("<" + (entry_tag) + ">"); if ($truthy(label_tag)) { - result['$<<']("" + "<" + (label_tag) + ">");} $send(terms, 'each', [], ($$11 = function(dt){var self = $$11.$$s || this; - - + result['$<<']("<" + (label_tag) + ">"); + } $send(terms, 'each', [], function $$6(dt){ - if (dt == null) { - dt = nil; - } return result['$<<']("" + "<" + (term_tag) + ">" + (dt.$text()) + "");}, $$11.$$s = self, $$11.$$arity = 1, $$11)); + if (dt == null) dt = nil; + return result['$<<']("<" + (term_tag) + ">" + (dt.$text()) + "");}); if ($truthy(label_tag)) { - result['$<<']("" + "");} result['$<<']("" + "<" + (item_tag) + ">"); + result['$<<'](""); + } result['$<<']("<" + (item_tag) + ">"); if ($truthy(dd)) { if ($truthy(dd['$text?']())) { - result['$<<']("" + "" + (dd.$text()) + "");} if ($truthy(dd['$blocks?']())) { - result['$<<'](dd.$content());}} result['$<<']("" + ""); - return result['$<<']("" + "");}, $$10.$$s = self, $$10.$$arity = 2, $$10)); + result['$<<']("" + (dd.$text()) + ""); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } result['$<<'](""); + return result['$<<']("");}); if ($truthy(list_tag)) { - result['$<<']("" + "");} } return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_dlist$7.$$arity = 1); + result['$<<'](""); + } } return result.$join($$('LF')); + }); - Opal.def(self, '$convert_example', $DocBook5Converter_convert_example$12 = function $$convert_example(node) { + $def(self, '$convert_example', function $$convert_example(node) { var self = this; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + (self.$enclose_content(node)) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + (self.$enclose_content(node)) + "\n" + "" } else { - return "" + "\n" + (self.$enclose_content(node)) + "\n" + "" + return "\n" + (self.$enclose_content(node)) + "\n" + "" } - }, $DocBook5Converter_convert_example$12.$$arity = 1); + }); - Opal.def(self, '$convert_floating_title', $DocBook5Converter_convert_floating_title$13 = function $$convert_floating_title(node) { + $def(self, '$convert_floating_title', function $$convert_floating_title(node) { var self = this; - return "" + "" + (node.$title()) + "" - }, $DocBook5Converter_convert_floating_title$13.$$arity = 1); + return "" + (node.$title()) + "" + }); - Opal.def(self, '$convert_image', $DocBook5Converter_convert_image$14 = function $$convert_image(node) { + $def(self, '$convert_image', function $$convert_image(node) { var self = this, width_attribute = nil, depth_attribute = nil, scale_attribute = nil, align_attribute = nil, mediaobject = nil; if ($truthy(node['$attr?']("scaledwidth"))) { - width_attribute = "" + " width=\"" + (node.$attr("scaledwidth")) + "\""; + width_attribute = " width=\"" + (node.$attr("scaledwidth")) + "\""; depth_attribute = ""; scale_attribute = ""; } else if ($truthy(node['$attr?']("scale"))) { - scale_attribute = "" + " scale=\"" + (node.$attr("scale")) + "\""; + scale_attribute = " scale=\"" + (node.$attr("scale")) + "\""; } else { - width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { - return "" + " contentwidth=\"" + (node.$attr("width")) + "\"" - } else { - return "" - } })(); - depth_attribute = (function() {if ($truthy(node['$attr?']("height"))) { - return "" + " contentdepth=\"" + (node.$attr("height")) + "\"" - } else { - return "" - } })(); + width_attribute = ($truthy(node['$attr?']("width")) ? (" contentwidth=\"" + (node.$attr("width")) + "\"") : ("")); + depth_attribute = ($truthy(node['$attr?']("height")) ? (" contentdepth=\"" + (node.$attr("height")) + "\"") : ("")); scale_attribute = ""; - } align_attribute = (function() {if ($truthy(node['$attr?']("align"))) { - return "" + " align=\"" + (node.$attr("align")) + "\"" - } else { - return "" - } })(); - mediaobject = "" + "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; + } align_attribute = ($truthy(node['$attr?']("align")) ? (" align=\"" + (node.$attr("align")) + "\"") : ("")); + mediaobject = "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + (mediaobject) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + (mediaobject) + "\n" + "" } else { - return "" + "\n" + (mediaobject) + "\n" + "" - } }, $DocBook5Converter_convert_image$14.$$arity = 1); + return "\n" + (mediaobject) + "\n" + "" + } }); - Opal.def(self, '$convert_listing', $DocBook5Converter_convert_listing$15 = function $$convert_listing(node) { + $def(self, '$convert_listing', function $$convert_listing(node) { var self = this, informal = nil, common_attrs = nil, attrs = nil, numbering_attrs = nil, wrapped_content = nil; informal = node['$title?']()['$!'](); common_attrs = self.$common_attributes(node.$id(), node.$role(), node.$reftext()); - if (node.$style()['$==']("source")) { + if ($eqeq(node.$style(), "source")) { if ($truthy((attrs = node.$attributes())['$key?']("linenums"))) { - numbering_attrs = (function() {if ($truthy(attrs['$key?']("start"))) { - return "" + " linenumbering=\"numbered\" startinglinenumber=\"" + (attrs['$[]']("start").$to_i()) + "\"" - } else { - return " linenumbering=\"numbered\"" - } })(); + numbering_attrs = ($truthy(attrs['$key?']("start")) ? (" linenumbering=\"numbered\" startinglinenumber=\"" + (attrs['$[]']("start").$to_i()) + "\"") : (" linenumbering=\"numbered\"")); } else { numbering_attrs = " linenumbering=\"unnumbered\""; } if ($truthy(attrs['$key?']("language"))) { - wrapped_content = "" + "" + (node.$content()) + ""; + wrapped_content = "" + (node.$content()) + ""; } else { - wrapped_content = "" + "" + (node.$content()) + ""; + wrapped_content = "" + (node.$content()) + ""; } } else { - wrapped_content = "" + "" + (node.$content()) + ""; + wrapped_content = "" + (node.$content()) + ""; } if ($truthy(informal)) { return wrapped_content } else { - return "" + "\n" + "" + (node.$title()) + "\n" + "\n" + (wrapped_content) + "\n" + "\n" + "" - } }, $DocBook5Converter_convert_listing$15.$$arity = 1); + return "\n" + "" + (node.$title()) + "\n" + "\n" + (wrapped_content) + "\n" + "\n" + "" + } }); - Opal.def(self, '$convert_literal', $DocBook5Converter_convert_literal$16 = function $$convert_literal(node) { + $def(self, '$convert_literal', function $$convert_literal(node) { var self = this; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + "\n" + "" + (node.$content()) + "\n" + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + "\n" + "" + (node.$content()) + "\n" + "\n" + "" } else { - return "" + "" + (node.$content()) + "" + return "" + (node.$content()) + "" } - }, $DocBook5Converter_convert_literal$16.$$arity = 1); - Opal.alias(self, "convert_pass", "content_only"); + }); + $alias(self, "convert_pass", "content_only"); - Opal.def(self, '$convert_stem', $DocBook5Converter_convert_stem$17 = function $$convert_stem(node) { - var $a, self = this, idx = nil, equation = nil, equation_data = nil; + $def(self, '$convert_stem', function $$convert_stem(node) { + var self = this, idx = nil, equation = nil, equation_data = nil; if ($truthy((idx = node.$subs().$index("specialcharacters")))) { node.$subs().$delete_at(idx); - equation = ($truthy($a = node.$content()) ? $a : ""); + equation = node.$content(); if ($truthy($rb_gt(idx, 0))) { node.$subs().$insert(idx, "specialcharacters"); @@ -324,479 +283,373 @@ function register () { node.$subs().$unshift("specialcharacters"); } } else { - equation = ($truthy($a = node.$content()) ? $a : ""); - } if (node.$style()['$==']("asciimath")) { - equation_data = (function() {if ($truthy(self['$asciimath_available?']())) { - - return $$$('::', 'AsciiMath').$parse(equation).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"})); - } else { - return "" + "" - } })(); + equation = node.$content(); + } if ($eqeq(node.$style(), "asciimath")) { + equation_data = ($truthy(self['$asciimath_available?']()) ? ($$$('AsciiMath').$parse(equation).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) : ("")); } else { - equation_data = "" + "\n" + ""; + equation_data = "\n" + ""; } if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + (equation_data) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + (equation_data) + "\n" + "" } else { - return "" + "\n" + (equation_data) + "\n" + "" - } }, $DocBook5Converter_convert_stem$17.$$arity = 1); + return "\n" + (equation_data) + "\n" + "" + } }); - Opal.def(self, '$convert_olist', $DocBook5Converter_convert_olist$18 = function $$convert_olist(node) { - var $$19, self = this, result = nil, num_attribute = nil, start_attribute = nil; + $def(self, '$convert_olist', function $$convert_olist(node) { + var self = this, result = nil, num_attribute = nil, start_attribute = nil; result = []; - num_attribute = (function() {if ($truthy(node.$style())) { - return "" + " numeration=\"" + (node.$style()) + "\"" - } else { - return "" - } })(); - start_attribute = (function() {if ($truthy(node['$attr?']("start"))) { - return "" + " startingnumber=\"" + (node.$attr("start")) + "\"" - } else { - return "" - } })(); - result['$<<']("" + ""); + num_attribute = ($truthy(node.$style()) ? (" numeration=\"" + (node.$style()) + "\"") : ("")); + start_attribute = ($truthy(node['$attr?']("start")) ? (" startingnumber=\"" + (node.$attr("start")) + "\"") : ("")); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$19 = function(item){var self = $$19.$$s || this; + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$7(item){var self = $$7.$$s == null ? this : $$7.$$s; - - if (item == null) { - item = nil; - } result['$<<']("" + ""); - result['$<<']("" + "" + (item.$text()) + ""); + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$19.$$s = self, $$19.$$arity = 1, $$19)); + result['$<<'](item.$content()); + } return result['$<<']("");}, {$$s: self}); result['$<<'](""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_olist$18.$$arity = 1); + return result.$join($$('LF')); + }); - Opal.def(self, '$convert_open', $DocBook5Converter_convert_open$20 = function $$convert_open(node) { - var $a, $b, self = this, $case = nil, id = nil, reftext = nil, role = nil, content_spacer = nil; + $def(self, '$convert_open', function $$convert_open(node) { + var self = this, id = nil, reftext = nil, role = nil, content_spacer = nil; - return (function() {$case = node.$style(); - if ("abstract"['$===']($case)) {if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) { - - self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); - return ""; - } else { - return "" + "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - }} - else if ("partintro"['$===']($case)) {if ($truthy(($truthy($a = (($b = node.$level()['$=='](0)) ? node.$parent().$context()['$==']("section") : node.$level()['$=='](0))) ? node.$document().$doctype()['$==']("book") : $a))) { - return "" + "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - } else { - - self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); - return ""; - }} - else { - if ($truthy((id = node.$id()))) { - reftext = node.$reftext();} role = node.$role(); - if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + "" + ((content_spacer = (function() {if (node.$content_model()['$==']("compound")) { - return $$($nesting, 'LF') - } else { - return "" - } })())) + (node.$content()) + (content_spacer) + "\n" + "" - } else if ($truthy(($truthy($a = id) ? $a : role))) { - if (node.$content_model()['$==']("compound")) { - return "" + "\n" + (node.$content()) + "\n" + "" - } else { - return "" + "" + (node.$content()) + "" - } - } else { - return self.$enclose_content(node) - }}})() - }, $DocBook5Converter_convert_open$20.$$arity = 1); + + switch (node.$style()) { + case "abstract": + if (($eqeq(node.$parent(), node.$document()) && ($eqeq(node.$document().$doctype(), "book")))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + } + case "partintro": + if ((($eqeq(node.$level(), 0) && ($eqeq(node.$parent().$context(), "section"))) && ($eqeq(node.$document().$doctype(), "book")))) { + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + } else { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } + default: + + if ($truthy((id = node.$id()))) { + reftext = node.$reftext(); + } role = node.$role(); + if ($truthy(node['$title?']())) { + return "\n" + "" + (node.$title()) + "\n" + "" + ((content_spacer = ($eqeq(node.$content_model(), "compound") ? ($$('LF')) : ("")))) + (node.$content()) + (content_spacer) + "\n" + "" + } else if (($truthy(id) || ($truthy(role)))) { + if ($eqeq(node.$content_model(), "compound")) { + return "\n" + (node.$content()) + "\n" + "" + } else { + return "" + (node.$content()) + "" + } + } else { + return self.$enclose_content(node) + } } + }); - Opal.def(self, '$convert_page_break', $DocBook5Converter_convert_page_break$21 = function $$convert_page_break(node) { - - return "" - }, $DocBook5Converter_convert_page_break$21.$$arity = 1); + $def(self, '$convert_page_break', $return_val("")); - Opal.def(self, '$convert_paragraph', $DocBook5Converter_convert_paragraph$22 = function $$convert_paragraph(node) { + $def(self, '$convert_paragraph', function $$convert_paragraph(node) { var self = this; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + "" + (node.$content()) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + "" + (node.$content()) + "\n" + "" } else { - return "" + "" + (node.$content()) + "" + return "" + (node.$content()) + "" } - }, $DocBook5Converter_convert_paragraph$22.$$arity = 1); + }); - Opal.def(self, '$convert_preamble', $DocBook5Converter_convert_preamble$23 = function $$convert_preamble(node) { + $def(self, '$convert_preamble', function $$convert_preamble(node) { var self = this; - if (node.$document().$doctype()['$==']("book")) { - return "" + "\n" + (self.$title_tag(node, false)) + (node.$content()) + "\n" + "" + if ($eqeq(node.$document().$doctype(), "book")) { + return "\n" + (self.$title_tag(node, false)) + (node.$content()) + "\n" + "" } else { return node.$content() } - }, $DocBook5Converter_convert_preamble$23.$$arity = 1); + }); - Opal.def(self, '$convert_quote', $DocBook5Converter_convert_quote$24 = function $$convert_quote(node) { - var $a, $$25, self = this; + $def(self, '$convert_quote', function $$convert_quote(node) { + var self = this, $ret_or_1 = nil; - return $send(self, 'blockquote_tag', [node, ($truthy($a = node['$has_role?']("epigraph")) ? "epigraph" : $a)], ($$25 = function(){var self = $$25.$$s || this; + return $send(self, 'blockquote_tag', [node, ($truthy(($ret_or_1 = node['$has_role?']("epigraph"))) ? ("epigraph") : ($ret_or_1))], function $$8(){var self = $$8.$$s == null ? this : $$8.$$s; - return self.$enclose_content(node)}, $$25.$$s = self, $$25.$$arity = 0, $$25)) - }, $DocBook5Converter_convert_quote$24.$$arity = 1); + return self.$enclose_content(node)}, {$$s: self}) + }); - Opal.def(self, '$convert_thematic_break', $DocBook5Converter_convert_thematic_break$26 = function $$convert_thematic_break(node) { - - return "" - }, $DocBook5Converter_convert_thematic_break$26.$$arity = 1); + $def(self, '$convert_thematic_break', $return_val("")); - Opal.def(self, '$convert_sidebar', $DocBook5Converter_convert_sidebar$27 = function $$convert_sidebar(node) { + $def(self, '$convert_sidebar', function $$convert_sidebar(node) { var self = this; - return "" + "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - }, $DocBook5Converter_convert_sidebar$27.$$arity = 1); + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + }); - Opal.def(self, '$convert_table', $DocBook5Converter_convert_table$28 = function $$convert_table(node) { - var $$29, $$30, $$31, self = this, has_body = nil, result = nil, pgwide_attribute = nil, frame = nil, grid = nil, tag_name = nil, col_width_key = nil, width = nil; + $def(self, '$convert_table', function $$convert_table(node) { + var self = this, has_body = nil, result = nil, pgwide_attribute = nil, frame = nil, grid = nil, tag_name = nil, width = nil, col_width_key = nil; has_body = false; result = []; - pgwide_attribute = (function() {if ($truthy(node['$option?']("pgwide"))) { - return " pgwide=\"1\"" - } else { - return "" - } })(); - if ((frame = node.$attr("frame", "all", "table-frame"))['$==']("ends")) { - frame = "topbot";} grid = node.$attr("grid", nil, "table-grid"); - result['$<<']("" + "<" + ((tag_name = (function() {if ($truthy(node['$title?']())) { - return "table" - } else { - return "informaltable" - } })())) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + (pgwide_attribute) + " frame=\"" + (frame) + "\" rowsep=\"" + ((function() {if ($truthy(["none", "cols"]['$include?'](grid))) { - return 0 - } else { - return 1 - } })()) + "\" colsep=\"" + ((function() {if ($truthy(["none", "rows"]['$include?'](grid))) { - return 0 - } else { - return 1 - } })()) + "\"" + ((function() {if ($truthy(node['$attr?']("orientation", "landscape", "table-orientation"))) { - return " orient=\"land\"" - } else { - return "" - } })()) + ">"); + pgwide_attribute = ($truthy(node['$option?']("pgwide")) ? (" pgwide=\"1\"") : ("")); + if ($eqeq((frame = node.$attr("frame", "all", "table-frame")), "ends")) { + frame = "topbot"; + } grid = node.$attr("grid", nil, "table-grid"); + result['$<<']("<" + ((tag_name = ($truthy(node['$title?']()) ? ("table") : ("informaltable")))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + (pgwide_attribute) + " frame=\"" + (frame) + "\" rowsep=\"" + (($truthy(["none", "cols"]['$include?'](grid)) ? (0) : (1))) + "\" colsep=\"" + (($truthy(["none", "rows"]['$include?'](grid)) ? (0) : (1))) + "\"" + (($truthy(node['$attr?']("orientation", "landscape", "table-orientation")) ? (" orient=\"land\"") : (""))) + ">"); if ($truthy(node['$option?']("unbreakable"))) { result['$<<'](""); } else if ($truthy(node['$option?']("breakable"))) { - result['$<<']("");} if (tag_name['$==']("table")) { - result['$<<']("" + "" + (node.$title()) + "");} col_width_key = (function() {if ($truthy((width = (function() {if ($truthy(node['$attr?']("width"))) { - - return node.$attr("width"); - } else { - return nil - } })()))) { - - $send($$($nesting, 'TABLE_PI_NAMES'), 'each', [], ($$29 = function(pi_name){var self = $$29.$$s || this; - + result['$<<'](""); + } if ($eqeq(tag_name, "table")) { + result['$<<']("" + (node.$title()) + ""); + } if ($truthy((width = ($truthy(node['$attr?']("width")) ? (node.$attr("width")) : (nil))))) { + $send($$('TABLE_PI_NAMES'), 'each', [], function $$9(pi_name){ - if (pi_name == null) { - pi_name = nil; - } return result['$<<']("" + "");}, $$29.$$s = self, $$29.$$arity = 1, $$29)); - return "colabswidth"; + if (pi_name == null) pi_name = nil; + return result['$<<']("");}); + col_width_key = "colabswidth"; } else { - return "colpcwidth" - } })(); - result['$<<']("" + ""); - $send(node.$columns(), 'each', [], ($$30 = function(col){var self = $$30.$$s || this; - - + col_width_key = "colpcwidth"; + } result['$<<'](""); + $send(node.$columns(), 'each', [], function $$10(col){ - if (col == null) { - col = nil; - } return result['$<<']("" + "");}, $$30.$$s = self, $$30.$$arity = 1, $$30)); - $send(node.$rows().$to_h(), 'each', [], ($$31 = function(tsec, rows){var self = $$31.$$s || this, $$32; - - - - if (tsec == null) { - tsec = nil; - } - if (rows == null) { - rows = nil; - } if ($truthy(rows['$empty?']())) { - return nil;} if (tsec['$==']("body")) { - has_body = true;} result['$<<']("" + ""); - $send(rows, 'each', [], ($$32 = function(row){var self = $$32.$$s || this, $$33; - + if (col == null) col = nil; + return result['$<<']("");}); + $send(node.$rows().$to_h(), 'each', [], function $$11(tsec, rows){ + if (tsec == null) tsec = nil; + if (rows == null) rows = nil; + if ($truthy(rows['$empty?']())) { + return nil + } if ($eqeq(tsec, "body")) { + has_body = true; + } result['$<<'](""); + $send(rows, 'each', [], function $$12(row){ - if (row == null) { - row = nil; - } result['$<<'](""); - $send(row, 'each', [], ($$33 = function(cell){var self = $$33.$$s || this, halign_attribute = nil, valign_attribute = nil, colspan_attribute = nil, colnum = nil, rowspan_attribute = nil, entry_start = nil, cell_content = nil, $case = nil, entry_end = nil; + if (row == null) row = nil; + result['$<<'](""); + $send(row, 'each', [], function $$13(cell){var colspan_attribute = nil, colnum = nil, rowspan_attribute = nil, entry_start = nil, cell_content = nil, entry_end = nil; - - if (cell == null) { - cell = nil; - } halign_attribute = (function() {if ($truthy(cell['$attr?']("halign"))) { - return "" + " align=\"" + (cell.$attr("halign")) + "\"" - } else { - return "" - } })(); - valign_attribute = (function() {if ($truthy(cell['$attr?']("valign"))) { - return "" + " valign=\"" + (cell.$attr("valign")) + "\"" - } else { - return "" - } })(); - colspan_attribute = (function() {if ($truthy(cell.$colspan())) { - return "" + " namest=\"col_" + ((colnum = cell.$column().$attr("colnumber"))) + "\" nameend=\"col_" + ($rb_minus($rb_plus(colnum, cell.$colspan()), 1)) + "\"" - } else { - return "" - } })(); - rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) { - return "" + " morerows=\"" + ($rb_minus(cell.$rowspan(), 1)) + "\"" - } else { - return "" - } })(); - entry_start = "" + ""; - if (tsec['$==']("head")) { + if (cell == null) cell = nil; + colspan_attribute = ($truthy(cell.$colspan()) ? (" namest=\"col_" + ((colnum = cell.$column().$attr("colnumber"))) + "\" nameend=\"col_" + ($rb_minus($rb_plus(colnum, cell.$colspan()), 1)) + "\"") : ("")); + rowspan_attribute = ($truthy(cell.$rowspan()) ? (" morerows=\"" + ($rb_minus(cell.$rowspan(), 1)) + "\"") : ("")); + entry_start = ""; + if ($eqeq(tsec, "head")) { cell_content = cell.$text(); - } else { - $case = cell.$style(); - if ("asciidoc"['$===']($case)) {cell_content = cell.$content();} - else if ("literal"['$===']($case)) {cell_content = "" + "" + (cell.$text()) + "";} - else if ("header"['$===']($case)) {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { - return "" - } else { - return "" + "" + (cell_content.$join("")) + "" - } })();} - else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { - return "" - } else { - return "" + "" + (cell_content.$join("")) + "" - } })();} - } entry_end = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) { - return "" + "" - } else { - return "" - } })(); - return result['$<<']("" + (entry_start) + (cell_content) + (entry_end));}, $$33.$$s = self, $$33.$$arity = 1, $$33)); - return result['$<<']("");}, $$32.$$s = self, $$32.$$arity = 1, $$32)); - return result['$<<']("" + "");}, $$31.$$s = self, $$31.$$arity = 2, $$31)); + } else + switch (cell.$style()) { + case "asciidoc": + cell_content = cell.$content(); + break; + case "literal": + cell_content = "" + (cell.$text()) + ""; + break; + case "header": + cell_content = ($truthy((cell_content = cell.$content())['$empty?']()) ? ("") : ("" + (cell_content.$join("")) + "")); + break; + default: + cell_content = ($truthy((cell_content = cell.$content())['$empty?']()) ? ("") : ("" + (cell_content.$join("")) + "")); + } entry_end = ($truthy(node.$document()['$attr?']("cellbgcolor")) ? ("") : ("")); + return result['$<<']("" + (entry_start) + (cell_content) + (entry_end));}); + return result['$<<']("");}); + return result['$<<']("");}); result['$<<'](""); - result['$<<']("" + ""); - if ($truthy(has_body)) ; else { + result['$<<'](""); + if (!$truthy(has_body)) { self.$logger().$warn("tables must have at least one body row"); - } return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_table$28.$$arity = 1); - Opal.alias(self, "convert_toc", "skip"); + } return result.$join($$('LF')); + }); + $alias(self, "convert_toc", "skip"); - Opal.def(self, '$convert_ulist', $DocBook5Converter_convert_ulist$34 = function $$convert_ulist(node) { - var $$35, $$36, self = this, result = nil, mark_type = nil, checklist = nil, mark_attribute = nil; + $def(self, '$convert_ulist', function $$convert_ulist(node) { + var self = this, result = nil, mark_type = nil, checklist = nil, mark_attribute = nil; result = []; - if (node.$style()['$==']("bibliography")) { + if ($eqeq(node.$style(), "bibliography")) { - result['$<<']("" + ""); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$35 = function(item){var self = $$35.$$s || this; - - + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$14(item){ - if (item == null) { - item = nil; - } result['$<<'](""); - result['$<<']("" + "" + (item.$text()) + ""); + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$35.$$s = self, $$35.$$arity = 1, $$35)); + result['$<<'](item.$content()); + } return result['$<<']("");}); result['$<<'](""); } else { - mark_type = (function() {if ($truthy((checklist = node['$option?']("checklist")))) { - return "none" - } else { - return node.$style() - } })(); - mark_attribute = (function() {if ($truthy(mark_type)) { - return "" + " mark=\"" + (mark_type) + "\"" - } else { - return "" - } })(); - result['$<<']("" + ""); + mark_type = ($truthy((checklist = node['$option?']("checklist"))) ? ("none") : (node.$style())); + mark_attribute = ($truthy(mark_type) ? (" mark=\"" + (mark_type) + "\"") : ("")); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$36 = function(item){var self = $$36.$$s || this, $a, text_marker = nil; + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$15(item){var self = $$15.$$s == null ? this : $$15.$$s, text_marker = nil, $ret_or_1 = nil; - - if (item == null) { - item = nil; - } if ($truthy(($truthy($a = checklist) ? item['$attr?']("checkbox") : $a))) { - text_marker = (function() {if ($truthy(item['$attr?']("checked"))) { - return "✓ " - } else { - return "❏ " - } })();} result['$<<']("" + ""); - result['$<<']("" + "" + (($truthy($a = text_marker) ? $a : "")) + (item.$text()) + ""); + if (item == null) item = nil; + if (($truthy(checklist) && ($truthy(item['$attr?']("checkbox"))))) { + text_marker = ($truthy(item['$attr?']("checked")) ? ("✓ ") : ("❏ ")); + } result['$<<'](""); + result['$<<']("" + (($truthy(($ret_or_1 = text_marker)) ? ($ret_or_1) : (""))) + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$36.$$s = self, $$36.$$arity = 1, $$36)); + result['$<<'](item.$content()); + } return result['$<<']("");}, {$$s: self}); result['$<<'](""); - } return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_ulist$34.$$arity = 1); + } return result.$join($$('LF')); + }); - Opal.def(self, '$convert_verse', $DocBook5Converter_convert_verse$37 = function $$convert_verse(node) { - var $a, $$38, self = this; - - return $send(self, 'blockquote_tag', [node, ($truthy($a = node['$has_role?']("epigraph")) ? "epigraph" : $a)], ($$38 = function(){var self = $$38.$$s || this; + $def(self, '$convert_verse', function $$convert_verse(node) { + var self = this, $ret_or_1 = nil; - return "" + "" + (node.$content()) + ""}, $$38.$$s = self, $$38.$$arity = 0, $$38)) - }, $DocBook5Converter_convert_verse$37.$$arity = 1); - Opal.alias(self, "convert_video", "skip"); + return $send(self, 'blockquote_tag', [node, ($truthy(($ret_or_1 = node['$has_role?']("epigraph"))) ? ("epigraph") : ($ret_or_1))], function $$16(){ + return "" + (node.$content()) + ""}) + }); + $alias(self, "convert_video", "skip"); - Opal.def(self, '$convert_inline_anchor', $DocBook5Converter_convert_inline_anchor$39 = function $$convert_inline_anchor(node) { - var $a, self = this, $case = nil, id = nil, path = nil, linkend = nil, text = nil; + $def(self, '$convert_inline_anchor', function $$convert_inline_anchor(node) { + var $a, self = this, id = nil, $ret_or_2 = nil, path = nil, linkend = nil, root_doc = nil, text = nil; - return (function() {$case = node.$type(); - if ("ref"['$===']($case)) {return "" + ""} - else if ("xref"['$===']($case)) {if ($truthy((path = node.$attributes()['$[]']("path")))) { - return "" + "" + (($truthy($a = node.$text()) ? $a : path)) + "" - } else { - - linkend = ($truthy($a = node.$attributes()['$[]']("fragment")) ? $a : node.$target()); - if ($truthy((text = node.$text()))) { - return "" + "" + (text) + "" - } else { - return "" + "" - } }} - else if ("link"['$===']($case)) {return "" + "" + (node.$text()) + ""} - else if ("bibref"['$===']($case)) {return "" + "" + (text)} - else { - self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect())); - return nil;}})() - }, $DocBook5Converter_convert_inline_anchor$39.$$arity = 1); + + switch (node.$type()) { + case "ref": + return "" + case "xref": + if ($truthy((path = node.$attributes()['$[]']("path")))) { + return "" + (($truthy(($ret_or_2 = node.$text())) ? ($ret_or_2) : (path))) + "" + } else { + + if ($truthy((linkend = node.$attributes()['$[]']("refid"))['$nil_or_empty?']())) { + + root_doc = self.$get_root_document(node); + linkend = ($truthy(($ret_or_2 = root_doc.$id())) ? ($ret_or_2) : (($a = [self.$generate_document_id(root_doc)], $send(root_doc, 'id=', $a), $a[$a.length - 1]))); + } if ($truthy((text = node.$text()))) { + return "" + (text) + "" + } else { + return "" + } } + case "link": + return "" + (node.$text()) + "" + case "bibref": + return "" + (text) + default: + + self.$logger().$warn("unknown anchor type: " + (node.$type().$inspect())); + return nil; + } + }); - Opal.def(self, '$convert_inline_break', $DocBook5Converter_convert_inline_break$40 = function $$convert_inline_break(node) { - + $def(self, '$convert_inline_break', function $$convert_inline_break(node) { + return "" + (node.$text()) + "" - }, $DocBook5Converter_convert_inline_break$40.$$arity = 1); + }); - Opal.def(self, '$convert_inline_button', $DocBook5Converter_convert_inline_button$41 = function $$convert_inline_button(node) { - - return "" + "" + (node.$text()) + "" - }, $DocBook5Converter_convert_inline_button$41.$$arity = 1); + $def(self, '$convert_inline_button', function $$convert_inline_button(node) { + + return "" + (node.$text()) + "" + }); - Opal.def(self, '$convert_inline_callout', $DocBook5Converter_convert_inline_callout$42 = function $$convert_inline_callout(node) { + $def(self, '$convert_inline_callout', function $$convert_inline_callout(node) { var self = this; - return "" + "" - }, $DocBook5Converter_convert_inline_callout$42.$$arity = 1); + return "" + }); - Opal.def(self, '$convert_inline_footnote', $DocBook5Converter_convert_inline_footnote$43 = function $$convert_inline_footnote(node) { + $def(self, '$convert_inline_footnote', function $$convert_inline_footnote(node) { var self = this; - if (node.$type()['$==']("xref")) { - return "" + "" + if ($eqeq(node.$type(), "xref")) { + return "" } else { - return "" + "" + (node.$text()) + "" + return "" + (node.$text()) + "" } - }, $DocBook5Converter_convert_inline_footnote$43.$$arity = 1); + }); - Opal.def(self, '$convert_inline_image', $DocBook5Converter_convert_inline_image$44 = function $$convert_inline_image(node) { - var width_attribute = nil, depth_attribute = nil; + $def(self, '$convert_inline_image', function $$convert_inline_image(node) { + var self = this, width_attribute = nil, depth_attribute = nil; - width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { - return "" + " contentwidth=\"" + (node.$attr("width")) + "\"" - } else { - return "" - } })(); - depth_attribute = (function() {if ($truthy(node['$attr?']("height"))) { - return "" + " contentdepth=\"" + (node.$attr("height")) + "\"" - } else { - return "" - } })(); - return "" + "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; - }, $DocBook5Converter_convert_inline_image$44.$$arity = 1); + width_attribute = ($truthy(node['$attr?']("width")) ? (" contentwidth=\"" + (node.$attr("width")) + "\"") : ("")); + depth_attribute = ($truthy(node['$attr?']("height")) ? (" contentdepth=\"" + (node.$attr("height")) + "\"") : ("")); + return "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; + }); - Opal.def(self, '$convert_inline_indexterm', $DocBook5Converter_convert_inline_indexterm$45 = function $$convert_inline_indexterm(node) { - var $$46, self = this, see = nil, rel = nil, see_also_list = nil, numterms = nil, terms = nil; + $def(self, '$convert_inline_indexterm', function $$convert_inline_indexterm(node) { + var see = nil, rel = nil, see_also_list = nil, numterms = nil, terms = nil; if ($truthy((see = node.$attr("see")))) { - rel = "" + "\n" + (see) + ""; + rel = "\n" + (see) + ""; } else if ($truthy((see_also_list = node.$attr("see-also")))) { - rel = $send(see_also_list, 'map', [], ($$46 = function(see_also){var self = $$46.$$s || this; - - + rel = $send(see_also_list, 'map', [], function $$17(see_also){ - if (see_also == null) { - see_also = nil; - } return "" + "\n" + (see_also) + "";}, $$46.$$s = self, $$46.$$arity = 1, $$46)).$join(); + if (see_also == null) see_also = nil; + return "\n" + (see_also) + "";}).$join(); } else { rel = ""; - } if (node.$type()['$==']("visible")) { - return "" + "\n" + "" + (node.$text()) + "" + (rel) + "\n" + "" + (node.$text()) + } if ($eqeq(node.$type(), "visible")) { + return "\n" + "" + (node.$text()) + "" + (rel) + "\n" + "" + (node.$text()) } else if ($truthy($rb_gt((numterms = (terms = node.$attr("terms")).$size()), 2))) { - return "" + "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "" + (rel) + "\n" + "" + ((function() {if ($truthy(node.$document()['$option?']("indexterm-promotion"))) { - return "" + "\n" + "\n" + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "\n" + "\n" + "\n" + "" + (terms['$[]'](2)) + "\n" + "" - } else { - return "" - } })()) + return "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "" + (rel) + "\n" + "" + (($truthy(node.$document()['$option?']("indexterm-promotion")) ? ("\n" + "\n" + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "\n" + "\n" + "\n" + "" + (terms['$[]'](2)) + "\n" + "") : (""))) } else if ($truthy($rb_gt(numterms, 1))) { - return "" + "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (rel) + "\n" + "" + ((function() {if ($truthy(node.$document()['$option?']("indexterm-promotion"))) { - return "" + "\n" + "\n" + "" + (terms['$[]'](1)) + "\n" + "" - } else { - return "" - } })()) + return "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (rel) + "\n" + "" + (($truthy(node.$document()['$option?']("indexterm-promotion")) ? ("\n" + "\n" + "" + (terms['$[]'](1)) + "\n" + "") : (""))) } else { - return "" + "\n" + "" + (terms['$[]'](0)) + "" + (rel) + "\n" + "" - } }, $DocBook5Converter_convert_inline_indexterm$45.$$arity = 1); + return "\n" + "" + (terms['$[]'](0)) + "" + (rel) + "\n" + "" + } }); - Opal.def(self, '$convert_inline_kbd', $DocBook5Converter_convert_inline_kbd$47 = function $$convert_inline_kbd(node) { + $def(self, '$convert_inline_kbd', function $$convert_inline_kbd(node) { var keys = nil; - if ((keys = node.$attr("keys")).$size()['$=='](1)) { - return "" + "" + (keys['$[]'](0)) + "" + if ($eqeq((keys = node.$attr("keys")).$size(), 1)) { + return "" + (keys['$[]'](0)) + "" } else { - return "" + "" + (keys.$join("")) + "" + return "" + (keys.$join("")) + "" } - }, $DocBook5Converter_convert_inline_kbd$47.$$arity = 1); + }); - Opal.def(self, '$convert_inline_menu', $DocBook5Converter_convert_inline_menu$48 = function $$convert_inline_menu(node) { + $def(self, '$convert_inline_menu', function $$convert_inline_menu(node) { var menu = nil, submenus = nil, menuitem = nil; menu = node.$attr("menu"); if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { if ($truthy((menuitem = node.$attr("menuitem")))) { - return "" + "" + (menu) + " " + (menuitem) + "" + return "" + (menu) + " " + (menuitem) + "" } else { - return "" + "" + (menu) + "" + return "" + (menu) + "" } } else { - return "" + "" + (menu) + " " + (submenus.$join(" ")) + " " + (node.$attr("menuitem")) + "" - } }, $DocBook5Converter_convert_inline_menu$48.$$arity = 1); + return "" + (menu) + " " + (submenus.$join(" ")) + " " + (node.$attr("menuitem")) + "" + } }); - Opal.def(self, '$convert_inline_quoted', $DocBook5Converter_convert_inline_quoted$49 = function $$convert_inline_quoted(node) { + $def(self, '$convert_inline_quoted', function $$convert_inline_quoted(node) { var $a, $b, self = this, type = nil, equation = nil, open = nil, close = nil, supports_phrase = nil, text = nil, quoted_text = nil; - if ((type = node.$type())['$==']("asciimath")) { + if ($eqeq((type = node.$type()), "asciimath")) { if ($truthy(self['$asciimath_available?']())) { - return "" + "" + ($$$('::', 'AsciiMath').$parse(node.$text()).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) + "" + return "" + ($$$('AsciiMath').$parse(node.$text()).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) + "" } else { - return "" + "" + return "" } - } else if (type['$==']("latexmath")) { - return "" + "" + } else if ($eqeq(type, "latexmath")) { + return "" } else { - $b = $$($nesting, 'QUOTE_TAGS')['$[]'](type), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (supports_phrase = ($a[2] == null ? nil : $a[2])), $b; + $b = $$('QUOTE_TAGS')['$[]'](type), $a = $to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (supports_phrase = ($a[2] == null ? nil : $a[2])); text = node.$text(); if ($truthy(node.$role())) { if ($truthy(supports_phrase)) { @@ -807,43 +660,37 @@ function register () { } else { quoted_text = "" + (open) + (text) + (close); } if ($truthy(node.$id())) { - return "" + "" + (quoted_text) + return "" + (quoted_text) } else { return quoted_text } } - }, $DocBook5Converter_convert_inline_quoted$49.$$arity = 1); + }); self.$private(); - Opal.def(self, '$common_attributes', $DocBook5Converter_common_attributes$50 = function $$common_attributes(id, role, reftext) { - var $a, attrs = nil; + $def(self, '$common_attributes', function $$common_attributes(id, role, reftext) { + var attrs = nil; - - if (role == null) { - role = nil; - } - if (reftext == null) { - reftext = nil; - } if ($truthy(id)) { - attrs = "" + " xml:id=\"" + (id) + "\"" + ((function() {if ($truthy(role)) { - return "" + " role=\"" + (role) + "\"" - } else { - return "" - } })()); + if (role == null) role = nil; + if (reftext == null) reftext = nil; + if ($truthy(id)) { + attrs = " xml:id=\"" + (id) + "\"" + (($truthy(role) ? (" role=\"" + (role) + "\"") : (""))); } else if ($truthy(role)) { - attrs = "" + " role=\"" + (role) + "\""; + attrs = " role=\"" + (role) + "\""; } else { attrs = ""; } if ($truthy(reftext)) { - if ($truthy(($truthy($a = reftext['$include?']("<")) ? (reftext = reftext.$gsub($$($nesting, 'XmlSanitizeRx'), ""))['$include?'](" ") : $a))) { - reftext = reftext.$squeeze(" ").$strip();} if ($truthy(reftext['$include?']("\""))) { - reftext = reftext.$gsub("\"", """);} return "" + (attrs) + " xreflabel=\"" + (reftext) + "\""; + if (($truthy(reftext['$include?']("<")) && ($truthy((reftext = reftext.$gsub($$('XmlSanitizeRx'), ""))['$include?'](" "))))) { + reftext = reftext.$squeeze(" ").$strip(); + } if ($truthy(reftext['$include?']("\""))) { + reftext = reftext.$gsub("\"", """); + } return "" + (attrs) + " xreflabel=\"" + (reftext) + "\""; } else { return attrs - } }, $DocBook5Converter_common_attributes$50.$$arity = -2); + } }, -2); - Opal.def(self, '$author_tag', $DocBook5Converter_author_tag$51 = function $$author_tag(doc, author) { + $def(self, '$author_tag', function $$author_tag(doc, author) { var result = nil; @@ -851,193 +698,196 @@ function register () { result['$<<'](""); result['$<<'](""); if ($truthy(author.$firstname())) { - result['$<<']("" + "" + (doc.$sub_replacements(author.$firstname())) + "");} if ($truthy(author.$middlename())) { - result['$<<']("" + "" + (doc.$sub_replacements(author.$middlename())) + "");} if ($truthy(author.$lastname())) { - result['$<<']("" + "" + (doc.$sub_replacements(author.$lastname())) + "");} result['$<<'](""); + result['$<<']("" + (doc.$sub_replacements(author.$firstname())) + ""); + } if ($truthy(author.$middlename())) { + result['$<<']("" + (doc.$sub_replacements(author.$middlename())) + ""); + } if ($truthy(author.$lastname())) { + result['$<<']("" + (doc.$sub_replacements(author.$lastname())) + ""); + } result['$<<'](""); if ($truthy(author.$email())) { - result['$<<']("" + "" + (author.$email()) + "");} result['$<<'](""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_author_tag$51.$$arity = 2); + result['$<<']("" + (author.$email()) + ""); + } result['$<<'](""); + return result.$join($$('LF')); + }); - Opal.def(self, '$document_info_tag', $DocBook5Converter_document_info_tag$52 = function $$document_info_tag(doc) { - var $a, $$53, $b, $$54, self = this, result = nil, title = nil, date = nil, authors = nil, author = nil, back_cover_tag = nil, front_cover_tag = nil, docinfo_content = nil; + $def(self, '$document_info_tag', function $$document_info_tag(doc) { + var $a, self = this, result = nil, title = nil, date = nil, authors = nil, author = nil, back_cover_tag = nil, front_cover_tag = nil, docinfo_content = nil; result = [""]; - if ($truthy(doc.$notitle())) ; else if ($truthy((title = doc.$doctitle($hash2(["partition", "use_fallback"], {"partition": true, "use_fallback": true})))['$subtitle?']())) { - result['$<<']("" + "" + (title.$main()) + "\n" + "" + (title.$subtitle()) + ""); - } else { - result['$<<']("" + "" + (title) + ""); - } if ($truthy((date = (function() {if ($truthy(doc['$attr?']("revdate"))) { - - return doc.$attr("revdate"); - } else { - - if ($truthy(doc['$attr?']("reproducible"))) { - return nil + if (!$truthy(doc.$notitle())) { + if ($truthy((title = doc.$doctitle($hash2(["partition", "use_fallback"], {"partition": true, "use_fallback": true})))['$subtitle?']())) { + result['$<<']("" + (title.$main()) + "\n" + "" + (title.$subtitle()) + ""); } else { - - return doc.$attr("docdate"); - } } })()))) { - result['$<<']("" + "" + (date) + "");} if ($truthy(doc['$attr?']("copyright"))) { + result['$<<']("" + (title) + ""); + } + } if ($truthy((date = ($truthy(doc['$attr?']("revdate")) ? (doc.$attr("revdate")) : (($truthy(doc['$attr?']("reproducible")) ? (nil) : (doc.$attr("docdate")))))))) { + result['$<<']("" + (date) + ""); + } if ($truthy(doc['$attr?']("copyright"))) { - $$($nesting, 'CopyrightRx')['$=~'](doc.$attr("copyright")); + $$('CopyrightRx')['$=~'](doc.$attr("copyright")); result['$<<'](""); - result['$<<']("" + "" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + ""); + result['$<<']("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + ""); if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { - result['$<<']("" + "" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "");} result['$<<']("");} if ($truthy(doc['$header?']())) { + result['$<<']("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + ""); + } result['$<<'](""); + } if ($truthy(doc['$header?']())) { - if ($truthy((authors = doc.$authors())['$empty?']())) ; else if ($truthy($rb_gt(authors.$size(), 1))) { - - result['$<<'](""); - $send(authors, 'each', [], ($$53 = function(author){var self = $$53.$$s || this; + if (!$truthy((authors = doc.$authors())['$empty?']())) { + if ($truthy($rb_gt(authors.$size(), 1))) { + + result['$<<'](""); + $send(authors, 'each', [], function $$18(author){var self = $$18.$$s == null ? this : $$18.$$s; - + + if (author == null) author = nil; + return result['$<<'](self.$author_tag(doc, author));}, {$$s: self}); + result['$<<'](""); + } else { - if (author == null) { - author = nil; - } return result['$<<'](self.$author_tag(doc, author));}, $$53.$$s = self, $$53.$$arity = 1, $$53)); - result['$<<'](""); - } else { + result['$<<'](self.$author_tag(doc, (author = authors['$[]'](0)))); + if ($truthy(author.$initials())) { + result['$<<']("" + (author.$initials()) + ""); + } } + } if (($truthy(doc['$attr?']("revdate")) && (($truthy(doc['$attr?']("revnumber")) || ($truthy(doc['$attr?']("revremark"))))))) { - result['$<<'](self.$author_tag(doc, (author = authors['$[]'](0)))); - if ($truthy(author.$initials())) { - result['$<<']("" + "" + (author.$initials()) + "");} } if ($truthy(($truthy($a = doc['$attr?']("revdate")) ? ($truthy($b = doc['$attr?']("revnumber")) ? $b : doc['$attr?']("revremark")) : $a))) { - - result['$<<']("" + "\n" + ""); + result['$<<']("\n" + ""); if ($truthy(doc['$attr?']("revnumber"))) { - result['$<<']("" + "" + (doc.$attr("revnumber")) + "");} if ($truthy(doc['$attr?']("revdate"))) { - result['$<<']("" + "" + (doc.$attr("revdate")) + "");} if ($truthy(doc['$attr?']("authorinitials"))) { - result['$<<']("" + "" + (doc.$attr("authorinitials")) + "");} if ($truthy(doc['$attr?']("revremark"))) { - result['$<<']("" + "" + (doc.$attr("revremark")) + "");} result['$<<']("" + "\n" + "");} if ($truthy(($truthy($a = doc['$attr?']("front-cover-image")) ? $a : doc['$attr?']("back-cover-image")))) { + result['$<<']("" + (doc.$attr("revnumber")) + ""); + } if ($truthy(doc['$attr?']("revdate"))) { + result['$<<']("" + (doc.$attr("revdate")) + ""); + } if ($truthy(doc['$attr?']("authorinitials"))) { + result['$<<']("" + (doc.$attr("authorinitials")) + ""); + } if ($truthy(doc['$attr?']("revremark"))) { + result['$<<']("" + (doc.$attr("revremark")) + ""); + } result['$<<']("\n" + ""); + } if (($truthy(doc['$attr?']("front-cover-image")) || ($truthy(doc['$attr?']("back-cover-image"))))) { if ($truthy((back_cover_tag = self.$cover_tag(doc, "back")))) { result['$<<'](self.$cover_tag(doc, "front", true)); result['$<<'](back_cover_tag); } else if ($truthy((front_cover_tag = self.$cover_tag(doc, "front")))) { - result['$<<'](front_cover_tag);}} if ($truthy(doc['$attr?']("orgname"))) { - result['$<<']("" + "" + (doc.$attr("orgname")) + "");} if ($truthy((docinfo_content = doc.$docinfo())['$empty?']())) ; else { + result['$<<'](front_cover_tag); + } + } if ($truthy(doc['$attr?']("orgname"))) { + result['$<<']("" + (doc.$attr("orgname")) + ""); + } if (!$truthy((docinfo_content = doc.$docinfo())['$empty?']())) { result['$<<'](docinfo_content); - }} result['$<<'](""); - if (doc.$doctype()['$==']("manpage")) { - - result['$<<'](""); - if ($truthy(doc['$attr?']("mantitle"))) { - result['$<<']("" + "" + (doc.$attr("mantitle")) + "");} if ($truthy(doc['$attr?']("manvolnum"))) { - result['$<<']("" + "" + (doc.$attr("manvolnum")) + "");} result['$<<']("" + "" + (doc.$attr("mansource", " ")) + ""); - result['$<<']("" + "" + (doc.$attr("manmanual", " ")) + ""); - result['$<<'](""); - result['$<<'](""); - if ($truthy(doc['$attr?']("mannames"))) { - result = $rb_plus(result, $send(doc.$attr("mannames"), 'map', [], ($$54 = function(n){var self = $$54.$$s || this; - - - - if (n == null) { - n = nil; - } return "" + "" + (n) + "";}, $$54.$$s = self, $$54.$$arity = 1, $$54)));} if ($truthy(doc['$attr?']("manpurpose"))) { - result['$<<']("" + "" + (doc.$attr("manpurpose")) + "");} result['$<<']("");} return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_document_info_tag$52.$$arity = 1); + } } result['$<<'](""); + return result.$join($$('LF')); + }); - Opal.def(self, '$enclose_content', $DocBook5Converter_enclose_content$55 = function $$enclose_content(node) { - - if (node.$content_model()['$==']("compound")) { + $def(self, '$get_root_document', function $$get_root_document(node) { + + + while ($truthy((node = node.$document())['$nested?']())) { + node = node.$parent_document(); + } return node; + }); + + $def(self, '$generate_document_id', function $$generate_document_id(doc) { + + return "__" + (doc.$doctype()) + "-root__" + }); + + $def(self, '$enclose_content', function $$enclose_content(node) { + + if ($eqeq(node.$content_model(), "compound")) { return node.$content() } else { - return "" + "" + (node.$content()) + "" + return "" + (node.$content()) + "" } - }, $DocBook5Converter_enclose_content$55.$$arity = 1); + }); - Opal.def(self, '$title_tag', $DocBook5Converter_title_tag$56 = function $$title_tag(node, optional) { - var $a; - + $def(self, '$title_tag', function $$title_tag(node, optional) { - if (optional == null) { - optional = true; - } if ($truthy(($truthy($a = optional['$!']()) ? $a : node['$title?']()))) { - return "" + "" + (node.$title()) + "\n" + if (optional == null) optional = true; + if (($not(optional) || ($truthy(node['$title?']())))) { + return "" + (node.$title()) + "\n" } else { return "" - } }, $DocBook5Converter_title_tag$56.$$arity = -2); + } }, -2); - Opal.def(self, '$cover_tag', $DocBook5Converter_cover_tag$57 = function $$cover_tag(doc, face, use_placeholder) { + $def(self, '$cover_tag', function $$cover_tag(doc, face, use_placeholder) { var $a, cover_image = nil, width_attr = nil, depth_attr = nil, attrlist = nil, attrs = nil; - - if (use_placeholder == null) { - use_placeholder = false; - } if ($truthy((cover_image = doc.$attr("" + (face) + "-cover-image")))) { + if (use_placeholder == null) use_placeholder = false; + if ($truthy((cover_image = doc.$attr("" + (face) + "-cover-image")))) { width_attr = ""; depth_attr = ""; - if ($truthy(($truthy($a = cover_image['$include?'](":")) ? $$($nesting, 'ImageMacroRx')['$=~'](cover_image) : $a))) { + if (($truthy(cover_image['$include?'](":")) && ($truthy($$('ImageMacroRx')['$=~'](cover_image))))) { attrlist = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)); cover_image = doc.$image_uri((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))); if ($truthy(attrlist)) { - attrs = $$($nesting, 'AttributeList').$new(attrlist).$parse(["alt", "width", "height"]); + attrs = $$('AttributeList').$new(attrlist).$parse(["alt", "width", "height"]); if ($truthy(attrs['$key?']("scaledwidth"))) { - width_attr = "" + " width=\"" + (attrs['$[]']("scaledwidth")) + "\""; + width_attr = " width=\"" + (attrs['$[]']("scaledwidth")) + "\""; } else { if ($truthy(attrs['$key?']("width"))) { - width_attr = "" + " contentwidth=\"" + (attrs['$[]']("width")) + "\"";} if ($truthy(attrs['$key?']("height"))) { - depth_attr = "" + " contentdepth=\"" + (attrs['$[]']("height")) + "\"";} }}} return "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + width_attr = " contentwidth=\"" + (attrs['$[]']("width")) + "\""; + } if ($truthy(attrs['$key?']("height"))) { + depth_attr = " contentdepth=\"" + (attrs['$[]']("height")) + "\""; + } } } } return "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; } else if ($truthy(use_placeholder)) { - return "" + "" + return "" } else { return nil - } }, $DocBook5Converter_cover_tag$57.$$arity = -3); + } }, -3); - Opal.def(self, '$blockquote_tag', $DocBook5Converter_blockquote_tag$58 = function $$blockquote_tag(node, tag_name) { - var $a, $iter = $DocBook5Converter_blockquote_tag$58.$$p, $yield = $iter || nil, self = this, start_tag = nil, end_tag = nil, result = nil; + $def(self, '$blockquote_tag', function $$blockquote_tag(node, tag_name) { + var $a, $yield = $$blockquote_tag.$$p || nil, self = this, start_tag = nil, end_tag = nil, result = nil; - if ($iter) $DocBook5Converter_blockquote_tag$58.$$p = null; - + $$blockquote_tag.$$p = null; - if (tag_name == null) { - tag_name = nil; - } if ($truthy(tag_name)) { - $a = ["" + "<" + (tag_name), "" + ""], (start_tag = $a[0]), (end_tag = $a[1]), $a; + if (tag_name == null) tag_name = nil; + if ($truthy(tag_name)) { + $a = ["<" + (tag_name), ""], (start_tag = $a[0]), (end_tag = $a[1]); } else { - $a = [""], (start_tag = $a[0]), (end_tag = $a[1]), $a; + $a = [""], (start_tag = $a[0]), (end_tag = $a[1]); } result = ["" + (start_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"]; if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} if ($truthy(($truthy($a = node['$attr?']("attribution")) ? $a : node['$attr?']("citetitle")))) { + result['$<<']("" + (node.$title()) + ""); + } if (($truthy(node['$attr?']("attribution")) || ($truthy(node['$attr?']("citetitle"))))) { result['$<<'](""); if ($truthy(node['$attr?']("attribution"))) { - result['$<<'](node.$attr("attribution"));} if ($truthy(node['$attr?']("citetitle"))) { - result['$<<']("" + "" + (node.$attr("citetitle")) + "");} result['$<<']("");} result['$<<'](Opal.yieldX($yield, [])); + result['$<<'](node.$attr("attribution")); + } if ($truthy(node['$attr?']("citetitle"))) { + result['$<<']("" + (node.$attr("citetitle")) + ""); + } result['$<<'](""); + } result['$<<'](Opal.yieldX($yield, [])); result['$<<'](end_tag); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_blockquote_tag$58.$$arity = -2); + return result.$join($$('LF')); + }, -2); - Opal.def(self, '$asciimath_available?', $DocBook5Converter_asciimath_available$ques$59 = function() { - var $a, self = this; + $def(self, '$asciimath_available?', function $DocBook5Converter_asciimath_available$ques$19() { + var self = this, $ret_or_1 = nil; - return (self.asciimath_status = ($truthy($a = self.asciimath_status) ? $a : self.$load_asciimath()))['$==']("loaded") - }, $DocBook5Converter_asciimath_available$ques$59.$$arity = 0); - return (Opal.def(self, '$load_asciimath', $DocBook5Converter_load_asciimath$60 = function $$load_asciimath() { + return (self.asciimath_status = ($truthy(($ret_or_1 = self.asciimath_status)) ? ($ret_or_1) : (self.$load_asciimath())))['$==']("loaded") + }); + return $def(self, '$load_asciimath', function $$load_asciimath() { var $a, $b, $c, $d; if ($truthy(((($a = $$$('::', 'AsciiMath', 'skip_raise')) && ($b = $a, $b) && ($c = $b) && ((($d = $c.$parse) && !$d.$$stub) || $c['$respond_to_missing?']('parse'))) ? 'method' : nil))) { return "loaded" - } else if ($truthy($$($nesting, 'Helpers').$require_library("asciimath", true, "warn")['$nil?']())) { + } else if ($truthy($$('Helpers').$require_library("asciimath", true, "warn")['$nil?']())) { return "unavailable" } else { return "loaded" } - }, $DocBook5Converter_load_asciimath$60.$$arity = 0), nil) && 'load_asciimath'; - })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting); + }); + })($$('Converter'), $$$($$('Converter'), 'Base'), $nesting) })($nesting[0], $nesting) -})(Opal); +}); } AsciidoctorDocBook.register = register; -export default AsciidoctorDocBook; +export { AsciidoctorDocBook as default }; diff --git a/dist/index.umd.js b/dist/index.umd.js index fb9a814..5b0f519 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,178 +1,167 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.AsciidoctorDocBook = factory()); -}(this, (function () { 'use strict'; + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.AsciidoctorDocBook = factory()); +})(this, (function () { 'use strict'; const AsciidoctorDocBook = {}; function register () { - /* Generated by Opal 0.11.99.dev */ - (function(Opal) { - function $rb_minus(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); - } - function $rb_gt(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); - } - function $rb_plus(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); - } - var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + Opal.queue(function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $hash2 = Opal.hash2, $regexp = Opal.regexp, $def = Opal.def, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $rb_plus = Opal.rb_plus, $send = Opal.send, $alias = Opal.alias, $rb_gt = Opal.rb_gt, $return_val = Opal.return_val, $rb_minus = Opal.rb_minus, $to_ary = Opal.to_ary, $gvars = Opal.gvars, $not = Opal.not, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; - Opal.add_stubs(['$register_for', '$default=', '$-', '$init_backend_traits', '$attr?', '$<<', '$attr', '$==', '$doctype', '$common_attributes', '$id', '$noheader', '$document_info_tag', '$empty?', '$docinfo', '$blocks?', '$content', '$join', '$document', '$[]', '$sectname', '$special', '$option?', '$title', '$role', '$reftext', '$title_tag', '$enclose_content', '$title?', '$each', '$items', '$text', '$style', '$text?', '$level', '$image_uri', '$alt', '$!', '$key?', '$attributes', '$to_i', '$index', '$subs', '$delete_at', '$>', '$insert', '$unshift', '$asciimath_available?', '$to_mathml', '$parse', '$===', '$parent', '$warn', '$logger', '$context', '$error', '$content_model', '$blockquote_tag', '$has_role?', '$include?', '$columns', '$to_h', '$rows', '$colspan', '$column', '$+', '$rowspan', '$type', '$target', '$inspect', '$icon_uri', '$map', '$size', '$chop', '$private', '$gsub', '$strip', '$squeeze', '$firstname', '$sub_replacements', '$middlename', '$lastname', '$email', '$notitle', '$subtitle?', '$doctitle', '$main', '$subtitle', '$=~', '$header?', '$authors', '$author_tag', '$initials', '$cover_tag', '$new', '$load_asciimath', '$nil?', '$require_library']); + Opal.add_stubs('register_for,default=,init_backend_traits,attr?,<<,attr,==,doctype,size,id,noheader,document_info_tag,apply_reftext_subs,+,map,empty?,docinfo,blocks?,content,id=,insert,common_attributes,join,content_only,document,[],sectname,option?,special,title,role,reftext,title_tag,enclose_content,skip,title?,each,items,text,style,text?,level,image_uri,alt,!,key?,attributes,to_i,index,subs,delete_at,>,unshift,asciimath_available?,to_mathml,parse,parent,warn,logger,context,error,content_model,blockquote_tag,has_role?,include?,columns,to_h,rows,colspan,column,-,rowspan,type,target,nil_or_empty?,get_root_document,generate_document_id,inspect,icon_uri,chop,private,gsub,strip,squeeze,firstname,sub_replacements,middlename,lastname,email,notitle,subtitle?,doctitle,main,subtitle,=~,header?,authors,author_tag,initials,cover_tag,nested?,parent_document,new,load_asciimath,nil?,require_library'); return (function($base, $parent_nesting) { var self = $module($base, 'Asciidoctor'); - var $nesting = [self].concat($parent_nesting); + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); - (function($base, $super, $parent_nesting) { + return (function($base, $super, $parent_nesting) { var self = $klass($base, $super, 'DocBook5Converter'); - var $nesting = [self].concat($parent_nesting), $DocBook5Converter_initialize$1, $DocBook5Converter_convert_document$2, $DocBook5Converter_convert_section$3, $DocBook5Converter_convert_admonition$4, $DocBook5Converter_convert_colist$5, $DocBook5Converter_convert_dlist$7, $DocBook5Converter_convert_example$12, $DocBook5Converter_convert_floating_title$13, $DocBook5Converter_convert_image$14, $DocBook5Converter_convert_listing$15, $DocBook5Converter_convert_literal$16, $DocBook5Converter_convert_stem$17, $DocBook5Converter_convert_olist$18, $DocBook5Converter_convert_open$20, $DocBook5Converter_convert_page_break$21, $DocBook5Converter_convert_paragraph$22, $DocBook5Converter_convert_preamble$23, $DocBook5Converter_convert_quote$24, $DocBook5Converter_convert_thematic_break$26, $DocBook5Converter_convert_sidebar$27, $DocBook5Converter_convert_table$28, $DocBook5Converter_convert_ulist$34, $DocBook5Converter_convert_verse$37, $DocBook5Converter_convert_inline_anchor$39, $DocBook5Converter_convert_inline_break$40, $DocBook5Converter_convert_inline_button$41, $DocBook5Converter_convert_inline_callout$42, $DocBook5Converter_convert_inline_footnote$43, $DocBook5Converter_convert_inline_image$44, $DocBook5Converter_convert_inline_indexterm$45, $DocBook5Converter_convert_inline_kbd$47, $DocBook5Converter_convert_inline_menu$48, $DocBook5Converter_convert_inline_quoted$49, $DocBook5Converter_common_attributes$50, $DocBook5Converter_author_tag$51, $DocBook5Converter_document_info_tag$52, $DocBook5Converter_enclose_content$55, $DocBook5Converter_title_tag$56, $DocBook5Converter_cover_tag$57, $DocBook5Converter_blockquote_tag$58, $DocBook5Converter_asciimath_available$ques$59, $DocBook5Converter_load_asciimath$60, $writer = nil; + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; - self.$$prototype.asciimath_status = nil; + $proto.asciimath_status = nil; self.$register_for("docbook5"); - - $writer = [$hash2(["list", "entry", "term", "item"], {"list": "variablelist", "entry": "varlistentry", "term": "term", "item": "listitem"})]; - $send(Opal.const_set($nesting[0], 'DLIST_TAGS', $hash2(["qanda", "glossary"], {"qanda": $hash2(["list", "entry", "label", "term", "item"], {"list": "qandaset", "entry": "qandaentry", "label": "question", "term": "simpara", "item": "answer"}), "glossary": $hash2(["list", "entry", "term", "item"], {"list": nil, "entry": "glossentry", "term": "glossterm", "item": "glossdef"})})), 'default=', Opal.to_a($writer)); - $writer[$rb_minus($writer["length"], 1)]; - $writer = [["", "", true]]; - $send(Opal.const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript"], {"monospaced": ["", ""], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["", "", true], "single": ["", "", true], "mark": ["", ""], "superscript": ["", ""], "subscript": ["", ""]})), 'default=', Opal.to_a($writer)); - $writer[$rb_minus($writer["length"], 1)]; Opal.const_set($nesting[0], 'MANPAGE_SECTION_TAGS', $hash2(["section", "synopsis"], {"section": "refsection", "synopsis": "refsynopsisdiv"})); - Opal.const_set($nesting[0], 'TABLE_PI_NAMES', ["dbhtml", "dbfo", "dblatex"]); - Opal.const_set($nesting[0], 'CopyrightRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?)(?: ((?:\\d{4}\\-)?\\d{4}))?$")); - Opal.const_set($nesting[0], 'ImageMacroRx', new RegExp("" + "^image::?(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); - - Opal.def(self, '$initialize', $DocBook5Converter_initialize$1 = function $$initialize(backend, opts) { + $const_set($nesting[0], 'DLIST_TAGS', $hash2(["qanda", "glossary"], {"qanda": $hash2(["list", "entry", "label", "term", "item"], {"list": "qandaset", "entry": "qandaentry", "label": "question", "term": "simpara", "item": "answer"}), "glossary": $hash2(["list", "entry", "term", "item"], {"list": nil, "entry": "glossentry", "term": "glossterm", "item": "glossdef"})}))['$default=']($hash2(["list", "entry", "term", "item"], {"list": "variablelist", "entry": "varlistentry", "term": "term", "item": "listitem"})); + $const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript"], {"monospaced": ["", ""], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["", "", true], "single": ["", "", true], "mark": ["", ""], "superscript": ["", ""], "subscript": ["", ""]}))['$default='](["", "", true]); + $const_set($nesting[0], 'MANPAGE_SECTION_TAGS', $hash2(["section", "synopsis"], {"section": "refsection", "synopsis": "refsynopsisdiv"})); + $const_set($nesting[0], 'TABLE_PI_NAMES', ["dbhtml", "dbfo", "dblatex"]); + $const_set($nesting[0], 'CopyrightRx', $regexp(["^(", $$('CC_ANY'), "+?)(?: ((?:\\d{4}-)?\\d{4}))?$"])); + $const_set($nesting[0], 'ImageMacroRx', $regexp(["^image::?(\\S|\\S", $$('CC_ANY'), "*?\\S)\\[(", $$('CC_ANY'), "+)?\\]$"])); + + $def(self, '$initialize', function $$initialize(backend, opts) { var self = this; - - if (opts == null) { - opts = $hash2([], {}); - } self.backend = backend; + if (opts == null) opts = $hash2([], {}); + self.backend = backend; return self.$init_backend_traits($hash2(["basebackend", "filetype", "outfilesuffix", "supports_templates"], {"basebackend": "docbook", "filetype": "xml", "outfilesuffix": ".xml", "supports_templates": true})); - }, $DocBook5Converter_initialize$1.$$arity = -2); + }, -2); - Opal.def(self, '$convert_document', $DocBook5Converter_convert_document$2 = function $$convert_document(node) { - var self = this, result = nil, lang_attribute = nil, root_tag_name = nil, docinfo_content = nil; + $def(self, '$convert_document', function $$convert_document(node) { + var $a, $b, self = this, result = nil, lang_attribute = nil, root_tag_name = nil, manpage = nil, root_tag_idx = nil, id = nil, docinfo_content = nil; result = [""]; if ($truthy(node['$attr?']("toc"))) { - result['$<<']((function() {if ($truthy(node['$attr?']("toclevels"))) { - return "" + "" - } else { - return "" - } })());} if ($truthy(node['$attr?']("sectnums"))) { - result['$<<']((function() {if ($truthy(node['$attr?']("sectnumlevels"))) { - return "" + "" - } else { - return "" - } })());} lang_attribute = (function() {if ($truthy(node['$attr?']("nolang"))) { - return "" - } else { - return "" + " xml:lang=\"" + (node.$attr("lang", "en")) + "\"" - } })(); - if ((root_tag_name = node.$doctype())['$==']("manpage")) { - root_tag_name = "refentry";} result['$<<']("" + "<" + (root_tag_name) + " xmlns=\"http://docbook.org/ns/docbook\" xmlns:xl=\"http://www.w3.org/1999/xlink\" version=\"5.0\"" + (lang_attribute) + (self.$common_attributes(node.$id())) + ">"); - if ($truthy(node.$noheader())) ; else { + result['$<<'](($truthy(node['$attr?']("toclevels")) ? ("") : (""))); + } if ($truthy(node['$attr?']("sectnums"))) { + result['$<<'](($truthy(node['$attr?']("sectnumlevels")) ? ("") : (""))); + } lang_attribute = ($truthy(node['$attr?']("nolang")) ? ("") : (" xml:lang=\"" + (node.$attr("lang", "en")) + "\"")); + if ($eqeq((root_tag_name = node.$doctype()), "manpage")) { + + manpage = true; + root_tag_name = "article"; + } root_tag_idx = result.$size(); + id = node.$id(); + if (!$truthy(node.$noheader())) { result['$<<'](self.$document_info_tag(node)); - } if ($truthy((docinfo_content = node.$docinfo("header"))['$empty?']())) ; else { + } if ($truthy(manpage)) { + + result['$<<'](""); + result['$<<'](""); + if ($truthy(node['$attr?']("mantitle"))) { + result['$<<']("" + (node.$apply_reftext_subs(node.$attr("mantitle"))) + ""); + } if ($truthy(node['$attr?']("manvolnum"))) { + result['$<<']("" + (node.$attr("manvolnum")) + ""); + } result['$<<']("" + (node.$attr("mansource", " ")) + ""); + result['$<<']("" + (node.$attr("manmanual", " ")) + ""); + result['$<<'](""); + result['$<<'](""); + if ($truthy(node['$attr?']("mannames"))) { + result = $rb_plus(result, $send(node.$attr("mannames"), 'map', [], function $$1(n){ + + if (n == null) n = nil; + return "" + (n) + "";})); + } if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<']("" + (node.$attr("manpurpose")) + ""); + } result['$<<'](""); + } if (!$truthy((docinfo_content = node.$docinfo("header"))['$empty?']())) { result['$<<'](docinfo_content); } if ($truthy(node['$blocks?']())) { - result['$<<'](node.$content());} if ($truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) ; else { + result['$<<'](node.$content()); + } if (!$truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { result['$<<'](docinfo_content); - } result['$<<']("" + ""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_document$2.$$arity = 1); - Opal.alias(self, "convert_embedded", "content_only"); - - Opal.def(self, '$convert_section', $DocBook5Converter_convert_section$3 = function $$convert_section(node) { - var $a, self = this, tag_name = nil, title_el = nil; + } if ($truthy(manpage)) { + result['$<<'](""); + } if (!$truthy(id)) { + $a = [node.$id(), nil], (id = $a[0]), ($b = [$a[1]], $send(node, 'id=', $b), $b[$b.length - 1]); + } result.$insert(root_tag_idx, "<" + (root_tag_name) + " xmlns=\"http://docbook.org/ns/docbook\" xmlns:xl=\"http://www.w3.org/1999/xlink\" version=\"5.0\"" + (lang_attribute) + (self.$common_attributes(id)) + ">"); + result['$<<'](""); + return result.$join($$('LF')); + }); + $alias(self, "convert_embedded", "content_only"); + + $def(self, '$convert_section', function $$convert_section(node) { + var self = this, tag_name = nil, $ret_or_1 = nil, title_el = nil; - if (node.$document().$doctype()['$==']("manpage")) { - tag_name = ($truthy($a = $$($nesting, 'MANPAGE_SECTION_TAGS')['$[]']((tag_name = node.$sectname()))) ? $a : tag_name); + if ($eqeq(node.$document().$doctype(), "manpage")) { + tag_name = ($truthy(($ret_or_1 = $$('MANPAGE_SECTION_TAGS')['$[]']((tag_name = node.$sectname())))) ? ($ret_or_1) : (tag_name)); } else { tag_name = node.$sectname(); - } title_el = (function() {if ($truthy(($truthy($a = node.$special()) ? node['$option?']("untitled") : $a))) { - return "" - } else { - return "" + "" + (node.$title()) + "\n" - } })(); - return "" + "<" + (tag_name) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (title_el) + (node.$content()) + "\n" + ""; - }, $DocBook5Converter_convert_section$3.$$arity = 1); + } title_el = (($truthy(node.$special()) && (($truthy(node['$option?']("notitle")) || ($truthy(node['$option?']("untitled")))))) ? ("") : ("" + (node.$title()) + "\n")); + return "<" + (tag_name) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (title_el) + (node.$content()) + "\n" + ""; + }); - Opal.def(self, '$convert_admonition', $DocBook5Converter_convert_admonition$4 = function $$convert_admonition(node) { + $def(self, '$convert_admonition', function $$convert_admonition(node) { var self = this, tag_name = nil; - return "" + "<" + ((tag_name = node.$attr("name"))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - }, $DocBook5Converter_convert_admonition$4.$$arity = 1); - Opal.alias(self, "convert_audio", "skip"); + return "<" + ((tag_name = node.$attr("name"))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + }); + $alias(self, "convert_audio", "skip"); - Opal.def(self, '$convert_colist', $DocBook5Converter_convert_colist$5 = function $$convert_colist(node) { - var $$6, self = this, result = nil; + $def(self, '$convert_colist', function $$convert_colist(node) { + var self = this, result = nil; result = []; - result['$<<']("" + ""); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$6 = function(item){var self = $$6.$$s || this; - - + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$2(item){ - if (item == null) { - item = nil; - } result['$<<']("" + ""); - result['$<<']("" + "" + (item.$text()) + ""); + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$6.$$s = self, $$6.$$arity = 1, $$6)); + result['$<<'](item.$content()); + } return result['$<<']("");}); result['$<<'](""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_colist$5.$$arity = 1); + return result.$join($$('LF')); + }); - Opal.def(self, '$convert_dlist', $DocBook5Converter_convert_dlist$7 = function $$convert_dlist(node) { - var $$8, $$10, self = this, result = nil, tag_name = nil, tags = nil, list_tag = nil, entry_tag = nil, label_tag = nil, term_tag = nil, item_tag = nil; + $def(self, '$convert_dlist', function $$convert_dlist(node) { + var self = this, result = nil, tag_name = nil, tags = nil, list_tag = nil, entry_tag = nil, label_tag = nil, term_tag = nil, item_tag = nil; result = []; - if (node.$style()['$==']("horizontal")) { - - result['$<<']("" + "<" + ((tag_name = (function() {if ($truthy(node['$title?']())) { - return "table" - } else { - return "informaltable" - } })())) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + " tabstyle=\"horizontal\" frame=\"none\" colsep=\"0\" rowsep=\"0\">\n" + (self.$title_tag(node)) + "\n" + "\n" + "\n" + ""); - $send(node.$items(), 'each', [], ($$8 = function(terms, dd){var self = $$8.$$s || this, $$9; - + if ($eqeq(node.$style(), "horizontal")) { + result['$<<']("<" + ((tag_name = ($truthy(node['$title?']()) ? ("table") : ("informaltable")))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + " tabstyle=\"horizontal\" frame=\"none\" colsep=\"0\" rowsep=\"0\">\n" + (self.$title_tag(node)) + "\n" + "\n" + "\n" + ""); + $send(node.$items(), 'each', [], function $$3(terms, dd){ - if (terms == null) { - terms = nil; - } - if (dd == null) { - dd = nil; - } result['$<<']("" + "\n" + ""); - $send(terms, 'each', [], ($$9 = function(dt){var self = $$9.$$s || this; - - + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<']("\n" + ""); + $send(terms, 'each', [], function $$4(dt){ - if (dt == null) { - dt = nil; - } return result['$<<']("" + "" + (dt.$text()) + "");}, $$9.$$s = self, $$9.$$arity = 1, $$9)); - result['$<<']("" + "\n" + ""); + if (dt == null) dt = nil; + return result['$<<']("" + (dt.$text()) + "");}); + result['$<<']("\n" + ""); if ($truthy(dd)) { if ($truthy(dd['$text?']())) { - result['$<<']("" + "" + (dd.$text()) + "");} if ($truthy(dd['$blocks?']())) { - result['$<<'](dd.$content());}} return result['$<<']("" + "\n" + "");}, $$8.$$s = self, $$8.$$arity = 2, $$8)); - result['$<<']("" + "\n" + "\n" + ""); + result['$<<']("" + (dd.$text()) + ""); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } return result['$<<']("\n" + "");}); + result['$<<']("\n" + "\n" + ""); } else { - tags = $$($nesting, 'DLIST_TAGS')['$[]'](node.$style()); + tags = $$('DLIST_TAGS')['$[]'](node.$style()); list_tag = tags['$[]']("list"); entry_tag = tags['$[]']("entry"); label_tag = tags['$[]']("label"); @@ -180,149 +169,119 @@ item_tag = tags['$[]']("item"); if ($truthy(list_tag)) { - result['$<<']("" + "<" + (list_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"); + result['$<<']("<" + (list_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");}} $send(node.$items(), 'each', [], ($$10 = function(terms, dd){var self = $$10.$$s || this, $$11; - - + result['$<<']("" + (node.$title()) + ""); + } } $send(node.$items(), 'each', [], function $$5(terms, dd){ - if (terms == null) { - terms = nil; - } - if (dd == null) { - dd = nil; - } result['$<<']("" + "<" + (entry_tag) + ">"); + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<']("<" + (entry_tag) + ">"); if ($truthy(label_tag)) { - result['$<<']("" + "<" + (label_tag) + ">");} $send(terms, 'each', [], ($$11 = function(dt){var self = $$11.$$s || this; - - + result['$<<']("<" + (label_tag) + ">"); + } $send(terms, 'each', [], function $$6(dt){ - if (dt == null) { - dt = nil; - } return result['$<<']("" + "<" + (term_tag) + ">" + (dt.$text()) + "");}, $$11.$$s = self, $$11.$$arity = 1, $$11)); + if (dt == null) dt = nil; + return result['$<<']("<" + (term_tag) + ">" + (dt.$text()) + "");}); if ($truthy(label_tag)) { - result['$<<']("" + "");} result['$<<']("" + "<" + (item_tag) + ">"); + result['$<<'](""); + } result['$<<']("<" + (item_tag) + ">"); if ($truthy(dd)) { if ($truthy(dd['$text?']())) { - result['$<<']("" + "" + (dd.$text()) + "");} if ($truthy(dd['$blocks?']())) { - result['$<<'](dd.$content());}} result['$<<']("" + ""); - return result['$<<']("" + "");}, $$10.$$s = self, $$10.$$arity = 2, $$10)); + result['$<<']("" + (dd.$text()) + ""); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } result['$<<'](""); + return result['$<<']("");}); if ($truthy(list_tag)) { - result['$<<']("" + "");} } return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_dlist$7.$$arity = 1); + result['$<<'](""); + } } return result.$join($$('LF')); + }); - Opal.def(self, '$convert_example', $DocBook5Converter_convert_example$12 = function $$convert_example(node) { + $def(self, '$convert_example', function $$convert_example(node) { var self = this; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + (self.$enclose_content(node)) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + (self.$enclose_content(node)) + "\n" + "" } else { - return "" + "\n" + (self.$enclose_content(node)) + "\n" + "" + return "\n" + (self.$enclose_content(node)) + "\n" + "" } - }, $DocBook5Converter_convert_example$12.$$arity = 1); + }); - Opal.def(self, '$convert_floating_title', $DocBook5Converter_convert_floating_title$13 = function $$convert_floating_title(node) { + $def(self, '$convert_floating_title', function $$convert_floating_title(node) { var self = this; - return "" + "" + (node.$title()) + "" - }, $DocBook5Converter_convert_floating_title$13.$$arity = 1); + return "" + (node.$title()) + "" + }); - Opal.def(self, '$convert_image', $DocBook5Converter_convert_image$14 = function $$convert_image(node) { + $def(self, '$convert_image', function $$convert_image(node) { var self = this, width_attribute = nil, depth_attribute = nil, scale_attribute = nil, align_attribute = nil, mediaobject = nil; if ($truthy(node['$attr?']("scaledwidth"))) { - width_attribute = "" + " width=\"" + (node.$attr("scaledwidth")) + "\""; + width_attribute = " width=\"" + (node.$attr("scaledwidth")) + "\""; depth_attribute = ""; scale_attribute = ""; } else if ($truthy(node['$attr?']("scale"))) { - scale_attribute = "" + " scale=\"" + (node.$attr("scale")) + "\""; + scale_attribute = " scale=\"" + (node.$attr("scale")) + "\""; } else { - width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { - return "" + " contentwidth=\"" + (node.$attr("width")) + "\"" - } else { - return "" - } })(); - depth_attribute = (function() {if ($truthy(node['$attr?']("height"))) { - return "" + " contentdepth=\"" + (node.$attr("height")) + "\"" - } else { - return "" - } })(); + width_attribute = ($truthy(node['$attr?']("width")) ? (" contentwidth=\"" + (node.$attr("width")) + "\"") : ("")); + depth_attribute = ($truthy(node['$attr?']("height")) ? (" contentdepth=\"" + (node.$attr("height")) + "\"") : ("")); scale_attribute = ""; - } align_attribute = (function() {if ($truthy(node['$attr?']("align"))) { - return "" + " align=\"" + (node.$attr("align")) + "\"" - } else { - return "" - } })(); - mediaobject = "" + "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; + } align_attribute = ($truthy(node['$attr?']("align")) ? (" align=\"" + (node.$attr("align")) + "\"") : ("")); + mediaobject = "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + (mediaobject) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + (mediaobject) + "\n" + "" } else { - return "" + "\n" + (mediaobject) + "\n" + "" - } }, $DocBook5Converter_convert_image$14.$$arity = 1); + return "\n" + (mediaobject) + "\n" + "" + } }); - Opal.def(self, '$convert_listing', $DocBook5Converter_convert_listing$15 = function $$convert_listing(node) { + $def(self, '$convert_listing', function $$convert_listing(node) { var self = this, informal = nil, common_attrs = nil, attrs = nil, numbering_attrs = nil, wrapped_content = nil; informal = node['$title?']()['$!'](); common_attrs = self.$common_attributes(node.$id(), node.$role(), node.$reftext()); - if (node.$style()['$==']("source")) { + if ($eqeq(node.$style(), "source")) { if ($truthy((attrs = node.$attributes())['$key?']("linenums"))) { - numbering_attrs = (function() {if ($truthy(attrs['$key?']("start"))) { - return "" + " linenumbering=\"numbered\" startinglinenumber=\"" + (attrs['$[]']("start").$to_i()) + "\"" - } else { - return " linenumbering=\"numbered\"" - } })(); + numbering_attrs = ($truthy(attrs['$key?']("start")) ? (" linenumbering=\"numbered\" startinglinenumber=\"" + (attrs['$[]']("start").$to_i()) + "\"") : (" linenumbering=\"numbered\"")); } else { numbering_attrs = " linenumbering=\"unnumbered\""; } if ($truthy(attrs['$key?']("language"))) { - wrapped_content = "" + "" + (node.$content()) + ""; + wrapped_content = "" + (node.$content()) + ""; } else { - wrapped_content = "" + "" + (node.$content()) + ""; + wrapped_content = "" + (node.$content()) + ""; } } else { - wrapped_content = "" + "" + (node.$content()) + ""; + wrapped_content = "" + (node.$content()) + ""; } if ($truthy(informal)) { return wrapped_content } else { - return "" + "\n" + "" + (node.$title()) + "\n" + "\n" + (wrapped_content) + "\n" + "\n" + "" - } }, $DocBook5Converter_convert_listing$15.$$arity = 1); + return "\n" + "" + (node.$title()) + "\n" + "\n" + (wrapped_content) + "\n" + "\n" + "" + } }); - Opal.def(self, '$convert_literal', $DocBook5Converter_convert_literal$16 = function $$convert_literal(node) { + $def(self, '$convert_literal', function $$convert_literal(node) { var self = this; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + "\n" + "" + (node.$content()) + "\n" + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + "\n" + "" + (node.$content()) + "\n" + "\n" + "" } else { - return "" + "" + (node.$content()) + "" + return "" + (node.$content()) + "" } - }, $DocBook5Converter_convert_literal$16.$$arity = 1); - Opal.alias(self, "convert_pass", "content_only"); + }); + $alias(self, "convert_pass", "content_only"); - Opal.def(self, '$convert_stem', $DocBook5Converter_convert_stem$17 = function $$convert_stem(node) { - var $a, self = this, idx = nil, equation = nil, equation_data = nil; + $def(self, '$convert_stem', function $$convert_stem(node) { + var self = this, idx = nil, equation = nil, equation_data = nil; if ($truthy((idx = node.$subs().$index("specialcharacters")))) { node.$subs().$delete_at(idx); - equation = ($truthy($a = node.$content()) ? $a : ""); + equation = node.$content(); if ($truthy($rb_gt(idx, 0))) { node.$subs().$insert(idx, "specialcharacters"); @@ -330,479 +289,373 @@ node.$subs().$unshift("specialcharacters"); } } else { - equation = ($truthy($a = node.$content()) ? $a : ""); - } if (node.$style()['$==']("asciimath")) { - equation_data = (function() {if ($truthy(self['$asciimath_available?']())) { - - return $$$('::', 'AsciiMath').$parse(equation).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"})); - } else { - return "" + "" - } })(); + equation = node.$content(); + } if ($eqeq(node.$style(), "asciimath")) { + equation_data = ($truthy(self['$asciimath_available?']()) ? ($$$('AsciiMath').$parse(equation).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) : ("")); } else { - equation_data = "" + "\n" + ""; + equation_data = "\n" + ""; } if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + (equation_data) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + (equation_data) + "\n" + "" } else { - return "" + "\n" + (equation_data) + "\n" + "" - } }, $DocBook5Converter_convert_stem$17.$$arity = 1); + return "\n" + (equation_data) + "\n" + "" + } }); - Opal.def(self, '$convert_olist', $DocBook5Converter_convert_olist$18 = function $$convert_olist(node) { - var $$19, self = this, result = nil, num_attribute = nil, start_attribute = nil; + $def(self, '$convert_olist', function $$convert_olist(node) { + var self = this, result = nil, num_attribute = nil, start_attribute = nil; result = []; - num_attribute = (function() {if ($truthy(node.$style())) { - return "" + " numeration=\"" + (node.$style()) + "\"" - } else { - return "" - } })(); - start_attribute = (function() {if ($truthy(node['$attr?']("start"))) { - return "" + " startingnumber=\"" + (node.$attr("start")) + "\"" - } else { - return "" - } })(); - result['$<<']("" + ""); + num_attribute = ($truthy(node.$style()) ? (" numeration=\"" + (node.$style()) + "\"") : ("")); + start_attribute = ($truthy(node['$attr?']("start")) ? (" startingnumber=\"" + (node.$attr("start")) + "\"") : ("")); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$19 = function(item){var self = $$19.$$s || this; + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$7(item){var self = $$7.$$s == null ? this : $$7.$$s; - - if (item == null) { - item = nil; - } result['$<<']("" + ""); - result['$<<']("" + "" + (item.$text()) + ""); + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$19.$$s = self, $$19.$$arity = 1, $$19)); + result['$<<'](item.$content()); + } return result['$<<']("");}, {$$s: self}); result['$<<'](""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_olist$18.$$arity = 1); + return result.$join($$('LF')); + }); - Opal.def(self, '$convert_open', $DocBook5Converter_convert_open$20 = function $$convert_open(node) { - var $a, $b, self = this, $case = nil, id = nil, reftext = nil, role = nil, content_spacer = nil; + $def(self, '$convert_open', function $$convert_open(node) { + var self = this, id = nil, reftext = nil, role = nil, content_spacer = nil; - return (function() {$case = node.$style(); - if ("abstract"['$===']($case)) {if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) { - - self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); - return ""; - } else { - return "" + "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - }} - else if ("partintro"['$===']($case)) {if ($truthy(($truthy($a = (($b = node.$level()['$=='](0)) ? node.$parent().$context()['$==']("section") : node.$level()['$=='](0))) ? node.$document().$doctype()['$==']("book") : $a))) { - return "" + "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - } else { - - self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); - return ""; - }} - else { - if ($truthy((id = node.$id()))) { - reftext = node.$reftext();} role = node.$role(); - if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + "" + ((content_spacer = (function() {if (node.$content_model()['$==']("compound")) { - return $$($nesting, 'LF') - } else { - return "" - } })())) + (node.$content()) + (content_spacer) + "\n" + "" - } else if ($truthy(($truthy($a = id) ? $a : role))) { - if (node.$content_model()['$==']("compound")) { - return "" + "\n" + (node.$content()) + "\n" + "" - } else { - return "" + "" + (node.$content()) + "" - } - } else { - return self.$enclose_content(node) - }}})() - }, $DocBook5Converter_convert_open$20.$$arity = 1); + + switch (node.$style()) { + case "abstract": + if (($eqeq(node.$parent(), node.$document()) && ($eqeq(node.$document().$doctype(), "book")))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + } + case "partintro": + if ((($eqeq(node.$level(), 0) && ($eqeq(node.$parent().$context(), "section"))) && ($eqeq(node.$document().$doctype(), "book")))) { + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + } else { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } + default: + + if ($truthy((id = node.$id()))) { + reftext = node.$reftext(); + } role = node.$role(); + if ($truthy(node['$title?']())) { + return "\n" + "" + (node.$title()) + "\n" + "" + ((content_spacer = ($eqeq(node.$content_model(), "compound") ? ($$('LF')) : ("")))) + (node.$content()) + (content_spacer) + "\n" + "" + } else if (($truthy(id) || ($truthy(role)))) { + if ($eqeq(node.$content_model(), "compound")) { + return "\n" + (node.$content()) + "\n" + "" + } else { + return "" + (node.$content()) + "" + } + } else { + return self.$enclose_content(node) + } } + }); - Opal.def(self, '$convert_page_break', $DocBook5Converter_convert_page_break$21 = function $$convert_page_break(node) { - - return "" - }, $DocBook5Converter_convert_page_break$21.$$arity = 1); + $def(self, '$convert_page_break', $return_val("")); - Opal.def(self, '$convert_paragraph', $DocBook5Converter_convert_paragraph$22 = function $$convert_paragraph(node) { + $def(self, '$convert_paragraph', function $$convert_paragraph(node) { var self = this; if ($truthy(node['$title?']())) { - return "" + "\n" + "" + (node.$title()) + "\n" + "" + (node.$content()) + "\n" + "" + return "\n" + "" + (node.$title()) + "\n" + "" + (node.$content()) + "\n" + "" } else { - return "" + "" + (node.$content()) + "" + return "" + (node.$content()) + "" } - }, $DocBook5Converter_convert_paragraph$22.$$arity = 1); + }); - Opal.def(self, '$convert_preamble', $DocBook5Converter_convert_preamble$23 = function $$convert_preamble(node) { + $def(self, '$convert_preamble', function $$convert_preamble(node) { var self = this; - if (node.$document().$doctype()['$==']("book")) { - return "" + "\n" + (self.$title_tag(node, false)) + (node.$content()) + "\n" + "" + if ($eqeq(node.$document().$doctype(), "book")) { + return "\n" + (self.$title_tag(node, false)) + (node.$content()) + "\n" + "" } else { return node.$content() } - }, $DocBook5Converter_convert_preamble$23.$$arity = 1); + }); - Opal.def(self, '$convert_quote', $DocBook5Converter_convert_quote$24 = function $$convert_quote(node) { - var $a, $$25, self = this; + $def(self, '$convert_quote', function $$convert_quote(node) { + var self = this, $ret_or_1 = nil; - return $send(self, 'blockquote_tag', [node, ($truthy($a = node['$has_role?']("epigraph")) ? "epigraph" : $a)], ($$25 = function(){var self = $$25.$$s || this; + return $send(self, 'blockquote_tag', [node, ($truthy(($ret_or_1 = node['$has_role?']("epigraph"))) ? ("epigraph") : ($ret_or_1))], function $$8(){var self = $$8.$$s == null ? this : $$8.$$s; - return self.$enclose_content(node)}, $$25.$$s = self, $$25.$$arity = 0, $$25)) - }, $DocBook5Converter_convert_quote$24.$$arity = 1); + return self.$enclose_content(node)}, {$$s: self}) + }); - Opal.def(self, '$convert_thematic_break', $DocBook5Converter_convert_thematic_break$26 = function $$convert_thematic_break(node) { - - return "" - }, $DocBook5Converter_convert_thematic_break$26.$$arity = 1); + $def(self, '$convert_thematic_break', $return_val("")); - Opal.def(self, '$convert_sidebar', $DocBook5Converter_convert_sidebar$27 = function $$convert_sidebar(node) { + $def(self, '$convert_sidebar', function $$convert_sidebar(node) { var self = this; - return "" + "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" - }, $DocBook5Converter_convert_sidebar$27.$$arity = 1); + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + }); - Opal.def(self, '$convert_table', $DocBook5Converter_convert_table$28 = function $$convert_table(node) { - var $$29, $$30, $$31, self = this, has_body = nil, result = nil, pgwide_attribute = nil, frame = nil, grid = nil, tag_name = nil, col_width_key = nil, width = nil; + $def(self, '$convert_table', function $$convert_table(node) { + var self = this, has_body = nil, result = nil, pgwide_attribute = nil, frame = nil, grid = nil, tag_name = nil, width = nil, col_width_key = nil; has_body = false; result = []; - pgwide_attribute = (function() {if ($truthy(node['$option?']("pgwide"))) { - return " pgwide=\"1\"" - } else { - return "" - } })(); - if ((frame = node.$attr("frame", "all", "table-frame"))['$==']("ends")) { - frame = "topbot";} grid = node.$attr("grid", nil, "table-grid"); - result['$<<']("" + "<" + ((tag_name = (function() {if ($truthy(node['$title?']())) { - return "table" - } else { - return "informaltable" - } })())) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + (pgwide_attribute) + " frame=\"" + (frame) + "\" rowsep=\"" + ((function() {if ($truthy(["none", "cols"]['$include?'](grid))) { - return 0 - } else { - return 1 - } })()) + "\" colsep=\"" + ((function() {if ($truthy(["none", "rows"]['$include?'](grid))) { - return 0 - } else { - return 1 - } })()) + "\"" + ((function() {if ($truthy(node['$attr?']("orientation", "landscape", "table-orientation"))) { - return " orient=\"land\"" - } else { - return "" - } })()) + ">"); + pgwide_attribute = ($truthy(node['$option?']("pgwide")) ? (" pgwide=\"1\"") : ("")); + if ($eqeq((frame = node.$attr("frame", "all", "table-frame")), "ends")) { + frame = "topbot"; + } grid = node.$attr("grid", nil, "table-grid"); + result['$<<']("<" + ((tag_name = ($truthy(node['$title?']()) ? ("table") : ("informaltable")))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + (pgwide_attribute) + " frame=\"" + (frame) + "\" rowsep=\"" + (($truthy(["none", "cols"]['$include?'](grid)) ? (0) : (1))) + "\" colsep=\"" + (($truthy(["none", "rows"]['$include?'](grid)) ? (0) : (1))) + "\"" + (($truthy(node['$attr?']("orientation", "landscape", "table-orientation")) ? (" orient=\"land\"") : (""))) + ">"); if ($truthy(node['$option?']("unbreakable"))) { result['$<<'](""); } else if ($truthy(node['$option?']("breakable"))) { - result['$<<']("");} if (tag_name['$==']("table")) { - result['$<<']("" + "" + (node.$title()) + "");} col_width_key = (function() {if ($truthy((width = (function() {if ($truthy(node['$attr?']("width"))) { - - return node.$attr("width"); - } else { - return nil - } })()))) { - - $send($$($nesting, 'TABLE_PI_NAMES'), 'each', [], ($$29 = function(pi_name){var self = $$29.$$s || this; - + result['$<<'](""); + } if ($eqeq(tag_name, "table")) { + result['$<<']("" + (node.$title()) + ""); + } if ($truthy((width = ($truthy(node['$attr?']("width")) ? (node.$attr("width")) : (nil))))) { + $send($$('TABLE_PI_NAMES'), 'each', [], function $$9(pi_name){ - if (pi_name == null) { - pi_name = nil; - } return result['$<<']("" + "");}, $$29.$$s = self, $$29.$$arity = 1, $$29)); - return "colabswidth"; + if (pi_name == null) pi_name = nil; + return result['$<<']("");}); + col_width_key = "colabswidth"; } else { - return "colpcwidth" - } })(); - result['$<<']("" + ""); - $send(node.$columns(), 'each', [], ($$30 = function(col){var self = $$30.$$s || this; - - + col_width_key = "colpcwidth"; + } result['$<<'](""); + $send(node.$columns(), 'each', [], function $$10(col){ - if (col == null) { - col = nil; - } return result['$<<']("" + "");}, $$30.$$s = self, $$30.$$arity = 1, $$30)); - $send(node.$rows().$to_h(), 'each', [], ($$31 = function(tsec, rows){var self = $$31.$$s || this, $$32; - - - - if (tsec == null) { - tsec = nil; - } - if (rows == null) { - rows = nil; - } if ($truthy(rows['$empty?']())) { - return nil;} if (tsec['$==']("body")) { - has_body = true;} result['$<<']("" + ""); - $send(rows, 'each', [], ($$32 = function(row){var self = $$32.$$s || this, $$33; - + if (col == null) col = nil; + return result['$<<']("");}); + $send(node.$rows().$to_h(), 'each', [], function $$11(tsec, rows){ + if (tsec == null) tsec = nil; + if (rows == null) rows = nil; + if ($truthy(rows['$empty?']())) { + return nil + } if ($eqeq(tsec, "body")) { + has_body = true; + } result['$<<'](""); + $send(rows, 'each', [], function $$12(row){ - if (row == null) { - row = nil; - } result['$<<'](""); - $send(row, 'each', [], ($$33 = function(cell){var self = $$33.$$s || this, halign_attribute = nil, valign_attribute = nil, colspan_attribute = nil, colnum = nil, rowspan_attribute = nil, entry_start = nil, cell_content = nil, $case = nil, entry_end = nil; + if (row == null) row = nil; + result['$<<'](""); + $send(row, 'each', [], function $$13(cell){var colspan_attribute = nil, colnum = nil, rowspan_attribute = nil, entry_start = nil, cell_content = nil, entry_end = nil; - - if (cell == null) { - cell = nil; - } halign_attribute = (function() {if ($truthy(cell['$attr?']("halign"))) { - return "" + " align=\"" + (cell.$attr("halign")) + "\"" - } else { - return "" - } })(); - valign_attribute = (function() {if ($truthy(cell['$attr?']("valign"))) { - return "" + " valign=\"" + (cell.$attr("valign")) + "\"" - } else { - return "" - } })(); - colspan_attribute = (function() {if ($truthy(cell.$colspan())) { - return "" + " namest=\"col_" + ((colnum = cell.$column().$attr("colnumber"))) + "\" nameend=\"col_" + ($rb_minus($rb_plus(colnum, cell.$colspan()), 1)) + "\"" - } else { - return "" - } })(); - rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) { - return "" + " morerows=\"" + ($rb_minus(cell.$rowspan(), 1)) + "\"" - } else { - return "" - } })(); - entry_start = "" + ""; - if (tsec['$==']("head")) { + if (cell == null) cell = nil; + colspan_attribute = ($truthy(cell.$colspan()) ? (" namest=\"col_" + ((colnum = cell.$column().$attr("colnumber"))) + "\" nameend=\"col_" + ($rb_minus($rb_plus(colnum, cell.$colspan()), 1)) + "\"") : ("")); + rowspan_attribute = ($truthy(cell.$rowspan()) ? (" morerows=\"" + ($rb_minus(cell.$rowspan(), 1)) + "\"") : ("")); + entry_start = ""; + if ($eqeq(tsec, "head")) { cell_content = cell.$text(); - } else { - $case = cell.$style(); - if ("asciidoc"['$===']($case)) {cell_content = cell.$content();} - else if ("literal"['$===']($case)) {cell_content = "" + "" + (cell.$text()) + "";} - else if ("header"['$===']($case)) {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { - return "" - } else { - return "" + "" + (cell_content.$join("")) + "" - } })();} - else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { - return "" - } else { - return "" + "" + (cell_content.$join("")) + "" - } })();} - } entry_end = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) { - return "" + "" - } else { - return "" - } })(); - return result['$<<']("" + (entry_start) + (cell_content) + (entry_end));}, $$33.$$s = self, $$33.$$arity = 1, $$33)); - return result['$<<']("");}, $$32.$$s = self, $$32.$$arity = 1, $$32)); - return result['$<<']("" + "");}, $$31.$$s = self, $$31.$$arity = 2, $$31)); + } else + switch (cell.$style()) { + case "asciidoc": + cell_content = cell.$content(); + break; + case "literal": + cell_content = "" + (cell.$text()) + ""; + break; + case "header": + cell_content = ($truthy((cell_content = cell.$content())['$empty?']()) ? ("") : ("" + (cell_content.$join("")) + "")); + break; + default: + cell_content = ($truthy((cell_content = cell.$content())['$empty?']()) ? ("") : ("" + (cell_content.$join("")) + "")); + } entry_end = ($truthy(node.$document()['$attr?']("cellbgcolor")) ? ("") : ("")); + return result['$<<']("" + (entry_start) + (cell_content) + (entry_end));}); + return result['$<<']("");}); + return result['$<<']("");}); result['$<<'](""); - result['$<<']("" + ""); - if ($truthy(has_body)) ; else { + result['$<<'](""); + if (!$truthy(has_body)) { self.$logger().$warn("tables must have at least one body row"); - } return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_table$28.$$arity = 1); - Opal.alias(self, "convert_toc", "skip"); + } return result.$join($$('LF')); + }); + $alias(self, "convert_toc", "skip"); - Opal.def(self, '$convert_ulist', $DocBook5Converter_convert_ulist$34 = function $$convert_ulist(node) { - var $$35, $$36, self = this, result = nil, mark_type = nil, checklist = nil, mark_attribute = nil; + $def(self, '$convert_ulist', function $$convert_ulist(node) { + var self = this, result = nil, mark_type = nil, checklist = nil, mark_attribute = nil; result = []; - if (node.$style()['$==']("bibliography")) { + if ($eqeq(node.$style(), "bibliography")) { - result['$<<']("" + ""); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$35 = function(item){var self = $$35.$$s || this; - - + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$14(item){ - if (item == null) { - item = nil; - } result['$<<'](""); - result['$<<']("" + "" + (item.$text()) + ""); + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$35.$$s = self, $$35.$$arity = 1, $$35)); + result['$<<'](item.$content()); + } return result['$<<']("");}); result['$<<'](""); } else { - mark_type = (function() {if ($truthy((checklist = node['$option?']("checklist")))) { - return "none" - } else { - return node.$style() - } })(); - mark_attribute = (function() {if ($truthy(mark_type)) { - return "" + " mark=\"" + (mark_type) + "\"" - } else { - return "" - } })(); - result['$<<']("" + ""); + mark_type = ($truthy((checklist = node['$option?']("checklist"))) ? ("none") : (node.$style())); + mark_attribute = ($truthy(mark_type) ? (" mark=\"" + (mark_type) + "\"") : ("")); + result['$<<'](""); if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} $send(node.$items(), 'each', [], ($$36 = function(item){var self = $$36.$$s || this, $a, text_marker = nil; + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$15(item){var self = $$15.$$s == null ? this : $$15.$$s, text_marker = nil, $ret_or_1 = nil; - - if (item == null) { - item = nil; - } if ($truthy(($truthy($a = checklist) ? item['$attr?']("checkbox") : $a))) { - text_marker = (function() {if ($truthy(item['$attr?']("checked"))) { - return "✓ " - } else { - return "❏ " - } })();} result['$<<']("" + ""); - result['$<<']("" + "" + (($truthy($a = text_marker) ? $a : "")) + (item.$text()) + ""); + if (item == null) item = nil; + if (($truthy(checklist) && ($truthy(item['$attr?']("checkbox"))))) { + text_marker = ($truthy(item['$attr?']("checked")) ? ("✓ ") : ("❏ ")); + } result['$<<'](""); + result['$<<']("" + (($truthy(($ret_or_1 = text_marker)) ? ($ret_or_1) : (""))) + (item.$text()) + ""); if ($truthy(item['$blocks?']())) { - result['$<<'](item.$content());} return result['$<<']("");}, $$36.$$s = self, $$36.$$arity = 1, $$36)); + result['$<<'](item.$content()); + } return result['$<<']("");}, {$$s: self}); result['$<<'](""); - } return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_convert_ulist$34.$$arity = 1); + } return result.$join($$('LF')); + }); - Opal.def(self, '$convert_verse', $DocBook5Converter_convert_verse$37 = function $$convert_verse(node) { - var $a, $$38, self = this; - - return $send(self, 'blockquote_tag', [node, ($truthy($a = node['$has_role?']("epigraph")) ? "epigraph" : $a)], ($$38 = function(){var self = $$38.$$s || this; + $def(self, '$convert_verse', function $$convert_verse(node) { + var self = this, $ret_or_1 = nil; - return "" + "" + (node.$content()) + ""}, $$38.$$s = self, $$38.$$arity = 0, $$38)) - }, $DocBook5Converter_convert_verse$37.$$arity = 1); - Opal.alias(self, "convert_video", "skip"); + return $send(self, 'blockquote_tag', [node, ($truthy(($ret_or_1 = node['$has_role?']("epigraph"))) ? ("epigraph") : ($ret_or_1))], function $$16(){ + return "" + (node.$content()) + ""}) + }); + $alias(self, "convert_video", "skip"); - Opal.def(self, '$convert_inline_anchor', $DocBook5Converter_convert_inline_anchor$39 = function $$convert_inline_anchor(node) { - var $a, self = this, $case = nil, id = nil, path = nil, linkend = nil, text = nil; + $def(self, '$convert_inline_anchor', function $$convert_inline_anchor(node) { + var $a, self = this, id = nil, $ret_or_2 = nil, path = nil, linkend = nil, root_doc = nil, text = nil; - return (function() {$case = node.$type(); - if ("ref"['$===']($case)) {return "" + ""} - else if ("xref"['$===']($case)) {if ($truthy((path = node.$attributes()['$[]']("path")))) { - return "" + "" + (($truthy($a = node.$text()) ? $a : path)) + "" - } else { - - linkend = ($truthy($a = node.$attributes()['$[]']("fragment")) ? $a : node.$target()); - if ($truthy((text = node.$text()))) { - return "" + "" + (text) + "" - } else { - return "" + "" - } }} - else if ("link"['$===']($case)) {return "" + "" + (node.$text()) + ""} - else if ("bibref"['$===']($case)) {return "" + "" + (text)} - else { - self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect())); - return nil;}})() - }, $DocBook5Converter_convert_inline_anchor$39.$$arity = 1); + + switch (node.$type()) { + case "ref": + return "" + case "xref": + if ($truthy((path = node.$attributes()['$[]']("path")))) { + return "" + (($truthy(($ret_or_2 = node.$text())) ? ($ret_or_2) : (path))) + "" + } else { + + if ($truthy((linkend = node.$attributes()['$[]']("refid"))['$nil_or_empty?']())) { + + root_doc = self.$get_root_document(node); + linkend = ($truthy(($ret_or_2 = root_doc.$id())) ? ($ret_or_2) : (($a = [self.$generate_document_id(root_doc)], $send(root_doc, 'id=', $a), $a[$a.length - 1]))); + } if ($truthy((text = node.$text()))) { + return "" + (text) + "" + } else { + return "" + } } + case "link": + return "" + (node.$text()) + "" + case "bibref": + return "" + (text) + default: + + self.$logger().$warn("unknown anchor type: " + (node.$type().$inspect())); + return nil; + } + }); - Opal.def(self, '$convert_inline_break', $DocBook5Converter_convert_inline_break$40 = function $$convert_inline_break(node) { - + $def(self, '$convert_inline_break', function $$convert_inline_break(node) { + return "" + (node.$text()) + "" - }, $DocBook5Converter_convert_inline_break$40.$$arity = 1); + }); - Opal.def(self, '$convert_inline_button', $DocBook5Converter_convert_inline_button$41 = function $$convert_inline_button(node) { - - return "" + "" + (node.$text()) + "" - }, $DocBook5Converter_convert_inline_button$41.$$arity = 1); + $def(self, '$convert_inline_button', function $$convert_inline_button(node) { + + return "" + (node.$text()) + "" + }); - Opal.def(self, '$convert_inline_callout', $DocBook5Converter_convert_inline_callout$42 = function $$convert_inline_callout(node) { + $def(self, '$convert_inline_callout', function $$convert_inline_callout(node) { var self = this; - return "" + "" - }, $DocBook5Converter_convert_inline_callout$42.$$arity = 1); + return "" + }); - Opal.def(self, '$convert_inline_footnote', $DocBook5Converter_convert_inline_footnote$43 = function $$convert_inline_footnote(node) { + $def(self, '$convert_inline_footnote', function $$convert_inline_footnote(node) { var self = this; - if (node.$type()['$==']("xref")) { - return "" + "" + if ($eqeq(node.$type(), "xref")) { + return "" } else { - return "" + "" + (node.$text()) + "" + return "" + (node.$text()) + "" } - }, $DocBook5Converter_convert_inline_footnote$43.$$arity = 1); + }); - Opal.def(self, '$convert_inline_image', $DocBook5Converter_convert_inline_image$44 = function $$convert_inline_image(node) { - var width_attribute = nil, depth_attribute = nil; + $def(self, '$convert_inline_image', function $$convert_inline_image(node) { + var self = this, width_attribute = nil, depth_attribute = nil; - width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { - return "" + " contentwidth=\"" + (node.$attr("width")) + "\"" - } else { - return "" - } })(); - depth_attribute = (function() {if ($truthy(node['$attr?']("height"))) { - return "" + " contentdepth=\"" + (node.$attr("height")) + "\"" - } else { - return "" - } })(); - return "" + "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; - }, $DocBook5Converter_convert_inline_image$44.$$arity = 1); + width_attribute = ($truthy(node['$attr?']("width")) ? (" contentwidth=\"" + (node.$attr("width")) + "\"") : ("")); + depth_attribute = ($truthy(node['$attr?']("height")) ? (" contentdepth=\"" + (node.$attr("height")) + "\"") : ("")); + return "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; + }); - Opal.def(self, '$convert_inline_indexterm', $DocBook5Converter_convert_inline_indexterm$45 = function $$convert_inline_indexterm(node) { - var $$46, self = this, see = nil, rel = nil, see_also_list = nil, numterms = nil, terms = nil; + $def(self, '$convert_inline_indexterm', function $$convert_inline_indexterm(node) { + var see = nil, rel = nil, see_also_list = nil, numterms = nil, terms = nil; if ($truthy((see = node.$attr("see")))) { - rel = "" + "\n" + (see) + ""; + rel = "\n" + (see) + ""; } else if ($truthy((see_also_list = node.$attr("see-also")))) { - rel = $send(see_also_list, 'map', [], ($$46 = function(see_also){var self = $$46.$$s || this; - - + rel = $send(see_also_list, 'map', [], function $$17(see_also){ - if (see_also == null) { - see_also = nil; - } return "" + "\n" + (see_also) + "";}, $$46.$$s = self, $$46.$$arity = 1, $$46)).$join(); + if (see_also == null) see_also = nil; + return "\n" + (see_also) + "";}).$join(); } else { rel = ""; - } if (node.$type()['$==']("visible")) { - return "" + "\n" + "" + (node.$text()) + "" + (rel) + "\n" + "" + (node.$text()) + } if ($eqeq(node.$type(), "visible")) { + return "\n" + "" + (node.$text()) + "" + (rel) + "\n" + "" + (node.$text()) } else if ($truthy($rb_gt((numterms = (terms = node.$attr("terms")).$size()), 2))) { - return "" + "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "" + (rel) + "\n" + "" + ((function() {if ($truthy(node.$document()['$option?']("indexterm-promotion"))) { - return "" + "\n" + "\n" + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "\n" + "\n" + "\n" + "" + (terms['$[]'](2)) + "\n" + "" - } else { - return "" - } })()) + return "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "" + (rel) + "\n" + "" + (($truthy(node.$document()['$option?']("indexterm-promotion")) ? ("\n" + "\n" + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "\n" + "\n" + "\n" + "" + (terms['$[]'](2)) + "\n" + "") : (""))) } else if ($truthy($rb_gt(numterms, 1))) { - return "" + "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (rel) + "\n" + "" + ((function() {if ($truthy(node.$document()['$option?']("indexterm-promotion"))) { - return "" + "\n" + "\n" + "" + (terms['$[]'](1)) + "\n" + "" - } else { - return "" - } })()) + return "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (rel) + "\n" + "" + (($truthy(node.$document()['$option?']("indexterm-promotion")) ? ("\n" + "\n" + "" + (terms['$[]'](1)) + "\n" + "") : (""))) } else { - return "" + "\n" + "" + (terms['$[]'](0)) + "" + (rel) + "\n" + "" - } }, $DocBook5Converter_convert_inline_indexterm$45.$$arity = 1); + return "\n" + "" + (terms['$[]'](0)) + "" + (rel) + "\n" + "" + } }); - Opal.def(self, '$convert_inline_kbd', $DocBook5Converter_convert_inline_kbd$47 = function $$convert_inline_kbd(node) { + $def(self, '$convert_inline_kbd', function $$convert_inline_kbd(node) { var keys = nil; - if ((keys = node.$attr("keys")).$size()['$=='](1)) { - return "" + "" + (keys['$[]'](0)) + "" + if ($eqeq((keys = node.$attr("keys")).$size(), 1)) { + return "" + (keys['$[]'](0)) + "" } else { - return "" + "" + (keys.$join("")) + "" + return "" + (keys.$join("")) + "" } - }, $DocBook5Converter_convert_inline_kbd$47.$$arity = 1); + }); - Opal.def(self, '$convert_inline_menu', $DocBook5Converter_convert_inline_menu$48 = function $$convert_inline_menu(node) { + $def(self, '$convert_inline_menu', function $$convert_inline_menu(node) { var menu = nil, submenus = nil, menuitem = nil; menu = node.$attr("menu"); if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { if ($truthy((menuitem = node.$attr("menuitem")))) { - return "" + "" + (menu) + " " + (menuitem) + "" + return "" + (menu) + " " + (menuitem) + "" } else { - return "" + "" + (menu) + "" + return "" + (menu) + "" } } else { - return "" + "" + (menu) + " " + (submenus.$join(" ")) + " " + (node.$attr("menuitem")) + "" - } }, $DocBook5Converter_convert_inline_menu$48.$$arity = 1); + return "" + (menu) + " " + (submenus.$join(" ")) + " " + (node.$attr("menuitem")) + "" + } }); - Opal.def(self, '$convert_inline_quoted', $DocBook5Converter_convert_inline_quoted$49 = function $$convert_inline_quoted(node) { + $def(self, '$convert_inline_quoted', function $$convert_inline_quoted(node) { var $a, $b, self = this, type = nil, equation = nil, open = nil, close = nil, supports_phrase = nil, text = nil, quoted_text = nil; - if ((type = node.$type())['$==']("asciimath")) { + if ($eqeq((type = node.$type()), "asciimath")) { if ($truthy(self['$asciimath_available?']())) { - return "" + "" + ($$$('::', 'AsciiMath').$parse(node.$text()).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) + "" + return "" + ($$$('AsciiMath').$parse(node.$text()).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) + "" } else { - return "" + "" + return "" } - } else if (type['$==']("latexmath")) { - return "" + "" + } else if ($eqeq(type, "latexmath")) { + return "" } else { - $b = $$($nesting, 'QUOTE_TAGS')['$[]'](type), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (supports_phrase = ($a[2] == null ? nil : $a[2])), $b; + $b = $$('QUOTE_TAGS')['$[]'](type), $a = $to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (supports_phrase = ($a[2] == null ? nil : $a[2])); text = node.$text(); if ($truthy(node.$role())) { if ($truthy(supports_phrase)) { @@ -813,43 +666,37 @@ } else { quoted_text = "" + (open) + (text) + (close); } if ($truthy(node.$id())) { - return "" + "" + (quoted_text) + return "" + (quoted_text) } else { return quoted_text } } - }, $DocBook5Converter_convert_inline_quoted$49.$$arity = 1); + }); self.$private(); - Opal.def(self, '$common_attributes', $DocBook5Converter_common_attributes$50 = function $$common_attributes(id, role, reftext) { - var $a, attrs = nil; + $def(self, '$common_attributes', function $$common_attributes(id, role, reftext) { + var attrs = nil; - - if (role == null) { - role = nil; - } - if (reftext == null) { - reftext = nil; - } if ($truthy(id)) { - attrs = "" + " xml:id=\"" + (id) + "\"" + ((function() {if ($truthy(role)) { - return "" + " role=\"" + (role) + "\"" - } else { - return "" - } })()); + if (role == null) role = nil; + if (reftext == null) reftext = nil; + if ($truthy(id)) { + attrs = " xml:id=\"" + (id) + "\"" + (($truthy(role) ? (" role=\"" + (role) + "\"") : (""))); } else if ($truthy(role)) { - attrs = "" + " role=\"" + (role) + "\""; + attrs = " role=\"" + (role) + "\""; } else { attrs = ""; } if ($truthy(reftext)) { - if ($truthy(($truthy($a = reftext['$include?']("<")) ? (reftext = reftext.$gsub($$($nesting, 'XmlSanitizeRx'), ""))['$include?'](" ") : $a))) { - reftext = reftext.$squeeze(" ").$strip();} if ($truthy(reftext['$include?']("\""))) { - reftext = reftext.$gsub("\"", """);} return "" + (attrs) + " xreflabel=\"" + (reftext) + "\""; + if (($truthy(reftext['$include?']("<")) && ($truthy((reftext = reftext.$gsub($$('XmlSanitizeRx'), ""))['$include?'](" "))))) { + reftext = reftext.$squeeze(" ").$strip(); + } if ($truthy(reftext['$include?']("\""))) { + reftext = reftext.$gsub("\"", """); + } return "" + (attrs) + " xreflabel=\"" + (reftext) + "\""; } else { return attrs - } }, $DocBook5Converter_common_attributes$50.$$arity = -2); + } }, -2); - Opal.def(self, '$author_tag', $DocBook5Converter_author_tag$51 = function $$author_tag(doc, author) { + $def(self, '$author_tag', function $$author_tag(doc, author) { var result = nil; @@ -857,190 +704,193 @@ result['$<<'](""); result['$<<'](""); if ($truthy(author.$firstname())) { - result['$<<']("" + "" + (doc.$sub_replacements(author.$firstname())) + "");} if ($truthy(author.$middlename())) { - result['$<<']("" + "" + (doc.$sub_replacements(author.$middlename())) + "");} if ($truthy(author.$lastname())) { - result['$<<']("" + "" + (doc.$sub_replacements(author.$lastname())) + "");} result['$<<'](""); + result['$<<']("" + (doc.$sub_replacements(author.$firstname())) + ""); + } if ($truthy(author.$middlename())) { + result['$<<']("" + (doc.$sub_replacements(author.$middlename())) + ""); + } if ($truthy(author.$lastname())) { + result['$<<']("" + (doc.$sub_replacements(author.$lastname())) + ""); + } result['$<<'](""); if ($truthy(author.$email())) { - result['$<<']("" + "" + (author.$email()) + "");} result['$<<'](""); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_author_tag$51.$$arity = 2); + result['$<<']("" + (author.$email()) + ""); + } result['$<<'](""); + return result.$join($$('LF')); + }); - Opal.def(self, '$document_info_tag', $DocBook5Converter_document_info_tag$52 = function $$document_info_tag(doc) { - var $a, $$53, $b, $$54, self = this, result = nil, title = nil, date = nil, authors = nil, author = nil, back_cover_tag = nil, front_cover_tag = nil, docinfo_content = nil; + $def(self, '$document_info_tag', function $$document_info_tag(doc) { + var $a, self = this, result = nil, title = nil, date = nil, authors = nil, author = nil, back_cover_tag = nil, front_cover_tag = nil, docinfo_content = nil; result = [""]; - if ($truthy(doc.$notitle())) ; else if ($truthy((title = doc.$doctitle($hash2(["partition", "use_fallback"], {"partition": true, "use_fallback": true})))['$subtitle?']())) { - result['$<<']("" + "" + (title.$main()) + "\n" + "" + (title.$subtitle()) + ""); - } else { - result['$<<']("" + "" + (title) + ""); - } if ($truthy((date = (function() {if ($truthy(doc['$attr?']("revdate"))) { - - return doc.$attr("revdate"); - } else { - - if ($truthy(doc['$attr?']("reproducible"))) { - return nil + if (!$truthy(doc.$notitle())) { + if ($truthy((title = doc.$doctitle($hash2(["partition", "use_fallback"], {"partition": true, "use_fallback": true})))['$subtitle?']())) { + result['$<<']("" + (title.$main()) + "\n" + "" + (title.$subtitle()) + ""); } else { - - return doc.$attr("docdate"); - } } })()))) { - result['$<<']("" + "" + (date) + "");} if ($truthy(doc['$attr?']("copyright"))) { + result['$<<']("" + (title) + ""); + } + } if ($truthy((date = ($truthy(doc['$attr?']("revdate")) ? (doc.$attr("revdate")) : (($truthy(doc['$attr?']("reproducible")) ? (nil) : (doc.$attr("docdate")))))))) { + result['$<<']("" + (date) + ""); + } if ($truthy(doc['$attr?']("copyright"))) { - $$($nesting, 'CopyrightRx')['$=~'](doc.$attr("copyright")); + $$('CopyrightRx')['$=~'](doc.$attr("copyright")); result['$<<'](""); - result['$<<']("" + "" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + ""); + result['$<<']("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + ""); if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { - result['$<<']("" + "" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "");} result['$<<']("");} if ($truthy(doc['$header?']())) { + result['$<<']("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + ""); + } result['$<<'](""); + } if ($truthy(doc['$header?']())) { - if ($truthy((authors = doc.$authors())['$empty?']())) ; else if ($truthy($rb_gt(authors.$size(), 1))) { - - result['$<<'](""); - $send(authors, 'each', [], ($$53 = function(author){var self = $$53.$$s || this; + if (!$truthy((authors = doc.$authors())['$empty?']())) { + if ($truthy($rb_gt(authors.$size(), 1))) { + + result['$<<'](""); + $send(authors, 'each', [], function $$18(author){var self = $$18.$$s == null ? this : $$18.$$s; - + + if (author == null) author = nil; + return result['$<<'](self.$author_tag(doc, author));}, {$$s: self}); + result['$<<'](""); + } else { - if (author == null) { - author = nil; - } return result['$<<'](self.$author_tag(doc, author));}, $$53.$$s = self, $$53.$$arity = 1, $$53)); - result['$<<'](""); - } else { + result['$<<'](self.$author_tag(doc, (author = authors['$[]'](0)))); + if ($truthy(author.$initials())) { + result['$<<']("" + (author.$initials()) + ""); + } } + } if (($truthy(doc['$attr?']("revdate")) && (($truthy(doc['$attr?']("revnumber")) || ($truthy(doc['$attr?']("revremark"))))))) { - result['$<<'](self.$author_tag(doc, (author = authors['$[]'](0)))); - if ($truthy(author.$initials())) { - result['$<<']("" + "" + (author.$initials()) + "");} } if ($truthy(($truthy($a = doc['$attr?']("revdate")) ? ($truthy($b = doc['$attr?']("revnumber")) ? $b : doc['$attr?']("revremark")) : $a))) { - - result['$<<']("" + "\n" + ""); + result['$<<']("\n" + ""); if ($truthy(doc['$attr?']("revnumber"))) { - result['$<<']("" + "" + (doc.$attr("revnumber")) + "");} if ($truthy(doc['$attr?']("revdate"))) { - result['$<<']("" + "" + (doc.$attr("revdate")) + "");} if ($truthy(doc['$attr?']("authorinitials"))) { - result['$<<']("" + "" + (doc.$attr("authorinitials")) + "");} if ($truthy(doc['$attr?']("revremark"))) { - result['$<<']("" + "" + (doc.$attr("revremark")) + "");} result['$<<']("" + "\n" + "");} if ($truthy(($truthy($a = doc['$attr?']("front-cover-image")) ? $a : doc['$attr?']("back-cover-image")))) { + result['$<<']("" + (doc.$attr("revnumber")) + ""); + } if ($truthy(doc['$attr?']("revdate"))) { + result['$<<']("" + (doc.$attr("revdate")) + ""); + } if ($truthy(doc['$attr?']("authorinitials"))) { + result['$<<']("" + (doc.$attr("authorinitials")) + ""); + } if ($truthy(doc['$attr?']("revremark"))) { + result['$<<']("" + (doc.$attr("revremark")) + ""); + } result['$<<']("\n" + ""); + } if (($truthy(doc['$attr?']("front-cover-image")) || ($truthy(doc['$attr?']("back-cover-image"))))) { if ($truthy((back_cover_tag = self.$cover_tag(doc, "back")))) { result['$<<'](self.$cover_tag(doc, "front", true)); result['$<<'](back_cover_tag); } else if ($truthy((front_cover_tag = self.$cover_tag(doc, "front")))) { - result['$<<'](front_cover_tag);}} if ($truthy(doc['$attr?']("orgname"))) { - result['$<<']("" + "" + (doc.$attr("orgname")) + "");} if ($truthy((docinfo_content = doc.$docinfo())['$empty?']())) ; else { + result['$<<'](front_cover_tag); + } + } if ($truthy(doc['$attr?']("orgname"))) { + result['$<<']("" + (doc.$attr("orgname")) + ""); + } if (!$truthy((docinfo_content = doc.$docinfo())['$empty?']())) { result['$<<'](docinfo_content); - }} result['$<<'](""); - if (doc.$doctype()['$==']("manpage")) { - - result['$<<'](""); - if ($truthy(doc['$attr?']("mantitle"))) { - result['$<<']("" + "" + (doc.$attr("mantitle")) + "");} if ($truthy(doc['$attr?']("manvolnum"))) { - result['$<<']("" + "" + (doc.$attr("manvolnum")) + "");} result['$<<']("" + "" + (doc.$attr("mansource", " ")) + ""); - result['$<<']("" + "" + (doc.$attr("manmanual", " ")) + ""); - result['$<<'](""); - result['$<<'](""); - if ($truthy(doc['$attr?']("mannames"))) { - result = $rb_plus(result, $send(doc.$attr("mannames"), 'map', [], ($$54 = function(n){var self = $$54.$$s || this; - - - - if (n == null) { - n = nil; - } return "" + "" + (n) + "";}, $$54.$$s = self, $$54.$$arity = 1, $$54)));} if ($truthy(doc['$attr?']("manpurpose"))) { - result['$<<']("" + "" + (doc.$attr("manpurpose")) + "");} result['$<<']("");} return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_document_info_tag$52.$$arity = 1); + } } result['$<<'](""); + return result.$join($$('LF')); + }); - Opal.def(self, '$enclose_content', $DocBook5Converter_enclose_content$55 = function $$enclose_content(node) { - - if (node.$content_model()['$==']("compound")) { + $def(self, '$get_root_document', function $$get_root_document(node) { + + + while ($truthy((node = node.$document())['$nested?']())) { + node = node.$parent_document(); + } return node; + }); + + $def(self, '$generate_document_id', function $$generate_document_id(doc) { + + return "__" + (doc.$doctype()) + "-root__" + }); + + $def(self, '$enclose_content', function $$enclose_content(node) { + + if ($eqeq(node.$content_model(), "compound")) { return node.$content() } else { - return "" + "" + (node.$content()) + "" + return "" + (node.$content()) + "" } - }, $DocBook5Converter_enclose_content$55.$$arity = 1); + }); - Opal.def(self, '$title_tag', $DocBook5Converter_title_tag$56 = function $$title_tag(node, optional) { - var $a; - + $def(self, '$title_tag', function $$title_tag(node, optional) { - if (optional == null) { - optional = true; - } if ($truthy(($truthy($a = optional['$!']()) ? $a : node['$title?']()))) { - return "" + "" + (node.$title()) + "\n" + if (optional == null) optional = true; + if (($not(optional) || ($truthy(node['$title?']())))) { + return "" + (node.$title()) + "\n" } else { return "" - } }, $DocBook5Converter_title_tag$56.$$arity = -2); + } }, -2); - Opal.def(self, '$cover_tag', $DocBook5Converter_cover_tag$57 = function $$cover_tag(doc, face, use_placeholder) { + $def(self, '$cover_tag', function $$cover_tag(doc, face, use_placeholder) { var $a, cover_image = nil, width_attr = nil, depth_attr = nil, attrlist = nil, attrs = nil; - - if (use_placeholder == null) { - use_placeholder = false; - } if ($truthy((cover_image = doc.$attr("" + (face) + "-cover-image")))) { + if (use_placeholder == null) use_placeholder = false; + if ($truthy((cover_image = doc.$attr("" + (face) + "-cover-image")))) { width_attr = ""; depth_attr = ""; - if ($truthy(($truthy($a = cover_image['$include?'](":")) ? $$($nesting, 'ImageMacroRx')['$=~'](cover_image) : $a))) { + if (($truthy(cover_image['$include?'](":")) && ($truthy($$('ImageMacroRx')['$=~'](cover_image))))) { attrlist = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)); cover_image = doc.$image_uri((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))); if ($truthy(attrlist)) { - attrs = $$($nesting, 'AttributeList').$new(attrlist).$parse(["alt", "width", "height"]); + attrs = $$('AttributeList').$new(attrlist).$parse(["alt", "width", "height"]); if ($truthy(attrs['$key?']("scaledwidth"))) { - width_attr = "" + " width=\"" + (attrs['$[]']("scaledwidth")) + "\""; + width_attr = " width=\"" + (attrs['$[]']("scaledwidth")) + "\""; } else { if ($truthy(attrs['$key?']("width"))) { - width_attr = "" + " contentwidth=\"" + (attrs['$[]']("width")) + "\"";} if ($truthy(attrs['$key?']("height"))) { - depth_attr = "" + " contentdepth=\"" + (attrs['$[]']("height")) + "\"";} }}} return "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + width_attr = " contentwidth=\"" + (attrs['$[]']("width")) + "\""; + } if ($truthy(attrs['$key?']("height"))) { + depth_attr = " contentdepth=\"" + (attrs['$[]']("height")) + "\""; + } } } } return "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; } else if ($truthy(use_placeholder)) { - return "" + "" + return "" } else { return nil - } }, $DocBook5Converter_cover_tag$57.$$arity = -3); + } }, -3); - Opal.def(self, '$blockquote_tag', $DocBook5Converter_blockquote_tag$58 = function $$blockquote_tag(node, tag_name) { - var $a, $iter = $DocBook5Converter_blockquote_tag$58.$$p, $yield = $iter || nil, self = this, start_tag = nil, end_tag = nil, result = nil; + $def(self, '$blockquote_tag', function $$blockquote_tag(node, tag_name) { + var $a, $yield = $$blockquote_tag.$$p || nil, self = this, start_tag = nil, end_tag = nil, result = nil; - if ($iter) $DocBook5Converter_blockquote_tag$58.$$p = null; - + $$blockquote_tag.$$p = null; - if (tag_name == null) { - tag_name = nil; - } if ($truthy(tag_name)) { - $a = ["" + "<" + (tag_name), "" + ""], (start_tag = $a[0]), (end_tag = $a[1]), $a; + if (tag_name == null) tag_name = nil; + if ($truthy(tag_name)) { + $a = ["<" + (tag_name), ""], (start_tag = $a[0]), (end_tag = $a[1]); } else { - $a = [""], (start_tag = $a[0]), (end_tag = $a[1]), $a; + $a = [""], (start_tag = $a[0]), (end_tag = $a[1]); } result = ["" + (start_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"]; if ($truthy(node['$title?']())) { - result['$<<']("" + "" + (node.$title()) + "");} if ($truthy(($truthy($a = node['$attr?']("attribution")) ? $a : node['$attr?']("citetitle")))) { + result['$<<']("" + (node.$title()) + ""); + } if (($truthy(node['$attr?']("attribution")) || ($truthy(node['$attr?']("citetitle"))))) { result['$<<'](""); if ($truthy(node['$attr?']("attribution"))) { - result['$<<'](node.$attr("attribution"));} if ($truthy(node['$attr?']("citetitle"))) { - result['$<<']("" + "" + (node.$attr("citetitle")) + "");} result['$<<']("");} result['$<<'](Opal.yieldX($yield, [])); + result['$<<'](node.$attr("attribution")); + } if ($truthy(node['$attr?']("citetitle"))) { + result['$<<']("" + (node.$attr("citetitle")) + ""); + } result['$<<'](""); + } result['$<<'](Opal.yieldX($yield, [])); result['$<<'](end_tag); - return result.$join($$($nesting, 'LF')); - }, $DocBook5Converter_blockquote_tag$58.$$arity = -2); + return result.$join($$('LF')); + }, -2); - Opal.def(self, '$asciimath_available?', $DocBook5Converter_asciimath_available$ques$59 = function() { - var $a, self = this; + $def(self, '$asciimath_available?', function $DocBook5Converter_asciimath_available$ques$19() { + var self = this, $ret_or_1 = nil; - return (self.asciimath_status = ($truthy($a = self.asciimath_status) ? $a : self.$load_asciimath()))['$==']("loaded") - }, $DocBook5Converter_asciimath_available$ques$59.$$arity = 0); - return (Opal.def(self, '$load_asciimath', $DocBook5Converter_load_asciimath$60 = function $$load_asciimath() { + return (self.asciimath_status = ($truthy(($ret_or_1 = self.asciimath_status)) ? ($ret_or_1) : (self.$load_asciimath())))['$==']("loaded") + }); + return $def(self, '$load_asciimath', function $$load_asciimath() { var $a, $b, $c, $d; if ($truthy(((($a = $$$('::', 'AsciiMath', 'skip_raise')) && ($b = $a, $b) && ($c = $b) && ((($d = $c.$parse) && !$d.$$stub) || $c['$respond_to_missing?']('parse'))) ? 'method' : nil))) { return "loaded" - } else if ($truthy($$($nesting, 'Helpers').$require_library("asciimath", true, "warn")['$nil?']())) { + } else if ($truthy($$('Helpers').$require_library("asciimath", true, "warn")['$nil?']())) { return "unavailable" } else { return "loaded" } - }, $DocBook5Converter_load_asciimath$60.$$arity = 0), nil) && 'load_asciimath'; - })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting); + }); + })($$('Converter'), $$$($$('Converter'), 'Base'), $nesting) })($nesting[0], $nesting) - })(Opal); + }); } @@ -1048,4 +898,4 @@ return AsciidoctorDocBook; -}))); +})); diff --git a/package-lock.json b/package-lock.json index b429c47..054d997 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,7 @@ { "name": "@asciidoctor/docbook-converter", "version": "3.0.0-alpha.1", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { @@ -9,155 +9,262 @@ "version": "3.0.0-alpha.1", "license": "MIT", "devDependencies": { - "@asciidoctor/core": "^2.0.0-rc.1", + "@asciidoctor/core": "~3.0", "bestikk-download": "1.0.0", "bestikk-fs": "1.0.0", "bestikk-log": "0.1.0", - "chai": "^4.2.0", - "dirty-chai": "^2.0.1", - "mocha": "9.2.2", - "mock-http-server": "^1.4.2", - "opal-compiler": "^1.0.13", - "portfinder": "^1.0.26", + "chai": "~4.3", + "dirty-chai": "2.0.1", + "mocha": "~10.2", + "mock-http-server": "1.4.5", + "opal-compiler": "3.0.0", + "portfinder": "1.0.32", "puppeteer": "^13.0.0", - "rollup": "^2.18.0", - "standard": "^16.0.3" + "rollup": "3.21.6", + "standard": "~17.0" }, "engines": { "node": ">=8.11", "npm": ">=5.0.0" }, "peerDependencies": { - "@asciidoctor/core": "^2.0.0-rc.1" + "@asciidoctor/core": ">= 3.0 < 4.0" + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" } }, "node_modules/@asciidoctor/core": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/@asciidoctor/core/-/core-2.2.5.tgz", - "integrity": "sha512-jtQPQ5EivgFbwvSyGKas4ANnMGGHPbmu791H9xrZKooA65JNI30jM2em5MvUXTTetSPgb6saUf+PJibEuSB6uw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@asciidoctor/core/-/core-3.0.2.tgz", + "integrity": "sha512-GbQWpqLlM/kN+90QrlLYISdU/vbGkUSeHsBQR9BzYNmVHDd6CEb/xfQZIFUo//EtT7e+QS3Sv3yYDzgjr96TbA==", "dev": true, "dependencies": { - "asciidoctor-opal-runtime": "0.3.3", - "unxhr": "1.0.1" + "@asciidoctor/opal-runtime": "3.0.1", + "unxhr": "1.2.0" }, "engines": { - "node": ">=8.11", - "npm": ">=5.0.0", - "yarn": ">=1.1.0" + "node": ">=16", + "npm": ">=8" } }, - "node_modules/@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "node_modules/@asciidoctor/opal-runtime": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@asciidoctor/opal-runtime/-/opal-runtime-3.0.1.tgz", + "integrity": "sha512-iW7ACahOG0zZft4A/4CqDcc7JX+fWRNjV5tFAVkNCzwZD+EnFolPaUOPYt8jzadc0+Bgd80cQTtRMQnaaV1kkg==", "dev": true, "dependencies": { - "@babel/highlight": "^7.10.4" + "glob": "8.1.0", + "unxhr": "1.2.0" + }, + "engines": { + "node": ">=16" } }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", - "dev": true - }, - "node_modules/@babel/highlight": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", - "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.10.4", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.9.1.tgz", + "integrity": "sha512-Y27x+MBLjXa+0JWDhykM3+JE+il3kHKAEqabfEWq3SDhZjLYb6/BHL/JKFnH3fe207JaXkyDo685Oc2Glt6ifA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "node_modules/@eslint/eslintrc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "dev": true, "dependencies": { - "color-convert": "^1.9.0" + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" }, "engines": { - "node": ">=4" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=4" + "node": "*" } }, - "node_modules/@eslint/eslintrc": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.1.tgz", - "integrity": "sha512-XRUeBZ5zBWLYgSANMpThFddrZZkEbGHgUdt5UJjZfnlN9BGCiUBrf+nvbRupSjMvqzwnQN0qwCmOxITt1cfywA==", + "node_modules/@eslint/js": { + "version": "8.51.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz", + "integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", "dev": true, "dependencies": { - "ajv": "^6.12.4", + "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "lodash": "^4.17.19", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" + "minimatch": "^3.0.5" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=10.10.0" } }, - "node_modules/@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, "node_modules/@types/node": { - "version": "16.4.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.12.tgz", - "integrity": "sha512-zxrTNFl9Z8boMJXs6ieqZP0wAhvkdzmHSxTlJabM16cf5G9xBc1uPRH5Bbv2omEDDiM8MzTfqTJXBf0Ba4xFWA==", + "version": "20.8.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.4.tgz", + "integrity": "sha512-ZVPnqU58giiCjSxjVUESDtdPk4QR5WQhhINbc9UBrKLU68MX5BF6kbQzTrkwbolyr0X8ChBpXfavr5mZFKZQ5A==", "dev": true, - "optional": true + "optional": true, + "dependencies": { + "undici-types": "~5.25.1" + } }, "node_modules/@types/yauzl": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", - "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.1.tgz", + "integrity": "sha512-CHzgNU3qYBnp/O4S3yv2tXPlvMTq0YWSTVg2/JYLqWZGHwwgJGAwd00poay/11asPq8wLFwHzubyInqHIFmmiw==", "dev": true, "optional": true, "dependencies": { "@types/node": "*" } }, - "node_modules/@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, "node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -167,9 +274,9 @@ } }, "node_modules/acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -213,21 +320,20 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" }, "engines": { @@ -237,28 +343,10 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/ansi-styles/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/ansi-styles/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "dependencies": { "normalize-path": "^3.0.0", @@ -269,23 +357,35 @@ } }, "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", "dev": true, "dependencies": { - "sprintf-js": "~1.0.2" + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/array-includes": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", - "integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", + "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", "dev": true, "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0", - "is-string": "^1.0.5" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-string": "^1.0.7" }, "engines": { "node": ">= 0.4" @@ -294,15 +394,17 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array.prototype.flat": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", - "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", + "node_modules/array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" }, "engines": { "node": ">= 0.4" @@ -311,24 +413,16 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array.prototype.flat/node_modules/es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "node_modules/array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", "dev": true, "dependencies": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -338,15 +432,15 @@ } }, "node_modules/array.prototype.flatmap": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.2.4.tgz", - "integrity": "sha512-r9Z0zYoxqHz60vvQbWEdXIEtCwHF0yxaWfno9qzXeNHvfyl3BZqygmGzb84dsubyaXLH4husF+NFgMSdpZhk2Q==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1", - "function-bind": "^1.1.1" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -355,43 +449,38 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array.prototype.flatmap/node_modules/es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "node_modules/array.prototype.tosorted": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.2.tgz", + "integrity": "sha512-HuQCHOlk1Weat5jzStICBCd83NxiIMwqDg/dHEsoefabn/hJRj5pVdWcPUSpRrwhwxZOsQassMpgN/xRYFBMIg==", "dev": true, "dependencies": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" } }, - "node_modules/asciidoctor-opal-runtime": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/asciidoctor-opal-runtime/-/asciidoctor-opal-runtime-0.3.3.tgz", - "integrity": "sha512-/CEVNiOia8E5BMO9FLooo+Kv18K4+4JBFRJp8vUy/N5dMRAg+fRNV4HA+o6aoSC79jVU/aT5XvUpxSxSsTS8FQ==", + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", "dev": true, "dependencies": { - "glob": "7.1.3", - "unxhr": "1.0.1" + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" }, "engines": { - "node": ">=8.11" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/assertion-error": { @@ -403,28 +492,40 @@ "node": "*" } }, - "node_modules/astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, - "engines": { - "node": ">=4" + "dependencies": { + "lodash": "^4.17.14" } }, - "node_modules/async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "node_modules/asynciterator.prototype": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz", + "integrity": "sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg==", "dev": true, "dependencies": { - "lodash": "^4.17.11" + "has-symbols": "^1.0.3" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "node_modules/base64-js": { @@ -476,7 +577,7 @@ "node_modules/bestikk-log": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/bestikk-log/-/bestikk-log-0.1.0.tgz", - "integrity": "sha1-asbdy07E776U7gguKJ5Mv2rVTyA=", + "integrity": "sha512-+btMmLI/mKJFK+s6ZCbh7YLMxn9RzJCcGXaTPx5/R3r4MmTmsjXMHQaDjPkh7/xWteituJ6EM0kdaNqTxPCCmw==", "dev": true, "dependencies": { "colors": "1.1.2" @@ -502,24 +603,27 @@ } }, "node_modules/body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dev": true, "dependencies": { - "bytes": "3.1.0", - "content-type": "~1.0.4", + "bytes": "3.1.2", + "content-type": "~1.0.5", "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" }, "engines": { - "node": ">= 0.8" + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, "node_modules/body-parser/node_modules/debug": { @@ -534,17 +638,16 @@ "node_modules/body-parser/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -608,7 +711,7 @@ "node_modules/buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "dev": true, "engines": { "node": "*" @@ -617,26 +720,50 @@ "node_modules/buffer-fill": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", "dev": true }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "dependencies": { + "semver": "^7.0.0" + } + }, + "node_modules/builtins/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/call-bind": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", - "integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "dev": true, "dependencies": { "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.0" + "get-intrinsic": "^1.0.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -652,9 +779,9 @@ } }, "node_modules/camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, "engines": { "node": ">=10" @@ -664,26 +791,27 @@ } }, "node_modules/chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "version": "4.3.10", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", + "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", "pathval": "^1.1.1", - "type-detect": "^4.0.5" + "type-detect": "^4.0.8" }, "engines": { "node": ">=4" } }, "node_modules/chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "dependencies": { "ansi-styles": "^4.1.0", @@ -696,15 +824,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chalk/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/chalk/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -718,10 +837,13 @@ } }, "node_modules/check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", "dev": true, + "dependencies": { + "get-func-name": "^2.0.2" + }, "engines": { "node": "*" } @@ -754,9 +876,9 @@ } }, "node_modules/chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, "node_modules/cliui": { @@ -770,66 +892,28 @@ "wrap-ansi": "^7.0.0" } }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/cliui/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" + "node": ">=7.0.0" } }, "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "integrity": "sha512-ENwblkFQpqqia6b++zLD/KUWafYlVY/UNnAp7oz7LY7E924wmpye416wBOmvv/HMWzl8gL1kJlfvId/1Dg176w==", "dev": true, "engines": { "node": ">=0.1.90" @@ -838,7 +922,7 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "node_modules/connect": { @@ -868,31 +952,22 @@ "node_modules/connect/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, - "node_modules/contains-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "dev": true }, "node_modules/cross-fetch": { @@ -919,9 +994,9 @@ } }, "node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -935,6 +1010,12 @@ } } }, + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/decamelize": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", @@ -948,48 +1029,77 @@ } }, "node_modules/deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, "dependencies": { "type-detect": "^4.0.0" }, "engines": { - "node": ">=0.12" + "node": ">=6" } }, "node_modules/deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "node_modules/define-data-property": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.0.tgz", + "integrity": "sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", "dev": true, "dependencies": { - "object-keys": "^1.0.12" + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", "dev": true, "engines": { - "node": ">= 0.6" + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, "node_modules/devtools-protocol": { - "version": "0.0.969999", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.969999.tgz", - "integrity": "sha512-6GfzuDWU0OFAuOvBokXpXPLxjOJ5DZ157Ue3sGQQM3LgAamb8m0R0ruSfN0DDu+XG5XJgT50i6zZ/0o8RglreQ==", + "version": "0.0.981744", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.981744.tgz", + "integrity": "sha512-0cuGS8+jhR67Fy7qG3i3Pc7Aw494sb9yG9QgpG97SFVWwolgYjlhJg7n+UaHxOQT30d1TYu/EYe9k01ivLErIg==", "dev": true }, "node_modules/diff": { @@ -1025,45 +1135,33 @@ "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "dev": true }, "node_modules/emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "dev": true, "dependencies": { "once": "^1.4.0" } }, - "node_modules/enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "dependencies": { - "ansi-colors": "^4.1.1" - }, - "engines": { - "node": ">=8.6" - } - }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1074,22 +1172,50 @@ } }, "node_modules/es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.2.tgz", + "integrity": "sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA==", "dev": true, "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.2", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.1", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.12", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.3", "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.1", + "safe-array-concat": "^1.0.1", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.8", + "string.prototype.trimend": "^1.0.7", + "string.prototype.trimstart": "^1.0.7", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.11" }, "engines": { "node": ">= 0.4" @@ -1098,6 +1224,51 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-iterator-helpers": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz", + "integrity": "sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g==", + "dev": true, + "dependencies": { + "asynciterator.prototype": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.1", + "es-set-tostringtag": "^2.0.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.2.1", + "globalthis": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "iterator.prototype": "^1.1.2", + "safe-array-concat": "^1.0.1" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + } + }, "node_modules/es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", @@ -1127,76 +1298,79 @@ "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", "dev": true }, "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, "engines": { - "node": ">=0.8.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/eslint": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.13.0.tgz", - "integrity": "sha512-uCORMuOO8tUzJmsdRtrvcGq5qposf7Rw0LwkTJkoDbOycVQtQjmnhZSuLQnozLE4TmAzlMVV45eCHmQ1OpDKUQ==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.2.1", - "ajv": "^6.10.0", + "version": "8.51.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz", + "integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.51.0", + "@humanwhocodes/config-array": "^0.11.11", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", - "debug": "^4.0.1", + "debug": "^4.3.2", "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.0", - "esquery": "^1.2.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.19", - "minimatch": "^3.0.4", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-config-standard": { - "version": "16.0.2", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.2.tgz", - "integrity": "sha512-fx3f1rJDsl9bY7qzyX8SAtP8GBSk6MfXFaTfaGgk12aAYW4gJSyRm7dM790L6cbXv63fvjY4XeSzXnb4WM+SKw==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", + "integrity": "sha512-/2ks1GKyqSOkH7JFvXJicu0iMpoojkwB+f5Du/1SC0PtBL+s8v30k9njRZ21pm2drKYm2342jFnGWzttxPmZVg==", "dev": true, "funding": [ { @@ -1213,16 +1387,16 @@ } ], "peerDependencies": { - "eslint": "^7.12.1", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1" + "eslint": "^8.0.1", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0", + "eslint-plugin-promise": "^6.0.0" } }, "node_modules/eslint-config-standard-jsx": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-10.0.0.tgz", - "integrity": "sha512-hLeA2f5e06W1xyr/93/QJulN/rLbUVUmqTlexv9PRKHFwEC9ffJcH2LvJhMoEqYQBEYafedgGZXH2W8NUpt5lA==", + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-11.0.0.tgz", + "integrity": "sha512-+1EV/R0JxEK1L0NGolAr8Iktm3Rgotx3BKwgaX+eAuSX8D952LULKtjgZD3F+e6SvibONnhLwoTi9DPxN5LvvQ==", "dev": true, "funding": [ { @@ -1239,67 +1413,60 @@ } ], "peerDependencies": { - "eslint": "^7.12.1", - "eslint-plugin-react": "^7.21.5" + "eslint": "^8.8.0", + "eslint-plugin-react": "^7.28.0" } }, "node_modules/eslint-import-resolver-node": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", - "integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", "dev": true, "dependencies": { - "debug": "^2.6.9", - "resolve": "^1.13.1" + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" } }, "node_modules/eslint-import-resolver-node/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, - "node_modules/eslint-import-resolver-node/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/eslint-module-utils": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", - "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", "dev": true, "dependencies": { - "debug": "^2.6.9", - "pkg-dir": "^2.0.0" + "debug": "^3.2.7" }, "engines": { "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } } }, "node_modules/eslint-module-utils/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, - "node_modules/eslint-module-utils/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/eslint-plugin-es": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", - "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", + "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", "dev": true, "dependencies": { "eslint-utils": "^2.0.0", @@ -1315,131 +1482,216 @@ "eslint": ">=4.19.1" } }, + "node_modules/eslint-plugin-es/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/eslint-plugin-import": { - "version": "2.22.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", - "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", - "dev": true, - "dependencies": { - "array-includes": "^3.1.1", - "array.prototype.flat": "^1.2.3", - "contains-path": "^0.1.0", - "debug": "^2.6.9", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.4", - "eslint-module-utils": "^2.6.0", + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz", + "integrity": "sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.findlastindex": "^1.2.2", + "array.prototype.flat": "^1.3.1", + "array.prototype.flatmap": "^1.3.1", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.7", + "eslint-module-utils": "^2.8.0", "has": "^1.0.3", - "minimatch": "^3.0.4", - "object.values": "^1.1.1", - "read-pkg-up": "^2.0.0", - "resolve": "^1.17.0", - "tsconfig-paths": "^3.9.0" + "is-core-module": "^2.13.0", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.6", + "object.groupby": "^1.0.0", + "object.values": "^1.1.6", + "semver": "^6.3.1", + "tsconfig-paths": "^3.14.2" }, "engines": { "node": ">=4" }, "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "node_modules/eslint-plugin-import/node_modules/doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "dependencies": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" + "esutils": "^2.0.2" }, "engines": { "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-import/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "node_modules/eslint-plugin-import/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } }, - "node_modules/eslint-plugin-node": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", - "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "node_modules/eslint-plugin-n": { + "version": "15.7.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.7.0.tgz", + "integrity": "sha512-jDex9s7D/Qial8AGVIHq4W7NswpUD5DPDL2RH8Lzd9EloWUuvUkHfv4FRLMipH5q2UtyurorBkPeNi1wVWNh3Q==", "dev": true, "dependencies": { - "eslint-plugin-es": "^3.0.0", - "eslint-utils": "^2.0.0", + "builtins": "^5.0.1", + "eslint-plugin-es": "^4.1.0", + "eslint-utils": "^3.0.0", "ignore": "^5.1.1", - "minimatch": "^3.0.4", - "resolve": "^1.10.1", - "semver": "^6.1.0" + "is-core-module": "^2.11.0", + "minimatch": "^3.1.2", + "resolve": "^1.22.1", + "semver": "^7.3.8" }, "engines": { - "node": ">=8.10.0" + "node": ">=12.22.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" }, "peerDependencies": { - "eslint": ">=5.16.0" + "eslint": ">=7.0.0" } }, - "node_modules/eslint-plugin-node/node_modules/ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "node_modules/eslint-plugin-n/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-n/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, "engines": { - "node": ">= 4" + "node": "*" } }, - "node_modules/eslint-plugin-node/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "node_modules/eslint-plugin-n/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/eslint-plugin-promise": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz", - "integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", + "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==", "dev": true, "engines": { - "node": ">=6" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" } }, "node_modules/eslint-plugin-react": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.21.5.tgz", - "integrity": "sha512-8MaEggC2et0wSF6bUeywF7qQ46ER81irOdWS4QWxnnlAEsnzeBevk1sWh7fhpCghPpXb+8Ks7hvaft6L/xsR6g==", + "version": "7.33.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz", + "integrity": "sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==", "dev": true, "dependencies": { - "array-includes": "^3.1.1", - "array.prototype.flatmap": "^1.2.3", + "array-includes": "^3.1.6", + "array.prototype.flatmap": "^1.3.1", + "array.prototype.tosorted": "^1.1.1", "doctrine": "^2.1.0", - "has": "^1.0.3", + "es-iterator-helpers": "^1.0.12", + "estraverse": "^5.3.0", "jsx-ast-utils": "^2.4.1 || ^3.0.0", - "object.entries": "^1.1.2", - "object.fromentries": "^2.0.2", - "object.values": "^1.1.1", - "prop-types": "^15.7.2", - "resolve": "^1.18.1", - "string.prototype.matchall": "^4.0.2" + "minimatch": "^3.1.2", + "object.entries": "^1.1.6", + "object.fromentries": "^2.0.6", + "object.hasown": "^1.1.2", + "object.values": "^1.1.6", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.4", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.8" }, "engines": { "node": ">=4" }, "peerDependencies": { - "eslint": "^3 || ^4 || ^5 || ^6 || ^7" + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" + } + }, + "node_modules/eslint-plugin-react/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, "node_modules/eslint-plugin-react/node_modules/doctrine": { @@ -1454,104 +1706,145 @@ "node": ">=0.10.0" } }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "node_modules/eslint-plugin-react/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=8.0.0" + "node": "*" } }, - "node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "node_modules/eslint-plugin-react/node_modules/resolve": { + "version": "2.0.0-next.5", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", + "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", "dev": true, "dependencies": { - "eslint-visitor-keys": "^1.1.0" + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, "engines": { - "node": ">=6" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" }, "funding": { "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" } }, "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true, "engines": { - "node": ">=4" + "node": ">=10" } }, "node_modules/eslint-visitor-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", - "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "engines": { - "node": ">=10" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/espree": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", - "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.3.0" + "is-glob": "^4.0.3" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=10.13.0" } }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, "engines": { - "node": ">=4" + "node": "*" } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": ">=4" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "dependencies": { "estraverse": "^5.1.0" @@ -1560,15 +1853,6 @@ "node": ">=0.10" } }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/esrecurse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", @@ -1581,19 +1865,10 @@ "node": ">=4.0" } }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "engines": { "node": ">=4.0" @@ -1643,28 +1918,37 @@ "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "dev": true, "dependencies": { "pend": "~1.2.0" } }, "node_modules/file-entry-cache": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, "dependencies": { - "flat-cache": "^2.0.1" + "flat-cache": "^3.0.4" }, "engines": { - "node": ">=4" + "node": "^10.12.0 || >=12.0.0" } }, "node_modules/fill-range": { @@ -1709,19 +1993,35 @@ "node_modules/finalhandler/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, + "node_modules/finalhandler/node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==", + "dev": true, + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "dependencies": { - "locate-path": "^2.0.0" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/flat": { @@ -1734,25 +2034,34 @@ } }, "node_modules/flat-cache": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", - "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", + "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==", "dev": true, "dependencies": { - "flatted": "^2.0.0", - "rimraf": "2.6.3", - "write": "1.0.3" + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" }, "engines": { - "node": ">=4" + "node": ">=12.0.0" } }, "node_modules/flatted": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", - "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", @@ -1762,13 +2071,13 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "optional": true, @@ -1785,11 +2094,32 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/get-caller-file": { "version": "2.0.5", @@ -1801,23 +2131,24 @@ } }, "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, "engines": { "node": "*" } }, "node_modules/get-intrinsic": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", - "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1850,31 +2181,39 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-stream/node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", "dev": true, "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "minimatch": "^5.0.1", + "once": "^1.3.0" }, "engines": { - "node": "*" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { @@ -1890,12 +2229,12 @@ } }, "node_modules/globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", + "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", "dev": true, "dependencies": { - "type-fest": "^0.8.1" + "type-fest": "^0.20.2" }, "engines": { "node": ">=8" @@ -1904,47 +2243,116 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", - "dev": true - }, - "node_modules/growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", "dev": true, + "dependencies": { + "define-properties": "^1.1.3" + }, "engines": { - "node": ">=4.x" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dev": true, "dependencies": { - "function-bind": "^1.1.1" + "get-intrinsic": "^1.1.3" }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz", + "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==", + "dev": true, "engines": { "node": ">= 0.4.0" } }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/has-symbols": { + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, "engines": { "node": ">= 0.4" }, @@ -1961,32 +2369,35 @@ "he": "bin/he" } }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, "node_modules/http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "dev": true, "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" }, "engines": { - "node": ">= 0.6" + "node": ">= 0.8" + } + }, + "node_modules/http-errors/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "engines": { + "node": ">= 0.8" } }, "node_modules/https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, "dependencies": { "agent-base": "6", @@ -2029,18 +2440,18 @@ ] }, "node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, "engines": { "node": ">= 4" } }, "node_modules/import-fresh": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz", - "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "dependencies": { "parent-module": "^1.0.0", @@ -2048,12 +2459,15 @@ }, "engines": { "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, "engines": { "node": ">=0.8.19" @@ -2062,7 +2476,7 @@ "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "dependencies": { "once": "^1.3.0", @@ -2070,31 +2484,72 @@ } }, "node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "node_modules/internal-slot": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.2.tgz", - "integrity": "sha512-2cQNfwhAfJIkU4KZPkDI+Gj5yNNnbqi40W9Gge6dfnk4TocEVm00B3bdiL+JINrbGJil2TeHvM4rETGzk/f/0g==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", "dev": true, "dependencies": { - "es-abstract": "^1.17.0-next.1", + "get-intrinsic": "^1.2.0", "has": "^1.0.3", - "side-channel": "^1.0.2" + "side-channel": "^1.0.4" }, "engines": { "node": ">= 0.4" } }, - "node_modules/is-arrayish": { + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, + "node_modules/is-async-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", + "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -2107,10 +2562,26 @@ "node": ">=8" } }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-callable": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", - "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true, "engines": { "node": ">= 0.4" @@ -2120,9 +2591,9 @@ } }, "node_modules/is-core-module": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.1.0.tgz", - "integrity": "sha512-YcV7BgVMRFRua2FqQzKtTDMz8iCuLEyGKjr70q8Zm1yy2qKcurbFEd79PAdHV77oL3NrAaOVQIbMmiHQCHB7ZA==", + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -2132,10 +2603,13 @@ } }, "node_modules/is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -2146,25 +2620,52 @@ "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, "engines": { "node": ">=0.10.0" } }, + "node_modules/is-finalizationregistry": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz", + "integrity": "sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { - "node": ">=4" + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "dependencies": { "is-extglob": "^2.1.1" @@ -2173,13 +2674,25 @@ "node": ">=0.10.0" } }, + "node_modules/is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-negative-zero": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", - "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", "dev": true, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-number": { @@ -2191,6 +2704,30 @@ "node": ">=0.12.0" } }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-obj": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", @@ -2201,12 +2738,13 @@ } }, "node_modules/is-regex": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", - "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "dev": true, "dependencies": { - "has-symbols": "^1.0.1" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -2215,11 +2753,35 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -2228,12 +2790,27 @@ } }, "node_modules/is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", "dev": true, "dependencies": { - "has-symbols": "^1.0.1" + "which-typed-array": "^1.1.11" }, "engines": { "node": ">= 0.4" @@ -2254,18 +2831,65 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", "dev": true }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/iterator.prototype": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.2.tgz", + "integrity": "sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "reflect.getprototypeof": "^1.0.4", + "set-function-name": "^2.0.1" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -2273,18 +2897,23 @@ "dev": true }, "node_modules/js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -2300,13 +2929,13 @@ "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, "node_modules/json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "dependencies": { "minimist": "^1.2.0" @@ -2316,18 +2945,29 @@ } }, "node_modules/jsx-ast-utils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.1.0.tgz", - "integrity": "sha512-d4/UOjg+mxAWxCiF0c5UTSwyqbchkbqCvK87aBovhnh8GtysTjWmgC63tY0cJx/HzGgm9qnA147jVBdpOiQ2RA==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", "dev": true, "dependencies": { - "array-includes": "^3.1.1", - "object.assign": "^4.1.1" + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" }, "engines": { "node": ">=4.0" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -2342,31 +2982,43 @@ } }, "node_modules/load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", + "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", "dev": true, "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" + "graceful-fs": "^4.1.15", + "parse-json": "^4.0.0", + "pify": "^4.0.1", + "strip-bom": "^3.0.0", + "type-fest": "^0.3.0" }, "engines": { - "node": ">=4" + "node": ">=6" + } + }, + "node_modules/load-json-file/node_modules/type-fest": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "dev": true, + "engines": { + "node": ">=6" } }, "node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" + "p-locate": "^5.0.0" }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/lodash": { @@ -2375,6 +3027,12 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", @@ -2403,61 +3061,85 @@ "loose-envify": "cli.js" } }, + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-db": { - "version": "1.48.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz", - "integrity": "sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.31", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.31.tgz", - "integrity": "sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "dependencies": { - "mime-db": "1.48.0" + "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" } }, "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=10" } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "dependencies": { - "minimist": "^1.2.5" + "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" @@ -2470,100 +3152,73 @@ "dev": true }, "node_modules/mocha": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", - "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", + "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", "dev": true, "dependencies": { - "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", "chokidar": "3.5.3", - "debug": "4.3.3", + "debug": "4.3.4", "diff": "5.0.0", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", "glob": "7.2.0", - "growl": "1.10.5", "he": "1.2.0", "js-yaml": "4.1.0", "log-symbols": "4.1.0", - "minimatch": "4.2.1", + "minimatch": "5.0.1", "ms": "2.1.3", - "nanoid": "3.3.1", + "nanoid": "3.3.3", "serialize-javascript": "6.0.0", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", - "which": "2.0.2", - "workerpool": "6.2.0", + "workerpool": "6.2.1", "yargs": "16.2.0", "yargs-parser": "20.2.4", "yargs-unparser": "2.0.0" }, "bin": { "_mocha": "bin/_mocha", - "mocha": "bin/mocha" + "mocha": "bin/mocha.js" }, "engines": { - "node": ">= 12.0.0" + "node": ">= 14.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/mochajs" } }, - "node_modules/mocha/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/mocha/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "node_modules/mocha/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, "engines": { - "node": ">=10" + "node": "*" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/mocha/node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mocha/node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "node_modules/mocha/node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, "node_modules/mocha/node_modules/glob/node_modules/minimatch": { @@ -2578,118 +3233,22 @@ "node": "*" } }, - "node_modules/mocha/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/mocha/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/mocha/node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/mocha/node_modules/minimatch": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", - "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/mocha/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mocha/node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mocha/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/mocha/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "brace-expansion": "^2.0.1" }, "engines": { "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" } }, "node_modules/mock-http-server": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/mock-http-server/-/mock-http-server-1.4.4.tgz", - "integrity": "sha512-QVkc/cI19VDsuDoCINgFnNl5TRiAVI4c7ReCoCbqWE5Je7RrkZIqMjWAIoTExQMCMZAiaUIJpX/0ae+yOVUuxg==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/mock-http-server/-/mock-http-server-1.4.5.tgz", + "integrity": "sha512-7WZx7RJmMQEvTxJTOJt9U6+gLFl0JFaPHLSsAngfLaOgr3UH+ci7PW8049quyXwZGI4mh3W8oAch6w406ccyRQ==", "dev": true, "dependencies": { "body-parser": "^1.18.1", @@ -2699,18 +3258,18 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "node_modules/multiparty": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz", - "integrity": "sha512-NtZLjlvsjcoGrzojtwQwn/Tm90aWJ6XXtPppYF4WmOk/6ncdwMMKggFY2NlRRN9yiCEIVxpOfPWahVEG2HAG8Q==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.3.tgz", + "integrity": "sha512-Ak6EUJZuhGS8hJ3c2fY6UW5MbkGUPMBEGd13djUzoY/BHqV/gTuFWtC6IuVA7A2+v3yjBS6c4or50xhzTQZImQ==", "dev": true, "dependencies": { - "http-errors": "~1.8.0", + "http-errors": "~1.8.1", "safe-buffer": "5.2.1", "uid-safe": "2.1.5" }, @@ -2718,58 +3277,35 @@ "node": ">= 0.10" } }, + "node_modules/multiparty/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/multiparty/node_modules/http-errors": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz", - "integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", "dev": true, "dependencies": { "depd": "~1.1.2", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" + "toidentifier": "1.0.1" }, "engines": { "node": ">= 0.6" } }, - "node_modules/multiparty/node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/multiparty/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/multiparty/node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "dev": true - }, "node_modules/nanoid": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", - "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", + "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", "dev": true, "bin": { "nanoid": "bin/nanoid.cjs" @@ -2781,7 +3317,7 @@ "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, "node_modules/node-fetch": { @@ -2804,27 +3340,6 @@ } } }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -2837,16 +3352,16 @@ "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/object-inspect": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2862,14 +3377,14 @@ } }, "node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", "object-keys": "^1.1.1" }, "engines": { @@ -2880,29 +3395,28 @@ } }, "node_modules/object.entries": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.2.tgz", - "integrity": "sha512-BQdB9qKmb/HyNdMNWVr7O3+z5MUIx3aiegEIJqjMBbBf0YT9RRxTJSim4mzFqtyr7PDAHigq0N9dO0m0tRakQA==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz", + "integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==", "dev": true, "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "has": "^1.0.3" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" } }, "node_modules/object.fromentries": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.2.tgz", - "integrity": "sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", + "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", "dev": true, "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" @@ -2911,16 +3425,40 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, + "node_modules/object.hasown": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", + "integrity": "sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/object.values": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", - "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", + "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", "dev": true, "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" @@ -2930,9 +3468,9 @@ } }, "node_modules/on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "dev": true, "dependencies": { "ee-first": "1.1.1" @@ -2944,85 +3482,91 @@ "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "dependencies": { "wrappy": "1" } }, "node_modules/opal-compiler": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/opal-compiler/-/opal-compiler-1.0.13.tgz", - "integrity": "sha512-DW5mTf+kLsyWnd/zJs7g7s1Y0RgyWhND2zt5Du7k/mJE6GXQikWM4K6UaWtcpOLFrRlmeUTOIpOt1vIUf6n+kA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/opal-compiler/-/opal-compiler-3.0.0.tgz", + "integrity": "sha512-6P6P9R+GitWPejowOi26dvEGf4iStmbb8GwMsZG0odfP4zExFHwKP6ScOPgY4sSlGievOhhkUQvbvISRDSYyxg==", "dev": true, "dependencies": { - "opal-runtime": "1.0.13" + "opal-runtime": "3.0.0" }, "engines": { - "node": ">=8.11" + "node": ">=16" } }, "node_modules/opal-runtime": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/opal-runtime/-/opal-runtime-1.0.13.tgz", - "integrity": "sha512-CJ6FzzoVyfgTLNzRKQicxAaorEAumqeSCQ0oVhZ9ODk4kZNXIP2URdqBI+DBWtJcStAoHvqKPMD+69VTF5f1kQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/opal-runtime/-/opal-runtime-3.0.0.tgz", + "integrity": "sha512-wOxH2C/u/6OLHAH7saIut4HLNZmKvOsgFWgJqtfArY7JMyeFVjooaVF4smJqAELgBUCqe1k5rKqrPMeQ/pENJw==", "dev": true, "dependencies": { - "glob": "7.1.3", - "unxhr": "1.0.1" + "glob": "8.1.0", + "unxhr": "1.2.0" }, "engines": { - "node": ">=8.11" + "node": ">=16" } }, "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "dev": true, "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "type-check": "^0.4.0" }, "engines": { "node": ">= 0.8.0" } }, "node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "dependencies": { - "p-try": "^1.0.0" + "yocto-queue": "^0.1.0" }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "dependencies": { - "p-limit": "^1.1.0" + "p-limit": "^3.0.2" }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true, "engines": { - "node": ">=4" + "node": ">=6" } }, "node_modules/parent-module": { @@ -3038,15 +3582,16 @@ } }, "node_modules/parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", "dev": true, "dependencies": { - "error-ex": "^1.2.0" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, "node_modules/parseurl": { @@ -3059,18 +3604,18 @@ } }, "node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, "engines": { "node": ">=0.10.0" @@ -3091,18 +3636,6 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, - "node_modules/path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "dependencies": { - "pify": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -3115,7 +3648,7 @@ "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", "dev": true }, "node_modules/picomatch": { @@ -3131,12 +3664,12 @@ } }, "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, "node_modules/pkg-conf": { @@ -3164,22 +3697,6 @@ "node": ">=6" } }, - "node_modules/pkg-conf/node_modules/load-json-file": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", - "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.15", - "parse-json": "^4.0.0", - "pify": "^4.0.1", - "strip-bom": "^3.0.0", - "type-fest": "^0.3.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/pkg-conf/node_modules/locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -3220,77 +3737,97 @@ "node": ">=6" } }, - "node_modules/pkg-conf/node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "node_modules/pkg-conf/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", "dev": true, "engines": { - "node": ">=6" + "node": ">=4" } }, - "node_modules/pkg-conf/node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "find-up": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/pkg-conf/node_modules/pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, "engines": { - "node": ">=6" + "node": ">=8" } }, - "node_modules/pkg-conf/node_modules/type-fest": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, "engines": { "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "dependencies": { - "find-up": "^2.1.0" + "p-limit": "^2.2.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/portfinder": { - "version": "1.0.28", - "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", - "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==", + "version": "1.0.32", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz", + "integrity": "sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==", "dev": true, "dependencies": { - "async": "^2.6.2", - "debug": "^3.1.1", - "mkdirp": "^0.5.5" + "async": "^2.6.4", + "debug": "^3.2.7", + "mkdirp": "^0.5.6" }, "engines": { "node": ">= 0.12.0" } }, "node_modules/portfinder/node_modules/debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, "dependencies": { "ms": "^2.1.1" @@ -3306,9 +3843,9 @@ } }, "node_modules/process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, "node_modules/progress": { @@ -3321,14 +3858,14 @@ } }, "node_modules/prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", "dev": true, "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", - "react-is": "^16.8.1" + "react-is": "^16.13.1" } }, "node_modules/proxy-from-env": { @@ -3338,9 +3875,9 @@ "dev": true }, "node_modules/pump": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", - "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, "dependencies": { "end-of-stream": "^1.1.0", @@ -3348,26 +3885,27 @@ } }, "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/puppeteer": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.5.1.tgz", - "integrity": "sha512-wWxO//vMiqxlvuzHMAJ0pRJeDHvDtM7DQpW1GKdStz2nZo2G42kOXBDgkmQ+zqjwMCFofKGesBeeKxIkX9BO+w==", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.7.0.tgz", + "integrity": "sha512-U1uufzBjz3+PkpCxFrWzh4OrMIdIb2ztzCu0YEPfRHjHswcSwHZswnK+WdsOQJsRV8WeTg3jLhJR4D867+fjsA==", + "deprecated": "< 19.4.0 is no longer supported", "dev": true, "hasInstallScript": true, "dependencies": { "cross-fetch": "3.1.5", - "debug": "4.3.3", - "devtools-protocol": "0.0.969999", + "debug": "4.3.4", + "devtools-protocol": "0.0.981744", "extract-zip": "2.0.1", - "https-proxy-agent": "5.0.0", + "https-proxy-agent": "5.0.1", "pkg-dir": "4.2.0", "progress": "2.0.3", "proxy-from-env": "1.1.0", @@ -3391,108 +3929,10 @@ "readable-stream": "^3.4.0" } }, - "node_modules/puppeteer/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer/node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/puppeteer/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/puppeteer/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer/node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/puppeteer/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer/node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer/node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/puppeteer/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, "dependencies": { "inherits": "^2.0.3", @@ -3503,21 +3943,6 @@ "node": ">= 6" } }, - "node_modules/puppeteer/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/puppeteer/node_modules/tar-fs": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", @@ -3547,18 +3972,44 @@ } }, "node_modules/qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, "engines": { "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/random-bytes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", - "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=", + "integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==", "dev": true, "engines": { "node": ">= 0.8" @@ -3574,13 +4025,13 @@ } }, "node_modules/raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, "dependencies": { - "bytes": "3.1.0", - "http-errors": "1.7.2", + "bytes": "3.1.2", + "http-errors": "2.0.0", "iconv-lite": "0.4.24", "unpipe": "1.0.0" }, @@ -3594,37 +4045,10 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, - "node_modules/read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "dependencies": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "dependencies": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "dependencies": { "core-util-is": "~1.0.0", @@ -3636,6 +4060,18 @@ "util-deprecate": "~1.0.1" } }, + "node_modules/readable-stream/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -3648,14 +4084,35 @@ "node": ">=8.10.0" } }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.4.tgz", + "integrity": "sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "globalthis": "^1.0.3", + "which-builtin-type": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/regexp.prototype.flags": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", - "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", "dev": true, "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" }, "engines": { "node": ">= 0.4" @@ -3665,9 +4122,9 @@ } }, "node_modules/regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true, "engines": { "node": ">=8" @@ -3679,20 +4136,24 @@ "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/resolve": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", - "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "dependencies": { - "is-core-module": "^2.1.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3707,38 +4168,163 @@ "node": ">=4" } }, - "node_modules/rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" } }, "node_modules/rollup": { - "version": "2.56.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.3.tgz", - "integrity": "sha512-Au92NuznFklgQCUcV96iXlxUbHuB1vQMaH76DHl5M11TotjOHwqk9CwcrT78+Tnv4FN9uTBxq6p4EJoYkpyekg==", + "version": "3.21.6", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.6.tgz", + "integrity": "sha512-SXIICxvxQxR3D4dp/3LDHZIJPC8a4anKMHd4E3Jiz2/JnY+2bEjqrOokAauc5ShGVNFHlEFjBXAXlaxkJqIqSg==", "dev": true, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=10.0.0" + "node": ">=14.18.0", + "npm": ">=8.0.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/safer-buffer": { "version": "2.1.2", @@ -3747,15 +4333,12 @@ "dev": true }, "node_modules/semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" } }, "node_modules/serialize-javascript": { @@ -3767,10 +4350,24 @@ "randombytes": "^2.1.0" } }, + "node_modules/set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "dev": true }, "node_modules/shebang-command": { @@ -3795,112 +4392,23 @@ } }, "node_modules/side-channel": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.3.tgz", - "integrity": "sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g==", - "dev": true, - "dependencies": { - "es-abstract": "^1.18.0-next.0", - "object-inspect": "^1.8.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel/node_modules/es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "dev": true, "dependencies": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/slice-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", - "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.0", - "astral-regex": "^1.0.0", - "is-fullwidth-code-point": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", - "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", - "dev": true - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, "node_modules/standard": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/standard/-/standard-16.0.3.tgz", - "integrity": "sha512-70F7NH0hSkNXosXRltjSv6KpTAOkUkSfyu3ynyM5dtRUiLtR+yX9EGZ7RKwuGUqCJiX/cnkceVM6HTZ4JpaqDg==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/standard/-/standard-17.0.0.tgz", + "integrity": "sha512-GlCM9nzbLUkr+TYR5I2WQoIah4wHA2lMauqbyPLV/oI5gJxqhHzhjl9EG2N0lr/nRqI3KCbCvm/W3smxvLaChA==", "dev": true, "funding": [ { @@ -3917,26 +4425,26 @@ } ], "dependencies": { - "eslint": "~7.13.0", - "eslint-config-standard": "16.0.2", - "eslint-config-standard-jsx": "10.0.0", - "eslint-plugin-import": "~2.22.1", - "eslint-plugin-node": "~11.1.0", - "eslint-plugin-promise": "~4.2.1", - "eslint-plugin-react": "~7.21.5", - "standard-engine": "^14.0.1" + "eslint": "^8.13.0", + "eslint-config-standard": "17.0.0", + "eslint-config-standard-jsx": "^11.0.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-n": "^15.1.0", + "eslint-plugin-promise": "^6.0.0", + "eslint-plugin-react": "^7.28.0", + "standard-engine": "^15.0.0" }, "bin": { "standard": "bin/cmd.js" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/standard-engine": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-14.0.1.tgz", - "integrity": "sha512-7FEzDwmHDOGva7r9ifOzD3BGdTbA7ujJ50afLVdW/tK14zQEptJjbFuUfn50irqdHDcTbNh0DTIoMPynMCXb0Q==", + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-15.1.0.tgz", + "integrity": "sha512-VHysfoyxFu/ukT+9v49d4BRXIokFRZuH3z1VRxzFArZdjSCFpro6rEIU3ji7e4AoAtuSfKBkiOmsrDqKW5ZSRw==", "dev": true, "funding": [ { @@ -3954,18 +4462,18 @@ ], "dependencies": { "get-stdin": "^8.0.0", - "minimist": "^1.2.5", + "minimist": "^1.2.6", "pkg-conf": "^3.1.0", "xdg-basedir": "^4.0.0" }, "engines": { - "node": ">=8.10" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", "dev": true, "engines": { "node": ">= 0.6" @@ -3980,54 +4488,55 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/string.prototype.matchall": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz", - "integrity": "sha512-N/jp6O5fMf9os0JU3E72Qhf590RSRZU/ungsL/qJUYVTNv7hTG0P/dbPjxINVN9jpscu3nzYwKESU3P3RY5tOg==", + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0", - "has-symbols": "^1.0.1", - "internal-slot": "^1.0.2", - "regexp.prototype.flags": "^1.3.0", - "side-channel": "^1.0.2" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=8" } }, - "node_modules/string.prototype.trimend": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.2.tgz", - "integrity": "sha512-8oAG/hi14Z4nOVP0z6mdiVZ/wqjDtWSLygMigTzAb+7aPEDTleeFf+WrF+alzecxIRkckkJVn+dTlwzJXORATw==", + "node_modules/string.prototype.matchall": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz", + "integrity": "sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==", "dev": true, "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "regexp.prototype.flags": "^1.5.0", + "set-function-name": "^2.0.0", + "side-channel": "^1.0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/string.prototype.trimend/node_modules/es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "node_modules/string.prototype.trim": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", "dev": true, "dependencies": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" @@ -4036,49 +4545,50 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.2.tgz", - "integrity": "sha512-7F6CdBTl5zyu30BJFdzSTlSlLPwODC23Od+iLoVH8X6+3fvDPPuBVVj9iaB1GOsSTSIgVfsfm27R2FGrAPznWg==", + "node_modules/string.prototype.trimend": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", "dev": true, "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/string.prototype.trimstart/node_modules/es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "node_modules/string.prototype.trimstart": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", "dev": true, "dependencies": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true, "engines": { "node": ">=4" @@ -4097,65 +4607,30 @@ } }, "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "dependencies": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=4" - } - }, - "node_modules/table": { - "version": "5.4.6", - "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", - "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", - "dev": true, - "dependencies": { - "ajv": "^6.10.2", - "lodash": "^4.17.14", - "slice-ansi": "^2.1.0", - "string-width": "^3.0.0" + "node": ">=10" }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/table/node_modules/ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true, - "engines": { - "node": ">=6" + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/table/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, "engines": { - "node": ">=6" - } - }, - "node_modules/table/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "dependencies": { - "ansi-regex": "^4.1.0" + "node": ">= 0.4" }, - "engines": { - "node": ">=6" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/tar-fs": { @@ -4170,12 +4645,22 @@ "tar-stream": "^1.1.2" } }, - "node_modules/tar-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", - "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", - "dev": true, - "dependencies": { + "node_modules/tar-fs/node_modules/pump": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", + "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "dev": true, + "dependencies": { "bl": "^1.0.0", "buffer-alloc": "^1.2.0", "end-of-stream": "^1.0.0", @@ -4191,13 +4676,13 @@ "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, "node_modules/to-buffer": { @@ -4219,9 +4704,9 @@ } }, "node_modules/toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true, "engines": { "node": ">=0.6" @@ -4230,18 +4715,18 @@ "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, "node_modules/tsconfig-paths": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", - "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", "dev": true, "dependencies": { "@types/json5": "^0.0.29", - "json5": "^1.0.1", - "minimist": "^1.2.0", + "json5": "^1.0.2", + "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, @@ -4267,12 +4752,15 @@ } }, "node_modules/type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/type-is": { @@ -4288,6 +4776,71 @@ "node": ">= 0.6" } }, + "node_modules/typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/uid-safe": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", @@ -4300,6 +4853,21 @@ "node": ">= 0.8" } }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", @@ -4311,33 +4879,40 @@ } }, "node_modules/underscore": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", - "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==", + "version": "1.13.6", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", + "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", "dev": true }, + "node_modules/undici-types": { + "version": "5.25.3", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", + "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==", + "dev": true, + "optional": true + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/unxhr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unxhr/-/unxhr-1.0.1.tgz", - "integrity": "sha512-MAhukhVHyaLGDjyDYhy8gVjWJyhTECCdNsLwlMoGFoNJ3o79fpQhtQuzmAE4IxCMDwraF4cW8ZjpAV0m9CRQbg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unxhr/-/unxhr-1.2.0.tgz", + "integrity": "sha512-6cGpm8NFXPD9QbSNx0cD2giy7teZ6xOkCUH3U89WKVkL9N9rBrWjlCwhR94Re18ZlAop4MOc3WU1M3Hv/bgpIw==", "dev": true, "engines": { "node": ">=8.11" } }, "node_modules/uri-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", - "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "dependencies": { "punycode": "^2.1.0" @@ -4346,44 +4921,28 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", "dev": true, "engines": { "node": ">= 0.4.0" } }, - "node_modules/v8-compile-cache": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", - "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", - "dev": true - }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "dev": true }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, "dependencies": { "tr46": "~0.0.3", @@ -4405,97 +4964,111 @@ "node": ">= 8" } }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", "dev": true, - "engines": { - "node": ">=0.10.0" + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/workerpool": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", - "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "node_modules/which-builtin-type": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.1.3.tgz", + "integrity": "sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==", "dev": true, "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "function.prototype.name": "^1.1.5", + "has-tostringtag": "^1.0.0", + "is-async-function": "^2.0.0", + "is-date-object": "^1.0.5", + "is-finalizationregistry": "^1.0.2", + "is-generator-function": "^1.0.10", + "is-regex": "^1.1.4", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/wrap-ansi/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "node_modules/which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", "dev": true, - "engines": { - "node": ">=8" + "dependencies": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/wrap-ansi/node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "node_modules/which-typed-array": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", + "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", "dev": true, "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "node_modules/workerpool": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "dependencies": { - "ansi-regex": "^5.0.0" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, - "node_modules/write": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", - "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", - "dev": true, - "dependencies": { - "mkdirp": "^0.5.1" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/ws": { "version": "8.5.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", @@ -4527,9 +5100,9 @@ } }, "node_modules/xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true, "engines": { "node": ">=0.4" @@ -4544,6 +5117,12 @@ "node": ">=10" } }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -4586,51 +5165,10 @@ "node": ">=10" } }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/yargs/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "dev": true, "dependencies": { "buffer-crc32": "~0.2.3", @@ -4649,3527 +5187,5 @@ "url": "https://github.com/sponsors/sindresorhus" } } - }, - "dependencies": { - "@asciidoctor/core": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/@asciidoctor/core/-/core-2.2.5.tgz", - "integrity": "sha512-jtQPQ5EivgFbwvSyGKas4ANnMGGHPbmu791H9xrZKooA65JNI30jM2em5MvUXTTetSPgb6saUf+PJibEuSB6uw==", - "dev": true, - "requires": { - "asciidoctor-opal-runtime": "0.3.3", - "unxhr": "1.0.1" - } - }, - "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", - "dev": true, - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", - "dev": true - }, - "@babel/highlight": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", - "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - } - } - }, - "@eslint/eslintrc": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.1.tgz", - "integrity": "sha512-XRUeBZ5zBWLYgSANMpThFddrZZkEbGHgUdt5UJjZfnlN9BGCiUBrf+nvbRupSjMvqzwnQN0qwCmOxITt1cfywA==", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "lodash": "^4.17.19", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - } - }, - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", - "dev": true - }, - "@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", - "dev": true - }, - "@types/node": { - "version": "16.4.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.12.tgz", - "integrity": "sha512-zxrTNFl9Z8boMJXs6ieqZP0wAhvkdzmHSxTlJabM16cf5G9xBc1uPRH5Bbv2omEDDiM8MzTfqTJXBf0Ba4xFWA==", - "dev": true, - "optional": true - }, - "@types/yauzl": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", - "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", - "dev": true, - "optional": true, - "requires": { - "@types/node": "*" - } - }, - "@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true - }, - "acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", - "dev": true, - "requires": {} - }, - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "requires": { - "debug": "4" - } - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - }, - "dependencies": { - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } - } - }, - "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "array-includes": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", - "integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0", - "is-string": "^1.0.5" - } - }, - "array.prototype.flat": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", - "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "array.prototype.flatmap": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.2.4.tgz", - "integrity": "sha512-r9Z0zYoxqHz60vvQbWEdXIEtCwHF0yxaWfno9qzXeNHvfyl3BZqygmGzb84dsubyaXLH4husF+NFgMSdpZhk2Q==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1", - "function-bind": "^1.1.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "asciidoctor-opal-runtime": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/asciidoctor-opal-runtime/-/asciidoctor-opal-runtime-0.3.3.tgz", - "integrity": "sha512-/CEVNiOia8E5BMO9FLooo+Kv18K4+4JBFRJp8vUy/N5dMRAg+fRNV4HA+o6aoSC79jVU/aT5XvUpxSxSsTS8FQ==", - "dev": true, - "requires": { - "glob": "7.1.3", - "unxhr": "1.0.1" - } - }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", - "dev": true - }, - "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", - "dev": true, - "requires": { - "lodash": "^4.17.11" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true - }, - "bestikk-download": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/bestikk-download/-/bestikk-download-1.0.0.tgz", - "integrity": "sha512-6DlRph7kpd7YKjV8fhTbCvZE0DqT6KdMFy+R0mUDcBpuSlBtkX7hsimyqnpgV9CykdY903RbJv9+lrInUEKdWA==", - "dev": true, - "requires": { - "bestikk-log": "0.1.0" - } - }, - "bestikk-fs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/bestikk-fs/-/bestikk-fs-1.0.0.tgz", - "integrity": "sha512-wQo8OWSRFDSEVjBXjGnz0Z95rUAooamaIl/dZZKexKbmTv6+B/dPiJk0900bG/2sWTvRlrAlkilG2FvSZCG+bQ==", - "dev": true, - "requires": { - "async": "^2.0.1", - "bestikk-log": "^0.1.0", - "tar-fs": "^1.13.2" - } - }, - "bestikk-log": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bestikk-log/-/bestikk-log-0.1.0.tgz", - "integrity": "sha1-asbdy07E776U7gguKJ5Mv2rVTyA=", - "dev": true, - "requires": { - "colors": "1.1.2" - } - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "bl": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", - "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", - "dev": true, - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "dev": true, - "requires": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "dev": true, - "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", - "dev": true - }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", - "dev": true - }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", - "dev": true - }, - "call-bind": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", - "integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.0" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", - "dev": true - }, - "chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", - "dev": true - }, - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - }, - "dependencies": { - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "connect": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", - "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", - "dev": true, - "requires": { - "debug": "2.6.9", - "finalhandler": "1.1.2", - "parseurl": "~1.3.3", - "utils-merge": "1.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "contains-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", - "dev": true - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "dev": true, - "requires": { - "node-fetch": "2.6.7" - } - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true - }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true - }, - "devtools-protocol": { - "version": "0.0.969999", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.969999.tgz", - "integrity": "sha512-6GfzuDWU0OFAuOvBokXpXPLxjOJ5DZ157Ue3sGQQM3LgAamb8m0R0ruSfN0DDu+XG5XJgT50i6zZ/0o8RglreQ==", - "dev": true - }, - "diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true - }, - "dirty-chai": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/dirty-chai/-/dirty-chai-2.0.1.tgz", - "integrity": "sha512-ys79pWKvDMowIDEPC6Fig8d5THiC0DJ2gmTeGzVAoEH18J8OzLud0Jh7I9IWg3NSk8x2UocznUuFmfHCXYZx9w==", - "dev": true, - "requires": {} - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", - "dev": true - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "eslint": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.13.0.tgz", - "integrity": "sha512-uCORMuOO8tUzJmsdRtrvcGq5qposf7Rw0LwkTJkoDbOycVQtQjmnhZSuLQnozLE4TmAzlMVV45eCHmQ1OpDKUQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.2.1", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.0", - "esquery": "^1.2.0", - "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash": "^4.17.19", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "eslint-config-standard": { - "version": "16.0.2", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.2.tgz", - "integrity": "sha512-fx3f1rJDsl9bY7qzyX8SAtP8GBSk6MfXFaTfaGgk12aAYW4gJSyRm7dM790L6cbXv63fvjY4XeSzXnb4WM+SKw==", - "dev": true, - "requires": {} - }, - "eslint-config-standard-jsx": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-10.0.0.tgz", - "integrity": "sha512-hLeA2f5e06W1xyr/93/QJulN/rLbUVUmqTlexv9PRKHFwEC9ffJcH2LvJhMoEqYQBEYafedgGZXH2W8NUpt5lA==", - "dev": true, - "requires": {} - }, - "eslint-import-resolver-node": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", - "integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==", - "dev": true, - "requires": { - "debug": "^2.6.9", - "resolve": "^1.13.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-module-utils": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", - "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", - "dev": true, - "requires": { - "debug": "^2.6.9", - "pkg-dir": "^2.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-plugin-es": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", - "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", - "dev": true, - "requires": { - "eslint-utils": "^2.0.0", - "regexpp": "^3.0.0" - } - }, - "eslint-plugin-import": { - "version": "2.22.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", - "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", - "dev": true, - "requires": { - "array-includes": "^3.1.1", - "array.prototype.flat": "^1.2.3", - "contains-path": "^0.1.0", - "debug": "^2.6.9", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.4", - "eslint-module-utils": "^2.6.0", - "has": "^1.0.3", - "minimatch": "^3.0.4", - "object.values": "^1.1.1", - "read-pkg-up": "^2.0.0", - "resolve": "^1.17.0", - "tsconfig-paths": "^3.9.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-plugin-node": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", - "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", - "dev": true, - "requires": { - "eslint-plugin-es": "^3.0.0", - "eslint-utils": "^2.0.0", - "ignore": "^5.1.1", - "minimatch": "^3.0.4", - "resolve": "^1.10.1", - "semver": "^6.1.0" - }, - "dependencies": { - "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "eslint-plugin-promise": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz", - "integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==", - "dev": true - }, - "eslint-plugin-react": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.21.5.tgz", - "integrity": "sha512-8MaEggC2et0wSF6bUeywF7qQ46ER81irOdWS4QWxnnlAEsnzeBevk1sWh7fhpCghPpXb+8Ks7hvaft6L/xsR6g==", - "dev": true, - "requires": { - "array-includes": "^3.1.1", - "array.prototype.flatmap": "^1.2.3", - "doctrine": "^2.1.0", - "has": "^1.0.3", - "jsx-ast-utils": "^2.4.1 || ^3.0.0", - "object.entries": "^1.1.2", - "object.fromentries": "^2.0.2", - "object.values": "^1.1.1", - "prop-types": "^15.7.2", - "resolve": "^1.18.1", - "string.prototype.matchall": "^4.0.2" - }, - "dependencies": { - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - } - } - }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, - "eslint-visitor-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", - "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", - "dev": true - }, - "espree": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.0.tgz", - "integrity": "sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw==", - "dev": true, - "requires": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.3.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "dev": true, - "requires": { - "@types/yauzl": "^2.9.1", - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, - "requires": { - "pend": "~1.2.0" - } - }, - "file-entry-cache": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", - "dev": true, - "requires": { - "flat-cache": "^2.0.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "dev": true, - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true - }, - "flat-cache": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", - "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", - "dev": true, - "requires": { - "flatted": "^2.0.0", - "rimraf": "2.6.3", - "write": "1.0.3" - } - }, - "flatted": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", - "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", - "dev": true - }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, - "get-intrinsic": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", - "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, - "get-stdin": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", - "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", - "dev": true - }, - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - }, - "dependencies": { - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - } - } - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "dev": true, - "requires": { - "type-fest": "^0.8.1" - } - }, - "graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", - "dev": true - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, - "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, - "requires": { - "agent-base": "6", - "debug": "4" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, - "import-fresh": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz", - "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "internal-slot": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.2.tgz", - "integrity": "sha512-2cQNfwhAfJIkU4KZPkDI+Gj5yNNnbqi40W9Gge6dfnk4TocEVm00B3bdiL+JINrbGJil2TeHvM4rETGzk/f/0g==", - "dev": true, - "requires": { - "es-abstract": "^1.17.0-next.1", - "has": "^1.0.3", - "side-channel": "^1.0.2" - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-callable": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", - "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", - "dev": true - }, - "is-core-module": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.1.0.tgz", - "integrity": "sha512-YcV7BgVMRFRua2FqQzKtTDMz8iCuLEyGKjr70q8Zm1yy2qKcurbFEd79PAdHV77oL3NrAaOVQIbMmiHQCHB7ZA==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-negative-zero": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", - "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", - "dev": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true - }, - "is-regex": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", - "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", - "dev": true - }, - "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - }, - "jsx-ast-utils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.1.0.tgz", - "integrity": "sha512-d4/UOjg+mxAWxCiF0c5UTSwyqbchkbqCvK87aBovhnh8GtysTjWmgC63tY0cJx/HzGgm9qnA147jVBdpOiQ2RA==", - "dev": true, - "requires": { - "array-includes": "^3.1.1", - "object.assign": "^4.1.1" - } - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - } - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", - "dev": true - }, - "mime-db": { - "version": "1.48.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz", - "integrity": "sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==", - "dev": true - }, - "mime-types": { - "version": "2.1.31", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.31.tgz", - "integrity": "sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==", - "dev": true, - "requires": { - "mime-db": "1.48.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "dev": true - }, - "mocha": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", - "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", - "dev": true, - "requires": { - "@ungap/promise-all-settled": "1.1.2", - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.3", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "4.2.1", - "ms": "2.1.3", - "nanoid": "3.3.1", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "which": "2.0.2", - "workerpool": "6.2.0", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "dependencies": { - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - } - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "minimatch": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", - "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "mock-http-server": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/mock-http-server/-/mock-http-server-1.4.4.tgz", - "integrity": "sha512-QVkc/cI19VDsuDoCINgFnNl5TRiAVI4c7ReCoCbqWE5Je7RrkZIqMjWAIoTExQMCMZAiaUIJpX/0ae+yOVUuxg==", - "dev": true, - "requires": { - "body-parser": "^1.18.1", - "connect": "^3.4.0", - "multiparty": "^4.1.2", - "underscore": "^1.8.3" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "multiparty": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz", - "integrity": "sha512-NtZLjlvsjcoGrzojtwQwn/Tm90aWJ6XXtPppYF4WmOk/6ncdwMMKggFY2NlRRN9yiCEIVxpOfPWahVEG2HAG8Q==", - "dev": true, - "requires": { - "http-errors": "~1.8.0", - "safe-buffer": "5.2.1", - "uid-safe": "2.1.5" - }, - "dependencies": { - "http-errors": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz", - "integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, - "setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "dev": true - } - } - }, - "nanoid": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", - "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", - "dev": true - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "requires": { - "whatwg-url": "^5.0.0" - } - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-inspect": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, - "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, - "object.entries": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.2.tgz", - "integrity": "sha512-BQdB9qKmb/HyNdMNWVr7O3+z5MUIx3aiegEIJqjMBbBf0YT9RRxTJSim4mzFqtyr7PDAHigq0N9dO0m0tRakQA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "has": "^1.0.3" - } - }, - "object.fromentries": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.2.tgz", - "integrity": "sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" - } - }, - "object.values": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", - "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" - } - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dev": true, - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "opal-compiler": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/opal-compiler/-/opal-compiler-1.0.13.tgz", - "integrity": "sha512-DW5mTf+kLsyWnd/zJs7g7s1Y0RgyWhND2zt5Du7k/mJE6GXQikWM4K6UaWtcpOLFrRlmeUTOIpOt1vIUf6n+kA==", - "dev": true, - "requires": { - "opal-runtime": "1.0.13" - } - }, - "opal-runtime": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/opal-runtime/-/opal-runtime-1.0.13.tgz", - "integrity": "sha512-CJ6FzzoVyfgTLNzRKQicxAaorEAumqeSCQ0oVhZ9ODk4kZNXIP2URdqBI+DBWtJcStAoHvqKPMD+69VTF5f1kQ==", - "dev": true, - "requires": { - "glob": "7.1.3", - "unxhr": "1.0.1" - } - }, - "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "^2.0.0" - } - }, - "pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true - }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pkg-conf": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-3.1.0.tgz", - "integrity": "sha512-m0OTbR/5VPNPqO1ph6Fqbj7Hv6QU7gR/tQW40ZqrL1rjgCU85W6C1bJn0BItuJqnR98PWzw7Z8hHeChD1WrgdQ==", - "dev": true, - "requires": { - "find-up": "^3.0.0", - "load-json-file": "^5.2.0" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "load-json-file": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", - "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.15", - "parse-json": "^4.0.0", - "pify": "^4.0.1", - "strip-bom": "^3.0.0", - "type-fest": "^0.3.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - }, - "type-fest": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", - "dev": true - } - } - }, - "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "requires": { - "find-up": "^2.1.0" - } - }, - "portfinder": { - "version": "1.0.28", - "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", - "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==", - "dev": true, - "requires": { - "async": "^2.6.2", - "debug": "^3.1.1", - "mkdirp": "^0.5.5" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "dev": true, - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } - }, - "proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true - }, - "pump": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", - "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "puppeteer": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.5.1.tgz", - "integrity": "sha512-wWxO//vMiqxlvuzHMAJ0pRJeDHvDtM7DQpW1GKdStz2nZo2G42kOXBDgkmQ+zqjwMCFofKGesBeeKxIkX9BO+w==", - "dev": true, - "requires": { - "cross-fetch": "3.1.5", - "debug": "4.3.3", - "devtools-protocol": "0.0.969999", - "extract-zip": "2.0.1", - "https-proxy-agent": "5.0.0", - "pkg-dir": "4.2.0", - "progress": "2.0.3", - "proxy-from-env": "1.1.0", - "rimraf": "3.0.2", - "tar-fs": "2.1.1", - "unbzip2-stream": "1.4.3", - "ws": "8.5.0" - }, - "dependencies": { - "bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", - "dev": true, - "requires": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dev": true, - "requires": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - } - } - } - }, - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", - "dev": true - }, - "random-bytes": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", - "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "dev": true, - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "regexp.prototype.flags": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", - "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - } - }, - "regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "resolve": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", - "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", - "dev": true, - "requires": { - "is-core-module": "^2.1.0", - "path-parse": "^1.0.6" - } - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "rollup": { - "version": "2.56.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.3.tgz", - "integrity": "sha512-Au92NuznFklgQCUcV96iXlxUbHuB1vQMaH76DHl5M11TotjOHwqk9CwcrT78+Tnv4FN9uTBxq6p4EJoYkpyekg==", - "dev": true, - "requires": { - "fsevents": "~2.3.2" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true - }, - "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "side-channel": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.3.tgz", - "integrity": "sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g==", - "dev": true, - "requires": { - "es-abstract": "^1.18.0-next.0", - "object-inspect": "^1.8.0" - }, - "dependencies": { - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "slice-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", - "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "astral-regex": "^1.0.0", - "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - } - } - }, - "spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", - "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "standard": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/standard/-/standard-16.0.3.tgz", - "integrity": "sha512-70F7NH0hSkNXosXRltjSv6KpTAOkUkSfyu3ynyM5dtRUiLtR+yX9EGZ7RKwuGUqCJiX/cnkceVM6HTZ4JpaqDg==", - "dev": true, - "requires": { - "eslint": "~7.13.0", - "eslint-config-standard": "16.0.2", - "eslint-config-standard-jsx": "10.0.0", - "eslint-plugin-import": "~2.22.1", - "eslint-plugin-node": "~11.1.0", - "eslint-plugin-promise": "~4.2.1", - "eslint-plugin-react": "~7.21.5", - "standard-engine": "^14.0.1" - } - }, - "standard-engine": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-14.0.1.tgz", - "integrity": "sha512-7FEzDwmHDOGva7r9ifOzD3BGdTbA7ujJ50afLVdW/tK14zQEptJjbFuUfn50irqdHDcTbNh0DTIoMPynMCXb0Q==", - "dev": true, - "requires": { - "get-stdin": "^8.0.0", - "minimist": "^1.2.5", - "pkg-conf": "^3.1.0", - "xdg-basedir": "^4.0.0" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "string.prototype.matchall": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz", - "integrity": "sha512-N/jp6O5fMf9os0JU3E72Qhf590RSRZU/ungsL/qJUYVTNv7hTG0P/dbPjxINVN9jpscu3nzYwKESU3P3RY5tOg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0", - "has-symbols": "^1.0.1", - "internal-slot": "^1.0.2", - "regexp.prototype.flags": "^1.3.0", - "side-channel": "^1.0.2" - } - }, - "string.prototype.trimend": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.2.tgz", - "integrity": "sha512-8oAG/hi14Z4nOVP0z6mdiVZ/wqjDtWSLygMigTzAb+7aPEDTleeFf+WrF+alzecxIRkckkJVn+dTlwzJXORATw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "string.prototype.trimstart": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.2.tgz", - "integrity": "sha512-7F6CdBTl5zyu30BJFdzSTlSlLPwODC23Od+iLoVH8X6+3fvDPPuBVVj9iaB1GOsSTSIgVfsfm27R2FGrAPznWg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "table": { - "version": "5.4.6", - "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", - "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", - "dev": true, - "requires": { - "ajv": "^6.10.2", - "lodash": "^4.17.14", - "slice-ansi": "^2.1.0", - "string-width": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "tar-fs": { - "version": "1.16.3", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz", - "integrity": "sha512-NvCeXpYx7OsmOh8zIOP/ebG55zZmxLE0etfWRbWok+q2Qo8x/vOR/IJT1taADXPe+jsiu9axDb3X4B+iIgNlKw==", - "dev": true, - "requires": { - "chownr": "^1.0.1", - "mkdirp": "^0.5.1", - "pump": "^1.0.0", - "tar-stream": "^1.1.2" - } - }, - "tar-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", - "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", - "dev": true, - "requires": { - "bl": "^1.0.0", - "buffer-alloc": "^1.2.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.1", - "xtend": "^4.0.0" - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "to-buffer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", - "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", - "dev": true - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "dev": true - }, - "tsconfig-paths": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", - "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", - "dev": true, - "requires": { - "@types/json5": "^0.0.29", - "json5": "^1.0.1", - "minimist": "^1.2.0", - "strip-bom": "^3.0.0" - } - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dev": true, - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "uid-safe": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", - "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", - "dev": true, - "requires": { - "random-bytes": "~1.0.0" - } - }, - "unbzip2-stream": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", - "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", - "dev": true, - "requires": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } - }, - "underscore": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", - "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==", - "dev": true - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "dev": true - }, - "unxhr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unxhr/-/unxhr-1.0.1.tgz", - "integrity": "sha512-MAhukhVHyaLGDjyDYhy8gVjWJyhTECCdNsLwlMoGFoNJ3o79fpQhtQuzmAE4IxCMDwraF4cW8ZjpAV0m9CRQbg==", - "dev": true - }, - "uri-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", - "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", - "dev": true - }, - "v8-compile-cache": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", - "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", - "dev": true - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "dev": true, - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true - }, - "workerpool": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", - "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", - "dev": true - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "write": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", - "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", - "dev": true, - "requires": { - "mkdirp": "^0.5.1" - } - }, - "ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", - "dev": true, - "requires": {} - }, - "xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "dependencies": { - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true - }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - } - }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - } } } diff --git a/package.json b/package.json index 864fe5b..6df7da3 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@asciidoctor/docbook-converter", "version": "3.0.0-alpha.1", "description": "DocBook converter for Asciidoctor.js", + "type": "module", "main": "dist/index.cjs", "browser": "dist/index.umd.js", "module": "dist/index.esm.js", @@ -14,8 +15,8 @@ "build": "node tasks/build.js && rollup -c", "test": "npm run test:node && npm run test:browser", "test:node": "mocha", - "test:browser": "node test/browser/run.js index.esm.html && node test/browser/run.js index.umd.html", - "lint": "standard test/**.js tasks/**.js" + "test:browser": "node test/browser/run.cjs index.esm.html && npx rollup -c test/browser/rollup.config.js && node test/browser/run.cjs index.umd.html", + "lint": "standard test/**.cjs tasks/**.js" }, "repository": { "type": "git", @@ -42,22 +43,22 @@ }, "homepage": "https://github.com/asciidoctor/asciidoctor-docbook.js", "devDependencies": { - "@asciidoctor/core": "^2.0.0-rc.1", + "@asciidoctor/core": "~3.0", "bestikk-download": "1.0.0", "bestikk-fs": "1.0.0", "bestikk-log": "0.1.0", - "chai": "^4.2.0", - "dirty-chai": "^2.0.1", - "mocha": "9.2.2", - "mock-http-server": "^1.4.2", - "opal-compiler": "^1.0.13", - "portfinder": "^1.0.26", + "chai": "~4.3", + "dirty-chai": "2.0.1", + "mocha": "~10.2", + "mock-http-server": "1.4.5", + "opal-compiler": "3.0.0", + "portfinder": "1.0.32", "puppeteer": "^13.0.0", - "rollup": "^2.18.0", - "standard": "^16.0.3" + "rollup": "3.21.6", + "standard": "~17.0" }, "peerDependencies": { - "@asciidoctor/core": "^2.0.0-rc.1" + "@asciidoctor/core": ">= 3.0 < 4.0" }, "standard": { "env": { diff --git a/tasks/build.js b/tasks/build.js index 4f2dc19..481c588 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -1,4 +1,4 @@ -const Builder = require('./builder.js') +import Builder from './builder.js' const builder = new Builder() ;(async () => { diff --git a/tasks/builder.js b/tasks/builder.js index 5407e72..8323e16 100644 --- a/tasks/builder.js +++ b/tasks/builder.js @@ -1,9 +1,10 @@ 'use strict' -const fs = require('fs') -const log = require('bestikk-log') -const bfs = require('bestikk-fs') -const Download = require('bestikk-download') -const OpalBuilder = require('opal-compiler').Builder + +import fs from 'node:fs' +import log from 'bestikk-log' +import bfs from 'bestikk-fs' +import Download from 'bestikk-download' +import { Builder as OpalBuilder } from 'opal-compiler' const concat = (message, files, destination) => { log.debug(message) @@ -11,7 +12,7 @@ const concat = (message, files, destination) => { } const templateFile = function (templateFile, context, outputFile) { - const template = fs.readFileSync(templateFile, 'utf8') + const template = fs.readFileSync(templateFile, { encoding: 'utf8' }) const lines = template.split('\n') lines.forEach(function (line, index, result) { if (line in context) { @@ -62,9 +63,9 @@ const compile = () => { fs.writeFileSync(`build/asciidoctor-${module}.js`, opalBuilder.build(`asciidoctor/converter/${module}`).toString(), 'utf8') } -class Builder { +export default class Builder { constructor () { - this.asciidoctorCoreVersion = '2.0.10' + this.asciidoctorCoreVersion = '2.0.20' this.download = new Download({}) } @@ -99,5 +100,3 @@ class Builder { await bfs.untar('build/asciidoctor.tar.gz', 'asciidoctor', 'build') } } - -module.exports = Builder diff --git a/test/browser/bin/mock-server.js b/test/browser/bin/mock-server.cjs similarity index 100% rename from test/browser/bin/mock-server.js rename to test/browser/bin/mock-server.cjs diff --git a/test/browser/index.esm.html b/test/browser/index.esm.html index 6872ea1..21adf27 100644 --- a/test/browser/index.esm.html +++ b/test/browser/index.esm.html @@ -10,8 +10,7 @@ - - + diff --git a/test/browser/index.umd.html b/test/browser/index.umd.html index 1547b62..2058fc6 100644 --- a/test/browser/index.umd.html +++ b/test/browser/index.umd.html @@ -10,9 +10,8 @@ - - + diff --git a/test/browser/mock-server.js b/test/browser/mock-server.cjs similarity index 92% rename from test/browser/mock-server.js rename to test/browser/mock-server.cjs index 1102637..0c1feb8 100644 --- a/test/browser/mock-server.js +++ b/test/browser/mock-server.cjs @@ -1,12 +1,12 @@ 'use strict' -const fs = require('fs') -const childProcess = require('child_process') +const fs = require('node:fs') +const childProcess = require('node:child_process') class MockServer { constructor (listener) { // we need to use "fork" to spawn a new Node.js process otherwise we will create a deadlock. - this.childProcess = childProcess.fork(`${__dirname}/bin/mock-server.js`) + this.childProcess = childProcess.fork(`${__dirname}/bin/mock-server.cjs`) if (listener) { this.childProcess.on('message', listener) } diff --git a/test/browser/rollup.config.js b/test/browser/rollup.config.js new file mode 100644 index 0000000..0eacb66 --- /dev/null +++ b/test/browser/rollup.config.js @@ -0,0 +1,13 @@ +import * as url from 'node:url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + +export default [ + { + input: `${__dirname}/spec.esm.js`, + output: { + file: `${__dirname}/spec.umd.js`, + name: 'AsciidoctorDocBookSpec', + format: 'umd' + } + }, +] diff --git a/test/browser/run.js b/test/browser/run.cjs similarity index 96% rename from test/browser/run.js rename to test/browser/run.cjs index 36efb98..46a3cb3 100644 --- a/test/browser/run.js +++ b/test/browser/run.cjs @@ -1,7 +1,7 @@ /* eslint-env node, es6 */ const puppeteer = require('puppeteer') -const MockServer = require('./mock-server.js') -const util = require('./util.js') +const MockServer = require('./mock-server.cjs') +const util = require('./util.cjs') // puppeteer options const opts = { diff --git a/test/browser/spec.esm.js b/test/browser/spec.esm.js index 8af5359..bd933fe 100644 --- a/test/browser/spec.esm.js +++ b/test/browser/spec.esm.js @@ -1,4 +1,6 @@ /* global AsciidoctorBrowserSpec, mocha, mochaOpts, testOpts */ + +import Asciidoctor from '../../node_modules/@asciidoctor/core/dist/browser/asciidoctor.js' import AsciidoctorDocBook from '../../dist/index.esm.js' (async () => { @@ -15,7 +17,7 @@ import AsciidoctorDocBook from '../../dist/index.esm.js' reporter: reporter }) - const asciidoctor = globalThis.Asciidoctor() + const asciidoctor = Asciidoctor() AsciidoctorDocBook.register() const expect = chai.expect diff --git a/test/browser/spec.umd.js b/test/browser/spec.umd.js index 25cabc6..92ff348 100644 --- a/test/browser/spec.umd.js +++ b/test/browser/spec.umd.js @@ -1,31 +1,45705 @@ -/* global chai, mocha, mochaOpts, testOpts */ - -// bootstrap -;(async () => { - let reporter - if (typeof mochaOpts === 'function') { - const opts = await mochaOpts() - reporter = opts.reporter - } else { - reporter = 'html' - } - mocha.setup({ - ui: 'bdd', - checkLeaks: false, - reporter: reporter - }) - - const asciidoctor = globalThis.Asciidoctor() - globalThis.AsciidoctorDocBook.register() - - const expect = chai.expect - await globalThis.AsciidoctorConvertSpec(asciidoctor, expect) - - mocha.run(function (failures) { - if (failures > 0) { - console.error('%d failures', failures) - } - }) -})().catch(err => { - console.error('Unable to start the browser tests suite: ' + err) -}) +(function (factory) { + typeof define === 'function' && define.amd ? define(factory) : + factory(); +})((function () { 'use strict'; + + /** + * @license Asciidoctor.js 3.0.2 | MIT | https://github.com/asciidoctor/asciidoctor.js + */ + (function(global_object) { + + // @note + // A few conventions for the documentation of this file: + // 1. Always use "//" (in contrast with "/**/") + // 2. The syntax used is Yardoc (yardoc.org), which is intended for Ruby (se below) + // 3. `@param` and `@return` types should be preceded by `JS.` when referring to + // JavaScript constructors (e.g. `JS.Function`) otherwise Ruby is assumed. + // 4. `nil` and `null` being unambiguous refer to the respective + // objects/values in Ruby and JavaScript + // 5. This is still WIP :) so please give feedback and suggestions on how + // to improve or for alternative solutions + // + // The way the code is digested before going through Yardoc is a secret kept + // in the docs repo (https://github.com/opal/docs/tree/master). + + var console; + + // Detect the global object + if (typeof(globalThis) !== 'undefined') { global_object = globalThis; } + else if (typeof(global) !== 'undefined') { global_object = global; } + else if (typeof(window) !== 'undefined') { global_object = window; } + + // Setup a dummy console object if missing + if (global_object.console == null) { + global_object.console = {}; + } + + if (typeof(global_object.console) === 'object') { + console = global_object.console; + } else { + console = {}; + } + + if (!('log' in console)) { console.log = function () {}; } + if (!('warn' in console)) { console.warn = console.log; } + + if (typeof(global_object.Opal) !== 'undefined') { + console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.'); + return global_object.Opal; + } + + var nil; + + // The actual class for BasicObject + var BasicObject; + + // The actual Object class. + // The leading underscore is to avoid confusion with window.Object() + var _Object; + + // The actual Module class + var Module; + + // The actual Class class + var Class; + + // The Opal.Opal class (helpers etc.) + var _Opal; + + // The Kernel module + var Kernel; + + // The Opal object that is exposed globally + var Opal = global_object.Opal = {}; + + // This is a useful reference to global object inside ruby files + Opal.global = global_object; + + // Configure runtime behavior with regards to require and unsupported features + Opal.config = { + missing_require_severity: 'error', // error, warning, ignore + unsupported_features_severity: 'warning', // error, warning, ignore + experimental_features_severity: 'warning',// warning, ignore + enable_stack_trace: true // true, false + }; + + // Minify common function calls + var $call = Function.prototype.call; + var $bind = Function.prototype.bind; + var $has_own = Object.hasOwn || $call.bind(Object.prototype.hasOwnProperty); + var $set_proto = Object.setPrototypeOf; + var $slice = $call.bind(Array.prototype.slice); + var $splice = $call.bind(Array.prototype.splice); + + // Nil object id is always 4 + var nil_id = 4; + + // Generates even sequential numbers greater than 4 + // (nil_id) to serve as unique ids for ruby objects + var unique_id = nil_id; + + // Return next unique id + function $uid() { + unique_id += 2; + return unique_id; + } Opal.uid = $uid; + + // Retrieve or assign the id of an object + Opal.id = function(obj) { + if (obj.$$is_number) return (obj * 2)+1; + if (obj.$$id == null) { + $prop(obj, '$$id', $uid()); + } + return obj.$$id; + }; + + // Globals table + var $gvars = Opal.gvars = {}; + + // Exit function, this should be replaced by platform specific implementation + // (See nodejs and chrome for examples) + Opal.exit = function(status) { if ($gvars.DEBUG) console.log('Exited with status '+status); }; + + // keeps track of exceptions for $! + Opal.exceptions = []; + + // @private + // Pops an exception from the stack and updates `$!`. + Opal.pop_exception = function() { + var exception = Opal.exceptions.pop(); + if (exception) { + $gvars["!"] = exception; + $gvars["@"] = exception.$backtrace(); + } + else { + $gvars["!"] = $gvars["@"] = nil; + } + }; + + // A helper function for raising things, that gracefully degrades if necessary + // functionality is not yet loaded. + function $raise(klass, message) { + // Raise Exception, so we can know that something wrong is going on. + if (!klass) klass = Opal.Exception || Error; + + if (Kernel && Kernel.$raise) { + if (arguments.length > 2) { + Kernel.$raise(klass.$new.apply(klass, $slice(arguments, 1))); + } + else { + Kernel.$raise(klass, message); + } + } + else if (!klass.$new) { + throw new klass(message); + } + else { + throw klass.$new(message); + } + } + + function $prop(object, name, initialValue) { + if (typeof(object) === "string") { + // Special case for: + // s = "string" + // def s.m; end + // String class is the only class that: + // + compiles to JS primitive + // + allows method definition directly on instances + // numbers, true, false and null do not support it. + object[name] = initialValue; + } else { + Object.defineProperty(object, name, { + value: initialValue, + enumerable: false, + configurable: true, + writable: true + }); + } + } + + Opal.prop = $prop; + + // @deprecated + Opal.defineProperty = Opal.prop; + + Opal.slice = $slice; + + // Helpers + // ----- + + var $truthy = Opal.truthy = function(val) { + return false !== val && nil !== val && undefined !== val && null !== val && (!(val instanceof Boolean) || true === val.valueOf()); + }; + + Opal.falsy = function(val) { + return !$truthy(val); + }; + + Opal.type_error = function(object, type, method, coerced) { + object = object.$$class; + + if (coerced && method) { + coerced = coerced.$$class; + $raise(Opal.TypeError, + "can't convert " + object + " into " + type + + " (" + object + "#" + method + " gives " + coerced + ")" + ); + } else { + $raise(Opal.TypeError, + "no implicit conversion of " + object + " into " + type + ); + } + }; + + Opal.coerce_to = function(object, type, method, args) { + var body; + + if (method === 'to_int' && type === Opal.Integer && object.$$is_number) + return object < 0 ? Math.ceil(object) : Math.floor(object); + + if (method === 'to_str' && type === Opal.String && object.$$is_string) + return object; + + if (Opal.is_a(object, type)) return object; + + // Fast path for the most common situation + if (object['$respond_to?'].$$pristine && object.$method_missing.$$pristine) { + body = object[$jsid(method)]; + if (body == null || body.$$stub) Opal.type_error(object, type); + return body.apply(object, args); + } + + if (!object['$respond_to?'](method)) { + Opal.type_error(object, type); + } + + if (args == null) args = []; + return Opal.send(object, method, args); + }; + + Opal.respond_to = function(obj, jsid, include_all) { + if (obj == null || !obj.$$class) return false; + include_all = !!include_all; + var body = obj[jsid]; + + if (obj['$respond_to?'].$$pristine) { + if (typeof(body) === "function" && !body.$$stub) { + return true; + } + if (!obj['$respond_to_missing?'].$$pristine) { + return Opal.send(obj, obj['$respond_to_missing?'], [jsid.substr(1), include_all]); + } + } else { + return Opal.send(obj, obj['$respond_to?'], [jsid.substr(1), include_all]); + } + }; + + // TracePoint support + // ------------------ + // + // Support for `TracePoint.trace(:class) do ... end` + Opal.trace_class = false; + Opal.tracers_for_class = []; + + function invoke_tracers_for_class(klass_or_module) { + var i, ii, tracer; + + for(i = 0, ii = Opal.tracers_for_class.length; i < ii; i++) { + tracer = Opal.tracers_for_class[i]; + tracer.trace_object = klass_or_module; + tracer.block.$call(tracer); + } + } + + function handle_autoload(cref, name) { + if (!cref.$$autoload[name].loaded) { + cref.$$autoload[name].loaded = true; + try { + Opal.Kernel.$require(cref.$$autoload[name].path); + } catch (e) { + cref.$$autoload[name].exception = e; + throw e; + } + cref.$$autoload[name].required = true; + if (cref.$$const[name] != null) { + cref.$$autoload[name].success = true; + return cref.$$const[name]; + } + } else if (cref.$$autoload[name].loaded && !cref.$$autoload[name].required) { + if (cref.$$autoload[name].exception) { throw cref.$$autoload[name].exception; } + } + } + + // Constants + // --------- + // + // For future reference: + // - The Rails autoloading guide (http://guides.rubyonrails.org/v5.0/autoloading_and_reloading_constants.html) + // - @ConradIrwin's 2012 post on “Everything you ever wanted to know about constant lookup in Ruby” (http://cirw.in/blog/constant-lookup.html) + // + // Legend of MRI concepts/names: + // - constant reference (cref): the module/class that acts as a namespace + // - nesting: the namespaces wrapping the current scope, e.g. nesting inside + // `module A; module B::C; end; end` is `[B::C, A]` + + // Get the constant in the scope of the current cref + function const_get_name(cref, name) { + if (cref) { + if (cref.$$const[name] != null) { return cref.$$const[name]; } + if (cref.$$autoload && cref.$$autoload[name]) { + return handle_autoload(cref, name); + } + } + } + + // Walk up the nesting array looking for the constant + function const_lookup_nesting(nesting, name) { + var i, ii, constant; + + if (nesting.length === 0) return; + + // If the nesting is not empty the constant is looked up in its elements + // and in order. The ancestors of those elements are ignored. + for (i = 0, ii = nesting.length; i < ii; i++) { + constant = nesting[i].$$const[name]; + if (constant != null) { + return constant; + } else if (nesting[i].$$autoload && nesting[i].$$autoload[name]) { + return handle_autoload(nesting[i], name); + } + } + } + + // Walk up the ancestors chain looking for the constant + function const_lookup_ancestors(cref, name) { + var i, ii, ancestors; + + if (cref == null) return; + + ancestors = $ancestors(cref); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + if (ancestors[i].$$const && $has_own(ancestors[i].$$const, name)) { + return ancestors[i].$$const[name]; + } else if (ancestors[i].$$autoload && ancestors[i].$$autoload[name]) { + return handle_autoload(ancestors[i], name); + } + } + } + + // Walk up Object's ancestors chain looking for the constant, + // but only if cref is missing or a module. + function const_lookup_Object(cref, name) { + if (cref == null || cref.$$is_module) { + return const_lookup_ancestors(_Object, name); + } + } + + // Call const_missing if nothing else worked + function const_missing(cref, name) { + return (cref || _Object).$const_missing(name); + } + + // Look for the constant just in the current cref or call `#const_missing` + Opal.const_get_local = function(cref, name, skip_missing) { + var result; + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + $raise(Opal.TypeError, cref.toString() + " is not a class/module"); + } + + result = const_get_name(cref, name); + return result != null || skip_missing ? result : const_missing(cref, name); + }; + + // Look for the constant relative to a cref or call `#const_missing` (when the + // constant is prefixed by `::`). + Opal.const_get_qualified = function(cref, name, skip_missing) { + var result, cache, cached, current_version = Opal.const_cache_version; + + if (name == null) { + // A shortpath for calls like ::String => $$$("String") + result = const_get_name(_Object, cref); + + if (result != null) return result; + return Opal.const_get_qualified(_Object, cref, skip_missing); + } + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + $raise(Opal.TypeError, cref.toString() + " is not a class/module"); + } + + if ((cache = cref.$$const_cache) == null) { + $prop(cref, '$$const_cache', Object.create(null)); + cache = cref.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null); + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null || skip_missing ? result : const_missing(cref, name); + }; + + // Initialize the top level constant cache generation counter + Opal.const_cache_version = 1; + + // Look for the constant in the open using the current nesting and the nearest + // cref ancestors or call `#const_missing` (when the constant has no :: prefix). + Opal.const_get_relative = function(nesting, name, skip_missing) { + var cref = nesting[0], result, current_version = Opal.const_cache_version, cache, cached; + + if ((cache = nesting.$$const_cache) == null) { + $prop(nesting, '$$const_cache', Object.create(null)); + cache = nesting.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_nesting(nesting, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null) || + ((result = const_lookup_Object(cref, name)) != null); + + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null || skip_missing ? result : const_missing(cref, name); + }; + + // Register the constant on a cref and opportunistically set the name of + // unnamed classes/modules. + function $const_set(cref, name, value) { + var new_const = true; + + if (cref == null || cref === '::') cref = _Object; + + if (value.$$is_a_module) { + if (value.$$name == null || value.$$name === nil) value.$$name = name; + if (value.$$base_module == null) value.$$base_module = cref; + } + + cref.$$const = (cref.$$const || Object.create(null)); + + if (name in cref.$$const || ("$$autoload" in cref && name in cref.$$autoload)) { + new_const = false; + } + + cref.$$const[name] = value; + + // Add a short helper to navigate constants manually. + // @example + // Opal.$$.Regexp.$$.IGNORECASE + cref.$$ = cref.$$const; + + Opal.const_cache_version++; + + // Expose top level constants onto the Opal object + if (cref === _Object) Opal[name] = value; + + // Name new class directly onto current scope (Opal.Foo.Baz = klass) + $prop(cref, name, value); + + if (new_const && cref.$const_added && !cref.$const_added.$$pristine) { + cref.$const_added(name); + } + + return value; + } + Opal.const_set = $const_set; + + // Get all the constants reachable from a given cref, by default will include + // inherited constants. + Opal.constants = function(cref, inherit) { + if (inherit == null) inherit = true; + + var module, modules = [cref], i, ii, constants = {}, constant; + + if (inherit) modules = modules.concat($ancestors(cref)); + if (inherit && cref.$$is_module) modules = modules.concat([Opal.Object]).concat($ancestors(Opal.Object)); + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + + // Do not show Objects constants unless we're querying Object itself + if (cref !== _Object && module == _Object) break; + + for (constant in module.$$const) { + constants[constant] = true; + } + if (module.$$autoload) { + for (constant in module.$$autoload) { + constants[constant] = true; + } + } + } + + return Object.keys(constants); + }; + + // Remove a constant from a cref. + Opal.const_remove = function(cref, name) { + Opal.const_cache_version++; + + if (cref.$$const[name] != null) { + var old = cref.$$const[name]; + delete cref.$$const[name]; + return old; + } + + if (cref.$$autoload && cref.$$autoload[name]) { + delete cref.$$autoload[name]; + return nil; + } + + $raise(Opal.NameError, "constant "+cref+"::"+cref.$name()+" not defined"); + }; + + // Generates a function that is a curried const_get_relative. + Opal.const_get_relative_factory = function(nesting) { + return function(name, skip_missing) { + return Opal.$$(nesting, name, skip_missing); + } + }; + + // Setup some shortcuts to reduce compiled size + Opal.$$ = Opal.const_get_relative; + Opal.$$$ = Opal.const_get_qualified; + Opal.$r = Opal.const_get_relative_factory; + + // Modules & Classes + // ----------------- + + // A `class Foo; end` expression in ruby is compiled to call this runtime + // method which either returns an existing class of the given name, or creates + // a new class in the given `base` scope. + // + // If a constant with the given name exists, then we check to make sure that + // it is a class and also that the superclasses match. If either of these + // fail, then we raise a `TypeError`. Note, `superclass` may be null if one + // was not specified in the ruby code. + // + // We pass a constructor to this method of the form `function ClassName() {}` + // simply so that classes show up with nicely formatted names inside debuggers + // in the web browser (or node/sprockets). + // + // The `scope` is the current `self` value where the class is being created + // from. We use this to get the scope for where the class should be created. + // If `scope` is an object (not a class/module), we simple get its class and + // use that as the scope instead. + // + // @param scope [Object] where the class is being created + // @param superclass [Class,null] superclass of the new class (may be null) + // @param singleton [Boolean,null] a true value denotes we want to allocate + // a singleton + // + // @return new [Class] or existing ruby class + // + function $allocate_class(name, superclass, singleton) { + var klass; + + if (superclass != null && superclass.$$bridge) { + // Inheritance from bridged classes requires + // calling original JS constructors + klass = function() { + var args = $slice(arguments), + self = new ($bind.apply(superclass.$$constructor, [null].concat(args)))(); + + // and replacing a __proto__ manually + $set_proto(self, klass.$$prototype); + return self; + }; + } else { + klass = function(){}; + } + + if (name && name !== nil) { + $prop(klass, 'displayName', '::'+name); + } + + $prop(klass, '$$name', name); + $prop(klass, '$$constructor', klass); + $prop(klass, '$$prototype', klass.prototype); + $prop(klass, '$$const', {}); + $prop(klass, '$$is_class', true); + $prop(klass, '$$is_a_module', true); + $prop(klass, '$$super', superclass); + $prop(klass, '$$cvars', {}); + $prop(klass, '$$own_included_modules', []); + $prop(klass, '$$own_prepended_modules', []); + $prop(klass, '$$ancestors', []); + $prop(klass, '$$ancestors_cache_version', null); + $prop(klass, '$$subclasses', []); + + $prop(klass.$$prototype, '$$class', klass); + + // By default if there are no singleton class methods + // __proto__ is Class.prototype + // Later singleton methods generate a singleton_class + // and inject it into ancestors chain + if (Opal.Class) { + $set_proto(klass, Opal.Class.prototype); + } + + if (superclass != null) { + $set_proto(klass.$$prototype, superclass.$$prototype); + + if (singleton !== true) { + // Let's not forbid GC from cleaning up our + // subclasses. + if (typeof WeakRef !== 'undefined') { + // First, let's clean up our array from empty objects. + var i, subclass, rebuilt_subclasses = []; + for (i = 0; i < superclass.$$subclasses.length; i++) { + subclass = superclass.$$subclasses[i]; + if (subclass.deref() !== undefined) { + rebuilt_subclasses.push(subclass); + } + } + // Now, let's add our class. + rebuilt_subclasses.push(new WeakRef(klass)); + superclass.$$subclasses = rebuilt_subclasses; + } + else { + superclass.$$subclasses.push(klass); + } + } + + if (superclass.$$meta) { + // If superclass has metaclass then we have explicitely inherit it. + Opal.build_class_singleton_class(klass); + } + } + + return klass; + } Opal.allocate_class = $allocate_class; + + + function find_existing_class(scope, name) { + // Try to find the class in the current scope + var klass = const_get_name(scope, name); + + // If the class exists in the scope, then we must use that + if (klass) { + // Make sure the existing constant is a class, or raise error + if (!klass.$$is_class) { + $raise(Opal.TypeError, name + " is not a class"); + } + + return klass; + } + } + + function ensureSuperclassMatch(klass, superclass) { + if (klass.$$super !== superclass) { + $raise(Opal.TypeError, "superclass mismatch for class " + klass.$$name); + } + } + + Opal.klass = function(scope, superclass, name) { + var bridged; + + if (scope == null || scope == '::') { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + // If the superclass is not an Opal-generated class then we're bridging a native JS class + if ( + superclass != null && (!superclass.hasOwnProperty || ( + superclass.hasOwnProperty && !superclass.hasOwnProperty('$$is_class') + )) + ) { + if (superclass.constructor && superclass.constructor.name == "Function") { + bridged = superclass; + superclass = _Object; + } else { + $raise(Opal.TypeError, "superclass must be a Class (" + ( + (superclass.constructor && (superclass.constructor.name || superclass.constructor.$$name)) || + typeof(superclass) + ) + " given)"); + } + } + + var klass = find_existing_class(scope, name); + + if (klass != null) { + if (superclass) { + // Make sure existing class has same superclass + ensureSuperclassMatch(klass, superclass); + } + } + else { + // Class doesn't exist, create a new one with given superclass... + + // Not specifying a superclass means we can assume it to be Object + if (superclass == null) { + superclass = _Object; + } + + // Create the class object (instance of Class) + klass = $allocate_class(name, superclass); + $const_set(scope, name, klass); + + // Call .inherited() hook with new class on the superclass + if (superclass.$inherited) { + superclass.$inherited(klass); + } + + if (bridged) { + Opal.bridge(bridged, klass); + } + } + + if (Opal.trace_class) { invoke_tracers_for_class(klass); } + + return klass; + }; + + // Define new module (or return existing module). The given `scope` is basically + // the current `self` value the `module` statement was defined in. If this is + // a ruby module or class, then it is used, otherwise if the scope is a ruby + // object then that objects real ruby class is used (e.g. if the scope is the + // main object, then the top level `Object` class is used as the scope). + // + // If a module of the given name is already defined in the scope, then that + // instance is just returned. + // + // If there is a class of the given name in the scope, then an error is + // generated instead (cannot have a class and module of same name in same scope). + // + // Otherwise, a new module is created in the scope with the given name, and that + // new instance is returned back (to be referenced at runtime). + // + // @param scope [Module, Class] class or module this definition is inside + // @param id [String] the name of the new (or existing) module + // + // @return [Module] + function $allocate_module(name) { + var constructor = function(){}; + var module = constructor; + + if (name) + $prop(constructor, 'displayName', name+'.constructor'); + + $prop(module, '$$name', name); + $prop(module, '$$prototype', constructor.prototype); + $prop(module, '$$const', {}); + $prop(module, '$$is_module', true); + $prop(module, '$$is_a_module', true); + $prop(module, '$$cvars', {}); + $prop(module, '$$iclasses', []); + $prop(module, '$$own_included_modules', []); + $prop(module, '$$own_prepended_modules', []); + $prop(module, '$$ancestors', [module]); + $prop(module, '$$ancestors_cache_version', null); + + $set_proto(module, Opal.Module.prototype); + + return module; + } Opal.allocate_module = $allocate_module; + + function find_existing_module(scope, name) { + var module = const_get_name(scope, name); + if (module == null && scope === _Object) module = const_lookup_ancestors(_Object, name); + + if (module) { + if (!module.$$is_module && module !== _Object) { + $raise(Opal.TypeError, name + " is not a module"); + } + } + + return module; + } + + Opal.module = function(scope, name) { + var module; + + if (scope == null || scope == '::') { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + module = find_existing_module(scope, name); + + if (module == null) { + // Module doesnt exist, create a new one... + module = $allocate_module(name); + $const_set(scope, name, module); + } + + if (Opal.trace_class) { invoke_tracers_for_class(module); } + + return module; + }; + + // Return the singleton class for the passed object. + // + // If the given object alredy has a singleton class, then it will be stored on + // the object as the `$$meta` property. If this exists, then it is simply + // returned back. + // + // Otherwise, a new singleton object for the class or object is created, set on + // the object at `$$meta` for future use, and then returned. + // + // @param object [Object] the ruby object + // @return [Class] the singleton class for object + Opal.get_singleton_class = function(object) { + if (object.$$is_number) { + $raise(Opal.TypeError, "can't define singleton"); + } + if (object.$$meta) { + return object.$$meta; + } + + if (object.hasOwnProperty('$$is_class')) { + return Opal.build_class_singleton_class(object); + } else if (object.hasOwnProperty('$$is_module')) { + return Opal.build_module_singleton_class(object); + } else { + return Opal.build_object_singleton_class(object); + } + }; + + // helper to set $$meta on klass, module or instance + function set_meta(obj, meta) { + if (obj.hasOwnProperty('$$meta')) { + obj.$$meta = meta; + } else { + $prop(obj, '$$meta', meta); + } + if (obj.$$frozen) { + // If a object is frozen (sealed), freeze $$meta too. + // No need to inject $$meta.$$prototype in the prototype chain, + // as $$meta cannot be modified anyway. + obj.$$meta.$freeze(); + } else { + $set_proto(obj, meta.$$prototype); + } + } + // Build the singleton class for an existing class. Class object are built + // with their singleton class already in the prototype chain and inheriting + // from their superclass object (up to `Class` itself). + // + // NOTE: Actually in MRI a class' singleton class inherits from its + // superclass' singleton class which in turn inherits from Class. + // + // @param klass [Class] + // @return [Class] + Opal.build_class_singleton_class = function(klass) { + if (klass.$$meta) { + return klass.$$meta; + } + + // The singleton_class superclass is the singleton_class of its superclass; + // but BasicObject has no superclass (its `$$super` is null), thus we + // fallback on `Class`. + var superclass = klass === BasicObject ? Class : Opal.get_singleton_class(klass.$$super); + + var meta = $allocate_class(null, superclass, true); + + $prop(meta, '$$is_singleton', true); + $prop(meta, '$$singleton_of', klass); + set_meta(klass, meta); + // Restoring ClassName.class + $prop(klass, '$$class', Opal.Class); + + return meta; + }; + + Opal.build_module_singleton_class = function(mod) { + if (mod.$$meta) { + return mod.$$meta; + } + + var meta = $allocate_class(null, Opal.Module, true); + + $prop(meta, '$$is_singleton', true); + $prop(meta, '$$singleton_of', mod); + set_meta(mod, meta); + // Restoring ModuleName.class + $prop(mod, '$$class', Opal.Module); + + return meta; + }; + + // Build the singleton class for a Ruby (non class) Object. + // + // @param object [Object] + // @return [Class] + Opal.build_object_singleton_class = function(object) { + var superclass = object.$$class, + klass = $allocate_class(nil, superclass, true); + + $prop(klass, '$$is_singleton', true); + $prop(klass, '$$singleton_of', object); + + delete klass.$$prototype.$$class; + + set_meta(object, klass); + + return klass; + }; + + Opal.is_method = function(prop) { + return (prop[0] === '$' && prop[1] !== '$'); + }; + + Opal.instance_methods = function(mod) { + var exclude = [], results = [], ancestors = $ancestors(mod); + + for (var i = 0, l = ancestors.length; i < l; i++) { + var ancestor = ancestors[i], + proto = ancestor.$$prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var j = 0, ll = props.length; j < ll; j++) { + var prop = props[j]; + + if (Opal.is_method(prop)) { + var method_name = prop.slice(1), + method = proto[prop]; + + if (method.$$stub && exclude.indexOf(method_name) === -1) { + exclude.push(method_name); + } + + if (!method.$$stub && results.indexOf(method_name) === -1 && exclude.indexOf(method_name) === -1) { + results.push(method_name); + } + } + } + } + + return results; + }; + + Opal.own_instance_methods = function(mod) { + var results = [], + proto = mod.$$prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var i = 0, length = props.length; i < length; i++) { + var prop = props[i]; + + if (Opal.is_method(prop)) { + var method = proto[prop]; + + if (!method.$$stub) { + var method_name = prop.slice(1); + results.push(method_name); + } + } + } + + return results; + }; + + Opal.methods = function(obj) { + return Opal.instance_methods(obj.$$meta || obj.$$class); + }; + + Opal.own_methods = function(obj) { + return obj.$$meta ? Opal.own_instance_methods(obj.$$meta) : []; + }; + + Opal.receiver_methods = function(obj) { + var mod = Opal.get_singleton_class(obj); + var singleton_methods = Opal.own_instance_methods(mod); + var instance_methods = Opal.own_instance_methods(mod.$$super); + return singleton_methods.concat(instance_methods); + }; + + // Returns an object containing all pairs of names/values + // for all class variables defined in provided +module+ + // and its ancestors. + // + // @param module [Module] + // @return [Object] + Opal.class_variables = function(module) { + var ancestors = $ancestors(module), + i, length = ancestors.length, + result = {}; + + for (i = length - 1; i >= 0; i--) { + var ancestor = ancestors[i]; + + for (var cvar in ancestor.$$cvars) { + result[cvar] = ancestor.$$cvars[cvar]; + } + } + + return result; + }; + + // Sets class variable with specified +name+ to +value+ + // in provided +module+ + // + // @param module [Module] + // @param name [String] + // @param value [Object] + Opal.class_variable_set = function(module, name, value) { + var ancestors = $ancestors(module), + i, length = ancestors.length; + + for (i = length - 2; i >= 0; i--) { + var ancestor = ancestors[i]; + + if ($has_own(ancestor.$$cvars, name)) { + ancestor.$$cvars[name] = value; + return value; + } + } + + module.$$cvars[name] = value; + + return value; + }; + + // Gets class variable with specified +name+ from provided +module+ + // + // @param module [Module] + // @param name [String] + Opal.class_variable_get = function(module, name, tolerant) { + if ($has_own(module.$$cvars, name)) + return module.$$cvars[name]; + + var ancestors = $ancestors(module), + i, length = ancestors.length; + + for (i = 0; i < length; i++) { + var ancestor = ancestors[i]; + + if ($has_own(ancestor.$$cvars, name)) { + return ancestor.$$cvars[name]; + } + } + + if (!tolerant) + $raise(Opal.NameError, 'uninitialized class variable '+name+' in '+module.$name()); + + return nil; + }; + + function isRoot(proto) { + return proto.hasOwnProperty('$$iclass') && proto.hasOwnProperty('$$root'); + } + + function own_included_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.$$prototype); + + while (proto) { + if (proto.hasOwnProperty('$$class')) { + // superclass + break; + } + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + proto = Object.getPrototypeOf(proto); + } + + return result; + } + + function own_prepended_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.$$prototype); + + if (module.$$prototype.hasOwnProperty('$$dummy')) { + while (proto) { + if (proto === module.$$prototype.$$define_methods_on) { + break; + } + + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + + proto = Object.getPrototypeOf(proto); + } + } + + return result; + } + + + // The actual inclusion of a module into a class. + // + // ## Class `$$parent` and `iclass` + // + // To handle `super` calls, every class has a `$$parent`. This parent is + // used to resolve the next class for a super call. A normal class would + // have this point to its superclass. However, if a class includes a module + // then this would need to take into account the module. The module would + // also have to then point its `$$parent` to the actual superclass. We + // cannot modify modules like this, because it might be included in more + // then one class. To fix this, we actually insert an `iclass` as the class' + // `$$parent` which can then point to the superclass. The `iclass` acts as + // a proxy to the actual module, so the `super` chain can then search it for + // the required method. + // + // @param module [Module] the module to include + // @param includer [Module] the target class to include module into + // @return [null] + Opal.append_features = function(module, includer) { + var module_ancestors = $ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(includer) !== -1) { + $raise(Opal.ArgumentError, 'cyclic include detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $prop(iclass, '$$included', true); + iclasses.push(iclass); + } + var includer_ancestors = $ancestors(includer), + chain = chain_iclasses(iclasses), + start_chain_after, + end_chain_on; + + if (includer_ancestors.indexOf(module) === -1) { + // first time include + + // includer -> chain.first -> ...chain... -> chain.last -> includer.parent + start_chain_after = includer.$$prototype; + end_chain_on = Object.getPrototypeOf(includer.$$prototype); + } else { + // The module has been already included, + // we don't need to put it into the ancestors chain again, + // but this module may have new included modules. + // If it's true we need to copy them. + // + // The simplest way is to replace ancestors chain from + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...previos chain of module.included_modules ... + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // to + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...regenerated chain of module.included_modules + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // because there are no intermediate classes between `parent` and `next ancestor`. + // It doesn't break any prototypes of other objects as we don't change class references. + + var parent = includer.$$prototype, module_iclass = Object.getPrototypeOf(parent); + + while (module_iclass != null) { + if (module_iclass.$$module === module && isRoot(module_iclass)) { + break; + } + + parent = module_iclass; + module_iclass = Object.getPrototypeOf(module_iclass); + } + + if (module_iclass) { + // module has been directly included + var next_ancestor = Object.getPrototypeOf(module_iclass); + + // skip non-root iclasses (that were recursively included) + while (next_ancestor.hasOwnProperty('$$iclass') && !isRoot(next_ancestor)) { + next_ancestor = Object.getPrototypeOf(next_ancestor); + } + + start_chain_after = parent; + end_chain_on = next_ancestor; + } else { + // module has not been directly included but was in ancestor chain because it was included by another module + // include it directly + start_chain_after = includer.$$prototype; + end_chain_on = Object.getPrototypeOf(includer.$$prototype); + } + } + + $set_proto(start_chain_after, chain.first); + $set_proto(chain.last, end_chain_on); + + // recalculate own_included_modules cache + includer.$$own_included_modules = own_included_modules(includer); + + Opal.const_cache_version++; + }; + + Opal.prepend_features = function(module, prepender) { + // Here we change the ancestors chain from + // + // prepender + // | + // parent + // + // to: + // + // dummy(prepender) + // | + // iclass(module) + // | + // iclass(prepender) + // | + // parent + var module_ancestors = $ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(prepender) !== -1) { + $raise(Opal.ArgumentError, 'cyclic prepend detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $prop(iclass, '$$prepended', true); + iclasses.push(iclass); + } + + var chain = chain_iclasses(iclasses), + dummy_prepender = prepender.$$prototype, + previous_parent = Object.getPrototypeOf(dummy_prepender), + prepender_iclass, + start_chain_after, + end_chain_on; + + if (dummy_prepender.hasOwnProperty('$$dummy')) { + // The module already has some prepended modules + // which means that we don't need to make it "dummy" + prepender_iclass = dummy_prepender.$$define_methods_on; + } else { + // Making the module "dummy" + prepender_iclass = create_dummy_iclass(prepender); + flush_methods_in(prepender); + $prop(dummy_prepender, '$$dummy', true); + $prop(dummy_prepender, '$$define_methods_on', prepender_iclass); + + // Converting + // dummy(prepender) -> previous_parent + // to + // dummy(prepender) -> iclass(prepender) -> previous_parent + $set_proto(dummy_prepender, prepender_iclass); + $set_proto(prepender_iclass, previous_parent); + } + + var prepender_ancestors = $ancestors(prepender); + + if (prepender_ancestors.indexOf(module) === -1) { + // first time prepend + + start_chain_after = dummy_prepender; + + // next $$root or prepender_iclass or non-$$iclass + end_chain_on = Object.getPrototypeOf(dummy_prepender); + while (end_chain_on != null) { + if ( + end_chain_on.hasOwnProperty('$$root') || + end_chain_on === prepender_iclass || + !end_chain_on.hasOwnProperty('$$iclass') + ) { + break; + } + + end_chain_on = Object.getPrototypeOf(end_chain_on); + } + } else { + $raise(Opal.RuntimeError, "Prepending a module multiple times is not supported"); + } + + $set_proto(start_chain_after, chain.first); + $set_proto(chain.last, end_chain_on); + + // recalculate own_prepended_modules cache + prepender.$$own_prepended_modules = own_prepended_modules(prepender); + + Opal.const_cache_version++; + }; + + function flush_methods_in(module) { + var proto = module.$$prototype, + props = Object.getOwnPropertyNames(proto); + + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (Opal.is_method(prop)) { + delete proto[prop]; + } + } + } + + function create_iclass(module) { + var iclass = create_dummy_iclass(module); + + if (module.$$is_module) { + module.$$iclasses.push(iclass); + } + + return iclass; + } + + // Dummy iclass doesn't receive updates when the module gets a new method. + function create_dummy_iclass(module) { + var iclass = {}, + proto = module.$$prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto), + length = props.length, i; + + for (i = 0; i < length; i++) { + var prop = props[i]; + $prop(iclass, prop, proto[prop]); + } + + $prop(iclass, '$$iclass', true); + $prop(iclass, '$$module', module); + + return iclass; + } + + function chain_iclasses(iclasses) { + var length = iclasses.length, first = iclasses[0]; + + $prop(first, '$$root', true); + + if (length === 1) { + return { first: first, last: first }; + } + + var previous = first; + + for (var i = 1; i < length; i++) { + var current = iclasses[i]; + $set_proto(previous, current); + previous = current; + } + + + return { first: iclasses[0], last: iclasses[length - 1] }; + } + + // For performance, some core Ruby classes are toll-free bridged to their + // native JavaScript counterparts (e.g. a Ruby Array is a JavaScript Array). + // + // This method is used to setup a native constructor (e.g. Array), to have + // its prototype act like a normal Ruby class. Firstly, a new Ruby class is + // created using the native constructor so that its prototype is set as the + // target for the new class. Note: all bridged classes are set to inherit + // from Object. + // + // Example: + // + // Opal.bridge(self, Function); + // + // @param klass [Class] the Ruby class to bridge + // @param constructor [JS.Function] native JavaScript constructor to use + // @return [Class] returns the passed Ruby class + // + Opal.bridge = function(native_klass, klass) { + if (native_klass.hasOwnProperty('$$bridge')) { + $raise(Opal.ArgumentError, "already bridged"); + } + + // constructor is a JS function with a prototype chain like: + // - constructor + // - super + // + // What we need to do is to inject our class (with its prototype chain) + // between constructor and super. For example, after injecting ::Object + // into JS String we get: + // + // - constructor (window.String) + // - Opal.Object + // - Opal.Kernel + // - Opal.BasicObject + // - super (window.Object) + // - null + // + $prop(native_klass, '$$bridge', klass); + $set_proto(native_klass.prototype, (klass.$$super || Opal.Object).$$prototype); + $prop(klass, '$$prototype', native_klass.prototype); + + $prop(klass.$$prototype, '$$class', klass); + $prop(klass, '$$constructor', native_klass); + $prop(klass, '$$bridge', true); + }; + + function protoToModule(proto) { + if (proto.hasOwnProperty('$$dummy')) { + return; + } else if (proto.hasOwnProperty('$$iclass')) { + return proto.$$module; + } else if (proto.hasOwnProperty('$$class')) { + return proto.$$class; + } + } + + function own_ancestors(module) { + return module.$$own_prepended_modules.concat([module]).concat(module.$$own_included_modules); + } + + // The Array of ancestors for a given module/class + function $ancestors(module) { + if (!module) { return []; } + + if (module.$$ancestors_cache_version === Opal.const_cache_version) { + return module.$$ancestors; + } + + var result = [], i, mods, length; + + for (i = 0, mods = own_ancestors(module), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + + if (module.$$super) { + for (i = 0, mods = $ancestors(module.$$super), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + } + + module.$$ancestors_cache_version = Opal.const_cache_version; + module.$$ancestors = result; + + return result; + } Opal.ancestors = $ancestors; + + Opal.included_modules = function(module) { + var result = [], mod = null, proto = Object.getPrototypeOf(module.$$prototype); + + for (; proto && Object.getPrototypeOf(proto); proto = Object.getPrototypeOf(proto)) { + mod = protoToModule(proto); + if (mod && mod.$$is_module && proto.$$iclass && proto.$$included) { + result.push(mod); + } + } + + return result; + }; + + + // Method Missing + // -------------- + + // Methods stubs are used to facilitate method_missing in opal. A stub is a + // placeholder function which just calls `method_missing` on the receiver. + // If no method with the given name is actually defined on an object, then it + // is obvious to say that the stub will be called instead, and then in turn + // method_missing will be called. + // + // When a file in ruby gets compiled to javascript, it includes a call to + // this function which adds stubs for every method name in the compiled file. + // It should then be safe to assume that method_missing will work for any + // method call detected. + // + // Method stubs are added to the BasicObject prototype, which every other + // ruby object inherits, so all objects should handle method missing. A stub + // is only added if the given property name (method name) is not already + // defined. + // + // Note: all ruby methods have a `$` prefix in javascript, so all stubs will + // have this prefix as well (to make this method more performant). + // + // Opal.add_stubs("foo,bar,baz="); + // + // All stub functions will have a private `$$stub` property set to true so + // that other internal methods can detect if a method is just a stub or not. + // `Kernel#respond_to?` uses this property to detect a methods presence. + // + // @param stubs [Array] an array of method stubs to add + // @return [undefined] + Opal.add_stubs = function(stubs) { + var proto = Opal.BasicObject.$$prototype; + var stub, existing_method; + stubs = stubs.split(','); + + for (var i = 0, length = stubs.length; i < length; i++) { + stub = $jsid(stubs[i]), existing_method = proto[stub]; + + if (existing_method == null || existing_method.$$stub) { + Opal.add_stub_for(proto, stub); + } + } + }; + + // Add a method_missing stub function to the given prototype for the + // given name. + // + // @param prototype [Prototype] the target prototype + // @param stub [String] stub name to add (e.g. "$foo") + // @return [undefined] + Opal.add_stub_for = function(prototype, stub) { + // Opal.stub_for(stub) is the method_missing_stub + $prop(prototype, stub, Opal.stub_for(stub)); + }; + + // Generate the method_missing stub for a given method name. + // + // @param method_name [String] The js-name of the method to stub (e.g. "$foo") + // @return [undefined] + Opal.stub_for = function(method_name) { + + function method_missing_stub() { + // Copy any given block onto the method_missing dispatcher + this.$method_missing.$$p = method_missing_stub.$$p; + + // Set block property to null ready for the next call (stop false-positives) + method_missing_stub.$$p = null; + + // call method missing with correct args (remove '$' prefix on method name) + var args_ary = new Array(arguments.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = arguments[i]; } + + return this.$method_missing.apply(this, [method_name.slice(1)].concat(args_ary)); + } + + method_missing_stub.$$stub = true; + + return method_missing_stub; + }; + + + // Methods + // ------- + + // Arity count error dispatcher for methods + // + // @param actual [Fixnum] number of arguments given to method + // @param expected [Fixnum] expected number of arguments + // @param object [Object] owner of the method +meth+ + // @param meth [String] method name that got wrong number of arguments + // @raise [ArgumentError] + Opal.ac = function(actual, expected, object, meth) { + var inspect = ''; + if (object.$$is_a_module) { + inspect += object.$$name + '.'; + } + else { + inspect += object.$$class.$$name + '#'; + } + inspect += meth; + + $raise(Opal.ArgumentError, '[' + inspect + '] wrong number of arguments (given ' + actual + ', expected ' + expected + ')'); + }; + + // Arity count error dispatcher for blocks + // + // @param actual [Fixnum] number of arguments given to block + // @param expected [Fixnum] expected number of arguments + // @param context [Object] context of the block definition + // @raise [ArgumentError] + Opal.block_ac = function(actual, expected, context) { + var inspect = "`block in " + context + "'"; + + $raise(Opal.ArgumentError, inspect + ': wrong number of arguments (given ' + actual + ', expected ' + expected + ')'); + }; + + function get_ancestors(obj) { + if (obj.hasOwnProperty('$$meta') && obj.$$meta !== null) { + return $ancestors(obj.$$meta); + } else { + return $ancestors(obj.$$class); + } + } + // Super dispatcher + Opal.find_super = function(obj, mid, current_func, defcheck, allow_stubs) { + var jsid = $jsid(mid), ancestors, super_method; + + ancestors = get_ancestors(obj); + + var current_index = ancestors.indexOf(current_func.$$owner); + + for (var i = current_index + 1; i < ancestors.length; i++) { + var ancestor = ancestors[i], + proto = ancestor.$$prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + if (proto.hasOwnProperty(jsid)) { + super_method = proto[jsid]; + break; + } + } + + if (!defcheck && super_method && super_method.$$stub && obj.$method_missing.$$pristine) { + // method_missing hasn't been explicitly defined + $raise(Opal.NoMethodError, 'super: no superclass method `'+mid+"' for "+obj, mid); + } + + return (super_method.$$stub && !allow_stubs) ? null : super_method; + }; + + // Iter dispatcher for super in a block + Opal.find_block_super = function(obj, jsid, current_func, defcheck, implicit) { + var call_jsid = jsid; + + if (!current_func) { + $raise(Opal.RuntimeError, "super called outside of method"); + } + + if (implicit && current_func.$$define_meth) { + $raise(Opal.RuntimeError, + "implicit argument passing of super from method defined by define_method() is not supported. " + + "Specify all arguments explicitly" + ); + } + + if (current_func.$$def) { + call_jsid = current_func.$$jsid; + } + + return Opal.find_super(obj, call_jsid, current_func, defcheck); + }; + + // @deprecated + Opal.find_super_dispatcher = Opal.find_super; + + // @deprecated + Opal.find_iter_super_dispatcher = Opal.find_block_super; + + // handles yield calls for 1 yielded arg + Opal.yield1 = function(block, arg) { + if (typeof(block) !== "function") { + $raise(Opal.LocalJumpError, "no block given"); + } + + var has_mlhs = block.$$has_top_level_mlhs_arg, + has_trailing_comma = block.$$has_trailing_comma_in_args; + + if (block.length > 1 || ((has_mlhs || has_trailing_comma) && block.length === 1)) { + arg = Opal.to_ary(arg); + } + + if ((block.length > 1 || (has_trailing_comma && block.length === 1)) && arg.$$is_array) { + return block.apply(null, arg); + } + else { + return block(arg); + } + }; + + // handles yield for > 1 yielded arg + Opal.yieldX = function(block, args) { + if (typeof(block) !== "function") { + $raise(Opal.LocalJumpError, "no block given"); + } + + if (block.length > 1 && args.length === 1) { + if (args[0].$$is_array) { + return block.apply(null, args[0]); + } + } + + if (!args.$$is_array) { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return block.apply(null, args_ary); + } + + return block.apply(null, args); + }; + + // Finds the corresponding exception match in candidates. Each candidate can + // be a value, or an array of values. Returns null if not found. + Opal.rescue = function(exception, candidates) { + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + + if (candidate.$$is_array) { + var result = Opal.rescue(exception, candidate); + + if (result) { + return result; + } + } + else if (candidate === Opal.JS.Error || candidate['$==='](exception)) { + return candidate; + } + } + + return null; + }; + + Opal.is_a = function(object, klass) { + if (klass != null && object.$$meta === klass || object.$$class === klass) { + return true; + } + + if (object.$$is_number && klass.$$is_number_class) { + return (klass.$$is_integer_class) ? (object % 1) === 0 : true; + } + + var ancestors = $ancestors(object.$$is_class ? Opal.get_singleton_class(object) : (object.$$meta || object.$$class)); + + return ancestors.indexOf(klass) !== -1; + }; + + // Helpers for extracting kwsplats + // Used for: { **h } + Opal.to_hash = function(value) { + if (value.$$is_hash) { + return value; + } + else if (value['$respond_to?']('to_hash', true)) { + var hash = value.$to_hash(); + if (hash.$$is_hash) { + return hash; + } + else { + $raise(Opal.TypeError, "Can't convert " + value.$$class + + " to Hash (" + value.$$class + "#to_hash gives " + hash.$$class + ")"); + } + } + else { + $raise(Opal.TypeError, "no implicit conversion of " + value.$$class + " into Hash"); + } + }; + + // Helpers for implementing multiple assignment + // Our code for extracting the values and assigning them only works if the + // return value is a JS array. + // So if we get an Array subclass, extract the wrapped JS array from it + + // Used for: a, b = something (no splat) + Opal.to_ary = function(value) { + if (value.$$is_array) { + return value; + } + else if (value['$respond_to?']('to_ary', true)) { + var ary = value.$to_ary(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + $raise(Opal.TypeError, "Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_ary gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for: a, b = *something (with splat) + Opal.to_a = function(value) { + if (value.$$is_array) { + // A splatted array must be copied + return value.slice(); + } + else if (value['$respond_to?']('to_a', true)) { + var ary = value.$to_a(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + $raise(Opal.TypeError, "Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_a gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for extracting keyword arguments from arguments passed to + // JS function. If provided +arguments+ list doesn't have a Hash + // as a last item, returns a blank Hash. + // + // @param parameters [Array] + // @return [Hash] + // + Opal.extract_kwargs = function(parameters) { + var kwargs = parameters[parameters.length - 1]; + if (kwargs != null && Opal.respond_to(kwargs, '$to_hash', true)) { + $splice(parameters, parameters.length - 1); + return kwargs; + } + }; + + // Used to get a list of rest keyword arguments. Method takes the given + // keyword args, i.e. the hash literal passed to the method containing all + // keyword arguemnts passed to method, as well as the used args which are + // the names of required and optional arguments defined. This method then + // just returns all key/value pairs which have not been used, in a new + // hash literal. + // + // @param given_args [Hash] all kwargs given to method + // @param used_args [Object] all keys used as named kwargs + // @return [Hash] + // + Opal.kwrestargs = function(given_args, used_args) { + var keys = [], + map = {}, + key , + given_map = given_args.$$smap; + + for (key in given_map) { + if (!used_args[key]) { + keys.push(key); + map[key] = given_map[key]; + } + } + + return Opal.hash2(keys, map); + }; + + function apply_blockopts(block, blockopts) { + if (typeof(blockopts) === 'number') { + block.$$arity = blockopts; + } + else if (typeof(blockopts) === 'object') { + Object.assign(block, blockopts); + } + } + + // Optimization for a costly operation of prepending '$' to method names + var jsid_cache = {}; + function $jsid(name) { + return jsid_cache[name] || (jsid_cache[name] = '$' + name); + } + Opal.jsid = $jsid; + + // Calls passed method on a ruby object with arguments and block: + // + // Can take a method or a method name. + // + // 1. When method name gets passed it invokes it by its name + // and calls 'method_missing' when object doesn't have this method. + // Used internally by Opal to invoke method that takes a block or a splat. + // 2. When method (i.e. method body) gets passed, it doesn't trigger 'method_missing' + // because it doesn't know the name of the actual method. + // Used internally by Opal to invoke 'super'. + // + // @example + // var my_array = [1, 2, 3, 4] + // Opal.send(my_array, 'length') # => 4 + // Opal.send(my_array, my_array.$length) # => 4 + // + // Opal.send(my_array, 'reverse!') # => [4, 3, 2, 1] + // Opal.send(my_array, my_array['$reverse!']') # => [4, 3, 2, 1] + // + // @param recv [Object] ruby object + // @param method [Function, String] method body or name of the method + // @param args [Array] arguments that will be passed to the method call + // @param block [Function] ruby block + // @param blockopts [Object, Number] optional properties to set on the block + // @return [Object] returning value of the method call + Opal.send = function(recv, method, args, block, blockopts) { + var body; + + if (typeof(method) === 'function') { + body = method; + method = null; + } else if (typeof(method) === 'string') { + body = recv[$jsid(method)]; + } else { + $raise(Opal.NameError, "Passed method should be a string or a function"); + } + + return Opal.send2(recv, body, method, args, block, blockopts); + }; + + Opal.send2 = function(recv, body, method, args, block, blockopts) { + if (body == null && method != null && recv.$method_missing) { + body = recv.$method_missing; + args = [method].concat(args); + } + + apply_blockopts(block, blockopts); + + if (typeof block === 'function') body.$$p = block; + return body.apply(recv, args); + }; + + Opal.refined_send = function(refinement_groups, recv, method, args, block, blockopts) { + var i, j, k, ancestors, ancestor, refinements, refinement, refine_modules, refine_module, body; + + ancestors = get_ancestors(recv); + + // For all ancestors that there are, starting from the closest to the furthest... + for (i = 0; i < ancestors.length; i++) { + ancestor = Opal.id(ancestors[i]); + + // For all refinement groups there are, starting from the closest scope to the furthest... + for (j = 0; j < refinement_groups.length; j++) { + refinements = refinement_groups[j]; + + // For all refinements there are, starting from the last `using` call to the furthest... + for (k = refinements.length - 1; k >= 0; k--) { + refinement = refinements[k]; + if (typeof refinement.$$refine_modules === 'undefined') continue; + + // A single module being given as an argument of the `using` call contains multiple + // refinement modules + refine_modules = refinement.$$refine_modules; + + // Does this module refine a given call for a given ancestor module? + if (typeof refine_modules[ancestor] === 'undefined') continue; + refine_module = refine_modules[ancestor]; + + // Does this module define a method we want to call? + if (typeof refine_module.$$prototype[$jsid(method)] !== 'undefined') { + body = refine_module.$$prototype[$jsid(method)]; + return Opal.send2(recv, body, method, args, block, blockopts); + } + } + } + } + + return Opal.send(recv, method, args, block, blockopts); + }; + + Opal.lambda = function(block, blockopts) { + block.$$is_lambda = true; + + apply_blockopts(block, blockopts); + + return block; + }; + + // Used to define methods on an object. This is a helper method, used by the + // compiled source to define methods on special case objects when the compiler + // can not determine the destination object, or the object is a Module + // instance. This can get called by `Module#define_method` as well. + // + // ## Modules + // + // Any method defined on a module will come through this runtime helper. + // The method is added to the module body, and the owner of the method is + // set to be the module itself. This is used later when choosing which + // method should show on a class if more than 1 included modules define + // the same method. Finally, if the module is in `module_function` mode, + // then the method is also defined onto the module itself. + // + // ## Classes + // + // This helper will only be called for classes when a method is being + // defined indirectly; either through `Module#define_method`, or by a + // literal `def` method inside an `instance_eval` or `class_eval` body. In + // either case, the method is simply added to the class' prototype. A special + // exception exists for `BasicObject` and `Object`. These two classes are + // special because they are used in toll-free bridged classes. In each of + // these two cases, extra work is required to define the methods on toll-free + // bridged class' prototypes as well. + // + // ## Objects + // + // If a simple ruby object is the object, then the method is simply just + // defined on the object as a singleton method. This would be the case when + // a method is defined inside an `instance_eval` block. + // + // @param obj [Object, Class] the actual obj to define method for + // @param jsid [String] the JavaScript friendly method name (e.g. '$foo') + // @param body [JS.Function] the literal JavaScript function used as method + // @param blockopts [Object, Number] optional properties to set on the body + // @return [null] + // + Opal.def = function(obj, jsid, body, blockopts) { + apply_blockopts(body, blockopts); + + // Special case for a method definition in the + // top-level namespace + if (obj === Opal.top) { + return Opal.defn(Opal.Object, jsid, body); + } + // if instance_eval is invoked on a module/class, it sets inst_eval_mod + else if (!obj.$$eval && obj.$$is_a_module) { + return Opal.defn(obj, jsid, body); + } + else { + return Opal.defs(obj, jsid, body); + } + }; + + // Define method on a module or class (see Opal.def). + Opal.defn = function(module, jsid, body) { + $deny_frozen_access(module); + + body.displayName = jsid; + body.$$owner = module; + + var name = jsid.substr(1); + + var proto = module.$$prototype; + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + $prop(proto, jsid, body); + + if (module.$$is_module) { + if (module.$$module_function) { + Opal.defs(module, jsid, body); + } + + for (var i = 0, iclasses = module.$$iclasses, length = iclasses.length; i < length; i++) { + var iclass = iclasses[i]; + $prop(iclass, jsid, body); + } + } + + var singleton_of = module.$$singleton_of; + if (module.$method_added && !module.$method_added.$$stub && !singleton_of) { + module.$method_added(name); + } + else if (singleton_of && singleton_of.$singleton_method_added && !singleton_of.$singleton_method_added.$$stub) { + singleton_of.$singleton_method_added(name); + } + + return name; + }; + + // Define a singleton method on the given object (see Opal.def). + Opal.defs = function(obj, jsid, body, blockopts) { + apply_blockopts(body, blockopts); + + if (obj.$$is_string || obj.$$is_number) { + $raise(Opal.TypeError, "can't define singleton"); + } + return Opal.defn(Opal.get_singleton_class(obj), jsid, body); + }; + + // Called from #remove_method. + Opal.rdef = function(obj, jsid) { + if (!$has_own(obj.$$prototype, jsid)) { + $raise(Opal.NameError, "method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + delete obj.$$prototype[jsid]; + + if (obj.$$is_singleton) { + if (obj.$$prototype.$singleton_method_removed && !obj.$$prototype.$singleton_method_removed.$$stub) { + obj.$$prototype.$singleton_method_removed(jsid.substr(1)); + } + } + else { + if (obj.$method_removed && !obj.$method_removed.$$stub) { + obj.$method_removed(jsid.substr(1)); + } + } + }; + + // Called from #undef_method. + Opal.udef = function(obj, jsid) { + if (!obj.$$prototype[jsid] || obj.$$prototype[jsid].$$stub) { + $raise(Opal.NameError, "method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + Opal.add_stub_for(obj.$$prototype, jsid); + + if (obj.$$is_singleton) { + if (obj.$$prototype.$singleton_method_undefined && !obj.$$prototype.$singleton_method_undefined.$$stub) { + obj.$$prototype.$singleton_method_undefined(jsid.substr(1)); + } + } + else { + if (obj.$method_undefined && !obj.$method_undefined.$$stub) { + obj.$method_undefined(jsid.substr(1)); + } + } + }; + + function is_method_body(body) { + return (typeof(body) === "function" && !body.$$stub); + } + + Opal.alias = function(obj, name, old) { + var id = $jsid(name), + old_id = $jsid(old), + body, + alias; + + // Aliasing on main means aliasing on Object... + if (typeof obj.$$prototype === 'undefined') { + obj = Opal.Object; + } + + body = obj.$$prototype[old_id]; + + // When running inside #instance_eval the alias refers to class methods. + if (obj.$$eval) { + return Opal.alias(Opal.get_singleton_class(obj), name, old); + } + + if (!is_method_body(body)) { + var ancestor = obj.$$super; + + while (typeof(body) !== "function" && ancestor) { + body = ancestor[old_id]; + ancestor = ancestor.$$super; + } + + if (!is_method_body(body) && obj.$$is_module) { + // try to look into Object + body = Opal.Object.$$prototype[old_id]; + } + + if (!is_method_body(body)) { + $raise(Opal.NameError, "undefined method `" + old + "' for class `" + obj.$name() + "'"); + } + } + + // If the body is itself an alias use the original body + // to keep the max depth at 1. + if (body.$$alias_of) body = body.$$alias_of; + + // We need a wrapper because otherwise properties + // would be overwritten on the original body. + alias = function() { + var block = alias.$$p, args, i, ii; + + args = new Array(arguments.length); + for(i = 0, ii = arguments.length; i < ii; i++) { + args[i] = arguments[i]; + } + + alias.$$p = null; + + return Opal.send(this, body, args, block); + }; + + // Assign the 'length' value with defineProperty because + // in strict mode the property is not writable. + // It doesn't work in older browsers (like Chrome 38), where + // an exception is thrown breaking Opal altogether. + try { + Object.defineProperty(alias, 'length', { value: body.length }); + } catch (e) {} + + // Try to make the browser pick the right name + alias.displayName = name; + + alias.$$arity = body.$$arity == null ? body.length : body.$$arity; + alias.$$parameters = body.$$parameters; + alias.$$source_location = body.$$source_location; + alias.$$alias_of = body; + alias.$$alias_name = name; + + Opal.defn(obj, id, alias); + + return obj; + }; + + Opal.alias_gvar = function(new_name, old_name) { + Object.defineProperty($gvars, new_name, { + configurable: true, + enumerable: true, + get: function() { + return $gvars[old_name]; + }, + set: function(new_value) { + $gvars[old_name] = new_value; + } + }); + return nil; + }; + + Opal.alias_native = function(obj, name, native_name) { + var id = $jsid(name), + body = obj.$$prototype[native_name]; + + if (typeof(body) !== "function" || body.$$stub) { + $raise(Opal.NameError, "undefined native method `" + native_name + "' for class `" + obj.$name() + "'"); + } + + Opal.defn(obj, id, body); + + return obj; + }; + + + // Hashes + // ------ + + Opal.hash_init = function(hash) { + hash.$$smap = Object.create(null); + hash.$$map = Object.create(null); + hash.$$keys = []; + }; + + Opal.hash_clone = function(from_hash, to_hash) { + to_hash.$$none = from_hash.$$none; + to_hash.$$proc = from_hash.$$proc; + + for (var i = 0, keys = from_hash.$$keys, smap = from_hash.$$smap, len = keys.length, key, value; i < len; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.hash_put(to_hash, key, value); + } + }; + + Opal.hash_put = function(hash, key, value) { + if (key.$$is_string) { + if (!$has_own(hash.$$smap, key)) { + hash.$$keys.push(key); + } + hash.$$smap[key] = value; + return; + } + + var key_hash, bucket, last_bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if (!$has_own(hash.$$map, key_hash)) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + hash.$$map[key_hash] = bucket; + return; + } + + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + last_bucket = undefined; + bucket.value = value; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + last_bucket.next = bucket; + } + }; + + Opal.hash_get = function(hash, key) { + if (key.$$is_string) { + if ($has_own(hash.$$smap, key)) { + return hash.$$smap[key]; + } + return; + } + + var key_hash, bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if ($has_own(hash.$$map, key_hash)) { + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + return bucket.value; + } + bucket = bucket.next; + } + } + }; + + Opal.hash_delete = function(hash, key) { + var i, keys = hash.$$keys, length = keys.length, value, key_tmp; + + if (key.$$is_string) { + if (typeof key !== "string") key = key.valueOf(); + + if (!$has_own(hash.$$smap, key)) { + return; + } + + for (i = 0; i < length; i++) { + key_tmp = keys[i]; + + if (key_tmp.$$is_string && typeof key_tmp !== "string") { + key_tmp = key_tmp.valueOf(); + } + + if (key_tmp === key) { + keys.splice(i, 1); + break; + } + } + + value = hash.$$smap[key]; + delete hash.$$smap[key]; + return value; + } + + var key_hash = key.$hash(); + + if (!$has_own(hash.$$map, key_hash)) { + return; + } + + var bucket = hash.$$map[key_hash], last_bucket; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + value = bucket.value; + + for (i = 0; i < length; i++) { + if (keys[i] === bucket) { + keys.splice(i, 1); + break; + } + } + + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[key_hash] = bucket.next; + } + else { + delete hash.$$map[key_hash]; + } + + return value; + } + last_bucket = bucket; + bucket = bucket.next; + } + }; + + Opal.hash_rehash = function(hash) { + for (var i = 0, length = hash.$$keys.length, key_hash, bucket, last_bucket; i < length; i++) { + + if (hash.$$keys[i].$$is_string) { + continue; + } + + key_hash = hash.$$keys[i].key.$hash(); + + if (key_hash === hash.$$keys[i].key_hash) { + continue; + } + + bucket = hash.$$map[hash.$$keys[i].key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[hash.$$keys[i].key_hash] = bucket.next; + } + else { + delete hash.$$map[hash.$$keys[i].key_hash]; + } + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + hash.$$keys[i].key_hash = key_hash; + + if (!$has_own(hash.$$map, key_hash)) { + hash.$$map[key_hash] = hash.$$keys[i]; + continue; + } + + bucket = hash.$$map[key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + last_bucket = undefined; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + last_bucket.next = hash.$$keys[i]; + } + } + }; + + Opal.hash = function() { + var arguments_length = arguments.length, args, hash, i, length, key, value; + + if (arguments_length === 1 && arguments[0].$$is_hash) { + return arguments[0]; + } + + hash = new Opal.Hash(); + Opal.hash_init(hash); + + if (arguments_length === 1) { + args = arguments[0]; + + if (arguments[0].$$is_array) { + length = args.length; + + for (i = 0; i < length; i++) { + if (args[i].length !== 2) { + $raise(Opal.ArgumentError, "value not of length 2: " + args[i].$inspect()); + } + + key = args[i][0]; + value = args[i][1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + } + else { + args = arguments[0]; + for (key in args) { + if ($has_own(args, key)) { + value = args[key]; + + Opal.hash_put(hash, key, value); + } + } + + return hash; + } + } + + if (arguments_length % 2 !== 0) { + $raise(Opal.ArgumentError, "odd number of arguments for Hash"); + } + + for (i = 0; i < arguments_length; i += 2) { + key = arguments[i]; + value = arguments[i + 1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + }; + + // A faster Hash creator for hashes that just use symbols and + // strings as keys. The map and keys array can be constructed at + // compile time, so they are just added here by the constructor + // function. + // + Opal.hash2 = function(keys, smap) { + var hash = new Opal.Hash(); + + hash.$$smap = smap; + hash.$$map = Object.create(null); + hash.$$keys = keys; + + return hash; + }; + + // Create a new range instance with first and last values, and whether the + // range excludes the last value. + // + Opal.range = function(first, last, exc) { + var range = new Opal.Range(); + range.begin = first; + range.end = last; + range.excl = exc; + + return range; + }; + + var reserved_ivar_names = [ + // properties + "constructor", "displayName", "__count__", "__noSuchMethod__", + "__parent__", "__proto__", + // methods + "hasOwnProperty", "valueOf" + ]; + + // Get the ivar name for a given name. + // Mostly adds a trailing $ to reserved names. + // + Opal.ivar = function(name) { + if (reserved_ivar_names.indexOf(name) !== -1) { + name += "$"; + } + + return name; + }; + + // Support for #freeze + // ------------------- + + // helper that can be used from methods + function $deny_frozen_access(obj) { + if (obj.$$frozen) { + $raise(Opal.FrozenError, "can't modify frozen " + (obj.$class()) + ": " + (obj), Opal.hash2(["receiver"], {"receiver": obj})); + } + } Opal.deny_frozen_access = $deny_frozen_access; + + // common #freeze runtime support + Opal.freeze = function(obj) { + $prop(obj, "$$frozen", true); + + // set $$id + if (!obj.hasOwnProperty('$$id')) { $prop(obj, '$$id', $uid()); } + + if (obj.hasOwnProperty('$$meta')) { + // freeze $$meta if it has already been set + obj.$$meta.$freeze(); + } else { + // ensure $$meta can be set lazily, $$meta is frozen when set in runtime.js + $prop(obj, '$$meta', null); + } + + // $$comparable is used internally and set multiple times + // defining it before sealing ensures it can be modified later on + if (!obj.hasOwnProperty('$$comparable')) { $prop(obj, '$$comparable', null); } + + // seal the Object + Object.seal(obj); + + return obj; + }; + + // freze props, make setters of instance variables throw FrozenError + Opal.freeze_props = function(obj) { + var prop, prop_type, desc; + + for(prop in obj) { + prop_type = typeof(prop); + + // prop_type "object" here is a String(), skip $ props + if ((prop_type === "string" || prop_type === "object") && prop[0] === '$') { + continue; + } + + desc = Object.getOwnPropertyDescriptor(obj, prop); + if (desc && desc.enumerable && desc.writable) { + // create closure to retain current value as cv + // for Opal 2.0 let for cv should do the trick, instead of a function + (function() { + // set v to undefined, as if the property is not set + var cv = obj[prop]; + Object.defineProperty(obj, prop, { + get: function() { return cv; }, + set: function(_val) { $deny_frozen_access(obj); }, + enumerable: true + }); + })(); + } + } + }; + + // Regexps + // ------- + + // Escape Regexp special chars letting the resulting string be used to build + // a new Regexp. + // + Opal.escape_regexp = function(str) { + return str.replace(/([-[\]\/{}()*+?.^$\\| ])/g, '\\$1') + .replace(/[\n]/g, '\\n') + .replace(/[\r]/g, '\\r') + .replace(/[\f]/g, '\\f') + .replace(/[\t]/g, '\\t'); + }; + + // Create a global Regexp from a RegExp object and cache the result + // on the object itself ($$g attribute). + // + Opal.global_regexp = function(pattern) { + if (pattern.global) { + return pattern; // RegExp already has the global flag + } + if (pattern.$$g == null) { + pattern.$$g = new RegExp(pattern.source, (pattern.multiline ? 'gm' : 'g') + (pattern.ignoreCase ? 'i' : '')); + } else { + pattern.$$g.lastIndex = null; // reset lastIndex property + } + return pattern.$$g; + }; + + // Create a global multiline Regexp from a RegExp object and cache the result + // on the object itself ($$gm or $$g attribute). + // + Opal.global_multiline_regexp = function(pattern) { + var result, flags; + + // RegExp already has the global and multiline flag + if (pattern.global && pattern.multiline) return pattern; + + flags = 'gm' + (pattern.ignoreCase ? 'i' : ''); + if (pattern.multiline) { + // we are using the $$g attribute because the Regexp is already multiline + if (pattern.$$g == null) { + pattern.$$g = new RegExp(pattern.source, flags); + } + result = pattern.$$g; + } else { + if (pattern.$$gm == null) { + pattern.$$gm = new RegExp(pattern.source, flags); + } + result = pattern.$$gm; + } + result.lastIndex = null; // reset lastIndex property + return result; + }; + + // Combine multiple regexp parts together + Opal.regexp = function(parts, flags) { + var part; + var ignoreCase = typeof flags !== 'undefined' && flags && flags.indexOf('i') >= 0; + + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + if (part instanceof RegExp) { + if (part.ignoreCase !== ignoreCase) + Opal.Kernel.$warn( + "ignore case doesn't match for " + part.source.$inspect(), + Opal.hash({uplevel: 1}) + ); + + part = part.source; + } + if (part === '') part = '(?:' + part + ')'; + parts[i] = part; + } + + if (flags) { + return new RegExp(parts.join(''), flags); + } else { + return new RegExp(parts.join('')); + } + }; + + // Require system + // -------------- + + Opal.modules = {}; + Opal.loaded_features = ['corelib/runtime']; + Opal.current_dir = '.'; + Opal.require_table = {'corelib/runtime': true}; + + Opal.normalize = function(path) { + var parts, part, new_parts = [], SEPARATOR = '/'; + + if (Opal.current_dir !== '.') { + path = Opal.current_dir.replace(/\/*$/, '/') + path; + } + + path = path.replace(/^\.\//, ''); + path = path.replace(/\.(rb|opal|js)$/, ''); + parts = path.split(SEPARATOR); + + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + if (part === '') continue; + (part === '..') ? new_parts.pop() : new_parts.push(part); + } + + return new_parts.join(SEPARATOR); + }; + + Opal.loaded = function(paths) { + var i, l, path; + + for (i = 0, l = paths.length; i < l; i++) { + path = Opal.normalize(paths[i]); + + if (Opal.require_table[path]) { + continue; + } + + Opal.loaded_features.push(path); + Opal.require_table[path] = true; + } + }; + + Opal.load_normalized = function(path) { + Opal.loaded([path]); + + var module = Opal.modules[path]; + + if (module) { + var retval = module(Opal); + if (typeof Promise !== 'undefined' && retval instanceof Promise) { + // A special case of require having an async top: + // We will need to await it. + return retval.then($return_val(true)); + } + } + else { + var severity = Opal.config.missing_require_severity; + var message = 'cannot load such file -- ' + path; + + if (severity === "error") { + $raise(Opal.LoadError, message); + } + else if (severity === "warning") { + console.warn('WARNING: LoadError: ' + message); + } + } + + return true; + }; + + Opal.load = function(path) { + path = Opal.normalize(path); + + return Opal.load_normalized(path); + }; + + Opal.require = function(path) { + path = Opal.normalize(path); + + if (Opal.require_table[path]) { + return false; + } + + return Opal.load_normalized(path); + }; + + + // Strings + // ------- + + Opal.encodings = Object.create(null); + + // Sets the encoding on a string, will treat string literals as frozen strings + // raising a FrozenError. + // + // @param str [String] the string on which the encoding should be set + // @param name [String] the canonical name of the encoding + // @param type [String] possible values are either `"encoding"`, `"internal_encoding"`, or `undefined + Opal.set_encoding = function(str, name, type) { + if (typeof type === "undefined") type = "encoding"; + if (typeof str === 'string' || str.$$frozen === true) + $raise(Opal.FrozenError, "can't modify frozen String"); + + var encoding = Opal.find_encoding(name); + + if (encoding === str[type]) { return str; } + + str[type] = encoding; + + return str; + }; + + // Fetches the encoding for the given name or raises ArgumentError. + Opal.find_encoding = function(name) { + var register = Opal.encodings; + var encoding = register[name] || register[name.toUpperCase()]; + if (!encoding) $raise(Opal.ArgumentError, "unknown encoding name - " + name); + return encoding; + }; + + // @returns a String object with the encoding set from a string literal + Opal.enc = function(str, name) { + var dup = new String(str); + dup = Opal.set_encoding(dup, name); + dup.internal_encoding = dup.encoding; + return dup + }; + + // @returns a String object with the internal encoding set to Binary + Opal.binary = function(str) { + var dup = new String(str); + return Opal.set_encoding(dup, "binary", "internal_encoding"); + }; + + Opal.last_promise = null; + Opal.promise_unhandled_exception = false; + + // Run a block of code, but if it returns a Promise, don't run the next + // one, but queue it. + Opal.queue = function(proc) { + if (Opal.last_promise) { + // The async path is taken only if anything before returned a + // Promise(V2). + Opal.last_promise = Opal.last_promise.then(function() { + if (!Opal.promise_unhandled_exception) return proc(Opal); + })['catch'](function(error) { + if (Opal.respond_to(error, '$full_message')) { + error = error.$full_message(); + } + console.error(error); + // Abort further execution + Opal.promise_unhandled_exception = true; + Opal.exit(1); + }); + return Opal.last_promise; + } + else { + var ret = proc(Opal); + if (typeof Promise === 'function' && typeof ret === 'object' && ret instanceof Promise) { + Opal.last_promise = ret; + } + return ret; + } + }; + + // Operator helpers + // ---------------- + + function are_both_numbers(l,r) { return typeof(l) === 'number' && typeof(r) === 'number' } + + Opal.rb_plus = function(l,r) { return are_both_numbers(l,r) ? l + r : l['$+'](r); }; + Opal.rb_minus = function(l,r) { return are_both_numbers(l,r) ? l - r : l['$-'](r); }; + Opal.rb_times = function(l,r) { return are_both_numbers(l,r) ? l * r : l['$*'](r); }; + Opal.rb_divide = function(l,r) { return are_both_numbers(l,r) ? l / r : l['$/'](r); }; + Opal.rb_lt = function(l,r) { return are_both_numbers(l,r) ? l < r : l['$<'](r); }; + Opal.rb_gt = function(l,r) { return are_both_numbers(l,r) ? l > r : l['$>'](r); }; + Opal.rb_le = function(l,r) { return are_both_numbers(l,r) ? l <= r : l['$<='](r); }; + Opal.rb_ge = function(l,r) { return are_both_numbers(l,r) ? l >= r : l['$>='](r); }; + + // Optimized helpers for calls like $truthy((a)['$==='](b)) -> $eqeqeq(a, b) + function are_both_numbers_or_strings(lhs, rhs) { + return (typeof lhs === 'number' && typeof rhs === 'number') || + (typeof lhs === 'string' && typeof rhs === 'string'); + } + + function $eqeq(lhs, rhs) { + return are_both_numbers_or_strings(lhs,rhs) ? lhs === rhs : $truthy((lhs)['$=='](rhs)); + } Opal.eqeq = $eqeq; + Opal.eqeqeq = function(lhs, rhs) { + return are_both_numbers_or_strings(lhs,rhs) ? lhs === rhs : $truthy((lhs)['$==='](rhs)); + }; + Opal.neqeq = function(lhs, rhs) { + return are_both_numbers_or_strings(lhs,rhs) ? lhs !== rhs : $truthy((lhs)['$!='](rhs)); + }; + Opal.not = function(arg) { + if (undefined === arg || null === arg || false === arg || nil === arg) return true; + if (true === arg || arg['$!'].$$pristine) return false; + return $truthy(arg['$!']()); + }; + + // Shortcuts - optimized function generators for simple kinds of functions + function $return_val(arg) { + return function() { + return arg; + } + } + Opal.return_val = $return_val; + + Opal.return_self = function() { + return this; + }; + Opal.return_ivar = function(ivar) { + return function() { + if (this[ivar] == null) { return nil; } + return this[ivar]; + } + }; + Opal.assign_ivar = function(ivar) { + return function(val) { + $deny_frozen_access(this); + return this[ivar] = val; + } + }; + Opal.assign_ivar_val = function(ivar, static_val) { + return function() { + $deny_frozen_access(this); + return this[ivar] = static_val; + } + }; + + // Primitives for handling parameters + Opal.ensure_kwargs = function(kwargs) { + if (kwargs == null) { + return Opal.hash2([], {}); + } else if (kwargs.$$is_hash) { + return kwargs; + } else { + $raise(Opal.ArgumentError, 'expected kwargs'); + } + }; + + Opal.get_kwarg = function(kwargs, key) { + if (!$has_own(kwargs.$$smap, key)) { + $raise(Opal.ArgumentError, 'missing keyword: '+key); + } + return kwargs.$$smap[key]; + }; + + // Arrays of size > 32 elements that contain only strings, + // symbols, integers and nils are compiled as a self-extracting + // string. + Opal.large_array_unpack = function(str) { + var array = str.split(","), length = array.length, i; + for (i = 0; i < length; i++) { + switch(array[i][0]) { + case undefined: + array[i] = nil; + break; + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + array[i] = +array[i]; + } + } + return array; + }; + + // Initialization + // -------------- + Opal.BasicObject = BasicObject = $allocate_class('BasicObject', null); + Opal.Object = _Object = $allocate_class('Object', Opal.BasicObject); + Opal.Module = Module = $allocate_class('Module', Opal.Object); + Opal.Class = Class = $allocate_class('Class', Opal.Module); + Opal.Opal = _Opal = $allocate_module('Opal'); + Opal.Kernel = Kernel = $allocate_module('Kernel'); + + $set_proto(Opal.BasicObject, Opal.Class.$$prototype); + $set_proto(Opal.Object, Opal.Class.$$prototype); + $set_proto(Opal.Module, Opal.Class.$$prototype); + $set_proto(Opal.Class, Opal.Class.$$prototype); + + // BasicObject can reach itself, avoid const_set to skip the $$base_module logic + BasicObject.$$const.BasicObject = BasicObject; + + // Assign basic constants + $const_set(_Object, "BasicObject", BasicObject); + $const_set(_Object, "Object", _Object); + $const_set(_Object, "Module", Module); + $const_set(_Object, "Class", Class); + $const_set(_Object, "Opal", _Opal); + $const_set(_Object, "Kernel", Kernel); + + // Fix booted classes to have correct .class value + BasicObject.$$class = Class; + _Object.$$class = Class; + Module.$$class = Class; + Class.$$class = Class; + _Opal.$$class = Module; + Kernel.$$class = Module; + + // Forward .toString() to #to_s + $prop(_Object.$$prototype, 'toString', function() { + var to_s = this.$to_s(); + if (to_s.$$is_string && typeof(to_s) === 'object') { + // a string created using new String('string') + return to_s.valueOf(); + } else { + return to_s; + } + }); + + // Make Kernel#require immediately available as it's needed to require all the + // other corelib files. + $prop(_Object.$$prototype, '$require', Opal.require); + + // Instantiate the main object + Opal.top = new _Object(); + Opal.top.$to_s = Opal.top.$inspect = $return_val('main'); + Opal.top.$define_method = top_define_method; + + // Foward calls to define_method on the top object to Object + function top_define_method() { + var args = $slice(arguments); + var block = top_define_method.$$p; + top_define_method.$$p = null; + return Opal.send(_Object, 'define_method', args, block) + } + // Nil + Opal.NilClass = $allocate_class('NilClass', Opal.Object); + $const_set(_Object, 'NilClass', Opal.NilClass); + nil = Opal.nil = new Opal.NilClass(); + nil.$$id = nil_id; + nil.call = nil.apply = function() { $raise(Opal.LocalJumpError, 'no block given'); }; + nil.$$frozen = true; + nil.$$comparable = false; + Object.seal(nil); + + Opal.thrower = function(type) { + var thrower = new Error('unexpected '+type); + thrower.$thrower_type = type; + thrower.$throw = function(value) { + if (value == null) value = nil; + thrower.$v = value; + throw thrower; + }; + return thrower; + }; + + Opal.t_eval_return = Opal.thrower("return"); + + TypeError.$$super = Error; + + // If enable-file-source-embed compiler option is enabled, each module loaded will add its + // sources to this object + Opal.file_sources = {}; + }).call(undefined); + Opal.loaded(["corelib/runtime.js"]); + Opal.modules["corelib/helpers"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $type_error = Opal.type_error, $coerce_to = Opal.coerce_to, $module = Opal.module, $defs = Opal.defs, $slice = Opal.slice, $eqeqeq = Opal.eqeqeq, $Kernel = Opal.Kernel, $truthy = Opal.truthy, $Opal = Opal.Opal, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('===,raise,respond_to?,nil?,__send__,<=>,class,coerce_to!,new,to_s,__id__'); + return (function($base) { + var self = $module($base, 'Opal'); + + + + $defs(self, '$bridge', function $$bridge(constructor, klass) { + + return Opal.bridge(constructor, klass); + }); + $defs(self, '$coerce_to!', function $Opal_coerce_to$excl$1(object, type, method, $a) { + var $post_args, args, coerced = nil; + + + $post_args = $slice(arguments, 3); + args = $post_args; + coerced = $coerce_to(object, type, method, args); + if (!$eqeqeq(type, coerced)) { + $Kernel.$raise($type_error(object, type, method, coerced)); + } return coerced; + }, -4); + $defs(self, '$coerce_to?', function $Opal_coerce_to$ques$2(object, type, method, $a) { + var $post_args, args, coerced = nil; + + + $post_args = $slice(arguments, 3); + args = $post_args; + if (!$truthy(object['$respond_to?'](method))) { + return nil + } coerced = $coerce_to(object, type, method, args); + if ($truthy(coerced['$nil?']())) { + return nil + } if (!$eqeqeq(type, coerced)) { + $Kernel.$raise($type_error(object, type, method, coerced)); + } return coerced; + }, -4); + $defs(self, '$try_convert', function $$try_convert(object, type, method) { + + + if ($eqeqeq(type, object)) { + return object + } if ($truthy(object['$respond_to?'](method))) { + return object.$__send__(method) + } else { + return nil + } }); + $defs(self, '$compare', function $$compare(a, b) { + var compare = nil; + + + compare = a['$<=>'](b); + if ($truthy(compare === nil)) { + $Kernel.$raise($$$('ArgumentError'), "comparison of " + (a.$class()) + " with " + (b.$class()) + " failed"); + } return compare; + }); + $defs(self, '$destructure', function $$destructure(args) { + + + if (args.length == 1) { + return args[0]; + } + else if (args.$$is_array) { + return args; + } + else { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return args_ary; + } + + }); + $defs(self, '$respond_to?', function $Opal_respond_to$ques$3(obj, method, include_all) { + + + if (include_all == null) include_all = false; + + if (obj == null || !obj.$$class) { + return false; + } + return obj['$respond_to?'](method, include_all); + }, -3); + $defs(self, '$instance_variable_name!', function $Opal_instance_variable_name$excl$4(name) { + + + name = $Opal['$coerce_to!'](name, $$$('String'), "to_str"); + if (!$truthy(/^@[a-zA-Z_][a-zA-Z0-9_]*?$/.test(name))) { + $Kernel.$raise($$$('NameError').$new("'" + (name) + "' is not allowed as an instance variable name", name)); + } return name; + }); + $defs(self, '$class_variable_name!', function $Opal_class_variable_name$excl$5(name) { + + + name = $Opal['$coerce_to!'](name, $$$('String'), "to_str"); + if ($truthy(name.length < 3 || name.slice(0,2) !== '@@')) { + $Kernel.$raise($$$('NameError').$new("`" + (name) + "' is not allowed as a class variable name", name)); + } return name; + }); + $defs(self, '$const_name?', function $Opal_const_name$ques$6(const_name) { + + + if (typeof const_name !== 'string') { + (const_name = $Opal['$coerce_to!'](const_name, $$$('String'), "to_str")); + } + + return const_name[0] === const_name[0].toUpperCase() + + }); + $defs(self, '$const_name!', function $Opal_const_name$excl$7(const_name) { + var self = this; + + + if ($truthy((($$$('::', 'String', 'skip_raise')) ? 'constant' : nil))) { + const_name = $Opal['$coerce_to!'](const_name, $$$('String'), "to_str"); + } + if (!const_name || const_name[0] != const_name[0].toUpperCase()) { + self.$raise($$$('NameError'), "wrong constant name " + (const_name)); + } + return const_name; + }); + $defs(self, '$pristine', function $$pristine(owner_class, $a) { + var $post_args, method_names; + + + $post_args = $slice(arguments, 1); + method_names = $post_args; + + var method_name, method; + for (var i = method_names.length - 1; i >= 0; i--) { + method_name = method_names[i]; + method = owner_class.$$prototype[Opal.jsid(method_name)]; + + if (method && !method.$$stub) { + method.$$pristine = true; + } + } + return nil; + }, -2); + var inspect_stack = []; + return $defs(self, '$inspect', function $$inspect(value) { + var e = nil; + var pushed = false; + + return (function() { try { + try { + + + if (value === null) { + // JS null value + return 'null'; + } + else if (value === undefined) { + // JS undefined value + return 'undefined'; + } + else if (typeof value.$$class === 'undefined') { + // JS object / other value that is not bridged + return Object.prototype.toString.apply(value); + } + else if (typeof value.$inspect !== 'function' || value.$inspect.$$stub) { + // BasicObject and friends + return "#<" + (value.$$class) + ":0x" + (value.$__id__().$to_s(16)) + ">" + } + else if (inspect_stack.indexOf(value.$__id__()) !== -1) { + // inspect recursing inside inspect to find out about the + // same object + return "#<" + (value.$$class) + ":0x" + (value.$__id__().$to_s(16)) + ">" + } + else { + // anything supporting Opal + inspect_stack.push(value.$__id__()); + pushed = true; + return value.$inspect(); + } + ; + return nil; + } catch ($err) { + if (Opal.rescue($err, [$$$('Exception')])) {(e = $err); + try { + return "#<" + (value.$$class) + ":0x" + (value.$__id__().$to_s(16)) + ">" + } finally { Opal.pop_exception(); } + } else { throw $err; } + } + } finally { + if (pushed) inspect_stack.pop(); + } })(); }, -1); + })('::') + }; + + Opal.modules["corelib/module"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $truthy = Opal.truthy, $coerce_to = Opal.coerce_to, $const_set = Opal.const_set, $Object = Opal.Object, $return_ivar = Opal.return_ivar, $assign_ivar = Opal.assign_ivar, $ivar = Opal.ivar, $deny_frozen_access = Opal.deny_frozen_access, $freeze = Opal.freeze, $prop = Opal.prop, $jsid = Opal.jsid, $klass = Opal.klass, $defs = Opal.defs, $send = Opal.send, $def = Opal.def, $eqeqeq = Opal.eqeqeq, $Module = Opal.Module, $Kernel = Opal.Kernel, $rb_lt = Opal.rb_lt, $rb_gt = Opal.rb_gt, $slice = Opal.slice, $to_a = Opal.to_a, $hash2 = Opal.hash2, $Opal = Opal.Opal, $return_val = Opal.return_val, $eqeq = Opal.eqeq, $lambda = Opal.lambda, $range = Opal.range, $send2 = Opal.send2, $find_super = Opal.find_super, $alias = Opal.alias, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('module_eval,to_proc,===,raise,equal?,<,>,nil?,attr_reader,attr_writer,warn,attr_accessor,const_name?,class_variable_name!,pristine,const_name!,=~,new,inject,split,const_get,==,start_with?,!~,bind,call,class,frozen?,name,append_features,included,cover?,size,merge,compile,proc,any?,prepend_features,prepended,to_s,__id__,constants,include?,copy_class_variables,copy_constants,class_exec,module_exec,inspect'); + + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Module'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $defs(self, '$allocate', function $$allocate() { + var self = this; + + + var module = Opal.allocate_module(nil, function(){}); + // Link the prototype of Module subclasses + if (self !== Opal.Module) Object.setPrototypeOf(module, self.$$prototype); + return module; + + }); + + $def(self, '$initialize', function $$initialize() { + var block = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + if ((block !== nil)) { + return $send(self, 'module_eval', [], block.$to_proc()) + } else { + return nil + } }); + + $def(self, '$===', function $Module_$eq_eq_eq$1(object) { + var self = this; + + + if ($truthy(object == null)) { + return false + } return Opal.is_a(object, self); }); + + $def(self, '$<', function $Module_$lt$2(other) { + var self = this; + + + if (!$eqeqeq($Module, other)) { + $Kernel.$raise($$$('TypeError'), "compared with non class/module"); + } + var working = self, + ancestors, + i, length; + + if (working === other) { + return false; + } + + for (i = 0, ancestors = Opal.ancestors(self), length = ancestors.length; i < length; i++) { + if (ancestors[i] === other) { + return true; + } + } + + for (i = 0, ancestors = Opal.ancestors(other), length = ancestors.length; i < length; i++) { + if (ancestors[i] === self) { + return false; + } + } + + return nil; + }); + + $def(self, '$<=', function $Module_$lt_eq$3(other) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self['$equal?'](other)))) { + return $ret_or_1 + } else { + return $rb_lt(self, other) + } + }); + + $def(self, '$>', function $Module_$gt$4(other) { + var self = this; + + + if (!$eqeqeq($Module, other)) { + $Kernel.$raise($$$('TypeError'), "compared with non class/module"); + } return $rb_lt(other, self); + }); + + $def(self, '$>=', function $Module_$gt_eq$5(other) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self['$equal?'](other)))) { + return $ret_or_1 + } else { + return $rb_gt(self, other) + } + }); + + $def(self, '$<=>', function $Module_$lt_eq_gt$6(other) { + var self = this, lt = nil; + + + + if (self === other) { + return 0; + } + if (!$eqeqeq($Module, other)) { + return nil + } lt = $rb_lt(self, other); + if ($truthy(lt['$nil?']())) { + return nil + } if ($truthy(lt)) { + return -1 + } else { + return 1 + } }); + + $def(self, '$alias_method', function $$alias_method(newname, oldname) { + var self = this; + + + $deny_frozen_access(self); + newname = $coerce_to(newname, $$$('String'), 'to_str'); + oldname = $coerce_to(oldname, $$$('String'), 'to_str'); + Opal.alias(self, newname, oldname); + return self; + }); + + $def(self, '$alias_native', function $$alias_native(mid, jsid) { + var self = this; + + + if (jsid == null) jsid = mid; + $deny_frozen_access(self); + Opal.alias_native(self, mid, jsid); + return self; + }, -2); + + $def(self, '$ancestors', function $$ancestors() { + var self = this; + + return Opal.ancestors(self); + }); + + $def(self, '$append_features', function $$append_features(includer) { + var self = this; + + + $deny_frozen_access(includer); + Opal.append_features(self, includer); + return self; + }); + + $def(self, '$attr_accessor', function $$attr_accessor($a) { + var $post_args, names, self = this; + + + $post_args = $slice(arguments); + names = $post_args; + $send(self, 'attr_reader', $to_a(names)); + return $send(self, 'attr_writer', $to_a(names)); + }, -1); + + $def(self, '$attr', function $$attr($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + + if (args.length == 2 && (args[1] === true || args[1] === false)) { + self.$warn("optional boolean argument is obsoleted", $hash2(["uplevel"], {"uplevel": 1})); + + args[1] ? self.$attr_accessor(args[0]) : self.$attr_reader(args[0]); + return nil; + } + return $send(self, 'attr_reader', $to_a(args)); + }, -1); + + $def(self, '$attr_reader', function $$attr_reader($a) { + var $post_args, names, self = this; + + + $post_args = $slice(arguments); + names = $post_args; + + $deny_frozen_access(self); + + var proto = self.$$prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = $jsid(name), + ivar = $ivar(name); + + var body = $return_ivar(ivar); + + // initialize the instance variable as nil + Opal.prop(proto, ivar, nil); + + body.$$parameters = []; + body.$$arity = 0; + + Opal.defn(self, id, body); + } + return nil; + }, -1); + + $def(self, '$attr_writer', function $$attr_writer($a) { + var $post_args, names, self = this; + + + $post_args = $slice(arguments); + names = $post_args; + + $deny_frozen_access(self); + + var proto = self.$$prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = $jsid(name + '='), + ivar = $ivar(name); + + var body = $assign_ivar(ivar); + + body.$$parameters = [['req']]; + body.$$arity = 1; + + // initialize the instance variable as nil + Opal.prop(proto, ivar, nil); + + Opal.defn(self, id, body); + } + return nil; + }, -1); + + $def(self, '$autoload', function $$autoload(const$, path) { + var self = this; + + + $deny_frozen_access(self); + + if (!$$('Opal')['$const_name?'](const$)) { + $Kernel.$raise($$$('NameError'), "autoload must be constant name: " + (const$)); + } + + if (path == "") { + $Kernel.$raise($$$('ArgumentError'), "empty file name"); + } + + if (!self.$$const.hasOwnProperty(const$)) { + if (!self.$$autoload) { + self.$$autoload = {}; + } + Opal.const_cache_version++; + self.$$autoload[const$] = { path: path, loaded: false, required: false, success: false, exception: false }; + + if (self.$const_added && !self.$const_added.$$pristine) { + self.$const_added(const$); + } + } + return nil; + + }); + + $def(self, '$autoload?', function $Module_autoload$ques$7(const$) { + var self = this; + + + if (self.$$autoload && self.$$autoload[const$] && !self.$$autoload[const$].required && !self.$$autoload[const$].success) { + return self.$$autoload[const$].path; + } + + var ancestors = self.$ancestors(); + + for (var i = 0, length = ancestors.length; i < length; i++) { + if (ancestors[i].$$autoload && ancestors[i].$$autoload[const$] && !ancestors[i].$$autoload[const$].required && !ancestors[i].$$autoload[const$].success) { + return ancestors[i].$$autoload[const$].path; + } + } + return nil; + + }); + + $def(self, '$class_variables', function $$class_variables() { + var self = this; + + return Object.keys(Opal.class_variables(self)); + }); + + $def(self, '$class_variable_get', function $$class_variable_get(name) { + var self = this; + + + name = $Opal['$class_variable_name!'](name); + return Opal.class_variable_get(self, name, false); }); + + $def(self, '$class_variable_set', function $$class_variable_set(name, value) { + var self = this; + + + $deny_frozen_access(self); + name = $Opal['$class_variable_name!'](name); + return Opal.class_variable_set(self, name, value); }); + + $def(self, '$class_variable_defined?', function $Module_class_variable_defined$ques$8(name) { + var self = this; + + + name = $Opal['$class_variable_name!'](name); + return Opal.class_variables(self).hasOwnProperty(name); }); + + $def(self, '$const_added', $return_val(nil)); + $Opal.$pristine(self, "const_added"); + + $def(self, '$remove_class_variable', function $$remove_class_variable(name) { + var self = this; + + + $deny_frozen_access(self); + name = $Opal['$class_variable_name!'](name); + + if (Opal.hasOwnProperty.call(self.$$cvars, name)) { + var value = self.$$cvars[name]; + delete self.$$cvars[name]; + return value; + } else { + $Kernel.$raise($$$('NameError'), "cannot remove " + (name) + " for " + (self)); + } + }); + + $def(self, '$constants', function $$constants(inherit) { + var self = this; + + + if (inherit == null) inherit = true; + return Opal.constants(self, inherit); }, -1); + $defs(self, '$constants', function $$constants(inherit) { + var self = this; + + if (inherit == null) { + var nesting = (self.$$nesting || []).concat($Object), + constant, constants = {}, + i, ii; + + for(i = 0, ii = nesting.length; i < ii; i++) { + for (constant in nesting[i].$$const) { + constants[constant] = true; + } + } + return Object.keys(constants); + } else { + return Opal.constants(self, inherit) + } + }, -1); + $defs(self, '$nesting', function $$nesting() { + var self = this; + + return self.$$nesting || []; + }); + + $def(self, '$const_defined?', function $Module_const_defined$ques$9(name, inherit) { + var self = this; + + + if (inherit == null) inherit = true; + name = $$('Opal')['$const_name!'](name); + if (!$truthy(name['$=~']($$$($Opal, 'CONST_NAME_REGEXP')))) { + $Kernel.$raise($$$('NameError').$new("wrong constant name " + (name), name)); + } + var module, modules = [self], i, ii; + + // Add up ancestors if inherit is true + if (inherit) { + modules = modules.concat(Opal.ancestors(self)); + + // Add Object's ancestors if it's a module – modules have no ancestors otherwise + if (self.$$is_module) { + modules = modules.concat([$Object]).concat(Opal.ancestors($Object)); + } + } + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + if (module.$$const[name] != null) { return true; } + if ( + module.$$autoload && + module.$$autoload[name] && + !module.$$autoload[name].required && + !module.$$autoload[name].success + ) { + return true; + } + } + + return false; + }, -2); + + $def(self, '$const_get', function $$const_get(name, inherit) { + var self = this; + + + if (inherit == null) inherit = true; + name = $$('Opal')['$const_name!'](name); + + if (name.indexOf('::') === 0 && name !== '::'){ + name = name.slice(2); + } + if ($truthy(name.indexOf('::') != -1 && name != '::')) { + return $send(name.$split("::"), 'inject', [self], function $$10(o, c){ + + if (o == null) o = nil; + if (c == null) c = nil; + return o.$const_get(c);}) + } if (!$truthy(name['$=~']($$$($Opal, 'CONST_NAME_REGEXP')))) { + $Kernel.$raise($$$('NameError').$new("wrong constant name " + (name), name)); + } + if (inherit) { + return Opal.$$([self], name); + } else { + return Opal.const_get_local(self, name); + } + }, -2); + + $def(self, '$const_missing', function $$const_missing(name) { + var self = this, full_const_name = nil; + + + full_const_name = ($eqeq(self, $Object) ? (name) : ("" + (self) + "::" + (name))); + return $Kernel.$raise($$$('NameError').$new("uninitialized constant " + (full_const_name), name)); + }); + + $def(self, '$const_set', function $$const_set(name, value) { + var self = this; + + + $deny_frozen_access(self); + name = $Opal['$const_name!'](name); + if (($truthy(name['$!~']($$$($Opal, 'CONST_NAME_REGEXP'))) || ($truthy(name['$start_with?']("::"))))) { + $Kernel.$raise($$$('NameError').$new("wrong constant name " + (name), name)); + } $const_set(self, name, value); + return value; + }); + + $def(self, '$public_constant', $return_val(nil)); + + $def(self, '$define_method', function $$define_method(name, method) { + var block = $$define_method.$$p || nil, self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + $$define_method.$$p = null; + + $deny_frozen_access(self); + + if (method === undefined && block === nil) + $Kernel.$raise($$$('ArgumentError'), "tried to create a Proc object without a block") + ; + block = ($truthy(($ret_or_1 = block)) ? ($ret_or_1) : ($eqeqeq($$$('Proc'), ($ret_or_2 = method)) ? (method) : ($eqeqeq($$$('Method'), $ret_or_2) ? (method.$to_proc().$$unbound) : ($eqeqeq($$$('UnboundMethod'), $ret_or_2) ? ($lambda(function $$11($a){var $post_args, args, self = $$11.$$s == null ? this : $$11.$$s, bound = nil; + + + $post_args = $slice(arguments); + args = $post_args; + bound = method.$bind(self); + return $send(bound, 'call', $to_a(args));}, {$$arity: -1, $$s: self})) : ($Kernel.$raise($$$('TypeError'), "wrong argument type " + (block.$class()) + " (expected Proc/Method)")))))); + + if (typeof(Proxy) !== 'undefined') { + + block.$$proxy_target = block; + block = new Proxy(block, { + apply: function(target, self, args) { + var old_name = target.$$jsid; + target.$$jsid = name; + try { + return target.apply(self, args); + } catch(e) { + if (e === target.$$brk || e === target.$$ret) return e.$v; + throw e; + } finally { + target.$$jsid = old_name; + } + } + }); + } + + block.$$jsid = name; + block.$$s = null; + block.$$def = block; + block.$$define_meth = true; + + return Opal.defn(self, $jsid(name), block); + }, -2); + + $def(self, '$freeze', function $$freeze() { + var self = this; + + + if ($truthy(self['$frozen?']())) { + return self + } + if (!self.hasOwnProperty('$$base_module')) { $prop(self, '$$base_module', null); } + + return $freeze(self); + }); + + $def(self, '$remove_method', function $$remove_method($a) { + var $post_args, names, self = this; + + + $post_args = $slice(arguments); + names = $post_args; + + for (var i = 0; i < names.length; i++) { + var name = names[i]; + if (!(typeof name === "string" || name.$$is_string)) { + self.$raise($$$('TypeError'), "" + (self.$name()) + " is not a symbol nor a string"); + } + $deny_frozen_access(self); + + Opal.rdef(self, "$" + name); + } + return self; + }, -1); + + $def(self, '$singleton_class?', function $Module_singleton_class$ques$12() { + var self = this; + + return !!self.$$is_singleton; + }); + + $def(self, '$include', function $$include($a) { + var $post_args, mods, self = this; + + + $post_args = $slice(arguments); + mods = $post_args; + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + $Kernel.$raise($$$('TypeError'), "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(self); + (mod).$included(self); + } + return self; + }, -1); + + $def(self, '$included_modules', function $$included_modules() { + var self = this; + + return Opal.included_modules(self); + }); + + $def(self, '$include?', function $Module_include$ques$13(mod) { + var self = this; + + + if (!mod.$$is_module) { + $Kernel.$raise($$$('TypeError'), "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + var i, ii, mod2, ancestors = Opal.ancestors(self); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + mod2 = ancestors[i]; + if (mod2 === mod && mod2 !== self) { + return true; + } + } + + return false; + + }); + + $def(self, '$instance_method', function $$instance_method(name) { + var self = this; + + + var meth = self.$$prototype[$jsid(name)]; + + if (!meth || meth.$$stub) { + $Kernel.$raise($$$('NameError').$new("undefined method `" + (name) + "' for class `" + (self.$name()) + "'", name)); + } + + return $$$('UnboundMethod').$new(self, meth.$$owner || self, meth, name); + + }); + + $def(self, '$instance_methods', function $$instance_methods(include_super) { + var self = this; + + + if (include_super == null) include_super = true; + + if ($truthy(include_super)) { + return Opal.instance_methods(self); + } else { + return Opal.own_instance_methods(self); + } + }, -1); + + $def(self, '$included', $return_val(nil)); + + $def(self, '$extended', $return_val(nil)); + + $def(self, '$extend_object', function $$extend_object(object) { + + + $deny_frozen_access(object); + return nil; + }); + + $def(self, '$method_added', function $$method_added($a) { + + + $slice(arguments); + return nil; + }, -1); + + $def(self, '$method_removed', function $$method_removed($a) { + + + $slice(arguments); + return nil; + }, -1); + + $def(self, '$method_undefined', function $$method_undefined($a) { + + + $slice(arguments); + return nil; + }, -1); + + $def(self, '$module_eval', function $$module_eval($a) { + var block = $$module_eval.$$p || nil, $post_args, args, $b, self = this, string = nil, file = nil, default_eval_options = nil, $ret_or_1 = nil, compiling_options = nil, compiled = nil; + + $$module_eval.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + if (($truthy(block['$nil?']()) && ($truthy(!!Opal.compile)))) { + + if (!$truthy($range(1, 3, false)['$cover?'](args.$size()))) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (0 for 1..3)"); + } $b = [].concat($to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (($b[2] == null ? nil : $b[2])); + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy(($ret_or_1 = file)) ? ($ret_or_1) : ("(eval)")), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $Opal.$compile(string, compiling_options); + block = $send($Kernel, 'proc', [], function $$14(){var self = $$14.$$s == null ? this : $$14.$$s; + + return new Function("Opal,self", "return " + compiled)(Opal, self);}, {$$s: self}); + } else if ($truthy(args['$any?']())) { + $Kernel.$raise($$$('ArgumentError'), "" + ("wrong number of arguments (" + (args.$size()) + " for 0)") + "\n\n NOTE:If you want to enable passing a String argument please add \"require 'opal-parser'\" to your script\n"); + } + var old = block.$$s, + result; + + block.$$s = null; + result = block.apply(self, [self]); + block.$$s = old; + + return result; + }, -1); + + $def(self, '$module_exec', function $$module_exec($a) { + var block = $$module_exec.$$p || nil, $post_args, args, self = this; + + $$module_exec.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + + if (block === nil) { + $Kernel.$raise($$$('LocalJumpError'), "no block given"); + } + + var block_self = block.$$s, result; + + block.$$s = null; + result = block.apply(self, args); + block.$$s = block_self; + + return result; + }, -1); + + $def(self, '$method_defined?', function $Module_method_defined$ques$15(method) { + var self = this; + + + var body = self.$$prototype[$jsid(method)]; + return (!!body) && !body.$$stub; + + }); + + $def(self, '$module_function', function $$module_function($a) { + var $post_args, methods, self = this; + + + $post_args = $slice(arguments); + methods = $post_args; + + $deny_frozen_access(self); + + if (methods.length === 0) { + self.$$module_function = true; + return nil; + } + else { + for (var i = 0, length = methods.length; i < length; i++) { + var meth = methods[i], + id = $jsid(meth), + func = self.$$prototype[id]; + + Opal.defs(self, id, func); + } + return methods.length === 1 ? methods[0] : methods; + } + }, -1); + + $def(self, '$name', function $$name() { + var self = this; + + + if (self.$$full_name) { + return self.$$full_name; + } + + var result = [], base = self; + + while (base) { + // Give up if any of the ancestors is unnamed + if (base.$$name === nil || base.$$name == null) return nil; + + result.unshift(base.$$name); + + base = base.$$base_module; + + if (base === $Object) { + break; + } + } + + if (result.length === 0) { + return nil; + } + + return self.$$full_name = result.join('::'); + + }); + + $def(self, '$prepend', function $$prepend($a) { + var $post_args, mods, self = this; + + + $post_args = $slice(arguments); + mods = $post_args; + + if (mods.length === 0) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (given 0, expected 1+)"); + } + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + $Kernel.$raise($$$('TypeError'), "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$prepend_features(self); + (mod).$prepended(self); + } + return self; + }, -1); + + $def(self, '$prepend_features', function $$prepend_features(prepender) { + var self = this; + + + + $deny_frozen_access(prepender); + + if (!self.$$is_module) { + $Kernel.$raise($$$('TypeError'), "wrong argument type " + (self.$class()) + " (expected Module)"); + } + + Opal.prepend_features(self, prepender) + ; + return self; + }); + + $def(self, '$prepended', $return_val(nil)); + + $def(self, '$remove_const', function $$remove_const(name) { + var self = this; + + + $deny_frozen_access(self); + return Opal.const_remove(self, name); }); + + $def(self, '$to_s', function $$to_s() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = Opal.Module.$name.call(self)))) { + return $ret_or_1 + } else { + return "#<" + (self.$$is_module ? 'Module' : 'Class') + ":0x" + (self.$__id__().$to_s(16)) + ">" + } + }); + + $def(self, '$undef_method', function $$undef_method($a) { + var $post_args, names, self = this; + + + $post_args = $slice(arguments); + names = $post_args; + + for (var i = 0; i < names.length; i++) { + var name = names[i]; + if (!(typeof name === "string" || name.$$is_string)) { + self.$raise($$$('TypeError'), "" + (self.$name()) + " is not a symbol nor a string"); + } + $deny_frozen_access(self); + + Opal.udef(self, "$" + names[i]); + } + return self; + }, -1); + + $def(self, '$instance_variables', function $$instance_variables() { + var self = this, consts = nil; + + + consts = (Opal.Module.$$nesting = $nesting, self.$constants()); + + var result = []; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$' && name !== 'constructor' && !consts['$include?'](name)) { + result.push('@' + name); + } + } + + return result; + }); + + $def(self, '$dup', function $$dup() { + var $yield = $$dup.$$p || nil, self = this, copy = nil; + + $$dup.$$p = null; + + copy = $send2(self, $find_super(self, 'dup', $$dup, false, true), 'dup', [], $yield); + copy.$copy_class_variables(self); + copy.$copy_constants(self); + return copy; + }); + + $def(self, '$copy_class_variables', function $$copy_class_variables(other) { + var self = this; + + + for (var name in other.$$cvars) { + self.$$cvars[name] = other.$$cvars[name]; + } + + }); + + $def(self, '$copy_constants', function $$copy_constants(other) { + var self = this; + + + var name, other_constants = other.$$const; + + for (name in other_constants) { + $const_set(self, name, other_constants[name]); + } + + }); + + $def(self, '$refine', function $$refine(klass) { + var block = $$refine.$$p || nil, $a, self = this, refinement_module = nil, m = nil, klass_id = nil; + + $$refine.$$p = null; + $a = [self, nil, nil], (refinement_module = $a[0]), (m = $a[1]), (klass_id = $a[2]); + + klass_id = Opal.id(klass); + if (typeof self.$$refine_modules === "undefined") { + self.$$refine_modules = Object.create(null); + } + if (typeof self.$$refine_modules[klass_id] === "undefined") { + m = self.$$refine_modules[klass_id] = $$$('Refinement').$new(); + } + else { + m = self.$$refine_modules[klass_id]; + } + m.refinement_module = refinement_module; + m.refined_class = klass + ; + $send(m, 'class_exec', [], block.$to_proc()); + return m; + }); + + $def(self, '$refinements', function $$refinements() { + var self = this; + + + var refine_modules = self.$$refine_modules, hash = $hash2([], {}); if (typeof refine_modules === "undefined") return hash; + for (var id in refine_modules) { + hash['$[]='](refine_modules[id].refined_class, refine_modules[id]); + } + return hash; + + }); + + $def(self, '$using', function $$using(mod) { + + return $Kernel.$raise("Module#using is not permitted in methods") + }); + $alias(self, "class_eval", "module_eval"); + $alias(self, "class_exec", "module_exec"); + return $alias(self, "inspect", "to_s"); + })('::', null, $nesting); + return (function($base, $super) { + var self = $klass($base, $super, 'Refinement'); + + var $proto = self.$$prototype; + + $proto.refinement_module = $proto.refined_class = nil; + + self.$attr_reader("refined_class"); + return $def(self, '$inspect', function $$inspect() { + var $yield = $$inspect.$$p || nil, self = this; + + $$inspect.$$p = null; + if ($truthy(self.refinement_module)) { + return "#" + } else { + return $send2(self, $find_super(self, 'inspect', $$inspect, false, true), 'inspect', [], $yield) + } + }); + })('::', $Module); + }; + + Opal.modules["corelib/class"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $send = Opal.send, $defs = Opal.defs, $def = Opal.def, $rb_plus = Opal.rb_plus, $return_val = Opal.return_val, $slice = Opal.slice, $send2 = Opal.send2, $find_super = Opal.find_super, $Kernel = Opal.Kernel, $alias = Opal.alias, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,class_eval,to_proc,+,subclasses,flatten,map,initialize_copy,allocate,name,to_s,raise'); + + self.$require("corelib/module"); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Class'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $defs(self, '$new', function $Class_new$1(superclass) { + var block = $Class_new$1.$$p || nil; + + $Class_new$1.$$p = null; + if (superclass == null) superclass = $$('Object'); + + if (!superclass.$$is_class) { + throw Opal.TypeError.$new("superclass must be a Class"); + } + + var klass = Opal.allocate_class(nil, superclass); + superclass.$inherited(klass); + ((block !== nil) ? ($send((klass), 'class_eval', [], block.$to_proc())) : nil); + return klass; + }, -1); + + $def(self, '$allocate', function $$allocate() { + var self = this; + + + var obj = new self.$$constructor(); + obj.$$id = Opal.uid(); + return obj; + + }); + + $def(self, '$descendants', function $$descendants() { + var self = this; + + return $rb_plus(self.$subclasses(), $send(self.$subclasses(), 'map', [], "descendants".$to_proc()).$flatten()) + }); + + $def(self, '$inherited', $return_val(nil)); + + $def(self, '$initialize_dup', function $$initialize_dup(original) { + var self = this; + + + self.$initialize_copy(original); + + self.$$name = null; + self.$$full_name = null; + }); + + $def(self, '$new', function $Class_new$2($a) { + var block = $Class_new$2.$$p || nil, $post_args, args, self = this; + + $Class_new$2.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + + var object = self.$allocate(); + Opal.send(object, object.$initialize, args, block); + return object; + }, -1); + + $def(self, '$subclasses', function $$subclasses() { + var self = this; + + + if (typeof WeakRef !== 'undefined') { + var i, subclass, out = []; + for (i = 0; i < self.$$subclasses.length; i++) { + subclass = self.$$subclasses[i].deref(); + if (subclass !== undefined) { + out.push(subclass); + } + } + return out; + } + else { + return self.$$subclasses; + } + + }); + + $def(self, '$superclass', function $$superclass() { + var self = this; + + return self.$$super || nil; + }); + + $def(self, '$to_s', function $$to_s() { + $$to_s.$$p || nil; var self = this; + + $$to_s.$$p = null; + + var singleton_of = self.$$singleton_of; + + if (singleton_of && singleton_of.$$is_a_module) { + return "#"; + } + else if (singleton_of) { + // a singleton class created from an object + return "#>"; + } + + return $send2(self, $find_super(self, 'to_s', $$to_s, false, true), 'to_s', [], null); + + }); + + $def(self, '$attached_object', function $$attached_object() { + var self = this; + + + if (self.$$singleton_of != null) { + return self.$$singleton_of; + } + else { + $Kernel.$raise($$$('TypeError'), "`" + (self) + "' is not a singleton class"); + } + + }); + return $alias(self, "inspect", "to_s"); + })('::', null, $nesting); + }; + + Opal.modules["corelib/basic_object"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $slice = Opal.slice, $def = Opal.def, $alias = Opal.alias, $return_val = Opal.return_val, $Opal = Opal.Opal, $truthy = Opal.truthy, $range = Opal.range, $Kernel = Opal.Kernel, $to_a = Opal.to_a, $hash2 = Opal.hash2, $send = Opal.send, $eqeq = Opal.eqeq, $rb_ge = Opal.rb_ge, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('==,raise,inspect,pristine,!,nil?,cover?,size,merge,compile,proc,[],first,>=,length,instance_variable_get,any?,new,caller'); + return (function($base, $super) { + var self = $klass($base, $super, 'BasicObject'); + + + + + $def(self, '$initialize', function $$initialize($a) { + + + $slice(arguments); + return nil; + }, -1); + + $def(self, '$==', function $BasicObject_$eq_eq$1(other) { + var self = this; + + return self === other; + }); + + $def(self, '$eql?', function $BasicObject_eql$ques$2(other) { + var self = this; + + return self['$=='](other) + }); + $alias(self, "equal?", "=="); + + $def(self, '$__id__', function $$__id__() { + var self = this; + + + if (self.$$id != null) { + return self.$$id; + } + Opal.prop(self, '$$id', Opal.uid()); + return self.$$id; + + }); + + $def(self, '$__send__', function $$__send__(symbol, $a) { + var block = $$__send__.$$p || nil, $post_args, args, self = this; + + $$__send__.$$p = null; + $post_args = $slice(arguments, 1); + args = $post_args; + + if (!symbol.$$is_string) { + self.$raise($$$('TypeError'), "" + (self.$inspect()) + " is not a symbol nor a string"); + } + + var func = self[Opal.jsid(symbol)]; + + if (func) { + if (block !== nil) { + func.$$p = block; + } + + return func.apply(self, args); + } + + if (block !== nil) { + self.$method_missing.$$p = block; + } + + return self.$method_missing.apply(self, [symbol].concat(args)); + }, -2); + + $def(self, '$!', $return_val(false)); + $Opal.$pristine("!"); + + $def(self, '$!=', function $BasicObject_$not_eq$3(other) { + var self = this; + + return self['$=='](other)['$!']() + }); + + $def(self, '$instance_eval', function $$instance_eval($a) { + var block = $$instance_eval.$$p || nil, $post_args, args, $b, self = this, string = nil, file = nil, default_eval_options = nil, $ret_or_1 = nil, compiling_options = nil, compiled = nil; + + $$instance_eval.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + if (($truthy(block['$nil?']()) && ($truthy(!!Opal.compile)))) { + + if (!$truthy($range(1, 3, false)['$cover?'](args.$size()))) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (0 for 1..3)"); + } $b = [].concat($to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (($b[2] == null ? nil : $b[2])); + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy(($ret_or_1 = file)) ? ($ret_or_1) : ("(eval)")), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $Opal.$compile(string, compiling_options); + block = $send($Kernel, 'proc', [], function $$4(){var self = $$4.$$s == null ? this : $$4.$$s; + + return new Function("Opal,self", "return " + compiled)(Opal, self);}, {$$s: self}); + } else if ((($truthy(block['$nil?']()) && ($truthy($rb_ge(args.$length(), 1)))) && ($eqeq(args.$first()['$[]'](0), "@")))) { + return self.$instance_variable_get(args.$first()) + } else if ($truthy(args['$any?']())) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (args.$size()) + " for 0)"); + } + var old = block.$$s, + result; + + block.$$s = null; + + // Need to pass $$eval so that method definitions know if this is + // being done on a class/module. Cannot be compiler driven since + // send(:instance_eval) needs to work. + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.call(self, self); + } + finally { + self.$$eval = false; + } + } + else { + result = block.call(self, self); + } + + block.$$s = old; + + return result; + }, -1); + + $def(self, '$instance_exec', function $$instance_exec($a) { + var block = $$instance_exec.$$p || nil, $post_args, args, self = this; + + $$instance_exec.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + if (!$truthy(block)) { + $Kernel.$raise($$$('ArgumentError'), "no block given"); + } + var block_self = block.$$s, + result; + + block.$$s = null; + + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.apply(self, args); + } + finally { + self.$$eval = false; + } + } + else { + result = block.apply(self, args); + } + + block.$$s = block_self; + + return result; + }, -1); + + $def(self, '$singleton_method_added', function $$singleton_method_added($a) { + + + $slice(arguments); + return nil; + }, -1); + + $def(self, '$singleton_method_removed', function $$singleton_method_removed($a) { + + + $slice(arguments); + return nil; + }, -1); + + $def(self, '$singleton_method_undefined', function $$singleton_method_undefined($a) { + + + $slice(arguments); + return nil; + }, -1); + + $def(self, '$method_missing', function $$method_missing(symbol, $a) { + $$method_missing.$$p || nil; var $post_args, args, self = this, inspect_result = nil; + + $$method_missing.$$p = null; + $post_args = $slice(arguments, 1); + args = $post_args; + inspect_result = $Opal.$inspect(self); + return $Kernel.$raise($$$('NoMethodError').$new("undefined method `" + (symbol) + "' for " + (inspect_result), symbol, args), nil, $Kernel.$caller(1)); + }, -2); + $Opal.$pristine(self, "method_missing"); + return $def(self, '$respond_to_missing?', function $BasicObject_respond_to_missing$ques$5(method_name, include_all) { + return false; + }, -2); + })('::', null) + }; + + Opal.modules["corelib/kernel"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $truthy = Opal.truthy, $coerce_to = Opal.coerce_to, $respond_to = Opal.respond_to, $Opal = Opal.Opal, $deny_frozen_access = Opal.deny_frozen_access, $freeze = Opal.freeze, $freeze_props = Opal.freeze_props, $jsid = Opal.jsid, $module = Opal.module, $return_val = Opal.return_val, $def = Opal.def, $Kernel = Opal.Kernel, $gvars = Opal.gvars, $slice = Opal.slice, $send = Opal.send, $to_a = Opal.to_a, $ensure_kwargs = Opal.ensure_kwargs, $eqeq = Opal.eqeq, $hash2 = Opal.hash2, $rb_plus = Opal.rb_plus, $eqeqeq = Opal.eqeqeq, $return_self = Opal.return_self, $rb_le = Opal.rb_le, $extract_kwargs = Opal.extract_kwargs, $rb_lt = Opal.rb_lt, $Object = Opal.Object, $alias = Opal.alias, $klass = Opal.klass, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('!,=~,==,object_id,raise,new,class,coerce_to?,<<,map,caller,nil?,allocate,copy_instance_variables,copy_singleton_methods,initialize_clone,frozen?,freeze,initialize_copy,define_method,singleton_class,to_proc,initialize_dup,for,empty?,pop,call,append_features,extend_object,extended,gets,__id__,include?,each,instance_variables,instance_variable_get,inspect,+,to_s,instance_variable_name!,respond_to?,to_int,coerce_to!,Integer,===,enum_for,result,any?,print,format,puts,<=,length,[],readline,<,first,split,to_str,exception,backtrace,rand,respond_to_missing?,pristine,try_convert!,expand_path,join,start_with?,new_seed,srand,tag,value,open,is_a?,__send__,yield_self,include'); + + (function($base, $parent_nesting) { + var self = $module($base, 'Kernel'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$=~', $return_val(false)); + + $def(self, '$!~', function $Kernel_$excl_tilde$1(obj) { + var self = this; + + return self['$=~'](obj)['$!']() + }); + + $def(self, '$===', function $Kernel_$eq_eq_eq$2(other) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.$object_id()['$=='](other.$object_id())))) { + return $ret_or_1 + } else { + return self['$=='](other) + } + }); + + $def(self, '$<=>', function $Kernel_$lt_eq_gt$3(other) { + var self = this; + + + // set guard for infinite recursion + self.$$comparable = true; + + var x = self['$=='](other); + + if (x && x !== nil) { + return 0; + } + + return nil; + + }); + + $def(self, '$method', function $$method(name) { + var self = this; + + + var meth = self[$jsid(name)]; + + if (!meth || meth.$$stub) { + $Kernel.$raise($$$('NameError').$new("undefined method `" + (name) + "' for class `" + (self.$class()) + "'", name)); + } + + return $$$('Method').$new(self, meth.$$owner || self.$class(), meth, name); + + }); + + $def(self, '$methods', function $$methods(all) { + var self = this; + + + if (all == null) all = true; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.own_methods(self); + } + }, -1); + + $def(self, '$public_methods', function $$public_methods(all) { + var self = this; + + + if (all == null) all = true; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.receiver_methods(self); + } + }, -1); + + $def(self, '$Array', function $$Array(object) { + + + var coerced; + + if (object === nil) { + return []; + } + + if (object.$$is_array) { + return object; + } + + coerced = $Opal['$coerce_to?'](object, $$$('Array'), "to_ary"); + if (coerced !== nil) { return coerced; } + + coerced = $Opal['$coerce_to?'](object, $$$('Array'), "to_a"); + if (coerced !== nil) { return coerced; } + + return [object]; + + }); + + $def(self, '$at_exit', function $$at_exit() { + var block = $$at_exit.$$p || nil, $ret_or_1 = nil; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + $$at_exit.$$p = null; + $gvars.__at_exit__ = ($truthy(($ret_or_1 = $gvars.__at_exit__)) ? ($ret_or_1) : ([])); + $gvars.__at_exit__['$<<'](block); + return block; + }); + + $def(self, '$caller', function $$caller(start, length) { + + + if (start == null) start = 1; + if (length == null) length = nil; + + var stack, result; + + stack = new Error().$backtrace(); + result = []; + + for (var i = start + 1, ii = stack.length; i < ii; i++) { + if (!stack[i].match(/runtime\.js/)) { + result.push(stack[i]); + } + } + if (length != nil) result = result.slice(0, length); + return result; + }, -1); + + $def(self, '$caller_locations', function $$caller_locations($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + return $send($send(self, 'caller', $to_a(args)), 'map', [], function $$4(loc){ + + if (loc == null) loc = nil; + return $$$($$$($$$('Thread'), 'Backtrace'), 'Location').$new(loc);}); + }, -1); + + $def(self, '$class', function $Kernel_class$5() { + var self = this; + + return self.$$class; + }); + + $def(self, '$copy_instance_variables', function $$copy_instance_variables(other) { + var self = this; + + + var keys = Object.keys(other), i, ii, name; + for (i = 0, ii = keys.length; i < ii; i++) { + name = keys[i]; + if (name.charAt(0) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }); + + $def(self, '$copy_singleton_methods', function $$copy_singleton_methods(other) { + var self = this; + + + var i, name, names, length; + + if (other.hasOwnProperty('$$meta') && other.$$meta !== null) { + var other_singleton_class = Opal.get_singleton_class(other); + var self_singleton_class = Opal.get_singleton_class(self); + names = Object.getOwnPropertyNames(other_singleton_class.$$prototype); + + for (i = 0, length = names.length; i < length; i++) { + name = names[i]; + if (Opal.is_method(name)) { + self_singleton_class.$$prototype[name] = other_singleton_class.$$prototype[name]; + } + } + + self_singleton_class.$$const = Object.assign({}, other_singleton_class.$$const); + Object.setPrototypeOf( + self_singleton_class.$$prototype, + Object.getPrototypeOf(other_singleton_class.$$prototype) + ); + } + + for (i = 0, names = Object.getOwnPropertyNames(other), length = names.length; i < length; i++) { + name = names[i]; + if (name.charAt(0) === '$' && name.charAt(1) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }); + + $def(self, '$clone', function $$clone($kwargs) { + var freeze, self = this, copy = nil; + + + $kwargs = $ensure_kwargs($kwargs); + + freeze = $kwargs.$$smap["freeze"];if (freeze == null) freeze = nil; + if (!(($truthy(freeze['$nil?']()) || ($eqeq(freeze, true))) || ($eqeq(freeze, false)))) { + self.$raise($$('ArgumentError'), "unexpected value for freeze: " + (freeze.$class())); + } copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self, $hash2(["freeze"], {"freeze": freeze})); + if (($eqeq(freeze, true) || (($truthy(freeze['$nil?']()) && ($truthy(self['$frozen?']())))))) { + copy.$freeze(); + } return copy; + }, -1); + + $def(self, '$initialize_clone', function $$initialize_clone(other, $kwargs) { + var self = this; + + + $kwargs = $ensure_kwargs($kwargs); + + $kwargs.$$smap["freeze"]; self.$initialize_copy(other); + return self; + }, -2); + + $def(self, '$define_singleton_method', function $$define_singleton_method(name, method) { + var block = $$define_singleton_method.$$p || nil, self = this; + + $$define_singleton_method.$$p = null; + return $send(self.$singleton_class(), 'define_method', [name, method], block.$to_proc()); + }, -2); + + $def(self, '$dup', function $$dup() { + var self = this, copy = nil; + + + copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }); + + $def(self, '$initialize_dup', function $$initialize_dup(other) { + var self = this; + + return self.$initialize_copy(other) + }); + + $def(self, '$enum_for', function $$enum_for($a, $b) { + var block = $$enum_for.$$p || nil, $post_args, method, args, self = this; + + $$enum_for.$$p = null; + $post_args = $slice(arguments); + + if ($post_args.length > 0) method = $post_args.shift();if (method == null) method = "each"; + args = $post_args; + return $send($$$('Enumerator'), 'for', [self, method].concat($to_a(args)), block.$to_proc()); + }, -1); + + $def(self, '$equal?', function $Kernel_equal$ques$6(other) { + var self = this; + + return self === other; + }); + + $def(self, '$exit', function $$exit(status) { + var $ret_or_1 = nil, block = nil; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + + if (status == null) status = true; + $gvars.__at_exit__ = ($truthy(($ret_or_1 = $gvars.__at_exit__)) ? ($ret_or_1) : ([])); + while (!($truthy($gvars.__at_exit__['$empty?']()))) { + + block = $gvars.__at_exit__.$pop(); + block.$call(); + } + if (status.$$is_boolean) { + status = status ? 0 : 1; + } else { + status = $coerce_to(status, $$$('Integer'), 'to_int'); + } + + Opal.exit(status); + return nil; + }, -1); + + $def(self, '$extend', function $$extend($a) { + var $post_args, mods, self = this; + + + $post_args = $slice(arguments); + mods = $post_args; + + if (mods.length == 0) { + self.$raise($$$('ArgumentError'), "wrong number of arguments (given 0, expected 1+)"); + } + + $deny_frozen_access(self); + + var singleton = self.$singleton_class(); + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + $Kernel.$raise($$$('TypeError'), "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(singleton); + (mod).$extend_object(self); + (mod).$extended(self); + } + return self; + }, -1); + + $def(self, '$freeze', function $$freeze() { + var self = this; + + + if ($truthy(self['$frozen?']())) { + return self + } + if (typeof(self) === "object") { + $freeze_props(self); + return $freeze(self); + } + return self; + }); + + $def(self, '$frozen?', function $Kernel_frozen$ques$7() { + var self = this; + + + switch (typeof(self)) { + case "string": + case "symbol": + case "number": + case "boolean": + return true; + case "object": + return (self.$$frozen || false); + default: + return false; + } + + }); + + $def(self, '$gets', function $$gets($a) { + var $post_args, args; + if ($gvars.stdin == null) $gvars.stdin = nil; + + + $post_args = $slice(arguments); + args = $post_args; + return $send($gvars.stdin, 'gets', $to_a(args)); + }, -1); + + $def(self, '$hash', function $$hash() { + var self = this; + + return self.$__id__() + }); + + $def(self, '$initialize_copy', $return_val(nil)); + var inspect_stack = []; + + $def(self, '$inspect', function $$inspect() { + var self = this, ivs = nil, id = nil, pushed = nil, e = nil; + + return (function() { try { + try { + + ivs = ""; + id = self.$__id__(); + if ($truthy((inspect_stack)['$include?'](id))) { + ivs = " ..."; + } else { + + (inspect_stack)['$<<'](id); + pushed = true; + $send(self.$instance_variables(), 'each', [], function $$8(i){var self = $$8.$$s == null ? this : $$8.$$s, ivar = nil, inspect = nil; + + + if (i == null) i = nil; + ivar = self.$instance_variable_get(i); + inspect = $$('Opal').$inspect(ivar); + return (ivs = $rb_plus(ivs, " " + (i) + "=" + (inspect)));}, {$$s: self}); + }; + return "#<" + (self.$class()) + ":0x" + (id.$to_s(16)) + (ivs) + ">"; + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) {(e = $err); + try { + return "#<" + (self.$class()) + ":0x" + (id.$to_s(16)) + ">" + } finally { Opal.pop_exception(); } + } else { throw $err; } + } + } finally { + ($truthy(pushed) ? ((inspect_stack).$pop()) : nil); + } })() + }); + + $def(self, '$instance_of?', function $Kernel_instance_of$ques$9(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + $Kernel.$raise($$$('TypeError'), "class or module required"); + } + + return self.$$class === klass; + + }); + + $def(self, '$instance_variable_defined?', function $Kernel_instance_variable_defined$ques$10(name) { + var self = this; + + + name = $Opal['$instance_variable_name!'](name); + return Opal.hasOwnProperty.call(self, name.substr(1)); }); + + $def(self, '$instance_variable_get', function $$instance_variable_get(name) { + var self = this; + + + name = $Opal['$instance_variable_name!'](name); + + var ivar = self[Opal.ivar(name.substr(1))]; + + return ivar == null ? nil : ivar; + }); + + $def(self, '$instance_variable_set', function $$instance_variable_set(name, value) { + var self = this; + + + $deny_frozen_access(self); + name = $Opal['$instance_variable_name!'](name); + return self[Opal.ivar(name.substr(1))] = value; }); + + $def(self, '$remove_instance_variable', function $$remove_instance_variable(name) { + var self = this; + + + name = $Opal['$instance_variable_name!'](name); + + var key = Opal.ivar(name.substr(1)), + val; + if (self.hasOwnProperty(key)) { + val = self[key]; + delete self[key]; + return val; + } + return $Kernel.$raise($$$('NameError'), "instance variable " + (name) + " not defined"); + }); + + $def(self, '$instance_variables', function $$instance_variables() { + var self = this; + + + var result = [], ivar; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$') { + if (name.substr(-1) === '$') { + ivar = name.slice(0, name.length - 1); + } else { + ivar = name; + } + result.push('@' + ivar); + } + } + + return result; + + }); + + $def(self, '$Integer', function $$Integer(value, base) { + + var i, str, base_digits; + + if (!value.$$is_string) { + if (base !== undefined) { + $Kernel.$raise($$$('ArgumentError'), "base specified for non string value"); + } + if (value === nil) { + $Kernel.$raise($$$('TypeError'), "can't convert nil into Integer"); + } + if (value.$$is_number) { + if (value === Infinity || value === -Infinity || isNaN(value)) { + $Kernel.$raise($$$('FloatDomainError'), value); + } + return Math.floor(value); + } + if (value['$respond_to?']("to_int")) { + i = value.$to_int(); + if (i !== nil) { + return i; + } + } + return $Opal['$coerce_to!'](value, $$$('Integer'), "to_i"); + } + + if (value === "0") { + return 0; + } + + if (base === undefined) { + base = 0; + } else { + base = $coerce_to(base, $$$('Integer'), 'to_int'); + if (base === 1 || base < 0 || base > 36) { + $Kernel.$raise($$$('ArgumentError'), "invalid radix " + (base)); + } + } + + str = value.toLowerCase(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + str = str.replace(/^(\s*[+-]?)(0[bodx]?)/, function (_, head, flag) { + switch (flag) { + case '0b': + if (base === 0 || base === 2) { + base = 2; + return head; + } + // no-break + case '0': + case '0o': + if (base === 0 || base === 8) { + base = 8; + return head; + } + // no-break + case '0d': + if (base === 0 || base === 10) { + base = 10; + return head; + } + // no-break + case '0x': + if (base === 0 || base === 16) { + base = 16; + return head; + } + // no-break + } + $Kernel.$raise($$$('ArgumentError'), "invalid value for Integer(): \"" + (value) + "\""); + }); + + base = (base === 0 ? 10 : base); + + base_digits = '0-' + (base <= 10 ? base - 1 : '9a-' + String.fromCharCode(97 + (base - 11))); + + if (!(new RegExp('^\\s*[+-]?[' + base_digits + ']+\\s*$')).test(str)) { + $Kernel.$raise($$$('ArgumentError'), "invalid value for Integer(): \"" + (value) + "\""); + } + + i = parseInt(str, base); + + if (isNaN(i)) { + $Kernel.$raise($$$('ArgumentError'), "invalid value for Integer(): \"" + (value) + "\""); + } + + return i; + }, -2); + + $def(self, '$Float', function $$Float(value) { + + + var str; + + if (value === nil) { + $Kernel.$raise($$$('TypeError'), "can't convert nil into Float"); + } + + if (value.$$is_string) { + str = value.toString(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + //Special case for hex strings only: + if (/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(str)) { + return $Kernel.$Integer(str); + } + + if (!/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(str)) { + $Kernel.$raise($$$('ArgumentError'), "invalid value for Float(): \"" + (value) + "\""); + } + + return parseFloat(str); + } + + return $Opal['$coerce_to!'](value, $$$('Float'), "to_f"); + + }); + + $def(self, '$Hash', function $$Hash(arg) { + + + if (($truthy(arg['$nil?']()) || ($eqeq(arg, [])))) { + return $hash2([], {}) + } if ($eqeqeq($$$('Hash'), arg)) { + return arg + } return $Opal['$coerce_to!'](arg, $$$('Hash'), "to_hash"); + }); + + $def(self, '$is_a?', function $Kernel_is_a$ques$11(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + $Kernel.$raise($$$('TypeError'), "class or module required"); + } + + return Opal.is_a(self, klass); + + }); + + $def(self, '$itself', $return_self); + + $def(self, '$lambda', function $$lambda() { + var block = $$lambda.$$p || nil; + + $$lambda.$$p = null; + return Opal.lambda(block); }); + + $def(self, '$load', function $$load(file) { + + + file = $Opal['$coerce_to!'](file, $$$('String'), "to_str"); + return Opal.load(file); + }); + + $def(self, '$loop', function $$loop() { + var $yield = $$loop.$$p || nil, self = this, e = nil; + + $$loop.$$p = null; + + if (!($yield !== nil)) { + return $send(self, 'enum_for', ["loop"], function $$12(){ + return $$$($$$('Float'), 'INFINITY')}) + } while ($truthy(true)) { + + try { + Opal.yieldX($yield, []); + } catch ($err) { + if (Opal.rescue($err, [$$$('StopIteration')])) {(e = $err); + try { + return e.$result() + } finally { Opal.pop_exception(); } + } else { throw $err; } + } } return self; + }); + + $def(self, '$nil?', $return_val(false)); + + $def(self, '$printf', function $$printf($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + if ($truthy(args['$any?']())) { + self.$print($send(self, 'format', $to_a(args))); + } return nil; + }, -1); + + $def(self, '$proc', function $$proc() { + var block = $$proc.$$p || nil; + + $$proc.$$p = null; + if (!$truthy(block)) { + $Kernel.$raise($$$('ArgumentError'), "tried to create Proc object without a block"); + } block.$$is_lambda = false; + return block; + }); + + $def(self, '$puts', function $$puts($a) { + var $post_args, strs; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + $post_args = $slice(arguments); + strs = $post_args; + return $send($gvars.stdout, 'puts', $to_a(strs)); + }, -1); + + $def(self, '$p', function $$p($a) { + var $post_args, args; + + + $post_args = $slice(arguments); + args = $post_args; + $send(args, 'each', [], function $$13(obj){ if ($gvars.stdout == null) $gvars.stdout = nil; + + + if (obj == null) obj = nil; + return $gvars.stdout.$puts(obj.$inspect());}); + if ($truthy($rb_le(args.$length(), 1))) { + return args['$[]'](0) + } else { + return args + } }, -1); + + $def(self, '$print', function $$print($a) { + var $post_args, strs; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + $post_args = $slice(arguments); + strs = $post_args; + return $send($gvars.stdout, 'print', $to_a(strs)); + }, -1); + + $def(self, '$readline', function $$readline($a) { + var $post_args, args; + if ($gvars.stdin == null) $gvars.stdin = nil; + + + $post_args = $slice(arguments); + args = $post_args; + return $send($gvars.stdin, 'readline', $to_a(args)); + }, -1); + + $def(self, '$warn', function $$warn($a, $b) { + var $post_args, $kwargs, strs, uplevel, $c, $d, self = this, location = nil; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + $post_args = $slice(arguments); + $kwargs = $extract_kwargs($post_args); + $kwargs = $ensure_kwargs($kwargs); + strs = $post_args; + + uplevel = $kwargs.$$smap["uplevel"];if (uplevel == null) uplevel = nil; + if ($truthy(uplevel)) { + + uplevel = $Opal['$coerce_to!'](uplevel, $$$('Integer'), "to_str"); + if ($truthy($rb_lt(uplevel, 0))) { + $Kernel.$raise($$$('ArgumentError'), "negative level (" + (uplevel) + ")"); + } location = ($c = ($d = self.$caller($rb_plus(uplevel, 1), 1).$first(), ($d === nil || $d == null) ? nil : $d.$split(":in `")), ($c === nil || $c == null) ? nil : $c.$first()); + if ($truthy(location)) { + location = "" + (location) + ": "; + } strs = $send(strs, 'map', [], function $$14(s){ + + if (s == null) s = nil; + return "" + (location) + "warning: " + (s);}); + } if (($truthy($gvars.VERBOSE['$nil?']()) || ($truthy(strs['$empty?']())))) { + return nil + } else { + return $send($gvars.stderr, 'puts', $to_a(strs)) + } }, -1); + + $def(self, '$raise', function $$raise(exception, string, backtrace) { + if ($gvars["!"] == null) $gvars["!"] = nil; + if ($gvars["@"] == null) $gvars["@"] = nil; + if (string == null) string = nil; + if (backtrace == null) backtrace = nil; + + if (exception == null && $gvars["!"] !== nil) { + throw $gvars["!"]; + } + if (exception == null) { + exception = $$$('RuntimeError').$new(""); + } + else if ($respond_to(exception, '$to_str')) { + exception = $$$('RuntimeError').$new(exception.$to_str()); + } + // using respond_to? and not an undefined check to avoid method_missing matching as true + else if (exception.$$is_class && $respond_to(exception, '$exception')) { + exception = exception.$exception(string); + } + else if (exception.$$is_exception) ; + else { + exception = $$$('TypeError').$new("exception class/object expected"); + } + + if (backtrace !== nil) { + exception.$set_backtrace(backtrace); + } + + if ($gvars["!"] !== nil) { + Opal.exceptions.push($gvars["!"]); + } + + $gvars["!"] = exception; + $gvars["@"] = (exception).$backtrace(); + + throw exception; + }, -1); + + $def(self, '$rand', function $$rand(max) { + + if (max === undefined) { + return $$$($$$('Random'), 'DEFAULT').$rand(); + } + + if (max.$$is_number) { + if (max < 0) { + max = Math.abs(max); + } + + if (max % 1 !== 0) { + max = max.$to_i(); + } + + if (max === 0) { + max = undefined; + } + } + return $$$($$$('Random'), 'DEFAULT').$rand(max); + }, -1); + + $def(self, '$respond_to?', function $Kernel_respond_to$ques$15(name, include_all) { + var self = this; + + + if (include_all == null) include_all = false; + + var body = self[$jsid(name)]; + + if (typeof(body) === "function" && !body.$$stub) { + return true; + } + + if (self['$respond_to_missing?'].$$pristine === true) { + return false; + } else { + return self['$respond_to_missing?'](name, include_all); + } + }, -2); + + $def(self, '$respond_to_missing?', function $Kernel_respond_to_missing$ques$16(method_name, include_all) { + return false; + }, -2); + $Opal.$pristine(self, "respond_to?", "respond_to_missing?"); + + $def(self, '$require', function $$require(file) { + + + // As Object.require refers to Kernel.require once Kernel has been loaded the String + // class may not be available yet, the coercion requires both String and Array to be loaded. + if (typeof file !== 'string' && Opal.String && Opal.Array) { + (file = $Opal['$coerce_to!'](file, $$$('String'), "to_str")); + } + return Opal.require(file) + + }); + + $def(self, '$require_relative', function $$require_relative(file) { + + + $Opal['$try_convert!'](file, $$$('String'), "to_str"); + file = $$$('File').$expand_path($$$('File').$join(Opal.current_file, "..", file)); + return Opal.require(file); + }); + + $def(self, '$require_tree', function $$require_tree(path, $kwargs) { + var autoload; + + + $kwargs = $ensure_kwargs($kwargs); + + autoload = $kwargs.$$smap["autoload"];if (autoload == null) autoload = false; + + var result = []; + + path = $$$('File').$expand_path(path); + path = Opal.normalize(path); + if (path === '.') path = ''; + for (var name in Opal.modules) { + if ((name)['$start_with?'](path)) { + if(!autoload) { + result.push([name, Opal.require(name)]); + } else { + result.push([name, true]); // do nothing, delegated to a autoloading + } + } + } + + return result; + }, -2); + + $def(self, '$singleton_class', function $$singleton_class() { + var self = this; + + return Opal.get_singleton_class(self); + }); + + $def(self, '$sleep', function $$sleep(seconds) { + + + if (seconds == null) seconds = nil; + + if (seconds === nil) { + $Kernel.$raise($$$('TypeError'), "can't convert NilClass into time interval"); + } + if (!seconds.$$is_number) { + $Kernel.$raise($$$('TypeError'), "can't convert " + (seconds.$class()) + " into time interval"); + } + if (seconds < 0) { + $Kernel.$raise($$$('ArgumentError'), "time interval must be positive"); + } + var get_time = Opal.global.performance ? + function() {return performance.now()} : + function() {return new Date()}; + + var t = get_time(); + while (get_time() - t <= seconds * 1000); + return Math.round(seconds); + }, -1); + + $def(self, '$srand', function $$srand(seed) { + + + if (seed == null) seed = $$('Random').$new_seed(); + return $$$('Random').$srand(seed); + }, -1); + + $def(self, '$String', function $$String(str) { + var $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = $Opal['$coerce_to?'](str, $$$('String'), "to_str")))) { + return $ret_or_1 + } else { + return $Opal['$coerce_to!'](str, $$$('String'), "to_s") + } + }); + + $def(self, '$tap', function $$tap() { + var block = $$tap.$$p || nil, self = this; + + $$tap.$$p = null; + Opal.yield1(block, self); + return self; + }); + + $def(self, '$to_proc', $return_self); + + $def(self, '$to_s', function $$to_s() { + var self = this; + + return "#<" + (self.$class()) + ":0x" + (self.$__id__().$to_s(16)) + ">" + }); + + $def(self, '$catch', function $Kernel_catch$17(tag) { + var $yield = $Kernel_catch$17.$$p || nil, $ret_or_1 = nil, e = nil; + + $Kernel_catch$17.$$p = null; + + if (tag == null) tag = nil; + try { + + tag = ($truthy(($ret_or_1 = tag)) ? ($ret_or_1) : ($Object.$new())); + return Opal.yield1($yield, tag);; + } catch ($err) { + if (Opal.rescue($err, [$$$('UncaughtThrowError')])) {(e = $err); + try { + + if ($eqeq(e.$tag(), tag)) { + return e.$value() + }; + return $Kernel.$raise(); + } finally { Opal.pop_exception(); } + } else { throw $err; } + } }, -1); + + $def(self, '$throw', function $Kernel_throw$18(tag, obj) { + + + if (obj == null) obj = nil; + return $Kernel.$raise($$$('UncaughtThrowError').$new(tag, obj)); + }, -2); + + $def(self, '$open', function $$open($a) { + var block = $$open.$$p || nil, $post_args, args; + + $$open.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + return $send($$$('File'), 'open', $to_a(args), block.$to_proc()); + }, -1); + + $def(self, '$yield_self', function $$yield_self() { + var $yield = $$yield_self.$$p || nil, self = this; + + $$yield_self.$$p = null; + + if (!($yield !== nil)) { + return $send(self, 'enum_for', ["yield_self"], $return_val(1)) + } return Opal.yield1($yield, self); }); + $alias(self, "fail", "raise"); + $alias(self, "kind_of?", "is_a?"); + $alias(self, "object_id", "__id__"); + $alias(self, "public_send", "__send__"); + $alias(self, "send", "__send__"); + $alias(self, "then", "yield_self"); + return $alias(self, "to_enum", "enum_for"); + })('::', $nesting); + return (function($base, $super) { + var self = $klass($base, $super, 'Object'); + + + + delete $Object.$$prototype.$require; + return self.$include($Kernel); + })('::', null); + }; + + Opal.modules["corelib/main"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $return_val = Opal.return_val, $def = Opal.def, $Object = Opal.Object, $slice = Opal.slice, $Kernel = Opal.Kernel, self = Opal.top; Opal.nil; + + Opal.add_stubs('include,raise'); + return (function(self, $parent_nesting) { + + + + $def(self, '$to_s', $return_val("main")); + + $def(self, '$include', function $$include(mod) { + + return $Object.$include(mod) + }); + + $def(self, '$autoload', function $$autoload($a) { + var $post_args, args; + + + $post_args = $slice(arguments); + args = $post_args; + return Opal.Object.$autoload.apply(Opal.Object, args); }, -1); + return $def(self, '$using', function $$using(mod) { + + return $Kernel.$raise("main.using is permitted only at toplevel") + }); + })(Opal.get_singleton_class(self)) + }; + + Opal.modules["corelib/error/errno"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $truthy = Opal.truthy, $rb_plus = Opal.rb_plus, $send2 = Opal.send2, $find_super = Opal.find_super, $def = Opal.def, $klass = Opal.klass, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('+,errno,class,attr_reader'); + + (function($base, $parent_nesting) { + var self = $module($base, 'Errno'); + + var errors = nil, klass = nil; + + + errors = [["EINVAL", "Invalid argument", 22], ["EEXIST", "File exists", 17], ["EISDIR", "Is a directory", 21], ["EMFILE", "Too many open files", 24], ["ESPIPE", "Illegal seek", 29], ["EACCES", "Permission denied", 13], ["EPERM", "Operation not permitted", 1], ["ENOENT", "No such file or directory", 2], ["ENAMETOOLONG", "File name too long", 36]]; + klass = nil; + + var i; + for (i = 0; i < errors.length; i++) { + (function() { // Create a closure + var class_name = errors[i][0]; + var default_message = errors[i][1]; + var errno = errors[i][2]; + + klass = Opal.klass(self, Opal.SystemCallError, class_name); + klass.errno = errno; + + (function(self, $parent_nesting) { + + return $def(self, '$new', function $new$1(name) { + $new$1.$$p || nil; var self = this, message = nil; + + $new$1.$$p = null; + + if (name == null) name = nil; + message = default_message; + if ($truthy(name)) { + message = $rb_plus(message, " - " + (name)); + } return $send2(self, $find_super(self, 'new', $new$1, false, true), 'new', [message], null); + }, -1) + })(Opal.get_singleton_class(klass)); + })(); + } + })('::'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'SystemCallError'); + + + + $def(self, '$errno', function $$errno() { + var self = this; + + return self.$class().$errno() + }); + return (function(self, $parent_nesting) { + + return self.$attr_reader("errno") + })(Opal.get_singleton_class(self)); + })('::', $$$('StandardError')); + }; + + Opal.modules["corelib/error"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $slice = Opal.slice, $gvars = Opal.gvars, $defs = Opal.defs, $send = Opal.send, $to_a = Opal.to_a, $def = Opal.def, $truthy = Opal.truthy, $hash2 = Opal.hash2, $Kernel = Opal.Kernel, $not = Opal.not, $rb_plus = Opal.rb_plus, $eqeq = Opal.eqeq, $Object = Opal.Object, $ensure_kwargs = Opal.ensure_kwargs, $send2 = Opal.send2, $find_super = Opal.find_super, $module = Opal.module, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('new,map,backtrace,clone,to_s,merge,tty?,[],include?,raise,dup,empty?,!,caller,shift,+,class,join,cause,full_message,==,reverse,split,autoload,attr_reader,inspect'); + + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Exception'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.message = nil; + + Opal.prop(self.$$prototype, '$$is_exception', true); + var stack_trace_limit; + Error.stackTraceLimit = 100; + $defs(self, '$new', function $Exception_new$1($a) { + var $post_args, args, self = this; + if ($gvars["!"] == null) $gvars["!"] = nil; + + + $post_args = $slice(arguments); + args = $post_args; + + var message = (args.length > 0) ? args[0] : nil; + var error = new self.$$constructor(message); + error.name = self.$$name; + error.message = message; + error.cause = $gvars["!"]; + Opal.send(error, error.$initialize, args); + + // Error.captureStackTrace() will use .name and .toString to build the + // first line of the stack trace so it must be called after the error + // has been initialized. + // https://nodejs.org/dist/latest-v6.x/docs/api/errors.html + if (Opal.config.enable_stack_trace && Error.captureStackTrace) { + // Passing Kernel.raise will cut the stack trace from that point above + Error.captureStackTrace(error, stack_trace_limit); + } + + return error; + }, -1); + stack_trace_limit = self.$new; + $defs(self, '$exception', function $$exception($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'new', $to_a(args)); + }, -1); + + $def(self, '$initialize', function $$initialize($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + return self.message = (args.length > 0) ? args[0] : nil; }, -1); + + // Convert backtrace from any format to Ruby format + function correct_backtrace(backtrace) { + var new_bt = [], m; + + for (var i = 0; i < backtrace.length; i++) { + var loc = backtrace[i]; + if (!loc || !loc.$$is_string) ; + /* Chromium format */ + else if ((m = loc.match(/^ at (.*?) \((.*?)\)$/))) { + new_bt.push(m[2] + ":in `" + m[1] + "'"); + } + else if ((m = loc.match(/^ at (.*?)$/))) { + new_bt.push(m[1] + ":in `undefined'"); + } + /* Node format */ + else if ((m = loc.match(/^ from (.*?)$/))) { + new_bt.push(m[1]); + } + /* Mozilla/Apple format */ + else if ((m = loc.match(/^(.*?)@(.*?)$/))) { + new_bt.push(m[2] + ':in `' + m[1] + "'"); + } + } + + return new_bt; + } + + $def(self, '$backtrace', function $$backtrace() { + var self = this; + + + if (self.backtrace) { + // nil is a valid backtrace + return self.backtrace; + } + + var backtrace = self.stack; + + if (typeof(backtrace) !== 'undefined' && backtrace.$$is_string) { + return self.backtrace = correct_backtrace(backtrace.split("\n")); + } + else if (backtrace) { + return self.backtrace = correct_backtrace(backtrace); + } + + return []; + + }); + + $def(self, '$backtrace_locations', function $$backtrace_locations() { + var $a, self = this; + + + if (self.backtrace_locations) return self.backtrace_locations; + self.backtrace_locations = ($a = self.$backtrace(), ($a === nil || $a == null) ? nil : $send($a, 'map', [], function $$2(loc){ + + if (loc == null) loc = nil; + return $$$($$$($$$('Thread'), 'Backtrace'), 'Location').$new(loc);})); + return self.backtrace_locations; + + }); + + $def(self, '$cause', function $$cause() { + var self = this; + + return self.cause || nil; + }); + + $def(self, '$exception', function $$exception(str) { + var self = this; + + + if (str == null) str = nil; + + if (str === nil || self === str) { + return self; + } + + var cloned = self.$clone(); + cloned.message = str; + if (self.backtrace) cloned.backtrace = self.backtrace.$dup(); + cloned.stack = self.stack; + cloned.cause = self.cause; + return cloned; + }, -1); + + $def(self, '$message', function $$message() { + var self = this; + + return self.$to_s() + }); + + $def(self, '$full_message', function $$full_message(kwargs) { + var $b, self = this, $ret_or_1 = nil, highlight = nil, order = nil, bold_underline = nil, bold = nil, reset = nil, bt = nil, first = nil, msg = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + if (kwargs == null) kwargs = nil; + if (!$truthy((($$('Hash', 'skip_raise')) ? 'constant' : nil))) { + return "" + (self.message) + "\n" + (self.stack) + } kwargs = $hash2(["highlight", "order"], {"highlight": $gvars.stderr['$tty?'](), "order": "top"}).$merge(($truthy(($ret_or_1 = kwargs)) ? ($ret_or_1) : ($hash2([], {})))); + $b = [kwargs['$[]']("highlight"), kwargs['$[]']("order")], (highlight = $b[0]), (order = $b[1]); + if (!$truthy([true, false]['$include?'](highlight))) { + $Kernel.$raise($$$('ArgumentError'), "expected true or false as highlight: " + (highlight)); + } if (!$truthy(["top", "bottom"]['$include?'](order))) { + $Kernel.$raise($$$('ArgumentError'), "expected :top or :bottom as order: " + (order)); + } if ($truthy(highlight)) { + + bold_underline = "\u001b[1;4m"; + bold = "\u001b[1m"; + reset = "\u001b[m"; + } else { + bold_underline = (bold = (reset = "")); + } bt = self.$backtrace().$dup(); + if (($not(bt) || ($truthy(bt['$empty?']())))) { + bt = self.$caller(); + } first = bt.$shift(); + msg = "" + (first) + ": "; + msg = $rb_plus(msg, "" + (bold) + (self.$to_s()) + " (" + (bold_underline) + (self.$class()) + (reset) + (bold) + ")" + (reset) + "\n"); + msg = $rb_plus(msg, $send(bt, 'map', [], function $$3(loc){ + + if (loc == null) loc = nil; + return "\tfrom " + (loc) + "\n";}).$join()); + if ($truthy(self.$cause())) { + msg = $rb_plus(msg, self.$cause().$full_message($hash2(["highlight"], {"highlight": highlight}))); + } if ($eqeq(order, "bottom")) { + + msg = msg.$split("\n").$reverse().$join("\n"); + msg = $rb_plus("" + (bold) + "Traceback" + (reset) + " (most recent call last):\n", msg); + } return msg; + }, -1); + + $def(self, '$inspect', function $$inspect() { + var self = this, as_str = nil; + + + as_str = self.$to_s(); + if ($truthy(as_str['$empty?']())) { + return self.$class().$to_s() + } else { + return "#<" + (self.$class().$to_s()) + ": " + (self.$to_s()) + ">" + } }); + + $def(self, '$set_backtrace', function $$set_backtrace(backtrace) { + var self = this; + + + var valid = true, i, ii; + + if (backtrace === nil) { + self.backtrace = nil; + self.stack = ''; + } else if (backtrace.$$is_string) { + self.backtrace = [backtrace]; + self.stack = ' from ' + backtrace; + } else { + if (backtrace.$$is_array) { + for (i = 0, ii = backtrace.length; i < ii; i++) { + if (!backtrace[i].$$is_string) { + valid = false; + break; + } + } + } else { + valid = false; + } + + if (valid === false) { + $Kernel.$raise($$$('TypeError'), "backtrace must be Array of String"); + } + + self.backtrace = backtrace; + self.stack = $send((backtrace), 'map', [], function $$4(i){ + + if (i == null) i = nil; + return $rb_plus(" from ", i);}).join("\n"); + } + + return backtrace; + + }); + return $def(self, '$to_s', function $$to_s() { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = self.message)) ? (self.message.$to_s()) : ($ret_or_2))))) { + return $ret_or_1 + } else { + return self.$class().$to_s() + } + }); + })('::', Error, $nesting); + $klass('::', $$$('Exception'), 'ScriptError'); + $klass('::', $$$('ScriptError'), 'SyntaxError'); + $klass('::', $$$('ScriptError'), 'LoadError'); + $klass('::', $$$('ScriptError'), 'NotImplementedError'); + $klass('::', $$$('Exception'), 'SystemExit'); + $klass('::', $$$('Exception'), 'NoMemoryError'); + $klass('::', $$$('Exception'), 'SignalException'); + $klass('::', $$$('SignalException'), 'Interrupt'); + $klass('::', $$$('Exception'), 'SecurityError'); + $klass('::', $$$('Exception'), 'SystemStackError'); + $klass('::', $$$('Exception'), 'StandardError'); + $klass('::', $$$('StandardError'), 'EncodingError'); + $klass('::', $$$('StandardError'), 'ZeroDivisionError'); + $klass('::', $$$('StandardError'), 'NameError'); + $klass('::', $$$('NameError'), 'NoMethodError'); + $klass('::', $$$('StandardError'), 'RuntimeError'); + $klass('::', $$$('RuntimeError'), 'FrozenError'); + $klass('::', $$$('StandardError'), 'LocalJumpError'); + $klass('::', $$$('StandardError'), 'TypeError'); + $klass('::', $$$('StandardError'), 'ArgumentError'); + $klass('::', $$$('ArgumentError'), 'UncaughtThrowError'); + $klass('::', $$$('StandardError'), 'IndexError'); + $klass('::', $$$('IndexError'), 'StopIteration'); + $klass('::', $$$('StopIteration'), 'ClosedQueueError'); + $klass('::', $$$('IndexError'), 'KeyError'); + $klass('::', $$$('StandardError'), 'RangeError'); + $klass('::', $$$('RangeError'), 'FloatDomainError'); + $klass('::', $$$('StandardError'), 'IOError'); + $klass('::', $$$('IOError'), 'EOFError'); + $klass('::', $$$('StandardError'), 'SystemCallError'); + $klass('::', $$$('StandardError'), 'RegexpError'); + $klass('::', $$$('StandardError'), 'ThreadError'); + $klass('::', $$$('StandardError'), 'FiberError'); + $Object.$autoload("Errno", "corelib/error/errno"); + (function($base, $super) { + var self = $klass($base, $super, 'FrozenError'); + + + + self.$attr_reader("receiver"); + return $def(self, '$initialize', function $$initialize(message, $kwargs) { + var receiver; $$initialize.$$p || nil; var self = this; + + $$initialize.$$p = null; + + $kwargs = $ensure_kwargs($kwargs); + + receiver = $kwargs.$$smap["receiver"];if (receiver == null) receiver = nil; + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [message], null); + return (self.receiver = receiver); + }, -2); + })('::', $$$('RuntimeError')); + (function($base, $super) { + var self = $klass($base, $super, 'UncaughtThrowError'); + + var $proto = self.$$prototype; + + $proto.tag = nil; + + self.$attr_reader("tag", "value"); + return $def(self, '$initialize', function $$initialize(tag, value) { + $$initialize.$$p || nil; var self = this; + + $$initialize.$$p = null; + + if (value == null) value = nil; + self.tag = tag; + self.value = value; + return $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', ["uncaught throw " + (self.tag.$inspect())], null); + }, -2); + })('::', $$$('ArgumentError')); + (function($base, $super) { + var self = $klass($base, $super, 'NameError'); + + + + self.$attr_reader("name"); + return $def(self, '$initialize', function $$initialize(message, name) { + $$initialize.$$p || nil; var self = this; + + $$initialize.$$p = null; + + if (name == null) name = nil; + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [message], null); + return (self.name = name); + }, -2); + })('::', null); + (function($base, $super) { + var self = $klass($base, $super, 'NoMethodError'); + + + + self.$attr_reader("args"); + return $def(self, '$initialize', function $$initialize(message, name, args) { + $$initialize.$$p || nil; var self = this; + + $$initialize.$$p = null; + + if (name == null) name = nil; + if (args == null) args = []; + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [message, name], null); + return (self.args = args); + }, -2); + })('::', null); + (function($base, $super) { + var self = $klass($base, $super, 'StopIteration'); + + + return self.$attr_reader("result") + })('::', null); + (function($base, $super) { + var self = $klass($base, $super, 'KeyError'); + + var $proto = self.$$prototype; + + $proto.receiver = $proto.key = nil; + + + $def(self, '$initialize', function $$initialize(message, $kwargs) { + var receiver, key; $$initialize.$$p || nil; var self = this; + + $$initialize.$$p = null; + + $kwargs = $ensure_kwargs($kwargs); + + receiver = $kwargs.$$smap["receiver"];if (receiver == null) receiver = nil; + + key = $kwargs.$$smap["key"];if (key == null) key = nil; + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [message], null); + self.receiver = receiver; + return (self.key = key); + }, -2); + + $def(self, '$receiver', function $$receiver() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.receiver))) { + return $ret_or_1 + } else { + return $Kernel.$raise($$$('ArgumentError'), "no receiver is available") + } + }); + return $def(self, '$key', function $$key() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.key))) { + return $ret_or_1 + } else { + return $Kernel.$raise($$$('ArgumentError'), "no key is available") + } + }); + })('::', null); + return (function($base, $parent_nesting) { + var self = $module($base, 'JS'); + + var $nesting = [self].concat($parent_nesting); + + return ($klass($nesting[0], null, 'Error'), nil) + })('::', $nesting); + }; + + Opal.modules["corelib/constants"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $const_set = Opal.const_set; Opal.nil; var $$$ = Opal.$$$; + + + $const_set('::', 'RUBY_PLATFORM', "opal"); + $const_set('::', 'RUBY_ENGINE', "opal"); + $const_set('::', 'RUBY_VERSION', "3.2.0"); + $const_set('::', 'RUBY_ENGINE_VERSION', "1.7.3"); + $const_set('::', 'RUBY_RELEASE_DATE', "2023-03-23"); + $const_set('::', 'RUBY_PATCHLEVEL', 0); + $const_set('::', 'RUBY_REVISION', "0"); + $const_set('::', 'RUBY_COPYRIGHT', "opal - Copyright (C) 2011-2023 Adam Beynon and the Opal contributors"); + return $const_set('::', 'RUBY_DESCRIPTION', "opal " + ($$$('RUBY_ENGINE_VERSION')) + " (" + ($$$('RUBY_RELEASE_DATE')) + " revision " + ($$$('RUBY_REVISION')) + ")"); + }; + + Opal.modules["opal/base"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $Object = Opal.Object; Opal.nil; + + Opal.add_stubs('require'); + + $Object.$require("corelib/runtime"); + $Object.$require("corelib/helpers"); + $Object.$require("corelib/module"); + $Object.$require("corelib/class"); + $Object.$require("corelib/basic_object"); + $Object.$require("corelib/kernel"); + $Object.$require("corelib/main"); + $Object.$require("corelib/error"); + return $Object.$require("corelib/constants"); + }; + + Opal.modules["corelib/nil"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $Kernel = Opal.Kernel, $def = Opal.def, $return_val = Opal.return_val, $ensure_kwargs = Opal.ensure_kwargs, $NilClass = Opal.NilClass, $slice = Opal.slice, $truthy = Opal.truthy, $rb_gt = Opal.rb_gt, $alias = Opal.alias, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('raise,name,new,>,length,Rational,to_i'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'NilClass'); + + + self.$$prototype.$$meta = self; + (function(self, $parent_nesting) { + + + + $def(self, '$allocate', function $$allocate() { + var self = this; + + return $Kernel.$raise($$$('TypeError'), "allocator undefined for " + (self.$name())) + }); + + + Opal.udef(self, '$' + "new"); return nil; })(Opal.get_singleton_class(self)); + + $def(self, '$!', $return_val(true)); + + $def(self, '$&', $return_val(false)); + + $def(self, '$|', function $NilClass_$$1(other) { + + return other !== false && other !== nil; + }); + + $def(self, '$^', function $NilClass_$$2(other) { + + return other !== false && other !== nil; + }); + + $def(self, '$==', function $NilClass_$eq_eq$3(other) { + + return other === nil; + }); + + $def(self, '$dup', $return_val(nil)); + + $def(self, '$clone', function $$clone($kwargs) { + + + $kwargs = $ensure_kwargs($kwargs); + + $kwargs.$$smap["freeze"]; return nil; + }, -1); + + $def(self, '$inspect', $return_val("nil")); + + $def(self, '$nil?', $return_val(true)); + + $def(self, '$singleton_class', function $$singleton_class() { + + return $NilClass + }); + + $def(self, '$to_a', function $$to_a() { + + return [] + }); + + $def(self, '$to_h', function $$to_h() { + + return Opal.hash(); + }); + + $def(self, '$to_i', $return_val(0)); + + $def(self, '$to_s', $return_val("")); + + $def(self, '$to_c', function $$to_c() { + + return $$$('Complex').$new(0, 0) + }); + + $def(self, '$rationalize', function $$rationalize($a) { + var $post_args, args; + + + $post_args = $slice(arguments); + args = $post_args; + if ($truthy($rb_gt(args.$length(), 1))) { + $Kernel.$raise($$$('ArgumentError')); + } return $Kernel.$Rational(0, 1); + }, -1); + + $def(self, '$to_r', function $$to_r() { + + return $Kernel.$Rational(0, 1) + }); + + $def(self, '$instance_variables', function $$instance_variables() { + + return [] + }); + return $alias(self, "to_f", "to_i"); + })('::', null) + }; + + Opal.modules["corelib/boolean"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $Kernel = Opal.Kernel, $def = Opal.def, $return_self = Opal.return_self, $ensure_kwargs = Opal.ensure_kwargs, $slice = Opal.slice, $truthy = Opal.truthy, $send2 = Opal.send2, $find_super = Opal.find_super, $to_a = Opal.to_a, $alias = Opal.alias, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('raise,name,==,to_s,__id__'); + + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Boolean'); + + + Opal.prop(self.$$prototype, '$$is_boolean', true); + + var properties = ['$$class', '$$meta']; + + for (var i = 0; i < properties.length; i++) { + Object.defineProperty(self.$$prototype, properties[i], { + configurable: true, + enumerable: false, + get: function() { + return this == true ? Opal.TrueClass : + this == false ? Opal.FalseClass : + Opal.Boolean; + } + }); + } + + Object.defineProperty(self.$$prototype, "$$id", { + configurable: true, + enumerable: false, + get: function() { + return this == true ? 2 : + this == false ? 0 : + nil; + } + }); + (function(self, $parent_nesting) { + + + + $def(self, '$allocate', function $$allocate() { + var self = this; + + return $Kernel.$raise($$$('TypeError'), "allocator undefined for " + (self.$name())) + }); + + + Opal.udef(self, '$' + "new"); return nil; })(Opal.get_singleton_class(self)); + + $def(self, '$__id__', function $$__id__() { + var self = this; + + return self.valueOf() ? 2 : 0; + }); + + $def(self, '$!', function $Boolean_$excl$1() { + var self = this; + + return self != true; + }); + + $def(self, '$&', function $Boolean_$$2(other) { + var self = this; + + return (self == true) ? (other !== false && other !== nil) : false; + }); + + $def(self, '$|', function $Boolean_$$3(other) { + var self = this; + + return (self == true) ? true : (other !== false && other !== nil); + }); + + $def(self, '$^', function $Boolean_$$4(other) { + var self = this; + + return (self == true) ? (other === false || other === nil) : (other !== false && other !== nil); + }); + + $def(self, '$==', function $Boolean_$eq_eq$5(other) { + var self = this; + + return (self == true) === other.valueOf(); + }); + + $def(self, '$singleton_class', function $$singleton_class() { + var self = this; + + return self.$$meta; + }); + + $def(self, '$to_s', function $$to_s() { + var self = this; + + return (self == true) ? 'true' : 'false'; + }); + + $def(self, '$dup', $return_self); + + $def(self, '$clone', function $$clone($kwargs) { + var self = this; + + + $kwargs = $ensure_kwargs($kwargs); + + $kwargs.$$smap["freeze"]; return self; + }, -1); + + $def(self, '$method_missing', function $$method_missing(method, $a) { + var block = $$method_missing.$$p || nil, $post_args, args, self = this; + + $$method_missing.$$p = null; + $post_args = $slice(arguments, 1); + args = $post_args; + var body = self.$$class.$$prototype[Opal.jsid(method)]; + if (!$truthy(typeof body !== 'undefined' && !body.$$stub)) { + $send2(self, $find_super(self, 'method_missing', $$method_missing, false, true), 'method_missing', [method].concat($to_a(args)), block); + } return Opal.send(self, body, args, block); + }, -2); + + $def(self, '$respond_to_missing?', function $Boolean_respond_to_missing$ques$6(method, _include_all) { + var self = this; + var body = self.$$class.$$prototype[Opal.jsid(method)]; + return typeof body !== 'undefined' && !body.$$stub; }, -2); + $alias(self, "eql?", "=="); + $alias(self, "equal?", "=="); + $alias(self, "inspect", "to_s"); + return $alias(self, "object_id", "__id__"); + })('::', Boolean); + $klass('::', $$$('Boolean'), 'TrueClass'); + return ($klass('::', $$$('Boolean'), 'FalseClass'), nil); + }; + + Opal.modules["corelib/comparable"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $truthy = Opal.truthy, $module = Opal.module, $rb_gt = Opal.rb_gt, $rb_lt = Opal.rb_lt, $eqeqeq = Opal.eqeqeq, $Kernel = Opal.Kernel, $def = Opal.def, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('>,<,===,raise,class,<=>,equal?'); + return (function($base) { + var self = $module($base, 'Comparable'); + + var $ret_or_1 = nil; + + + + function normalize(what) { + if (Opal.is_a(what, Opal.Integer)) { return what; } + + if ($rb_gt(what, 0)) { return 1; } + if ($rb_lt(what, 0)) { return -1; } + return 0; + } + + function fail_comparison(lhs, rhs) { + var class_name; + (($eqeqeq(nil, ($ret_or_1 = rhs)) || (($eqeqeq(true, $ret_or_1) || (($eqeqeq(false, $ret_or_1) || (($eqeqeq($$$('Integer'), $ret_or_1) || ($eqeqeq($$$('Float'), $ret_or_1))))))))) ? (class_name = rhs.$inspect()) : (class_name = rhs.$$class)); + $Kernel.$raise($$$('ArgumentError'), "comparison of " + ((lhs).$class()) + " with " + (class_name) + " failed"); + } + + function cmp_or_fail(lhs, rhs) { + var cmp = (lhs)['$<=>'](rhs); + if (!$truthy(cmp)) fail_comparison(lhs, rhs); + return normalize(cmp); + } + + $def(self, '$==', function $Comparable_$eq_eq$1(other) { + var self = this, cmp = nil; + + + if ($truthy(self['$equal?'](other))) { + return true + } + if (self["$<=>"] == Opal.Kernel["$<=>"]) { + return false; + } + + // check for infinite recursion + if (self.$$comparable) { + self.$$comparable = false; + return false; + } + if (!$truthy((cmp = self['$<=>'](other)))) { + return false + } return normalize(cmp) == 0; }); + + $def(self, '$>', function $Comparable_$gt$2(other) { + var self = this; + + return cmp_or_fail(self, other) > 0; + }); + + $def(self, '$>=', function $Comparable_$gt_eq$3(other) { + var self = this; + + return cmp_or_fail(self, other) >= 0; + }); + + $def(self, '$<', function $Comparable_$lt$4(other) { + var self = this; + + return cmp_or_fail(self, other) < 0; + }); + + $def(self, '$<=', function $Comparable_$lt_eq$5(other) { + var self = this; + + return cmp_or_fail(self, other) <= 0; + }); + + $def(self, '$between?', function $Comparable_between$ques$6(min, max) { + var self = this; + + + if ($rb_lt(self, min)) { + return false + } if ($rb_gt(self, max)) { + return false + } return true; + }); + return $def(self, '$clamp', function $$clamp(min, max) { + var self = this; + + + if (max == null) max = nil; + + var c, excl; + + if (max === nil) { + // We are dealing with a new Ruby 2.7 behaviour that we are able to + // provide a single Range argument instead of 2 Comparables. + + if (!Opal.is_a(min, Opal.Range)) { + $Kernel.$raise($$$('TypeError'), "wrong argument type " + (min.$class()) + " (expected Range)"); + } + + excl = min.excl; + max = min.end; + min = min.begin; + + if (max !== nil && excl) { + $Kernel.$raise($$$('ArgumentError'), "cannot clamp with an exclusive range"); + } + } + + if (min !== nil && max !== nil && cmp_or_fail(min, max) > 0) { + $Kernel.$raise($$$('ArgumentError'), "min argument must be smaller than max argument"); + } + + if (min !== nil) { + c = cmp_or_fail(self, min); + + if (c == 0) return self; + if (c < 0) return min; + } + + if (max !== nil) { + c = cmp_or_fail(self, max); + + if (c > 0) return max; + } + + return self; + }, -2); + })('::') + }; + + Opal.modules["corelib/regexp"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $coerce_to = Opal.coerce_to, $prop = Opal.prop, $freeze = Opal.freeze, $klass = Opal.klass, $const_set = Opal.const_set, $send2 = Opal.send2, $find_super = Opal.find_super, $def = Opal.def, $truthy = Opal.truthy, $gvars = Opal.gvars, $slice = Opal.slice, $Kernel = Opal.Kernel, $Opal = Opal.Opal, $alias = Opal.alias, $send = Opal.send, $hash2 = Opal.hash2, $rb_plus = Opal.rb_plus, $ensure_kwargs = Opal.ensure_kwargs, $rb_ge = Opal.rb_ge, $to_a = Opal.to_a, $eqeqeq = Opal.eqeqeq, $rb_minus = Opal.rb_minus, $return_ivar = Opal.return_ivar, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('nil?,[],raise,escape,options,to_str,new,join,coerce_to!,!,match,coerce_to?,begin,frozen?,uniq,map,scan,source,to_proc,transform_values,group_by,each_with_index,+,last,=~,==,attr_reader,>=,length,is_a?,include?,names,regexp,named_captures,===,captures,-,inspect,empty?,each,to_a'); + + $klass('::', $$$('StandardError'), 'RegexpError'); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Regexp'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $const_set(self, 'IGNORECASE', 1); + $const_set(self, 'EXTENDED', 2); + $const_set(self, 'MULTILINE', 4); + Opal.prop(self.$$prototype, '$$is_regexp', true); + (function(self, $parent_nesting) { + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$allocate', function $$allocate() { + var $yield = $$allocate.$$p || nil, self = this, allocated = nil; + + $$allocate.$$p = null; + + allocated = $send2(self, $find_super(self, 'allocate', $$allocate, false, true), 'allocate', [], $yield); + allocated.uninitialized = true; + return allocated; + }); + + $def(self, '$escape', function $$escape(string) { + + return Opal.escape_regexp(string); + }); + + $def(self, '$last_match', function $$last_match(n) { + if ($gvars["~"] == null) $gvars["~"] = nil; + + + if (n == null) n = nil; + if ($truthy(n['$nil?']())) { + return $gvars["~"] + } else if ($truthy($gvars["~"])) { + return $gvars["~"]['$[]'](n) + } else { + return nil + } }, -1); + + $def(self, '$union', function $$union($a) { + var $post_args, parts, self = this; + + + $post_args = $slice(arguments); + parts = $post_args; + + var is_first_part_array, quoted_validated, part, options, each_part_options; + if (parts.length == 0) { + return /(?!)/; + } + // return fast if there's only one element + if (parts.length == 1 && parts[0].$$is_regexp) { + return parts[0]; + } + // cover the 2 arrays passed as arguments case + is_first_part_array = parts[0].$$is_array; + if (parts.length > 1 && is_first_part_array) { + $Kernel.$raise($$$('TypeError'), "no implicit conversion of Array into String"); + } + // deal with splat issues (related to https://github.com/opal/opal/issues/858) + if (is_first_part_array) { + parts = parts[0]; + } + options = undefined; + quoted_validated = []; + for (var i=0; i < parts.length; i++) { + part = parts[i]; + if (part.$$is_string) { + quoted_validated.push(self.$escape(part)); + } + else if (part.$$is_regexp) { + each_part_options = (part).$options(); + if (options != undefined && options != each_part_options) { + $Kernel.$raise($$$('TypeError'), "All expressions must use the same options"); + } + options = each_part_options; + quoted_validated.push('('+part.source+')'); + } + else { + quoted_validated.push(self.$escape((part).$to_str())); + } + } + return self.$new((quoted_validated).$join("|"), options); + }, -1); + + $def(self, '$new', function $new$1(regexp, options) { + + if (regexp.$$is_regexp) { + return new RegExp(regexp); + } + + regexp = $Opal['$coerce_to!'](regexp, $$$('String'), "to_str"); + + if (regexp.charAt(regexp.length - 1) === '\\' && regexp.charAt(regexp.length - 2) !== '\\') { + $Kernel.$raise($$$('RegexpError'), "too short escape sequence: /" + (regexp) + "/"); + } + + regexp = regexp.replace('\\A', '^').replace('\\z', '$'); + + if (options === undefined || options['$!']()) { + return new RegExp(regexp); + } + + if (options.$$is_number) { + var temp = ''; + if ($$('IGNORECASE') & options) { temp += 'i'; } + if ($$('MULTILINE') & options) { temp += 'm'; } + options = temp; + } + else { + options = 'i'; + } + + return new RegExp(regexp, options); + }, -2); + $alias(self, "compile", "new"); + return $alias(self, "quote", "escape"); + })(Opal.get_singleton_class(self), $nesting); + + $def(self, '$==', function $Regexp_$eq_eq$2(other) { + var self = this; + + return other instanceof RegExp && self.toString() === other.toString(); + }); + + $def(self, '$===', function $Regexp_$eq_eq_eq$3(string) { + var self = this; + + return self.$match($Opal['$coerce_to?'](string, $$$('String'), "to_str")) !== nil + }); + + $def(self, '$=~', function $Regexp_$eq_tilde$4(string) { + var self = this, $ret_or_1 = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ($truthy(($ret_or_1 = self.$match(string)))) { + return $gvars["~"].$begin(0) + } else { + return $ret_or_1 + } + }); + + $def(self, '$freeze', function $$freeze() { + var self = this; + + + if ($truthy(self['$frozen?']())) { + return self + } + if (!self.hasOwnProperty('$$g')) { $prop(self, '$$g', null); } + if (!self.hasOwnProperty('$$gm')) { $prop(self, '$$gm', null); } + + return $freeze(self); + }); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + + var regexp_format = /^\/(.*)\/([^\/]*)$/; + var value = self.toString(); + var matches = regexp_format.exec(value); + if (matches) { + var regexp_pattern = matches[1]; + var regexp_flags = matches[2]; + var chars = regexp_pattern.split(''); + var chars_length = chars.length; + var char_escaped = false; + var regexp_pattern_escaped = ''; + for (var i = 0; i < chars_length; i++) { + var current_char = chars[i]; + if (!char_escaped && current_char == '/') { + regexp_pattern_escaped = regexp_pattern_escaped.concat('\\'); + } + regexp_pattern_escaped = regexp_pattern_escaped.concat(current_char); + if (current_char == '\\') { + if (char_escaped) { + // does not over escape + char_escaped = false; + } else { + char_escaped = true; + } + } else { + char_escaped = false; + } + } + return '/' + regexp_pattern_escaped + '/' + regexp_flags; + } else { + return value; + } + + }); + + $def(self, '$match', function $$match(string, pos) { + var block = $$match.$$p || nil, self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + $$match.$$p = null; + + if (self.uninitialized) { + $Kernel.$raise($$$('TypeError'), "uninitialized Regexp"); + } + + if (pos === undefined) { + if (string === nil) return ($gvars["~"] = nil); + var m = self.exec($coerce_to(string, $$$('String'), 'to_str')); + if (m) { + ($gvars["~"] = $$$('MatchData').$new(self, m)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } else { + return ($gvars["~"] = nil); + } + } + + pos = $coerce_to(pos, $$$('Integer'), 'to_int'); + + if (string === nil) { + return ($gvars["~"] = nil); + } + + string = $coerce_to(string, $$$('String'), 'to_str'); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return ($gvars["~"] = nil); + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + while (true) { + md = re.exec(string); + if (md === null) { + return ($gvars["~"] = nil); + } + if (md.index >= pos) { + ($gvars["~"] = $$$('MatchData').$new(re, md)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } + re.lastIndex = md.index + 1; + } + }, -2); + + $def(self, '$match?', function $Regexp_match$ques$5(string, pos) { + var self = this; + + if (self.uninitialized) { + $Kernel.$raise($$$('TypeError'), "uninitialized Regexp"); + } + + if (pos === undefined) { + return string === nil ? false : self.test($coerce_to(string, $$$('String'), 'to_str')); + } + + pos = $coerce_to(pos, $$$('Integer'), 'to_int'); + + if (string === nil) { + return false; + } + + string = $coerce_to(string, $$$('String'), 'to_str'); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return false; + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + md = re.exec(string); + if (md === null || md.index < pos) { + return false; + } else { + return true; + } + }, -2); + + $def(self, '$names', function $$names() { + var self = this; + + return $send(self.$source().$scan(/\(?<(\w+)>/, $hash2(["no_matchdata"], {"no_matchdata": true})), 'map', [], "first".$to_proc()).$uniq() + }); + + $def(self, '$named_captures', function $$named_captures() { + var self = this; + + return $send($send($send(self.$source().$scan(/\(?<(\w+)>/, $hash2(["no_matchdata"], {"no_matchdata": true})), 'map', [], "first".$to_proc()).$each_with_index(), 'group_by', [], "first".$to_proc()), 'transform_values', [], function $$6(i){ + + if (i == null) i = nil; + return $send(i, 'map', [], function $$7(j){ + + if (j == null) j = nil; + return $rb_plus(j.$last(), 1);});}) + }); + + $def(self, '$~', function $Regexp_$$8() { + var self = this; + if ($gvars._ == null) $gvars._ = nil; + + return self['$=~']($gvars._) + }); + + $def(self, '$source', function $$source() { + var self = this; + + return self.source; + }); + + $def(self, '$options', function $$options() { + var self = this; + + + if (self.uninitialized) { + $Kernel.$raise($$$('TypeError'), "uninitialized Regexp"); + } + var result = 0; + // should be supported in IE6 according to https://msdn.microsoft.com/en-us/library/7f5z26w4(v=vs.94).aspx + if (self.multiline) { + result |= $$('MULTILINE'); + } + if (self.ignoreCase) { + result |= $$('IGNORECASE'); + } + return result; + + }); + + $def(self, '$casefold?', function $Regexp_casefold$ques$9() { + var self = this; + + return self.ignoreCase; + }); + $alias(self, "eql?", "=="); + return $alias(self, "to_s", "source"); + })('::', RegExp, $nesting); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'MatchData'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.matches = nil; + + self.$attr_reader("post_match", "pre_match", "regexp", "string"); + + $def(self, '$initialize', function $$initialize(regexp, match_groups, $kwargs) { + var no_matchdata, self = this; + + + $kwargs = $ensure_kwargs($kwargs); + + no_matchdata = $kwargs.$$smap["no_matchdata"];if (no_matchdata == null) no_matchdata = false; + if (!$truthy(no_matchdata)) { + $gvars["~"] = self; + } self.regexp = regexp; + self.begin = match_groups.index; + self.string = match_groups.input; + self.pre_match = match_groups.input.slice(0, match_groups.index); + self.post_match = match_groups.input.slice(match_groups.index + match_groups[0].length); + self.matches = []; + + for (var i = 0, length = match_groups.length; i < length; i++) { + var group = match_groups[i]; + + if (group == null) { + self.matches.push(nil); + } + else { + self.matches.push(group); + } + } + }, -3); + + $def(self, '$match', function $$match(idx) { + var self = this, match = nil; + + if ($truthy((match = self['$[]'](idx)))) { + return match + } else if (($truthy(idx['$is_a?']($$('Integer'))) && ($truthy($rb_ge(idx, self.$length()))))) { + return $Kernel.$raise($$$('IndexError'), "index " + (idx) + " out of matches") + } else { + return nil + } + }); + + $def(self, '$match_length', function $$match_length(idx) { + var $a, self = this; + + return ($a = self.$match(idx), ($a === nil || $a == null) ? nil : $a.$length()) + }); + + $def(self, '$[]', function $MatchData_$$$10($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + + if (args[0].$$is_string) { + if (self.$regexp().$names()['$include?'](args['$[]'](0))['$!']()) { + $Kernel.$raise($$$('IndexError'), "undefined group name reference: " + (args['$[]'](0))); + } + return self.$named_captures()['$[]'](args['$[]'](0)) + } + else { + return $send(self.matches, '[]', $to_a(args)) + } + }, -1); + + $def(self, '$offset', function $$offset(n) { + var self = this; + + + if (n !== 0) { + $Kernel.$raise($$$('ArgumentError'), "MatchData#offset only supports 0th element"); + } + return [self.begin, self.begin + self.matches[n].length]; + + }); + + $def(self, '$==', function $MatchData_$eq_eq$11(other) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil, $ret_or_3 = nil, $ret_or_4 = nil; + + + if (!$eqeqeq($$$('MatchData'), other)) { + return false + } if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = ($truthy(($ret_or_4 = self.string == other.string)) ? (self.regexp.toString() == other.regexp.toString()) : ($ret_or_4)))) ? (self.pre_match == other.pre_match) : ($ret_or_3)))) ? (self.post_match == other.post_match) : ($ret_or_2))))) { + return self.begin == other.begin; + } else { + return $ret_or_1 + } }); + + $def(self, '$begin', function $$begin(n) { + var self = this; + + + if (n !== 0) { + $Kernel.$raise($$$('ArgumentError'), "MatchData#begin only supports 0th element"); + } + return self.begin; + + }); + + $def(self, '$end', function $$end(n) { + var self = this; + + + if (n !== 0) { + $Kernel.$raise($$$('ArgumentError'), "MatchData#end only supports 0th element"); + } + return self.begin + self.matches[n].length; + + }); + + $def(self, '$captures', function $$captures() { + var self = this; + + return self.matches.slice(1) + }); + + $def(self, '$named_captures', function $$named_captures() { + var self = this, matches = nil; + + + matches = self.$captures(); + return $send(self.$regexp().$named_captures(), 'transform_values', [], function $$12(i){ + + if (i == null) i = nil; + return matches['$[]']($rb_minus(i.$last(), 1));}); + }); + + $def(self, '$names', function $$names() { + var self = this; + + return self.$regexp().$names() + }); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + + var str = "#"; + + }); + + $def(self, '$length', function $$length() { + var self = this; + + return self.matches.length + }); + + $def(self, '$to_a', $return_ivar("matches")); + + $def(self, '$to_s', function $$to_s() { + var self = this; + + return self.matches[0] + }); + + $def(self, '$values_at', function $$values_at($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + + var i, a, index, values = []; + + for (i = 0; i < args.length; i++) { + + if (args[i].$$is_range) { + a = (args[i]).$to_a(); + a.unshift(i, 1); + Array.prototype.splice.apply(args, a); + } + + index = $Opal['$coerce_to!'](args[i], $$$('Integer'), "to_int"); + + if (index < 0) { + index += self.matches.length; + if (index < 0) { + values.push(nil); + continue; + } + } + + values.push(self.matches[index]); + } + + return values; + }, -1); + $alias(self, "eql?", "=="); + return $alias(self, "size", "length"); + })($nesting[0], null, $nesting); + }; + + Opal.modules["corelib/string"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $coerce_to = Opal.coerce_to, $respond_to = Opal.respond_to, $global_multiline_regexp = Opal.global_multiline_regexp, $prop = Opal.prop, $klass = Opal.klass, $def = Opal.def, $Opal = Opal.Opal, $defs = Opal.defs, $slice = Opal.slice, $send = Opal.send, $to_a = Opal.to_a, $extract_kwargs = Opal.extract_kwargs, $ensure_kwargs = Opal.ensure_kwargs, $eqeqeq = Opal.eqeqeq, $Kernel = Opal.Kernel, $truthy = Opal.truthy, $gvars = Opal.gvars, $rb_divide = Opal.rb_divide, $rb_plus = Opal.rb_plus, $eqeq = Opal.eqeq, $hash2 = Opal.hash2, $alias = Opal.alias, $const_set = Opal.const_set, self = Opal.top, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,include,coerce_to?,initialize,===,format,raise,respond_to?,to_s,to_str,<=>,==,=~,new,force_encoding,casecmp,empty?,ljust,ceil,/,+,rjust,floor,coerce_to!,nil?,class,copy_singleton_methods,initialize_clone,initialize_dup,enum_for,chomp,[],to_i,length,each_line,to_proc,to_a,match,match?,captures,proc,succ,escape,include?,upcase,unicode_normalize,dup,__id__,next,intern,pristine'); + + self.$require("corelib/comparable"); + self.$require("corelib/regexp"); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'String'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$$('Comparable')); + + Opal.prop(self.$$prototype, '$$is_string', true); + + $def(self, '$__id__', function $$__id__() { + var self = this; + + return self.toString(); + }); + $defs(self, '$try_convert', function $$try_convert(what) { + + return $Opal['$coerce_to?'](what, $$$('String'), "to_str") + }); + $defs(self, '$new', function $String_new$1($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + + var str = args[0] || ""; + var opts = args[args.length-1]; + str = $coerce_to(str, $$$('String'), 'to_str'); + if (opts && opts.$$is_hash) { + if (opts.$$smap.encoding) str = str.$force_encoding(opts.$$smap.encoding); + } + str = new self.$$constructor(str); + if (!str.$initialize.$$pristine) $send((str), 'initialize', $to_a(args)); + return str; + }, -1); + + $def(self, '$initialize', function $$initialize($a, $b) { + var $post_args, $kwargs; + + + $post_args = $slice(arguments); + $kwargs = $extract_kwargs($post_args); + $kwargs = $ensure_kwargs($kwargs); + + if ($post_args.length > 0) $post_args.shift(); + $kwargs.$$smap["encoding"]; + $kwargs.$$smap["capacity"]; return nil; + }, -1); + + $def(self, '$%', function $String_$percent$2(data) { + var self = this; + + if ($eqeqeq($$$('Array'), data)) { + return $send(self, 'format', [self].concat($to_a(data))) + } else { + return self.$format(self, data) + } + }); + + $def(self, '$*', function $String_$$3(count) { + var self = this; + + + count = $coerce_to(count, $$$('Integer'), 'to_int'); + + if (count < 0) { + $Kernel.$raise($$$('ArgumentError'), "negative argument"); + } + + if (count === 0) { + return ''; + } + + var result = '', + string = self.toString(); + + // All credit for the bit-twiddling magic code below goes to Mozilla + // polyfill implementation of String.prototype.repeat() posted here: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat + + if (string.length * count >= 1 << 28) { + $Kernel.$raise($$$('RangeError'), "multiply count must not overflow maximum string size"); + } + + for (;;) { + if ((count & 1) === 1) { + result += string; + } + count >>>= 1; + if (count === 0) { + break; + } + string += string; + } + + return result; + + }); + + $def(self, '$+', function $String_$plus$4(other) { + var self = this; + + + other = $coerce_to(other, $$$('String'), 'to_str'); + + if (other == "" && self.$$class === Opal.String) return self; + if (self == "" && other.$$class === Opal.String) return other; + var out = self + other; + if (self.encoding === out.encoding && other.encoding === out.encoding) return out; + if (self.encoding.name === "UTF-8" || other.encoding.name === "UTF-8") return out; + return Opal.enc(out, self.encoding); + }); + + $def(self, '$<=>', function $String_$lt_eq_gt$5(other) { + var self = this; + + if ($truthy(other['$respond_to?']("to_str"))) { + + other = other.$to_str().$to_s(); + return self > other ? 1 : (self < other ? -1 : 0); } else { + + var cmp = other['$<=>'](self); + + if (cmp === nil) { + return nil; + } + else { + return cmp > 0 ? -1 : (cmp < 0 ? 1 : 0); + } + + } + }); + + $def(self, '$==', function $String_$eq_eq$6(other) { + var self = this; + + + if (other.$$is_string) { + return self.toString() === other.toString(); + } + if ($respond_to(other, '$to_str')) { + return other['$=='](self); + } + return false; + + }); + + $def(self, '$=~', function $String_$eq_tilde$7(other) { + var self = this; + + + if (other.$$is_string) { + $Kernel.$raise($$$('TypeError'), "type mismatch: String given"); + } + + return other['$=~'](self); + + }); + + $def(self, '$[]', function $String_$$$8(index, length) { + var self = this; + + var size = self.length, exclude, range; + + if (index.$$is_range) { + exclude = index.excl; + range = index; + length = index.end === nil ? -1 : $coerce_to(index.end, $$$('Integer'), 'to_int'); + index = index.begin === nil ? 0 : $coerce_to(index.begin, $$$('Integer'), 'to_int'); + + if (Math.abs(index) > size) { + return nil; + } + + if (index < 0) { + index += size; + } + + if (length < 0) { + length += size; + } + + if (!exclude || range.end === nil) { + length += 1; + } + + length = length - index; + + if (length < 0) { + length = 0; + } + + return self.substr(index, length); + } + + + if (index.$$is_string) { + if (length != null) { + $Kernel.$raise($$$('TypeError')); + } + return self.indexOf(index) !== -1 ? index : nil; + } + + + if (index.$$is_regexp) { + var match = self.match(index); + + if (match === null) { + ($gvars["~"] = nil); + return nil; + } + + ($gvars["~"] = $$$('MatchData').$new(index, match)); + + if (length == null) { + return match[0]; + } + + length = $coerce_to(length, $$$('Integer'), 'to_int'); + + if (length < 0 && -length < match.length) { + return match[length += match.length]; + } + + if (length >= 0 && length < match.length) { + return match[length]; + } + + return nil; + } + + + index = $coerce_to(index, $$$('Integer'), 'to_int'); + + if (index < 0) { + index += size; + } + + if (length == null) { + if (index >= size || index < 0) { + return nil; + } + return self.substr(index, 1); + } + + length = $coerce_to(length, $$$('Integer'), 'to_int'); + + if (length < 0) { + return nil; + } + + if (index > size || index < 0) { + return nil; + } + + return self.substr(index, length); + }, -2); + + $def(self, '$b', function $$b() { + var self = this; + + return (new String(self)).$force_encoding("binary") + }); + + $def(self, '$capitalize', function $$capitalize() { + var self = this; + + return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase(); + }); + + $def(self, '$casecmp', function $$casecmp(other) { + var self = this; + + + if (!$truthy(other['$respond_to?']("to_str"))) { + return nil + } other = ($coerce_to(other, $$$('String'), 'to_str')).$to_s(); + + var ascii_only = /^[\x00-\x7F]*$/; + if (ascii_only.test(self) && ascii_only.test(other)) { + self = self.toLowerCase(); + other = other.toLowerCase(); + } + return self['$<=>'](other); + }); + + $def(self, '$casecmp?', function $String_casecmp$ques$9(other) { + var self = this; + + + var cmp = self.$casecmp(other); + if (cmp === nil) { + return nil; + } else { + return cmp === 0; + } + + }); + + $def(self, '$center', function $$center(width, padstr) { + var self = this; + + + if (padstr == null) padstr = " "; + width = $coerce_to(width, $$$('Integer'), 'to_int'); + padstr = ($coerce_to(padstr, $$$('String'), 'to_str')).$to_s(); + if ($truthy(padstr['$empty?']())) { + $Kernel.$raise($$$('ArgumentError'), "zero width padding"); + } if ($truthy(width <= self.length)) { + return self + } + var ljustified = self.$ljust($rb_divide($rb_plus(width, self.length), 2).$ceil(), padstr), + rjustified = self.$rjust($rb_divide($rb_plus(width, self.length), 2).$floor(), padstr); + + return rjustified + ljustified.slice(self.length); + }, -2); + + $def(self, '$chomp', function $$chomp(separator) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + if (separator == null) separator = $gvars["/"]; + if ($truthy(separator === nil || self.length === 0)) { + return self + } separator = $Opal['$coerce_to!'](separator, $$$('String'), "to_str").$to_s(); + + var result; + + if (separator === "\n") { + result = self.replace(/\r?\n?$/, ''); + } + else if (separator === "") { + result = self.replace(/(\r?\n)+$/, ''); + } + else if (self.length >= separator.length) { + var tail = self.substr(self.length - separator.length, separator.length); + + if (tail === separator) { + result = self.substr(0, self.length - separator.length); + } + } + + if (result != null) { + return result; + } + return self; + }, -1); + + $def(self, '$chop', function $$chop() { + var self = this; + + + var length = self.length, result; + + if (length <= 1) { + result = ""; + } else if (self.charAt(length - 1) === "\n" && self.charAt(length - 2) === "\r") { + result = self.substr(0, length - 2); + } else { + result = self.substr(0, length - 1); + } + + return result; + + }); + + $def(self, '$chr', function $$chr() { + var self = this; + + return self.charAt(0); + }); + + $def(self, '$clone', function $$clone($kwargs) { + var freeze, self = this, copy = nil; + + + $kwargs = $ensure_kwargs($kwargs); + + freeze = $kwargs.$$smap["freeze"];if (freeze == null) freeze = nil; + if (!(($truthy(freeze['$nil?']()) || ($eqeq(freeze, true))) || ($eqeq(freeze, false)))) { + self.$raise($$('ArgumentError'), "unexpected value for freeze: " + (freeze.$class())); + } copy = new String(self); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self, $hash2(["freeze"], {"freeze": freeze})); + if ($eqeq(freeze, true)) { + if (!copy.$$frozen) { copy.$$frozen = true; } + } else if ($truthy(freeze['$nil?']())) { + if (self.$$frozen) { copy.$$frozen = true; } + } return copy; + }, -1); + + $def(self, '$dup', function $$dup() { + var self = this, copy = nil; + + + copy = new String(self); + copy.$initialize_dup(self); + return copy; + }); + + $def(self, '$count', function $$count($a) { + var $post_args, sets, self = this; + + + $post_args = $slice(arguments); + sets = $post_args; + + if (sets.length === 0) { + $Kernel.$raise($$$('ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)"); + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return 0; + } + return self.length - self.replace(new RegExp(char_class, 'g'), '').length; + }, -1); + + $def(self, '$delete', function $String_delete$10($a) { + var $post_args, sets, self = this; + + + $post_args = $slice(arguments); + sets = $post_args; + + if (sets.length === 0) { + $Kernel.$raise($$$('ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)"); + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.replace(new RegExp(char_class, 'g'), ''); + }, -1); + + $def(self, '$delete_prefix', function $$delete_prefix(prefix) { + var self = this; + + + if (!prefix.$$is_string) { + prefix = $coerce_to(prefix, $$$('String'), 'to_str'); + } + + if (self.slice(0, prefix.length) === prefix) { + return self.slice(prefix.length); + } else { + return self; + } + + }); + + $def(self, '$delete_suffix', function $$delete_suffix(suffix) { + var self = this; + + + if (!suffix.$$is_string) { + suffix = $coerce_to(suffix, $$$('String'), 'to_str'); + } + + if (self.slice(self.length - suffix.length) === suffix) { + return self.slice(0, self.length - suffix.length); + } else { + return self; + } + + }); + + $def(self, '$downcase', function $$downcase() { + var self = this; + + return self.toLowerCase(); + }); + + $def(self, '$each_line', function $$each_line($a, $b) { + var block = $$each_line.$$p || nil, $post_args, $kwargs, separator, chomp, self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + $$each_line.$$p = null; + $post_args = $slice(arguments); + $kwargs = $extract_kwargs($post_args); + $kwargs = $ensure_kwargs($kwargs); + + if ($post_args.length > 0) separator = $post_args.shift();if (separator == null) separator = $gvars["/"]; + + chomp = $kwargs.$$smap["chomp"];if (chomp == null) chomp = false; + if (!(block !== nil)) { + return self.$enum_for("each_line", separator, $hash2(["chomp"], {"chomp": chomp})) + } + if (separator === nil) { + Opal.yield1(block, self); + + return self; + } + + separator = $coerce_to(separator, $$$('String'), 'to_str'); + + var a, i, n, length, chomped, trailing, splitted, value; + + if (separator.length === 0) { + for (a = self.split(/((?:\r?\n){2})(?:(?:\r?\n)*)/), i = 0, n = a.length; i < n; i += 2) { + if (a[i] || a[i + 1]) { + value = (a[i] || "") + (a[i + 1] || ""); + if (chomp) { + value = (value).$chomp("\n"); + } + Opal.yield1(block, value); + } + } + + return self; + } + + chomped = self.$chomp(separator); + trailing = self.length != chomped.length; + splitted = chomped.split(separator); + + for (i = 0, length = splitted.length; i < length; i++) { + value = splitted[i]; + if (i < length - 1 || trailing) { + value += separator; + } + if (chomp) { + value = (value).$chomp(separator); + } + Opal.yield1(block, value); + } + return self; + }, -1); + + $def(self, '$empty?', function $String_empty$ques$11() { + var self = this; + + return self.length === 0; + }); + + $def(self, '$end_with?', function $String_end_with$ques$12($a) { + var $post_args, suffixes, self = this; + + + $post_args = $slice(arguments); + suffixes = $post_args; + + for (var i = 0, length = suffixes.length; i < length; i++) { + var suffix = $coerce_to(suffixes[i], $$$('String'), 'to_str').$to_s(); + + if (self.length >= suffix.length && + self.substr(self.length - suffix.length, suffix.length) == suffix) { + return true; + } + } + return false; + }, -1); + + $def(self, '$gsub', function $$gsub(pattern, replacement) { + var block = $$gsub.$$p || nil, self = this; + + $$gsub.$$p = null; + + if (replacement === undefined && block === nil) { + return self.$enum_for("gsub", pattern); + } + + var result = '', match_data = nil, index = 0, match, _replacement; + + if (pattern.$$is_regexp) { + pattern = $global_multiline_regexp(pattern); + } else { + pattern = $coerce_to(pattern, $$$('String'), 'to_str'); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + var lastIndex; + while (true) { + match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil); + result += self.slice(index); + break; + } + + match_data = $$$('MatchData').$new(pattern, match); + + if (replacement === undefined) { + lastIndex = pattern.lastIndex; + _replacement = block(match[0]); + pattern.lastIndex = lastIndex; // save and restore lastIndex + } + else if (replacement.$$is_hash) { + _replacement = (replacement)['$[]'](match[0]).$to_s(); + } + else { + if (!replacement.$$is_string) { + replacement = $coerce_to(replacement, $$$('String'), 'to_str'); + } + _replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + } + + if (pattern.lastIndex === match.index) { + result += (self.slice(index, match.index) + _replacement + (self[match.index] || "")); + pattern.lastIndex += 1; + } + else { + result += (self.slice(index, match.index) + _replacement); + } + index = pattern.lastIndex; + } + + ($gvars["~"] = match_data); + return result; + }, -2); + + $def(self, '$hash', function $$hash() { + var self = this; + + return self.toString(); + }); + + $def(self, '$hex', function $$hex() { + var self = this; + + return self.$to_i(16) + }); + + $def(self, '$include?', function $String_include$ques$13(other) { + var self = this; + + + if (!other.$$is_string) { + other = $coerce_to(other, $$$('String'), 'to_str'); + } + return self.indexOf(other) !== -1; + + }); + + $def(self, '$index', function $$index(search, offset) { + var self = this; + + var index, + match, + regex; + + if (offset === undefined) { + offset = 0; + } else { + offset = $coerce_to(offset, $$$('Integer'), 'to_int'); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + regex = $global_multiline_regexp(search); + while (true) { + match = regex.exec(self); + if (match === null) { + ($gvars["~"] = nil); + index = -1; + break; + } + if (match.index >= offset) { + ($gvars["~"] = $$$('MatchData').$new(regex, match)); + index = match.index; + break; + } + regex.lastIndex = match.index + 1; + } + } else { + search = $coerce_to(search, $$$('String'), 'to_str'); + if (search.length === 0 && offset > self.length) { + index = -1; + } else { + index = self.indexOf(search, offset); + } + } + + return index === -1 ? nil : index; + }, -2); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + + /* eslint-disable no-misleading-character-class */ + var escapable = /[\\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + meta = { + '\u0007': '\\a', + '\u001b': '\\e', + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\v': '\\v', + '"' : '\\"', + '\\': '\\\\' + }, + escaped = self.replace(escapable, function (chr) { + if (meta[chr]) return meta[chr]; + chr = chr.charCodeAt(0); + if (chr <= 0xff && (self.encoding["$binary?"]() || self.internal_encoding["$binary?"]())) { + return '\\x' + ('00' + chr.toString(16).toUpperCase()).slice(-2); + } else { + return '\\u' + ('0000' + chr.toString(16).toUpperCase()).slice(-4); + } + }); + return '"' + escaped.replace(/\#[\$\@\{]/g, '\\$&') + '"'; + /* eslint-enable no-misleading-character-class */ + + }); + + $def(self, '$intern', function $$intern() { + var self = this; + + return self.toString(); + }); + + $def(self, '$length', function $$length() { + var self = this; + + return self.length; + }); + $alias(self, "size", "length"); + + $def(self, '$lines', function $$lines($a, $b) { + var block = $$lines.$$p || nil, $post_args, $kwargs, separator, chomp, self = this, e = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + $$lines.$$p = null; + $post_args = $slice(arguments); + $kwargs = $extract_kwargs($post_args); + $kwargs = $ensure_kwargs($kwargs); + + if ($post_args.length > 0) separator = $post_args.shift();if (separator == null) separator = $gvars["/"]; + + chomp = $kwargs.$$smap["chomp"];if (chomp == null) chomp = false; + e = $send(self, 'each_line', [separator, $hash2(["chomp"], {"chomp": chomp})], block.$to_proc()); + if ($truthy(block)) { + return self + } else { + return e.$to_a() + } }, -1); + + $def(self, '$ljust', function $$ljust(width, padstr) { + var self = this; + + + if (padstr == null) padstr = " "; + width = $coerce_to(width, $$$('Integer'), 'to_int'); + padstr = ($coerce_to(padstr, $$$('String'), 'to_str')).$to_s(); + if ($truthy(padstr['$empty?']())) { + $Kernel.$raise($$$('ArgumentError'), "zero width padding"); + } if ($truthy(width <= self.length)) { + return self + } + var index = -1, + result = ""; + + width -= self.length; + + while (++index < width) { + result += padstr; + } + + return self + result.slice(0, width); + }, -2); + + $def(self, '$lstrip', function $$lstrip() { + var self = this; + + return self.replace(/^[\u0000\s]*/, ''); + }); + + $def(self, '$ascii_only?', function $String_ascii_only$ques$14() { + var self = this; + + + if (!self.encoding.ascii) return false; + return /^[\x00-\x7F]*$/.test(self); + + }); + + $def(self, '$match', function $$match(pattern, pos) { + var block = $$match.$$p || nil, self = this; + + $$match.$$p = null; + if (($eqeqeq($$('String'), pattern) || ($truthy(pattern['$respond_to?']("to_str"))))) { + pattern = $$$('Regexp').$new(pattern.$to_str()); + } if (!$eqeqeq($$$('Regexp'), pattern)) { + $Kernel.$raise($$$('TypeError'), "wrong argument type " + (pattern.$class()) + " (expected Regexp)"); + } return $send(pattern, 'match', [self, pos], block.$to_proc()); + }, -2); + + $def(self, '$match?', function $String_match$ques$15(pattern, pos) { + var self = this; + if (($eqeqeq($$('String'), pattern) || ($truthy(pattern['$respond_to?']("to_str"))))) { + pattern = $$$('Regexp').$new(pattern.$to_str()); + } if (!$eqeqeq($$$('Regexp'), pattern)) { + $Kernel.$raise($$$('TypeError'), "wrong argument type " + (pattern.$class()) + " (expected Regexp)"); + } return pattern['$match?'](self, pos); + }, -2); + + $def(self, '$next', function $$next() { + var self = this; + + + var i = self.length; + if (i === 0) { + return ''; + } + var result = self; + var first_alphanum_char_index = self.search(/[a-zA-Z0-9]/); + var carry = false; + var code; + while (i--) { + code = self.charCodeAt(i); + if ((code >= 48 && code <= 57) || + (code >= 65 && code <= 90) || + (code >= 97 && code <= 122)) { + switch (code) { + case 57: + carry = true; + code = 48; + break; + case 90: + carry = true; + code = 65; + break; + case 122: + carry = true; + code = 97; + break; + default: + carry = false; + code += 1; + } + } else { + if (first_alphanum_char_index === -1) { + if (code === 255) { + carry = true; + code = 0; + } else { + carry = false; + code += 1; + } + } else { + carry = true; + } + } + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i + 1); + if (carry && (i === 0 || i === first_alphanum_char_index)) { + switch (code) { + case 65: + break; + case 97: + break; + default: + code += 1; + } + if (i === 0) { + result = String.fromCharCode(code) + result; + } else { + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i); + } + carry = false; + } + if (!carry) { + break; + } + } + return result; + + }); + + $def(self, '$oct', function $$oct() { + var self = this; + + + var result, + string = self, + radix = 8; + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x') { + return original; + } + } + switch (flag) { + case '0b': + radix = 2; + break; + case '0': + case '0o': + radix = 8; + break; + case '0d': + radix = 10; + break; + case '0x': + radix = 16; + break; + } + return head + tail; + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + + }); + + $def(self, '$ord', function $$ord() { + var self = this; + + + if (typeof self.codePointAt === "function") { + return self.codePointAt(0); + } + else { + return self.charCodeAt(0); + } + + }); + + $def(self, '$partition', function $$partition(sep) { + var self = this; + + + var i, m; + + if (sep.$$is_regexp) { + m = sep.exec(self); + if (m === null) { + i = -1; + } else { + $$$('MatchData').$new(sep, m); + sep = m[0]; + i = m.index; + } + } else { + sep = $coerce_to(sep, $$$('String'), 'to_str'); + i = self.indexOf(sep); + } + + if (i === -1) { + return [self, '', '']; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }); + + $def(self, '$reverse', function $$reverse() { + var self = this; + + return self.split('').reverse().join(''); + }); + + $def(self, '$rindex', function $$rindex(search, offset) { + var self = this; + + var i, m, r, _m; + + if (offset === undefined) { + offset = self.length; + } else { + offset = $coerce_to(offset, $$$('Integer'), 'to_int'); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + m = null; + r = $global_multiline_regexp(search); + while (true) { + _m = r.exec(self); + if (_m === null || _m.index > offset) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + if (m === null) { + ($gvars["~"] = nil); + i = -1; + } else { + $$$('MatchData').$new(r, m); + i = m.index; + } + } else { + search = $coerce_to(search, $$$('String'), 'to_str'); + i = self.lastIndexOf(search, offset); + } + + return i === -1 ? nil : i; + }, -2); + + $def(self, '$rjust', function $$rjust(width, padstr) { + var self = this; + + + if (padstr == null) padstr = " "; + width = $coerce_to(width, $$$('Integer'), 'to_int'); + padstr = ($coerce_to(padstr, $$$('String'), 'to_str')).$to_s(); + if ($truthy(padstr['$empty?']())) { + $Kernel.$raise($$$('ArgumentError'), "zero width padding"); + } if ($truthy(width <= self.length)) { + return self + } + var chars = Math.floor(width - self.length), + patterns = Math.floor(chars / padstr.length), + result = Array(patterns + 1).join(padstr), + remaining = chars - result.length; + + return result + padstr.slice(0, remaining) + self; + }, -2); + + $def(self, '$rpartition', function $$rpartition(sep) { + var self = this; + + + var i, m, r, _m; + + if (sep.$$is_regexp) { + m = null; + r = $global_multiline_regexp(sep); + + while (true) { + _m = r.exec(self); + if (_m === null) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + + if (m === null) { + i = -1; + } else { + $$$('MatchData').$new(r, m); + sep = m[0]; + i = m.index; + } + + } else { + sep = $coerce_to(sep, $$$('String'), 'to_str'); + i = self.lastIndexOf(sep); + } + + if (i === -1) { + return ['', '', self]; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }); + + $def(self, '$rstrip', function $$rstrip() { + var self = this; + + return self.replace(/[\s\u0000]*$/, ''); + }); + + $def(self, '$scan', function $$scan(pattern, $kwargs) { + var block = $$scan.$$p || nil, no_matchdata, self = this; + + $$scan.$$p = null; + $kwargs = $ensure_kwargs($kwargs); + + no_matchdata = $kwargs.$$smap["no_matchdata"];if (no_matchdata == null) no_matchdata = false; + + var result = [], + match_data = nil, + match; + + if (pattern.$$is_regexp) { + pattern = $global_multiline_regexp(pattern); + } else { + pattern = $coerce_to(pattern, $$$('String'), 'to_str'); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + while ((match = pattern.exec(self)) != null) { + match_data = $$$('MatchData').$new(pattern, match, $hash2(["no_matchdata"], {"no_matchdata": no_matchdata})); + if (block === nil) { + match.length == 1 ? result.push(match[0]) : result.push((match_data).$captures()); + } else { + match.length == 1 ? Opal.yield1(block, match[0]) : Opal.yield1(block, (match_data).$captures()); + } + if (pattern.lastIndex === match.index) { + pattern.lastIndex += 1; + } + } + + if (!no_matchdata) ($gvars["~"] = match_data); + + return (block !== nil ? self : result); + }, -2); + + $def(self, '$singleton_class', function $$singleton_class() { + var self = this; + + return Opal.get_singleton_class(self); + }); + + $def(self, '$split', function $$split(pattern, limit) { + var self = this, $ret_or_1 = nil; + if ($gvars[";"] == null) $gvars[";"] = nil; + + if (self.length === 0) { + return []; + } + + if (limit === undefined) { + limit = 0; + } else { + limit = $Opal['$coerce_to!'](limit, $$$('Integer'), "to_int"); + if (limit === 1) { + return [self]; + } + } + + if (pattern === undefined || pattern === nil) { + pattern = ($truthy(($ret_or_1 = $gvars[";"])) ? ($ret_or_1) : (" ")); + } + + var result = [], + string = self.toString(), + index = 0, + match, + i, ii; + + if (pattern.$$is_regexp) { + pattern = $global_multiline_regexp(pattern); + } else { + pattern = $coerce_to(pattern, $$$('String'), 'to_str').$to_s(); + if (pattern === ' ') { + pattern = /\s+/gm; + string = string.replace(/^\s+/, ''); + } else { + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + } + + result = string.split(pattern); + + if (result.length === 1 && result[0] === string) { + return [result[0]]; + } + + while ((i = result.indexOf(undefined)) !== -1) { + result.splice(i, 1); + } + + if (limit === 0) { + while (result[result.length - 1] === '') { + result.length -= 1; + } + return result; + } + + match = pattern.exec(string); + + if (limit < 0) { + if (match !== null && match[0] === '' && pattern.source.indexOf('(?=') === -1) { + for (i = 0, ii = match.length; i < ii; i++) { + result.push(''); + } + } + return result; + } + + if (match !== null && match[0] === '') { + result.splice(limit - 1, result.length - 1, result.slice(limit - 1).join('')); + return result; + } + + if (limit >= result.length) { + return result; + } + + i = 0; + while (match !== null) { + i++; + index = pattern.lastIndex; + if (i + 1 === limit) { + break; + } + match = pattern.exec(string); + } + result.splice(limit - 1, result.length - 1, string.slice(index)); + return result; + }, -1); + + $def(self, '$squeeze', function $$squeeze($a) { + var $post_args, sets, self = this; + + + $post_args = $slice(arguments); + sets = $post_args; + + if (sets.length === 0) { + return self.replace(/(.)\1+/g, '$1'); + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.replace(new RegExp('(' + char_class + ')\\1+', 'g'), '$1'); + }, -1); + + $def(self, '$start_with?', function $String_start_with$ques$16($a) { + var $post_args, prefixes, self = this; + + + $post_args = $slice(arguments); + prefixes = $post_args; + + for (var i = 0, length = prefixes.length; i < length; i++) { + if (prefixes[i].$$is_regexp) { + var regexp = prefixes[i]; + var match = regexp.exec(self); + + if (match != null && match.index === 0) { + ($gvars["~"] = $$$('MatchData').$new(regexp, match)); + return true; + } else { + ($gvars["~"] = nil); + } + } else { + var prefix = $coerce_to(prefixes[i], $$$('String'), 'to_str').$to_s(); + + if (self.indexOf(prefix) === 0) { + return true; + } + } + } + + return false; + }, -1); + + $def(self, '$strip', function $$strip() { + var self = this; + + return self.replace(/^[\s\u0000]*|[\s\u0000]*$/g, ''); + }); + + $def(self, '$sub', function $$sub(pattern, replacement) { + var block = $$sub.$$p || nil, self = this; + + $$sub.$$p = null; + + if (!pattern.$$is_regexp) { + pattern = $coerce_to(pattern, $$$('String'), 'to_str'); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')); + } + + var result, match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil); + result = self.toString(); + } else { + $$$('MatchData').$new(pattern, match); + + if (replacement === undefined) { + + if (block === nil) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (1 for 2)"); + } + result = self.slice(0, match.index) + block(match[0]) + self.slice(match.index + match[0].length); + + } else if (replacement.$$is_hash) { + + result = self.slice(0, match.index) + (replacement)['$[]'](match[0]).$to_s() + self.slice(match.index + match[0].length); + + } else { + + replacement = $coerce_to(replacement, $$$('String'), 'to_str'); + + replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + + result = self.slice(0, match.index) + replacement + self.slice(match.index + match[0].length); + } + } + + return result; + }, -2); + + $def(self, '$sum', function $$sum(n) { + var self = this; + + + if (n == null) n = 16; + + n = $coerce_to(n, $$$('Integer'), 'to_int'); + + var result = 0, + length = self.length, + i = 0; + + for (; i < length; i++) { + result += self.charCodeAt(i); + } + + if (n <= 0) { + return result; + } + + return result & (Math.pow(2, n) - 1); + }, -1); + + $def(self, '$swapcase', function $$swapcase() { + var self = this; + + + var str = self.replace(/([a-z]+)|([A-Z]+)/g, function($0,$1,$2) { + return $1 ? $0.toUpperCase() : $0.toLowerCase(); + }); + + return str; + + }); + + $def(self, '$to_f', function $$to_f() { + var self = this; + + + if (self.charAt(0) === '_') { + return 0; + } + + var result = parseFloat(self.replace(/_/g, '')); + + if (isNaN(result) || result == Infinity || result == -Infinity) { + return 0; + } + else { + return result; + } + + }); + + $def(self, '$to_i', function $$to_i(base) { + var self = this; + + + if (base == null) base = 10; + + var result, + string = self.toLowerCase(), + radix = $coerce_to(base, $$$('Integer'), 'to_int'); + + if (radix === 1 || radix < 0 || radix > 36) { + $Kernel.$raise($$$('ArgumentError'), "invalid radix " + (radix)); + } + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x' && (radix === 0 || radix === 16)) { + return original; + } + } + switch (flag) { + case '0b': + if (radix === 0 || radix === 2) { + radix = 2; + return head + tail; + } + break; + case '0': + case '0o': + if (radix === 0 || radix === 8) { + radix = 8; + return head + tail; + } + break; + case '0d': + if (radix === 0 || radix === 10) { + radix = 10; + return head + tail; + } + break; + case '0x': + if (radix === 0 || radix === 16) { + radix = 16; + return head + tail; + } + break; + } + return original + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + }, -1); + + $def(self, '$to_proc', function $$to_proc() { + $$to_proc.$$p || nil; var self = this, method_name = nil, jsid = nil, proc = nil; + + $$to_proc.$$p = null; + + method_name = self.valueOf(); + jsid = Opal.jsid(method_name); + proc = $send($Kernel, 'proc', [], function $$17($a){var block = $$17.$$p || nil, $post_args, args; + + $$17.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + + if (args.length === 0) { + $Kernel.$raise($$$('ArgumentError'), "no receiver given"); + } + + var recv = args[0]; + + if (recv == null) recv = nil; + + var body = recv[jsid]; + + if (!body) { + body = recv.$method_missing; + args[0] = method_name; + } else { + args = args.slice(1); + } + + if (typeof block === 'function') { + body.$$p = block; + } + + if (args.length === 0) { + return body.call(recv); + } else { + return body.apply(recv, args); + } + }, -1); + proc.$$source_location = nil; + return proc; + }); + + $def(self, '$to_s', function $$to_s() { + var self = this; + + return self.toString(); + }); + + $def(self, '$tr', function $$tr(from, to) { + var self = this; + + + from = $coerce_to(from, $$$('String'), 'to_str').$to_s(); + to = $coerce_to(to, $$$('String'), 'to_str').$to_s(); + + if (from.length == 0 || from === to) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1]; + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + $Kernel.$raise($$$('ArgumentError'), "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration"); + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_to == null) { + last_to = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_to.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + $Kernel.$raise($$$('ArgumentError'), "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration"); + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_to = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + + var new_str = ''; + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch]; + if (inverse) { + new_str += (sub == null ? global_sub : ch); + } + else { + new_str += (sub != null ? sub : ch); + } + } + return new_str; + + }); + + $def(self, '$tr_s', function $$tr_s(from, to) { + var self = this; + + + from = $coerce_to(from, $$$('String'), 'to_str').$to_s(); + to = $coerce_to(to, $$$('String'), 'to_str').$to_s(); + + if (from.length == 0) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1]; + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + $Kernel.$raise($$$('ArgumentError'), "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration"); + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_from == null) { + last_from = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + $Kernel.$raise($$$('ArgumentError'), "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration"); + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + var new_str = ''; + var last_substitute = null; + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch]; + if (inverse) { + if (sub == null) { + if (last_substitute == null) { + new_str += global_sub; + last_substitute = true; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + else { + if (sub != null) { + if (last_substitute == null || last_substitute !== sub) { + new_str += sub; + last_substitute = sub; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + } + return new_str; + + }); + + $def(self, '$upcase', function $$upcase() { + var self = this; + + return self.toUpperCase(); + }); + + $def(self, '$upto', function $$upto(stop, excl) { + var block = $$upto.$$p || nil, self = this; + + $$upto.$$p = null; + if (excl == null) excl = false; + if (!(block !== nil)) { + return self.$enum_for("upto", stop, excl) + } + var a, b, s = self.toString(); + + stop = $coerce_to(stop, $$$('String'), 'to_str'); + + if (s.length === 1 && stop.length === 1) { + + a = s.charCodeAt(0); + b = stop.charCodeAt(0); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(String.fromCharCode(a)); + + a += 1; + } + + } else if (parseInt(s, 10).toString() === s && parseInt(stop, 10).toString() === stop) { + + a = parseInt(s, 10); + b = parseInt(stop, 10); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(a.toString()); + + a += 1; + } + + } else { + + while (s.length <= stop.length && s <= stop) { + if (excl && s === stop) { + break; + } + + block(s); + + s = (s).$succ(); + } + + } + return self; + }, -2); + + function char_class_from_char_sets(sets) { + function explode_sequences_in_character_set(set) { + var result = '', + i, len = set.length, + curr_char, + skip_next_dash, + char_code_from, + char_code_upto, + char_code; + for (i = 0; i < len; i++) { + curr_char = set.charAt(i); + if (curr_char === '-' && i > 0 && i < (len - 1) && !skip_next_dash) { + char_code_from = set.charCodeAt(i - 1); + char_code_upto = set.charCodeAt(i + 1); + if (char_code_from > char_code_upto) { + $Kernel.$raise($$$('ArgumentError'), "invalid range \"" + (char_code_from) + "-" + (char_code_upto) + "\" in string transliteration"); + } + for (char_code = char_code_from + 1; char_code < char_code_upto + 1; char_code++) { + result += String.fromCharCode(char_code); + } + skip_next_dash = true; + i++; + } else { + skip_next_dash = (curr_char === '\\'); + result += curr_char; + } + } + return result; + } + + function intersection(setA, setB) { + if (setA.length === 0) { + return setB; + } + var result = '', + i, len = setA.length, + chr; + for (i = 0; i < len; i++) { + chr = setA.charAt(i); + if (setB.indexOf(chr) !== -1) { + result += chr; + } + } + return result; + } + + var i, len, set, neg, chr, tmp, + pos_intersection = '', + neg_intersection = ''; + + for (i = 0, len = sets.length; i < len; i++) { + set = $coerce_to(sets[i], $$$('String'), 'to_str'); + neg = (set.charAt(0) === '^' && set.length > 1); + set = explode_sequences_in_character_set(neg ? set.slice(1) : set); + if (neg) { + neg_intersection = intersection(neg_intersection, set); + } else { + pos_intersection = intersection(pos_intersection, set); + } + } + + if (pos_intersection.length > 0 && neg_intersection.length > 0) { + tmp = ''; + for (i = 0, len = pos_intersection.length; i < len; i++) { + chr = pos_intersection.charAt(i); + if (neg_intersection.indexOf(chr) === -1) { + tmp += chr; + } + } + pos_intersection = tmp; + neg_intersection = ''; + } + + if (pos_intersection.length > 0) { + return '[' + $$$('Regexp').$escape(pos_intersection) + ']'; + } + + if (neg_intersection.length > 0) { + return '[^' + $$$('Regexp').$escape(neg_intersection) + ']'; + } + + return null; + } + + $def(self, '$instance_variables', function $$instance_variables() { + + return [] + }); + $defs(self, '$_load', function $$_load($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'new', $to_a(args)); + }, -1); + + $def(self, '$unicode_normalize', function $$unicode_normalize(form) { + var self = this; + + + if (form == null) form = "nfc"; + if (!$truthy(["nfc", "nfd", "nfkc", "nfkd"]['$include?'](form))) { + $Kernel.$raise($$$('ArgumentError'), "Invalid normalization form " + (form)); + } return self.normalize(form.$upcase()); + }, -1); + + $def(self, '$unicode_normalized?', function $String_unicode_normalized$ques$18(form) { + var self = this; + + + if (form == null) form = "nfc"; + return self.$unicode_normalize(form)['$=='](self); + }, -1); + + $def(self, '$unpack', function $$unpack(format) { + + return $Kernel.$raise("To use String#unpack, you must first require 'corelib/string/unpack'.") + }); + + $def(self, '$unpack1', function $$unpack1(format) { + + return $Kernel.$raise("To use String#unpack1, you must first require 'corelib/string/unpack'.") + }); + + $def(self, '$freeze', function $$freeze() { + var self = this; + + + if (typeof self === 'string') { return self; } + $prop(self, "$$frozen", true); + return self; + + }); + + $def(self, '$-@', function $String_$minus$$19() { + var self = this; + + + if (typeof self === 'string') return self; + if (self.$$frozen) return self; + if (self.encoding.name == 'UTF-8' && self.internal_encoding.name == 'UTF-8') return self.toString(); + return self.$dup().$freeze(); + + }); + + $def(self, '$frozen?', function $String_frozen$ques$20() { + var self = this; + + return typeof self === 'string' || self.$$frozen === true; + }); + $alias(self, "+@", "dup"); + $alias(self, "===", "=="); + $alias(self, "byteslice", "[]"); + $alias(self, "eql?", "=="); + $alias(self, "equal?", "==="); + $alias(self, "object_id", "__id__"); + $alias(self, "slice", "[]"); + $alias(self, "succ", "next"); + $alias(self, "to_str", "to_s"); + $alias(self, "to_sym", "intern"); + return $Opal.$pristine(self, "initialize"); + })('::', String, $nesting); + return $const_set($nesting[0], 'Symbol', $$('String')); + }; + + Opal.modules["corelib/enumerable"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $truthy = Opal.truthy, $coerce_to = Opal.coerce_to, $yield1 = Opal.yield1, $yieldX = Opal.yieldX, $deny_frozen_access = Opal.deny_frozen_access, $module = Opal.module, $send = Opal.send, $slice = Opal.slice, $to_a = Opal.to_a, $Opal = Opal.Opal, $thrower = Opal.thrower, $def = Opal.def, $Kernel = Opal.Kernel, $return_val = Opal.return_val, $rb_gt = Opal.rb_gt, $rb_times = Opal.rb_times, $rb_lt = Opal.rb_lt, $eqeq = Opal.eqeq, $rb_plus = Opal.rb_plus, $rb_minus = Opal.rb_minus, $rb_divide = Opal.rb_divide, $rb_le = Opal.rb_le, $hash2 = Opal.hash2, $lambda = Opal.lambda, $not = Opal.not, $alias = Opal.alias, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('each,public_send,destructure,to_enum,enumerator_size,new,yield,raise,slice_when,!,enum_for,flatten,map,to_proc,compact,to_a,warn,proc,==,nil?,respond_to?,coerce_to!,>,*,try_convert,<,+,-,ceil,/,size,select,__send__,length,<=,[],push,<<,[]=,===,inspect,<=>,first,reverse,sort,take,sort_by,compare,call,dup,sort!,map!,include?,-@,key?,values,transform_values,group_by,fetch,to_h,coerce_to?,class,zip,detect,find_all,collect_concat,collect,inject,entries'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Enumerable'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + function comparableForPattern(value) { + if (value.length === 0) { + value = [nil]; + } + + if (value.length > 1) { + value = [value]; + } + + return value; + } + + $def(self, '$all?', function $Enumerable_all$ques$1(pattern) {try { var $t_return = $thrower('return'); + var block = $Enumerable_all$ques$1.$$p || nil, self = this; + + $Enumerable_all$ques$1.$$p = null; + + ; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], function $$2($a){var $post_args, value, comparable = nil; + + + $post_args = $slice(arguments); + value = $post_args; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat($to_a(comparable))))) { + return nil + } else { + $t_return.$throw(false); + };}, {$$arity: -1, $$ret: $t_return}); + } else if ((block !== nil)) { + $send(self, 'each', [], function $$3($a){var $post_args, value; + + + $post_args = $slice(arguments); + value = $post_args; + if ($truthy(Opal.yieldX(block, $to_a(value)))) { + return nil + } else { + $t_return.$throw(false); + };}, {$$arity: -1, $$ret: $t_return}); + } else { + $send(self, 'each', [], function $$4($a){var $post_args, value; + + + $post_args = $slice(arguments); + value = $post_args; + if ($truthy($Opal.$destructure(value))) { + return nil + } else { + $t_return.$throw(false); + };}, {$$arity: -1, $$ret: $t_return}); + }; + return true;} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }, -1); + + $def(self, '$any?', function $Enumerable_any$ques$5(pattern) {try { var $t_return = $thrower('return'); + var block = $Enumerable_any$ques$5.$$p || nil, self = this; + + $Enumerable_any$ques$5.$$p = null; + + ; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], function $$6($a){var $post_args, value, comparable = nil; + + + $post_args = $slice(arguments); + value = $post_args; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat($to_a(comparable))))) { + $t_return.$throw(true); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + } else if ((block !== nil)) { + $send(self, 'each', [], function $$7($a){var $post_args, value; + + + $post_args = $slice(arguments); + value = $post_args; + if ($truthy(Opal.yieldX(block, $to_a(value)))) { + $t_return.$throw(true); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + } else { + $send(self, 'each', [], function $$8($a){var $post_args, value; + + + $post_args = $slice(arguments); + value = $post_args; + if ($truthy($Opal.$destructure(value))) { + $t_return.$throw(true); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + }; + return false;} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }, -1); + + $def(self, '$chunk', function $$chunk() { + var block = $$chunk.$$p || nil, self = this; + + $$chunk.$$p = null; + if (!(block !== nil)) { + return $send(self, 'to_enum', ["chunk"], function $$9(){var self = $$9.$$s == null ? this : $$9.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } return $send($$$('Enumerator'), 'new', [], function $$10(yielder){var self = $$10.$$s == null ? this : $$10.$$s; + + + if (yielder == null) yielder = nil; + + var previous = nil, accumulate = []; + + function releaseAccumulate() { + if (accumulate.length > 0) { + yielder.$yield(previous, accumulate); + } + } + + self.$each.$$p = function(value) { + var key = $yield1(block, value); + + if (key === nil) { + releaseAccumulate(); + accumulate = []; + previous = nil; + } else { + if (previous === nil || previous === key) { + accumulate.push(value); + } else { + releaseAccumulate(); + accumulate = [value]; + } + + previous = key; + } + }; + + self.$each(); + + releaseAccumulate(); + }, {$$s: self}); + }); + + $def(self, '$chunk_while', function $$chunk_while() { + var block = $$chunk_while.$$p || nil, self = this; + + $$chunk_while.$$p = null; + if (!(block !== nil)) { + $Kernel.$raise($$$('ArgumentError'), "no block given"); + } return $send(self, 'slice_when', [], function $$11(before, after){ + + if (before == null) before = nil; + if (after == null) after = nil; + return Opal.yieldX(block, [before, after])['$!']();}); + }); + + $def(self, '$collect', function $$collect() { + var block = $$collect.$$p || nil, self = this; + + $$collect.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["collect"], function $$12(){var self = $$12.$$s == null ? this : $$12.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } + var result = []; + + self.$each.$$p = function() { + var value = $yieldX(block, arguments); + + result.push(value); + }; + + self.$each(); + + return result; + }); + + $def(self, '$collect_concat', function $$collect_concat() { + var block = $$collect_concat.$$p || nil, self = this; + + $$collect_concat.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["collect_concat"], function $$13(){var self = $$13.$$s == null ? this : $$13.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } return $send(self, 'map', [], block.$to_proc()).$flatten(1); + }); + + $def(self, '$compact', function $$compact() { + var self = this; + + return self.$to_a().$compact() + }); + + $def(self, '$count', function $$count(object) { + var block = $$count.$$p || nil, self = this, result = nil; + + $$count.$$p = null; + result = 0; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used"); + } + if ($truthy(object != null)) { + block = $send($Kernel, 'proc', [], function $$14($a){var $post_args, args; + + + $post_args = $slice(arguments); + args = $post_args; + return $Opal.$destructure(args)['$=='](object);}, -1); + } else if ($truthy(block['$nil?']())) { + block = $send($Kernel, 'proc', [], $return_val(true)); + } $send(self, 'each', [], function $$15($a){var $post_args, args; + + + $post_args = $slice(arguments); + args = $post_args; + if ($truthy($yieldX(block, args))) { + return result++; + } else { + return nil + }}, -1); + return result; + }, -1); + + $def(self, '$cycle', function $$cycle(n) { + var block = $$cycle.$$p || nil, self = this; + + $$cycle.$$p = null; + if (n == null) n = nil; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["cycle", n], function $$16(){var self = $$16.$$s == null ? this : $$16.$$s; + + if ($truthy(n['$nil?']())) { + if ($truthy(self['$respond_to?']("size"))) { + return $$$($$$('Float'), 'INFINITY') + } else { + return nil + } + } else { + + n = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + } }}, {$$s: self}) + } if (!$truthy(n['$nil?']())) { + + n = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + if ($truthy(n <= 0)) { + return nil + } } + var all = [], i, length; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments); + $yield1(block, param); + + all.push(param); + }; + + self.$each(); + + if (all.length === 0) { + return nil; + } + + if (n === nil) { + while (true) { + for (i = 0, length = all.length; i < length; i++) { + $yield1(block, all[i]); + } + } + } + else { + while (n > 1) { + for (i = 0, length = all.length; i < length; i++) { + $yield1(block, all[i]); + } + + n--; + } + } + }, -1); + + $def(self, '$detect', function $$detect(ifnone) {try { var $t_return = $thrower('return'); + var block = $$detect.$$p || nil, self = this; + + $$detect.$$p = null; + + ; + ; + if (!(block !== nil)) { + return self.$enum_for("detect", ifnone) + }; + $send(self, 'each', [], function $$17($a){var $post_args, args, value = nil; + + + $post_args = $slice(arguments); + args = $post_args; + value = $Opal.$destructure(args); + if ($truthy(Opal.yield1(block, value))) { + $t_return.$throw(value); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + + if (ifnone !== undefined) { + if (typeof(ifnone) === 'function') { + return ifnone(); + } else { + return ifnone; + } + } + ; + return nil;} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }, -1); + + $def(self, '$drop', function $$drop(number) { + var self = this; + + + number = $coerce_to(number, $$$('Integer'), 'to_int'); + if ($truthy(number < 0)) { + $Kernel.$raise($$$('ArgumentError'), "attempt to drop negative size"); + } + var result = [], + current = 0; + + self.$each.$$p = function() { + if (number <= current) { + result.push($Opal.$destructure(arguments)); + } + + current++; + }; + + self.$each(); + + return result; + }); + + $def(self, '$drop_while', function $$drop_while() { + var block = $$drop_while.$$p || nil, self = this; + + $$drop_while.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("drop_while") + } + var result = [], + dropping = true; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments); + + if (dropping) { + var value = $yield1(block, param); + + if (!$truthy(value)) { + dropping = false; + result.push(param); + } + } + else { + result.push(param); + } + }; + + self.$each(); + + return result; + }); + + $def(self, '$each_cons', function $$each_cons(n) { + var block = $$each_cons.$$p || nil, self = this; + + $$each_cons.$$p = null; + if ($truthy(arguments.length != 1)) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 1)"); + } n = $Opal.$try_convert(n, $$$('Integer'), "to_int"); + if ($truthy(n <= 0)) { + $Kernel.$raise($$$('ArgumentError'), "invalid size"); + } if (!(block !== nil)) { + return $send(self, 'enum_for', ["each_cons", n], function $$18(){var self = $$18.$$s == null ? this : $$18.$$s, enum_size = nil; + + + enum_size = self.$enumerator_size(); + if ($truthy(enum_size['$nil?']())) { + return nil + } else if (($eqeq(enum_size, 0) || ($truthy($rb_lt(enum_size, n))))) { + return 0 + } else { + return $rb_plus($rb_minus(enum_size, n), 1) + }}, {$$s: self}) + } + var buffer = []; + + self.$each.$$p = function() { + var element = $Opal.$destructure(arguments); + buffer.push(element); + if (buffer.length > n) { + buffer.shift(); + } + if (buffer.length == n) { + $yield1(block, buffer.slice(0, n)); + } + }; + + self.$each(); + + return self; + }); + + $def(self, '$each_entry', function $$each_entry($a) { + var block = $$each_entry.$$p || nil, $post_args, data, self = this; + + $$each_entry.$$p = null; + $post_args = $slice(arguments); + data = $post_args; + if (!(block !== nil)) { + return $send(self, 'to_enum', ["each_entry"].concat($to_a(data)), function $$19(){var self = $$19.$$s == null ? this : $$19.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } + self.$each.$$p = function() { + var item = $Opal.$destructure(arguments); + + $yield1(block, item); + }; + + self.$each.apply(self, data); + + return self; + }, -1); + + $def(self, '$each_slice', function $$each_slice(n) { + var block = $$each_slice.$$p || nil, self = this; + + $$each_slice.$$p = null; + n = $coerce_to(n, $$$('Integer'), 'to_int'); + if ($truthy(n <= 0)) { + $Kernel.$raise($$$('ArgumentError'), "invalid slice size"); + } if (!(block !== nil)) { + return $send(self, 'enum_for', ["each_slice", n], function $$20(){var self = $$20.$$s == null ? this : $$20.$$s; + + if ($truthy(self['$respond_to?']("size"))) { + return $rb_divide(self.$size(), n).$ceil() + } else { + return nil + }}, {$$s: self}) + } + var slice = []; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments); + + slice.push(param); + + if (slice.length === n) { + $yield1(block, slice); + slice = []; + } + }; + + self.$each(); + + // our "last" group, if smaller than n then won't have been yielded + if (slice.length > 0) { + $yield1(block, slice); + } + return self; + }); + + $def(self, '$each_with_index', function $$each_with_index($a) { + var block = $$each_with_index.$$p || nil, $post_args, args, self = this; + + $$each_with_index.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["each_with_index"].concat($to_a(args)), function $$21(){var self = $$21.$$s == null ? this : $$21.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } + var index = 0; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments); + + block(param, index); + + index++; + }; + + self.$each.apply(self, args); + return self; + }, -1); + + $def(self, '$each_with_object', function $$each_with_object(object) { + var block = $$each_with_object.$$p || nil, self = this; + + $$each_with_object.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["each_with_object", object], function $$22(){var self = $$22.$$s == null ? this : $$22.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments); + + block(param, object); + }; + + self.$each(); + return object; + }); + + $def(self, '$entries', function $$entries($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + + var result = []; + + self.$each.$$p = function() { + result.push($Opal.$destructure(arguments)); + }; + + self.$each.apply(self, args); + + return result; + }, -1); + + $def(self, '$filter_map', function $$filter_map() { + var block = $$filter_map.$$p || nil, self = this; + + $$filter_map.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["filter_map"], function $$23(){var self = $$23.$$s == null ? this : $$23.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } return $send($send(self, 'map', [], block.$to_proc()), 'select', [], "itself".$to_proc()); + }); + + $def(self, '$find_all', function $$find_all() { + var block = $$find_all.$$p || nil, self = this; + + $$find_all.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["find_all"], function $$24(){var self = $$24.$$s == null ? this : $$24.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } + var result = []; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = $yield1(block, param); + + if ($truthy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + }); + + $def(self, '$find_index', function $$find_index(object) {try { var $t_return = $thrower('return'); + var block = $$find_index.$$p || nil, self = this, index = nil; + + $$find_index.$$p = null; + + ; + ; + if ($truthy(object === undefined && block === nil)) { + return self.$enum_for("find_index") + }; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used"); + } + ; + index = 0; + if ($truthy(object != null)) { + $send(self, 'each', [], function $$25($a){var $post_args, value; + + + $post_args = $slice(arguments); + value = $post_args; + if ($eqeq($Opal.$destructure(value), object)) { + $t_return.$throw(index); + }; + return index += 1;;}, {$$arity: -1, $$ret: $t_return}); + } else { + $send(self, 'each', [], function $$26($a){var $post_args, value; + + + $post_args = $slice(arguments); + value = $post_args; + if ($truthy(Opal.yieldX(block, $to_a(value)))) { + $t_return.$throw(index); + }; + return index += 1;;}, {$$arity: -1, $$ret: $t_return}); + }; + return nil;} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }, -1); + + $def(self, '$first', function $$first(number) {try { var $t_return = $thrower('return'); + var self = this, result = nil, current = nil; + + + ; + if ($truthy(number === undefined)) { + return $send(self, 'each', [], function $$27(value){ + + if (value == null) value = nil; + $t_return.$throw(value);}, {$$ret: $t_return}) + } else { + + result = []; + number = $coerce_to(number, $$$('Integer'), 'to_int'); + if ($truthy(number < 0)) { + $Kernel.$raise($$$('ArgumentError'), "attempt to take negative size"); + }; + if ($truthy(number == 0)) { + return [] + }; + current = 0; + $send(self, 'each', [], function $$28($a){var $post_args, args; + + + $post_args = $slice(arguments); + args = $post_args; + result.push($Opal.$destructure(args)); + if ($truthy(number <= ++current)) { + $t_return.$throw(result); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + return result; + };} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }, -1); + + $def(self, '$grep', function $$grep(pattern) { + var block = $$grep.$$p || nil, self = this, result = nil; + + $$grep.$$p = null; + result = []; + $send(self, 'each', [], function $$29($a){var $post_args, value, cmp = nil; + + + $post_args = $slice(arguments); + value = $post_args; + cmp = comparableForPattern(value); + if (!$truthy($send(pattern, '__send__', ["==="].concat($to_a(cmp))))) { + return nil + } if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]; + } value = Opal.yieldX(block, $to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0); + } return result.$push(value);}, -1); + return result; + }); + + $def(self, '$grep_v', function $$grep_v(pattern) { + var block = $$grep_v.$$p || nil, self = this, result = nil; + + $$grep_v.$$p = null; + result = []; + $send(self, 'each', [], function $$30($a){var $post_args, value, cmp = nil; + + + $post_args = $slice(arguments); + value = $post_args; + cmp = comparableForPattern(value); + if ($truthy($send(pattern, '__send__', ["==="].concat($to_a(cmp))))) { + return nil + } if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]; + } value = Opal.yieldX(block, $to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0); + } return result.$push(value);}, -1); + return result; + }); + + $def(self, '$group_by', function $$group_by() { + var block = $$group_by.$$p || nil, $a, self = this, hash = nil, $ret_or_1 = nil; + + $$group_by.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["group_by"], function $$31(){var self = $$31.$$s == null ? this : $$31.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } hash = $hash2([], {}); + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = $yield1(block, param); + + ($truthy(($ret_or_1 = hash['$[]'](value))) ? ($ret_or_1) : (($a = [value, []], $send(hash, '[]=', $a), $a[$a.length - 1])))['$<<'](param); + }; + + self.$each(); + return hash; + }); + + $def(self, '$include?', function $Enumerable_include$ques$32(obj) {try { var $t_return = $thrower('return'); + var self = this; + + + $send(self, 'each', [], function $$33($a){var $post_args, args; + + + $post_args = $slice(arguments); + args = $post_args; + if ($eqeq($Opal.$destructure(args), obj)) { + $t_return.$throw(true); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + return false;} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }); + + $def(self, '$inject', function $$inject(object, sym) { + var block = $$inject.$$p || nil, self = this; + + $$inject.$$p = null; + + var result = object; + + if (block !== nil && sym === undefined) { + self.$each.$$p = function() { + var value = $Opal.$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + value = $yieldX(block, [result, value]); + + result = value; + }; + } + else { + if (sym === undefined) { + if (!$$$('Symbol')['$==='](object)) { + $Kernel.$raise($$$('TypeError'), "" + (object.$inspect()) + " is not a Symbol"); + } + + sym = object; + result = undefined; + } + + self.$each.$$p = function() { + var value = $Opal.$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + result = (result).$__send__(sym, value); + }; + } + + self.$each(); + + return result == undefined ? nil : result; + }, -1); + + $def(self, '$lazy', function $$lazy() { + var self = this; + + return $send($$$($$$('Enumerator'), 'Lazy'), 'new', [self, self.$enumerator_size()], function $$34(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + return $send(enum$, 'yield', $to_a(args));}, -2) + }); + + $def(self, '$enumerator_size', function $$enumerator_size() { + var self = this; + + if ($truthy(self['$respond_to?']("size"))) { + return self.$size() + } else { + return nil + } + }); + + $def(self, '$max', function $$max(n) { + var block = $$max.$$p || nil, self = this; + + $$max.$$p = null; + + if (n === undefined || n === nil) { + var result, value; + + self.$each.$$p = function() { + var item = $Opal.$destructure(arguments); + + if (result === undefined) { + result = item; + return; + } + + if (block !== nil) { + value = $yieldX(block, [item, result]); + } else { + value = (item)['$<=>'](result); + } + + if (value === nil) { + $Kernel.$raise($$$('ArgumentError'), "comparison failed"); + } + + if (value > 0) { + result = item; + } + }; + + self.$each(); + + if (result === undefined) { + return nil; + } else { + return result; + } + } + + n = $coerce_to(n, $$$('Integer'), 'to_int'); + return $send(self, 'sort', [], block.$to_proc()).$reverse().$first(n); + }, -1); + + $def(self, '$max_by', function $$max_by(n) { + var block = $$max_by.$$p || nil, self = this; + + $$max_by.$$p = null; + if (n == null) n = nil; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["max_by", n], function $$35(){var self = $$35.$$s == null ? this : $$35.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } if (!$truthy(n['$nil?']())) { + return $send(self, 'sort_by', [], block.$to_proc()).$reverse().$take(n) + } + var result, + by; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = $yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) > 0) { + result = param; + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + }, -1); + + $def(self, '$min', function $$min(n) { + var block = $$min.$$p || nil, self = this; + + $$min.$$p = null; + if (n == null) n = nil; + if (!$truthy(n['$nil?']())) { + if ((block !== nil)) { + return $send(self, 'sort', [], function $$36(a, b){ + + if (a == null) a = nil; + if (b == null) b = nil; + return Opal.yieldX(block, [a, b]);}).$take(n) + } else { + return self.$sort().$take(n) + } + } + var result; + + if (block !== nil) { + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + var value = block(param, result); + + if (value === nil) { + $Kernel.$raise($$$('ArgumentError'), "comparison failed"); + } + + if (value < 0) { + result = param; + } + }; + } + else { + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + if ($Opal.$compare(param, result) < 0) { + result = param; + } + }; + } + + self.$each(); + + return result === undefined ? nil : result; + }, -1); + + $def(self, '$min_by', function $$min_by(n) { + var block = $$min_by.$$p || nil, self = this; + + $$min_by.$$p = null; + if (n == null) n = nil; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["min_by", n], function $$37(){var self = $$37.$$s == null ? this : $$37.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } if (!$truthy(n['$nil?']())) { + return $send(self, 'sort_by', [], block.$to_proc()).$take(n) + } + var result, + by; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = $yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) < 0) { + result = param; + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + }, -1); + + $def(self, '$minmax', function $$minmax() { + var block = $$minmax.$$p || nil, self = this, $ret_or_1 = nil; + + $$minmax.$$p = null; + block = ($truthy(($ret_or_1 = block)) ? ($ret_or_1) : ($send($Kernel, 'proc', [], function $$38(a, b){ + + if (a == null) a = nil; + if (b == null) b = nil; + return a['$<=>'](b);}))); + + var min = nil, max = nil, first_time = true; + + self.$each.$$p = function() { + var element = $Opal.$destructure(arguments); + if (first_time) { + min = max = element; + first_time = false; + } else { + var min_cmp = block.$call(min, element); + + if (min_cmp === nil) { + $Kernel.$raise($$$('ArgumentError'), "comparison failed"); + } else if (min_cmp > 0) { + min = element; + } + + var max_cmp = block.$call(max, element); + + if (max_cmp === nil) { + $Kernel.$raise($$$('ArgumentError'), "comparison failed"); + } else if (max_cmp < 0) { + max = element; + } + } + }; + + self.$each(); + + return [min, max]; + }); + + $def(self, '$minmax_by', function $$minmax_by() { + var block = $$minmax_by.$$p || nil, self = this; + + $$minmax_by.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["minmax_by"], function $$39(){var self = $$39.$$s == null ? this : $$39.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } + var min_result = nil, + max_result = nil, + min_by, + max_by; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = $yield1(block, param); + + if ((min_by === undefined) || (value)['$<=>'](min_by) < 0) { + min_result = param; + min_by = value; + } + + if ((max_by === undefined) || (value)['$<=>'](max_by) > 0) { + max_result = param; + max_by = value; + } + }; + + self.$each(); + + return [min_result, max_result]; + }); + + $def(self, '$none?', function $Enumerable_none$ques$40(pattern) {try { var $t_return = $thrower('return'); + var block = $Enumerable_none$ques$40.$$p || nil, self = this; + + $Enumerable_none$ques$40.$$p = null; + + ; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], function $$41($a){var $post_args, value, comparable = nil; + + + $post_args = $slice(arguments); + value = $post_args; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat($to_a(comparable))))) { + $t_return.$throw(false); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + } else if ((block !== nil)) { + $send(self, 'each', [], function $$42($a){var $post_args, value; + + + $post_args = $slice(arguments); + value = $post_args; + if ($truthy(Opal.yieldX(block, $to_a(value)))) { + $t_return.$throw(false); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + } else { + $send(self, 'each', [], function $$43($a){var $post_args, value, item = nil; + + + $post_args = $slice(arguments); + value = $post_args; + item = $Opal.$destructure(value); + if ($truthy(item)) { + $t_return.$throw(false); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + }; + return true;} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }, -1); + + $def(self, '$one?', function $Enumerable_one$ques$44(pattern) {try { var $t_return = $thrower('return'); + var block = $Enumerable_one$ques$44.$$p || nil, self = this, count = nil; + + $Enumerable_one$ques$44.$$p = null; + + ; + ; + count = 0; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], function $$45($a){var $post_args, value, comparable = nil; + + + $post_args = $slice(arguments); + value = $post_args; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat($to_a(comparable))))) { + + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + $t_return.$throw(false); + } else { + return nil + }; + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + } else if ((block !== nil)) { + $send(self, 'each', [], function $$46($a){var $post_args, value; + + + $post_args = $slice(arguments); + value = $post_args; + if (!$truthy(Opal.yieldX(block, $to_a(value)))) { + return nil + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + $t_return.$throw(false); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + } else { + $send(self, 'each', [], function $$47($a){var $post_args, value; + + + $post_args = $slice(arguments); + value = $post_args; + if (!$truthy($Opal.$destructure(value))) { + return nil + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + $t_return.$throw(false); + } else { + return nil + };}, {$$arity: -1, $$ret: $t_return}); + }; + return count['$=='](1);} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }, -1); + + $def(self, '$partition', function $$partition() { + var block = $$partition.$$p || nil, self = this; + + $$partition.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["partition"], function $$48(){var self = $$48.$$s == null ? this : $$48.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } + var truthy = [], falsy = []; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = $yield1(block, param); + + if ($truthy(value)) { + truthy.push(param); + } + else { + falsy.push(param); + } + }; + + self.$each(); + + return [truthy, falsy]; + }); + + $def(self, '$reject', function $$reject() { + var block = $$reject.$$p || nil, self = this; + + $$reject.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["reject"], function $$49(){var self = $$49.$$s == null ? this : $$49.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } + var result = []; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = $yield1(block, param); + + if (!$truthy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + }); + + $def(self, '$reverse_each', function $$reverse_each() { + var block = $$reverse_each.$$p || nil, self = this; + + $$reverse_each.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["reverse_each"], function $$50(){var self = $$50.$$s == null ? this : $$50.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } + var result = []; + + self.$each.$$p = function() { + result.push(arguments); + }; + + self.$each(); + + for (var i = result.length - 1; i >= 0; i--) { + $yieldX(block, result[i]); + } + + return result; + }); + + $def(self, '$slice_before', function $$slice_before(pattern) { + var block = $$slice_before.$$p || nil, self = this; + + $$slice_before.$$p = null; + if ($truthy(pattern === undefined && block === nil)) { + $Kernel.$raise($$$('ArgumentError'), "both pattern and block are given"); + } if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " expected 1)"); + } return $send($$$('Enumerator'), 'new', [], function $$51(e){var self = $$51.$$s == null ? this : $$51.$$s; + + + if (e == null) e = nil; + + var slice = []; + + if (block !== nil) { + if (pattern === undefined) { + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = $yield1(block, param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + else { + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = block(param, pattern.$dup()); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + } + else { + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = pattern['$==='](param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + + self.$each(); + + if (slice.length > 0) { + e['$<<'](slice); + } + }, {$$s: self}); + }, -1); + + $def(self, '$slice_after', function $$slice_after(pattern) { + var block = $$slice_after.$$p || nil, self = this; + + $$slice_after.$$p = null; + if ($truthy(pattern === undefined && block === nil)) { + $Kernel.$raise($$$('ArgumentError'), "both pattern and block are given"); + } if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " expected 1)"); + } if ($truthy(pattern !== undefined)) { + block = $send($Kernel, 'proc', [], function $$52(e){ + + if (e == null) e = nil; + return pattern['$==='](e);}); + } return $send($$$('Enumerator'), 'new', [], function $$53(yielder){var self = $$53.$$s == null ? this : $$53.$$s; + + + if (yielder == null) yielder = nil; + + var accumulate; + + self.$each.$$p = function() { + var element = $Opal.$destructure(arguments), + end_chunk = $yield1(block, element); + + if (accumulate == null) { + accumulate = []; + } + + if ($truthy(end_chunk)) { + accumulate.push(element); + yielder.$yield(accumulate); + accumulate = null; + } else { + accumulate.push(element); + } + }; + + self.$each(); + + if (accumulate != null) { + yielder.$yield(accumulate); + } + }, {$$s: self}); + }, -1); + + $def(self, '$slice_when', function $$slice_when() { + var block = $$slice_when.$$p || nil, self = this; + + $$slice_when.$$p = null; + if (!(block !== nil)) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (0 for 1)"); + } return $send($$$('Enumerator'), 'new', [], function $$54(yielder){var self = $$54.$$s == null ? this : $$54.$$s; + + + if (yielder == null) yielder = nil; + + var slice = nil, last_after = nil; + + self.$each_cons.$$p = function() { + var params = $Opal.$destructure(arguments), + before = params[0], + after = params[1], + match = $yieldX(block, [before, after]); + + last_after = after; + + if (slice === nil) { + slice = []; + } + + if ($truthy(match)) { + slice.push(before); + yielder.$yield(slice); + slice = []; + } else { + slice.push(before); + } + }; + + self.$each_cons(2); + + if (slice !== nil) { + slice.push(last_after); + yielder.$yield(slice); + } + }, {$$s: self}); + }); + + $def(self, '$sort', function $$sort() { + var block = $$sort.$$p || nil, self = this, ary = nil; + + $$sort.$$p = null; + ary = self.$to_a(); + if (!(block !== nil)) { + block = $lambda(function $$55(a, b){ + + if (a == null) a = nil; + if (b == null) b = nil; + return a['$<=>'](b);}); + } return $send(ary, 'sort', [], block.$to_proc()); + }); + + $def(self, '$sort_by', function $$sort_by() { + var block = $$sort_by.$$p || nil, self = this, dup = nil; + + $$sort_by.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["sort_by"], function $$56(){var self = $$56.$$s == null ? this : $$56.$$s; + + return self.$enumerator_size()}, {$$s: self}) + } dup = $send(self, 'map', [], function $$57(){var arg = nil; + + + arg = $Opal.$destructure(arguments); + return [Opal.yield1(block, arg), arg];}); + $send(dup, 'sort!', [], function $$58(a, b){ + + if (a == null) a = nil; + if (b == null) b = nil; + return (a[0])['$<=>'](b[0]);}); + return $send(dup, 'map!', [], function $$59(i){ + + if (i == null) i = nil; + return i[1];}); + }); + + $def(self, '$sum', function $$sum(initial) { + var $yield = $$sum.$$p || nil, self = this, result = nil, compensation = nil; + + $$sum.$$p = null; + + if (initial == null) initial = 0; + result = initial; + compensation = 0; + $send(self, 'each', [], function $$60($a){var $post_args, args, item = nil, y = nil, t = nil; + + + $post_args = $slice(arguments); + args = $post_args; + item = (($yield !== nil) ? (Opal.yieldX($yield, $to_a(args))) : ($Opal.$destructure(args))); + if (($not([$$$($$$('Float'), 'INFINITY'), $$$($$$('Float'), 'INFINITY')['$-@']()]['$include?'](item)) && ($truthy(item['$respond_to?']("-"))))) { + + y = $rb_minus(item, compensation); + t = $rb_plus(result, y); + compensation = $rb_minus($rb_minus(t, result), y); + return (result = t); + } else { + return (result = $rb_plus(result, item)) + }}, -1); + return result; + }, -1); + + $def(self, '$take', function $$take(num) { + var self = this; + + return self.$first(num) + }); + + $def(self, '$take_while', function $$take_while() {try { var $t_return = $thrower('return'); + var block = $$take_while.$$p || nil, self = this, result = nil; + + $$take_while.$$p = null; + + ; + if (!$truthy(block)) { + return self.$enum_for("take_while") + }; + result = []; + return $send(self, 'each', [], function $$61($a){var $post_args, args, value = nil; + + + $post_args = $slice(arguments); + args = $post_args; + value = $Opal.$destructure(args); + if (!$truthy(Opal.yield1(block, value))) { + $t_return.$throw(result); + }; + return result.push(value);;}, {$$arity: -1, $$ret: $t_return});} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }); + + $def(self, '$uniq', function $$uniq() { + var block = $$uniq.$$p || nil, self = this, hash = nil; + + $$uniq.$$p = null; + hash = $hash2([], {}); + $send(self, 'each', [], function $$62($a){var $post_args, args, $b, value = nil, produced = nil; + + + $post_args = $slice(arguments); + args = $post_args; + value = $Opal.$destructure(args); + produced = ((block !== nil) ? (Opal.yield1(block, value)) : (value)); + if ($truthy(hash['$key?'](produced))) { + return nil + } else { + return ($b = [produced, value], $send(hash, '[]=', $b), $b[$b.length - 1]) + }}, -1); + return hash.$values(); + }); + + $def(self, '$tally', function $$tally(hash) { + var self = this, out = nil; + if (hash && hash !== nil) { $deny_frozen_access(hash); } out = $send($send(self, 'group_by', [], "itself".$to_proc()), 'transform_values', [], "count".$to_proc()); + if ($truthy(hash)) { + + $send(out, 'each', [], function $$63(k, v){var $a; + + + if (k == null) k = nil; + if (v == null) v = nil; + return ($a = [k, $rb_plus(hash.$fetch(k, 0), v)], $send(hash, '[]=', $a), $a[$a.length - 1]);}); + return hash; + } else { + return out + } }, -1); + + $def(self, '$to_h', function $$to_h($a) { + var block = $$to_h.$$p || nil, $post_args, args, self = this; + + $$to_h.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + if ((block !== nil)) { + return $send($send(self, 'map', [], block.$to_proc()), 'to_h', $to_a(args)) + } + var hash = $hash2([], {}); + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments); + var ary = $Opal['$coerce_to?'](param, $$$('Array'), "to_ary"), key, val; + if (!ary.$$is_array) { + $Kernel.$raise($$$('TypeError'), "wrong element type " + ((ary).$class()) + " (expected array)"); + } + if (ary.length !== 2) { + $Kernel.$raise($$$('ArgumentError'), "wrong array length (expected 2, was " + ((ary).$length()) + ")"); + } + key = ary[0]; + val = ary[1]; + + Opal.hash_put(hash, key, val); + }; + + self.$each.apply(self, args); + + return hash; + }, -1); + + $def(self, '$to_set', function $$to_set($a, $b) { + var block = $$to_set.$$p || nil, $post_args, klass, args, self = this; + + $$to_set.$$p = null; + $post_args = $slice(arguments); + + if ($post_args.length > 0) klass = $post_args.shift();if (klass == null) klass = $$('Set'); + args = $post_args; + return $send(klass, 'new', [self].concat($to_a(args)), block.$to_proc()); + }, -1); + + $def(self, '$zip', function $$zip($a) { + $$zip.$$p || nil; var $post_args, others, self = this; + + $$zip.$$p = null; + $post_args = $slice(arguments); + others = $post_args; + return $send(self.$to_a(), 'zip', $to_a(others)); + }, -1); + $alias(self, "find", "detect"); + $alias(self, "filter", "find_all"); + $alias(self, "flat_map", "collect_concat"); + $alias(self, "map", "collect"); + $alias(self, "member?", "include?"); + $alias(self, "reduce", "inject"); + $alias(self, "select", "find_all"); + return $alias(self, "to_a", "entries"); + })('::', $nesting) + }; + + Opal.modules["corelib/enumerator/arithmetic_sequence"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $truthy = Opal.truthy, $to_a = Opal.to_a, $eqeq = Opal.eqeq, $Kernel = Opal.Kernel, $def = Opal.def, $rb_gt = Opal.rb_gt, $rb_lt = Opal.rb_lt, $rb_le = Opal.rb_le, $rb_ge = Opal.rb_ge, $rb_plus = Opal.rb_plus, $rb_minus = Opal.rb_minus, $eqeqeq = Opal.eqeqeq, $not = Opal.not, $rb_times = Opal.rb_times, $rb_divide = Opal.rb_divide, $alias = Opal.alias, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('is_a?,==,raise,respond_to?,class,attr_reader,begin,end,exclude_end?,>,step,<,<=,>=,-@,_lesser_than_end?,<<,+,-,===,%,_greater_than_begin?,reverse,!,include?,*,to_i,abs,/,hash,inspect'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Enumerator'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'ArithmeticSequence'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.step_arg2 = $proto.receiver_num = $proto.step_arg1 = $proto.step = $proto.range = $proto.topfx = $proto.bypfx = $proto.creation_method = $proto.skipped_arg = nil; + + Opal.prop(self.$$prototype, '$$is_arithmetic_seq', true); + var inf = Infinity; + + $def(self, '$initialize', function $$initialize(range, step, creation_method) { + var $a, self = this, $ret_or_1 = nil; + if (creation_method == null) creation_method = "step"; + self.creation_method = creation_method; + if ($truthy(range['$is_a?']($$$('Array')))) { + + $a = [].concat($to_a(range)), (self.step_arg1 = ($a[0] == null ? nil : $a[0])), (self.step_arg2 = ($a[1] == null ? nil : $a[1])), (self.topfx = ($a[2] == null ? nil : $a[2])), (self.bypfx = ($a[3] == null ? nil : $a[3])); + self.receiver_num = step; + self.step = 1; + self.range = ($truthy(self.step_arg2) ? (((self.step = self.step_arg2), Opal.Range.$new(self.receiver_num, self.step_arg1, false))) : ($truthy(self.step_arg1) ? (Opal.Range.$new(self.receiver_num, self.step_arg1, false)) : (Opal.Range.$new(self.receiver_num, nil, false)))); + } else { + + if (!$truthy(step)) { + self.skipped_arg = true; + } $a = [range, ($truthy(($ret_or_1 = step)) ? ($ret_or_1) : (1))], (self.range = $a[0]), (self.step = $a[1]); + } self.object = self; + if ($eqeq(self.step, 0)) { + $Kernel.$raise($$('ArgumentError'), "step can't be 0"); + } if ($truthy(self.step['$respond_to?']("to_int"))) { + return nil + } else { + return $Kernel.$raise($$('ArgumentError'), "" + ("no implicit conversion of " + (self.step.$class()) + " ") + "into Integer") + } }, -2); + self.$attr_reader("step"); + + $def(self, '$begin', function $$begin() { + var self = this; + + return self.range.$begin() + }); + + $def(self, '$end', function $$end() { + var self = this; + + return self.range.$end() + }); + + $def(self, '$exclude_end?', function $ArithmeticSequence_exclude_end$ques$1() { + var self = this; + + return self.range['$exclude_end?']() + }); + + $def(self, '$_lesser_than_end?', function $ArithmeticSequence__lesser_than_end$ques$2(val) { + var self = this, end_ = nil, $ret_or_1 = nil; + + + end_ = ($truthy(($ret_or_1 = self.$end())) ? ($ret_or_1) : (inf)); + if ($truthy($rb_gt(self.$step(), 0))) { + if ($truthy(self['$exclude_end?']())) { + return $rb_lt(val, end_) + } else { + return $rb_le(val, end_) + } + } else if ($truthy(self['$exclude_end?']())) { + return $rb_gt(val, end_) + } else { + return $rb_ge(val, end_) + } }); + + $def(self, '$_greater_than_begin?', function $ArithmeticSequence__greater_than_begin$ques$3(val) { + var self = this, begin_ = nil, $ret_or_1 = nil; + + + begin_ = ($truthy(($ret_or_1 = self.$begin())) ? ($ret_or_1) : ((inf)['$-@']())); + if ($truthy($rb_gt(self.$step(), 0))) { + return $rb_gt(val, begin_) + } else { + return $rb_lt(val, begin_) + } }); + + $def(self, '$first', function $$first(count) { + var self = this, iter = nil, $ret_or_1 = nil, out = nil; + iter = ($truthy(($ret_or_1 = self.$begin())) ? ($ret_or_1) : ((inf)['$-@']())); + if (!$truthy(count)) { + return ($truthy(self['$_lesser_than_end?'](iter)) ? (iter) : (nil)) + } out = []; + while ($truthy(($truthy(($ret_or_1 = self['$_lesser_than_end?'](iter))) ? ($rb_gt(count, 0)) : ($ret_or_1)))) { + + out['$<<'](iter); + iter = $rb_plus(iter, self.$step()); + count = $rb_minus(count, 1); + } return out; + }, -1); + + $def(self, '$each', function $$each() { + var block = $$each.$$p || nil, self = this, $ret_or_1 = nil, iter = nil; + + $$each.$$p = null; + if (!(block !== nil)) { + return self + } if ($eqeqeq(nil, ($ret_or_1 = self.$begin()))) { + $Kernel.$raise($$('TypeError'), "nil can't be coerced into Integer"); + } iter = ($truthy(($ret_or_1 = self.$begin())) ? ($ret_or_1) : ((inf)['$-@']())); + while ($truthy(self['$_lesser_than_end?'](iter))) { + + Opal.yield1(block, iter); + iter = $rb_plus(iter, self.$step()); + } return self; + }); + + $def(self, '$last', function $$last(count) { + var self = this, $ret_or_1 = nil, iter = nil, out = nil; + if (($eqeqeq(inf, ($ret_or_1 = self.$end())) || ($eqeqeq((inf)['$-@'](), $ret_or_1)))) { + $Kernel.$raise($$$('FloatDomainError'), self.$end()); + } else if ($eqeqeq(nil, $ret_or_1)) { + $Kernel.$raise($$$('RangeError'), "cannot get the last element of endless arithmetic sequence"); + } else ; iter = $rb_minus(self.$end(), $rb_minus(self.$end(), self.$begin())['$%'](self.$step())); + if (!$truthy(self['$_lesser_than_end?'](iter))) { + iter = $rb_minus(iter, self.$step()); + } if (!$truthy(count)) { + return ($truthy(self['$_greater_than_begin?'](iter)) ? (iter) : (nil)) + } out = []; + while ($truthy(($truthy(($ret_or_1 = self['$_greater_than_begin?'](iter))) ? ($rb_gt(count, 0)) : ($ret_or_1)))) { + + out['$<<'](iter); + iter = $rb_minus(iter, self.$step()); + count = $rb_minus(count, 1); + } return out.$reverse(); + }, -1); + + $def(self, '$size', function $$size() { + var self = this, step_sign = nil, iter = nil; + + + step_sign = ($truthy($rb_gt(self.$step(), 0)) ? (1) : (-1)); + if ($not(self['$_lesser_than_end?'](self.$begin()))) { + return 0 + } else if ($truthy([(inf)['$-@'](), inf]['$include?'](self.$step()))) { + return 1 + } else if (($truthy([$rb_times((inf)['$-@'](), step_sign), nil]['$include?'](self.$begin())) || ($truthy([$rb_times(inf, step_sign), nil]['$include?'](self.$end()))))) { + return inf; + } else { + + iter = $rb_minus(self.$end(), $rb_minus(self.$end(), self.$begin())['$%'](self.$step())); + if (!$truthy(self['$_lesser_than_end?'](iter))) { + iter = $rb_minus(iter, self.$step()); + } return $rb_plus($rb_divide($rb_minus(iter, self.$begin()), self.$step()).$abs().$to_i(), 1); + } }); + + $def(self, '$==', function $ArithmeticSequence_$eq_eq$4(other) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil, $ret_or_3 = nil, $ret_or_4 = nil; + + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = ($truthy(($ret_or_4 = self.$class()['$=='](other.$class()))) ? (self.$begin()['$=='](other.$begin())) : ($ret_or_4)))) ? (self.$end()['$=='](other.$end())) : ($ret_or_3)))) ? (self.$step()['$=='](other.$step())) : ($ret_or_2))))) { + return self['$exclude_end?']()['$=='](other['$exclude_end?']()) + } else { + return $ret_or_1 + } + }); + + $def(self, '$hash', function $$hash() { + var self = this; + + return [self.$begin(), self.$end(), self.$step(), self['$exclude_end?']()].$hash() + }); + + $def(self, '$inspect', function $$inspect() { + var self = this, args = nil; + + if ($truthy(self.receiver_num)) { + + args = ($truthy(self.step_arg2) ? ("(" + (self.topfx) + (self.step_arg1.$inspect()) + ", " + (self.bypfx) + (self.step_arg2.$inspect()) + ")") : ($truthy(self.step_arg1) ? ("(" + (self.topfx) + (self.step_arg1.$inspect()) + ")") : nil)); + return "(" + (self.receiver_num.$inspect()) + "." + (self.creation_method) + (args) + ")"; + } else { + + args = ($truthy(self.skipped_arg) ? (nil) : ("(" + (self.step) + ")")); + return "((" + (self.range.$inspect()) + ")." + (self.creation_method) + (args) + ")"; + } + }); + $alias(self, "===", "=="); + return $alias(self, "eql?", "=="); + })(self, self, $nesting) + })('::', null, $nesting) + }; + + Opal.modules["corelib/enumerator/chain"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $deny_frozen_access = Opal.deny_frozen_access, $klass = Opal.klass, $slice = Opal.slice, $def = Opal.def, $send = Opal.send, $to_a = Opal.to_a, $truthy = Opal.truthy, $rb_plus = Opal.rb_plus, $thrower = Opal.thrower, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('to_enum,size,each,<<,to_proc,include?,+,reverse_each,respond_to?,rewind,inspect'); + return (function($base, $super) { + var self = $klass($base, $super, 'Enumerator'); + + + return (function($base, $super) { + var self = $klass($base, $super, 'Chain'); + + var $proto = self.$$prototype; + + $proto.enums = $proto.iterated = nil; + + + $def(self, '$initialize', function $$initialize($a) { + var $post_args, enums, self = this; + + + $post_args = $slice(arguments); + enums = $post_args; + $deny_frozen_access(self); + self.enums = enums; + self.iterated = []; + return (self.object = self); + }, -1); + + $def(self, '$each', function $$each($a) { + var block = $$each.$$p || nil, $post_args, args, self = this; + + $$each.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + if (!(block !== nil)) { + return $send(self, 'to_enum', ["each"].concat($to_a(args)), function $$1(){var self = $$1.$$s == null ? this : $$1.$$s; + + return self.$size()}, {$$s: self}) + } $send(self.enums, 'each', [], function $$2(enum$){var self = $$2.$$s == null ? this : $$2.$$s; + if (self.iterated == null) self.iterated = nil; + + + if (enum$ == null) enum$ = nil; + self.iterated['$<<'](enum$); + return $send(enum$, 'each', $to_a(args), block.$to_proc());}, {$$s: self}); + return self; + }, -1); + + $def(self, '$size', function $$size($a) {try { var $t_return = $thrower('return'); + var $post_args, args, self = this, accum = nil; + + + $post_args = $slice(arguments); + args = $post_args; + accum = 0; + $send(self.enums, 'each', [], function $$3(enum$){var size = nil; + + + if (enum$ == null) enum$ = nil; + size = $send(enum$, 'size', $to_a(args)); + if ($truthy([nil, $$$($$$('Float'), 'INFINITY')]['$include?'](size))) { + $t_return.$throw(size); + }; + return (accum = $rb_plus(accum, size));}, {$$ret: $t_return}); + return accum;} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }, -1); + + $def(self, '$rewind', function $$rewind() { + var self = this; + + + $send(self.iterated, 'reverse_each', [], function $$4(enum$){ + + if (enum$ == null) enum$ = nil; + if ($truthy(enum$['$respond_to?']("rewind"))) { + return enum$.$rewind() + } else { + return nil + }}); + self.iterated = []; + return self; + }); + return $def(self, '$inspect', function $$inspect() { + var self = this; + + return "#" + }); + })(self, self) + })('::', null) + }; + + Opal.modules["corelib/enumerator/generator"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $deny_frozen_access = Opal.deny_frozen_access, $klass = Opal.klass, $truthy = Opal.truthy, $Kernel = Opal.Kernel, $def = Opal.def, $slice = Opal.slice, $send = Opal.send, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('include,raise,new,to_proc'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Enumerator'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Generator'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.block = nil; + + self.$include($$$('Enumerable')); + + $def(self, '$initialize', function $$initialize() { + var block = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + $deny_frozen_access(self); + if (!$truthy(block)) { + $Kernel.$raise($$$('LocalJumpError'), "no block given"); + } return (self.block = block); + }); + return $def(self, '$each', function $$each($a) { + var block = $$each.$$p || nil, $post_args, args, self = this, yielder = nil; + + $$each.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + yielder = $send($$('Yielder'), 'new', [], block.$to_proc()); + + try { + args.unshift(yielder); + + Opal.yieldX(self.block, args); + } + catch (e) { + if (e && e.$thrower_type == "breaker") { + return e.$v; + } + else { + throw e; + } + } + return self; + }, -1); + })($nesting[0], null, $nesting) + })($nesting[0], null, $nesting) + }; + + Opal.modules["corelib/enumerator/lazy"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $truthy = Opal.truthy, $coerce_to = Opal.coerce_to, $yield1 = Opal.yield1, $yieldX = Opal.yieldX, $deny_frozen_access = Opal.deny_frozen_access, $klass = Opal.klass, $slice = Opal.slice, $send2 = Opal.send2, $find_super = Opal.find_super, $to_a = Opal.to_a, $defs = Opal.defs, $Kernel = Opal.Kernel, $send = Opal.send, $def = Opal.def, $return_self = Opal.return_self, $Opal = Opal.Opal, $rb_lt = Opal.rb_lt, $eqeqeq = Opal.eqeqeq, $rb_plus = Opal.rb_plus, $alias = Opal.alias, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('raise,each,new,enumerator_size,yield,respond_to?,try_convert,<,===,+,for,class,to_proc,destructure,inspect,to_a,find_all,collect_concat,collect,enum_for'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Enumerator'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Lazy'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.enumerator = nil; + + $klass(self, $$$('Exception'), 'StopLazyError'); + $defs(self, '$for', function $Lazy_for$1(object, $a) { + var $post_args, $fwd_rest, $yield = $Lazy_for$1.$$p || nil, self = this, lazy = nil; + + $Lazy_for$1.$$p = null; + + $post_args = $slice(arguments, 1); + $fwd_rest = $post_args; + lazy = $send2(self, $find_super(self, 'for', $Lazy_for$1, false, true), 'for', [object].concat($to_a($fwd_rest)), $yield); + lazy.enumerator = object; + return lazy; + }, -2); + + $def(self, '$initialize', function $$initialize(object, size) { + var block = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + if (size == null) size = nil; + $deny_frozen_access(self); + if (!(block !== nil)) { + $Kernel.$raise($$$('ArgumentError'), "tried to call lazy new without a block"); + } self.enumerator = object; + return $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [size], function $$2(yielder, $a){var $post_args, each_args; + + + if (yielder == null) yielder = nil; + $post_args = $slice(arguments, 1); + each_args = $post_args; + try { + return $send(object, 'each', $to_a(each_args), function $$3($b){var $post_args, args; + + + $post_args = $slice(arguments); + args = $post_args; + + args.unshift(yielder); + + $yieldX(block, args); + ;}, -1) + } catch ($err) { + if (Opal.rescue($err, [$$('StopLazyError')])) { + try { + return nil + } finally { Opal.pop_exception(); } + } else { throw $err; } + }}, -2); + }, -2); + + $def(self, '$lazy', $return_self); + + $def(self, '$collect', function $$collect() { + var block = $$collect.$$p || nil, self = this; + + $$collect.$$p = null; + if (!$truthy(block)) { + $Kernel.$raise($$$('ArgumentError'), "tried to call lazy map without a block"); + } return $send($$('Lazy'), 'new', [self, self.$enumerator_size()], function $$4(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + + var value = $yieldX(block, args); + + enum$.$yield(value); + }, -2); + }); + + $def(self, '$collect_concat', function $$collect_concat() { + var block = $$collect_concat.$$p || nil, self = this; + + $$collect_concat.$$p = null; + if (!$truthy(block)) { + $Kernel.$raise($$$('ArgumentError'), "tried to call lazy map without a block"); + } return $send($$('Lazy'), 'new', [self, nil], function $$5(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + + var value = $yieldX(block, args); + + if ((value)['$respond_to?']("force") && (value)['$respond_to?']("each")) { + $send((value), 'each', [], function $$6(v){ + + if (v == null) v = nil; + return enum$.$yield(v);}); + } + else { + var array = $Opal.$try_convert(value, $$$('Array'), "to_ary"); + + if (array === nil) { + enum$.$yield(value); + } + else { + $send((value), 'each', [], function $$7(v){ + + if (v == null) v = nil; + return enum$.$yield(v);}); + } + } + }, -2); + }); + + $def(self, '$drop', function $$drop(n) { + var self = this, current_size = nil, set_size = nil, dropped = nil; + + + n = $coerce_to(n, $$$('Integer'), 'to_int'); + if ($truthy($rb_lt(n, 0))) { + $Kernel.$raise($$$('ArgumentError'), "attempt to drop negative size"); + } current_size = self.$enumerator_size(); + set_size = ($eqeqeq($$$('Integer'), current_size) ? (($truthy($rb_lt(n, current_size)) ? (n) : (current_size))) : (current_size)); + dropped = 0; + return $send($$('Lazy'), 'new', [self, set_size], function $$8(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + if ($truthy($rb_lt(dropped, n))) { + return (dropped = $rb_plus(dropped, 1)) + } else { + return $send(enum$, 'yield', $to_a(args)) + }}, -2); + }); + + $def(self, '$drop_while', function $$drop_while() { + var block = $$drop_while.$$p || nil, self = this, succeeding = nil; + + $$drop_while.$$p = null; + if (!$truthy(block)) { + $Kernel.$raise($$$('ArgumentError'), "tried to call lazy drop_while without a block"); + } succeeding = true; + return $send($$('Lazy'), 'new', [self, nil], function $$9(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + if ($truthy(succeeding)) { + + var value = $yieldX(block, args); + + if (!$truthy(value)) { + succeeding = false; + + $send(enum$, 'yield', $to_a(args)); + } + + } else { + return $send(enum$, 'yield', $to_a(args)) + }}, -2); + }); + + $def(self, '$enum_for', function $$enum_for($a, $b) { + var block = $$enum_for.$$p || nil, $post_args, method, args, self = this; + + $$enum_for.$$p = null; + $post_args = $slice(arguments); + + if ($post_args.length > 0) method = $post_args.shift();if (method == null) method = "each"; + args = $post_args; + return $send(self.$class(), 'for', [self, method].concat($to_a(args)), block.$to_proc()); + }, -1); + + $def(self, '$find_all', function $$find_all() { + var block = $$find_all.$$p || nil, self = this; + + $$find_all.$$p = null; + if (!$truthy(block)) { + $Kernel.$raise($$$('ArgumentError'), "tried to call lazy select without a block"); + } return $send($$('Lazy'), 'new', [self, nil], function $$10(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + + var value = $yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', $to_a(args)); + } + }, -2); + }); + + $def(self, '$grep', function $$grep(pattern) { + var block = $$grep.$$p || nil, self = this; + + $$grep.$$p = null; + if ($truthy(block)) { + return $send($$('Lazy'), 'new', [self, nil], function $$11(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + + var param = $Opal.$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + value = $yield1(block, param); + + enum$.$yield($yield1(block, param)); + } + }, -2) + } else { + return $send($$('Lazy'), 'new', [self, nil], function $$12(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + + var param = $Opal.$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + enum$.$yield(param); + } + }, -2) + } }); + + $def(self, '$reject', function $$reject() { + var block = $$reject.$$p || nil, self = this; + + $$reject.$$p = null; + if (!$truthy(block)) { + $Kernel.$raise($$$('ArgumentError'), "tried to call lazy reject without a block"); + } return $send($$('Lazy'), 'new', [self, nil], function $$13(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + + var value = $yieldX(block, args); + + if (!$truthy(value)) { + $send(enum$, 'yield', $to_a(args)); + } + }, -2); + }); + + $def(self, '$take', function $$take(n) { + var self = this, current_size = nil, set_size = nil, taken = nil; + + + n = $coerce_to(n, $$$('Integer'), 'to_int'); + if ($truthy($rb_lt(n, 0))) { + $Kernel.$raise($$$('ArgumentError'), "attempt to take negative size"); + } current_size = self.$enumerator_size(); + set_size = ($eqeqeq($$$('Integer'), current_size) ? (($truthy($rb_lt(n, current_size)) ? (n) : (current_size))) : (current_size)); + taken = 0; + return $send($$('Lazy'), 'new', [self, set_size], function $$14(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + if ($truthy($rb_lt(taken, n))) { + + $send(enum$, 'yield', $to_a(args)); + return (taken = $rb_plus(taken, 1)); + } else { + return $Kernel.$raise($$('StopLazyError')) + }}, -2); + }); + + $def(self, '$take_while', function $$take_while() { + var block = $$take_while.$$p || nil, self = this; + + $$take_while.$$p = null; + if (!$truthy(block)) { + $Kernel.$raise($$$('ArgumentError'), "tried to call lazy take_while without a block"); + } return $send($$('Lazy'), 'new', [self, nil], function $$15(enum$, $a){var $post_args, args; + + + if (enum$ == null) enum$ = nil; + $post_args = $slice(arguments, 1); + args = $post_args; + + var value = $yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', $to_a(args)); + } + else { + $Kernel.$raise($$('StopLazyError')); + } + }, -2); + }); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + return "#<" + (self.$class()) + ": " + (self.enumerator.$inspect()) + ">" + }); + $alias(self, "force", "to_a"); + $alias(self, "filter", "find_all"); + $alias(self, "flat_map", "collect_concat"); + $alias(self, "map", "collect"); + $alias(self, "select", "find_all"); + return $alias(self, "to_enum", "enum_for"); + })(self, self, $nesting) + })('::', null, $nesting) + }; + + Opal.modules["corelib/enumerator/yielder"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $def = Opal.def, $slice = Opal.slice, $send = Opal.send, $to_a = Opal.to_a, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('yield,proc'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Enumerator'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super) { + var self = $klass($base, $super, 'Yielder'); + + var $proto = self.$$prototype; + + $proto.block = nil; + + + $def(self, '$initialize', function $$initialize() { + var block = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + self.block = block; + return self; + }); + + $def(self, '$yield', function $Yielder_yield$1($a) { + var $post_args, values, self = this; + + + $post_args = $slice(arguments); + values = $post_args; + + var value = Opal.yieldX(self.block, values); + + if (value && value.$thrower_type == "break") { + throw value; + } + + return value; + }, -1); + + $def(self, '$<<', function $Yielder_$lt$lt$2(value) { + var self = this; + + + self.$yield(value); + return self; + }); + return $def(self, '$to_proc', function $$to_proc() { + var self = this; + + return $send(self, 'proc', [], function $$3($a){var $post_args, values, self = $$3.$$s == null ? this : $$3.$$s; + + + $post_args = $slice(arguments); + values = $post_args; + return $send(self, 'yield', $to_a(values));}, {$$arity: -1, $$s: self}) + }); + })($nesting[0], null) + })($nesting[0], null, $nesting) + }; + + Opal.modules["corelib/enumerator"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $slice = Opal.slice, $coerce_to = Opal.coerce_to, $deny_frozen_access = Opal.deny_frozen_access, $klass = Opal.klass, $defs = Opal.defs, $truthy = Opal.truthy, $send = Opal.send, $not = Opal.not, $def = Opal.def, $rb_plus = Opal.rb_plus, $to_a = Opal.to_a, $Opal = Opal.Opal, $send2 = Opal.send2, $find_super = Opal.find_super, $rb_ge = Opal.rb_ge, $Kernel = Opal.Kernel, $rb_le = Opal.rb_le, $alias = Opal.alias, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,include,allocate,new,to_proc,!,respond_to?,empty?,nil?,+,class,__send__,call,enum_for,size,destructure,map,>=,length,raise,[],peek_values,<=,next_values,inspect,any?,each_with_object,autoload'); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Enumerator'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.size = $proto.args = $proto.object = $proto.method = $proto.values = $proto.cursor = nil; + + self.$include($$$('Enumerable')); + self.$$prototype.$$is_enumerator = true; + $defs(self, '$for', function $Enumerator_for$1(object, $a, $b) { + var block = $Enumerator_for$1.$$p || nil, $post_args, method, args, self = this; + + $Enumerator_for$1.$$p = null; + $post_args = $slice(arguments, 1); + + if ($post_args.length > 0) method = $post_args.shift();if (method == null) method = "each"; + args = $post_args; + + var obj = self.$allocate(); + + obj.object = object; + obj.size = block; + obj.method = method; + obj.args = args; + obj.cursor = 0; + + return obj; + }, -2); + + $def(self, '$initialize', function $$initialize($a) { + var block = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + $slice(arguments); + $deny_frozen_access(self); + self.cursor = 0; + if ($truthy(block)) { + + self.object = $send($$('Generator'), 'new', [], block.$to_proc()); + self.method = "each"; + self.args = []; + self.size = arguments[0] || nil; + if (($truthy(self.size) && ($not(self.size['$respond_to?']("call"))))) { + return (self.size = $coerce_to(self.size, $$$('Integer'), 'to_int')) + } else { + return nil + } } else { + + self.object = arguments[0]; + self.method = arguments[1] || "each"; + self.args = $slice(arguments, 2); + return (self.size = nil); + } }, -1); + + $def(self, '$each', function $$each($a) { + var block = $$each.$$p || nil, $post_args, args, self = this; + + $$each.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + if (($truthy(block['$nil?']()) && ($truthy(args['$empty?']())))) { + return self + } args = $rb_plus(self.args, args); + if ($truthy(block['$nil?']())) { + return $send(self.$class(), 'new', [self.object, self.method].concat($to_a(args))) + } return $send(self.object, '__send__', [self.method].concat($to_a(args)), block.$to_proc()); + }, -1); + + $def(self, '$size', function $$size() { + var self = this; + + if ($truthy(self.size['$respond_to?']("call"))) { + return $send(self.size, 'call', $to_a(self.args)) + } else { + return self.size + } + }); + + $def(self, '$with_index', function $$with_index(offset) { + var block = $$with_index.$$p || nil, self = this; + + $$with_index.$$p = null; + if (offset == null) offset = 0; + offset = ($truthy(offset) ? ($coerce_to(offset, $$$('Integer'), 'to_int')) : (0)); + if (!$truthy(block)) { + return $send(self, 'enum_for', ["with_index", offset], function $$2(){var self = $$2.$$s == null ? this : $$2.$$s; + + return self.$size()}, {$$s: self}) + } + var index = offset; + + self.$each.$$p = function() { + var param = $Opal.$destructure(arguments), + value = block(param, index); + + index++; + + return value; + }; + + return self.$each(); + }, -1); + + $def(self, '$each_with_index', function $$each_with_index() { + var block = $$each_with_index.$$p || nil, self = this; + + $$each_with_index.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["each_with_index"], function $$3(){var self = $$3.$$s == null ? this : $$3.$$s; + + return self.$size()}, {$$s: self}) + } $send2(self, $find_super(self, 'each_with_index', $$each_with_index, false, true), 'each_with_index', [], block); + return self.object; + }); + + $def(self, '$rewind', function $$rewind() { + var self = this; + + + self.cursor = 0; + return self; + }); + + $def(self, '$peek_values', function $$peek_values() { + var self = this, $ret_or_1 = nil; + + + self.values = ($truthy(($ret_or_1 = self.values)) ? ($ret_or_1) : ($send(self, 'map', [], function $$4($a){var $post_args, i; + + + $post_args = $slice(arguments); + i = $post_args; + return i;}, -1))); + if ($truthy($rb_ge(self.cursor, self.values.$length()))) { + $Kernel.$raise($$$('StopIteration'), "iteration reached an end"); + } return self.values['$[]'](self.cursor); + }); + + $def(self, '$peek', function $$peek() { + var self = this, values = nil; + + + values = self.$peek_values(); + if ($truthy($rb_le(values.$length(), 1))) { + return values['$[]'](0) + } else { + return values + } }); + + $def(self, '$next_values', function $$next_values() { + var self = this, out = nil; + + + out = self.$peek_values(); + self.cursor = $rb_plus(self.cursor, 1); + return out; + }); + + $def(self, '$next', function $$next() { + var self = this, values = nil; + + + values = self.$next_values(); + if ($truthy($rb_le(values.$length(), 1))) { + return values['$[]'](0) + } else { + return values + } }); + + $def(self, '$feed', function $$feed(arg) { + var self = this; + + return self.$raise($$('NotImplementedError'), "Opal doesn't support Enumerator#feed") + }); + + $def(self, '$+', function $Enumerator_$plus$5(other) { + var self = this; + + return $$$($$$('Enumerator'), 'Chain').$new(self, other) + }); + + $def(self, '$inspect', function $$inspect() { + var self = this, result = nil; + + + result = "#<" + (self.$class()) + ": " + (self.object.$inspect()) + ":" + (self.method); + if ($truthy(self.args['$any?']())) { + result = $rb_plus(result, "(" + (self.args.$inspect()['$[]']($$$('Range').$new(1, -2))) + ")"); + } return $rb_plus(result, ">"); + }); + $alias(self, "with_object", "each_with_object"); + self.$autoload("ArithmeticSequence", "corelib/enumerator/arithmetic_sequence"); + self.$autoload("Chain", "corelib/enumerator/chain"); + self.$autoload("Generator", "corelib/enumerator/generator"); + self.$autoload("Lazy", "corelib/enumerator/lazy"); + return self.$autoload("Yielder", "corelib/enumerator/yielder"); + })('::', null, $nesting); + }; + + Opal.modules["corelib/numeric"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $truthy = Opal.truthy, $Kernel = Opal.Kernel, $def = Opal.def, $to_ary = Opal.to_ary, $return_self = Opal.return_self, $rb_minus = Opal.rb_minus, $rb_times = Opal.rb_times, $rb_lt = Opal.rb_lt, $eqeq = Opal.eqeq, $rb_divide = Opal.rb_divide, $return_val = Opal.return_val, $Opal = Opal.Opal, $slice = Opal.slice, $extract_kwargs = Opal.extract_kwargs, $ensure_kwargs = Opal.ensure_kwargs, $not = Opal.not, $send = Opal.send, $rb_ge = Opal.rb_ge, $rb_le = Opal.rb_le, $rb_plus = Opal.rb_plus, $rb_gt = Opal.rb_gt, $alias = Opal.alias, self = Opal.top, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,include,instance_of?,class,Float,respond_to?,coerce,__send__,raise,equal?,-,*,div,<,-@,ceil,to_f,denominator,to_r,==,floor,/,%,Complex,zero?,numerator,abs,arg,coerce_to!,round,<=>,compare,is_a?,!,new,enum_for,to_proc,negative?,>=,<=,+,to_i,truncate,>,angle,conj,imag,rect'); + + self.$require("corelib/comparable"); + return (function($base, $super) { + var self = $klass($base, $super, 'Numeric'); + + + + self.$include($$$('Comparable')); + + $def(self, '$coerce', function $$coerce(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + return [other, self] + } return [$Kernel.$Float(other), $Kernel.$Float(self)]; + }); + + $def(self, '$__coerced__', function $$__coerced__(method, other) { + var $a, $b, self = this, a = nil, b = nil; + + if ($truthy(other['$respond_to?']("coerce"))) { + + $b = other.$coerce(self), $a = $to_ary($b), (a = ($a[0] == null ? nil : $a[0])), (b = ($a[1] == null ? nil : $a[1])); + return a.$__send__(method, b); + } else + switch (method) { + case "+": + case "-": + case "*": + case "/": + case "%": + case "&": + case "|": + case "^": + case "**": + return $Kernel.$raise($$$('TypeError'), "" + (other.$class()) + " can't be coerced into Numeric") + case ">": + case ">=": + case "<": + case "<=": + case "<=>": + return $Kernel.$raise($$$('ArgumentError'), "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + default: + return nil + } + }); + + $def(self, '$<=>', function $Numeric_$lt_eq_gt$1(other) { + var self = this; + + + if ($truthy(self['$equal?'](other))) { + return 0 + } return nil; + }); + + $def(self, '$+@', $return_self); + + $def(self, '$-@', function $Numeric_$minus$$2() { + var self = this; + + return $rb_minus(0, self) + }); + + $def(self, '$%', function $Numeric_$percent$3(other) { + var self = this; + + return $rb_minus(self, $rb_times(other, self.$div(other))) + }); + + $def(self, '$abs', function $$abs() { + var self = this; + + if ($rb_lt(self, 0)) { + return self['$-@']() + } else { + return self + } + }); + + $def(self, '$abs2', function $$abs2() { + var self = this; + + return $rb_times(self, self) + }); + + $def(self, '$angle', function $$angle() { + var self = this; + + if ($rb_lt(self, 0)) { + return $$$($$$('Math'), 'PI') + } else { + return 0 + } + }); + + $def(self, '$ceil', function $$ceil(ndigits) { + var self = this; + + + if (ndigits == null) ndigits = 0; + return self.$to_f().$ceil(ndigits); + }, -1); + + $def(self, '$conj', $return_self); + + $def(self, '$denominator', function $$denominator() { + var self = this; + + return self.$to_r().$denominator() + }); + + $def(self, '$div', function $$div(other) { + var self = this; + + + if ($eqeq(other, 0)) { + $Kernel.$raise($$$('ZeroDivisionError'), "divided by o"); + } return $rb_divide(self, other).$floor(); + }); + + $def(self, '$divmod', function $$divmod(other) { + var self = this; + + return [self.$div(other), self['$%'](other)] + }); + + $def(self, '$fdiv', function $$fdiv(other) { + var self = this; + + return $rb_divide(self.$to_f(), other) + }); + + $def(self, '$floor', function $$floor(ndigits) { + var self = this; + + + if (ndigits == null) ndigits = 0; + return self.$to_f().$floor(ndigits); + }, -1); + + $def(self, '$i', function $$i() { + var self = this; + + return $Kernel.$Complex(0, self) + }); + + $def(self, '$imag', $return_val(0)); + + $def(self, '$integer?', $return_val(false)); + + $def(self, '$nonzero?', function $Numeric_nonzero$ques$4() { + var self = this; + + if ($truthy(self['$zero?']())) { + return nil + } else { + return self + } + }); + + $def(self, '$numerator', function $$numerator() { + var self = this; + + return self.$to_r().$numerator() + }); + + $def(self, '$polar', function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }); + + $def(self, '$quo', function $$quo(other) { + var self = this; + + return $rb_divide($Opal['$coerce_to!'](self, $$$('Rational'), "to_r"), other) + }); + + $def(self, '$real', $return_self); + + $def(self, '$real?', $return_val(true)); + + $def(self, '$rect', function $$rect() { + var self = this; + + return [self, 0] + }); + + $def(self, '$round', function $$round(digits) { + var self = this; + return self.$to_f().$round(digits); + }, -1); + + $def(self, '$step', function $$step($a, $b, $c) { + var block = $$step.$$p || nil, $post_args, $kwargs, limit, step, to, by, self = this, counter = nil; + + $$step.$$p = null; + $post_args = $slice(arguments); + $kwargs = $extract_kwargs($post_args); + $kwargs = $ensure_kwargs($kwargs); + + if ($post_args.length > 0) limit = $post_args.shift(); + if ($post_args.length > 0) step = $post_args.shift(); + to = $kwargs.$$smap["to"]; + by = $kwargs.$$smap["by"]; + if (limit !== undefined && to !== undefined) { + $Kernel.$raise($$$('ArgumentError'), "to is given twice"); + } + + if (step !== undefined && by !== undefined) { + $Kernel.$raise($$$('ArgumentError'), "step is given twice"); + } + + if (to !== undefined) { + limit = to; + } + + if (by !== undefined) { + step = by; + } + + if (limit === undefined) { + limit = nil; + } + + function validateParameters() { + if (step === nil) { + $Kernel.$raise($$$('TypeError'), "step must be numeric"); + } + + if (step != null && step['$=='](0)) { + $Kernel.$raise($$$('ArgumentError'), "step can't be 0"); + } + + if (step === nil || step == null) { + step = 1; + } + + var sign = step['$<=>'](0); + + if (sign === nil) { + $Kernel.$raise($$$('ArgumentError'), "0 can't be coerced into " + (step.$class())); + } + + if (limit === nil || limit == null) { + limit = sign > 0 ? $$$($$$('Float'), 'INFINITY') : $$$($$$('Float'), 'INFINITY')['$-@'](); + } + + $Opal.$compare(self, limit); + } + + function stepFloatSize() { + if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else if (step === Infinity || step === -Infinity) { + return 1; + } else { + var abs = Math.abs, floor = Math.floor, + err = (abs(self) + abs(limit) + abs(limit - self)) / abs(step) * $$$($$$('Float'), 'EPSILON'); + + if (err === Infinity || err === -Infinity) { + return 0; + } else { + if (err > 0.5) { + err = 0.5; + } + + return floor((limit - self) / step + err) + 1 + } + } + } + + function stepSize() { + validateParameters(); + + if (step === 0) { + return Infinity; + } + + if (step % 1 !== 0) { + return stepFloatSize(); + } else if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else { + var ceil = Math.ceil, abs = Math.abs, + lhs = abs(self - limit) + 1, + rhs = abs(step); + + return ceil(lhs / rhs); + } + } + if (!(block !== nil)) { + if ((($not(limit) || ($truthy(limit['$is_a?']($$$('Numeric'))))) && (($not(step) || ($truthy(step['$is_a?']($$$('Numeric')))))))) { + return $$$($$$('Enumerator'), 'ArithmeticSequence').$new([limit, step, ($truthy(to) ? ("to: ") : nil), ($truthy(by) ? ("by: ") : nil)], self) + } else { + return $send(self, 'enum_for', ["step", limit, step], (stepSize).$to_proc()) + } + } + validateParameters(); + + var isDesc = step['$negative?'](), + isInf = step['$=='](0) || + (limit === Infinity && !isDesc) || + (limit === -Infinity && isDesc); + + if (self.$$is_number && step.$$is_number && limit.$$is_number) { + if (self % 1 === 0 && (isInf || limit % 1 === 0) && step % 1 === 0) { + var value = self; + + if (isInf) { + for (;; value += step) { + block(value); + } + } else if (isDesc) { + for (; value >= limit; value += step) { + block(value); + } + } else { + for (; value <= limit; value += step) { + block(value); + } + } + + return self; + } else { + var begin = self.$to_f().valueOf(); + step = step.$to_f().valueOf(); + limit = limit.$to_f().valueOf(); + + var n = stepFloatSize(); + + if (!isFinite(step)) { + if (n !== 0) block(begin); + } else if (step === 0) { + while (true) { + block(begin); + } + } else { + for (var i = 0; i < n; i++) { + var d = i * step + self; + if (step >= 0 ? limit < d : limit > d) { + d = limit; + } + block(d); + } + } + + return self; + } + } + counter = self; + while ($truthy(isDesc ? $rb_ge(counter, limit) : $rb_le(counter, limit))) { + + Opal.yield1(block, counter); + counter = $rb_plus(counter, step); + } }, -1); + + $def(self, '$to_c', function $$to_c() { + var self = this; + + return $Kernel.$Complex(self, 0) + }); + + $def(self, '$to_int', function $$to_int() { + var self = this; + + return self.$to_i() + }); + + $def(self, '$truncate', function $$truncate(ndigits) { + var self = this; + + + if (ndigits == null) ndigits = 0; + return self.$to_f().$truncate(ndigits); + }, -1); + + $def(self, '$zero?', function $Numeric_zero$ques$5() { + var self = this; + + return self['$=='](0) + }); + + $def(self, '$positive?', function $Numeric_positive$ques$6() { + var self = this; + + return $rb_gt(self, 0) + }); + + $def(self, '$negative?', function $Numeric_negative$ques$7() { + var self = this; + + return $rb_lt(self, 0) + }); + + $def(self, '$dup', $return_self); + + $def(self, '$clone', function $$clone($kwargs) { + var self = this; + + + $kwargs = $ensure_kwargs($kwargs); + + $kwargs.$$smap["freeze"]; return self; + }, -1); + + $def(self, '$finite?', $return_val(true)); + + $def(self, '$infinite?', $return_val(nil)); + $alias(self, "arg", "angle"); + $alias(self, "conjugate", "conj"); + $alias(self, "imaginary", "imag"); + $alias(self, "magnitude", "abs"); + $alias(self, "modulo", "%"); + $alias(self, "phase", "arg"); + return $alias(self, "rectangular", "rect"); + })('::', null); + }; + + Opal.modules["corelib/array"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $truthy = Opal.truthy, $falsy = Opal.falsy, $hash_ids = Opal.hash_ids, $yield1 = Opal.yield1, $hash_get = Opal.hash_get, $hash_put = Opal.hash_put, $hash_delete = Opal.hash_delete, $coerce_to = Opal.coerce_to, $respond_to = Opal.respond_to, $deny_frozen_access = Opal.deny_frozen_access, $freeze = Opal.freeze, $klass = Opal.klass, $slice = Opal.slice, $defs = Opal.defs, $Kernel = Opal.Kernel, $def = Opal.def, $Opal = Opal.Opal, $eqeqeq = Opal.eqeqeq, $hash2 = Opal.hash2, $send2 = Opal.send2, $find_super = Opal.find_super, $send = Opal.send, $rb_gt = Opal.rb_gt, $rb_times = Opal.rb_times, $eqeq = Opal.eqeq, $rb_minus = Opal.rb_minus, $to_a = Opal.to_a, $to_ary = Opal.to_ary, $gvars = Opal.gvars, $rb_ge = Opal.rb_ge, $assign_ivar = Opal.assign_ivar, $rb_lt = Opal.rb_lt, $return_self = Opal.return_self, $neqeq = Opal.neqeq, $alias = Opal.alias, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,include,to_a,warn,raise,replace,respond_to?,to_ary,coerce_to?,===,join,to_str,hash,<=>,==,object_id,inspect,enum_for,class,bsearch_index,to_proc,nil?,coerce_to!,>,*,enumerator_size,empty?,size,map,equal?,dup,each,reduce,-,[],dig,eql?,length,exclude_end?,flatten,frozen?,__id__,&,!,intersection,to_s,new,item,max,min,>=,**,delete_if,reverse,rotate,rand,at,keep_if,shuffle!,<,sort,sort_by,!=,times,[]=,<<,uniq,|,values,is_a?,end,begin,upto,reject,push,select,select!,collect,collect!,unshift,pristine,singleton_class'); + + self.$require("corelib/enumerable"); + self.$require("corelib/numeric"); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Array'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$$('Enumerable')); + Opal.prop(self.$$prototype, '$$is_array', true); + + // Recent versions of V8 (> 7.1) only use an optimized implementation when Array.prototype is unmodified. + // For instance, "array-splice.tq" has a "fast path" (ExtractFastJSArray, defined in "src/codegen/code-stub-assembler.cc") + // but it's only enabled when "IsPrototypeInitialArrayPrototype()" is true. + // + // Older versions of V8 were using relatively fast JS-with-extensions code even when Array.prototype is modified: + // https://github.com/v8/v8/blob/7.0.1/src/js/array.js#L599-L642 + // + // In short, Array operations are slow in recent versions of V8 when the Array.prototype has been tampered. + // So, when possible, we are using faster open-coded version to boost the performance. + + // As of V8 8.4, depending on the size of the array, this is up to ~25x times faster than Array#shift() + // Implementation is heavily inspired by: https://github.com/nodejs/node/blob/ba684805b6c0eded76e5cd89ee00328ac7a59365/lib/internal/util.js#L341-L347 + function shiftNoArg(list) { + var r = list[0]; + var index = 1; + var length = list.length; + for (; index < length; index++) { + list[index - 1] = list[index]; + } + list.pop(); + return r; + } + + function toArraySubclass(obj, klass) { + if (klass.$$name === Opal.Array) { + return obj; + } else { + return klass.$allocate().$replace((obj).$to_a()); + } + } + + // A helper for keep_if and delete_if, filter is either Opal.truthy + // or Opal.falsy. + function filterIf(self, filter, block) { + var value, raised = null, updated = new Array(self.length); + + for (var i = 0, i2 = 0, length = self.length; i < length; i++) { + if (!raised) { + try { + value = $yield1(block, self[i]); + } catch(error) { + raised = error; + } + } + + if (raised || filter(value)) { + updated[i2] = self[i]; + i2 += 1; + } + } + + if (i2 !== i) { + self.splice.apply(self, [0, updated.length].concat(updated)); + self.splice(i2, updated.length); + } + + if (raised) throw raised; + } + $defs(self, '$[]', function $Array_$$$1($a) { + var $post_args, objects, self = this; + + + $post_args = $slice(arguments); + objects = $post_args; + return toArraySubclass(objects, self); }, -1); + + $def(self, '$initialize', function $$initialize(size, obj) { + var block = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + if (size == null) size = nil; + if (obj == null) obj = nil; + + $deny_frozen_access(self); + + if (obj !== nil && block !== nil) { + $Kernel.$warn("warning: block supersedes default value argument"); + } + + if (size > $$$($$$('Integer'), 'MAX')) { + $Kernel.$raise($$$('ArgumentError'), "array size too big"); + } + + if (arguments.length > 2) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 0..2)"); + } + + if (arguments.length === 0) { + self.splice(0, self.length); + return self; + } + + if (arguments.length === 1) { + if (size.$$is_array) { + self.$replace(size.$to_a()); + return self; + } else if (size['$respond_to?']("to_ary")) { + self.$replace(size.$to_ary()); + return self; + } + } + + size = $coerce_to(size, $$$('Integer'), 'to_int'); + + if (size < 0) { + $Kernel.$raise($$$('ArgumentError'), "negative array size"); + } + + self.splice(0, self.length); + var i, value; + + if (block === nil) { + for (i = 0; i < size; i++) { + self.push(obj); + } + } + else { + for (i = 0, value; i < size; i++) { + value = block(i); + self[i] = value; + } + } + + return self; + }, -1); + $defs(self, '$try_convert', function $$try_convert(obj) { + + return $Opal['$coerce_to?'](obj, $$$('Array'), "to_ary") + }); + + $def(self, '$&', function $Array_$$2(other) { + var self = this; + + + other = ($eqeqeq($$$('Array'), other) ? (other.$to_a()) : (($coerce_to(other, $$$('Array'), 'to_ary')).$to_a())); + + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + $hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if ($hash_delete(hash, item) !== undefined) { + result.push(item); + } + } + + return result; + }); + + $def(self, '$|', function $Array_$$3(other) { + var self = this; + + + other = ($eqeqeq($$$('Array'), other) ? (other.$to_a()) : (($coerce_to(other, $$$('Array'), 'to_ary')).$to_a())); + + var hash = $hash2([], {}), i, length; + + for (i = 0, length = self.length; i < length; i++) { + $hash_put(hash, self[i], true); + } + + for (i = 0, length = other.length; i < length; i++) { + $hash_put(hash, other[i], true); + } + + return hash.$keys(); + }); + + $def(self, '$*', function $Array_$$4(other) { + var self = this; + + + if ($truthy(other['$respond_to?']("to_str"))) { + return self.$join(other.$to_str()) + } other = $coerce_to(other, $$$('Integer'), 'to_int'); + if ($truthy(other < 0)) { + $Kernel.$raise($$$('ArgumentError'), "negative argument"); + } + var result = [], + converted = self.$to_a(); + + for (var i = 0; i < other; i++) { + result = result.concat(converted); + } + + return result; + }); + + $def(self, '$+', function $Array_$plus$5(other) { + var self = this; + + + other = ($eqeqeq($$$('Array'), other) ? (other.$to_a()) : (($coerce_to(other, $$$('Array'), 'to_ary')).$to_a())); + return self.concat(other); }); + + $def(self, '$-', function $Array_$minus$6(other) { + var self = this; + + + other = ($eqeqeq($$$('Array'), other) ? (other.$to_a()) : (($coerce_to(other, $$$('Array'), 'to_ary')).$to_a())); + if ($truthy(self.length === 0)) { + return [] + } if ($truthy(other.length === 0)) { + return self.slice() + } + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + $hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if ($hash_get(hash, item) === undefined) { + result.push(item); + } + } + + return result; + }); + + $def(self, '$<<', function $Array_$lt$lt$7(object) { + var self = this; + + + $deny_frozen_access(self); + self.push(object); + return self; + }); + + $def(self, '$<=>', function $Array_$lt_eq_gt$8(other) { + var self = this; + + + if ($eqeqeq($$$('Array'), other)) { + other = other.$to_a(); + } else if ($truthy(other['$respond_to?']("to_ary"))) { + other = other.$to_ary().$to_a(); + } else { + return nil + } + if (self.$hash() === other.$hash()) { + return 0; + } + + var count = Math.min(self.length, other.length); + + for (var i = 0; i < count; i++) { + var tmp = (self[i])['$<=>'](other[i]); + + if (tmp !== 0) { + return tmp; + } + } + + return (self.length)['$<=>'](other.length); + }); + + $def(self, '$==', function $Array_$eq_eq$9(other) { + var self = this; + + + var recursed = {}; + + function _eqeq(array, other) { + var i, length, a, b; + + if (array === other) + return true; + + if (!other.$$is_array) { + if ($respond_to(other, '$to_ary')) { + return (other)['$=='](array); + } else { + return false; + } + } + + if (array.$$constructor !== Array) + array = (array).$to_a(); + if (other.$$constructor !== Array) + other = (other).$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + + }); + + function $array_slice_range(self, index) { + var size = self.length, + exclude, from, to, result; + + exclude = index.excl; + from = index.begin === nil ? 0 : $coerce_to(index.begin, Opal.Integer, 'to_int'); + to = index.end === nil ? -1 : $coerce_to(index.end, Opal.Integer, 'to_int'); + + if (from < 0) { + from += size; + + if (from < 0) { + return nil; + } + } + + if (index.excl_rev && index.begin !== nil) { + from += 1; + } + + if (from > size) { + return nil; + } + + if (to < 0) { + to += size; + + if (to < 0) { + return []; + } + } + + if (!exclude || index.end === nil) { + to += 1; + } + + result = self.slice(from, to); + return result; + } + + function $array_slice_arithmetic_seq(self, index) { + var array, out = [], i = 0, pseudorange; + + if (index.step < 0) { + pseudorange = { + begin: index.range.end, + end: index.range.begin, + excl: false, + excl_rev: index.range.excl + }; + array = $array_slice_range(self, pseudorange).$reverse(); + } + else { + array = $array_slice_range(self, index.range); + } + + while (i < array.length) { + out.push(array[i]); + i += Math.abs(index.step); + } + + return out; + } + + function $array_slice_index_length(self, index, length) { + var size = self.length, + result; + + index = $coerce_to(index, Opal.Integer, 'to_int'); + + if (index < 0) { + index += size; + + if (index < 0) { + return nil; + } + } + + if (length === undefined) { + if (index >= size || index < 0) { + return nil; + } + + return self[index]; + } + else { + length = $coerce_to(length, Opal.Integer, 'to_int'); + + if (length < 0 || index > size || index < 0) { + return nil; + } + + result = self.slice(index, index + length); + } + return result; + } + + $def(self, '$[]', function $Array_$$$10(index, length) { + var self = this; + + if (index.$$is_range) { + return $array_slice_range(self, index); + } + else if (index.$$is_arithmetic_seq) { + return $array_slice_arithmetic_seq(self, index); + } + else { + return $array_slice_index_length(self, index, length); + } + }, -2); + + $def(self, '$[]=', function $Array_$$$eq$11(index, value, extra) { + var self = this, data = nil, length = nil; + $deny_frozen_access(self); + data = nil; + + var i, size = self.length; + + if (index.$$is_range) { + if (value.$$is_array) + data = value.$to_a(); + else if (value['$respond_to?']("to_ary")) + data = value.$to_ary().$to_a(); + else + data = [value]; + + var exclude = index.excl, + from = index.begin === nil ? 0 : $coerce_to(index.begin, Opal.Integer, 'to_int'), + to = index.end === nil ? -1 : $coerce_to(index.end, Opal.Integer, 'to_int'); + + if (from < 0) { + from += size; + + if (from < 0) { + $Kernel.$raise($$$('RangeError'), "" + (index.$inspect()) + " out of range"); + } + } + + if (to < 0) { + to += size; + } + + if (!exclude || index.end === nil) { + to += 1; + } + + if (from > size) { + for (i = size; i < from; i++) { + self[i] = nil; + } + } + + if (to < 0) { + self.splice.apply(self, [from, 0].concat(data)); + } + else { + self.splice.apply(self, [from, to - from].concat(data)); + } + + return value; + } else { + if (extra === undefined) { + (length = 1); + } else { + length = value; + value = extra; + + if (value.$$is_array) + data = value.$to_a(); + else if (value['$respond_to?']("to_ary")) + data = value.$to_ary().$to_a(); + else + data = [value]; + } + + var old; + + index = $coerce_to(index, $$$('Integer'), 'to_int'); + length = $coerce_to(length, $$$('Integer'), 'to_int'); + + if (index < 0) { + old = index; + index += size; + + if (index < 0) { + $Kernel.$raise($$$('IndexError'), "index " + (old) + " too small for array; minimum " + (-self.length)); + } + } + + if (length < 0) { + $Kernel.$raise($$$('IndexError'), "negative length (" + (length) + ")"); + } + + if (index > size) { + for (i = size; i < index; i++) { + self[i] = nil; + } + } + + if (extra === undefined) { + self[index] = value; + } + else { + self.splice.apply(self, [index, length].concat(data)); + } + + return value; + } + }, -3); + + $def(self, '$any?', function $Array_any$ques$12(pattern) { + var block = $Array_any$ques$12.$$p || nil, self = this; + + $Array_any$ques$12.$$p = null; + if (self.length === 0) return false; + return $send2(self, $find_super(self, 'any?', $Array_any$ques$12, false, true), 'any?', [pattern], block); + }, -1); + + $def(self, '$assoc', function $$assoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + if (item = self[i], item.length && (item[0])['$=='](object)) { + return item; + } + } + + return nil; + + }); + + $def(self, '$at', function $$at(index) { + var self = this; + + + index = $coerce_to(index, $$$('Integer'), 'to_int'); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + return self[index]; + + }); + + $def(self, '$bsearch_index', function $$bsearch_index() { + var block = $$bsearch_index.$$p || nil, self = this; + + $$bsearch_index.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("bsearch_index") + } + var min = 0, + max = self.length, + mid, + val, + ret, + smaller = false, + satisfied = nil; + + while (min < max) { + mid = min + Math.floor((max - min) / 2); + val = self[mid]; + ret = $yield1(block, val); + + if (ret === true) { + satisfied = mid; + smaller = true; + } + else if (ret === false || ret === nil) { + smaller = false; + } + else if (ret.$$is_number) { + if (ret === 0) { return mid; } + smaller = (ret < 0); + } + else { + $Kernel.$raise($$$('TypeError'), "wrong argument type " + ((ret).$class()) + " (must be numeric, true, false or nil)"); + } + + if (smaller) { max = mid; } else { min = mid + 1; } + } + + return satisfied; + }); + + $def(self, '$bsearch', function $$bsearch() { + var block = $$bsearch.$$p || nil, self = this, index = nil; + + $$bsearch.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("bsearch") + } index = $send(self, 'bsearch_index', [], block.$to_proc()); + + if (index != null && index.$$is_number) { + return self[index]; + } else { + return index; + } + }); + + $def(self, '$cycle', function $$cycle(n) { + var block = $$cycle.$$p || nil, self = this; + + $$cycle.$$p = null; + if (n == null) n = nil; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["cycle", n], function $$13(){var self = $$13.$$s == null ? this : $$13.$$s; + + if ($truthy(n['$nil?']())) { + return $$$($$$('Float'), 'INFINITY') + } else { + + n = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + } }}, {$$s: self}) + } if (($truthy(self['$empty?']()) || ($eqeq(n, 0)))) { + return nil + } + var i, length; + + if (n === nil) { + while (true) { + for (i = 0, length = self.length; i < length; i++) { + $yield1(block, self[i]); + } + } + } + else { + n = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + if (n <= 0) { + return self; + } + + while (n > 0) { + for (i = 0, length = self.length; i < length; i++) { + $yield1(block, self[i]); + } + + n--; + } + } + return self; + }, -1); + + $def(self, '$clear', function $$clear() { + var self = this; + + + $deny_frozen_access(self); + self.splice(0, self.length); + return self; + }); + + $def(self, '$count', function $$count(object) { + var block = $$count.$$p || nil, self = this; + + $$count.$$p = null; + if (($truthy(object !== undefined) || ($truthy(block)))) { + return $send2(self, $find_super(self, 'count', $$count, false, true), 'count', [object], block) + } else { + return self.$size() + } }, -1); + + $def(self, '$initialize_copy', function $$initialize_copy(other) { + var self = this; + + return self.$replace(other) + }); + + $def(self, '$collect', function $$collect() { + var block = $$collect.$$p || nil, self = this; + + $$collect.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["collect"], function $$14(){var self = $$14.$$s == null ? this : $$14.$$s; + + return self.$size()}, {$$s: self}) + } + var result = []; + + for (var i = 0, length = self.length; i < length; i++) { + var value = $yield1(block, self[i]); + result.push(value); + } + + return result; + }); + + $def(self, '$collect!', function $Array_collect$excl$15() { + var block = $Array_collect$excl$15.$$p || nil, self = this; + + $Array_collect$excl$15.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["collect!"], function $$16(){var self = $$16.$$s == null ? this : $$16.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + for (var i = 0, length = self.length; i < length; i++) { + var value = $yield1(block, self[i]); + self[i] = value; + } + return self; + }); + + function binomial_coefficient(n, k) { + if (n === k || k === 0) { + return 1; + } + + if (k > 0 && n > k) { + return binomial_coefficient(n - 1, k - 1) + binomial_coefficient(n - 1, k); + } + + return 0; + } + + $def(self, '$combination', function $$combination(n) { + var $yield = $$combination.$$p || nil, self = this, num = nil; + + $$combination.$$p = null; + + num = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + if (!($yield !== nil)) { + return $send(self, 'enum_for', ["combination", num], function $$17(){var self = $$17.$$s == null ? this : $$17.$$s; + + return binomial_coefficient(self.length, num)}, {$$s: self}) + } + var i, length, stack, chosen, lev, done, next; + + if (num === 0) { + Opal.yield1($yield, []); + } else if (num === 1) { + for (i = 0, length = self.length; i < length; i++) { + Opal.yield1($yield, [self[i]]); + } + } + else if (num === self.length) { + Opal.yield1($yield, self.slice()); + } + else if (num >= 0 && num < self.length) { + stack = []; + for (i = 0; i <= num + 1; i++) { + stack.push(0); + } + + chosen = []; + lev = 0; + done = false; + stack[0] = -1; + + while (!done) { + chosen[lev] = self[stack[lev+1]]; + while (lev < num - 1) { + lev++; + next = stack[lev+1] = stack[lev] + 1; + chosen[lev] = self[next]; + } + Opal.yield1($yield, chosen.slice()); + lev++; + do { + done = (lev === 0); + stack[lev]++; + lev--; + } while ( stack[lev+1] + num === self.length + lev + 1 ); + } + } + return self; + }); + + $def(self, '$repeated_combination', function $$repeated_combination(n) { + var $yield = $$repeated_combination.$$p || nil, self = this, num = nil; + + $$repeated_combination.$$p = null; + + num = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + if (!($yield !== nil)) { + return $send(self, 'enum_for', ["repeated_combination", num], function $$18(){var self = $$18.$$s == null ? this : $$18.$$s; + + return binomial_coefficient(self.length + num - 1, num);}, {$$s: self}) + } + function iterate(max, from, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy); + return; + } + for (var i = from; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, i, buffer, self); + buffer.pop(); + } + } + + if (num >= 0) { + iterate(num, 0, [], self); + } + return self; + }); + + $def(self, '$compact', function $$compact() { + var self = this; + + + var result = []; + + for (var i = 0, length = self.length, item; i < length; i++) { + if ((item = self[i]) !== nil) { + result.push(item); + } + } + + return result; + + }); + + $def(self, '$compact!', function $Array_compact$excl$19() { + var self = this; + + + $deny_frozen_access(self); + + var original = self.length; + + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] === nil) { + self.splice(i, 1); + + length--; + i--; + } + } + + return self.length === original ? nil : self; + + }); + + $def(self, '$concat', function $$concat($a) { + var $post_args, others, self = this; + + + $post_args = $slice(arguments); + others = $post_args; + $deny_frozen_access(self); + others = $send(others, 'map', [], function $$20(other){var self = $$20.$$s == null ? this : $$20.$$s; + + + if (other == null) other = nil; + other = ($eqeqeq($$$('Array'), other) ? (other.$to_a()) : (($coerce_to(other, $$$('Array'), 'to_ary')).$to_a())); + if ($truthy(other['$equal?'](self))) { + other = other.$dup(); + } return other;}, {$$s: self}); + $send(others, 'each', [], function $$21(other){var self = $$21.$$s == null ? this : $$21.$$s; + + + if (other == null) other = nil; + + for (var i = 0, length = other.length; i < length; i++) { + self.push(other[i]); + } + }, {$$s: self}); + return self; + }, -1); + + $def(self, '$delete', function $Array_delete$22(object) { + var $yield = $Array_delete$22.$$p || nil, self = this; + + $Array_delete$22.$$p = null; + + var original = self.length; + + for (var i = 0, length = original; i < length; i++) { + if ((self[i])['$=='](object)) { + $deny_frozen_access(self); + + self.splice(i, 1); + + length--; + i--; + } + } + + if (self.length === original) { + if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } + return nil; + } + return object; + + }); + + $def(self, '$delete_at', function $$delete_at(index) { + var self = this; + + + $deny_frozen_access(self); + + index = $coerce_to(index, $$$('Integer'), 'to_int'); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + var result = self[index]; + + self.splice(index, 1); + + return result; + + }); + + $def(self, '$delete_if', function $$delete_if() { + var block = $$delete_if.$$p || nil, self = this; + + $$delete_if.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["delete_if"], function $$23(){var self = $$23.$$s == null ? this : $$23.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + filterIf(self, $falsy, block) + ; + return self; + }); + + $def(self, '$difference', function $$difference($a) { + var $post_args, arrays, self = this; + + + $post_args = $slice(arguments); + arrays = $post_args; + return $send(arrays, 'reduce', [self.$to_a().$dup()], function $$24(a, b){ + + if (a == null) a = nil; + if (b == null) b = nil; + return $rb_minus(a, b);}); + }, -1); + + $def(self, '$dig', function $$dig(idx, $a) { + var $post_args, idxs, self = this, item = nil; + + + $post_args = $slice(arguments, 1); + idxs = $post_args; + item = self['$[]'](idx); + + if (item === nil || idxs.length === 0) { + return item; + } + if (!$truthy(item['$respond_to?']("dig"))) { + $Kernel.$raise($$$('TypeError'), "" + (item.$class()) + " does not have #dig method"); + } return $send(item, 'dig', $to_a(idxs)); + }, -2); + + $def(self, '$drop', function $$drop(number) { + var self = this; + + + number = $coerce_to(number, $$$('Integer'), 'to_int'); + + if (number < 0) { + $Kernel.$raise($$$('ArgumentError')); + } + + return self.slice(number); + + }); + + $def(self, '$dup', function $$dup() { + var $yield = $$dup.$$p || nil, self = this; + + $$dup.$$p = null; + + + if (self.$$class === Opal.Array && + self.$$class.$allocate.$$pristine && + self.$copy_instance_variables.$$pristine && + self.$initialize_dup.$$pristine) { + return self.slice(0); + } + return $send2(self, $find_super(self, 'dup', $$dup, false, true), 'dup', [], $yield); + }); + + $def(self, '$each', function $$each() { + var block = $$each.$$p || nil, self = this; + + $$each.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["each"], function $$25(){var self = $$25.$$s == null ? this : $$25.$$s; + + return self.$size()}, {$$s: self}) + } + for (var i = 0, length = self.length; i < length; i++) { + $yield1(block, self[i]); + } + return self; + }); + + $def(self, '$each_index', function $$each_index() { + var block = $$each_index.$$p || nil, self = this; + + $$each_index.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["each_index"], function $$26(){var self = $$26.$$s == null ? this : $$26.$$s; + + return self.$size()}, {$$s: self}) + } + for (var i = 0, length = self.length; i < length; i++) { + $yield1(block, i); + } + return self; + }); + + $def(self, '$empty?', function $Array_empty$ques$27() { + var self = this; + + return self.length === 0; + }); + + $def(self, '$eql?', function $Array_eql$ques$28(other) { + var self = this; + + + var recursed = {}; + + function _eql(array, other) { + var i, length, a, b; + + if (!other.$$is_array) { + return false; + } + + other = other.$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eql(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eql(self, other); + + }); + + $def(self, '$fetch', function $$fetch(index, defaults) { + var block = $$fetch.$$p || nil, self = this; + + $$fetch.$$p = null; + + var original = index; + + index = $coerce_to(index, $$$('Integer'), 'to_int'); + + if (index < 0) { + index += self.length; + } + + if (index >= 0 && index < self.length) { + return self[index]; + } + + if (block !== nil && defaults != null) { + self.$warn("warning: block supersedes default value argument"); + } + + if (block !== nil) { + return block(original); + } + + if (defaults != null) { + return defaults; + } + + if (self.length === 0) { + $Kernel.$raise($$$('IndexError'), "index " + (original) + " outside of array bounds: 0...0"); + } + else { + $Kernel.$raise($$$('IndexError'), "index " + (original) + " outside of array bounds: -" + (self.length) + "..." + (self.length)); + } + }, -2); + + $def(self, '$fill', function $$fill($a) { + var block = $$fill.$$p || nil, $post_args, args, $b, $c, self = this, one = nil, two = nil, obj = nil, left = nil, right = nil; + + $$fill.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + + $deny_frozen_access(self); + + var i, value; + if ($truthy(block)) { + + if ($truthy(args.length > 2)) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (args.$length()) + " for 0..2)"); + } $c = args, $b = $to_ary($c), (one = ($b[0] == null ? nil : $b[0])), (two = ($b[1] == null ? nil : $b[1])); + } else { + + if ($truthy(args.length == 0)) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (0 for 1..3)"); + } else if ($truthy(args.length > 3)) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (args.$length()) + " for 1..3)"); + } $c = args, $b = $to_ary($c), (obj = ($b[0] == null ? nil : $b[0])), (one = ($b[1] == null ? nil : $b[1])), (two = ($b[2] == null ? nil : $b[2])); + } if ($eqeqeq($$$('Range'), one)) { + + if ($truthy(two)) { + $Kernel.$raise($$$('TypeError'), "length invalid with range"); + } left = one.begin === nil ? 0 : $coerce_to(one.begin, $$$('Integer'), 'to_int'); + if ($truthy(left < 0)) { + left += this.length; + } if ($truthy(left < 0)) { + $Kernel.$raise($$$('RangeError'), "" + (one.$inspect()) + " out of range"); + } right = one.end === nil ? -1 : $coerce_to(one.end, $$$('Integer'), 'to_int'); + if ($truthy(right < 0)) { + right += this.length; + } if (!$truthy(one['$exclude_end?']())) { + right += 1; + } if ($truthy(right <= left)) { + return self + } } else if ($truthy(one)) { + + left = $coerce_to(one, $$$('Integer'), 'to_int'); + if ($truthy(left < 0)) { + left += this.length; + } if ($truthy(left < 0)) { + left = 0; + } if ($truthy(two)) { + + right = $coerce_to(two, $$$('Integer'), 'to_int'); + if ($truthy(right == 0)) { + return self + } right += left; + } else { + right = this.length; + } } else { + + left = 0; + right = this.length; + } if ($truthy(left > this.length)) { + + for (i = this.length; i < right; i++) { + self[i] = nil; + } + + } if ($truthy(right > this.length)) { + this.length = right; + } if ($truthy(block)) { + + for (this.length; left < right; left++) { + value = block(left); + self[left] = value; + } + + } else { + + for (this.length; left < right; left++) { + self[left] = obj; + } + + } return self; + }, -1); + + $def(self, '$first', function $$first(count) { + var self = this; + + if (count == null) { + return self.length === 0 ? nil : self[0]; + } + + count = $coerce_to(count, $$$('Integer'), 'to_int'); + + if (count < 0) { + $Kernel.$raise($$$('ArgumentError'), "negative array size"); + } + + return self.slice(0, count); + }, -1); + + $def(self, '$flatten', function $$flatten(level) { + var self = this; + + function _flatten(array, level) { + var result = [], + i, length, + item, ary; + + array = (array).$to_a(); + + for (i = 0, length = array.length; i < length; i++) { + item = array[i]; + + if (!$respond_to(item, '$to_ary', true)) { + result.push(item); + continue; + } + + ary = (item).$to_ary(); + + if (ary === nil) { + result.push(item); + continue; + } + + if (!ary.$$is_array) { + $Kernel.$raise($$$('TypeError')); + } + + if (ary === self) { + $Kernel.$raise($$$('ArgumentError')); + } + + switch (level) { + case undefined: + result = result.concat(_flatten(ary)); + break; + case 0: + result.push(ary); + break; + default: + result.push.apply(result, _flatten(ary, level - 1)); + } + } + return result; + } + + if (level !== undefined) { + level = $coerce_to(level, $$$('Integer'), 'to_int'); + } + + return _flatten(self, level); + }, -1); + + $def(self, '$flatten!', function $Array_flatten$excl$29(level) { + var self = this; + + $deny_frozen_access(self); + + var flattened = self.$flatten(level); + + if (self.length == flattened.length) { + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] !== flattened[i]) { + break; + } + } + + if (i == length) { + return nil; + } + } + + self.$replace(flattened); + return self; + }, -1); + + $def(self, '$freeze', function $$freeze() { + var self = this; + + + if ($truthy(self['$frozen?']())) { + return self + } return $freeze(self); }); + + $def(self, '$hash', function $$hash() { + var self = this; + + + var top = ($hash_ids === undefined), + result = ['A'], + hash_id = self.$object_id(), + item, i, key; + + try { + if (top) { + $hash_ids = Object.create(null); + } + + // return early for recursive structures + if ($hash_ids[hash_id]) { + return 'self'; + } + + for (key in $hash_ids) { + item = $hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + $hash_ids[hash_id] = self; + + for (i = 0; i < self.length; i++) { + item = self[i]; + result.push(item.$hash()); + } + + return result.join(','); + } finally { + if (top) { + $hash_ids = undefined; + } + } + + }); + + $def(self, '$include?', function $Array_include$ques$30(member) { + var self = this; + + + for (var i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](member)) { + return true; + } + } + + return false; + + }); + + $def(self, '$index', function $$index(object) { + var block = $$index.$$p || nil, self = this; + + $$index.$$p = null; + + var i, length, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used"); + } + + if (object != null) { + for (i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = 0, length = self.length; i < length; i++) { + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else { + return self.$enum_for("index"); + } + + return nil; + }, -1); + + $def(self, '$insert', function $$insert(index, $a) { + var $post_args, objects, self = this; + + + $post_args = $slice(arguments, 1); + objects = $post_args; + + $deny_frozen_access(self); + + index = $coerce_to(index, $$$('Integer'), 'to_int'); + + if (objects.length > 0) { + if (index < 0) { + index += self.length + 1; + + if (index < 0) { + $Kernel.$raise($$$('IndexError'), "" + (index) + " is out of bounds"); + } + } + if (index > self.length) { + for (var i = self.length; i < index; i++) { + self.push(nil); + } + } + + self.splice.apply(self, [index, 0].concat(objects)); + } + return self; + }, -2); + var inspect_stack = []; + + $def(self, '$inspect', function $$inspect() { + var self = this; + + + + var result = [], + id = self.$__id__(), + pushed = true; + + return (function() { try { + + + if (inspect_stack.indexOf(id) !== -1) { + pushed = false; + return '[...]'; + } + inspect_stack.push(id); + + for (var i = 0, length = self.length; i < length; i++) { + var item = self['$[]'](i); + + result.push($$('Opal').$inspect(item)); + } + + return '[' + result.join(', ') + ']'; + ; + return nil; + } finally { + if (pushed) inspect_stack.pop(); + } })(); }); + + $def(self, '$intersection', function $$intersection($a) { + var $post_args, arrays, self = this; + + + $post_args = $slice(arguments); + arrays = $post_args; + return $send(arrays, 'reduce', [self.$to_a().$dup()], function $$31(a, b){ + + if (a == null) a = nil; + if (b == null) b = nil; + return a['$&'](b);}); + }, -1); + + $def(self, '$intersect?', function $Array_intersect$ques$32(other) { + var self = this; + + return self.$intersection(other)['$empty?']()['$!']() + }); + + $def(self, '$join', function $$join(sep) { + var self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + if (sep == null) sep = nil; + if ($truthy(self.length === 0)) { + return "" + } if ($truthy(sep === nil)) { + sep = $gvars[","]; + } + var result = []; + var i, length, item, tmp; + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + + if ($respond_to(item, '$to_str')) { + tmp = (item).$to_str(); + + if (tmp !== nil) { + result.push((tmp).$to_s()); + + continue; + } + } + + if ($respond_to(item, '$to_ary')) { + tmp = (item).$to_ary(); + + if (tmp === self) { + $Kernel.$raise($$$('ArgumentError')); + } + + if (tmp !== nil) { + result.push((tmp).$join(sep)); + + continue; + } + } + + if ($respond_to(item, '$to_s')) { + tmp = (item).$to_s(); + + if (tmp !== nil) { + result.push(tmp); + + continue; + } + } + + $Kernel.$raise($$$('NoMethodError').$new("" + ($$('Opal').$inspect(self.$item())) + " doesn't respond to #to_str, #to_ary or #to_s", "to_str")); + } + + if (sep === nil) { + return result.join(''); + } + else { + return result.join($Opal['$coerce_to!'](sep, $$$('String'), "to_str").$to_s()); + } + }, -1); + + $def(self, '$keep_if', function $$keep_if() { + var block = $$keep_if.$$p || nil, self = this; + + $$keep_if.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["keep_if"], function $$33(){var self = $$33.$$s == null ? this : $$33.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + filterIf(self, $truthy, block) + ; + return self; + }); + + $def(self, '$last', function $$last(count) { + var self = this; + + if (count == null) { + return self.length === 0 ? nil : self[self.length - 1]; + } + + count = $coerce_to(count, $$$('Integer'), 'to_int'); + + if (count < 0) { + $Kernel.$raise($$$('ArgumentError'), "negative array size"); + } + + if (count > self.length) { + count = self.length; + } + + return self.slice(self.length - count, self.length); + }, -1); + + $def(self, '$length', function $$length() { + var self = this; + + return self.length; + }); + + $def(self, '$max', function $$max(n) { + var block = $$max.$$p || nil, self = this; + + $$max.$$p = null; + return $send(self.$each(), 'max', [n], block.$to_proc()); + }, -1); + + $def(self, '$min', function $$min() { + var block = $$min.$$p || nil, self = this; + + $$min.$$p = null; + return $send(self.$each(), 'min', [], block.$to_proc()); + }); + + // Returns the product of from, from-1, ..., from - how_many + 1. + function descending_factorial(from, how_many) { + var count = how_many >= 0 ? 1 : 0; + while (how_many) { + count *= from; + from--; + how_many--; + } + return count; + } + + $def(self, '$permutation', function $$permutation(num) { + var block = $$permutation.$$p || nil, self = this, perm = nil, used = nil; + + $$permutation.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["permutation", num], function $$34(){var self = $$34.$$s == null ? this : $$34.$$s; + + return descending_factorial(self.length, num === undefined ? self.length : num);}, {$$s: self}) + } + var permute, offensive, output; + + if (num === undefined) { + num = self.length; + } + else { + num = $coerce_to(num, $$$('Integer'), 'to_int'); + } + + if (num < 0 || self.length < num) ; + else if (num === 0) { + // exactly one permutation: the zero-length array + Opal.yield1(block, []); + } + else if (num === 1) { + // this is a special, easy case + for (var i = 0; i < self.length; i++) { + Opal.yield1(block, [self[i]]); + } + } + else { + // this is the general case + (perm = $$('Array').$new(num)); + (used = $$('Array').$new(self.length, false)); + + permute = function(num, perm, index, used, blk) { + self = this; + for(var i = 0; i < self.length; i++){ + if(used['$[]'](i)['$!']()) { + perm[index] = i; + if(index < num - 1) { + used[i] = true; + permute.call(self, num, perm, index + 1, used, blk); + used[i] = false; + } + else { + output = []; + for (var j = 0; j < perm.length; j++) { + output.push(self[perm[j]]); + } + $yield1(blk, output); + } + } + } + }; + + if ((block !== nil)) { + // offensive (both definitions) copy. + offensive = self.slice(); + permute.call(offensive, num, perm, 0, used, block); + } + else { + permute.call(self, num, perm, 0, used, block); + } + } + return self; + }, -1); + + $def(self, '$repeated_permutation', function $$repeated_permutation(n) { + var $yield = $$repeated_permutation.$$p || nil, self = this, num = nil; + + $$repeated_permutation.$$p = null; + + num = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + if (!($yield !== nil)) { + return $send(self, 'enum_for', ["repeated_permutation", num], function $$35(){var self = $$35.$$s == null ? this : $$35.$$s; + + if ($truthy($rb_ge(num, 0))) { + return self.$size()['$**'](num) + } else { + return 0 + }}, {$$s: self}) + } + function iterate(max, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy); + return; + } + for (var i = 0; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, buffer, self); + buffer.pop(); + } + } + + iterate(num, [], self.slice()); + return self; + }); + + $def(self, '$pop', function $$pop(count) { + var self = this; + $deny_frozen_access(self); + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil + } return self.pop(); + } count = $coerce_to(count, $$$('Integer'), 'to_int'); + if ($truthy(count < 0)) { + $Kernel.$raise($$$('ArgumentError'), "negative array size"); + } if ($truthy(self.length === 0)) { + return [] + } if ($truthy(count === 1)) { + return [self.pop()]; + } else if ($truthy(count > self.length)) { + return self.splice(0, self.length); + } else { + return self.splice(self.length - count, self.length); + } }, -1); + + $def(self, '$product', function $$product($a) { + var block = $$product.$$p || nil, $post_args, args, self = this; + + $$product.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + + var result = (block !== nil) ? null : [], + n = args.length + 1, + counters = new Array(n), + lengths = new Array(n), + arrays = new Array(n), + i, m, subarray, len, resultlen = 1; + + arrays[0] = self; + for (i = 1; i < n; i++) { + arrays[i] = $coerce_to(args[i - 1], $$$('Array'), 'to_ary'); + } + + for (i = 0; i < n; i++) { + len = arrays[i].length; + if (len === 0) { + return result || self; + } + resultlen *= len; + if (resultlen > 2147483647) { + $Kernel.$raise($$$('RangeError'), "too big to product"); + } + lengths[i] = len; + counters[i] = 0; + } + + outer_loop: for (;;) { + subarray = []; + for (i = 0; i < n; i++) { + subarray.push(arrays[i][counters[i]]); + } + if (result) { + result.push(subarray); + } else { + Opal.yield1(block, subarray); + } + m = n - 1; + counters[m]++; + while (counters[m] === lengths[m]) { + counters[m] = 0; + if (--m < 0) break outer_loop; + counters[m]++; + } + } + + return result || self; + }, -1); + + $def(self, '$push', function $$push($a) { + var $post_args, objects, self = this; + + + $post_args = $slice(arguments); + objects = $post_args; + + $deny_frozen_access(self); + + for (var i = 0, length = objects.length; i < length; i++) { + self.push(objects[i]); + } + return self; + }, -1); + + $def(self, '$rassoc', function $$rassoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + item = self[i]; + + if (item.length && item[1] !== undefined) { + if ((item[1])['$=='](object)) { + return item; + } + } + } + + return nil; + + }); + + $def(self, '$reject', function $$reject() { + var block = $$reject.$$p || nil, self = this; + + $$reject.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["reject"], function $$36(){var self = $$36.$$s == null ? this : $$36.$$s; + + return self.$size()}, {$$s: self}) + } + var result = []; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value === false || value === nil) { + result.push(self[i]); + } + } + return result; + }); + + $def(self, '$reject!', function $Array_reject$excl$37() { + var block = $Array_reject$excl$37.$$p || nil, self = this, original = nil; + + $Array_reject$excl$37.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["reject!"], function $$38(){var self = $$38.$$s == null ? this : $$38.$$s; + + return self.$size()}, {$$s: self}) + } $deny_frozen_access(self); + original = self.$length(); + $send(self, 'delete_if', [], block.$to_proc()); + if ($eqeq(self.$length(), original)) { + return nil + } else { + return self + } }); + + $def(self, '$replace', function $$replace(other) { + var self = this; + + + $deny_frozen_access(self); + other = ($eqeqeq($$$('Array'), other) ? (other.$to_a()) : (($coerce_to(other, $$$('Array'), 'to_ary')).$to_a())); + + self.splice(0, self.length); + self.push.apply(self, other); + return self; + }); + + $def(self, '$reverse', function $$reverse() { + var self = this; + + return self.slice(0).reverse(); + }); + + $def(self, '$reverse!', function $Array_reverse$excl$39() { + var self = this; + + + $deny_frozen_access(self); + return self.reverse(); }); + + $def(self, '$reverse_each', function $$reverse_each() { + var block = $$reverse_each.$$p || nil, self = this; + + $$reverse_each.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["reverse_each"], function $$40(){var self = $$40.$$s == null ? this : $$40.$$s; + + return self.$size()}, {$$s: self}) + } $send(self.$reverse(), 'each', [], block.$to_proc()); + return self; + }); + + $def(self, '$rindex', function $$rindex(object) { + var block = $$rindex.$$p || nil, self = this; + + $$rindex.$$p = null; + + var i, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used"); + } + + if (object != null) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else if (object == null) { + return self.$enum_for("rindex"); + } + + return nil; + }, -1); + + $def(self, '$rotate', function $$rotate(n) { + var self = this; + + + if (n == null) n = 1; + + var ary, idx, firstPart, lastPart; + + n = $coerce_to(n, $$$('Integer'), 'to_int'); + + if (self.length === 1) { + return self.slice(); + } + if (self.length === 0) { + return []; + } + + ary = self.slice(); + idx = n % ary.length; + + firstPart = ary.slice(idx); + lastPart = ary.slice(0, idx); + return firstPart.concat(lastPart); + }, -1); + + $def(self, '$rotate!', function $Array_rotate$excl$41(cnt) { + var self = this, ary = nil; + + + if (cnt == null) cnt = 1; + + $deny_frozen_access(self); + + if (self.length === 0 || self.length === 1) { + return self; + } + cnt = $coerce_to(cnt, $$$('Integer'), 'to_int'); + ary = self.$rotate(cnt); + return self.$replace(ary); + }, -1); + (function($base, $super) { + var self = $klass($base, $super, 'SampleRandom'); + + var $proto = self.$$prototype; + + $proto.rng = nil; + + + $def(self, '$initialize', $assign_ivar("rng")); + return $def(self, '$rand', function $$rand(size) { + var self = this, random = nil; + + + random = $coerce_to(self.rng.$rand(size), $$$('Integer'), 'to_int'); + if ($truthy(random < 0)) { + $Kernel.$raise($$$('RangeError'), "random value must be >= 0"); + } if (!$truthy(random < size)) { + $Kernel.$raise($$$('RangeError'), "random value must be less than Array size"); + } return random; + }); + })(self, null); + + $def(self, '$sample', function $$sample(count, options) { + var self = this, o = nil, rng = nil; + if ($truthy(count === undefined)) { + return self.$at($Kernel.$rand(self.length)) + } if ($truthy(options === undefined)) { + if ($truthy((o = $Opal['$coerce_to?'](count, $$$('Hash'), "to_hash")))) { + + options = o; + count = nil; + } else { + + options = nil; + count = $coerce_to(count, $$$('Integer'), 'to_int'); + } + } else { + + count = $coerce_to(count, $$$('Integer'), 'to_int'); + options = $coerce_to(options, $$$('Hash'), 'to_hash'); + } if (($truthy(count) && ($truthy(count < 0)))) { + $Kernel.$raise($$$('ArgumentError'), "count must be greater than 0"); + } if ($truthy(options)) { + rng = options['$[]']("random"); + } rng = (($truthy(rng) && ($truthy(rng['$respond_to?']("rand")))) ? ($$('SampleRandom').$new(rng)) : ($Kernel)); + if (!$truthy(count)) { + return self[rng.$rand(self.length)] + } + + var abandon, spin, result, i, j, k, targetIndex, oldValue; + + if (count > self.length) { + count = self.length; + } + + switch (count) { + case 0: + return []; + case 1: + return [self[rng.$rand(self.length)]]; + case 2: + i = rng.$rand(self.length); + j = rng.$rand(self.length - 1); + if (i <= j) { + j++; + } + return [self[i], self[j]]; + default: + if (self.length / count > 3) { + abandon = false; + spin = 0; + + result = $$('Array').$new(count); + i = 1; + + result[0] = rng.$rand(self.length); + while (i < count) { + k = rng.$rand(self.length); + j = 0; + + while (j < i) { + while (k === result[j]) { + spin++; + if (spin > 100) { + abandon = true; + break; + } + k = rng.$rand(self.length); + } + if (abandon) { break; } + + j++; + } + + if (abandon) { break; } + + result[i] = k; + + i++; + } + + if (!abandon) { + i = 0; + while (i < count) { + result[i] = self[result[i]]; + i++; + } + + return result; + } + } + + result = self.slice(); + + for (var c = 0; c < count; c++) { + targetIndex = rng.$rand(self.length - c) + c; + oldValue = result[c]; + result[c] = result[targetIndex]; + result[targetIndex] = oldValue; + } + + return count === self.length ? result : (result)['$[]'](0, count); + } + }, -1); + + $def(self, '$select', function $$select() { + var block = $$select.$$p || nil, self = this; + + $$select.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["select"], function $$42(){var self = $$42.$$s == null ? this : $$42.$$s; + + return self.$size()}, {$$s: self}) + } + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = $yield1(block, item); + + if ($truthy(value)) { + result.push(item); + } + } + + return result; + }); + + $def(self, '$select!', function $Array_select$excl$43() { + var block = $Array_select$excl$43.$$p || nil, self = this; + + $Array_select$excl$43.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["select!"], function $$44(){var self = $$44.$$s == null ? this : $$44.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + var original = self.length; + $send(self, 'keep_if', [], block.$to_proc()); + return self.length === original ? nil : self; + }); + + $def(self, '$shift', function $$shift(count) { + var self = this; + $deny_frozen_access(self); + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil + } return shiftNoArg(self); + } count = $coerce_to(count, $$$('Integer'), 'to_int'); + if ($truthy(count < 0)) { + $Kernel.$raise($$$('ArgumentError'), "negative array size"); + } if ($truthy(self.length === 0)) { + return [] + } return self.splice(0, count); }, -1); + + $def(self, '$shuffle', function $$shuffle(rng) { + var self = this; + return self.$dup().$to_a()['$shuffle!'](rng); + }, -1); + + $def(self, '$shuffle!', function $Array_shuffle$excl$45(rng) { + var self = this; + + $deny_frozen_access(self); + + var randgen, i = self.length, j, tmp; + + if (rng !== undefined) { + rng = $Opal['$coerce_to?'](rng, $$$('Hash'), "to_hash"); + + if (rng !== nil) { + rng = rng['$[]']("random"); + + if (rng !== nil && rng['$respond_to?']("rand")) { + randgen = rng; + } + } + } + + while (i) { + if (randgen) { + j = randgen.$rand(i).$to_int(); + + if (j < 0) { + $Kernel.$raise($$$('RangeError'), "random number too small " + (j)); + } + + if (j >= i) { + $Kernel.$raise($$$('RangeError'), "random number too big " + (j)); + } + } + else { + j = self.$rand(i); + } + + tmp = self[--i]; + self[i] = self[j]; + self[j] = tmp; + } + + return self; + }, -1); + + $def(self, '$slice!', function $Array_slice$excl$46(index, length) { + var self = this, result = nil, range = nil, range_start = nil, range_end = nil, start = nil; + $deny_frozen_access(self); + result = nil; + if ($truthy(length === undefined)) { + if ($eqeqeq($$$('Range'), index)) { + + range = index; + result = self['$[]'](range); + range_start = range.begin === nil ? 0 : $coerce_to(range.begin, $$$('Integer'), 'to_int'); + range_end = range.end === nil ? -1 : $coerce_to(range.end, $$$('Integer'), 'to_int'); + + if (range_start < 0) { + range_start += self.length; + } + + if (range_end < 0) { + range_end += self.length; + } else if (range_end >= self.length) { + range_end = self.length - 1; + if (range.excl) { + range_end += 1; + } + } + + var range_length = range_end - range_start; + if (range.excl && range.end !== nil) { + range_end -= 1; + } else { + range_length += 1; + } + + if (range_start < self.length && range_start >= 0 && range_end < self.length && range_end >= 0 && range_length > 0) { + self.splice(range_start, range_length); + } + } else { + + start = $coerce_to(index, $$$('Integer'), 'to_int'); + + if (start < 0) { + start += self.length; + } + + if (start < 0 || start >= self.length) { + return nil; + } + + result = self[start]; + + if (start === 0) { + self.shift(); + } else { + self.splice(start, 1); + } + } + } else { + + start = $coerce_to(index, $$$('Integer'), 'to_int'); + length = $coerce_to(length, $$$('Integer'), 'to_int'); + + if (length < 0) { + return nil; + } + + result = self['$[]'](start, length); + + if (start < 0) { + start += self.length; + } + + if (start + length > self.length) { + length = self.length - start; + } + + if (start < self.length && start >= 0) { + self.splice(start, length); + } + } return result; + }, -2); + + $def(self, '$sort', function $$sort() { + var block = $$sort.$$p || nil, self = this; + + $$sort.$$p = null; + if (!$truthy(self.length > 1)) { + return self + } + if (block === nil) { + block = function(a, b) { + return (a)['$<=>'](b); + }; + } + + return self.slice().sort(function(x, y) { + var ret = block(x, y); + + if (ret === nil) { + $Kernel.$raise($$$('ArgumentError'), "comparison of " + ((x).$inspect()) + " with " + ((y).$inspect()) + " failed"); + } + + return $rb_gt(ret, 0) ? 1 : ($rb_lt(ret, 0) ? -1 : 0); + }); + }); + + $def(self, '$sort!', function $Array_sort$excl$47() { + var block = $Array_sort$excl$47.$$p || nil, self = this; + + $Array_sort$excl$47.$$p = null; + + $deny_frozen_access(self); + + var result; + + if ((block !== nil)) { + result = $send((self.slice()), 'sort', [], block.$to_proc()); + } + else { + result = (self.slice()).$sort(); + } + + self.length = 0; + for(var i = 0, length = result.length; i < length; i++) { + self.push(result[i]); + } + + return self; + }); + + $def(self, '$sort_by!', function $Array_sort_by$excl$48() { + var block = $Array_sort_by$excl$48.$$p || nil, self = this; + + $Array_sort_by$excl$48.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["sort_by!"], function $$49(){var self = $$49.$$s == null ? this : $$49.$$s; + + return self.$size()}, {$$s: self}) + } $deny_frozen_access(self); + return self.$replace($send(self, 'sort_by', [], block.$to_proc())); + }); + + $def(self, '$take', function $$take(count) { + var self = this; + + + if (count < 0) { + $Kernel.$raise($$$('ArgumentError')); + } + + return self.slice(0, count); + + }); + + $def(self, '$take_while', function $$take_while() { + var block = $$take_while.$$p || nil, self = this; + + $$take_while.$$p = null; + + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = block(item); + + if (value === false || value === nil) { + return result; + } + + result.push(item); + } + + return result; + }); + + $def(self, '$to_a', function $$to_a() { + var self = this; + + + if (self.$$class === Opal.Array) { + return self; + } + else { + return Opal.Array.$new(self); + } + + }); + + $def(self, '$to_ary', $return_self); + + $def(self, '$to_h', function $$to_h() { + var block = $$to_h.$$p || nil, self = this, array = nil; + + $$to_h.$$p = null; + array = self; + if ((block !== nil)) { + array = $send(array, 'map', [], block.$to_proc()); + } + var i, len = array.length, ary, key, val, hash = $hash2([], {}); + + for (i = 0; i < len; i++) { + ary = $Opal['$coerce_to?'](array[i], $$$('Array'), "to_ary"); + if (!ary.$$is_array) { + $Kernel.$raise($$$('TypeError'), "wrong element type " + ((ary).$class()) + " at " + (i) + " (expected array)"); + } + if (ary.length !== 2) { + $Kernel.$raise($$$('ArgumentError'), "wrong array length at " + (i) + " (expected 2, was " + ((ary).$length()) + ")"); + } + key = ary[0]; + val = ary[1]; + $hash_put(hash, key, val); + } + + return hash; + }); + + $def(self, '$transpose', function $$transpose() { + var self = this, result = nil, max = nil; + + + if ($truthy(self['$empty?']())) { + return [] + } result = []; + max = nil; + $send(self, 'each', [], function $$50(row){var $ret_or_1 = nil; + + + if (row == null) row = nil; + row = ($eqeqeq($$$('Array'), row) ? (row.$to_a()) : (($coerce_to(row, $$$('Array'), 'to_ary')).$to_a())); + max = ($truthy(($ret_or_1 = max)) ? ($ret_or_1) : (row.length)); + if ($neqeq(row.length, max)) { + $Kernel.$raise($$$('IndexError'), "element size differs (" + (row.length) + " should be " + (max) + ")"); + } return $send((row.length), 'times', [], function $$51(i){var $a, entry = nil; + + + if (i == null) i = nil; + entry = ($truthy(($ret_or_1 = result['$[]'](i))) ? ($ret_or_1) : (($a = [i, []], $send(result, '[]=', $a), $a[$a.length - 1]))); + return entry['$<<'](row.$at(i));});}); + return result; + }); + + $def(self, '$union', function $$union($a) { + var $post_args, arrays, self = this; + + + $post_args = $slice(arguments); + arrays = $post_args; + return $send(arrays, 'reduce', [self.$uniq()], function $$52(a, b){ + + if (a == null) a = nil; + if (b == null) b = nil; + return a['$|'](b);}); + }, -1); + + $def(self, '$uniq', function $$uniq() { + var block = $$uniq.$$p || nil, self = this; + + $$uniq.$$p = null; + + var hash = $hash2([], {}), i, length, item, key; + + if (block === nil) { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if ($hash_get(hash, item) === undefined) { + $hash_put(hash, item, item); + } + } + } + else { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + key = $yield1(block, item); + if ($hash_get(hash, key) === undefined) { + $hash_put(hash, key, item); + } + } + } + + return (hash).$values(); + }); + + $def(self, '$uniq!', function $Array_uniq$excl$53() { + var block = $Array_uniq$excl$53.$$p || nil, self = this; + + $Array_uniq$excl$53.$$p = null; + + $deny_frozen_access(self); + + var original_length = self.length, hash = $hash2([], {}), i, length, item, key; + + for (i = 0, length = original_length; i < length; i++) { + item = self[i]; + key = (block === nil ? item : $yield1(block, item)); + + if ($hash_get(hash, key) === undefined) { + $hash_put(hash, key, item); + continue; + } + + self.splice(i, 1); + length--; + i--; + } + + return self.length === original_length ? nil : self; + }); + + $def(self, '$unshift', function $$unshift($a) { + var $post_args, objects, self = this; + + + $post_args = $slice(arguments); + objects = $post_args; + + $deny_frozen_access(self); + + var selfLength = self.length; + var objectsLength = objects.length; + if (objectsLength == 0) return self; + var index = selfLength - objectsLength; + for (var i = 0; i < objectsLength; i++) { + self.push(self[index + i]); + } + var len = selfLength - 1; + while (len - objectsLength >= 0) { + self[len] = self[len - objectsLength]; + len--; + } + for (var j = 0; j < objectsLength; j++) { + self[j] = objects[j]; + } + return self; + }, -1); + + $def(self, '$values_at', function $$values_at($a) { + var $post_args, args, self = this, out = nil; + + + $post_args = $slice(arguments); + args = $post_args; + out = []; + $send(args, 'each', [], function $$54(elem){var self = $$54.$$s == null ? this : $$54.$$s, finish = nil, start = nil, i = nil; + + + if (elem == null) elem = nil; + if ($truthy(elem['$is_a?']($$$('Range')))) { + + finish = elem.$end() === nil ? -1 : $coerce_to(elem.$end(), $$$('Integer'), 'to_int'); + start = elem.$begin() === nil ? 0 : $coerce_to(elem.$begin(), $$$('Integer'), 'to_int'); + + if (start < 0) { + start = start + self.length; + return nil; + } + + if (finish < 0) { + finish = finish + self.length; + } + if (elem['$exclude_end?']() && elem.$end() !== nil) { + finish--; + } + if (finish < start) { + return nil; + } + return $send(start, 'upto', [finish], function $$55(i){var self = $$55.$$s == null ? this : $$55.$$s; + + + if (i == null) i = nil; + return out['$<<'](self.$at(i));}, {$$s: self}); + } else { + + i = $coerce_to(elem, $$$('Integer'), 'to_int'); + return out['$<<'](self.$at(i)); + }}, {$$s: self}); + return out; + }, -1); + + $def(self, '$zip', function $$zip($a) { + var block = $$zip.$$p || nil, $post_args, others, self = this, $ret_or_1 = nil; + + $$zip.$$p = null; + $post_args = $slice(arguments); + others = $post_args; + + var result = [], size = self.length, part, o, i, j, jj; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j]; + if (o.$$is_array) { + continue; + } + if (o.$$is_range || o.$$is_enumerator) { + others[j] = o.$take(size); + continue; + } + others[j] = ($truthy(($ret_or_1 = $Opal['$coerce_to?'](o, $$$('Array'), "to_ary"))) ? ($ret_or_1) : ($Opal['$coerce_to!'](o, $$$('Enumerator'), "to_enum", "each"))).$to_a(); + } + + for (i = 0; i < size; i++) { + part = [self[i]]; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j][i]; + + if (o == null) { + o = nil; + } + + part[j + 1] = o; + } + + result[i] = part; + } + + if (block !== nil) { + for (i = 0; i < size; i++) { + Opal.yield1(block, result[i]); + } + + return nil; + } + + return result; + }, -1); + $defs(self, '$inherited', function $$inherited(klass) { + + + klass.$$prototype.$to_a = function() { + return this.slice(0, this.length); + }; + + }); + + $def(self, '$instance_variables', function $$instance_variables() { + var $yield = $$instance_variables.$$p || nil, self = this; + + $$instance_variables.$$p = null; + return $send($send2(self, $find_super(self, 'instance_variables', $$instance_variables, false, true), 'instance_variables', [], $yield), 'reject', [], function $$56(ivar){var $ret_or_1 = nil; + + + if (ivar == null) ivar = nil; + if ($truthy(($ret_or_1 = /^@\d+$/.test(ivar)))) { + return $ret_or_1 + } else { + return ivar['$==']("@length") + }}) + }); + + $def(self, '$pack', function $$pack($a) { + + + $slice(arguments); + return $Kernel.$raise("To use Array#pack, you must first require 'corelib/array/pack'."); + }, -1); + $alias(self, "append", "push"); + $alias(self, "filter", "select"); + $alias(self, "filter!", "select!"); + $alias(self, "map", "collect"); + $alias(self, "map!", "collect!"); + $alias(self, "prepend", "unshift"); + $alias(self, "size", "length"); + $alias(self, "slice", "[]"); + $alias(self, "to_s", "inspect"); + $Opal.$pristine(self.$singleton_class(), "allocate"); + return $Opal.$pristine(self, "copy_instance_variables", "initialize_dup"); + })('::', Array, $nesting); + }; + + Opal.modules["corelib/hash"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $yield1 = Opal.yield1, $hash = Opal.hash, $hash_init = Opal.hash_init, $hash_get = Opal.hash_get, $hash_put = Opal.hash_put, $hash_delete = Opal.hash_delete, $deny_frozen_access = Opal.deny_frozen_access, $freeze = Opal.freeze, $klass = Opal.klass, $slice = Opal.slice, $Opal = Opal.Opal, $Kernel = Opal.Kernel, $defs = Opal.defs, $def = Opal.def, $send = Opal.send, $rb_ge = Opal.rb_ge, $rb_gt = Opal.rb_gt, $hash2 = Opal.hash2, $truthy = Opal.truthy, $to_a = Opal.to_a, $return_self = Opal.return_self, $alias = Opal.alias, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,include,coerce_to?,[],merge!,allocate,raise,coerce_to!,each,fetch,>=,>,==,compare_by_identity,lambda?,abs,arity,enum_for,size,respond_to?,class,dig,except!,dup,delete,new,inspect,map,to_proc,flatten,frozen?,eql?,default,default_proc,default_proc=,default=,to_h,proc,clone,select,select!,has_key?,indexes,index,length,[]=,has_value?'); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Hash'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$$('Enumerable')); + self.$$prototype.$$is_hash = true; + $defs(self, '$[]', function $Hash_$$$1($a) { + var $post_args, argv, self = this; + + + $post_args = $slice(arguments); + argv = $post_args; + + var hash, argc = argv.length, i; + + if (argc === 1) { + hash = $Opal['$coerce_to?'](argv['$[]'](0), $$$('Hash'), "to_hash"); + if (hash !== nil) { + return self.$allocate()['$merge!'](hash); + } + + argv = $Opal['$coerce_to?'](argv['$[]'](0), $$$('Array'), "to_ary"); + if (argv === nil) { + $Kernel.$raise($$$('ArgumentError'), "odd number of arguments for Hash"); + } + + argc = argv.length; + hash = self.$allocate(); + + for (i = 0; i < argc; i++) { + if (!argv[i].$$is_array) continue; + switch(argv[i].length) { + case 1: + hash.$store(argv[i][0], nil); + break; + case 2: + hash.$store(argv[i][0], argv[i][1]); + break; + default: + $Kernel.$raise($$$('ArgumentError'), "invalid number of elements (" + (argv[i].length) + " for 1..2)"); + } + } + + return hash; + } + + if (argc % 2 !== 0) { + $Kernel.$raise($$$('ArgumentError'), "odd number of arguments for Hash"); + } + + hash = self.$allocate(); + + for (i = 0; i < argc; i += 2) { + hash.$store(argv[i], argv[i + 1]); + } + + return hash; + }, -1); + $defs(self, '$allocate', function $$allocate() { + var self = this; + + + var hash = new self.$$constructor(); + + $hash_init(hash); + + hash.$$none = nil; + hash.$$proc = nil; + + return hash; + + }); + $defs(self, '$try_convert', function $$try_convert(obj) { + + return $Opal['$coerce_to?'](obj, $$$('Hash'), "to_hash") + }); + + $def(self, '$initialize', function $$initialize(defaults) { + var block = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + + $deny_frozen_access(self); + + if (defaults !== undefined && block !== nil) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (1 for 0)"); + } + self.$$none = (defaults === undefined ? nil : defaults); + self.$$proc = block; + + return self; + }, -1); + + $def(self, '$==', function $Hash_$eq_eq$2(other) { + var self = this; + + + if (self === other) { + return true; + } + + if (!other.$$is_hash) { + return false; + } + + if (self.$$keys.length !== other.$$keys.length) { + return false; + } + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, other_value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + other_value = other.$$smap[key]; + } else { + value = key.value; + other_value = $hash_get(other, key.key); + } + + if (other_value === undefined || !value['$eql?'](other_value)) { + return false; + } + } + + return true; + + }); + + $def(self, '$>=', function $Hash_$gt_eq$3(other) { + var self = this, result = nil; + + + other = $Opal['$coerce_to!'](other, $$$('Hash'), "to_hash"); + + if (self.$$keys.length < other.$$keys.length) { + return false + } + result = true; + $send(other, 'each', [], function $$4(other_key, other_val){var self = $$4.$$s == null ? this : $$4.$$s, val = nil; + + + if (other_key == null) other_key = nil; + if (other_val == null) other_val = nil; + val = self.$fetch(other_key, null); + + if (val == null || val !== other_val) { + result = false; + return; + } + }, {$$s: self}); + return result; + }); + + $def(self, '$>', function $Hash_$gt$5(other) { + var self = this; + + + other = $Opal['$coerce_to!'](other, $$$('Hash'), "to_hash"); + + if (self.$$keys.length <= other.$$keys.length) { + return false + } + return $rb_ge(self, other); + }); + + $def(self, '$<', function $Hash_$lt$6(other) { + var self = this; + + + other = $Opal['$coerce_to!'](other, $$$('Hash'), "to_hash"); + return $rb_gt(other, self); + }); + + $def(self, '$<=', function $Hash_$lt_eq$7(other) { + var self = this; + + + other = $Opal['$coerce_to!'](other, $$$('Hash'), "to_hash"); + return $rb_ge(other, self); + }); + + $def(self, '$[]', function $Hash_$$$8(key) { + var self = this; + + + var value = $hash_get(self, key); + + if (value !== undefined) { + return value; + } + + return self.$default(key); + + }); + + $def(self, '$[]=', function $Hash_$$$eq$9(key, value) { + var self = this; + + + $deny_frozen_access(self); + + $hash_put(self, key, value); + return value; + + }); + + $def(self, '$assoc', function $$assoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + if ((key)['$=='](object)) { + return [key, self.$$smap[key]]; + } + } else { + if ((key.key)['$=='](object)) { + return [key.key, key.value]; + } + } + } + + return nil; + + }); + + $def(self, '$clear', function $$clear() { + var self = this; + + + $deny_frozen_access(self); + + $hash_init(self); + return self; + + }); + + $def(self, '$clone', function $$clone() { + var self = this; + + + var hash = new self.$$class(); + + $hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + + }); + + $def(self, '$compact', function $$compact() { + var self = this; + + + var hash = $hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value !== nil) { + $hash_put(hash, key, value); + } + } + + return hash; + + }); + + $def(self, '$compact!', function $Hash_compact$excl$10() { + var self = this; + + + $deny_frozen_access(self); + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value === nil) { + if ($hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + + }); + + $def(self, '$compare_by_identity', function $$compare_by_identity() { + var self = this; + + + $deny_frozen_access(self); + + var i, ii, key, keys = self.$$keys, identity_hash; + + if (self.$$by_identity) return self; + if (self.$$keys.length === 0) { + self.$$by_identity = true; + return self; + } + + identity_hash = $hash2([], {}).$compare_by_identity(); + for(i = 0, ii = keys.length; i < ii; i++) { + key = keys[i]; + if (!key.$$is_string) key = key.key; + $hash_put(identity_hash, key, $hash_get(self, key)); + } + + self.$$by_identity = true; + self.$$map = identity_hash.$$map; + self.$$smap = identity_hash.$$smap; + return self; + + }); + + $def(self, '$compare_by_identity?', function $Hash_compare_by_identity$ques$11() { + var self = this; + + return self.$$by_identity === true; + }); + + $def(self, '$default', function $Hash_default$12(key) { + var self = this; + + if (key !== undefined && self.$$proc !== nil && self.$$proc !== undefined) { + return self.$$proc.$call(self, key); + } + if (self.$$none === undefined) { + return nil; + } + return self.$$none; + }, -1); + + $def(self, '$default=', function $Hash_default$eq$13(object) { + var self = this; + + + $deny_frozen_access(self); + + self.$$proc = nil; + self.$$none = object; + + return object; + + }); + + $def(self, '$default_proc', function $$default_proc() { + var self = this; + + + if (self.$$proc !== undefined) { + return self.$$proc; + } + return nil; + + }); + + $def(self, '$default_proc=', function $Hash_default_proc$eq$14(default_proc) { + var self = this; + + + $deny_frozen_access(self); + + var proc = default_proc; + + if (proc !== nil) { + proc = $Opal['$coerce_to!'](proc, $$$('Proc'), "to_proc"); + + if ((proc)['$lambda?']() && (proc).$arity().$abs() !== 2) { + $Kernel.$raise($$$('TypeError'), "default_proc takes two arguments"); + } + } + + self.$$none = nil; + self.$$proc = proc; + + return default_proc; + + }); + + $def(self, '$delete', function $Hash_delete$15(key) { + var block = $Hash_delete$15.$$p || nil, self = this; + + $Hash_delete$15.$$p = null; + + $deny_frozen_access(self); + var value = $hash_delete(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return Opal.yield1(block, key); + } + + return nil; + }); + + $def(self, '$delete_if', function $$delete_if() { + var block = $$delete_if.$$p || nil, self = this; + + $$delete_if.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["delete_if"], function $$16(){var self = $$16.$$s == null ? this : $$16.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if ($hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + }); + + $def(self, '$dig', function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + $post_args = $slice(arguments, 1); + keys = $post_args; + item = self['$[]'](key); + + if (item === nil || keys.length === 0) { + return item; + } + if (!$truthy(item['$respond_to?']("dig"))) { + $Kernel.$raise($$$('TypeError'), "" + (item.$class()) + " does not have #dig method"); + } return $send(item, 'dig', $to_a(keys)); + }, -2); + + $def(self, '$each', function $$each() { + var block = $$each.$$p || nil, self = this; + + $$each.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["each"], function $$17(){var self = $$17.$$s == null ? this : $$17.$$s; + + return self.$size()}, {$$s: self}) + } + for (var i = 0, keys = self.$$keys.slice(), length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + $yield1(block, [key, value]); + } + + return self; + }); + + $def(self, '$each_key', function $$each_key() { + var block = $$each_key.$$p || nil, self = this; + + $$each_key.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["each_key"], function $$18(){var self = $$18.$$s == null ? this : $$18.$$s; + + return self.$size()}, {$$s: self}) + } + for (var i = 0, keys = self.$$keys.slice(), length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? key : key.key); + } + + return self; + }); + + $def(self, '$each_value', function $$each_value() { + var block = $$each_value.$$p || nil, self = this; + + $$each_value.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["each_value"], function $$19(){var self = $$19.$$s == null ? this : $$19.$$s; + + return self.$size()}, {$$s: self}) + } + for (var i = 0, keys = self.$$keys.slice(), length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? self.$$smap[key] : key.value); + } + + return self; + }); + + $def(self, '$empty?', function $Hash_empty$ques$20() { + var self = this; + + return self.$$keys.length === 0; + }); + + $def(self, '$except', function $$except($a) { + var $post_args, keys, self = this; + + + $post_args = $slice(arguments); + keys = $post_args; + return $send(self.$dup(), 'except!', $to_a(keys)); + }, -1); + + $def(self, '$except!', function $Hash_except$excl$21($a) { + var $post_args, keys, self = this; + + + $post_args = $slice(arguments); + keys = $post_args; + $send(keys, 'each', [], function $$22(key){var self = $$22.$$s == null ? this : $$22.$$s; + + + if (key == null) key = nil; + return self.$delete(key);}, {$$s: self}); + return self; + }, -1); + + $def(self, '$fetch', function $$fetch(key, defaults) { + var block = $$fetch.$$p || nil, self = this; + + $$fetch.$$p = null; + + var value = $hash_get(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return block(key); + } + + if (defaults !== undefined) { + return defaults; + } + return $Kernel.$raise($$$('KeyError').$new("key not found: " + (key.$inspect()), $hash2(["key", "receiver"], {"key": key, "receiver": self}))); + }, -2); + + $def(self, '$fetch_values', function $$fetch_values($a) { + var block = $$fetch_values.$$p || nil, $post_args, keys, self = this; + + $$fetch_values.$$p = null; + $post_args = $slice(arguments); + keys = $post_args; + return $send(keys, 'map', [], function $$23(key){var self = $$23.$$s == null ? this : $$23.$$s; + + + if (key == null) key = nil; + return $send(self, 'fetch', [key], block.$to_proc());}, {$$s: self}); + }, -1); + + $def(self, '$flatten', function $$flatten(level) { + var self = this; + + + if (level == null) level = 1; + level = $Opal['$coerce_to!'](level, $$$('Integer'), "to_int"); + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push(key); + + if (value.$$is_array) { + if (level === 1) { + result.push(value); + continue; + } + + result = result.concat((value).$flatten(level - 2)); + continue; + } + + result.push(value); + } + + return result; + }, -1); + + $def(self, '$freeze', function $$freeze() { + var self = this; + + + if ($truthy(self['$frozen?']())) { + return self + } return $freeze(self); }); + + $def(self, '$has_key?', function $Hash_has_key$ques$24(key) { + var self = this; + + return $hash_get(self, key) !== undefined; + }); + + $def(self, '$has_value?', function $Hash_has_value$ques$25(value) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (((key.$$is_string ? self.$$smap[key] : key.value))['$=='](value)) { + return true; + } + } + + return false; + + }); + + $def(self, '$hash', function $$hash() { + var self = this; + + + var top = (Opal.hash_ids === undefined), + hash_id = self.$object_id(), + result = ['Hash'], + key, item; + + try { + if (top) { + Opal.hash_ids = Object.create(null); + } + + if (Opal[hash_id]) { + return 'self'; + } + + for (key in Opal.hash_ids) { + item = Opal.hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + Opal.hash_ids[hash_id] = self; + + for (var i = 0, keys = self.$$keys, length = keys.length; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push([key, self.$$smap[key].$hash()]); + } else { + result.push([key.key_hash, key.value.$hash()]); + } + } + + return result.sort().join(); + + } finally { + if (top) { + Opal.hash_ids = undefined; + } + } + + }); + + $def(self, '$index', function $$index(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return key; + } + } + + return nil; + + }); + + $def(self, '$indexes', function $$indexes($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + + var result = []; + + for (var i = 0, length = args.length, key, value; i < length; i++) { + key = args[i]; + value = $hash_get(self, key); + + if (value === undefined) { + result.push(self.$default()); + continue; + } + + result.push(value); + } + + return result; + }, -1); + var inspect_ids; + + $def(self, '$inspect', function $$inspect() { + var self = this; + + + + var top = (inspect_ids === undefined), + hash_id = self.$object_id(), + result = []; + + return (function() { try { + + + if (top) { + inspect_ids = {}; + } + + if (inspect_ids.hasOwnProperty(hash_id)) { + return '{...}'; + } + + inspect_ids[hash_id] = true; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + key = $$('Opal').$inspect(key); + value = $$('Opal').$inspect(value); + + result.push(key + '=>' + value); + } + + return '{' + result.join(', ') + '}'; + ; + return nil; + } finally { + if (top) inspect_ids = undefined; + } })(); }); + + $def(self, '$invert', function $$invert() { + var self = this; + + + var hash = $hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + $hash_put(hash, value, key); + } + + return hash; + + }); + + $def(self, '$keep_if', function $$keep_if() { + var block = $$keep_if.$$p || nil, self = this; + + $$keep_if.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["keep_if"], function $$26(){var self = $$26.$$s == null ? this : $$26.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if ($hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + }); + + $def(self, '$keys', function $$keys() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(key); + } else { + result.push(key.key); + } + } + + return result; + + }); + + $def(self, '$length', function $$length() { + var self = this; + + return self.$$keys.length; + }); + + $def(self, '$merge', function $$merge($a) { + var block = $$merge.$$p || nil, $post_args, others, self = this; + + $$merge.$$p = null; + $post_args = $slice(arguments); + others = $post_args; + return $send(self.$dup(), 'merge!', $to_a(others), block.$to_proc()); + }, -1); + + $def(self, '$merge!', function $Hash_merge$excl$27($a) { + var block = $Hash_merge$excl$27.$$p || nil, $post_args, others, self = this; + + $Hash_merge$excl$27.$$p = null; + $post_args = $slice(arguments); + others = $post_args; + + $deny_frozen_access(self); + var i, j, other, other_keys, length, key, value, other_value; + for (i = 0; i < others.length; ++i) { + other = $Opal['$coerce_to!'](others[i], $$$('Hash'), "to_hash"); + other_keys = other.$$keys, length = other_keys.length; + + if (block === nil) { + for (j = 0; j < length; j++) { + key = other_keys[j]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + $hash_put(self, key, other_value); + } + } else { + for (j = 0; j < length; j++) { + key = other_keys[j]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + value = $hash_get(self, key); + + if (value === undefined) { + $hash_put(self, key, other_value); + continue; + } + + $hash_put(self, key, block(key, value, other_value)); + } + } + } + + return self; + }, -1); + + $def(self, '$rassoc', function $$rassoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return [key, value]; + } + } + + return nil; + + }); + + $def(self, '$rehash', function $$rehash() { + var self = this; + + + $deny_frozen_access(self); + Opal.hash_rehash(self); + return self; + + }); + + $def(self, '$reject', function $$reject() { + var block = $$reject.$$p || nil, self = this; + + $$reject.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["reject"], function $$28(){var self = $$28.$$s == null ? this : $$28.$$s; + + return self.$size()}, {$$s: self}) + } + var hash = $hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + $hash_put(hash, key, value); + } + } + + return hash; + }); + + $def(self, '$reject!', function $Hash_reject$excl$29() { + var block = $Hash_reject$excl$29.$$p || nil, self = this; + + $Hash_reject$excl$29.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["reject!"], function $$30(){var self = $$30.$$s == null ? this : $$30.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if ($hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + }); + + $def(self, '$replace', function $$replace(other) { + var self = this; + + + $deny_frozen_access(self); other = $Opal['$coerce_to!'](other, $$$('Hash'), "to_hash"); + + $hash_init(self); + + for (var i = 0, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + $hash_put(self, key, other_value); + } + if ($truthy(other.$default_proc())) { + self['$default_proc='](other.$default_proc()); + } else { + self['$default='](other.$default()); + } return self; + }); + + $def(self, '$select', function $$select() { + var block = $$select.$$p || nil, self = this; + + $$select.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["select"], function $$31(){var self = $$31.$$s == null ? this : $$31.$$s; + + return self.$size()}, {$$s: self}) + } + var hash = $hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + $hash_put(hash, key, value); + } + } + + return hash; + }); + + $def(self, '$select!', function $Hash_select$excl$32() { + var block = $Hash_select$excl$32.$$p || nil, self = this; + + $Hash_select$excl$32.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["select!"], function $$33(){var self = $$33.$$s == null ? this : $$33.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + var result = nil; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if ($hash_delete(self, key) !== undefined) { + length--; + i--; + } + result = self; + } + } + + return result; + }); + + $def(self, '$shift', function $$shift() { + var self = this; + + + $deny_frozen_access(self); + var keys = self.$$keys, + key; + + if (keys.length > 0) { + key = keys[0]; + + key = key.$$is_string ? key : key.key; + + return [key, $hash_delete(self, key)]; + } + + return nil; + + }); + + $def(self, '$slice', function $$slice($a) { + var $post_args, keys, self = this; + + + $post_args = $slice(arguments); + keys = $post_args; + + var result = $hash(); + + for (var i = 0, length = keys.length; i < length; i++) { + var key = keys[i], value = $hash_get(self, key); + + if (value !== undefined) { + $hash_put(result, key, value); + } + } + + return result; + }, -1); + + $def(self, '$to_a', function $$to_a() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push([key, value]); + } + + return result; + + }); + + $def(self, '$to_h', function $$to_h() { + var block = $$to_h.$$p || nil, self = this; + + $$to_h.$$p = null; + if ((block !== nil)) { + return $send(self, 'map', [], block.$to_proc()).$to_h() + } + if (self.$$class === Opal.Hash) { + return self; + } + + var hash = new Opal.Hash(); + + $hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + }); + + $def(self, '$to_hash', $return_self); + + $def(self, '$to_proc', function $$to_proc() { + var self = this; + + return $send(self, 'proc', [], function $$34(key){var self = $$34.$$s == null ? this : $$34.$$s; + + if (key == null) { + $Kernel.$raise($$$('ArgumentError'), "no key given"); + } + return self['$[]'](key);}, {$$arity: -1, $$s: self}) + }); + + $def(self, '$transform_keys', function $$transform_keys() { + var block = $$transform_keys.$$p || nil, self = this; + + $$transform_keys.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["transform_keys"], function $$35(){var self = $$35.$$s == null ? this : $$35.$$s; + + return self.$size()}, {$$s: self}) + } + var result = $hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + key = $yield1(block, key); + + $hash_put(result, key, value); + } + + return result; + }); + + $def(self, '$transform_keys!', function $Hash_transform_keys$excl$36() { + var block = $Hash_transform_keys$excl$36.$$p || nil, self = this; + + $Hash_transform_keys$excl$36.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["transform_keys!"], function $$37(){var self = $$37.$$s == null ? this : $$37.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + var keys = Opal.slice(self.$$keys), + i, length = keys.length, key, value, new_key; + + for (i = 0; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + new_key = $yield1(block, key); + + $hash_delete(self, key); + $hash_put(self, new_key, value); + } + + return self; + }); + + $def(self, '$transform_values', function $$transform_values() { + var block = $$transform_values.$$p || nil, self = this; + + $$transform_values.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["transform_values"], function $$38(){var self = $$38.$$s == null ? this : $$38.$$s; + + return self.$size()}, {$$s: self}) + } + var result = $hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = $yield1(block, value); + + $hash_put(result, key, value); + } + + return result; + }); + + $def(self, '$transform_values!', function $Hash_transform_values$excl$39() { + var block = $Hash_transform_values$excl$39.$$p || nil, self = this; + + $Hash_transform_values$excl$39.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["transform_values!"], function $$40(){var self = $$40.$$s == null ? this : $$40.$$s; + + return self.$size()}, {$$s: self}) + } + $deny_frozen_access(self); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = $yield1(block, value); + + $hash_put(self, key, value); + } + + return self; + }); + + $def(self, '$values', function $$values() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(self.$$smap[key]); + } else { + result.push(key.value); + } + } + + return result; + + }); + $alias(self, "dup", "clone"); + $alias(self, "each_pair", "each"); + $alias(self, "eql?", "=="); + $alias(self, "filter", "select"); + $alias(self, "filter!", "select!"); + $alias(self, "include?", "has_key?"); + $alias(self, "indices", "indexes"); + $alias(self, "key", "index"); + $alias(self, "key?", "has_key?"); + $alias(self, "member?", "has_key?"); + $alias(self, "size", "length"); + $alias(self, "store", "[]="); + $alias(self, "to_s", "inspect"); + $alias(self, "update", "merge!"); + $alias(self, "value?", "has_value?"); + return $alias(self, "values_at", "indexes"); + })('::', null, $nesting); + }; + + Opal.modules["corelib/number"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $Opal = Opal.Opal, $Kernel = Opal.Kernel, $def = Opal.def, $eqeqeq = Opal.eqeqeq, $truthy = Opal.truthy, $rb_gt = Opal.rb_gt, $not = Opal.not, $rb_lt = Opal.rb_lt, $alias = Opal.alias, $send2 = Opal.send2, $find_super = Opal.find_super, $send = Opal.send, $rb_plus = Opal.rb_plus, $rb_minus = Opal.rb_minus, $eqeq = Opal.eqeq, $return_self = Opal.return_self, $rb_divide = Opal.rb_divide, $to_ary = Opal.to_ary, $rb_times = Opal.rb_times, $rb_le = Opal.rb_le, $rb_ge = Opal.rb_ge, $return_val = Opal.return_val, $const_set = Opal.const_set, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,bridge,raise,name,class,Float,respond_to?,coerce_to!,__coerced__,===,>,!,**,new,<,to_f,==,nan?,infinite?,enum_for,+,-,gcd,lcm,%,/,frexp,to_i,ldexp,rationalize,*,<<,to_r,truncate,-@,size,<=,>=,inspect,angle,to_s,is_a?,abs,__id__,next,coerce_to?'); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Number'); + + + $Opal.$bridge(Number, self); + Opal.prop(self.$$prototype, '$$is_number', true); + self.$$is_number_class = true; + (function(self, $parent_nesting) { + + + + $def(self, '$allocate', function $$allocate() { + var self = this; + + return $Kernel.$raise($$$('TypeError'), "allocator undefined for " + (self.$name())) + }); + + + Opal.udef(self, '$' + "new"); return nil; })(Opal.get_singleton_class(self)); + + $def(self, '$coerce', function $$coerce(other) { + var self = this; + + + if (other === nil) { + $Kernel.$raise($$$('TypeError'), "can't convert " + (other.$class()) + " into Float"); + } + else if (other.$$is_string) { + return [$Kernel.$Float(other), self]; + } + else if (other['$respond_to?']("to_f")) { + return [$Opal['$coerce_to!'](other, $$$('Float'), "to_f"), self]; + } + else if (other.$$is_number) { + return [other, self]; + } + else { + $Kernel.$raise($$$('TypeError'), "can't convert " + (other.$class()) + " into Float"); + } + + }); + + $def(self, '$__id__', function $$__id__() { + var self = this; + + return (self * 2) + 1; + }); + + $def(self, '$+', function $Number_$plus$1(other) { + var self = this; + + + if (other.$$is_number) { + return self + other; + } + else { + return self.$__coerced__("+", other); + } + + }); + + $def(self, '$-', function $Number_$minus$2(other) { + var self = this; + + + if (other.$$is_number) { + return self - other; + } + else { + return self.$__coerced__("-", other); + } + + }); + + $def(self, '$*', function $Number_$$3(other) { + var self = this; + + + if (other.$$is_number) { + return self * other; + } + else { + return self.$__coerced__("*", other); + } + + }); + + $def(self, '$/', function $Number_$slash$4(other) { + var self = this; + + + if (other.$$is_number) { + return self / other; + } + else { + return self.$__coerced__("/", other); + } + + }); + + $def(self, '$%', function $Number_$percent$5(other) { + var self = this; + + + if (other.$$is_number) { + if (other == -Infinity) { + return other; + } + else if (other == 0) { + $Kernel.$raise($$$('ZeroDivisionError'), "divided by 0"); + } + else if (other < 0 || self < 0) { + return (self % other + other) % other; + } + else { + return self % other; + } + } + else { + return self.$__coerced__("%", other); + } + + }); + + $def(self, '$&', function $Number_$$6(other) { + var self = this; + + + if (other.$$is_number) { + return self & other; + } + else { + return self.$__coerced__("&", other); + } + + }); + + $def(self, '$|', function $Number_$$7(other) { + var self = this; + + + if (other.$$is_number) { + return self | other; + } + else { + return self.$__coerced__("|", other); + } + + }); + + $def(self, '$^', function $Number_$$8(other) { + var self = this; + + + if (other.$$is_number) { + return self ^ other; + } + else { + return self.$__coerced__("^", other); + } + + }); + + $def(self, '$<', function $Number_$lt$9(other) { + var self = this; + + + if (other.$$is_number) { + return self < other; + } + else { + return self.$__coerced__("<", other); + } + + }); + + $def(self, '$<=', function $Number_$lt_eq$10(other) { + var self = this; + + + if (other.$$is_number) { + return self <= other; + } + else { + return self.$__coerced__("<=", other); + } + + }); + + $def(self, '$>', function $Number_$gt$11(other) { + var self = this; + + + if (other.$$is_number) { + return self > other; + } + else { + return self.$__coerced__(">", other); + } + + }); + + $def(self, '$>=', function $Number_$gt_eq$12(other) { + var self = this; + + + if (other.$$is_number) { + return self >= other; + } + else { + return self.$__coerced__(">=", other); + } + + }); + + var spaceship_operator = function(self, other) { + if (other.$$is_number) { + if (isNaN(self) || isNaN(other)) { + return nil; + } + + if (self > other) { + return 1; + } else if (self < other) { + return -1; + } else { + return 0; + } + } + else { + return self.$__coerced__("<=>", other); + } + } + ; + + $def(self, '$<=>', function $Number_$lt_eq_gt$13(other) { + var self = this; + + try { + return spaceship_operator(self, other); + } catch ($err) { + if (Opal.rescue($err, [$$$('ArgumentError')])) { + try { + return nil + } finally { Opal.pop_exception(); } + } else { throw $err; } + } + }); + + $def(self, '$<<', function $Number_$lt$lt$14(count) { + var self = this; + + + count = $Opal['$coerce_to!'](count, $$$('Integer'), "to_int"); + return count > 0 ? self << count : self >> -count; + }); + + $def(self, '$>>', function $Number_$gt$gt$15(count) { + var self = this; + + + count = $Opal['$coerce_to!'](count, $$$('Integer'), "to_int"); + return count > 0 ? self >> count : self << -count; + }); + + $def(self, '$[]', function $Number_$$$16(bit) { + var self = this; + + + bit = $Opal['$coerce_to!'](bit, $$$('Integer'), "to_int"); + + if (bit < 0) { + return 0; + } + if (bit >= 32) { + return self < 0 ? 1 : 0; + } + return (self >> bit) & 1; + }); + + $def(self, '$+@', function $Number_$plus$$17() { + var self = this; + + return +self; + }); + + $def(self, '$-@', function $Number_$minus$$18() { + var self = this; + + return -self; + }); + + $def(self, '$~', function $Number_$$19() { + var self = this; + + return ~self; + }); + + $def(self, '$**', function $Number_$$$20(other) { + var self = this; + + if ($eqeqeq($$$('Integer'), other)) { + if (($not($$$('Integer')['$==='](self)) || ($truthy($rb_gt(other, 0))))) { + return Math.pow(self, other); + } else { + return $$$('Rational').$new(self, 1)['$**'](other) + } + } else if (($rb_lt(self, 0) && (($eqeqeq($$$('Float'), other) || ($eqeqeq($$$('Rational'), other)))))) { + return $$$('Complex').$new(self, 0)['$**'](other.$to_f()) + } else if ($truthy(other.$$is_number != null)) { + return Math.pow(self, other); + } else { + return self.$__coerced__("**", other) + } + }); + + $def(self, '$==', function $Number_$eq_eq$21(other) { + var self = this; + + + if (other.$$is_number) { + return self.valueOf() === other.valueOf(); + } + else if (other['$respond_to?']("==")) { + return other['$=='](self); + } + else { + return false; + } + + }); + $alias(self, "===", "=="); + + $def(self, '$abs', function $$abs() { + var self = this; + + return Math.abs(self); + }); + + $def(self, '$abs2', function $$abs2() { + var self = this; + + return Math.abs(self * self); + }); + + $def(self, '$allbits?', function $Number_allbits$ques$22(mask) { + var self = this; + + + mask = $Opal['$coerce_to!'](mask, $$$('Integer'), "to_int"); + return (self & mask) == mask; }); + + $def(self, '$anybits?', function $Number_anybits$ques$23(mask) { + var self = this; + + + mask = $Opal['$coerce_to!'](mask, $$$('Integer'), "to_int"); + return (self & mask) !== 0; }); + + $def(self, '$angle', function $$angle() { + var self = this; + + + if ($truthy(self['$nan?']())) { + return self + } + if (self == 0) { + if (1 / self > 0) { + return 0; + } + else { + return Math.PI; + } + } + else if (self < 0) { + return Math.PI; + } + else { + return 0; + } + }); + + $def(self, '$bit_length', function $$bit_length() { + var self = this; + + + if (!$eqeqeq($$$('Integer'), self)) { + $Kernel.$raise($$$('NoMethodError').$new("undefined method `bit_length` for " + (self) + ":Float", "bit_length")); + } + if (self === 0 || self === -1) { + return 0; + } + + var result = 0, + value = self < 0 ? ~self : self; + + while (value != 0) { + result += 1; + value >>>= 1; + } + + return result; + }); + + $def(self, '$ceil', function $$ceil(ndigits) { + var self = this; + + + if (ndigits == null) ndigits = 0; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.ceil(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + }, -1); + + $def(self, '$chr', function $$chr(encoding) { + var self = this; + return Opal.enc(String.fromCharCode(self), encoding || "BINARY"); }, -1); + + $def(self, '$denominator', function $$denominator() { + var $yield = $$denominator.$$p || nil, self = this; + + $$denominator.$$p = null; + if (($truthy(self['$nan?']()) || ($truthy(self['$infinite?']())))) { + return 1 + } else { + return $send2(self, $find_super(self, 'denominator', $$denominator, false, true), 'denominator', [], $yield) + } + }); + + $def(self, '$downto', function $$downto(stop) { + var block = $$downto.$$p || nil, self = this; + + $$downto.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["downto", stop], function $$24(){var self = $$24.$$s == null ? this : $$24.$$s; + + + if (!$eqeqeq($$$('Numeric'), stop)) { + $Kernel.$raise($$$('ArgumentError'), "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed"); + } if ($truthy($rb_gt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(self, stop), 1) + }}, {$$s: self}) + } + if (!stop.$$is_number) { + $Kernel.$raise($$$('ArgumentError'), "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed"); + } + for (var i = self; i >= stop; i--) { + block(i); + } + return self; + }); + + $def(self, '$equal?', function $Number_equal$ques$25(other) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self['$=='](other)))) { + return $ret_or_1 + } else { + return isNaN(self) && isNaN(other); + } + }); + + $def(self, '$even?', function $Number_even$ques$26() { + var self = this; + + return self % 2 === 0; + }); + + $def(self, '$floor', function $$floor(ndigits) { + var self = this; + + + if (ndigits == null) ndigits = 0; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.floor(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + }, -1); + + $def(self, '$gcd', function $$gcd(other) { + var self = this; + + + if (!$eqeqeq($$$('Integer'), other)) { + $Kernel.$raise($$$('TypeError'), "not an integer"); + } + var min = Math.abs(self), + max = Math.abs(other); + + while (min > 0) { + var tmp = min; + + min = max % min; + max = tmp; + } + + return max; + }); + + $def(self, '$gcdlcm', function $$gcdlcm(other) { + var self = this; + + return [self.$gcd(other), self.$lcm(other)] + }); + + $def(self, '$integer?', function $Number_integer$ques$27() { + var self = this; + + return self % 1 === 0; + }); + + $def(self, '$is_a?', function $Number_is_a$ques$28(klass) { + var $yield = $Number_is_a$ques$28.$$p || nil, self = this; + + $Number_is_a$ques$28.$$p = null; + + if (($eqeq(klass, $$$('Integer')) && ($eqeqeq($$$('Integer'), self)))) { + return true + } if (($eqeq(klass, $$$('Integer')) && ($eqeqeq($$$('Integer'), self)))) { + return true + } if (($eqeq(klass, $$$('Float')) && ($eqeqeq($$$('Float'), self)))) { + return true + } return $send2(self, $find_super(self, 'is_a?', $Number_is_a$ques$28, false, true), 'is_a?', [klass], $yield); + }); + + $def(self, '$instance_of?', function $Number_instance_of$ques$29(klass) { + var $yield = $Number_instance_of$ques$29.$$p || nil, self = this; + + $Number_instance_of$ques$29.$$p = null; + + if (($eqeq(klass, $$$('Integer')) && ($eqeqeq($$$('Integer'), self)))) { + return true + } if (($eqeq(klass, $$$('Integer')) && ($eqeqeq($$$('Integer'), self)))) { + return true + } if (($eqeq(klass, $$$('Float')) && ($eqeqeq($$$('Float'), self)))) { + return true + } return $send2(self, $find_super(self, 'instance_of?', $Number_instance_of$ques$29, false, true), 'instance_of?', [klass], $yield); + }); + + $def(self, '$lcm', function $$lcm(other) { + var self = this; + + + if (!$eqeqeq($$$('Integer'), other)) { + $Kernel.$raise($$$('TypeError'), "not an integer"); + } + if (self == 0 || other == 0) { + return 0; + } + else { + return Math.abs(self * other / self.$gcd(other)); + } + }); + + $def(self, '$next', function $$next() { + var self = this; + + return self + 1; + }); + + $def(self, '$nobits?', function $Number_nobits$ques$30(mask) { + var self = this; + + + mask = $Opal['$coerce_to!'](mask, $$$('Integer'), "to_int"); + return (self & mask) == 0; }); + + $def(self, '$nonzero?', function $Number_nonzero$ques$31() { + var self = this; + + return self == 0 ? nil : self; + }); + + $def(self, '$numerator', function $$numerator() { + var $yield = $$numerator.$$p || nil, self = this; + + $$numerator.$$p = null; + if (($truthy(self['$nan?']()) || ($truthy(self['$infinite?']())))) { + return self + } else { + return $send2(self, $find_super(self, 'numerator', $$numerator, false, true), 'numerator', [], $yield) + } + }); + + $def(self, '$odd?', function $Number_odd$ques$32() { + var self = this; + + return self % 2 !== 0; + }); + + $def(self, '$ord', $return_self); + + $def(self, '$pow', function $$pow(b, m) { + var self = this; + + if (self == 0) { + $Kernel.$raise($$$('ZeroDivisionError'), "divided by 0"); + } + + if (m === undefined) { + return self['$**'](b); + } else { + if (!($$$('Integer')['$==='](b))) { + $Kernel.$raise($$$('TypeError'), "Integer#pow() 2nd argument not allowed unless a 1st argument is integer"); + } + + if (b < 0) { + $Kernel.$raise($$$('TypeError'), "Integer#pow() 1st argument cannot be negative when 2nd argument specified"); + } + + if (!($$$('Integer')['$==='](m))) { + $Kernel.$raise($$$('TypeError'), "Integer#pow() 2nd argument not allowed unless all arguments are integers"); + } + + if (m === 0) { + $Kernel.$raise($$$('ZeroDivisionError'), "divided by 0"); + } + + return self['$**'](b)['$%'](m) + } + }, -2); + + $def(self, '$pred', function $$pred() { + var self = this; + + return self - 1; + }); + + $def(self, '$quo', function $$quo(other) { + var $yield = $$quo.$$p || nil, self = this; + + $$quo.$$p = null; + if ($eqeqeq($$$('Integer'), self)) { + return $send2(self, $find_super(self, 'quo', $$quo, false, true), 'quo', [other], $yield) + } else { + return $rb_divide(self, other) + } + }); + + $def(self, '$rationalize', function $$rationalize(eps) { + var $a, $b, self = this, f = nil, n = nil; + + if (arguments.length > 1) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + if ($eqeqeq($$$('Integer'), self)) { + return $$$('Rational').$new(self, 1) + } else if ($truthy(self['$infinite?']())) { + return $Kernel.$raise($$$('FloatDomainError'), "Infinity") + } else if ($truthy(self['$nan?']())) { + return $Kernel.$raise($$$('FloatDomainError'), "NaN") + } else if ($truthy(eps == null)) { + + $b = $$$('Math').$frexp(self), $a = $to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (n = ($a[1] == null ? nil : $a[1])); + f = $$$('Math').$ldexp(f, $$$($$$('Float'), 'MANT_DIG')).$to_i(); + n = $rb_minus(n, $$$($$$('Float'), 'MANT_DIG')); + return $$$('Rational').$new($rb_times(2, f), (1)['$<<']($rb_minus(1, n))).$rationalize($$$('Rational').$new(1, (1)['$<<']($rb_minus(1, n)))); + } else { + return self.$to_r().$rationalize(eps) + } }, -1); + + $def(self, '$remainder', function $$remainder(y) { + var self = this; + + return $rb_minus(self, $rb_times(y, $rb_divide(self, y).$truncate())) + }); + + $def(self, '$round', function $$round(ndigits) { + var $a, $b, self = this, exp = nil; + if ($eqeqeq($$$('Integer'), self)) { + + if ($truthy(ndigits == null)) { + return self + } if (($eqeqeq($$$('Float'), ndigits) && ($truthy(ndigits['$infinite?']())))) { + $Kernel.$raise($$$('RangeError'), "Infinity"); + } ndigits = $Opal['$coerce_to!'](ndigits, $$$('Integer'), "to_int"); + if ($truthy($rb_lt(ndigits, $$$($$$('Integer'), 'MIN')))) { + $Kernel.$raise($$$('RangeError'), "out of bounds"); + } if ($truthy(ndigits >= 0)) { + return self + } ndigits = ndigits['$-@'](); + + if (0.415241 * ndigits - 0.125 > self.$size()) { + return 0; + } + + var f = Math.pow(10, ndigits), + x = Math.floor((Math.abs(self) + f / 2) / f) * f; + + return self < 0 ? -x : x; + } else { + + if (($truthy(self['$nan?']()) && ($truthy(ndigits == null)))) { + $Kernel.$raise($$$('FloatDomainError'), "NaN"); + } ndigits = $Opal['$coerce_to!'](ndigits || 0, $$$('Integer'), "to_int"); + if ($truthy($rb_le(ndigits, 0))) { + if ($truthy(self['$nan?']())) { + $Kernel.$raise($$$('RangeError'), "NaN"); + } else if ($truthy(self['$infinite?']())) { + $Kernel.$raise($$$('FloatDomainError'), "Infinity"); + } + } else if ($eqeq(ndigits, 0)) { + return Math.round(self) + } else if (($truthy(self['$nan?']()) || ($truthy(self['$infinite?']())))) { + return self + } $b = $$$('Math').$frexp(self), $a = $to_ary($b), (($a[0] == null ? nil : $a[0])), (exp = ($a[1] == null ? nil : $a[1])); + if ($truthy($rb_ge(ndigits, $rb_minus($rb_plus($$$($$$('Float'), 'DIG'), 2), ($truthy($rb_gt(exp, 0)) ? ($rb_divide(exp, 4)) : ($rb_minus($rb_divide(exp, 3), 1))))))) { + return self + } if ($truthy($rb_lt(ndigits, ($truthy($rb_gt(exp, 0)) ? ($rb_plus($rb_divide(exp, 3), 1)) : ($rb_divide(exp, 4)))['$-@']()))) { + return 0 + } return Math.round(self * Math.pow(10, ndigits)) / Math.pow(10, ndigits); } }, -1); + + $def(self, '$times', function $$times() { + var block = $$times.$$p || nil, self = this; + + $$times.$$p = null; + if (!$truthy(block)) { + return $send(self, 'enum_for', ["times"], function $$33(){var self = $$33.$$s == null ? this : $$33.$$s; + + return self}, {$$s: self}) + } + for (var i = 0; i < self; i++) { + block(i); + } + return self; + }); + + $def(self, '$to_f', $return_self); + + $def(self, '$to_i', function $$to_i() { + var self = this; + + return self < 0 ? Math.ceil(self) : Math.floor(self); + }); + + $def(self, '$to_r', function $$to_r() { + var $a, $b, self = this, f = nil, e = nil; + + if ($eqeqeq($$$('Integer'), self)) { + return $$$('Rational').$new(self, 1) + } else { + + $b = $$$('Math').$frexp(self), $a = $to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (e = ($a[1] == null ? nil : $a[1])); + f = $$$('Math').$ldexp(f, $$$($$$('Float'), 'MANT_DIG')).$to_i(); + e = $rb_minus(e, $$$($$$('Float'), 'MANT_DIG')); + return $rb_times(f, $$$($$$('Float'), 'RADIX')['$**'](e)).$to_r(); + } + }); + + $def(self, '$to_s', function $$to_s(base) { + var self = this; + + + if (base == null) base = 10; + base = $Opal['$coerce_to!'](base, $$$('Integer'), "to_int"); + if (($truthy($rb_lt(base, 2)) || ($truthy($rb_gt(base, 36))))) { + $Kernel.$raise($$$('ArgumentError'), "invalid radix " + (base)); + } if (($eqeq(self, 0) && ($truthy(1/self === -Infinity)))) { + return "-0.0" + } return self.toString(base); }, -1); + + $def(self, '$truncate', function $$truncate(ndigits) { + var self = this; + + + if (ndigits == null) ndigits = 0; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = parseInt(f * factor, 10) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + }, -1); + + $def(self, '$digits', function $$digits(base) { + var self = this; + + + if (base == null) base = 10; + if ($rb_lt(self, 0)) { + $Kernel.$raise($$$($$$('Math'), 'DomainError'), "out of domain"); + } base = $Opal['$coerce_to!'](base, $$$('Integer'), "to_int"); + if ($truthy($rb_lt(base, 2))) { + $Kernel.$raise($$$('ArgumentError'), "invalid radix " + (base)); + } + if (self != parseInt(self)) $Kernel.$raise($$$('NoMethodError'), "undefined method `digits' for " + (self.$inspect())); + + var value = self, result = []; + + if (self == 0) { + return [0]; + } + + while (value != 0) { + result.push(value % base); + value = parseInt(value / base, 10); + } + + return result; + }, -1); + + $def(self, '$divmod', function $$divmod(other) { + var $yield = $$divmod.$$p || nil, self = this; + + $$divmod.$$p = null; + if (($truthy(self['$nan?']()) || ($truthy(other['$nan?']())))) { + return $Kernel.$raise($$$('FloatDomainError'), "NaN") + } else if ($truthy(self['$infinite?']())) { + return $Kernel.$raise($$$('FloatDomainError'), "Infinity") + } else { + return $send2(self, $find_super(self, 'divmod', $$divmod, false, true), 'divmod', [other], $yield) + } + }); + + $def(self, '$upto', function $$upto(stop) { + var block = $$upto.$$p || nil, self = this; + + $$upto.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["upto", stop], function $$34(){var self = $$34.$$s == null ? this : $$34.$$s; + + + if (!$eqeqeq($$$('Numeric'), stop)) { + $Kernel.$raise($$$('ArgumentError'), "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed"); + } if ($truthy($rb_lt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(stop, self), 1) + }}, {$$s: self}) + } + if (!stop.$$is_number) { + $Kernel.$raise($$$('ArgumentError'), "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed"); + } + for (var i = self; i <= stop; i++) { + block(i); + } + return self; + }); + + $def(self, '$zero?', function $Number_zero$ques$35() { + var self = this; + + return self == 0; + }); + + $def(self, '$size', $return_val(4)); + + $def(self, '$nan?', function $Number_nan$ques$36() { + var self = this; + + return isNaN(self); + }); + + $def(self, '$finite?', function $Number_finite$ques$37() { + var self = this; + + return self != Infinity && self != -Infinity && !isNaN(self); + }); + + $def(self, '$infinite?', function $Number_infinite$ques$38() { + var self = this; + + + if (self == Infinity) { + return +1; + } + else if (self == -Infinity) { + return -1; + } + else { + return nil; + } + + }); + + $def(self, '$positive?', function $Number_positive$ques$39() { + var self = this; + + return self != 0 && (self == Infinity || 1 / self > 0); + }); + + $def(self, '$negative?', function $Number_negative$ques$40() { + var self = this; + + return self == -Infinity || 1 / self < 0; + }); + + function numberToUint8Array(num) { + var uint8array = new Uint8Array(8); + new DataView(uint8array.buffer).setFloat64(0, num, true); + return uint8array; + } + + function uint8ArrayToNumber(arr) { + return new DataView(arr.buffer).getFloat64(0, true); + } + + function incrementNumberBit(num) { + var arr = numberToUint8Array(num); + for (var i = 0; i < arr.length; i++) { + if (arr[i] === 0xff) { + arr[i] = 0; + } else { + arr[i]++; + break; + } + } + return uint8ArrayToNumber(arr); + } + + function decrementNumberBit(num) { + var arr = numberToUint8Array(num); + for (var i = 0; i < arr.length; i++) { + if (arr[i] === 0) { + arr[i] = 0xff; + } else { + arr[i]--; + break; + } + } + return uint8ArrayToNumber(arr); + } + + $def(self, '$next_float', function $$next_float() { + var self = this; + + + if ($eqeq(self, $$$($$$('Float'), 'INFINITY'))) { + return $$$($$$('Float'), 'INFINITY') + } if ($truthy(self['$nan?']())) { + return $$$($$$('Float'), 'NAN') + } if ($rb_ge(self, 0)) { + return incrementNumberBit(Math.abs(self)); + } else { + return decrementNumberBit(self); + } }); + + $def(self, '$prev_float', function $$prev_float() { + var self = this; + + + if ($eqeq(self, $$$($$$('Float'), 'INFINITY')['$-@']())) { + return $$$($$$('Float'), 'INFINITY')['$-@']() + } if ($truthy(self['$nan?']())) { + return $$$($$$('Float'), 'NAN') + } if ($rb_gt(self, 0)) { + return decrementNumberBit(self); + } else { + return -incrementNumberBit(Math.abs(self)); + } }); + $alias(self, "arg", "angle"); + $alias(self, "eql?", "=="); + $alias(self, "fdiv", "/"); + $alias(self, "inspect", "to_s"); + $alias(self, "kind_of?", "is_a?"); + $alias(self, "magnitude", "abs"); + $alias(self, "modulo", "%"); + $alias(self, "object_id", "__id__"); + $alias(self, "phase", "angle"); + $alias(self, "succ", "next"); + return $alias(self, "to_int", "to_i"); + })('::', $$$('Numeric')); + $const_set('::', 'Fixnum', $$$('Number')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Integer'); + + var $nesting = [self].concat($parent_nesting); + + + self.$$is_number_class = true; + self.$$is_integer_class = true; + (function(self, $parent_nesting) { + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$allocate', function $$allocate() { + var self = this; + + return $Kernel.$raise($$$('TypeError'), "allocator undefined for " + (self.$name())) + }); + + Opal.udef(self, '$' + "new"); + $def(self, '$sqrt', function $$sqrt(n) { + + + n = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + + if (n < 0) { + $Kernel.$raise($$$($$$('Math'), 'DomainError'), "Numerical argument is out of domain - \"isqrt\""); + } + + return parseInt(Math.sqrt(n), 10); + }); + return $def(self, '$try_convert', function $$try_convert(object) { + var self = this; + + return $$('Opal')['$coerce_to?'](object, self, "to_int") + }); + })(Opal.get_singleton_class(self), $nesting); + $const_set(self, 'MAX', Math.pow(2, 30) - 1); + return $const_set(self, 'MIN', -Math.pow(2, 30)); + })('::', $$$('Numeric'), $nesting); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Float'); + + + self.$$is_number_class = true; + (function(self, $parent_nesting) { + + + + $def(self, '$allocate', function $$allocate() { + var self = this; + + return $Kernel.$raise($$$('TypeError'), "allocator undefined for " + (self.$name())) + }); + + Opal.udef(self, '$' + "new"); return $def(self, '$===', function $eq_eq_eq$41(other) { + + return !!other.$$is_number; + }); + })(Opal.get_singleton_class(self)); + $const_set(self, 'INFINITY', Infinity); + $const_set(self, 'MAX', Number.MAX_VALUE); + $const_set(self, 'MIN', Number.MIN_VALUE); + $const_set(self, 'NAN', NaN); + $const_set(self, 'DIG', 15); + $const_set(self, 'MANT_DIG', 53); + $const_set(self, 'RADIX', 2); + return $const_set(self, 'EPSILON', Number.EPSILON || 2.2204460492503130808472633361816E-16); + })('::', $$$('Numeric')); + }; + + Opal.modules["corelib/range"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $truthy = Opal.truthy, $Kernel = Opal.Kernel, $def = Opal.def, $not = Opal.not, $send2 = Opal.send2, $find_super = Opal.find_super, $rb_lt = Opal.rb_lt, $rb_le = Opal.rb_le, $send = Opal.send, $eqeq = Opal.eqeq, $eqeqeq = Opal.eqeqeq, $return_ivar = Opal.return_ivar, $rb_gt = Opal.rb_gt, $rb_minus = Opal.rb_minus, $Opal = Opal.Opal, $rb_divide = Opal.rb_divide, $rb_plus = Opal.rb_plus, $rb_times = Opal.rb_times, $rb_ge = Opal.rb_ge, $thrower = Opal.thrower, $alias = Opal.alias, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,include,attr_reader,raise,nil?,<=>,include?,!,<,<=,enum_for,size,upto,to_proc,respond_to?,class,succ,==,===,exclude_end?,eql?,begin,end,last,to_a,>,-@,-,to_i,coerce_to!,ceil,/,is_a?,new,loop,+,*,>=,each_with_index,%,step,bsearch,inspect,[],hash,cover?'); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Range'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.begin = $proto.end = $proto.excl = nil; + + self.$include($$$('Enumerable')); + self.$$prototype.$$is_range = true; + self.$attr_reader("begin", "end"); + + $def(self, '$initialize', function $$initialize(first, last, exclude) { + var self = this; + + + if (exclude == null) exclude = false; + if ($truthy(self.begin)) { + $Kernel.$raise($$$('NameError'), "'initialize' called twice"); + } if (!(($truthy(first['$<=>'](last)) || ($truthy(first['$nil?']()))) || ($truthy(last['$nil?']())))) { + $Kernel.$raise($$$('ArgumentError'), "bad value for range"); + } self.begin = first; + self.end = last; + return (self.excl = exclude); + }, -3); + + $def(self, '$===', function $Range_$eq_eq_eq$1(value) { + var self = this; + + return self['$include?'](value) + }); + + function is_infinite(self) { + if (self.begin === nil || self.end === nil || + self.begin === -Infinity || self.end === Infinity || + self.begin === Infinity || self.end === -Infinity) return true; + return false; + } + + $def(self, '$count', function $$count() { + var block = $$count.$$p || nil, self = this; + + $$count.$$p = null; + if (($not((block !== nil)) && ($truthy(is_infinite(self))))) { + return $$$($$$('Float'), 'INFINITY') + } return $send2(self, $find_super(self, 'count', $$count, false, true), 'count', [], block); + }); + + $def(self, '$to_a', function $$to_a() { + var $yield = $$to_a.$$p || nil, self = this; + + $$to_a.$$p = null; + + if ($truthy(is_infinite(self))) { + $Kernel.$raise($$$('TypeError'), "cannot convert endless range to an array"); + } return $send2(self, $find_super(self, 'to_a', $$to_a, false, true), 'to_a', [], $yield); + }); + + $def(self, '$cover?', function $Range_cover$ques$2(value) { + var self = this, beg_cmp = nil, $ret_or_1 = nil, $ret_or_2 = nil, $ret_or_3 = nil, end_cmp = nil; + + + beg_cmp = ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = self.begin['$nil?']())) ? (-1) : ($ret_or_3)))) ? ($ret_or_2) : (self.begin['$<=>'](value))))) && ($ret_or_1)); + end_cmp = ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = self.end['$nil?']())) ? (-1) : ($ret_or_3)))) ? ($ret_or_2) : (value['$<=>'](self.end))))) && ($ret_or_1)); + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ($truthy(self.excl) ? (($truthy(($ret_or_3 = end_cmp)) ? ($rb_lt(end_cmp, 0)) : ($ret_or_3))) : ($truthy(($ret_or_3 = end_cmp)) ? ($rb_le(end_cmp, 0)) : ($ret_or_3))))) ? (beg_cmp) : ($ret_or_2))))) { + return $rb_le(beg_cmp, 0) + } else { + return $ret_or_1 + } }); + + $def(self, '$each', function $$each() { + var block = $$each.$$p || nil, self = this, current = nil, last = nil, $ret_or_1 = nil; + + $$each.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["each"], function $$3(){var self = $$3.$$s == null ? this : $$3.$$s; + + return self.$size()}, {$$s: self}) + } + var i, limit; + + if (self.begin.$$is_number && self.end.$$is_number) { + if (self.begin % 1 !== 0 || self.end % 1 !== 0) { + $Kernel.$raise($$$('TypeError'), "can't iterate from Float"); + } + + for (i = self.begin, limit = self.end + ($truthy(self.excl) ? (0) : (1)); i < limit; i++) { + block(i); + } + + return self; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + $send(self.begin, 'upto', [self.end, self.excl], block.$to_proc()); + return self; + } + current = self.begin; + last = self.end; + if (!$truthy(current['$respond_to?']("succ"))) { + $Kernel.$raise($$$('TypeError'), "can't iterate from " + (current.$class())); + } while ($truthy(($truthy(($ret_or_1 = self.end['$nil?']())) ? ($ret_or_1) : ($rb_lt(current['$<=>'](last), 0))))) { + + Opal.yield1(block, current); + current = current.$succ(); + } if (($not(self.excl) && ($eqeq(current, last)))) { + Opal.yield1(block, current); + } return self; + }); + + $def(self, '$eql?', function $Range_eql$ques$4(other) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + + if (!$eqeqeq($$$('Range'), other)) { + return false + } if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = self.excl['$==='](other['$exclude_end?']()))) ? (self.begin['$eql?'](other.$begin())) : ($ret_or_2))))) { + return self.end['$eql?'](other.$end()) + } else { + return $ret_or_1 + } }); + + $def(self, '$exclude_end?', $return_ivar("excl")); + + $def(self, '$first', function $$first(n) { + var $yield = $$first.$$p || nil, self = this; + + $$first.$$p = null; + if ($truthy(self.begin['$nil?']())) { + $Kernel.$raise($$$('RangeError'), "cannot get the minimum of beginless range"); + } if ($truthy(n == null)) { + return self.begin + } return $send2(self, $find_super(self, 'first', $$first, false, true), 'first', [n], $yield); + }, -1); + + $def(self, '$last', function $$last(n) { + var self = this; + if ($truthy(self.end['$nil?']())) { + $Kernel.$raise($$$('RangeError'), "cannot get the maximum of endless range"); + } if ($truthy(n == null)) { + return self.end + } return self.$to_a().$last(n); + }, -1); + + $def(self, '$max', function $$max() { + var $yield = $$max.$$p || nil, self = this; + + $$max.$$p = null; + if ($truthy(self.end['$nil?']())) { + return $Kernel.$raise($$$('RangeError'), "cannot get the maximum of endless range") + } else if (($yield !== nil)) { + return $send2(self, $find_super(self, 'max', $$max, false, true), 'max', [], $yield) + } else if (($not(self.begin['$nil?']()) && (($truthy($rb_gt(self.begin, self.end)) || (($truthy(self.excl) && ($eqeq(self.begin, self.end)))))))) { + return nil + } else { + return self.excl ? self.end - 1 : self.end + } + }); + + $def(self, '$min', function $$min() { + var $yield = $$min.$$p || nil, self = this; + + $$min.$$p = null; + if ($truthy(self.begin['$nil?']())) { + return $Kernel.$raise($$$('RangeError'), "cannot get the minimum of beginless range") + } else if (($yield !== nil)) { + return $send2(self, $find_super(self, 'min', $$min, false, true), 'min', [], $yield) + } else if (($not(self.end['$nil?']()) && (($truthy($rb_gt(self.begin, self.end)) || (($truthy(self.excl) && ($eqeq(self.begin, self.end)))))))) { + return nil + } else { + return self.begin + } + }); + + $def(self, '$size', function $$size() { + var self = this, infinity = nil, range_begin = nil, range_end = nil; + + + infinity = $$$($$$('Float'), 'INFINITY'); + if ((($eqeq(self.begin, infinity) && ($not(self.end['$nil?']()))) || (($eqeq(self.end, infinity['$-@']()) && ($not(self.begin['$nil?']())))))) { + return 0 + } if ($truthy(is_infinite(self))) { + return infinity + } if (!($eqeqeq($$$('Numeric'), self.begin) && ($eqeqeq($$$('Numeric'), self.end)))) { + return nil + } range_begin = self.begin; + range_end = self.end; + if ($truthy(self.excl)) { + range_end = $rb_minus(range_end, 1); + } if ($truthy($rb_lt(range_end, range_begin))) { + return 0 + } return (Math.abs(range_end - range_begin) + 1).$to_i(); + }); + + $def(self, '$step', function $$step(n) { + var $yield = $$step.$$p || nil, self = this, $ret_or_1 = nil, i = nil; + + $$step.$$p = null; + + function coerceStepSize() { + if (n == null) { + n = 1; + } + else if (!n.$$is_number) { + n = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + } + + if (n < 0) { + $Kernel.$raise($$$('ArgumentError'), "step can't be negative"); + } else if (n === 0) { + $Kernel.$raise($$$('ArgumentError'), "step can't be 0"); + } + } + + function enumeratorSize() { + if (!self.begin['$respond_to?']("succ")) { + return nil; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + return nil; + } + + if (n % 1 === 0) { + return $rb_divide(self.$size(), n).$ceil(); + } else { + // n is a float + var begin = self.begin, end = self.end, + abs = Math.abs, floor = Math.floor, + err = (abs(begin) + abs(end) + abs(end - begin)) / abs(n) * $$$($$$('Float'), 'EPSILON'), + size; + + if (err > 0.5) { + err = 0.5; + } + + if (self.excl) { + size = floor((end - begin) / n - err); + if (size * n + begin < end) { + size++; + } + } else { + size = floor((end - begin) / n + err) + 1; + } + + return size; + } + } + if (!($yield !== nil)) { + if (((($truthy(self.begin['$is_a?']($$('Numeric'))) || ($truthy(self.begin['$nil?']()))) && (($truthy(self.end['$is_a?']($$('Numeric'))) || ($truthy(self.end['$nil?']()))))) && ($not(($truthy(($ret_or_1 = self.begin['$nil?']())) ? (self.end['$nil?']()) : ($ret_or_1)))))) { + return $$$($$$('Enumerator'), 'ArithmeticSequence').$new(self, n, "step") + } else { + return $send(self, 'enum_for', ["step", n], function $$5(){ + + coerceStepSize(); + return enumeratorSize(); + }) + } + } coerceStepSize(); + if ($truthy(self.begin.$$is_number && self.end.$$is_number)) { + + i = 0; + (function(){try { var $t_break = $thrower('break'); return $send(self, 'loop', [], function $$6(){var self = $$6.$$s == null ? this : $$6.$$s, current = nil; + if (self.begin == null) self.begin = nil; + if (self.excl == null) self.excl = nil; + if (self.end == null) self.end = nil; + + + current = $rb_plus(self.begin, $rb_times(i, n)); + if ($truthy(self.excl)) { + if ($truthy($rb_ge(current, self.end))) { + $t_break.$throw(); + } + } else if ($truthy($rb_gt(current, self.end))) { + $t_break.$throw(); + }; + Opal.yield1($yield, current); + return (i = $rb_plus(i, 1));}, {$$s: self})} catch($e) { + if ($e === $t_break) return $e.$v; + throw $e; + }})(); + } else { + + + if (self.begin.$$is_string && self.end.$$is_string && n % 1 !== 0) { + $Kernel.$raise($$$('TypeError'), "no implicit conversion to float from string"); + } + $send(self, 'each_with_index', [], function $$7(value, idx){ + + if (value == null) value = nil; + if (idx == null) idx = nil; + if ($eqeq(idx['$%'](n), 0)) { + return Opal.yield1($yield, value); + } else { + return nil + }}); + } return self; + }, -1); + + $def(self, '$%', function $Range_$percent$8(n) { + var self = this; + + if (($truthy(self.begin['$is_a?']($$('Numeric'))) && ($truthy(self.end['$is_a?']($$('Numeric')))))) { + return $$$($$$('Enumerator'), 'ArithmeticSequence').$new(self, n, "%") + } else { + return self.$step(n) + } + }); + + $def(self, '$bsearch', function $$bsearch() { + var block = $$bsearch.$$p || nil, self = this; + + $$bsearch.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("bsearch") + } if ($truthy(is_infinite(self) && (self.begin.$$is_number || self.end.$$is_number))) { + $Kernel.$raise($$$('NotImplementedError'), "Can't #bsearch an infinite range"); + } if (!$truthy(self.begin.$$is_number && self.end.$$is_number)) { + $Kernel.$raise($$$('TypeError'), "can't do binary search for " + (self.begin.$class())); + } return $send(self.$to_a(), 'bsearch', [], block.$to_proc()); + }); + + $def(self, '$to_s', function $$to_s() { + var self = this, $ret_or_1 = nil; + + return "" + (($truthy(($ret_or_1 = self.begin)) ? ($ret_or_1) : (""))) + (($truthy(self.excl) ? ("...") : (".."))) + (($truthy(($ret_or_1 = self.end)) ? ($ret_or_1) : (""))) + }); + + $def(self, '$inspect', function $$inspect() { + var self = this, $ret_or_1 = nil; + + return "" + (($truthy(($ret_or_1 = self.begin)) ? (self.begin.$inspect()) : ($ret_or_1))) + (($truthy(self.excl) ? ("...") : (".."))) + (($truthy(($ret_or_1 = self.end)) ? (self.end.$inspect()) : ($ret_or_1))) + }); + + $def(self, '$marshal_load', function $$marshal_load(args) { + var self = this; + + + self.begin = args['$[]']("begin"); + self.end = args['$[]']("end"); + return (self.excl = args['$[]']("excl")); + }); + + $def(self, '$hash', function $$hash() { + var self = this; + + return [self.begin, self.end, self.excl].$hash() + }); + $alias(self, "==", "eql?"); + $alias(self, "include?", "cover?"); + return $alias(self, "member?", "cover?"); + })('::', null, $nesting); + }; + + Opal.modules["corelib/proc"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $Kernel = Opal.Kernel, $defs = Opal.defs, $def = Opal.def, $send = Opal.send, $to_a = Opal.to_a, $return_self = Opal.return_self, $ensure_kwargs = Opal.ensure_kwargs, $Opal = Opal.Opal, $alias = Opal.alias, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('raise,proc,call,to_proc,new,source_location,coerce_to!,dup'); + return (function($base, $super) { + var self = $klass($base, $super, 'Proc'); + + + + Opal.prop(self.$$prototype, '$$is_proc', true); + Opal.prop(self.$$prototype, '$$is_lambda', false); + $defs(self, '$new', function $Proc_new$1() { + var block = $Proc_new$1.$$p || nil; + + $Proc_new$1.$$p = null; + if (!$truthy(block)) { + $Kernel.$raise($$$('ArgumentError'), "tried to create a Proc object without a block"); + } return block; + }); + + $def(self, '$call', function $$call($a) { + var block = $$call.$$p || nil, $post_args, args, self = this; + + $$call.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + + if (block !== nil) { + self.$$p = block; + } + + var result, $brk = self.$$brk, $ret = self.$$ret; + + if ($brk || ($ret && self.$$is_lambda)) { + try { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } catch (err) { + if (err === $brk) { + return err.$v; + } + else if (self.$$is_lambda && err === $ret) { + return err.$v; + } + else { + throw err; + } + } + } + else { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } + + return result; + }, -1); + + $def(self, '$>>', function $Proc_$gt$gt$2(other) { + $Proc_$gt$gt$2.$$p || nil; var self = this; + + $Proc_$gt$gt$2.$$p = null; + return $send($Kernel, 'proc', [], function $$3($a){var block = $$3.$$p || nil, $post_args, args, self = $$3.$$s == null ? this : $$3.$$s, out = nil; + + $$3.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + out = $send(self, 'call', $to_a(args), block.$to_proc()); + return other.$call(out);}, {$$arity: -1, $$s: self}) + }); + + $def(self, '$<<', function $Proc_$lt$lt$4(other) { + $Proc_$lt$lt$4.$$p || nil; var self = this; + + $Proc_$lt$lt$4.$$p = null; + return $send($Kernel, 'proc', [], function $$5($a){var block = $$5.$$p || nil, $post_args, args, self = $$5.$$s == null ? this : $$5.$$s, out = nil; + + $$5.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + out = $send(other, 'call', $to_a(args), block.$to_proc()); + return self.$call(out);}, {$$arity: -1, $$s: self}) + }); + + $def(self, '$to_proc', $return_self); + + $def(self, '$lambda?', function $Proc_lambda$ques$6() { + var self = this; + + return !!self.$$is_lambda; + }); + + $def(self, '$arity', function $$arity() { + var self = this; + + + if (self.$$is_curried) { + return -1; + } else if (self.$$arity != null) { + return self.$$arity; + } else { + return self.length; + } + + }); + + $def(self, '$source_location', function $$source_location() { + var self = this, $ret_or_1 = nil; + + + if (self.$$is_curried) { return nil; } if ($truthy(($ret_or_1 = self.$$source_location))) { + return $ret_or_1 + } else { + return nil + } }); + + $def(self, '$binding', function $$binding() { + var self = this; + + + if (self.$$is_curried) { $Kernel.$raise($$$('ArgumentError'), "Can't create Binding"); } if ($truthy((($$$('::', 'Binding', 'skip_raise')) ? 'constant' : nil))) { + return $$$('Binding').$new(nil, [], self.$$s, self.$source_location()) + } else { + return nil + } }); + + $def(self, '$parameters', function $$parameters($kwargs) { + var lambda, self = this; + + + $kwargs = $ensure_kwargs($kwargs); + + lambda = $kwargs.$$smap["lambda"]; + if (self.$$is_curried) { + return [["rest"]]; + } else if (self.$$parameters) { + if (lambda == null ? self.$$is_lambda : lambda) { + return self.$$parameters; + } else { + var result = [], i, length; + + for (i = 0, length = self.$$parameters.length; i < length; i++) { + var parameter = self.$$parameters[i]; + + if (parameter[0] === 'req') { + // required arguments always have name + parameter = ['opt', parameter[1]]; + } + + result.push(parameter); + } + + return result; + } + } else { + return []; + } + }, -1); + + $def(self, '$curry', function $$curry(arity) { + var self = this; + + if (arity === undefined) { + arity = self.length; + } + else { + arity = $Opal['$coerce_to!'](arity, $$$('Integer'), "to_int"); + if (self.$$is_lambda && arity !== self.length) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (arity) + " for " + (self.length) + ")"); + } + } + + function curried () { + var args = $slice(arguments), + length = args.length, + result; + + if (length > arity && self.$$is_lambda && !self.$$is_curried) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (length) + " for " + (arity) + ")"); + } + + if (length >= arity) { + return self.$call.apply(self, args); + } + + result = function () { + return curried.apply(null, + args.concat($slice(arguments))); + }; + result.$$is_lambda = self.$$is_lambda; + result.$$is_curried = true; + + return result; + } + curried.$$is_lambda = self.$$is_lambda; + curried.$$is_curried = true; + return curried; + }, -1); + + $def(self, '$dup', function $$dup() { + var self = this; + + + var original_proc = self.$$original_proc || self, + proc = function () { + return original_proc.apply(this, arguments); + }; + + for (var prop in self) { + if (self.hasOwnProperty(prop)) { + proc[prop] = self[prop]; + } + } + + return proc; + + }); + $alias(self, "===", "call"); + $alias(self, "clone", "dup"); + $alias(self, "yield", "call"); + return $alias(self, "[]", "call"); + })('::', Function) + }; + + Opal.modules["corelib/method"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $def = Opal.def, $truthy = Opal.truthy, $slice = Opal.slice, $alias = Opal.alias, $Kernel = Opal.Kernel, $send = Opal.send, $to_a = Opal.to_a, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('attr_reader,arity,curry,>>,<<,new,class,join,source_location,call,raise,bind,to_proc'); + + (function($base, $super) { + var self = $klass($base, $super, 'Method'); + + var $proto = self.$$prototype; + + $proto.method = $proto.receiver = $proto.owner = $proto.name = nil; + + self.$attr_reader("owner", "receiver", "name"); + + $def(self, '$initialize', function $$initialize(receiver, owner, method, name) { + var self = this; + + + self.receiver = receiver; + self.owner = owner; + self.name = name; + return (self.method = method); + }); + + $def(self, '$arity', function $$arity() { + var self = this; + + return self.method.$arity() + }); + + $def(self, '$parameters', function $$parameters() { + var self = this; + + return self.method.$$parameters + }); + + $def(self, '$source_location', function $$source_location() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.method.$$source_location))) { + return $ret_or_1 + } else { + return ["(eval)", 0] + } + }); + + $def(self, '$comments', function $$comments() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.method.$$comments))) { + return $ret_or_1 + } else { + return [] + } + }); + + $def(self, '$call', function $$call($a) { + var block = $$call.$$p || nil, $post_args, args, self = this; + + $$call.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + + self.method.$$p = block; + + return self.method.apply(self.receiver, args); + }, -1); + + $def(self, '$curry', function $$curry(arity) { + var self = this; + return self.method.$curry(arity); + }, -1); + + $def(self, '$>>', function $Method_$gt$gt$1(other) { + var self = this; + + return self.method['$>>'](other) + }); + + $def(self, '$<<', function $Method_$lt$lt$2(other) { + var self = this; + + return self.method['$<<'](other) + }); + + $def(self, '$unbind', function $$unbind() { + var self = this; + + return $$$('UnboundMethod').$new(self.receiver.$class(), self.owner, self.method, self.name) + }); + + $def(self, '$to_proc', function $$to_proc() { + var self = this; + + + var proc = self.$call.bind(self); + proc.$$unbound = self.method; + proc.$$is_lambda = true; + proc.$$arity = self.method.$$arity == null ? self.method.length : self.method.$$arity; + proc.$$parameters = self.method.$$parameters; + return proc; + + }); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + return "#<" + (self.$class()) + ": " + (self.receiver.$class()) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }); + $alias(self, "[]", "call"); + return $alias(self, "===", "call"); + })('::', null); + return (function($base, $super) { + var self = $klass($base, $super, 'UnboundMethod'); + + var $proto = self.$$prototype; + + $proto.method = $proto.owner = $proto.name = $proto.source = nil; + + self.$attr_reader("source", "owner", "name"); + + $def(self, '$initialize', function $$initialize(source, owner, method, name) { + var self = this; + + + self.source = source; + self.owner = owner; + self.method = method; + return (self.name = name); + }); + + $def(self, '$arity', function $$arity() { + var self = this; + + return self.method.$arity() + }); + + $def(self, '$parameters', function $$parameters() { + var self = this; + + return self.method.$$parameters + }); + + $def(self, '$source_location', function $$source_location() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.method.$$source_location))) { + return $ret_or_1 + } else { + return ["(eval)", 0] + } + }); + + $def(self, '$comments', function $$comments() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.method.$$comments))) { + return $ret_or_1 + } else { + return [] + } + }); + + $def(self, '$bind', function $$bind(object) { + var self = this; + + + if (self.owner.$$is_module || Opal.is_a(object, self.owner)) { + return $$$('Method').$new(object, self.owner, self.method, self.name); + } + else { + $Kernel.$raise($$$('TypeError'), "can't bind singleton method to a different class (expected " + (object) + ".kind_of?(" + (self.owner) + " to be true)"); + } + + }); + + $def(self, '$bind_call', function $$bind_call(object, $a) { + var block = $$bind_call.$$p || nil, $post_args, args, self = this; + + $$bind_call.$$p = null; + $post_args = $slice(arguments, 1); + args = $post_args; + return $send(self.$bind(object), 'call', $to_a(args), block.$to_proc()); + }, -2); + return $def(self, '$inspect', function $$inspect() { + var self = this; + + return "#<" + (self.$class()) + ": " + (self.source) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }); + })('::', null); + }; + + Opal.modules["corelib/variables"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $gvars = Opal.gvars, $const_set = Opal.const_set, $Object = Opal.Object, $hash2 = Opal.hash2, nil = Opal.nil; + + Opal.add_stubs('new'); + + $gvars['&'] = $gvars['~'] = $gvars['`'] = $gvars["'"] = nil; + $gvars.LOADED_FEATURES = ($gvars["\""] = Opal.loaded_features); + $gvars.LOAD_PATH = ($gvars[":"] = []); + $gvars["/"] = "\n"; + $gvars[","] = nil; + $const_set('::', 'ARGV', []); + $const_set('::', 'ARGF', $Object.$new()); + $const_set('::', 'ENV', $hash2([], {})); + $gvars.VERBOSE = false; + $gvars.DEBUG = false; + return ($gvars.SAFE = 0); + }; + + Opal.modules["corelib/io"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $const_set = Opal.const_set, $not = Opal.not, $truthy = Opal.truthy, $def = Opal.def, $return_ivar = Opal.return_ivar, $return_val = Opal.return_val, $slice = Opal.slice, $Kernel = Opal.Kernel, $gvars = Opal.gvars, $send = Opal.send, $to_a = Opal.to_a, $rb_plus = Opal.rb_plus, $neqeq = Opal.neqeq, $range = Opal.range, $hash2 = Opal.hash2, $eqeq = Opal.eqeq, $to_ary = Opal.to_ary, $rb_gt = Opal.rb_gt, $assign_ivar_val = Opal.assign_ivar_val, $alias = Opal.alias, $a, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('attr_reader,attr_accessor,!,match?,include?,size,write,String,flatten,puts,sysread_noraise,+,!=,[],ord,getc,readchar,raise,gets,==,to_str,length,split,sub,sysread,>,to_a,each_line,enum_for,getbyte,closed_write?,closed_read?,each,eof,new,write_proc=,read_proc='); + + (function($base, $super) { + var self = $klass($base, $super, 'IO'); + + var $proto = self.$$prototype; + + $proto.read_buffer = $proto.closed = nil; + + $const_set(self, 'SEEK_SET', 0); + $const_set(self, 'SEEK_CUR', 1); + $const_set(self, 'SEEK_END', 2); + $const_set(self, 'SEEK_DATA', 3); + $const_set(self, 'SEEK_HOLE', 4); + $const_set(self, 'READABLE', 1); + $const_set(self, 'WRITABLE', 4); + self.$attr_reader("eof"); + self.$attr_accessor("read_proc", "sync", "tty", "write_proc"); + + $def(self, '$initialize', function $$initialize(fd, flags) { + var self = this; + + + if (flags == null) flags = "r"; + self.fd = fd; + self.flags = flags; + self.eof = false; + if (($truthy(flags['$include?']("r")) && ($not(flags['$match?'](/[wa+]/))))) { + return (self.closed = "write") + } else if (($truthy(flags['$match?'](/[wa]/)) && ($not(flags['$match?'](/[r+]/))))) { + return (self.closed = "read") + } else { + return nil + } }, -2); + + $def(self, '$fileno', $return_ivar("fd")); + + $def(self, '$tty?', function $IO_tty$ques$1() { + var self = this; + + return self.tty == true; + }); + + $def(self, '$write', function $$write(string) { + var self = this; + + + self.write_proc(string); + return string.$size(); + }); + + $def(self, '$flush', $return_val(nil)); + + $def(self, '$<<', function $IO_$lt$lt$2(string) { + var self = this; + + + self.$write(string); + return self; + }); + + $def(self, '$print', function $$print($a) { + var $post_args, args, self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + $post_args = $slice(arguments); + args = $post_args; + + for (var i = 0, ii = args.length; i < ii; i++) { + args[i] = $Kernel.$String(args[i]); + } + self.$write(args.join($gvars[","])); + return nil; + }, -1); + + $def(self, '$puts', function $$puts($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + + var line; + if (args.length === 0) { + self.$write("\n"); + return nil; + } else { + for (var i = 0, ii = args.length; i < ii; i++) { + if (args[i].$$is_array){ + var ary = (args[i]).$flatten(); + if (ary.length > 0) $send(self, 'puts', $to_a((ary))); + } else { + if (args[i].$$is_string) { + line = args[i].valueOf(); + } else { + line = $Kernel.$String(args[i]); + } + if (!line.endsWith("\n")) line += "\n"; + self.$write(line); + } + } + } + return nil; + }, -1); + + $def(self, '$getc', function $$getc() { + var self = this, $ret_or_1 = nil, parts = nil, ret = nil; + + + self.read_buffer = ($truthy(($ret_or_1 = self.read_buffer)) ? ($ret_or_1) : ("")); + parts = ""; + do { + + self.read_buffer = $rb_plus(self.read_buffer, parts); + if ($neqeq(self.read_buffer, "")) { + + ret = self.read_buffer['$[]'](0); + self.read_buffer = self.read_buffer['$[]']($range(1, -1, false)); + return ret; + } } while ($truthy((parts = self.$sysread_noraise(1)))); return nil; + }); + + $def(self, '$getbyte', function $$getbyte() { + var $a, self = this; + + return ($a = self.$getc(), ($a === nil || $a == null) ? nil : $a.$ord()) + }); + + $def(self, '$readbyte', function $$readbyte() { + var self = this; + + return self.$readchar().$ord() + }); + + $def(self, '$readchar', function $$readchar() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.$getc()))) { + return $ret_or_1 + } else { + return $Kernel.$raise($$$('EOFError'), "end of file reached") + } + }); + + $def(self, '$readline', function $$readline($a) { + var $post_args, args, self = this, $ret_or_1 = nil; + + + $post_args = $slice(arguments); + args = $post_args; + if ($truthy(($ret_or_1 = $send(self, 'gets', $to_a(args))))) { + return $ret_or_1 + } else { + return $Kernel.$raise($$$('EOFError'), "end of file reached") + } }, -1); + + $def(self, '$gets', function $$gets(sep, limit, opts) { + var $a, $b, self = this, orig_sep = nil, $ret_or_1 = nil, seplen = nil, data = nil, ret = nil, orig_buffer = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + if (sep == null) sep = false; + if (limit == null) limit = nil; + if (opts == null) opts = $hash2([], {}); + if (($truthy(sep.$$is_number) && ($not(limit)))) { + $a = [false, sep, limit], (sep = $a[0]), (limit = $a[1]), (opts = $a[2]); + } if ((($truthy(sep.$$is_hash) && ($not(limit))) && ($eqeq(opts, $hash2([], {}))))) { + $a = [false, nil, sep], (sep = $a[0]), (limit = $a[1]), (opts = $a[2]); + } else if (($truthy(limit.$$is_hash) && ($eqeq(opts, $hash2([], {}))))) { + $a = [sep, nil, limit], (sep = $a[0]), (limit = $a[1]), (opts = $a[2]); + } orig_sep = sep; + if ($eqeq(sep, false)) { + sep = $gvars["/"]; + } if ($eqeq(sep, "")) { + sep = /\r?\n\r?\n/; + } sep = ($truthy(($ret_or_1 = sep)) ? ($ret_or_1) : ("")); + if (!$eqeq(orig_sep, "")) { + sep = sep.$to_str(); + } seplen = ($eqeq(orig_sep, "") ? (2) : (sep.$length())); + if ($eqeq(sep, " ")) { + sep = / /; + } self.read_buffer = ($truthy(($ret_or_1 = self.read_buffer)) ? ($ret_or_1) : ("")); + data = ""; + ret = nil; + do { + + self.read_buffer = $rb_plus(self.read_buffer, data); + if (($neqeq(sep, "") && ($truthy(($truthy(sep.$$is_regexp) ? (self.read_buffer['$match?'](sep)) : (self.read_buffer['$include?'](sep))))))) { + + orig_buffer = self.read_buffer; + $b = self.read_buffer.$split(sep, 2), $a = $to_ary($b), (ret = ($a[0] == null ? nil : $a[0])), (self.read_buffer = ($a[1] == null ? nil : $a[1])); + if ($neqeq(ret, orig_buffer)) { + ret = $rb_plus(ret, orig_buffer['$[]'](ret.$length(), seplen)); + } break; + } } while ($truthy((data = self.$sysread_noraise(($eqeq(sep, "") ? (65536) : (1)))))); if (!$truthy(ret)) { + + $a = [($truthy(($ret_or_1 = self.read_buffer)) ? ($ret_or_1) : ("")), ""], (ret = $a[0]), (self.read_buffer = $a[1]); + if ($eqeq(ret, "")) { + ret = nil; + } } if ($truthy(ret)) { + + if ($truthy(limit)) { + + ret = ret['$[]'](Opal.Range.$new(0,limit, true)); + self.read_buffer = $rb_plus(ret['$[]'](Opal.Range.$new(limit, -1, false)), self.read_buffer); + } if ($truthy(opts['$[]']("chomp"))) { + ret = ret.$sub(/\r?\n$/, ""); + } if ($eqeq(orig_sep, "")) { + ret = ret.$sub(/^[\r\n]+/, ""); + } } if ($eqeq(orig_sep, false)) { + $gvars._ = ret; + } return ret; + }, -1); + + $def(self, '$sysread', function $$sysread(integer) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.read_proc(integer)))) { + return $ret_or_1 + } else { + + self.eof = true; + return $Kernel.$raise($$$('EOFError'), "end of file reached"); + } + }); + + $def(self, '$sysread_noraise', function $$sysread_noraise(integer) { + var self = this; + + try { + return self.$sysread(integer) + } catch ($err) { + if (Opal.rescue($err, [$$$('EOFError')])) { + try { + return nil + } finally { Opal.pop_exception(); } + } else { throw $err; } + } + }); + + $def(self, '$readpartial', function $$readpartial(integer) { + var $a, self = this, $ret_or_1 = nil, part = nil, ret = nil; + + + self.read_buffer = ($truthy(($ret_or_1 = self.read_buffer)) ? ($ret_or_1) : ("")); + part = self.$sysread(integer); + $a = [$rb_plus(self.read_buffer, ($truthy(($ret_or_1 = part)) ? ($ret_or_1) : (""))), ""], (ret = $a[0]), (self.read_buffer = $a[1]); + if ($eqeq(ret, "")) { + ret = nil; + } return ret; + }); + + $def(self, '$read', function $$read(integer) { + var $a, self = this, $ret_or_1 = nil, parts = nil, ret = nil; + + + if (integer == null) integer = nil; + self.read_buffer = ($truthy(($ret_or_1 = self.read_buffer)) ? ($ret_or_1) : ("")); + parts = ""; + ret = nil; + do { + + self.read_buffer = $rb_plus(self.read_buffer, parts); + if (($truthy(integer) && ($truthy($rb_gt(self.read_buffer.$length(), integer))))) { + + $a = [self.read_buffer['$[]'](Opal.Range.$new(0,integer, true)), self.read_buffer['$[]'](Opal.Range.$new(integer, -1, false))], (ret = $a[0]), (self.read_buffer = $a[1]); + return ret; + } } while ($truthy((parts = self.$sysread_noraise(($truthy(($ret_or_1 = integer)) ? ($ret_or_1) : (65536)))))); $a = [self.read_buffer, ""], (ret = $a[0]), (self.read_buffer = $a[1]); + return ret; + }, -1); + + $def(self, '$readlines', function $$readlines(separator) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + if (separator == null) separator = $gvars["/"]; + return self.$each_line(separator).$to_a(); + }, -1); + + $def(self, '$each', function $$each($a, $b) { + var block = $$each.$$p || nil, $post_args, sep, args, self = this, s = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + $$each.$$p = null; + $post_args = $slice(arguments); + + if ($post_args.length > 0) sep = $post_args.shift();if (sep == null) sep = $gvars["/"]; + args = $post_args; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["each", sep].concat($to_a(args))) + } while ($truthy((s = $send(self, 'gets', [sep].concat($to_a(args)))))) { + Opal.yield1(block, s); + } return self; + }, -1); + + $def(self, '$each_byte', function $$each_byte() { + var block = $$each_byte.$$p || nil, self = this, s = nil; + + $$each_byte.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("each_byte") + } while ($truthy((s = self.$getbyte()))) { + Opal.yield1(block, s); + } return self; + }); + + $def(self, '$each_char', function $$each_char() { + var block = $$each_char.$$p || nil, self = this, s = nil; + + $$each_char.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("each_char") + } while ($truthy((s = self.$getc()))) { + Opal.yield1(block, s); + } return self; + }); + + $def(self, '$close', $assign_ivar_val("closed", "both")); + + $def(self, '$close_read', function $$close_read() { + var self = this; + + if ($eqeq(self.closed, "write")) { + return (self.closed = "both") + } else { + return (self.closed = "read") + } + }); + + $def(self, '$close_write', function $$close_write() { + var self = this; + + if ($eqeq(self.closed, "read")) { + return (self.closed = "both") + } else { + return (self.closed = "write") + } + }); + + $def(self, '$closed?', function $IO_closed$ques$3() { + var self = this; + + return self.closed['$==']("both") + }); + + $def(self, '$closed_read?', function $IO_closed_read$ques$4() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.closed['$==']("read")))) { + return $ret_or_1 + } else { + return self.closed['$==']("both") + } + }); + + $def(self, '$closed_write?', function $IO_closed_write$ques$5() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.closed['$==']("write")))) { + return $ret_or_1 + } else { + return self.closed['$==']("both") + } + }); + + $def(self, '$check_writable', function $$check_writable() { + var self = this; + + if ($truthy(self['$closed_write?']())) { + return $Kernel.$raise($$$('IOError'), "not opened for writing") + } else { + return nil + } + }); + + $def(self, '$check_readable', function $$check_readable() { + var self = this; + + if ($truthy(self['$closed_read?']())) { + return $Kernel.$raise($$$('IOError'), "not opened for reading") + } else { + return nil + } + }); + $alias(self, "each_line", "each"); + return $alias(self, "eof?", "eof"); + })('::', null); + $const_set('::', 'STDIN', ($gvars.stdin = $$$('IO').$new(0, "r"))); + $const_set('::', 'STDOUT', ($gvars.stdout = $$$('IO').$new(1, "w"))); + $const_set('::', 'STDERR', ($gvars.stderr = $$$('IO').$new(2, "w"))); + var console = Opal.global.console; + $$$('STDOUT')['$write_proc='](typeof(process) === 'object' && typeof(process.stdout) === 'object' ? function(s){process.stdout.write(s);} : function(s){console.log(s);}); + $$$('STDERR')['$write_proc='](typeof(process) === 'object' && typeof(process.stderr) === 'object' ? function(s){process.stderr.write(s);} : function(s){console.warn(s);}); + return ($a = [function(s) { var p = prompt(); if (p !== null) return p + "\n"; return nil; }], $send($$$('STDIN'), 'read_proc=', $a), $a[$a.length - 1]); + }; + + Opal.modules["opal/regexp_anchors"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $const_set = Opal.const_set, $nesting = []; Opal.nil; var $$$ = Opal.$$$; + + Opal.add_stubs('new'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Opal'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $const_set(self, 'REGEXP_START', "^"); + $const_set(self, 'REGEXP_END', "$"); + $const_set(self, 'FORBIDDEN_STARTING_IDENTIFIER_CHARS', "\\u0001-\\u002F\\u003A-\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + $const_set(self, 'FORBIDDEN_ENDING_IDENTIFIER_CHARS', "\\u0001-\\u0020\\u0022-\\u002F\\u003A-\\u003E\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + $const_set(self, 'INLINE_IDENTIFIER_REGEXP', $$('Regexp').$new("[^" + ($$$(self, 'FORBIDDEN_STARTING_IDENTIFIER_CHARS')) + "]*[^" + ($$$(self, 'FORBIDDEN_ENDING_IDENTIFIER_CHARS')) + "]")); + $const_set(self, 'FORBIDDEN_CONST_NAME_CHARS', "\\u0001-\\u0020\\u0021-\\u002F\\u003B-\\u003F\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + return $const_set(self, 'CONST_NAME_REGEXP', $$('Regexp').$new("" + ($$$(self, 'REGEXP_START')) + "(::)?[A-Z][^" + ($$$(self, 'FORBIDDEN_CONST_NAME_CHARS')) + "]*" + ($$$(self, 'REGEXP_END')))); + })($nesting[0], $nesting) + }; + + Opal.modules["opal/mini"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $Object = Opal.Object; Opal.nil; + + Opal.add_stubs('require'); + + $Object.$require("opal/base"); + $Object.$require("corelib/nil"); + $Object.$require("corelib/boolean"); + $Object.$require("corelib/string"); + $Object.$require("corelib/comparable"); + $Object.$require("corelib/enumerable"); + $Object.$require("corelib/enumerator"); + $Object.$require("corelib/array"); + $Object.$require("corelib/hash"); + $Object.$require("corelib/number"); + $Object.$require("corelib/range"); + $Object.$require("corelib/proc"); + $Object.$require("corelib/method"); + $Object.$require("corelib/regexp"); + $Object.$require("corelib/variables"); + $Object.$require("corelib/io"); + return $Object.$require("opal/regexp_anchors"); + }; + + Opal.modules["corelib/kernel/format"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $coerce_to = Opal.coerce_to, $module = Opal.module, $slice = Opal.slice, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $Opal = Opal.Opal, $Kernel = Opal.Kernel, $gvars = Opal.gvars, $def = Opal.def, $alias = Opal.alias, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('respond_to?,[],==,length,coerce_to?,nil?,to_a,raise,to_int,fetch,Integer,Float,to_ary,to_str,inspect,to_s,format'); + return (function($base) { + var self = $module($base, 'Kernel'); + + + + + $def(self, '$format', function $$format(format_string, $a) { + var $post_args, args, ary = nil; + if ($gvars.DEBUG == null) $gvars.DEBUG = nil; + + + $post_args = $slice(arguments, 1); + args = $post_args; + if (($eqeq(args.$length(), 1) && ($truthy(args['$[]'](0)['$respond_to?']("to_ary"))))) { + + ary = $Opal['$coerce_to?'](args['$[]'](0), $$$('Array'), "to_ary"); + if (!$truthy(ary['$nil?']())) { + args = ary.$to_a(); + } } + var result = '', + //used for slicing: + begin_slice = 0, + end_slice, + //used for iterating over the format string: + i, + len = format_string.length, + //used for processing field values: + arg, + str, + //used for processing %g and %G fields: + exponent, + //used for keeping track of width and precision: + width, + precision, + //used for holding temporary values: + tmp_num, + //used for processing %{} and %<> fileds: + hash_parameter_key, + closing_brace_char, + //used for processing %b, %B, %o, %x, and %X fields: + base_number, + base_prefix, + base_neg_zero_regex, + base_neg_zero_digit, + //used for processing arguments: + next_arg, + seq_arg_num = 1, + pos_arg_num = 0, + //used for keeping track of flags: + flags, + FNONE = 0, + FSHARP = 1, + FMINUS = 2, + FPLUS = 4, + FZERO = 8, + FSPACE = 16, + FWIDTH = 32, + FPREC = 64, + FPREC0 = 128; + + function CHECK_FOR_FLAGS() { + if (flags&FWIDTH) { $Kernel.$raise($$$('ArgumentError'), "flag after width"); } + if (flags&FPREC0) { $Kernel.$raise($$$('ArgumentError'), "flag after precision"); } + } + + function CHECK_FOR_WIDTH() { + if (flags&FWIDTH) { $Kernel.$raise($$$('ArgumentError'), "width given twice"); } + if (flags&FPREC0) { $Kernel.$raise($$$('ArgumentError'), "width after precision"); } + } + + function GET_NTH_ARG(num) { + if (num >= args.length) { $Kernel.$raise($$$('ArgumentError'), "too few arguments"); } + return args[num]; + } + + function GET_NEXT_ARG() { + switch (pos_arg_num) { + case -1: $Kernel.$raise($$$('ArgumentError'), "unnumbered(" + (seq_arg_num) + ") mixed with numbered"); // raise + case -2: $Kernel.$raise($$$('ArgumentError'), "unnumbered(" + (seq_arg_num) + ") mixed with named"); // raise + } + pos_arg_num = seq_arg_num++; + return GET_NTH_ARG(pos_arg_num - 1); + } + + function GET_POS_ARG(num) { + if (pos_arg_num > 0) { + $Kernel.$raise($$$('ArgumentError'), "numbered(" + (num) + ") after unnumbered(" + (pos_arg_num) + ")"); + } + if (pos_arg_num === -2) { + $Kernel.$raise($$$('ArgumentError'), "numbered(" + (num) + ") after named"); + } + if (num < 1) { + $Kernel.$raise($$$('ArgumentError'), "invalid index - " + (num) + "$"); + } + pos_arg_num = -1; + return GET_NTH_ARG(num - 1); + } + + function GET_ARG() { + return (next_arg === undefined ? GET_NEXT_ARG() : next_arg); + } + + function READ_NUM(label) { + var num, str = ''; + for (;; i++) { + if (i === len) { + $Kernel.$raise($$$('ArgumentError'), "malformed format string - %*[0-9]"); + } + if (format_string.charCodeAt(i) < 48 || format_string.charCodeAt(i) > 57) { + i--; + num = parseInt(str, 10) || 0; + if (num > 2147483647) { + $Kernel.$raise($$$('ArgumentError'), "" + (label) + " too big"); + } + return num; + } + str += format_string.charAt(i); + } + } + + function READ_NUM_AFTER_ASTER(label) { + var arg, num = READ_NUM(label); + if (format_string.charAt(i + 1) === '$') { + i++; + arg = GET_POS_ARG(num); + } else { + arg = GET_NEXT_ARG(); + } + return (arg).$to_int(); + } + + for (i = format_string.indexOf('%'); i !== -1; i = format_string.indexOf('%', i)) { + str = undefined; + + flags = FNONE; + width = -1; + precision = -1; + next_arg = undefined; + + end_slice = i; + + i++; + + switch (format_string.charAt(i)) { + case '%': + begin_slice = i; + // no-break + case '': + case '\n': + case '\0': + i++; + continue; + } + + format_sequence: for (; i < len; i++) { + switch (format_string.charAt(i)) { + + case ' ': + CHECK_FOR_FLAGS(); + flags |= FSPACE; + continue format_sequence; + + case '#': + CHECK_FOR_FLAGS(); + flags |= FSHARP; + continue format_sequence; + + case '+': + CHECK_FOR_FLAGS(); + flags |= FPLUS; + continue format_sequence; + + case '-': + CHECK_FOR_FLAGS(); + flags |= FMINUS; + continue format_sequence; + + case '0': + CHECK_FOR_FLAGS(); + flags |= FZERO; + continue format_sequence; + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + tmp_num = READ_NUM('width'); + if (format_string.charAt(i + 1) === '$') { + if (i + 2 === len) { + str = '%'; + i++; + break format_sequence; + } + if (next_arg !== undefined) { + $Kernel.$raise($$$('ArgumentError'), "value given twice - %" + (tmp_num) + "$"); + } + next_arg = GET_POS_ARG(tmp_num); + i++; + } else { + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = tmp_num; + } + continue format_sequence; + + case '<': + case '\{': + closing_brace_char = (format_string.charAt(i) === '<' ? '>' : '\}'); + hash_parameter_key = ''; + + i++; + + for (;; i++) { + if (i === len) { + $Kernel.$raise($$$('ArgumentError'), "malformed name - unmatched parenthesis"); + } + if (format_string.charAt(i) === closing_brace_char) { + + if (pos_arg_num > 0) { + $Kernel.$raise($$$('ArgumentError'), "named " + (hash_parameter_key) + " after unnumbered(" + (pos_arg_num) + ")"); + } + if (pos_arg_num === -1) { + $Kernel.$raise($$$('ArgumentError'), "named " + (hash_parameter_key) + " after numbered"); + } + pos_arg_num = -2; + + if (args[0] === undefined || !args[0].$$is_hash) { + $Kernel.$raise($$$('ArgumentError'), "one hash required"); + } + + next_arg = (args[0]).$fetch(hash_parameter_key); + + if (closing_brace_char === '>') { + continue format_sequence; + } else { + str = next_arg.toString(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + } + } + hash_parameter_key += format_string.charAt(i); + } + // raise + + case '*': + i++; + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = READ_NUM_AFTER_ASTER('width'); + if (width < 0) { + flags |= FMINUS; + width = -width; + } + continue format_sequence; + + case '.': + if (flags&FPREC0) { + $Kernel.$raise($$$('ArgumentError'), "precision given twice"); + } + flags |= FPREC|FPREC0; + precision = 0; + i++; + if (format_string.charAt(i) === '*') { + i++; + precision = READ_NUM_AFTER_ASTER('precision'); + if (precision < 0) { + flags &= ~FPREC; + } + continue format_sequence; + } + precision = READ_NUM('precision'); + continue format_sequence; + + case 'd': + case 'i': + case 'u': + arg = $Kernel.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (-arg).toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + break format_sequence; + + case 'b': + case 'B': + case 'o': + case 'x': + case 'X': + switch (format_string.charAt(i)) { + case 'b': + case 'B': + base_number = 2; + base_prefix = '0b'; + base_neg_zero_regex = /^1+/; + base_neg_zero_digit = '1'; + break; + case 'o': + base_number = 8; + base_prefix = '0'; + base_neg_zero_regex = /^3?7+/; + base_neg_zero_digit = '7'; + break; + case 'x': + case 'X': + base_number = 16; + base_prefix = '0x'; + base_neg_zero_regex = /^f+/; + base_neg_zero_digit = 'f'; + break; + } + arg = $Kernel.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0) - ((flags&FSHARP && arg !== 0) ? base_prefix.length : 0)) { str = '0' + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (flags&FPLUS || flags&FSPACE) { + str = (-arg).toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1 - (flags&FSHARP ? 2 : 0)) { str = '0' + str; } + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + } else { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (arg >>> 0).toString(base_number).replace(base_neg_zero_regex, base_neg_zero_digit); + while (str.length < precision - 2) { str = base_neg_zero_digit + str; } + if (flags&FMINUS) { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 2 - (flags&FSHARP ? base_prefix.length : 0)) { str = base_neg_zero_digit + str; } + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + } else { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase()) { + str = str.toUpperCase(); + } + break format_sequence; + + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + arg = $Kernel.$Float(GET_ARG()); + if (arg >= 0 || isNaN(arg)) { + if (arg === Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = arg.toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = arg.toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = arg.toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = arg.toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== Infinity && !isNaN(arg)) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (arg === -Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = (-arg).toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = (-arg).toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = (-arg).toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = (-arg).toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== -Infinity) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase() && arg !== Infinity && arg !== -Infinity && !isNaN(arg)) { + str = str.toUpperCase(); + } + str = str.replace(/([eE][-+]?)([0-9])$/, '$10$2'); + break format_sequence; + + case 'a': + case 'A': + // Not implemented because there are no specs for this field type. + $Kernel.$raise($$$('NotImplementedError'), "`A` and `a` format field types are not implemented in Opal yet"); + // raise + + case 'c': + arg = GET_ARG(); + if ((arg)['$respond_to?']("to_ary")) { arg = (arg).$to_ary()[0]; } + if ((arg)['$respond_to?']("to_str")) { + str = (arg).$to_str(); + } else { + str = String.fromCharCode($coerce_to(arg, $$$('Integer'), 'to_int')); + } + if (str.length !== 1) { + $Kernel.$raise($$$('ArgumentError'), "%c requires a character"); + } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 'p': + str = (GET_ARG()).$inspect(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 's': + str = (GET_ARG()).$to_s(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + default: + $Kernel.$raise($$$('ArgumentError'), "malformed format string - %" + (format_string.charAt(i))); + } + } + + if (str === undefined) { + $Kernel.$raise($$$('ArgumentError'), "malformed format string - %"); + } + + result += format_string.slice(begin_slice, end_slice) + str; + begin_slice = i + 1; + } + + if ($gvars.DEBUG && pos_arg_num >= 0 && seq_arg_num < args.length) { + $Kernel.$raise($$$('ArgumentError'), "too many arguments for format string"); + } + + return result + format_string.slice(begin_slice); + }, -2); + return $alias(self, "sprintf", "format"); + })('::') + }; + + Opal.modules["corelib/string/encoding"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $hash2 = Opal.hash2, $rb_plus = Opal.rb_plus, $truthy = Opal.truthy, $send = Opal.send, $defs = Opal.defs, $eqeq = Opal.eqeq, $def = Opal.def, $return_ivar = Opal.return_ivar, $return_val = Opal.return_val, $slice = Opal.slice, $Kernel = Opal.Kernel, $Opal = Opal.Opal, $rb_lt = Opal.rb_lt, $a, self = Opal.top, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,+,[],clone,initialize,new,instance_eval,to_proc,each,const_set,tr,==,default_external,attr_accessor,singleton_class,attr_reader,raise,register,length,bytes,force_encoding,dup,bytesize,enum_for,each_byte,to_a,each_char,each_codepoint,coerce_to!,find,<,default_external='); + + self.$require("corelib/string"); + (function($base, $super) { + var self = $klass($base, $super, 'Encoding'); + + var $proto = self.$$prototype; + + $proto.name = $proto.dummy = nil; + + $defs(self, '$register', function $$register(name, options) { + var block = $$register.$$p || nil, self = this, names = nil, $ret_or_1 = nil, ascii = nil, dummy = nil, encoding = nil, register = nil; + + $$register.$$p = null; + if (options == null) options = $hash2([], {}); + names = $rb_plus([name], ($truthy(($ret_or_1 = options['$[]']("aliases"))) ? ($ret_or_1) : ([]))); + ascii = ($truthy(($ret_or_1 = options['$[]']("ascii"))) && ($ret_or_1)); + dummy = ($truthy(($ret_or_1 = options['$[]']("dummy"))) && ($ret_or_1)); + if ($truthy(options['$[]']("inherits"))) { + + encoding = options['$[]']("inherits").$clone(); + encoding.$initialize(name, names, ascii, dummy); + } else { + encoding = self.$new(name, names, ascii, dummy); + } if ((block !== nil)) { + $send(encoding, 'instance_eval', [], block.$to_proc()); + } register = Opal.encodings; + return $send(names, 'each', [], function $$1(encoding_name){var self = $$1.$$s == null ? this : $$1.$$s; + + + if (encoding_name == null) encoding_name = nil; + self.$const_set(encoding_name.$tr("-", "_"), encoding); + return register[encoding_name] = encoding;}, {$$s: self}); + }, -2); + $defs(self, '$find', function $$find(name) { + var self = this; + + + if ($eqeq(name, "default_external")) { + return self.$default_external() + } return Opal.find_encoding(name); }); + self.$singleton_class().$attr_accessor("default_external"); + self.$attr_reader("name", "names"); + + $def(self, '$initialize', function $$initialize(name, names, ascii, dummy) { + var self = this; + + + self.name = name; + self.names = names; + self.ascii = ascii; + return (self.dummy = dummy); + }); + + $def(self, '$ascii_compatible?', $return_ivar("ascii")); + + $def(self, '$dummy?', $return_ivar("dummy")); + + $def(self, '$binary?', $return_val(false)); + + $def(self, '$to_s', $return_ivar("name")); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + return "#" + }); + + $def(self, '$charsize', function $$charsize(string) { + + + var len = 0; + for (var i = 0, length = string.length; i < length; i++) { + var charcode = string.charCodeAt(i); + if (!(charcode >= 0xD800 && charcode <= 0xDBFF)) { + len++; + } + } + return len; + + }); + + $def(self, '$each_char', function $$each_char(string) { + var block = $$each_char.$$p || nil; + + $$each_char.$$p = null; + + var low_surrogate = ""; + for (var i = 0, length = string.length; i < length; i++) { + var charcode = string.charCodeAt(i); + var chr = string.charAt(i); + if (charcode >= 0xDC00 && charcode <= 0xDFFF) { + low_surrogate = chr; + continue; + } + else if (charcode >= 0xD800 && charcode <= 0xDBFF) { + chr = low_surrogate + chr; + } + if (string.encoding.name != "UTF-8") { + chr = new String(chr); + chr.encoding = string.encoding; + } + Opal.yield1(block, chr); + } + }); + + $def(self, '$each_byte', function $$each_byte($a) { + + + $slice(arguments); + return $Kernel.$raise($$$('NotImplementedError')); + }, -1); + + $def(self, '$bytesize', function $$bytesize($a) { + + + $slice(arguments); + return $Kernel.$raise($$$('NotImplementedError')); + }, -1); + $klass('::', $$$('StandardError'), 'EncodingError'); + return ($klass('::', $$$('EncodingError'), 'CompatibilityError'), nil); + })('::', null); + $send($$$('Encoding'), 'register', ["UTF-8", $hash2(["aliases", "ascii"], {"aliases": ["CP65001"], "ascii": true})], function $$2(){var self = $$2.$$s == null ? this : $$2.$$s; + + + + $def(self, '$each_byte', function $$each_byte(string) { + var block = $$each_byte.$$p || nil; + + $$each_byte.$$p = null; + + // Taken from: https://github.com/feross/buffer/blob/f52dffd9df0445b93c0c9065c2f8f0f46b2c729a/index.js#L1954-L2032 + var units = Infinity; + var codePoint; + var length = string.length; + var leadSurrogate = null; + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i); + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) { + Opal.yield1(block, 0xEF); + Opal.yield1(block, 0xBF); + Opal.yield1(block, 0xBD); + } + continue; + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) { + Opal.yield1(block, 0xEF); + Opal.yield1(block, 0xBF); + Opal.yield1(block, 0xBD); + } + continue; + } + + // valid lead + leadSurrogate = codePoint; + + continue; + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) { + Opal.yield1(block, 0xEF); + Opal.yield1(block, 0xBF); + Opal.yield1(block, 0xBD); + } + leadSurrogate = codePoint; + continue; + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) { + Opal.yield1(block, 0xEF); + Opal.yield1(block, 0xBF); + Opal.yield1(block, 0xBD); + } + } + + leadSurrogate = null; + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break; + Opal.yield1(block, codePoint); + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break; + Opal.yield1(block, codePoint >> 0x6 | 0xC0); + Opal.yield1(block, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break; + Opal.yield1(block, codePoint >> 0xC | 0xE0); + Opal.yield1(block, codePoint >> 0x6 & 0x3F | 0x80); + Opal.yield1(block, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break; + Opal.yield1(block, codePoint >> 0x12 | 0xF0); + Opal.yield1(block, codePoint >> 0xC & 0x3F | 0x80); + Opal.yield1(block, codePoint >> 0x6 & 0x3F | 0x80); + Opal.yield1(block, codePoint & 0x3F | 0x80); + } else ; + } + }); + return $def(self, '$bytesize', function $$bytesize(string) { + + return string.$bytes().$length() + });}, {$$s: self}); + $send($$$('Encoding'), 'register', ["UTF-16LE"], function $$3(){var self = $$3.$$s == null ? this : $$3.$$s; + + + + $def(self, '$each_byte', function $$each_byte(string) { + var block = $$each_byte.$$p || nil; + + $$each_byte.$$p = null; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + }); + return $def(self, '$bytesize', function $$bytesize(string) { + + return string.length * 2; + });}, {$$s: self}); + $send($$$('Encoding'), 'register', ["UTF-16BE", $hash2(["inherits"], {"inherits": $$$($$$('Encoding'), 'UTF_16LE')})], function $$4(){var self = $$4.$$s == null ? this : $$4.$$s; + + return $def(self, '$each_byte', function $$each_byte(string) { + var block = $$each_byte.$$p || nil; + + $$each_byte.$$p = null; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code >> 8); + Opal.yield1(block, code & 0xff); + } + })}, {$$s: self}); + $send($$$('Encoding'), 'register', ["UTF-32LE"], function $$5(){var self = $$5.$$s == null ? this : $$5.$$s; + + + + $def(self, '$each_byte', function $$each_byte(string) { + var block = $$each_byte.$$p || nil; + + $$each_byte.$$p = null; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + Opal.yield1(block, 0); + Opal.yield1(block, 0); + } + }); + return $def(self, '$bytesize', function $$bytesize(string) { + + return string.length * 4; + });}, {$$s: self}); + $send($$$('Encoding'), 'register', ["UTF-32BE", $hash2(["inherits"], {"inherits": $$$($$$('Encoding'), 'UTF_32LE')})], function $$6(){var self = $$6.$$s == null ? this : $$6.$$s; + + return $def(self, '$each_byte', function $$each_byte(string) { + var block = $$each_byte.$$p || nil; + + $$each_byte.$$p = null; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, 0); + Opal.yield1(block, 0); + Opal.yield1(block, code >> 8); + Opal.yield1(block, code & 0xff); + } + })}, {$$s: self}); + $send($$$('Encoding'), 'register', ["ASCII-8BIT", $hash2(["aliases", "ascii"], {"aliases": ["BINARY"], "ascii": true})], function $$7(){var self = $$7.$$s == null ? this : $$7.$$s; + + + + $def(self, '$each_char', function $$each_char(string) { + var block = $$each_char.$$p || nil; + + $$each_char.$$p = null; + + for (var i = 0, length = string.length; i < length; i++) { + var chr = new String(string.charAt(i)); + chr.encoding = string.encoding; + Opal.yield1(block, chr); + } + }); + + $def(self, '$charsize', function $$charsize(string) { + + return string.length; + }); + + $def(self, '$each_byte', function $$each_byte(string) { + var block = $$each_byte.$$p || nil; + + $$each_byte.$$p = null; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + Opal.yield1(block, code & 0xff); + } + }); + + $def(self, '$bytesize', function $$bytesize(string) { + + return string.length; + }); + return $def(self, '$binary?', $return_val(true));}, {$$s: self}); + $$$('Encoding').$register("ISO-8859-1", $hash2(["aliases", "ascii", "inherits"], {"aliases": ["ISO8859-1"], "ascii": true, "inherits": $$$($$$('Encoding'), 'ASCII_8BIT')})); + $$$('Encoding').$register("US-ASCII", $hash2(["aliases", "ascii", "inherits"], {"aliases": ["ASCII"], "ascii": true, "inherits": $$$($$$('Encoding'), 'ASCII_8BIT')})); + (function($base, $super) { + var self = $klass($base, $super, 'String'); + + var $proto = self.$$prototype; + + $proto.internal_encoding = $proto.bytes = $proto.encoding = nil; + + self.$attr_reader("encoding"); + self.$attr_reader("internal_encoding"); + Opal.prop(String.prototype, 'bytes', nil); + Opal.prop(String.prototype, 'encoding', $$$($$$('Encoding'), 'UTF_8')); + Opal.prop(String.prototype, 'internal_encoding', $$$($$$('Encoding'), 'UTF_8')); + + $def(self, '$b', function $$b() { + var self = this; + + return self.$dup().$force_encoding("binary") + }); + + $def(self, '$bytesize', function $$bytesize() { + var self = this; + + return self.internal_encoding.$bytesize(self) + }); + + $def(self, '$each_byte', function $$each_byte() { + var block = $$each_byte.$$p || nil, self = this; + + $$each_byte.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["each_byte"], function $$8(){var self = $$8.$$s == null ? this : $$8.$$s; + + return self.$bytesize()}, {$$s: self}) + } $send(self.internal_encoding, 'each_byte', [self], block.$to_proc()); + return self; + }); + + $def(self, '$bytes', function $$bytes() { + var self = this, $ret_or_1 = nil; + + + + if (typeof self === 'string') { + return (new String(self)).$each_byte().$to_a(); + } + self.bytes = ($truthy(($ret_or_1 = self.bytes)) ? ($ret_or_1) : (self.$each_byte().$to_a())); + return self.bytes.$dup(); + }); + + $def(self, '$each_char', function $$each_char() { + var block = $$each_char.$$p || nil, self = this; + + $$each_char.$$p = null; + if (!(block !== nil)) { + return $send(self, 'enum_for', ["each_char"], function $$9(){var self = $$9.$$s == null ? this : $$9.$$s; + + return self.$length()}, {$$s: self}) + } $send(self.encoding, 'each_char', [self], block.$to_proc()); + return self; + }); + + $def(self, '$chars', function $$chars() { + var block = $$chars.$$p || nil, self = this; + + $$chars.$$p = null; + if (!$truthy(block)) { + return self.$each_char().$to_a() + } return $send(self, 'each_char', [], block.$to_proc()); + }); + + $def(self, '$each_codepoint', function $$each_codepoint() { + var block = $$each_codepoint.$$p || nil, self = this; + + $$each_codepoint.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("each_codepoint") + } + for (var i = 0, length = self.length; i < length; i++) { + Opal.yield1(block, self.codePointAt(i)); + } + return self; + }); + + $def(self, '$codepoints', function $$codepoints() { + var block = $$codepoints.$$p || nil, self = this; + + $$codepoints.$$p = null; + if ((block !== nil)) { + return $send(self, 'each_codepoint', [], block.$to_proc()) + } return self.$each_codepoint().$to_a(); + }); + + $def(self, '$encode', function $$encode(encoding) { + var self = this; + + return Opal.enc(self, encoding); + }); + + $def(self, '$force_encoding', function $$force_encoding(encoding) { + var self = this; + + + var str = self; + + if (encoding === str.encoding) { return str; } + + encoding = $Opal['$coerce_to!'](encoding, $$$('String'), "to_s"); + encoding = $$$('Encoding').$find(encoding); + + if (encoding === str.encoding) { return str; } + + str = Opal.set_encoding(str, encoding); + + return str; + + }); + + $def(self, '$getbyte', function $$getbyte(idx) { + var self = this, string_bytes = nil; + + + string_bytes = self.$bytes(); + idx = $Opal['$coerce_to!'](idx, $$$('Integer'), "to_int"); + if ($truthy($rb_lt(string_bytes.$length(), idx))) { + return nil + } return string_bytes['$[]'](idx); + }); + + $def(self, '$initialize_copy', function $$initialize_copy(other) { + + return "\n" + " self.encoding = other.encoding;\n" + " self.internal_encoding = other.internal_encoding;\n" + " " + }); + return $def(self, '$valid_encoding?', $return_val(true)); + })('::', null); + return ($a = [$$$($$('Encoding'), 'UTF_8')], $send($$$('Encoding'), 'default_external=', $a), $a[$a.length - 1]); + }; + + Opal.modules["corelib/math"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $type_error = Opal.type_error, $module = Opal.module, $const_set = Opal.const_set, $Class = Opal.Class, $slice = Opal.slice, $Kernel = Opal.Kernel, $defs = Opal.defs, $truthy = Opal.truthy, $send = Opal.send, $def = Opal.def, $rb_minus = Opal.rb_minus, $eqeqeq = Opal.eqeqeq, $rb_divide = Opal.rb_divide, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('new,raise,Float,Integer,module_function,each,define_method,checked,float!,===,gamma,-,integer!,/,infinite?'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Math'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $const_set(self, 'E', Math.E); + $const_set(self, 'PI', Math.PI); + $const_set(self, 'DomainError', $Class.$new($$$('StandardError'))); + $defs(self, '$checked', function $$checked(method, $a) { + var $post_args, args; + + + $post_args = $slice(arguments, 1); + args = $post_args; + + if (isNaN(args[0]) || (args.length == 2 && isNaN(args[1]))) { + return NaN; + } + + var result = Math[method].apply(null, args); + + if (isNaN(result)) { + $Kernel.$raise($$('DomainError'), "Numerical argument is out of domain - \"" + (method) + "\""); + } + + return result; + }, -2); + $defs(self, '$float!', function $Math_float$excl$1(value) { + + try { + return $Kernel.$Float(value) + } catch ($err) { + if (Opal.rescue($err, [$$$('ArgumentError')])) { + try { + return $Kernel.$raise($type_error(value, $$$('Float'))) + } finally { Opal.pop_exception(); } + } else { throw $err; } + } + }); + $defs(self, '$integer!', function $Math_integer$excl$2(value) { + + try { + return $Kernel.$Integer(value) + } catch ($err) { + if (Opal.rescue($err, [$$$('ArgumentError')])) { + try { + return $Kernel.$raise($type_error(value, $$$('Integer'))) + } finally { Opal.pop_exception(); } + } else { throw $err; } + } + }); + self.$module_function(); + if (!$truthy((typeof(Math.erf) !== "undefined"))) { + + Opal.prop(Math, 'erf', function(x) { + var A1 = 0.254829592, + A2 = -0.284496736, + A3 = 1.421413741, + A4 = -1.453152027, + A5 = 1.061405429, + P = 0.3275911; + + var sign = 1; + + if (x < 0) { + sign = -1; + } + + x = Math.abs(x); + + var t = 1.0 / (1.0 + P * x); + var y = 1.0 - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * Math.exp(-x * x); + + return sign * y; + }); + + } if (!$truthy((typeof(Math.erfc) !== "undefined"))) { + + Opal.prop(Math, 'erfc', function(x) { + var z = Math.abs(x), + t = 1.0 / (0.5 * z + 1.0); + + var A1 = t * 0.17087277 + -0.82215223, + A2 = t * A1 + 1.48851587, + A3 = t * A2 + -1.13520398, + A4 = t * A3 + 0.27886807, + A5 = t * A4 + -0.18628806, + A6 = t * A5 + 0.09678418, + A7 = t * A6 + 0.37409196, + A8 = t * A7 + 1.00002368, + A9 = t * A8, + A10 = -z * z - 1.26551223 + A9; + + var a = t * Math.exp(A10); + + if (x < 0.0) { + return 2.0 - a; + } + else { + return a; + } + }); + + } $send(["acos", "acosh", "asin", "asinh", "atan", "atanh", "cbrt", "cos", "cosh", "erf", "erfc", "exp", "sin", "sinh", "sqrt", "tanh"], 'each', [], function $Math$3(method){var self = $Math$3.$$s == null ? this : $Math$3.$$s; + + + if (method == null) method = nil; + return $send(self, 'define_method', [method], function $$4(x){ + + if (x == null) x = nil; + return $$$('Math').$checked(method, $$$('Math')['$float!'](x));});}, {$$s: self}); + + $def(self, '$atan2', function $$atan2(y, x) { + + return $$$('Math').$checked("atan2", $$$('Math')['$float!'](y), $$$('Math')['$float!'](x)) + }); + + $def(self, '$hypot', function $$hypot(x, y) { + + return $$$('Math').$checked("hypot", $$$('Math')['$float!'](x), $$$('Math')['$float!'](y)) + }); + + $def(self, '$frexp', function $$frexp(x) { + + + x = $$('Math')['$float!'](x); + + if (isNaN(x)) { + return [NaN, 0]; + } + + var ex = Math.floor(Math.log(Math.abs(x)) / Math.log(2)) + 1, + frac = x / Math.pow(2, ex); + + return [frac, ex]; + }); + + $def(self, '$gamma', function $$gamma(n) { + + + n = $$('Math')['$float!'](n); + + var i, t, x, value, result, twoN, threeN, fourN, fiveN; + + var G = 4.7421875; + + var P = [ + 0.99999999999999709182, + 57.156235665862923517, + -59.597960355475491248, + 14.136097974741747174, + -0.49191381609762019978, + 0.33994649984811888699e-4, + 0.46523628927048575665e-4, + -0.98374475304879564677e-4, + 0.15808870322491248884e-3, + -0.21026444172410488319e-3, + 0.21743961811521264320e-3, + -0.16431810653676389022e-3, + 0.84418223983852743293e-4, + -0.26190838401581408670e-4, + 0.36899182659531622704e-5 + ]; + + + if (isNaN(n)) { + return NaN; + } + + if (n === 0 && 1 / n < 0) { + return -Infinity; + } + + if (n === -1 || n === -Infinity) { + $Kernel.$raise($$('DomainError'), "Numerical argument is out of domain - \"gamma\""); + } + + if ($$('Integer')['$==='](n)) { + if (n <= 0) { + return isFinite(n) ? Infinity : NaN; + } + + if (n > 171) { + return Infinity; + } + + value = n - 2; + result = n - 1; + + while (value > 1) { + result *= value; + value--; + } + + if (result == 0) { + result = 1; + } + + return result; + } + + if (n < 0.5) { + return Math.PI / (Math.sin(Math.PI * n) * $$$('Math').$gamma($rb_minus(1, n))); + } + + if (n >= 171.35) { + return Infinity; + } + + if (n > 85.0) { + twoN = n * n; + threeN = twoN * n; + fourN = threeN * n; + fiveN = fourN * n; + + return Math.sqrt(2 * Math.PI / n) * Math.pow((n / Math.E), n) * + (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - + 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + + 5246819 / (75246796800 * fiveN * n)); + } + + n -= 1; + x = P[0]; + + for (i = 1; i < P.length; ++i) { + x += P[i] / (n + i); + } + + t = n + G + 0.5; + + return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x; + }); + + $def(self, '$ldexp', function $$ldexp(mantissa, exponent) { + + + mantissa = $$('Math')['$float!'](mantissa); + exponent = $$('Math')['$integer!'](exponent); + + if (isNaN(exponent)) { + $Kernel.$raise($$$('RangeError'), "float NaN out of range of integer"); + } + + return mantissa * Math.pow(2, exponent); + }); + + $def(self, '$lgamma', function $$lgamma(n) { + + + if (n == -1) { + return [Infinity, 1]; + } + else { + return [Math.log(Math.abs($$$('Math').$gamma(n))), $$$('Math').$gamma(n) < 0 ? -1 : 1]; + } + + }); + + $def(self, '$log', function $$log(x, base) { + if ($eqeqeq($$$('String'), x)) { + $Kernel.$raise($type_error(x, $$$('Float'))); + } if ($truthy(base == null)) { + return $$$('Math').$checked("log", $$$('Math')['$float!'](x)) + } else { + + if ($eqeqeq($$$('String'), base)) { + $Kernel.$raise($type_error(base, $$$('Float'))); + } return $rb_divide($$$('Math').$checked("log", $$$('Math')['$float!'](x)), $$$('Math').$checked("log", $$$('Math')['$float!'](base))); + } }, -2); + + $def(self, '$log10', function $$log10(x) { + + + if ($eqeqeq($$$('String'), x)) { + $Kernel.$raise($type_error(x, $$$('Float'))); + } return $$$('Math').$checked("log10", $$$('Math')['$float!'](x)); + }); + + $def(self, '$log2', function $$log2(x) { + + + if ($eqeqeq($$$('String'), x)) { + $Kernel.$raise($type_error(x, $$$('Float'))); + } return $$$('Math').$checked("log2", $$$('Math')['$float!'](x)); + }); + return $def(self, '$tan', function $$tan(x) { + + + x = $$$('Math')['$float!'](x); + if ($truthy(x['$infinite?']())) { + return $$$($$$('Float'), 'NAN') + } return $$$('Math').$checked("tan", $$$('Math')['$float!'](x)); + }); + })('::', $nesting) + }; + + Opal.modules["corelib/complex/base"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $truthy = Opal.truthy, $def = Opal.def, $klass = Opal.klass, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('new,from_string'); + + (function($base, $parent_nesting) { + var self = $module($base, 'Kernel'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$Complex', function $$Complex(real, imag) { + + + if (imag == null) imag = nil; + if ($truthy(imag)) { + return $$('Complex').$new(real, imag) + } else { + return $$('Complex').$new(real, 0) + } }, -2) + })('::', $nesting); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'String'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$to_c', function $$to_c() { + var self = this; + + return $$('Complex').$from_string(self) + }) + })('::', null, $nesting); + }; + + Opal.modules["corelib/complex"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $truthy = Opal.truthy, $eqeqeq = Opal.eqeqeq, $Kernel = Opal.Kernel, $defs = Opal.defs, $rb_times = Opal.rb_times, $def = Opal.def, $rb_plus = Opal.rb_plus, $rb_minus = Opal.rb_minus, $rb_divide = Opal.rb_divide, $eqeq = Opal.eqeq, $to_ary = Opal.to_ary, $rb_gt = Opal.rb_gt, $neqeq = Opal.neqeq, $return_val = Opal.return_val, $const_set = Opal.const_set, $alias = Opal.alias, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,real?,===,raise,new,*,cos,sin,attr_reader,freeze,class,==,real,imag,Complex,-@,+,__coerced__,-,nan?,/,conj,abs2,quo,polar,exp,log,>,!=,divmod,**,hypot,atan2,lcm,denominator,finite?,infinite?,numerator,abs,arg,rationalize,to_f,to_i,to_r,inspect,zero?,positive?,Rational,rect,angle'); + + self.$require("corelib/numeric"); + self.$require("corelib/complex/base"); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Complex'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.real = $proto.imag = nil; + + $defs(self, '$rect', function $$rect(real, imag) { + var self = this; + + + if (imag == null) imag = 0; + if (!((($eqeqeq($$$('Numeric'), real) && ($truthy(real['$real?']()))) && ($eqeqeq($$$('Numeric'), imag))) && ($truthy(imag['$real?']())))) { + $Kernel.$raise($$$('TypeError'), "not a real"); + } return self.$new(real, imag); + }, -2); + $defs(self, '$polar', function $$polar(r, theta) { + var self = this; + + + if (theta == null) theta = 0; + if (!((($eqeqeq($$$('Numeric'), r) && ($truthy(r['$real?']()))) && ($eqeqeq($$$('Numeric'), theta))) && ($truthy(theta['$real?']())))) { + $Kernel.$raise($$$('TypeError'), "not a real"); + } return self.$new($rb_times(r, $$$('Math').$cos(theta)), $rb_times(r, $$$('Math').$sin(theta))); + }, -2); + self.$attr_reader("real", "imag"); + + $def(self, '$initialize', function $$initialize(real, imag) { + var self = this; + + + if (imag == null) imag = 0; + self.real = real; + self.imag = imag; + return self.$freeze(); + }, -2); + + $def(self, '$coerce', function $$coerce(other) { + var self = this; + + if ($eqeqeq($$$('Complex'), other)) { + return [other, self] + } else if (($eqeqeq($$$('Numeric'), other) && ($truthy(other['$real?']())))) { + return [$$$('Complex').$new(other, 0), self] + } else { + return $Kernel.$raise($$$('TypeError'), "" + (other.$class()) + " can't be coerced into Complex") + } + }); + + $def(self, '$==', function $Complex_$eq_eq$1(other) { + var self = this, $ret_or_1 = nil; + + if ($eqeqeq($$$('Complex'), other)) { + if ($truthy(($ret_or_1 = self.real['$=='](other.$real())))) { + return self.imag['$=='](other.$imag()) + } else { + return $ret_or_1 + } + } else if (($eqeqeq($$$('Numeric'), other) && ($truthy(other['$real?']())))) { + if ($truthy(($ret_or_1 = self.real['$=='](other)))) { + return self.imag['$=='](0) + } else { + return $ret_or_1 + } + } else { + return other['$=='](self) + } + }); + + $def(self, '$-@', function $Complex_$minus$$2() { + var self = this; + + return $Kernel.$Complex(self.real['$-@'](), self.imag['$-@']()) + }); + + $def(self, '$+', function $Complex_$plus$3(other) { + var self = this; + + if ($eqeqeq($$$('Complex'), other)) { + return $Kernel.$Complex($rb_plus(self.real, other.$real()), $rb_plus(self.imag, other.$imag())) + } else if (($eqeqeq($$$('Numeric'), other) && ($truthy(other['$real?']())))) { + return $Kernel.$Complex($rb_plus(self.real, other), self.imag) + } else { + return self.$__coerced__("+", other) + } + }); + + $def(self, '$-', function $Complex_$minus$4(other) { + var self = this; + + if ($eqeqeq($$$('Complex'), other)) { + return $Kernel.$Complex($rb_minus(self.real, other.$real()), $rb_minus(self.imag, other.$imag())) + } else if (($eqeqeq($$$('Numeric'), other) && ($truthy(other['$real?']())))) { + return $Kernel.$Complex($rb_minus(self.real, other), self.imag) + } else { + return self.$__coerced__("-", other) + } + }); + + $def(self, '$*', function $Complex_$$5(other) { + var self = this; + + if ($eqeqeq($$$('Complex'), other)) { + return $Kernel.$Complex($rb_minus($rb_times(self.real, other.$real()), $rb_times(self.imag, other.$imag())), $rb_plus($rb_times(self.real, other.$imag()), $rb_times(self.imag, other.$real()))) + } else if (($eqeqeq($$$('Numeric'), other) && ($truthy(other['$real?']())))) { + return $Kernel.$Complex($rb_times(self.real, other), $rb_times(self.imag, other)) + } else { + return self.$__coerced__("*", other) + } + }); + + $def(self, '$/', function $Complex_$slash$6(other) { + var self = this; + + if ($eqeqeq($$$('Complex'), other)) { + if ((((($eqeqeq($$$('Number'), self.real) && ($truthy(self.real['$nan?']()))) || (($eqeqeq($$$('Number'), self.imag) && ($truthy(self.imag['$nan?']()))))) || (($eqeqeq($$$('Number'), other.$real()) && ($truthy(other.$real()['$nan?']()))))) || (($eqeqeq($$$('Number'), other.$imag()) && ($truthy(other.$imag()['$nan?']())))))) { + return $$$('Complex').$new($$$($$$('Float'), 'NAN'), $$$($$$('Float'), 'NAN')) + } else { + return $rb_divide($rb_times(self, other.$conj()), other.$abs2()) + } + } else if (($eqeqeq($$$('Numeric'), other) && ($truthy(other['$real?']())))) { + return $Kernel.$Complex(self.real.$quo(other), self.imag.$quo(other)) + } else { + return self.$__coerced__("/", other) + } + }); + + $def(self, '$**', function $Complex_$$$7(other) { + var $a, $b, self = this, r = nil, theta = nil, ore = nil, oim = nil, nr = nil, ntheta = nil, x = nil, z = nil, n = nil, div = nil, mod = nil; + + + if ($eqeq(other, 0)) { + return $$$('Complex').$new(1, 0) + } if ($eqeqeq($$$('Complex'), other)) { + + $b = self.$polar(), $a = $to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])); + ore = other.$real(); + oim = other.$imag(); + nr = $$$('Math').$exp($rb_minus($rb_times(ore, $$$('Math').$log(r)), $rb_times(oim, theta))); + ntheta = $rb_plus($rb_times(theta, ore), $rb_times(oim, $$$('Math').$log(r))); + return $$$('Complex').$polar(nr, ntheta); + } else if ($eqeqeq($$$('Integer'), other)) { + if ($truthy($rb_gt(other, 0))) { + + x = self; + z = x; + n = $rb_minus(other, 1); + while ($neqeq(n, 0)) { + + $b = n.$divmod(2), $a = $to_ary($b), (div = ($a[0] == null ? nil : $a[0])), (mod = ($a[1] == null ? nil : $a[1])); + while ($eqeq(mod, 0)) { + + x = $Kernel.$Complex($rb_minus($rb_times(x.$real(), x.$real()), $rb_times(x.$imag(), x.$imag())), $rb_times($rb_times(2, x.$real()), x.$imag())); + n = div; + $b = n.$divmod(2), $a = $to_ary($b), (div = ($a[0] == null ? nil : $a[0])), (mod = ($a[1] == null ? nil : $a[1])); + } z = $rb_times(z, x); + n = $rb_minus(n, 1); + } return z; + } else { + return $rb_divide($$$('Rational').$new(1, 1), self)['$**'](other['$-@']()) + } + } else if (($eqeqeq($$$('Float'), other) || ($eqeqeq($$$('Rational'), other)))) { + + $b = self.$polar(), $a = $to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])); + return $$$('Complex').$polar(r['$**'](other), $rb_times(theta, other)); + } else { + return self.$__coerced__("**", other) + } }); + + $def(self, '$abs', function $$abs() { + var self = this; + + return $$$('Math').$hypot(self.real, self.imag) + }); + + $def(self, '$abs2', function $$abs2() { + var self = this; + + return $rb_plus($rb_times(self.real, self.real), $rb_times(self.imag, self.imag)) + }); + + $def(self, '$angle', function $$angle() { + var self = this; + + return $$$('Math').$atan2(self.imag, self.real) + }); + + $def(self, '$conj', function $$conj() { + var self = this; + + return $Kernel.$Complex(self.real, self.imag['$-@']()) + }); + + $def(self, '$denominator', function $$denominator() { + var self = this; + + return self.real.$denominator().$lcm(self.imag.$denominator()) + }); + + $def(self, '$eql?', function $Complex_eql$ques$8(other) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = $$('Complex')['$==='](other))) ? (self.real.$class()['$=='](self.imag.$class())) : ($ret_or_2))))) { + return self['$=='](other) + } else { + return $ret_or_1 + } + }); + + $def(self, '$fdiv', function $$fdiv(other) { + var self = this; + + + if (!$eqeqeq($$$('Numeric'), other)) { + $Kernel.$raise($$$('TypeError'), "" + (other.$class()) + " can't be coerced into Complex"); + } return $rb_divide(self, other); + }); + + $def(self, '$finite?', function $Complex_finite$ques$9() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.real['$finite?']()))) { + return self.imag['$finite?']() + } else { + return $ret_or_1 + } + }); + + $def(self, '$hash', function $$hash() { + var self = this; + + return "Complex:" + (self.real) + ":" + (self.imag) + }); + + $def(self, '$infinite?', function $Complex_infinite$ques$10() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.real['$infinite?']()))) { + return $ret_or_1 + } else { + return self.imag['$infinite?']() + } + }); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + return "(" + (self) + ")" + }); + + $def(self, '$numerator', function $$numerator() { + var self = this, d = nil; + + + d = self.$denominator(); + return $Kernel.$Complex($rb_times(self.real.$numerator(), $rb_divide(d, self.real.$denominator())), $rb_times(self.imag.$numerator(), $rb_divide(d, self.imag.$denominator()))); + }); + + $def(self, '$polar', function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }); + + $def(self, '$rationalize', function $$rationalize(eps) { + var self = this; + + if (arguments.length > 1) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + if ($neqeq(self.imag, 0)) { + $Kernel.$raise($$$('RangeError'), "can't convert " + (self) + " into Rational"); + } return self.$real().$rationalize(eps); + }, -1); + + $def(self, '$real?', $return_val(false)); + + $def(self, '$rect', function $$rect() { + var self = this; + + return [self.real, self.imag] + }); + + $def(self, '$to_f', function $$to_f() { + var self = this; + + + if (!$eqeq(self.imag, 0)) { + $Kernel.$raise($$$('RangeError'), "can't convert " + (self) + " into Float"); + } return self.real.$to_f(); + }); + + $def(self, '$to_i', function $$to_i() { + var self = this; + + + if (!$eqeq(self.imag, 0)) { + $Kernel.$raise($$$('RangeError'), "can't convert " + (self) + " into Integer"); + } return self.real.$to_i(); + }); + + $def(self, '$to_r', function $$to_r() { + var self = this; + + + if (!$eqeq(self.imag, 0)) { + $Kernel.$raise($$$('RangeError'), "can't convert " + (self) + " into Rational"); + } return self.real.$to_r(); + }); + + $def(self, '$to_s', function $$to_s() { + var self = this, result = nil; + + + result = self.real.$inspect(); + result = $rb_plus(result, (((($eqeqeq($$$('Number'), self.imag) && ($truthy(self.imag['$nan?']()))) || ($truthy(self.imag['$positive?']()))) || ($truthy(self.imag['$zero?']()))) ? ("+") : ("-"))); + result = $rb_plus(result, self.imag.$abs().$inspect()); + if (($eqeqeq($$$('Number'), self.imag) && (($truthy(self.imag['$nan?']()) || ($truthy(self.imag['$infinite?']())))))) { + result = $rb_plus(result, "*"); + } return $rb_plus(result, "i"); + }); + $const_set($nesting[0], 'I', self.$new(0, 1)); + $defs(self, '$from_string', function $$from_string(str) { + + + var re = /[+-]?[\d_]+(\.[\d_]+)?(e\d+)?/; + str.match(re); + var real, imag; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + // handles both floats and rationals + function cutNumber() { + if (isFloat()) { + var numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + var denominator = parseFloat(cutFloat()); + return $Kernel.$Rational(numerator, denominator); + } else { + // reverting '/' + str = '/' + str; + return numerator; + } + } else { + // float real part, no denominator + return numerator; + } + } else { + return null; + } + } + + real = cutNumber(); + + if (!real) { + if (str[0] === 'i') { + // i => Complex(0, 1) + return $Kernel.$Complex(0, 1); + } + if (str[0] === '-' && str[1] === 'i') { + // -i => Complex(0, -1) + return $Kernel.$Complex(0, -1); + } + if (str[0] === '+' && str[1] === 'i') { + // +i => Complex(0, 1) + return $Kernel.$Complex(0, 1); + } + // anything => Complex(0, 0) + return $Kernel.$Complex(0, 0); + } + + imag = cutNumber(); + if (!imag) { + if (str[0] === 'i') { + // 3i => Complex(0, 3) + return $Kernel.$Complex(0, real); + } else { + // 3 => Complex(3, 0) + return $Kernel.$Complex(real, 0); + } + } else { + // 3+2i => Complex(3, 2) + return $Kernel.$Complex(real, imag); + } + + }); + (function(self, $parent_nesting) { + + return $alias(self, "rectangular", "rect") + })(Opal.get_singleton_class(self)); + $alias(self, "arg", "angle"); + $alias(self, "conjugate", "conj"); + $alias(self, "divide", "/"); + $alias(self, "imaginary", "imag"); + $alias(self, "magnitude", "abs"); + $alias(self, "phase", "arg"); + $alias(self, "quo", "/"); + $alias(self, "rectangular", "rect"); + + Opal.udef(self, '$' + "negative?"); + Opal.udef(self, '$' + "positive?"); + + Opal.udef(self, '$' + "step"); return nil; })('::', $$$('Numeric'), $nesting); + }; + + Opal.modules["corelib/rational/base"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $def = Opal.def, $klass = Opal.klass; Opal.nil; var $$$ = Opal.$$$; + + Opal.add_stubs('convert,from_string'); + + (function($base) { + var self = $module($base, 'Kernel'); + + + return $def(self, '$Rational', function $$Rational(numerator, denominator) { + + + if (denominator == null) denominator = 1; + return $$$('Rational').$convert(numerator, denominator); + }, -2) + })('::'); + return (function($base, $super) { + var self = $klass($base, $super, 'String'); + + + return $def(self, '$to_r', function $$to_r() { + var self = this; + + return $$$('Rational').$from_string(self) + }) + })('::', null); + }; + + Opal.modules["corelib/rational"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $eqeq = Opal.eqeq, $Kernel = Opal.Kernel, $truthy = Opal.truthy, $rb_lt = Opal.rb_lt, $rb_divide = Opal.rb_divide, $defs = Opal.defs, $eqeqeq = Opal.eqeqeq, $not = Opal.not, $Opal = Opal.Opal, $def = Opal.def, $return_ivar = Opal.return_ivar, $rb_minus = Opal.rb_minus, $rb_times = Opal.rb_times, $rb_plus = Opal.rb_plus, $rb_gt = Opal.rb_gt, $rb_le = Opal.rb_le, $return_self = Opal.return_self, $alias = Opal.alias, self = Opal.top, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,to_i,==,raise,<,-@,new,gcd,/,nil?,===,reduce,to_r,!,equal?,coerce_to!,freeze,to_f,numerator,denominator,<=>,-,*,__coerced__,+,Rational,>,**,abs,ceil,with_precision,floor,<=,truncate,send'); + + self.$require("corelib/numeric"); + self.$require("corelib/rational/base"); + return (function($base, $super) { + var self = $klass($base, $super, 'Rational'); + + var $proto = self.$$prototype; + + $proto.num = $proto.den = nil; + + $defs(self, '$reduce', function $$reduce(num, den) { + var self = this, gcd = nil; + + + num = num.$to_i(); + den = den.$to_i(); + if ($eqeq(den, 0)) { + $Kernel.$raise($$$('ZeroDivisionError'), "divided by 0"); + } else if ($truthy($rb_lt(den, 0))) { + + num = num['$-@'](); + den = den['$-@'](); + } else if ($eqeq(den, 1)) { + return self.$new(num, den) + } gcd = num.$gcd(den); + return self.$new($rb_divide(num, gcd), $rb_divide(den, gcd)); + }); + $defs(self, '$convert', function $$convert(num, den) { + var self = this; + + + if (($truthy(num['$nil?']()) || ($truthy(den['$nil?']())))) { + $Kernel.$raise($$$('TypeError'), "cannot convert nil into Rational"); + } if (($eqeqeq($$$('Integer'), num) && ($eqeqeq($$$('Integer'), den)))) { + return self.$reduce(num, den) + } if ((($eqeqeq($$$('Float'), num) || ($eqeqeq($$$('String'), num))) || ($eqeqeq($$$('Complex'), num)))) { + num = num.$to_r(); + } if ((($eqeqeq($$$('Float'), den) || ($eqeqeq($$$('String'), den))) || ($eqeqeq($$$('Complex'), den)))) { + den = den.$to_r(); + } if (($truthy(den['$equal?'](1)) && ($not($$$('Integer')['$==='](num))))) { + return $Opal['$coerce_to!'](num, $$$('Rational'), "to_r") + } else if (($eqeqeq($$$('Numeric'), num) && ($eqeqeq($$$('Numeric'), den)))) { + return $rb_divide(num, den) + } else { + return self.$reduce(num, den) + } }); + + $def(self, '$initialize', function $$initialize(num, den) { + var self = this; + + + self.num = num; + self.den = den; + return self.$freeze(); + }); + + $def(self, '$numerator', $return_ivar("num")); + + $def(self, '$denominator', $return_ivar("den")); + + $def(self, '$coerce', function $$coerce(other) { + var self = this, $ret_or_1 = nil; + + if ($eqeqeq($$$('Rational'), ($ret_or_1 = other))) { + return [other, self] + } else if ($eqeqeq($$$('Integer'), $ret_or_1)) { + return [other.$to_r(), self] + } else if ($eqeqeq($$$('Float'), $ret_or_1)) { + return [other, self.$to_f()] + } else { + return nil + } + }); + + $def(self, '$==', function $Rational_$eq_eq$1(other) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + if ($eqeqeq($$$('Rational'), ($ret_or_1 = other))) { + if ($truthy(($ret_or_2 = self.num['$=='](other.$numerator())))) { + return self.den['$=='](other.$denominator()) + } else { + return $ret_or_2 + } + } else if ($eqeqeq($$$('Integer'), $ret_or_1)) { + if ($truthy(($ret_or_2 = self.num['$=='](other)))) { + return self.den['$=='](1) + } else { + return $ret_or_2 + } + } else if ($eqeqeq($$$('Float'), $ret_or_1)) { + return self.$to_f()['$=='](other) + } else { + return other['$=='](self) + } + }); + + $def(self, '$<=>', function $Rational_$lt_eq_gt$2(other) { + var self = this, $ret_or_1 = nil; + + if ($eqeqeq($$$('Rational'), ($ret_or_1 = other))) { + return $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator()))['$<=>'](0) + } else if ($eqeqeq($$$('Integer'), $ret_or_1)) { + return $rb_minus(self.num, $rb_times(self.den, other))['$<=>'](0) + } else if ($eqeqeq($$$('Float'), $ret_or_1)) { + return self.$to_f()['$<=>'](other) + } else { + return self.$__coerced__("<=>", other) + } + }); + + $def(self, '$+', function $Rational_$plus$3(other) { + var self = this, $ret_or_1 = nil, num = nil, den = nil; + + if ($eqeqeq($$$('Rational'), ($ret_or_1 = other))) { + + num = $rb_plus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return $Kernel.$Rational(num, den); + } else if ($eqeqeq($$$('Integer'), $ret_or_1)) { + return $Kernel.$Rational($rb_plus(self.num, $rb_times(other, self.den)), self.den) + } else if ($eqeqeq($$$('Float'), $ret_or_1)) { + return $rb_plus(self.$to_f(), other) + } else { + return self.$__coerced__("+", other) + } + }); + + $def(self, '$-', function $Rational_$minus$4(other) { + var self = this, $ret_or_1 = nil, num = nil, den = nil; + + if ($eqeqeq($$$('Rational'), ($ret_or_1 = other))) { + + num = $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return $Kernel.$Rational(num, den); + } else if ($eqeqeq($$$('Integer'), $ret_or_1)) { + return $Kernel.$Rational($rb_minus(self.num, $rb_times(other, self.den)), self.den) + } else if ($eqeqeq($$$('Float'), $ret_or_1)) { + return $rb_minus(self.$to_f(), other) + } else { + return self.$__coerced__("-", other) + } + }); + + $def(self, '$*', function $Rational_$$5(other) { + var self = this, $ret_or_1 = nil, num = nil, den = nil; + + if ($eqeqeq($$$('Rational'), ($ret_or_1 = other))) { + + num = $rb_times(self.num, other.$numerator()); + den = $rb_times(self.den, other.$denominator()); + return $Kernel.$Rational(num, den); + } else if ($eqeqeq($$$('Integer'), $ret_or_1)) { + return $Kernel.$Rational($rb_times(self.num, other), self.den) + } else if ($eqeqeq($$$('Float'), $ret_or_1)) { + return $rb_times(self.$to_f(), other) + } else { + return self.$__coerced__("*", other) + } + }); + + $def(self, '$/', function $Rational_$slash$6(other) { + var self = this, $ret_or_1 = nil, num = nil, den = nil; + + if ($eqeqeq($$$('Rational'), ($ret_or_1 = other))) { + + num = $rb_times(self.num, other.$denominator()); + den = $rb_times(self.den, other.$numerator()); + return $Kernel.$Rational(num, den); + } else if ($eqeqeq($$$('Integer'), $ret_or_1)) { + if ($eqeq(other, 0)) { + return $rb_divide(self.$to_f(), 0.0) + } else { + return $Kernel.$Rational(self.num, $rb_times(self.den, other)) + } + } else if ($eqeqeq($$$('Float'), $ret_or_1)) { + return $rb_divide(self.$to_f(), other) + } else { + return self.$__coerced__("/", other) + } + }); + + $def(self, '$**', function $Rational_$$$7(other) { + var self = this, $ret_or_1 = nil; + + if ($eqeqeq($$$('Integer'), ($ret_or_1 = other))) { + if (($eqeq(self, 0) && ($truthy($rb_lt(other, 0))))) { + return $$$($$$('Float'), 'INFINITY') + } else if ($truthy($rb_gt(other, 0))) { + return $Kernel.$Rational(self.num['$**'](other), self.den['$**'](other)) + } else if ($truthy($rb_lt(other, 0))) { + return $Kernel.$Rational(self.den['$**'](other['$-@']()), self.num['$**'](other['$-@']())) + } else { + return $Kernel.$Rational(1, 1) + } + } else if ($eqeqeq($$$('Float'), $ret_or_1)) { + return self.$to_f()['$**'](other) + } else if ($eqeqeq($$$('Rational'), $ret_or_1)) { + if ($eqeq(other, 0)) { + return $Kernel.$Rational(1, 1) + } else if ($eqeq(other.$denominator(), 1)) { + if ($truthy($rb_lt(other, 0))) { + return $Kernel.$Rational(self.den['$**'](other.$numerator().$abs()), self.num['$**'](other.$numerator().$abs())) + } else { + return $Kernel.$Rational(self.num['$**'](other.$numerator()), self.den['$**'](other.$numerator())) + } + } else if (($eqeq(self, 0) && ($truthy($rb_lt(other, 0))))) { + return $Kernel.$raise($$$('ZeroDivisionError'), "divided by 0") + } else { + return self.$to_f()['$**'](other) + } + } else { + return self.$__coerced__("**", other) + } + }); + + $def(self, '$abs', function $$abs() { + var self = this; + + return $Kernel.$Rational(self.num.$abs(), self.den.$abs()) + }); + + $def(self, '$ceil', function $$ceil(precision) { + var self = this; + + + if (precision == null) precision = 0; + if ($eqeq(precision, 0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$ceil() + } else { + return self.$with_precision("ceil", precision) + } }, -1); + + $def(self, '$floor', function $$floor(precision) { + var self = this; + + + if (precision == null) precision = 0; + if ($eqeq(precision, 0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$floor() + } else { + return self.$with_precision("floor", precision) + } }, -1); + + $def(self, '$hash', function $$hash() { + var self = this; + + return "Rational:" + (self.num) + ":" + (self.den) + }); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + return "(" + (self) + ")" + }); + + $def(self, '$rationalize', function $$rationalize(eps) { + var self = this; + + if (arguments.length > 1) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + + if (eps == null) { + return self; + } + + var e = eps.$abs(), + a = $rb_minus(self, e), + b = $rb_plus(self, e); + + var p0 = 0, + p1 = 1, + q0 = 1, + q1 = 0, + p2, q2; + + var c, k, t; + + while (true) { + c = (a).$ceil(); + + if ($rb_le(c, b)) { + break; + } + + k = c - 1; + p2 = k * p1 + p0; + q2 = k * q1 + q0; + t = $rb_divide(1, $rb_minus(b, k)); + b = $rb_divide(1, $rb_minus(a, k)); + a = t; + + p0 = p1; + q0 = q1; + p1 = p2; + q1 = q2; + } + + return $Kernel.$Rational(c * p1 + p0, c * q1 + q0); + }, -1); + + $def(self, '$round', function $$round(precision) { + var self = this, num = nil, den = nil, approx = nil; + + + if (precision == null) precision = 0; + if (!$eqeq(precision, 0)) { + return self.$with_precision("round", precision) + } if ($eqeq(self.num, 0)) { + return 0 + } if ($eqeq(self.den, 1)) { + return self.num + } num = $rb_plus($rb_times(self.num.$abs(), 2), self.den); + den = $rb_times(self.den, 2); + approx = $rb_divide(num, den).$truncate(); + if ($truthy($rb_lt(self.num, 0))) { + return approx['$-@']() + } else { + return approx + } }, -1); + + $def(self, '$to_f', function $$to_f() { + var self = this; + + return $rb_divide(self.num, self.den) + }); + + $def(self, '$to_i', function $$to_i() { + var self = this; + + return self.$truncate() + }); + + $def(self, '$to_r', $return_self); + + $def(self, '$to_s', function $$to_s() { + var self = this; + + return "" + (self.num) + "/" + (self.den) + }); + + $def(self, '$truncate', function $$truncate(precision) { + var self = this; + + + if (precision == null) precision = 0; + if ($eqeq(precision, 0)) { + if ($truthy($rb_lt(self.num, 0))) { + return self.$ceil() + } else { + return self.$floor() + } + } else { + return self.$with_precision("truncate", precision) + } }, -1); + + $def(self, '$with_precision', function $$with_precision(method, precision) { + var self = this, p = nil, s = nil; + + + if (!$eqeqeq($$$('Integer'), precision)) { + $Kernel.$raise($$$('TypeError'), "not an Integer"); + } p = (10)['$**'](precision); + s = $rb_times(self, p); + if ($truthy($rb_lt(precision, 1))) { + return $rb_divide(s.$send(method), p).$to_i() + } else { + return $Kernel.$Rational(s.$send(method), p) + } }); + $defs(self, '$from_string', function $$from_string(string) { + + + var str = string.trimLeft(), + re = /^[+-]?[\d_]+(\.[\d_]+)?/; + str.match(re); + var numerator, denominator; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + if (isFloat()) { + numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + denominator = parseFloat(cutFloat()); + return $Kernel.$Rational(numerator, denominator); + } else { + return $Kernel.$Rational(numerator, 1); + } + } else { + return $Kernel.$Rational(numerator, 1); + } + } else { + return $Kernel.$Rational(0, 1); + } + + }); + $alias(self, "divide", "/"); + return $alias(self, "quo", "/"); + })('::', $$$('Numeric')); + }; + + Opal.modules["corelib/time"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $slice = Opal.slice, $deny_frozen_access = Opal.deny_frozen_access, $klass = Opal.klass, $Kernel = Opal.Kernel, $Opal = Opal.Opal, $defs = Opal.defs, $eqeqeq = Opal.eqeqeq, $def = Opal.def, $truthy = Opal.truthy, $rb_gt = Opal.rb_gt, $rb_lt = Opal.rb_lt, $send = Opal.send, $rb_plus = Opal.rb_plus, $rb_divide = Opal.rb_divide, $rb_minus = Opal.rb_minus, $range = Opal.range, $neqeq = Opal.neqeq, $rb_le = Opal.rb_le, $eqeq = Opal.eqeq, $alias = Opal.alias, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,include,===,raise,coerce_to!,respond_to?,to_str,to_i,_parse_offset,new,<=>,to_f,nil?,>,<,strftime,each,define_method,year,month,day,+,round,/,-,copy_instance_variables,initialize_dup,is_a?,zero?,wday,utc?,mon,yday,hour,min,sec,rjust,ljust,zone,to_s,[],cweek_cyear,jd,to_date,format,isdst,!=,<=,==,ceil,local,gm,asctime,getgm,gmt_offset,inspect,usec,gmtime,gmt?'); + + self.$require("corelib/comparable"); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Time'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$$('Comparable')); + + var days_of_week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + short_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + short_months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + long_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + $defs(self, '$at', function $$at(seconds, frac) { + + var result; + + if ($$$('Time')['$==='](seconds)) { + if (frac !== undefined) { + $Kernel.$raise($$$('TypeError'), "can't convert Time into an exact number"); + } + result = new Date(seconds.getTime()); + result.timezone = seconds.timezone; + return result; + } + + if (!seconds.$$is_number) { + seconds = $Opal['$coerce_to!'](seconds, $$$('Integer'), "to_int"); + } + + if (frac === undefined) { + return new Date(seconds * 1000); + } + + if (!frac.$$is_number) { + frac = $Opal['$coerce_to!'](frac, $$$('Integer'), "to_int"); + } + + return new Date(seconds * 1000 + (frac / 1000)); + }, -2); + + function time_params(year, month, day, hour, min, sec) { + if (year.$$is_string) { + year = parseInt(year, 10); + } else { + year = $Opal['$coerce_to!'](year, $$$('Integer'), "to_int"); + } + + if (month === nil) { + month = 1; + } else if (!month.$$is_number) { + if ((month)['$respond_to?']("to_str")) { + month = (month).$to_str(); + switch (month.toLowerCase()) { + case 'jan': month = 1; break; + case 'feb': month = 2; break; + case 'mar': month = 3; break; + case 'apr': month = 4; break; + case 'may': month = 5; break; + case 'jun': month = 6; break; + case 'jul': month = 7; break; + case 'aug': month = 8; break; + case 'sep': month = 9; break; + case 'oct': month = 10; break; + case 'nov': month = 11; break; + case 'dec': month = 12; break; + default: month = (month).$to_i(); + } + } else { + month = $Opal['$coerce_to!'](month, $$$('Integer'), "to_int"); + } + } + + if (month < 1 || month > 12) { + $Kernel.$raise($$$('ArgumentError'), "month out of range: " + (month)); + } + month = month - 1; + + if (day === nil) { + day = 1; + } else if (day.$$is_string) { + day = parseInt(day, 10); + } else { + day = $Opal['$coerce_to!'](day, $$$('Integer'), "to_int"); + } + + if (day < 1 || day > 31) { + $Kernel.$raise($$$('ArgumentError'), "day out of range: " + (day)); + } + + if (hour === nil) { + hour = 0; + } else if (hour.$$is_string) { + hour = parseInt(hour, 10); + } else { + hour = $Opal['$coerce_to!'](hour, $$$('Integer'), "to_int"); + } + + if (hour < 0 || hour > 24) { + $Kernel.$raise($$$('ArgumentError'), "hour out of range: " + (hour)); + } + + if (min === nil) { + min = 0; + } else if (min.$$is_string) { + min = parseInt(min, 10); + } else { + min = $Opal['$coerce_to!'](min, $$$('Integer'), "to_int"); + } + + if (min < 0 || min > 59) { + $Kernel.$raise($$$('ArgumentError'), "min out of range: " + (min)); + } + + if (sec === nil) { + sec = 0; + } else if (!sec.$$is_number) { + if (sec.$$is_string) { + sec = parseInt(sec, 10); + } else { + sec = $Opal['$coerce_to!'](sec, $$$('Integer'), "to_int"); + } + } + + if (sec < 0 || sec > 60) { + $Kernel.$raise($$$('ArgumentError'), "sec out of range: " + (sec)); + } + + return [year, month, day, hour, min, sec]; + } + $defs(self, '$new', function $Time_new$1(year, month, day, hour, min, sec, utc_offset) { + var self = this; + if (month == null) month = nil; + if (day == null) day = nil; + if (hour == null) hour = nil; + if (min == null) min = nil; + if (sec == null) sec = nil; + if (utc_offset == null) utc_offset = nil; + + var args, result, timezone, utc_date; + + if (year === undefined) { + return new Date(); + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + if (utc_offset === nil) { + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + } + + timezone = self.$_parse_offset(utc_offset); + utc_date = new Date(Date.UTC(year, month, day, hour, min, 0, sec * 1000)); + if (year < 100) { + utc_date.setUTCFullYear(year); + } + + result = new Date(utc_date.getTime() - timezone * 3600000); + result.timezone = timezone; + + return result; + }, -1); + $defs(self, '$_parse_offset', function $$_parse_offset(utc_offset) { + + + var timezone; + if (utc_offset.$$is_string) { + if (utc_offset == 'UTC') { + timezone = 0; + } + else if(/^[+-]\d\d:[0-5]\d$/.test(utc_offset)) { + var sign, hours, minutes; + sign = utc_offset[0]; + hours = +(utc_offset[1] + utc_offset[2]); + minutes = +(utc_offset[4] + utc_offset[5]); + + timezone = (sign == '-' ? -1 : 1) * (hours + minutes / 60); + } + else { + // Unsupported: "A".."I","K".."Z" + $Kernel.$raise($$$('ArgumentError'), "\"+HH:MM\", \"-HH:MM\", \"UTC\" expected for utc_offset: " + (utc_offset)); + } + } + else if (utc_offset.$$is_number) { + timezone = utc_offset / 3600; + } + else { + $Kernel.$raise($$$('ArgumentError'), "Opal doesn't support other types for a timezone argument than Integer and String"); + } + return timezone; + + }); + $defs(self, '$local', function $$local(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + + + if (month == null) month = nil; + if (day == null) day = nil; + if (hour == null) hour = nil; + if (min == null) min = nil; + if (sec == null) sec = nil; + if (millisecond == null) millisecond = nil; + if (_dummy1 == null) _dummy1 = nil; + if (_dummy2 == null) _dummy2 = nil; + if (_dummy3 == null) _dummy3 = nil; + + var args, result; + + if (arguments.length === 10) { + args = $slice(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + }, -2); + $defs(self, '$gm', function $$gm(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + + + if (month == null) month = nil; + if (day == null) day = nil; + if (hour == null) hour = nil; + if (min == null) min = nil; + if (sec == null) sec = nil; + if (millisecond == null) millisecond = nil; + if (_dummy1 == null) _dummy1 = nil; + if (_dummy2 == null) _dummy2 = nil; + if (_dummy3 == null) _dummy3 = nil; + + var args, result; + + if (arguments.length === 10) { + args = $slice(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(Date.UTC(year, month, day, hour, min, 0, sec * 1000)); + if (year < 100) { + result.setUTCFullYear(year); + } + result.timezone = 0; + return result; + }, -2); + $defs(self, '$now', function $$now() { + var self = this; + + return self.$new() + }); + + $def(self, '$+', function $Time_$plus$2(other) { + var self = this; + + + if ($eqeqeq($$$('Time'), other)) { + $Kernel.$raise($$$('TypeError'), "time + time?"); + } + if (!other.$$is_number) { + other = $Opal['$coerce_to!'](other, $$$('Integer'), "to_int"); + } + var result = new Date(self.getTime() + (other * 1000)); + result.timezone = self.timezone; + return result; + }); + + $def(self, '$-', function $Time_$minus$3(other) { + var self = this; + + + if ($eqeqeq($$$('Time'), other)) { + return (self.getTime() - other.getTime()) / 1000 + } + if (!other.$$is_number) { + other = $Opal['$coerce_to!'](other, $$$('Integer'), "to_int"); + } + var result = new Date(self.getTime() - (other * 1000)); + result.timezone = self.timezone; + return result; + }); + + $def(self, '$<=>', function $Time_$lt_eq_gt$4(other) { + var self = this, r = nil; + + if ($eqeqeq($$$('Time'), other)) { + return self.$to_f()['$<=>'](other.$to_f()) + } else { + + r = other['$<=>'](self); + if ($truthy(r['$nil?']())) { + return nil + } else if ($truthy($rb_gt(r, 0))) { + return -1 + } else if ($truthy($rb_lt(r, 0))) { + return 1 + } else { + return 0 + } } + }); + + $def(self, '$==', function $Time_$eq_eq$5(other) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = $$$('Time')['$==='](other)))) { + return self.$to_f() === other.$to_f() + } else { + return $ret_or_1 + } + }); + + $def(self, '$asctime', function $$asctime() { + var self = this; + + return self.$strftime("%a %b %e %H:%M:%S %Y") + }); + $send([["year", "getFullYear", "getUTCFullYear"], ["mon", "getMonth", "getUTCMonth", 1], ["wday", "getDay", "getUTCDay"], ["day", "getDate", "getUTCDate"], ["hour", "getHours", "getUTCHours"], ["min", "getMinutes", "getUTCMinutes"], ["sec", "getSeconds", "getUTCSeconds"]], 'each', [], function $Time$6(method, getter, utcgetter, difference){var self = $Time$6.$$s == null ? this : $Time$6.$$s; + + + if (method == null) method = nil; + if (getter == null) getter = nil; + if (utcgetter == null) utcgetter = nil; + if (difference == null) difference = 0; + return $send(self, 'define_method', [method], function $$7(){var self = $$7.$$s == null ? this : $$7.$$s; + + + return difference + ((self.timezone != null) ? + (new Date(self.getTime() + self.timezone * 3600000))[utcgetter]() : + self[getter]()) + }, {$$s: self});}, {$$arity: -4, $$s: self}); + + $def(self, '$yday', function $$yday() { + var self = this, start_of_year = nil, start_of_day = nil, one_day = nil; + + + start_of_year = $$('Time').$new(self.$year()).$to_i(); + start_of_day = $$('Time').$new(self.$year(), self.$month(), self.$day()).$to_i(); + one_day = 86400; + return $rb_plus($rb_divide($rb_minus(start_of_day, start_of_year), one_day).$round(), 1); + }); + + $def(self, '$isdst', function $$isdst() { + var self = this; + + + var jan = new Date(self.getFullYear(), 0, 1), + jul = new Date(self.getFullYear(), 6, 1); + return self.getTimezoneOffset() < Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); + + }); + + $def(self, '$dup', function $$dup() { + var self = this, copy = nil; + + + copy = new Date(self.getTime()); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }); + + $def(self, '$eql?', function $Time_eql$ques$8(other) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = other['$is_a?']($$$('Time'))))) { + return self['$<=>'](other)['$zero?']() + } else { + return $ret_or_1 + } + }); + $send([["sunday?", 0], ["monday?", 1], ["tuesday?", 2], ["wednesday?", 3], ["thursday?", 4], ["friday?", 5], ["saturday?", 6]], 'each', [], function $Time$9(method, weekday){var self = $Time$9.$$s == null ? this : $Time$9.$$s; + + + if (method == null) method = nil; + if (weekday == null) weekday = nil; + return $send(self, 'define_method', [method], function $$10(){var self = $$10.$$s == null ? this : $$10.$$s; + + return self.$wday() === weekday}, {$$s: self});}, {$$s: self}); + + $def(self, '$hash', function $$hash() { + var self = this; + + return 'Time:' + self.getTime(); + }); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + if ($truthy(self['$utc?']())) { + return self.$strftime("%Y-%m-%d %H:%M:%S UTC") + } else { + return self.$strftime("%Y-%m-%d %H:%M:%S %z") + } + }); + + $def(self, '$succ', function $$succ() { + var self = this; + + + var result = new Date(self.getTime() + 1000); + result.timezone = self.timezone; + return result; + + }); + + $def(self, '$usec', function $$usec() { + var self = this; + + return self.getMilliseconds() * 1000; + }); + + $def(self, '$zone', function $$zone() { + var self = this; + + + if (self.timezone === 0) return "UTC"; + else if (self.timezone != null) return nil; + + var string = self.toString(), + result; + + if (string.indexOf('(') == -1) { + result = string.match(/[A-Z]{3,4}/)[0]; + } + else { + result = string.match(/\((.+)\)(?:\s|$)/)[1]; + } + + if (result == "GMT" && /(GMT\W*\d{4})/.test(string)) { + return RegExp.$1; + } + else { + return result; + } + + }); + + $def(self, '$getgm', function $$getgm() { + var self = this; + + + var result = new Date(self.getTime()); + result.timezone = 0; + return result; + + }); + + $def(self, '$gmtime', function $$gmtime() { + var self = this; + + + if (self.timezone !== 0) { + $deny_frozen_access(self); + self.timezone = 0; + } + return self; + + }); + + $def(self, '$gmt?', function $Time_gmt$ques$11() { + var self = this; + + return self.timezone === 0; + }); + + $def(self, '$gmt_offset', function $$gmt_offset() { + var self = this; + + return (self.timezone != null) ? self.timezone * 60 : -self.getTimezoneOffset() * 60; + }); + + $def(self, '$strftime', function $$strftime(format) { + var self = this; + + + return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) { + var result = "", jd, c, s, + zero = flags.indexOf('0') !== -1, + pad = flags.indexOf('-') === -1, + blank = flags.indexOf('_') !== -1, + upcase = flags.indexOf('^') !== -1, + invert = flags.indexOf('#') !== -1, + colons = (flags.match(':') || []).length; + + width = parseInt(width, 10); + + if (zero && blank) { + if (flags.indexOf('0') < flags.indexOf('_')) { + zero = false; + } + else { + blank = false; + } + } + + switch (conv) { + case 'Y': + result += self.$year(); + break; + + case 'C': + zero = !blank; + result += Math.round(self.$year() / 100); + break; + + case 'y': + zero = !blank; + result += (self.$year() % 100); + break; + + case 'm': + zero = !blank; + result += self.$mon(); + break; + + case 'B': + result += long_months[self.$mon() - 1]; + break; + + case 'b': + case 'h': + blank = !zero; + result += short_months[self.$mon() - 1]; + break; + + case 'd': + zero = !blank; + result += self.$day(); + break; + + case 'e': + blank = !zero; + result += self.$day(); + break; + + case 'j': + zero = !blank; + width = isNaN(width) ? 3 : width; + result += self.$yday(); + break; + + case 'H': + zero = !blank; + result += self.$hour(); + break; + + case 'k': + blank = !zero; + result += self.$hour(); + break; + + case 'I': + zero = !blank; + result += (self.$hour() % 12 || 12); + break; + + case 'l': + blank = !zero; + result += (self.$hour() % 12 || 12); + break; + + case 'P': + result += (self.$hour() >= 12 ? "pm" : "am"); + break; + + case 'p': + result += (self.$hour() >= 12 ? "PM" : "AM"); + break; + + case 'M': + zero = !blank; + result += self.$min(); + break; + + case 'S': + zero = !blank; + result += self.$sec(); + break; + + case 'L': + zero = !blank; + width = isNaN(width) ? 3 : width; + result += self.getMilliseconds(); + break; + + case 'N': + width = isNaN(width) ? 9 : width; + result += (self.getMilliseconds().toString()).$rjust(3, "0"); + result = (result).$ljust(width, "0"); + break; + + case 'z': + var offset = (self.timezone == null) ? self.getTimezoneOffset() : (-self.timezone * 60), + hours = Math.floor(Math.abs(offset) / 60), + minutes = Math.abs(offset) % 60; + + result += offset < 0 ? "+" : "-"; + result += hours < 10 ? "0" : ""; + result += hours; + + if (colons > 0) { + result += ":"; + } + + result += minutes < 10 ? "0" : ""; + result += minutes; + + if (colons > 1) { + result += ":00"; + } + + break; + + case 'Z': + result += self.$zone(); + break; + + case 'A': + result += days_of_week[self.$wday()]; + break; + + case 'a': + result += short_days[self.$wday()]; + break; + + case 'u': + result += (self.$wday() + 1); + break; + + case 'w': + result += self.$wday(); + break; + + case 'V': + result += self.$cweek_cyear()['$[]'](0).$to_s().$rjust(2, "0"); + break; + + case 'G': + result += self.$cweek_cyear()['$[]'](1); + break; + + case 'g': + result += self.$cweek_cyear()['$[]'](1)['$[]']($range(-2, -1, false)); + break; + + case 's': + result += self.$to_i(); + break; + + case 'n': + result += "\n"; + break; + + case 't': + result += "\t"; + break; + + case '%': + result += "%"; + break; + + case 'c': + result += self.$strftime("%a %b %e %T %Y"); + break; + + case 'D': + case 'x': + result += self.$strftime("%m/%d/%y"); + break; + + case 'F': + result += self.$strftime("%Y-%m-%d"); + break; + + case 'v': + result += self.$strftime("%e-%^b-%4Y"); + break; + + case 'r': + result += self.$strftime("%I:%M:%S %p"); + break; + + case 'R': + result += self.$strftime("%H:%M"); + break; + + case 'T': + case 'X': + result += self.$strftime("%H:%M:%S"); + break; + + // Non-standard: JIS X 0301 date format + case 'J': + jd = self.$to_date().$jd(); + if (jd < 2405160) { + result += self.$strftime("%Y-%m-%d"); + break; + } + else if (jd < 2419614) + c = 'M', s = 1867; + else if (jd < 2424875) + c = 'T', s = 1911; + else if (jd < 2447535) + c = 'S', s = 1925; + else if (jd < 2458605) + c = 'H', s = 1988; + else + c = 'R', s = 2018; + + result += self.$format("%c%02d", c, $rb_minus(self.$year(), s)); + result += self.$strftime("-%m-%d"); + break; + + default: + return full; + } + + if (upcase) { + result = result.toUpperCase(); + } + + if (invert) { + result = result.replace(/[A-Z]/, function(c) { c.toLowerCase(); }). + replace(/[a-z]/, function(c) { c.toUpperCase(); }); + } + + if (pad && (zero || blank)) { + result = (result).$rjust(isNaN(width) ? 2 : width, blank ? " " : "0"); + } + + return result; + }); + + }); + + $def(self, '$to_a', function $$to_a() { + var self = this; + + return [self.$sec(), self.$min(), self.$hour(), self.$day(), self.$month(), self.$year(), self.$wday(), self.$yday(), self.$isdst(), self.$zone()] + }); + + $def(self, '$to_f', function $$to_f() { + var self = this; + + return self.getTime() / 1000; + }); + + $def(self, '$to_i', function $$to_i() { + var self = this; + + return parseInt(self.getTime() / 1000, 10); + }); + + $def(self, '$cweek_cyear', function $$cweek_cyear() { + var self = this, jan01 = nil, jan01_wday = nil, year = nil, offset = nil, week = nil, dec31 = nil, dec31_wday = nil; + + + jan01 = $$$('Time').$new(self.$year(), 1, 1); + jan01_wday = jan01.$wday(); + year = self.$year(); + if (($truthy($rb_le(jan01_wday, 4)) && ($neqeq(jan01_wday, 0)))) { + offset = $rb_minus(jan01_wday, 1); + } else { + + offset = $rb_minus($rb_minus(jan01_wday, 7), 1); + if ($eqeq(offset, -8)) { + offset = -1; + } } week = $rb_divide($rb_plus(self.$yday(), offset), 7.0).$ceil(); + if ($truthy($rb_le(week, 0))) { + return $$$('Time').$new($rb_minus(self.$year(), 1), 12, 31).$cweek_cyear() + } else if ($eqeq(week, 53)) { + + dec31 = $$$('Time').$new(self.$year(), 12, 31); + dec31_wday = dec31.$wday(); + if (($truthy($rb_le(dec31_wday, 3)) && ($neqeq(dec31_wday, 0)))) { + + week = 1; + year = $rb_plus(year, 1); + } } return [week, year]; + }); + (function(self, $parent_nesting) { + + + $alias(self, "mktime", "local"); + return $alias(self, "utc", "gm"); + })(Opal.get_singleton_class(self)); + $alias(self, "ctime", "asctime"); + $alias(self, "dst?", "isdst"); + $alias(self, "getutc", "getgm"); + $alias(self, "gmtoff", "gmt_offset"); + $alias(self, "mday", "day"); + $alias(self, "month", "mon"); + $alias(self, "to_s", "inspect"); + $alias(self, "tv_sec", "to_i"); + $alias(self, "tv_usec", "usec"); + $alias(self, "utc", "gmtime"); + $alias(self, "utc?", "gmt?"); + return $alias(self, "utc_offset", "gmt_offset"); + })('::', Date, $nesting); + }; + + Opal.modules["corelib/struct"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $slice = Opal.slice, $extract_kwargs = Opal.extract_kwargs, $ensure_kwargs = Opal.ensure_kwargs, $truthy = Opal.truthy, $neqeq = Opal.neqeq, $eqeq = Opal.eqeq, $Opal = Opal.Opal, $send = Opal.send, $Class = Opal.Class, $to_a = Opal.to_a, $def = Opal.def, $defs = Opal.defs, $Kernel = Opal.Kernel, $hash2 = Opal.hash2, $rb_gt = Opal.rb_gt, $rb_minus = Opal.rb_minus, $eqeqeq = Opal.eqeqeq, $rb_lt = Opal.rb_lt, $rb_ge = Opal.rb_ge, $rb_plus = Opal.rb_plus, $alias = Opal.alias, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,include,!=,upcase,[],==,class,unshift,const_name!,map,coerce_to!,new,each,define_struct_attribute,allocate,initialize,alias_method,module_eval,to_proc,const_set,raise,<<,members,define_method,instance_eval,last,>,length,-,keys,any?,join,[]=,each_with_index,hash,===,<,-@,size,>=,include?,to_sym,instance_of?,__id__,eql?,enum_for,+,name,each_pair,inspect,to_h,args,each_with_object,flatten,to_a,respond_to?,dig'); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Struct'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$$('Enumerable')); + $defs(self, '$new', function $Struct_new$1(const_name, $a, $b) { + var block = $Struct_new$1.$$p || nil, $post_args, $kwargs, args, keyword_init, self = this, klass = nil; + + $Struct_new$1.$$p = null; + $post_args = $slice(arguments, 1); + $kwargs = $extract_kwargs($post_args); + $kwargs = $ensure_kwargs($kwargs); + args = $post_args; + + keyword_init = $kwargs.$$smap["keyword_init"];if (keyword_init == null) keyword_init = false; + if ($truthy(const_name)) { + if (($eqeq(const_name.$class(), $$$('String')) && ($neqeq(const_name['$[]'](0).$upcase(), const_name['$[]'](0))))) { + + args.$unshift(const_name); + const_name = nil; + } else { + + try { + const_name = $Opal['$const_name!'](const_name); + } catch ($err) { + if (Opal.rescue($err, [$$$('TypeError'), $$$('NameError')])) { + try { + + args.$unshift(const_name); + const_name = nil; + } finally { Opal.pop_exception(); } + } else { throw $err; } + } } + } $send(args, 'map', [], function $$2(arg){ + + if (arg == null) arg = nil; + return $Opal['$coerce_to!'](arg, $$$('String'), "to_str");}); + klass = $send($Class, 'new', [self], function $$3(){var self = $$3.$$s == null ? this : $$3.$$s; + + + $send(args, 'each', [], function $$4(arg){var self = $$4.$$s == null ? this : $$4.$$s; + + + if (arg == null) arg = nil; + return self.$define_struct_attribute(arg);}, {$$s: self}); + return (function(self, $parent_nesting) { + + + + $def(self, '$new', function $new$5($a) { + var $post_args, args, self = this, instance = nil; + + + $post_args = $slice(arguments); + args = $post_args; + instance = self.$allocate(); + instance.$$data = {}; + $send(instance, 'initialize', $to_a(args)); + return instance; + }, -1); + return self.$alias_method("[]", "new"); + })(Opal.get_singleton_class(self));}, {$$s: self}); + if ($truthy(block)) { + $send(klass, 'module_eval', [], block.$to_proc()); + } klass.$$keyword_init = keyword_init; + if ($truthy(const_name)) { + $$$('Struct').$const_set(const_name, klass); + } return klass; + }, -2); + $defs(self, '$define_struct_attribute', function $$define_struct_attribute(name) { + var self = this; + + + if ($eqeq(self, $$$('Struct'))) { + $Kernel.$raise($$$('ArgumentError'), "you cannot define attributes to the Struct class"); + } self.$members()['$<<'](name); + $send(self, 'define_method', [name], function $$6(){var self = $$6.$$s == null ? this : $$6.$$s; + + return self.$$data[name];}, {$$s: self}); + return $send(self, 'define_method', ["" + (name) + "="], function $$7(value){var self = $$7.$$s == null ? this : $$7.$$s; + + + if (value == null) value = nil; + return self.$$data[name] = value;}, {$$s: self}); + }); + $defs(self, '$members', function $$members() { + var self = this, $ret_or_1 = nil; + if (self.members == null) self.members = nil; + + + if ($eqeq(self, $$$('Struct'))) { + $Kernel.$raise($$$('ArgumentError'), "the Struct class has no members"); + } return (self.members = ($truthy(($ret_or_1 = self.members)) ? ($ret_or_1) : ([]))); + }); + $defs(self, '$inherited', function $$inherited(klass) { + var self = this, members = nil; + if (self.members == null) self.members = nil; + + + members = self.members; + return $send(klass, 'instance_eval', [], function $$8(){var self = $$8.$$s == null ? this : $$8.$$s; + + return (self.members = members)}, {$$s: self}); + }); + + $def(self, '$initialize', function $$initialize($a) { + var $post_args, args, self = this, kwargs = nil, $ret_or_1 = nil, extra = nil; + + + $post_args = $slice(arguments); + args = $post_args; + if ($truthy(self.$class().$$keyword_init)) { + + kwargs = ($truthy(($ret_or_1 = args.$last())) ? ($ret_or_1) : ($hash2([], {}))); + if (($truthy($rb_gt(args.$length(), 1)) || ($truthy((args.length === 1 && !kwargs.$$is_hash))))) { + $Kernel.$raise($$$('ArgumentError'), "wrong number of arguments (given " + (args.$length()) + ", expected 0)"); + } extra = $rb_minus(kwargs.$keys(), self.$class().$members()); + if ($truthy(extra['$any?']())) { + $Kernel.$raise($$$('ArgumentError'), "unknown keywords: " + (extra.$join(", "))); + } return $send(self.$class().$members(), 'each', [], function $$9(name){var $b, self = $$9.$$s == null ? this : $$9.$$s; + + + if (name == null) name = nil; + return ($b = [name, kwargs['$[]'](name)], $send(self, '[]=', $b), $b[$b.length - 1]);}, {$$s: self}); + } else { + + if ($truthy($rb_gt(args.$length(), self.$class().$members().$length()))) { + $Kernel.$raise($$$('ArgumentError'), "struct size differs"); + } return $send(self.$class().$members(), 'each_with_index', [], function $$10(name, index){var $b, self = $$10.$$s == null ? this : $$10.$$s; + + + if (name == null) name = nil; + if (index == null) index = nil; + return ($b = [name, args['$[]'](index)], $send(self, '[]=', $b), $b[$b.length - 1]);}, {$$s: self}); + } }, -1); + + $def(self, '$initialize_copy', function $$initialize_copy(from) { + var self = this; + + + self.$$data = {}; + var keys = Object.keys(from.$$data), i, max, name; + for (i = 0, max = keys.length; i < max; i++) { + name = keys[i]; + self.$$data[name] = from.$$data[name]; + } + + }); + $defs(self, '$keyword_init?', function $Struct_keyword_init$ques$11() { + var self = this; + + return self.$$keyword_init; + }); + + $def(self, '$members', function $$members() { + var self = this; + + return self.$class().$members() + }); + + $def(self, '$hash', function $$hash() { + var self = this; + + return $$('Hash').$new(self.$$data).$hash() + }); + + $def(self, '$[]', function $Struct_$$$12(name) { + var self = this; + + + if ($eqeqeq($$$('Integer'), name)) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + $Kernel.$raise($$$('IndexError'), "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")"); + } if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + $Kernel.$raise($$$('IndexError'), "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")"); + } name = self.$class().$members()['$[]'](name); + } else if ($eqeqeq($$$('String'), name)) { + + if(!self.$$data.hasOwnProperty(name)) { + $Kernel.$raise($$$('NameError').$new("no member '" + (name) + "' in struct", name)); + } + + } else { + $Kernel.$raise($$$('TypeError'), "no implicit conversion of " + (name.$class()) + " into Integer"); + } name = $Opal['$coerce_to!'](name, $$$('String'), "to_str"); + return self.$$data[name]; }); + + $def(self, '$[]=', function $Struct_$$$eq$13(name, value) { + var self = this; + + + if ($eqeqeq($$$('Integer'), name)) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + $Kernel.$raise($$$('IndexError'), "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")"); + } if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + $Kernel.$raise($$$('IndexError'), "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")"); + } name = self.$class().$members()['$[]'](name); + } else if ($eqeqeq($$$('String'), name)) { + if (!$truthy(self.$class().$members()['$include?'](name.$to_sym()))) { + $Kernel.$raise($$$('NameError').$new("no member '" + (name) + "' in struct", name)); + } + } else { + $Kernel.$raise($$$('TypeError'), "no implicit conversion of " + (name.$class()) + " into Integer"); + } name = $Opal['$coerce_to!'](name, $$$('String'), "to_str"); + return self.$$data[name] = value; }); + + $def(self, '$==', function $Struct_$eq_eq$14(other) { + var self = this; + + + if (!$truthy(other['$instance_of?'](self.$class()))) { + return false + } + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$$('Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + }); + + $def(self, '$eql?', function $Struct_eql$ques$15(other) { + var self = this; + + + if (!$truthy(other['$instance_of?'](self.$class()))) { + return false + } + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$$('Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + }); + + $def(self, '$each', function $$each() { + var $yield = $$each.$$p || nil, self = this; + + $$each.$$p = null; + + if (!($yield !== nil)) { + return $send(self, 'enum_for', ["each"], function $$16(){var self = $$16.$$s == null ? this : $$16.$$s; + + return self.$size()}, {$$s: self}) + } $send(self.$class().$members(), 'each', [], function $$17(name){var self = $$17.$$s == null ? this : $$17.$$s; + + + if (name == null) name = nil; + return Opal.yield1($yield, self['$[]'](name));}, {$$s: self}); + return self; + }); + + $def(self, '$each_pair', function $$each_pair() { + var $yield = $$each_pair.$$p || nil, self = this; + + $$each_pair.$$p = null; + + if (!($yield !== nil)) { + return $send(self, 'enum_for', ["each_pair"], function $$18(){var self = $$18.$$s == null ? this : $$18.$$s; + + return self.$size()}, {$$s: self}) + } $send(self.$class().$members(), 'each', [], function $$19(name){var self = $$19.$$s == null ? this : $$19.$$s; + + + if (name == null) name = nil; + return Opal.yield1($yield, [name, self['$[]'](name)]);}, {$$s: self}); + return self; + }); + + $def(self, '$length', function $$length() { + var self = this; + + return self.$class().$members().$length() + }); + + $def(self, '$to_a', function $$to_a() { + var self = this; + + return $send(self.$class().$members(), 'map', [], function $$20(name){var self = $$20.$$s == null ? this : $$20.$$s; + + + if (name == null) name = nil; + return self['$[]'](name);}, {$$s: self}) + }); + var inspect_stack = []; + + $def(self, '$inspect', function $$inspect() { + var self = this, result = nil, pushed = nil; + + return (function() { try { + + result = "#") + } else { + + (inspect_stack)['$<<'](self.$__id__()); + pushed = true; + if (($eqeqeq($$$('Struct'), self) && ($truthy(self.$class().$name())))) { + result = $rb_plus(result, "" + (self.$class()) + " "); + }; + result = $rb_plus(result, $send(self.$each_pair(), 'map', [], function $$21(name, value){ + + if (name == null) name = nil; + if (value == null) value = nil; + return "" + (name) + "=" + ($$('Opal').$inspect(value));}).$join(", ")); + result = $rb_plus(result, ">"); + return result; + }; + } finally { + ($truthy(pushed) ? (inspect_stack.pop()) : nil); + } })() + }); + + $def(self, '$to_h', function $$to_h() { + var block = $$to_h.$$p || nil, self = this; + + $$to_h.$$p = null; + if ((block !== nil)) { + return $send($send(self, 'map', [], block.$to_proc()), 'to_h', $to_a(self.$args())) + } return $send(self.$class().$members(), 'each_with_object', [$hash2([], {})], function $$22(name, h){var $a, self = $$22.$$s == null ? this : $$22.$$s; + + + if (name == null) name = nil; + if (h == null) h = nil; + return ($a = [name, self['$[]'](name)], $send(h, '[]=', $a), $a[$a.length - 1]);}, {$$s: self}); + }); + + $def(self, '$values_at', function $$values_at($a) { + var $post_args, args, self = this; + + + $post_args = $slice(arguments); + args = $post_args; + args = $send(args, 'map', [], function $$23(arg){ + + if (arg == null) arg = nil; + return arg.$$is_range ? arg.$to_a() : arg;}).$flatten(); + + var result = []; + for (var i = 0, len = args.length; i < len; i++) { + if (!args[i].$$is_number) { + $Kernel.$raise($$$('TypeError'), "no implicit conversion of " + ((args[i]).$class()) + " into Integer"); + } + result.push(self['$[]'](args[i])); + } + return result; + }, -1); + + $def(self, '$dig', function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + $post_args = $slice(arguments, 1); + keys = $post_args; + item = ($truthy(key.$$is_string && self.$$data.hasOwnProperty(key)) ? (self.$$data[key] || nil) : nil); + + if (item === nil || keys.length === 0) { + return item; + } + if (!$truthy(item['$respond_to?']("dig"))) { + $Kernel.$raise($$$('TypeError'), "" + (item.$class()) + " does not have #dig method"); + } return $send(item, 'dig', $to_a(keys)); + }, -2); + $alias(self, "size", "length"); + $alias(self, "to_s", "inspect"); + return $alias(self, "values", "to_a"); + })('::', null, $nesting); + }; + + Opal.modules["corelib/set"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $freeze = Opal.freeze, $klass = Opal.klass, $slice = Opal.slice, $defs = Opal.defs, $hash2 = Opal.hash2, $truthy = Opal.truthy, $eqeqeq = Opal.eqeqeq, $Kernel = Opal.Kernel, $send = Opal.send, $def = Opal.def, $eqeq = Opal.eqeq, $rb_lt = Opal.rb_lt, $rb_le = Opal.rb_le, $alias = Opal.alias, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('include,new,nil?,===,raise,each,add,merge,class,respond_to?,subtract,dup,join,to_a,equal?,instance_of?,==,instance_variable_get,size,is_a?,all?,include?,[]=,enum_for,[],<<,replace,compare_by_identity,name,compare_by_identity?,delete,select,frozen?,freeze,reject,delete_if,to_proc,keep_if,each_key,empty?,eql?,instance_eval,clear,<,<=,any?,!,intersect?,keys,|,proper_subset?,subset?,proper_superset?,superset?,-,select!,collect!'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Set'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $ret_or_1 = nil, $proto = self.$$prototype; + + $proto.hash = nil; + + self.$include($$$('Enumerable')); + $defs(self, '$[]', function $Set_$$$1($a) { + var $post_args, ary, self = this; + + + $post_args = $slice(arguments); + ary = $post_args; + return self.$new(ary); + }, -1); + + $def(self, '$initialize', function $$initialize(enum$) { + var block = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + if (enum$ == null) enum$ = nil; + self.hash = $hash2([], {}); + if ($truthy(enum$['$nil?']())) { + return nil + } if (!$eqeqeq($$$('Enumerable'), enum$)) { + $Kernel.$raise($$$('ArgumentError'), "value must be enumerable"); + } if ($truthy(block)) { + return $send(enum$, 'each', [], function $$2(item){var self = $$2.$$s == null ? this : $$2.$$s; + + + if (item == null) item = nil; + return self.$add(Opal.yield1(block, item));}, {$$s: self}) + } else { + return self.$merge(enum$) + } }, -1); + + $def(self, '$dup', function $$dup() { + var self = this, result = nil; + + + result = self.$class().$new(); + return result.$merge(self); + }); + + $def(self, '$-', function $Set_$minus$3(enum$) { + var self = this; + + + if (!$truthy(enum$['$respond_to?']("each"))) { + $Kernel.$raise($$$('ArgumentError'), "value must be enumerable"); + } return self.$dup().$subtract(enum$); + }); + + $def(self, '$inspect', function $$inspect() { + var self = this; + + return "#" + }); + + $def(self, '$==', function $Set_$eq_eq$4(other) { + var self = this; + + if ($truthy(self['$equal?'](other))) { + return true + } else if ($truthy(other['$instance_of?'](self.$class()))) { + return self.hash['$=='](other.$instance_variable_get("@hash")) + } else if (($truthy(other['$is_a?']($$$('Set'))) && ($eqeq(self.$size(), other.$size())))) { + return $send(other, 'all?', [], function $$5(o){var self = $$5.$$s == null ? this : $$5.$$s; + if (self.hash == null) self.hash = nil; + + + if (o == null) o = nil; + return self.hash['$include?'](o);}, {$$s: self}) + } else { + return false + } + }); + + $def(self, '$add', function $$add(o) { + var self = this; + + + self.hash['$[]='](o, true); + return self; + }); + + $def(self, '$classify', function $$classify() { + var block = $$classify.$$p || nil, self = this, result = nil; + + $$classify.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("classify") + } result = $send($$$('Hash'), 'new', [], function $$6(h, k){var $a, self = $$6.$$s == null ? this : $$6.$$s; + + + if (h == null) h = nil; + if (k == null) k = nil; + return ($a = [k, self.$class().$new()], $send(h, '[]=', $a), $a[$a.length - 1]);}, {$$s: self}); + $send(self, 'each', [], function $$7(item){ + + if (item == null) item = nil; + return result['$[]'](Opal.yield1(block, item)).$add(item);}); + return result; + }); + + $def(self, '$collect!', function $Set_collect$excl$8() { + var block = $Set_collect$excl$8.$$p || nil, self = this, result = nil; + + $Set_collect$excl$8.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("collect!") + } result = self.$class().$new(); + $send(self, 'each', [], function $$9(item){ + + if (item == null) item = nil; + return result['$<<'](Opal.yield1(block, item));}); + return self.$replace(result); + }); + + $def(self, '$compare_by_identity', function $$compare_by_identity() { + var self = this; + + if ($truthy(self.hash['$respond_to?']("compare_by_identity"))) { + + self.hash.$compare_by_identity(); + return self; + } else { + return self.$raise($$('NotImplementedError'), "" + (self.$class().$name()) + "#" + ("compare_by_identity") + " is not implemented") + } + }); + + $def(self, '$compare_by_identity?', function $Set_compare_by_identity$ques$10() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.hash['$respond_to?']("compare_by_identity?")))) { + return self.hash['$compare_by_identity?']() + } else { + return $ret_or_1 + } + }); + + $def(self, '$delete', function $Set_delete$11(o) { + var self = this; + + + self.hash.$delete(o); + return self; + }); + + $def(self, '$delete?', function $Set_delete$ques$12(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + + self.$delete(o); + return self; + } else { + return nil + } + }); + + $def(self, '$delete_if', function $$delete_if() { + var $yield = $$delete_if.$$p || nil, self = this; + + $$delete_if.$$p = null; + + if (!($yield !== nil)) { + return self.$enum_for("delete_if") + } $send($send(self, 'select', [], function $$13(o){ + + if (o == null) o = nil; + return Opal.yield1($yield, o);}), 'each', [], function $$14(o){var self = $$14.$$s == null ? this : $$14.$$s; + if (self.hash == null) self.hash = nil; + + + if (o == null) o = nil; + return self.hash.$delete(o);}, {$$s: self}); + return self; + }); + + $def(self, '$freeze', function $$freeze() { + var self = this; + + + if ($truthy(self['$frozen?']())) { + return self + } self.hash.$freeze(); + return $freeze(self); }); + + $def(self, '$keep_if', function $$keep_if() { + var $yield = $$keep_if.$$p || nil, self = this; + + $$keep_if.$$p = null; + + if (!($yield !== nil)) { + return self.$enum_for("keep_if") + } $send($send(self, 'reject', [], function $$15(o){ + + if (o == null) o = nil; + return Opal.yield1($yield, o);}), 'each', [], function $$16(o){var self = $$16.$$s == null ? this : $$16.$$s; + if (self.hash == null) self.hash = nil; + + + if (o == null) o = nil; + return self.hash.$delete(o);}, {$$s: self}); + return self; + }); + + $def(self, '$reject!', function $Set_reject$excl$17() { + var block = $Set_reject$excl$17.$$p || nil, self = this, before = nil; + + $Set_reject$excl$17.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("reject!") + } before = self.$size(); + $send(self, 'delete_if', [], block.$to_proc()); + if ($eqeq(self.$size(), before)) { + return nil + } else { + return self + } }); + + $def(self, '$select!', function $Set_select$excl$18() { + var block = $Set_select$excl$18.$$p || nil, self = this, before = nil; + + $Set_select$excl$18.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("select!") + } before = self.$size(); + $send(self, 'keep_if', [], block.$to_proc()); + if ($eqeq(self.$size(), before)) { + return nil + } else { + return self + } }); + + $def(self, '$add?', function $Set_add$ques$19(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + return nil + } else { + return self.$add(o) + } + }); + + $def(self, '$each', function $$each() { + var block = $$each.$$p || nil, self = this; + + $$each.$$p = null; + if (!(block !== nil)) { + return self.$enum_for("each") + } $send(self.hash, 'each_key', [], block.$to_proc()); + return self; + }); + + $def(self, '$empty?', function $Set_empty$ques$20() { + var self = this; + + return self.hash['$empty?']() + }); + + $def(self, '$eql?', function $Set_eql$ques$21(other) { + var self = this; + + return self.hash['$eql?']($send(other, 'instance_eval', [], function $$22(){var self = $$22.$$s == null ? this : $$22.$$s; + if (self.hash == null) self.hash = nil; + + return self.hash}, {$$s: self})) + }); + + $def(self, '$clear', function $$clear() { + var self = this; + + + self.hash.$clear(); + return self; + }); + + $def(self, '$include?', function $Set_include$ques$23(o) { + var self = this; + + return self.hash['$include?'](o) + }); + + $def(self, '$merge', function $$merge(enum$) { + var self = this; + + + $send(enum$, 'each', [], function $$24(item){var self = $$24.$$s == null ? this : $$24.$$s; + + + if (item == null) item = nil; + return self.$add(item);}, {$$s: self}); + return self; + }); + + $def(self, '$replace', function $$replace(enum$) { + var self = this; + + + self.$clear(); + self.$merge(enum$); + return self; + }); + + $def(self, '$size', function $$size() { + var self = this; + + return self.hash.$size() + }); + + $def(self, '$subtract', function $$subtract(enum$) { + var self = this; + + + $send(enum$, 'each', [], function $$25(item){var self = $$25.$$s == null ? this : $$25.$$s; + + + if (item == null) item = nil; + return self.$delete(item);}, {$$s: self}); + return self; + }); + + $def(self, '$|', function $Set_$$26(enum$) { + var self = this; + + + if (!$truthy(enum$['$respond_to?']("each"))) { + $Kernel.$raise($$$('ArgumentError'), "value must be enumerable"); + } return self.$dup().$merge(enum$); + }); + + function is_set(set) { + ($truthy(($ret_or_1 = (set)['$is_a?']($$$('Set')))) ? ($ret_or_1) : ($Kernel.$raise($$$('ArgumentError'), "value must be a set"))); + } + + $def(self, '$superset?', function $Set_superset$ques$27(set) { + var self = this; + + + is_set(set); + if ($truthy($rb_lt(self.$size(), set.$size()))) { + return false + } return $send(set, 'all?', [], function $$28(o){var self = $$28.$$s == null ? this : $$28.$$s; + + + if (o == null) o = nil; + return self['$include?'](o);}, {$$s: self}); + }); + + $def(self, '$proper_superset?', function $Set_proper_superset$ques$29(set) { + var self = this; + + + is_set(set); + if ($truthy($rb_le(self.$size(), set.$size()))) { + return false + } return $send(set, 'all?', [], function $$30(o){var self = $$30.$$s == null ? this : $$30.$$s; + + + if (o == null) o = nil; + return self['$include?'](o);}, {$$s: self}); + }); + + $def(self, '$subset?', function $Set_subset$ques$31(set) { + var self = this; + + + is_set(set); + if ($truthy($rb_lt(set.$size(), self.$size()))) { + return false + } return $send(self, 'all?', [], function $$32(o){ + + if (o == null) o = nil; + return set['$include?'](o);}); + }); + + $def(self, '$proper_subset?', function $Set_proper_subset$ques$33(set) { + var self = this; + + + is_set(set); + if ($truthy($rb_le(set.$size(), self.$size()))) { + return false + } return $send(self, 'all?', [], function $$34(o){ + + if (o == null) o = nil; + return set['$include?'](o);}); + }); + + $def(self, '$intersect?', function $Set_intersect$ques$35(set) { + var self = this; + + + is_set(set); + if ($truthy($rb_lt(self.$size(), set.$size()))) { + return $send(self, 'any?', [], function $$36(o){ + + if (o == null) o = nil; + return set['$include?'](o);}) + } else { + return $send(set, 'any?', [], function $$37(o){var self = $$37.$$s == null ? this : $$37.$$s; + + + if (o == null) o = nil; + return self['$include?'](o);}, {$$s: self}) + } }); + + $def(self, '$disjoint?', function $Set_disjoint$ques$38(set) { + var self = this; + + return self['$intersect?'](set)['$!']() + }); + + $def(self, '$to_a', function $$to_a() { + var self = this; + + return self.hash.$keys() + }); + $alias(self, "+", "|"); + $alias(self, "<", "proper_subset?"); + $alias(self, "<<", "add"); + $alias(self, "<=", "subset?"); + $alias(self, ">", "proper_superset?"); + $alias(self, ">=", "superset?"); + $alias(self, "difference", "-"); + $alias(self, "filter!", "select!"); + $alias(self, "length", "size"); + $alias(self, "map!", "collect!"); + $alias(self, "member?", "include?"); + return $alias(self, "union", "|"); + })('::', null, $nesting) + }; + + Opal.modules["corelib/dir"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $def = Opal.def, $truthy = Opal.truthy, $alias = Opal.alias, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('[],pwd'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Dir'); + + return (function(self, $parent_nesting) { + + + + $def(self, '$chdir', function $$chdir(dir) { + var $yield = $$chdir.$$p || nil, prev_cwd = nil; + + $$chdir.$$p = null; + return (function() { try { + + prev_cwd = Opal.current_dir; + Opal.current_dir = dir; + return Opal.yieldX($yield, []);; + } finally { + Opal.current_dir = prev_cwd; + } })() + }); + + $def(self, '$pwd', function $$pwd() { + + return Opal.current_dir || '.'; + }); + + $def(self, '$home', function $$home() { + var $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = $$$('ENV')['$[]']("HOME")))) { + return $ret_or_1 + } else { + return "." + } + }); + return $alias(self, "getwd", "pwd"); + })(Opal.get_singleton_class(self)) + })('::', null) + }; + + Opal.modules["corelib/file"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $truthy = Opal.truthy, $klass = Opal.klass, $const_set = Opal.const_set, $Opal = Opal.Opal, $regexp = Opal.regexp, $rb_plus = Opal.rb_plus, $def = Opal.def, $Kernel = Opal.Kernel, $eqeq = Opal.eqeq, $rb_lt = Opal.rb_lt, $rb_minus = Opal.rb_minus, $range = Opal.range, $send = Opal.send, $slice = Opal.slice, $alias = Opal.alias, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('respond_to?,to_path,coerce_to!,pwd,split,sub,+,unshift,join,home,raise,start_with?,absolute_path,==,<,dirname,-,basename,empty?,rindex,[],length,nil?,gsub,find,=~,map,each_with_index,flatten,reject,to_proc,end_with?,expand_path,exist?'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'File'); + + var $nesting = [self].concat($parent_nesting), windows_root_rx = nil; + + + $const_set($nesting[0], 'Separator', $const_set($nesting[0], 'SEPARATOR', "/")); + $const_set($nesting[0], 'ALT_SEPARATOR', nil); + $const_set($nesting[0], 'PATH_SEPARATOR', ":"); + $const_set($nesting[0], 'FNM_SYSCASE', 0); + windows_root_rx = /^[a-zA-Z]:(?:\\|\/)/; + return (function(self, $parent_nesting) { + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$absolute_path', function $$absolute_path(path, basedir) { + var sep = nil, sep_chars = nil, new_parts = nil, $ret_or_1 = nil, path_abs = nil, basedir_abs = nil, parts = nil, leading_sep = nil, abs = nil, new_path = nil; + + + if (basedir == null) basedir = nil; + sep = $$('SEPARATOR'); + sep_chars = $sep_chars(); + new_parts = []; + path = ($truthy(path['$respond_to?']("to_path")) ? (path.$to_path()) : (path)); + path = $Opal['$coerce_to!'](path, $$$('String'), "to_str"); + basedir = ($truthy(($ret_or_1 = basedir)) ? ($ret_or_1) : ($$$('Dir').$pwd())); + path_abs = path.substr(0, sep.length) === sep || windows_root_rx.test(path); + basedir_abs = basedir.substr(0, sep.length) === sep || windows_root_rx.test(basedir); + if ($truthy(path_abs)) { + + parts = path.$split($regexp(["[", sep_chars, "]"])); + leading_sep = windows_root_rx.test(path) ? '' : path.$sub($regexp(["^([", sep_chars, "]+).*$"]), "\\1"); + abs = true; + } else { + + parts = $rb_plus(basedir.$split($regexp(["[", sep_chars, "]"])), path.$split($regexp(["[", sep_chars, "]"]))); + leading_sep = windows_root_rx.test(basedir) ? '' : basedir.$sub($regexp(["^([", sep_chars, "]+).*$"]), "\\1"); + abs = basedir_abs; + } + var part; + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + + if ( + (part === nil) || + (part === '' && ((new_parts.length === 0) || abs)) || + (part === '.' && ((new_parts.length === 0) || abs)) + ) { + continue; + } + if (part === '..') { + new_parts.pop(); + } else { + new_parts.push(part); + } + } + + if (!abs && parts[0] !== '.') { + new_parts.$unshift("."); + } + new_path = new_parts.$join(sep); + if ($truthy(abs)) { + new_path = $rb_plus(leading_sep, new_path); + } return new_path; + }, -2); + + $def(self, '$expand_path', function $$expand_path(path, basedir) { + var self = this, sep = nil, sep_chars = nil, home = nil, leading_sep = nil, home_path_regexp = nil; + + + if (basedir == null) basedir = nil; + sep = $$('SEPARATOR'); + sep_chars = $sep_chars(); + if ($truthy(path[0] === '~' || (basedir && basedir[0] === '~'))) { + + home = $$('Dir').$home(); + if (!$truthy(home)) { + $Kernel.$raise($$$('ArgumentError'), "couldn't find HOME environment -- expanding `~'"); + } leading_sep = windows_root_rx.test(home) ? '' : home.$sub($regexp(["^([", sep_chars, "]+).*$"]), "\\1"); + if (!$truthy(home['$start_with?'](leading_sep))) { + $Kernel.$raise($$$('ArgumentError'), "non-absolute home"); + } home = $rb_plus(home, sep); + home_path_regexp = $regexp(["^\\~(?:", sep, "|$)"]); + path = path.$sub(home_path_regexp, home); + if ($truthy(basedir)) { + basedir = basedir.$sub(home_path_regexp, home); + } } return self.$absolute_path(path, basedir); + }, -2); + + // Coerce a given path to a path string using #to_path and #to_str + function $coerce_to_path(path) { + if ($truthy((path)['$respond_to?']("to_path"))) { + path = path.$to_path(); + } + + path = $Opal['$coerce_to!'](path, $$$('String'), "to_str"); + + return path; + } + + // Return a RegExp compatible char class + function $sep_chars() { + if ($$('ALT_SEPARATOR') === nil) { + return Opal.escape_regexp($$('SEPARATOR')); + } else { + return Opal.escape_regexp($rb_plus($$('SEPARATOR'), $$('ALT_SEPARATOR'))); + } + } + + $def(self, '$dirname', function $$dirname(path, level) { + var self = this, sep_chars = nil; + + + if (level == null) level = 1; + if ($eqeq(level, 0)) { + return path + } if ($truthy($rb_lt(level, 0))) { + $Kernel.$raise($$$('ArgumentError'), "level can't be negative"); + } sep_chars = $sep_chars(); + path = $coerce_to_path(path); + + var absolute = path.match(new RegExp("^[" + (sep_chars) + "]")), out; + + path = path.replace(new RegExp("[" + (sep_chars) + "]+$"), ''); // remove trailing separators + path = path.replace(new RegExp("[^" + (sep_chars) + "]+$"), ''); // remove trailing basename + path = path.replace(new RegExp("[" + (sep_chars) + "]+$"), ''); // remove final trailing separators + + if (path === '') { + out = absolute ? '/' : '.'; + } + else { + out = path; + } + + if (level == 1) { + return out; + } + else { + return self.$dirname(out, $rb_minus(level, 1)) + } + }, -2); + + $def(self, '$basename', function $$basename(name, suffix) { + var sep_chars = nil; + + + if (suffix == null) suffix = nil; + sep_chars = $sep_chars(); + name = $coerce_to_path(name); + + if (name.length == 0) { + return name; + } + + if (suffix !== nil) { + suffix = $Opal['$coerce_to!'](suffix, $$$('String'), "to_str"); + } else { + suffix = null; + } + + name = name.replace(new RegExp("(.)[" + (sep_chars) + "]*$"), '$1'); + name = name.replace(new RegExp("^(?:.*[" + (sep_chars) + "])?([^" + (sep_chars) + "]+)$"), '$1'); + + if (suffix === ".*") { + name = name.replace(/\.[^\.]+$/, ''); + } else if(suffix !== null) { + suffix = Opal.escape_regexp(suffix); + name = name.replace(new RegExp("" + (suffix) + "$"), ''); + } + + return name; + }, -2); + + $def(self, '$extname', function $$extname(path) { + var self = this, filename = nil, last_dot_idx = nil; + + + path = $coerce_to_path(path); + filename = self.$basename(path); + if ($truthy(filename['$empty?']())) { + return "" + } last_dot_idx = filename['$[]']($range(1, -1, false)).$rindex("."); + if (($truthy(last_dot_idx['$nil?']()) || ($eqeq($rb_plus(last_dot_idx, 1), $rb_minus(filename.$length(), 1))))) { + return "" + } else { + return filename['$[]'](Opal.Range.$new($rb_plus(last_dot_idx, 1), -1, false)) + } }); + + $def(self, '$exist?', function $exist$ques$1(path) { + + return Opal.modules[path] != null + }); + + $def(self, '$directory?', function $directory$ques$2(path) { + var files = nil; + + + files = []; + + for (var key in Opal.modules) { + files.push(key); + } + path = path.$gsub($regexp(["(^.", $$('SEPARATOR'), "+|", $$('SEPARATOR'), "+$)"])); + return $send(files, 'find', [], function $$3(f){ + + if (f == null) f = nil; + return f['$=~']($regexp(["^", path]));}); + }); + + $def(self, '$join', function $$join($a) { + var $post_args, paths, result = nil; + + + $post_args = $slice(arguments); + paths = $post_args; + if ($truthy(paths['$empty?']())) { + return "" + } result = ""; + paths = $send(paths.$flatten().$each_with_index(), 'map', [], function $$4(item, index){ + + if (item == null) item = nil; + if (index == null) index = nil; + if (($eqeq(index, 0) && ($truthy(item['$empty?']())))) { + return $$('SEPARATOR') + } else if (($eqeq(paths.$length(), $rb_plus(index, 1)) && ($truthy(item['$empty?']())))) { + return $$('SEPARATOR') + } else { + return item + }}); + paths = $send(paths, 'reject', [], "empty?".$to_proc()); + $send(paths, 'each_with_index', [], function $$5(item, index){var next_item = nil; + + + if (item == null) item = nil; + if (index == null) index = nil; + next_item = paths['$[]']($rb_plus(index, 1)); + if ($truthy(next_item['$nil?']())) { + return (result = "" + (result) + (item)) + } else { + + if (($truthy(item['$end_with?']($$('SEPARATOR'))) && ($truthy(next_item['$start_with?']($$('SEPARATOR')))))) { + item = item.$sub($regexp([$$('SEPARATOR'), "+$"]), ""); + } return (result = (($truthy(item['$end_with?']($$('SEPARATOR'))) || ($truthy(next_item['$start_with?']($$('SEPARATOR'))))) ? ("" + (result) + (item)) : ("" + (result) + (item) + ($$('SEPARATOR'))))); + }}); + return result; + }, -1); + + $def(self, '$split', function $$split(path) { + + return path.$split($$('SEPARATOR')) + }); + $alias(self, "realpath", "expand_path"); + return $alias(self, "exists?", "exist?"); + })(Opal.get_singleton_class(self), $nesting); + })('::', $$$('IO'), $nesting) + }; + + Opal.modules["corelib/process/base"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $slice = Opal.slice, $defs = Opal.defs, $return_val = Opal.return_val, nil = Opal.nil; + + + (function($base, $super) { + var self = $klass($base, $super, 'Signal'); + + + return $defs(self, '$trap', function $$trap($a) { + + + $slice(arguments); + return nil; + }, -1) + })('::', null); + return (function($base, $super) { + var self = $klass($base, $super, 'GC'); + + + return $defs(self, '$start', $return_val(nil)) + })('::', null); + }; + + Opal.modules["corelib/process"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $defs = Opal.defs, $truthy = Opal.truthy, $return_val = Opal.return_val, $Kernel = Opal.Kernel, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('const_set,size,<<,__register_clock__,to_f,now,new,[],raise'); + return (function($base) { + var self = $module($base, 'Process'); + + var monotonic = nil; + + + self.__clocks__ = []; + $defs(self, '$__register_clock__', function $$__register_clock__(name, func) { + var self = this; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + self.$const_set(name, self.__clocks__.$size()); + return self.__clocks__['$<<'](func); + }); + self.$__register_clock__("CLOCK_REALTIME", function() { return Date.now() }); + monotonic = false; + + if (Opal.global.performance) { + monotonic = function() { + return performance.now() + }; + } + else if (Opal.global.process && process.hrtime) { + // let now be the base to get smaller numbers + var hrtime_base = process.hrtime(); + + monotonic = function() { + var hrtime = process.hrtime(hrtime_base); + var us = (hrtime[1] / 1000) | 0; // cut below microsecs; + return ((hrtime[0] * 1000) + (us / 1000)); + }; + } + if ($truthy(monotonic)) { + self.$__register_clock__("CLOCK_MONOTONIC", monotonic); + } $defs(self, '$pid', $return_val(0)); + $defs(self, '$times', function $$times() { + var t = nil; + + + t = $$$('Time').$now().$to_f(); + return $$$($$$('Benchmark'), 'Tms').$new(t, t, t, t, t); + }); + return $defs(self, '$clock_gettime', function $$clock_gettime(clock_id, unit) { + var self = this, clock = nil; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + if (unit == null) unit = "float_second"; + if ($truthy(((clock = self.__clocks__['$[]'](clock_id))))) ; else { + $Kernel.$raise($$$($$$('Errno'), 'EINVAL'), "clock_gettime(" + (clock_id) + ") " + (self.__clocks__['$[]'](clock_id))); + } + var ms = clock(); + switch (unit) { + case 'float_second': return (ms / 1000); // number of seconds as a float (default) + case 'float_millisecond': return (ms / 1); // number of milliseconds as a float + case 'float_microsecond': return (ms * 1000); // number of microseconds as a float + case 'second': return ((ms / 1000) | 0); // number of seconds as an integer + case 'millisecond': return ((ms / 1) | 0); // number of milliseconds as an integer + case 'microsecond': return ((ms * 1000) | 0); // number of microseconds as an integer + case 'nanosecond': return ((ms * 1000000) | 0); // number of nanoseconds as an integer + default: $Kernel.$raise($$$('ArgumentError'), "unexpected unit: " + (unit)); + } + }, -2); + })('::') + }; + + Opal.modules["corelib/random/formatter"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $module = Opal.module, $def = Opal.def, $range = Opal.range, $send = Opal.send, $rb_divide = Opal.rb_divide, $Kernel = Opal.Kernel, $Opal = Opal.Opal, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('_verify_count,bytes,encode,strict_encode64,random_bytes,urlsafe_encode64,split,hex,[]=,[],map,to_proc,join,times,<<,|,ord,/,abs,random_float,raise,coerce_to!,flatten,new,random_number,length,include,extend'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Random'); + + var $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + var self = $module($base, 'Formatter'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$hex', function $$hex(count) { + var self = this; + + + if (count == null) count = nil; + count = $$$('Random').$_verify_count(count); + + var bytes = self.$bytes(count); + var out = ""; + for (var i = 0; i < count; i++) { + out += bytes.charCodeAt(i).toString(16).padStart(2, '0'); + } + return (out).$encode("US-ASCII"); + }, -1); + + $def(self, '$random_bytes', function $$random_bytes(count) { + var self = this; + + + if (count == null) count = nil; + return self.$bytes(count); + }, -1); + + $def(self, '$base64', function $$base64(count) { + var self = this; + + + if (count == null) count = nil; + return $$$('Base64').$strict_encode64(self.$random_bytes(count)).$encode("US-ASCII"); + }, -1); + + $def(self, '$urlsafe_base64', function $$urlsafe_base64(count, padding) { + var self = this; + + + if (count == null) count = nil; + if (padding == null) padding = false; + return $$$('Base64').$urlsafe_encode64(self.$random_bytes(count), padding).$encode("US-ASCII"); + }, -1); + + $def(self, '$uuid', function $$uuid() { + var self = this, str = nil; + + + str = self.$hex(16).$split(""); + str['$[]='](12, "4"); + str['$[]='](16, (parseInt(str['$[]'](16), 16) & 3 | 8).toString(16)); + str = [str['$[]']($range(0, 8, true)), str['$[]']($range(8, 12, true)), str['$[]']($range(12, 16, true)), str['$[]']($range(16, 20, true)), str['$[]']($range(20, 32, true))]; + str = $send(str, 'map', [], "join".$to_proc()); + return str.$join("-"); + }); + + $def(self, '$random_float', function $$random_float() { + var self = this, bs = nil, num = nil; + + + bs = self.$bytes(4); + num = 0; + $send((4), 'times', [], function $$1(i){ + + if (i == null) i = nil; + num = num['$<<'](8); + return (num = num['$|'](bs['$[]'](i).$ord()));}); + return $rb_divide(num.$abs(), 2147483647); + }); + + $def(self, '$random_number', function $$random_number(limit) { + var self = this; + + function randomFloat() { + return self.$random_float(); + } + + function randomInt(max) { + return Math.floor(randomFloat() * max); + } + + function randomRange() { + var min = limit.begin, + max = limit.end; + + if (min === nil || max === nil) { + return nil; + } + + var length = max - min; + + if (length < 0) { + return nil; + } + + if (length === 0) { + return min; + } + + if (max % 1 === 0 && min % 1 === 0 && !limit.excl) { + length++; + } + + return randomInt(length) + min; + } + + if (limit == null) { + return randomFloat(); + } else if (limit.$$is_range) { + return randomRange(); + } else if (limit.$$is_number) { + if (limit <= 0) { + $Kernel.$raise($$$('ArgumentError'), "invalid argument - " + (limit)); + } + + if (limit % 1 === 0) { + // integer + return randomInt(limit); + } else { + return randomFloat() * limit; + } + } else { + limit = $Opal['$coerce_to!'](limit, $$$('Integer'), "to_int"); + + if (limit <= 0) { + $Kernel.$raise($$$('ArgumentError'), "invalid argument - " + (limit)); + } + + return randomInt(limit); + } + }, -1); + return $def(self, '$alphanumeric', function $$alphanumeric(count) { + var self = this, map = nil; + + + if (count == null) count = nil; + count = $$('Random').$_verify_count(count); + map = $send([$range("0", "9", false), $range("a", "z", false), $range("A", "Z", false)], 'map', [], "to_a".$to_proc()).$flatten(); + return $send($$$('Array'), 'new', [count], function $$2(i){var self = $$2.$$s == null ? this : $$2.$$s; + return map['$[]'](self.$random_number(map.$length()));}, {$$s: self}).$join(); + }, -1); + })(self, $nesting); + self.$include($$$($$$('Random'), 'Formatter')); + return self.$extend($$$($$$('Random'), 'Formatter')); + })('::', null, $nesting) + }; + + Opal.modules["corelib/random/mersenne_twister"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $const_set = Opal.const_set, $send = Opal.send, nil = Opal.nil, $$$ = Opal.$$$, mersenne_twister = nil; + + Opal.add_stubs('generator='); + + mersenne_twister = (function() { + /* Period parameters */ + var N = 624; + var M = 397; + var MATRIX_A = 0x9908b0df; /* constant vector a */ + var UMASK = 0x80000000; /* most significant w-r bits */ + var LMASK = 0x7fffffff; /* least significant r bits */ + var MIXBITS = function(u,v) { return ( ((u) & UMASK) | ((v) & LMASK) ); }; + var TWIST = function(u,v) { return (MIXBITS((u),(v)) >>> 1) ^ ((v & 0x1) ? MATRIX_A : 0x0); }; + + function init(s) { + var mt = {left: 0, next: N, state: new Array(N)}; + init_genrand(mt, s); + return mt; + } + + /* initializes mt[N] with a seed */ + function init_genrand(mt, s) { + var j; + mt.state[0] = s >>> 0; + for (j=1; j> 30) >>> 0)) + j); + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + /* In the previous versions, MSBs of the seed affect */ + /* only MSBs of the array state[]. */ + /* 2002/01/09 modified by Makoto Matsumoto */ + mt.state[j] &= 0xffffffff; /* for >32 bit machines */ + } + mt.left = 1; + mt.next = N; + } + + /* generate N words at one time */ + function next_state(mt) { + var p = 0, _p = mt.state; + var j; + + mt.left = N; + mt.next = 0; + + for (j=N-M+1; --j; p++) + _p[p] = _p[p+(M)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + for (j=M; --j; p++) + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[0]); + } + + /* generates a random number on [0,0xffffffff]-interval */ + function genrand_int32(mt) { + /* mt must be initialized */ + var y; + + if (--mt.left <= 0) next_state(mt); + y = mt.state[mt.next++]; + + /* Tempering */ + y ^= (y >>> 11); + y ^= (y << 7) & 0x9d2c5680; + y ^= (y << 15) & 0xefc60000; + y ^= (y >>> 18); + + return y >>> 0; + } + + function int_pair_to_real_exclusive(a, b) { + a >>>= 5; + b >>>= 6; + return (a*67108864.0+b)*(1.0/9007199254740992.0); + } + + // generates a random number on [0,1) with 53-bit resolution + function genrand_real(mt) { + /* mt must be initialized */ + var a = genrand_int32(mt), b = genrand_int32(mt); + return int_pair_to_real_exclusive(a, b); + } + + return { genrand_real: genrand_real, init: init }; + })(); + return (function($base, $super) { + var self = $klass($base, $super, 'Random'); + + var $a; + + + var MAX_INT = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; + $const_set(self, 'MERSENNE_TWISTER_GENERATOR', { + new_seed: function() { return Math.round(Math.random() * MAX_INT); }, + reseed: function(seed) { return mersenne_twister.init(seed); }, + rand: function(mt) { return mersenne_twister.genrand_real(mt); } + }); + return ($a = [$$$(self, 'MERSENNE_TWISTER_GENERATOR')], $send(self, 'generator=', $a), $a[$a.length - 1]); + })('::', null); + }; + + Opal.modules["corelib/random"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $truthy = Opal.truthy, $klass = Opal.klass, $Kernel = Opal.Kernel, $defs = Opal.defs, $Opal = Opal.Opal, $def = Opal.def, $eqeqeq = Opal.eqeqeq, $send = Opal.send, self = Opal.top, nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,attr_reader,to_int,raise,new_seed,coerce_to!,reseed,rand,seed,bytes,===,==,state,_verify_count,encode,join,new,chr,random_number,random_float,const_defined?,const_set'); + + self.$require("corelib/random/formatter"); + (function($base, $super) { + var self = $klass($base, $super, 'Random'); + + + + self.$attr_reader("seed", "state"); + $defs(self, '$_verify_count', function $$_verify_count(count) { + + + if (!$truthy(count)) count = 16; + if (typeof count !== "number") count = (count).$to_int(); + if (count < 0) $Kernel.$raise($$$('ArgumentError'), "negative string size (or size too big)"); + count = Math.floor(count); + return count; + + }); + + $def(self, '$initialize', function $$initialize(seed) { + var self = this; + + + if (seed == null) seed = $$$('Random').$new_seed(); + seed = $Opal['$coerce_to!'](seed, $$$('Integer'), "to_int"); + self.state = seed; + return self.$reseed(seed); + }, -1); + + $def(self, '$reseed', function $$reseed(seed) { + var self = this; + + + self.seed = seed; + return self.$rng = Opal.$$rand.reseed(seed); }); + $defs(self, '$new_seed', function $$new_seed() { + + return Opal.$$rand.new_seed(); + }); + $defs(self, '$rand', function $$rand(limit) { + var self = this; + return $$$(self, 'DEFAULT').$rand(limit); + }, -1); + $defs(self, '$srand', function $$srand(n) { + var self = this, previous_seed = nil; + + + if (n == null) n = $$$('Random').$new_seed(); + n = $Opal['$coerce_to!'](n, $$$('Integer'), "to_int"); + previous_seed = $$$(self, 'DEFAULT').$seed(); + $$$(self, 'DEFAULT').$reseed(n); + return previous_seed; + }, -1); + $defs(self, '$urandom', function $$urandom(size) { + + return $$$('SecureRandom').$bytes(size) + }); + + $def(self, '$==', function $Random_$eq_eq$1(other) { + var self = this, $ret_or_1 = nil; + + + if (!$eqeqeq($$$('Random'), other)) { + return false + } if ($truthy(($ret_or_1 = self.$seed()['$=='](other.$seed())))) { + return self.$state()['$=='](other.$state()) + } else { + return $ret_or_1 + } }); + + $def(self, '$bytes', function $$bytes(length) { + var self = this; + + + length = $$$('Random').$_verify_count(length); + return $send($$$('Array'), 'new', [length], function $$2(){var self = $$2.$$s == null ? this : $$2.$$s; + + return self.$rand(255).$chr()}, {$$s: self}).$join().$encode("ASCII-8BIT"); + }); + $defs(self, '$bytes', function $$bytes(length) { + var self = this; + + return $$$(self, 'DEFAULT').$bytes(length) + }); + + $def(self, '$rand', function $$rand(limit) { + var self = this; + return self.$random_number(limit); + }, -1); + + $def(self, '$random_float', function $$random_float() { + var self = this; + + + self.state++; + return Opal.$$rand.rand(self.$rng); + + }); + $defs(self, '$random_float', function $$random_float() { + var self = this; + + return $$$(self, 'DEFAULT').$random_float() + }); + return $defs(self, '$generator=', function $Random_generator$eq$3(generator) { + var self = this; + + + Opal.$$rand = generator; + if ($truthy(self['$const_defined?']("DEFAULT"))) { + return $$$(self, 'DEFAULT').$reseed() + } else { + return self.$const_set("DEFAULT", self.$new(self.$new_seed())) + } }); + })('::', null); + return self.$require("corelib/random/mersenne_twister"); + }; + + Opal.modules["corelib/unsupported"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $Kernel = Opal.Kernel, $klass = Opal.klass, $send = Opal.send, $slice = Opal.slice, $module = Opal.module, $def = Opal.def, $return_val = Opal.return_val, $alias = Opal.alias, $defs = Opal.defs, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('raise,warn,each,define_method,%,public,private_method_defined?,private_class_method,instance_method,instance_methods,method_defined?,private_methods'); + + + var warnings = {}; + + function handle_unsupported_feature(message) { + switch (Opal.config.unsupported_features_severity) { + case 'error': + $Kernel.$raise($$$('NotImplementedError'), message); + break; + case 'warning': + warn(message); + break; + // noop + } + } + + function warn(string) { + if (warnings[string]) { + return; + } + + warnings[string] = true; + self.$warn(string); + } + (function($base, $super) { + var self = $klass($base, $super, 'String'); + + + + var ERROR = "String#%s not supported. Mutable String methods are not supported in Opal."; + return $send(["<<", "capitalize!", "chomp!", "chop!", "downcase!", "gsub!", "lstrip!", "next!", "reverse!", "slice!", "squeeze!", "strip!", "sub!", "succ!", "swapcase!", "tr!", "tr_s!", "upcase!", "prepend", "[]=", "clear", "encode!", "unicode_normalize!"], 'each', [], function $String$1(method_name){var self = $String$1.$$s == null ? this : $String$1.$$s; + + + if (method_name == null) method_name = nil; + return $send(self, 'define_method', [method_name], function $$2($a){ + + $slice(arguments); + return $Kernel.$raise($$$('NotImplementedError'), (ERROR)['$%'](method_name));}, -1);}, {$$s: self}); + })('::', null); + (function($base) { + var self = $module($base, 'Kernel'); + + + + var ERROR = "Object tainting is not supported by Opal"; + + $def(self, '$taint', function $$taint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }); + + $def(self, '$untaint', function $$untaint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }); + return $def(self, '$tainted?', function $Kernel_tainted$ques$3() { + + + handle_unsupported_feature(ERROR); + return false; + }); + })('::'); + (function($base, $super) { + var self = $klass($base, $super, 'Module'); + + + + + $def(self, '$public', function $Module_public$4($a) { + var $post_args, methods, self = this; + + + $post_args = $slice(arguments); + methods = $post_args; + + if (methods.length === 0) { + self.$$module_function = false; + return nil; + } + return (methods.length === 1) ? methods[0] : methods; + }, -1); + + $def(self, '$private_class_method', function $$private_class_method($a) { + var $post_args, methods; + + + $post_args = $slice(arguments); + methods = $post_args; + return (methods.length === 1) ? methods[0] : methods; }, -1); + + $def(self, '$private_method_defined?', $return_val(false)); + + $def(self, '$private_constant', function $$private_constant($a) { + + + $slice(arguments); + return nil; + }, -1); + $alias(self, "nesting", "public"); + $alias(self, "private", "public"); + $alias(self, "protected", "public"); + $alias(self, "protected_method_defined?", "private_method_defined?"); + $alias(self, "public_class_method", "private_class_method"); + $alias(self, "public_instance_method", "instance_method"); + $alias(self, "public_instance_methods", "instance_methods"); + return $alias(self, "public_method_defined?", "method_defined?"); + })('::', null); + (function($base) { + var self = $module($base, 'Kernel'); + + + + + $def(self, '$private_methods', function $$private_methods($a) { + + + $slice(arguments); + return []; + }, -1); + $alias(self, "protected_methods", "private_methods"); + $alias(self, "private_instance_methods", "private_methods"); + return $alias(self, "protected_instance_methods", "private_methods"); + })('::'); + (function($base, $parent_nesting) { + var self = $module($base, 'Kernel'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$eval', function $Kernel_eval$5($a) { + + + $slice(arguments); + return $Kernel.$raise($$$('NotImplementedError'), "To use Kernel#eval, you must first require 'opal-parser'. " + ("See https://github.com/opal/opal/blob/" + ($$('RUBY_ENGINE_VERSION')) + "/docs/opal_parser.md for details.")); + }, -1) + })('::', $nesting); + $defs(self, '$public', function $public$6($a) { + var $post_args, methods; + + + $post_args = $slice(arguments); + methods = $post_args; + return (methods.length === 1) ? methods[0] : methods; }, -1); + return $defs(self, '$private', function $private$7($a) { + var $post_args, methods; + + + $post_args = $slice(arguments); + methods = $post_args; + return (methods.length === 1) ? methods[0] : methods; }, -1); + }; + + Opal.queue(function(Opal) {/* Generated by Opal 1.7.3 */ + var $Object = Opal.Object; Opal.nil; + + Opal.add_stubs('require,autoload'); + + $Object.$require("opal/base"); + $Object.$require("opal/mini"); + $Object.$require("corelib/kernel/format"); + $Object.$require("corelib/string/encoding"); + $Object.$autoload("Math", "corelib/math"); + $Object.$require("corelib/complex/base"); + $Object.$autoload("Complex", "corelib/complex"); + $Object.$require("corelib/rational/base"); + $Object.$autoload("Rational", "corelib/rational"); + $Object.$require("corelib/time"); + $Object.$autoload("Struct", "corelib/struct"); + $Object.$autoload("Set", "corelib/set"); + $Object.$autoload("Dir", "corelib/dir"); + $Object.$autoload("File", "corelib/file"); + $Object.$require("corelib/process/base"); + $Object.$autoload("Process", "corelib/process"); + $Object.$autoload("Random", "corelib/random"); + return $Object.$require("corelib/unsupported"); + }); + + + + + + function Asciidoctor(moduleConfig) { + Opal.modules["asciidoctor/js/opal_ext/browser/file"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $defs = Opal.defs, $nesting = []; Opal.nil; + + Opal.add_stubs('new'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'File'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $defs(self, '$read', function $$read(path) { + + + var data = ''; + var status = -1; + try { + var xhr = new XMLHttpRequest(); + xhr.open('GET', path, false); + xhr.addEventListener('load', function() { + status = this.status; + // status is 0 for local file mode (i.e., file://) + if (status === 0 || status === 200) { + data = this.responseText; + } + }); + xhr.overrideMimeType('text/plain'); + xhr.send(); + } + catch (e) { + throw $$('IOError').$new('Error reading file or directory: ' + path + '; reason: ' + e.message); + } + // assume that no data in local file mode means it doesn't exist + if (status === 404 || (status === 0 && !data)) { + throw $$('IOError').$new('No such file or directory: ' + path); + } + return data; + + }) + })($nesting[0], null, $nesting) + }; + + Opal.modules["asciidoctor/js/opal_ext/browser"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $const_set = Opal.const_set, self = Opal.top, $nesting = []; Opal.nil; + + Opal.add_stubs('require'); + + + var platform, engine, framework, ioModule; + + if (typeof moduleConfig === 'object' && typeof moduleConfig.runtime === 'object') { + var runtime = moduleConfig.runtime; + platform = runtime.platform; + engine = runtime.engine; + framework = runtime.framework; + ioModule = runtime.ioModule; + } + ioModule = ioModule || 'xmlhttprequest'; + platform = platform || 'browser'; + engine = engine || ''; + framework = framework || ''; + $const_set($nesting[0], 'JAVASCRIPT_IO_MODULE', ioModule); + $const_set($nesting[0], 'JAVASCRIPT_PLATFORM', platform); + $const_set($nesting[0], 'JAVASCRIPT_ENGINE', engine); + $const_set($nesting[0], 'JAVASCRIPT_FRAMEWORK', framework); + return self.$require("asciidoctor/js/opal_ext/browser/file"); + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/browser/abstract_node"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $def = Opal.def, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('web_path,path_resolver,uriish?,[],attr?,start_with?,descends_from?,base_dir,join,prepare_source_string,read,fetch,warn,logger,normalize_system_path,read_asset'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'AbstractNode'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.document = nil; + + + $def(self, '$read_contents', function $$read_contents(target, opts) { + var self = this, doc = nil, start = nil, $ret_or_1 = nil; + + + if (opts == null) opts = $hash2([], {}); + doc = self.document; + if (($truthy($$('Helpers')['$uriish?'](target)) || ((($truthy((start = opts['$[]']("start"))) && ($truthy($$('Helpers')['$uriish?'](start)))) && ($truthy((target = doc.$path_resolver().$web_path(target, start)))))))) { + if ((($truthy(doc.$path_resolver()['$descends_from?'](target, doc.$base_dir())) || ($truthy(target['$start_with?']("chrome://")))) || ($truthy(doc['$attr?']("allow-uri-read"))))) { + + try { + if ($truthy(opts['$[]']("normalize"))) { + return $$('Helpers').$prepare_source_string($$$('File').$read(target)).$join($$('LF')) + } else { + return $$$('File').$read(target) + } + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("could not retrieve contents of " + (($truthy(($ret_or_1 = opts['$[]']("label"))) ? ($ret_or_1) : ("asset"))) + " at URI: " + (target)); + }; + return nil; + } finally { Opal.pop_exception(); } + } else { throw $err; } + } } else { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("cannot retrieve contents of " + (($truthy(($ret_or_1 = opts['$[]']("label"))) ? ($ret_or_1) : ("asset"))) + " at URI: " + (target) + " (allow-uri-read attribute not enabled)"); + } return nil; + } + } else { + + target = self.$normalize_system_path(target, opts['$[]']("start"), nil, $hash2(["target_name"], {"target_name": ($truthy(($ret_or_1 = opts['$[]']("label"))) ? ($ret_or_1) : ("asset"))})); + return self.$read_asset(target, $hash2(["normalize", "warn_on_failure", "label"], {"normalize": opts['$[]']("normalize"), "warn_on_failure": opts.$fetch("warn_on_failure", true), "label": opts['$[]']("label")})); + } }, -2); + return $def(self, '$generate_data_uri_from_uri', function $$generate_data_uri_from_uri(image_uri, cache_uri) { + var self = this; + + var contentType = ''; + var b64encoded = ''; + var status = -1; + + try { + var xhr = new XMLHttpRequest(); + xhr.open('GET', image_uri, false); + // the response type cannot be changed for synchronous requests made from a document + // xhr.responseType = 'arraybuffer' + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + xhr.addEventListener('load', function() { + status = this.status; + // status is 0 for local file mode (i.e., file://) + if (status === 0 || status === 200) { + var binary = ''; + var rawText = this.responseText; + for (var i = 0, len = rawText.length; i < len; ++i) { + var c = rawText.charCodeAt(i); + var byteCode = c & 0xff; // byte at offset i + binary += String.fromCharCode(byteCode); + } + b64encoded = btoa(binary); + contentType = this.getResponseHeader('content-type'); + } + }); + xhr.send(null); + // try to detect the MIME Type from the file extension + if (!contentType) { + if (image_uri.endsWith('.jpeg') || image_uri.endsWith('.jpg') || image_uri.endsWith('.jpe')) { + contentType = 'image/jpg'; + } else if (image_uri.endsWith('.png')) { + contentType = 'image/png'; + } else if (image_uri.endsWith('.svg')) { + contentType = 'image/svg+xml'; + } else if (image_uri.endsWith('.bmp')) { + contentType = 'image/bmp'; + } else if (image_uri.endsWith('.tif') || image_uri.endsWith('.tiff')) { + contentType = 'image/tiff'; + } + } + } + catch (e) { + // something bad happened! + status = 0; + } + + // assume that no data in local file mode means it doesn't exist + if (status === 404 || (status === 0 && (!b64encoded || !contentType))) { + self.$logger().$warn('could not retrieve image data from URI: ' + image_uri); + return image_uri + } + return 'data:' + contentType + ';base64,' + b64encoded + ; + }, -2); + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/browser/open_uri"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $slice = Opal.slice, $send = Opal.send, $to_a = Opal.to_a, $defs = Opal.defs, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('new,path'); + return (function($base, $parent_nesting) { + var self = $module($base, 'OpenURI'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $defs($$('OpenURI'), '$open_uri', function $$open_uri(name, $a) { + var $post_args, rest, $yield = $$open_uri.$$p || nil, self = this, file = nil; + + $$open_uri.$$p = null; + + $post_args = $slice(arguments, 1); + rest = $post_args; + file = $send($$('File'), 'new', [self.$path()].concat($to_a(rest))); + if (($yield !== nil)) { + return Opal.yield1($yield, file); + } else { + return file + } }, -2) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/browser/path_resolver"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $def = Opal.def, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('absolute_path?,start_with?'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super) { + var self = $klass($base, $super, 'PathResolver'); + + + return $def(self, '$root?', function $PathResolver_root$ques$1(path) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self['$absolute_path?'](path)))) { + return $ret_or_1 + } else { + + return path['$start_with?']("file://", "http://", "https://", "chrome://"); + } + }) + })($nesting[0], null) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/browser/reader"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $not = Opal.not, $def = Opal.def, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('posixify,new,base_dir,start_with?,uriish?,key?,attributes,descends_from?,replace_next_line,absolute_path?,==,empty?,!,slice,length'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'PreprocessorReader'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.path_resolver = $proto.document = $proto.include_stack = $proto.dir = nil; + return $def(self, '$resolve_include_path', function $$resolve_include_path(target, attrlist, attributes) { + var $a, self = this, p_target = nil, $ret_or_1 = nil, base_dir = nil, inc_path = nil, relpath = nil, ctx_dir = nil, top_level = nil, offset = nil; + + + p_target = (self.path_resolver = ($truthy(($ret_or_1 = self.path_resolver)) ? ($ret_or_1) : ($$('PathResolver').$new("\\")))).$posixify(target); + $a = ["file", self.document.$base_dir()], ($a[0]), (base_dir = $a[1]); + if ($truthy(p_target['$start_with?']("file://"))) { + inc_path = (relpath = p_target); + } else if ($truthy($$('Helpers')['$uriish?'](p_target))) { + + if (!($truthy(self.path_resolver['$descends_from?'](p_target, base_dir)) || ($truthy(self.document.$attributes()['$key?']("allow-uri-read"))))) { + return self.$replace_next_line("link:" + (target) + "[" + (attrlist) + "]") + } inc_path = (relpath = p_target); + } else if ($truthy(self.path_resolver['$absolute_path?'](p_target))) { + inc_path = (relpath = "file://" + (($truthy(p_target['$start_with?']("/")) ? ("") : ("/"))) + (p_target)); + } else if ($eqeq((ctx_dir = ($truthy((top_level = self.include_stack['$empty?']())) ? (base_dir) : (self.dir))), ".")) { + inc_path = (relpath = p_target); + } else if (($truthy(ctx_dir['$start_with?']("file://")) || ($not($$('Helpers')['$uriish?'](ctx_dir))))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + if ($truthy(top_level)) { + relpath = p_target; + } else if (($eqeq(base_dir, ".") || ($not((offset = self.path_resolver['$descends_from?'](inc_path, base_dir)))))) { + relpath = inc_path; + } else { + relpath = inc_path.$slice(offset, inc_path.$length()); + } } else if ($truthy(top_level)) { + inc_path = "" + (ctx_dir) + "/" + ((relpath = p_target)); + } else if (($truthy((offset = self.path_resolver['$descends_from?'](ctx_dir, base_dir))) || ($truthy(self.document.$attributes()['$key?']("allow-uri-read"))))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + relpath = ($truthy(offset) ? (inc_path.$slice(offset, inc_path.$length())) : (p_target)); + } else { + return self.$replace_next_line("link:" + (target) + "[" + (attrlist) + "]") + } return [inc_path, "file", relpath]; + }) + })($nesting[0], $$('Reader'), $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/browser"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $eqeq = Opal.eqeq, self = Opal.top, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil; + + Opal.add_stubs('==,require'); + if ($eqeq($$('JAVASCRIPT_IO_MODULE'), "xmlhttprequest")) { + + self.$require("asciidoctor/js/asciidoctor_ext/browser/abstract_node"); + self.$require("asciidoctor/js/asciidoctor_ext/browser/open_uri"); + self.$require("asciidoctor/js/asciidoctor_ext/browser/path_resolver"); + return self.$require("asciidoctor/js/asciidoctor_ext/browser/reader"); + } else { + return nil + } + }; + + Opal.modules["set"] = Opal.return_val(Opal.nil); /* Generated by Opal 1.7.3 */ + + Opal.modules["asciidoctor/js/opal_ext/kernel"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $slice = Opal.slice, $send = Opal.send, $to_a = Opal.to_a, $def = Opal.def, $return_val = Opal.return_val, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('new'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Kernel'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$open', function $$open(path, $a) { + var $post_args, rest, $yield = $$open.$$p || nil, file = nil; + + $$open.$$p = null; + + $post_args = $slice(arguments, 1); + rest = $post_args; + file = $send($$('File'), 'new', [path].concat($to_a(rest))); + if (($yield !== nil)) { + return Opal.yield1($yield, file); + } else { + return file + } }, -2); + return $def(self, '$__dir__', $return_val("")); + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/opal_ext/file"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $def = Opal.def, $truthy = Opal.truthy, $gvars = Opal.gvars, $return_val = Opal.return_val, $defs = Opal.defs, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('attr_reader,delete,gsub,read,size,to_enum,chomp,each_line,readlines,split'); + + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'File'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.eof = $proto.path = nil; + + self.$attr_reader("eof"); + self.$attr_reader("lineno"); + self.$attr_reader("path"); + + $def(self, '$initialize', function $$initialize(path, flags) { + var self = this, encoding_flag_regexp = nil; + + + if (flags == null) flags = "r"; + self.path = path; + self.contents = nil; + self.eof = false; + self.lineno = 0; + flags = flags.$delete("b"); + encoding_flag_regexp = /:(.*)/; + flags = flags.$gsub(encoding_flag_regexp, ""); + return (self.flags = flags); + }, -2); + + $def(self, '$read', function $$read() { + var self = this, res = nil; + + if ($truthy(self.eof)) { + return "" + } else { + + res = $$('File').$read(self.path); + self.eof = true; + self.lineno = res.$size(); + return res; + } + }); + + $def(self, '$each_line', function $$each_line(separator) { + var block = $$each_line.$$p || nil, self = this, lines = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + $$each_line.$$p = null; + if (separator == null) separator = $gvars["/"]; + if ($truthy(self.eof)) { + return ((block !== nil) ? (self) : ([].$to_enum())) + } if ((block !== nil)) { + + lines = $$('File').$read(self.path); + + self.eof = false; + self.lineno = 0; + var chomped = lines.$chomp(), + trailing = lines.length != chomped.length, + splitted = chomped.split(separator); + for (var i = 0, length = splitted.length; i < length; i++) { + self.lineno += 1; + if (i < length - 1 || trailing) { + Opal.yield1(block, splitted[i] + separator); + } + else { + Opal.yield1(block, splitted[i]); + } + } + self.eof = true; + return self; + } else { + return self.$read().$each_line() + } }, -1); + + $def(self, '$readlines', function $$readlines() { + var self = this; + + return $$('File').$readlines(self.path) + }); + return (function(self, $parent_nesting) { + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$readlines', function $$readlines(path, separator) { + var content = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + if (separator == null) separator = $gvars["/"]; + content = $$('File').$read(path); + return content.$split(separator); + }, -2); + + $def(self, '$file?', $return_val(true)); + + $def(self, '$readable?', $return_val(true)); + return $def(self, '$read', $return_val("")); + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'IO'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $defs(self, '$read', function $$read(path) { + + return $$('File').$read(path) + }) + })($nesting[0], null, $nesting); + }; + + Opal.modules["asciidoctor/js/opal_ext/match_data"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $send = Opal.send, $def = Opal.def, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('[]='); + return (function($base, $super) { + var self = $klass($base, $super, 'MatchData'); + + var $proto = self.$$prototype; + + $proto.matches = nil; + return $def(self, '$[]=', function $MatchData_$$$eq$1(idx, val) { + var $a, self = this; + + return ($a = [idx, val], $send(self.matches, '[]=', $a), $a[$a.length - 1]) + }) + })($nesting[0], null) + }; + + Opal.modules["asciidoctor/js/opal_ext/string"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $truthy = Opal.truthy, $rb_lt = Opal.rb_lt, $def = Opal.def, $alias = Opal.alias, $rb_ge = Opal.rb_ge, $eqeq = Opal.eqeq, $rb_minus = Opal.rb_minus, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('method_defined?,<,length,bytes,to_s,byteslice,limit_bytesize,>=,==,-,_original_byteslice,unpack,_original_unpack'); + return (function($base, $super) { + var self = $klass($base, $super, 'String'); + + + + if (!$truthy(self['$method_defined?']("limit_bytesize"))) { + + $def(self, '$limit_bytesize', function $$limit_bytesize(size) { + var self = this, result = nil; + + + if (!$truthy($rb_lt(size, self.$bytes().$length()))) { + return self.$to_s() + } result = self.$byteslice(0, size); + return result.$to_s(); + }); + } if (!$truthy(self['$method_defined?']("limit"))) { + $alias(self, "limit", "limit_bytesize"); + } $alias(self, "_original_byteslice", "byteslice"); + + $def(self, '$byteslice', function $$byteslice(index, length) { + var self = this; + + + if (length == null) length = 1; + if ((($eqeq(index, 3) && ($truthy($rb_ge(length, index)))) && ($truthy(self.charCodeAt() === 65279)))) { + return (self.substr(1)).$byteslice(0, $rb_minus(length, 3)) + } else { + return self.$_original_byteslice(index, length) + } }, -2); + $alias(self, "_original_unpack", "unpack"); + return $def(self, '$unpack', function $$unpack(format) { + var self = this; + + if ($eqeq(format, "C3")) { + if ($truthy(self.charCodeAt() === 65279)) { + return [239, 187, 191] + } else { + + var bytes = []; + for (var i=0; i < 3; i++) { + if (i < self.length) { + bytes.push(self.charCodeAt(i)); + } else { + bytes.push(nil); + } + } + return bytes + + } + } else { + return self.$_original_unpack(format) + } + }); + })($nesting[0], null) + }; + + Opal.modules["asciidoctor/js/opal_ext/uri"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $defs = Opal.defs, $return_self = Opal.return_self, $def = Opal.def, $nesting = []; Opal.nil; + + Opal.add_stubs('extend'); + return (function($base, $parent_nesting) { + var self = $module($base, 'URI'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $defs(self, '$parse', function $$parse(str) { + + return str.$extend($$('URI')) + }); + return $def(self, '$path', $return_self); + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/opal_ext/base64"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $defs = Opal.defs, $ensure_kwargs = Opal.ensure_kwargs, $truthy = Opal.truthy, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('delete'); + return (function($base) { + var self = $module($base, 'Base64'); + + + + + var encode, decode; + encode = Opal.global.btoa || function (input) { + var buffer; + if (input instanceof Buffer) { + buffer = input; + } else { + buffer = Buffer.from(input.toString(), 'binary'); + } + return buffer.toString('base64'); + }; + decode = Opal.global.atob || function (input) { + return Buffer.from(input, 'base64').toString('binary'); + }; + $defs(self, '$decode64', function $$decode64(string) { + + return decode(string.replace(/\r?\n/g, '')); + }); + $defs(self, '$encode64', function $$encode64(string) { + + return encode(string).replace(/(.{60})/g, "$1\n").replace(/([^\n])$/g, "$1\n"); + }); + $defs(self, '$strict_decode64', function $$strict_decode64(string) { + + return decode(string); + }); + $defs(self, '$strict_encode64', function $$strict_encode64(string) { + + return encode(string); + }); + $defs(self, '$urlsafe_decode64', function $$urlsafe_decode64(string) { + + return decode(string.replace(/\-/g, '+').replace(/_/g, '/')); + }); + return $defs(self, '$urlsafe_encode64', function $$urlsafe_encode64(string, $kwargs) { + var padding, str = nil; + + + $kwargs = $ensure_kwargs($kwargs); + + padding = $kwargs.$$smap["padding"];if (padding == null) padding = true; + str = encode(string).replace(/\+/g, '-').replace(/\//g, '_'); + if (!$truthy(padding)) { + str = str.$delete("="); + } return str; + }, -2); + })($nesting[0]) + }; + + Opal.modules["asciidoctor/js/opal_ext/number"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $truthy = Opal.truthy, $rb_gt = Opal.rb_gt, $def = Opal.def, $nesting = [], $$ = Opal.$r($nesting); Opal.nil; + + Opal.add_stubs('coerce_to!,>'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Number'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$round', function $$round(ndigits) { + var self = this; + ndigits = $$('Opal')['$coerce_to!'](ndigits, $$('Integer'), "to_int"); + if ($truthy($rb_gt(ndigits, 0))) { + return Number(self.toFixed(ndigits)); + } else { + return Math.round(self); + } }, -1) + })($nesting[0], $$('Numeric'), $nesting) + }; + + Opal.modules["asciidoctor/js/opal_ext"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var self = Opal.top; Opal.nil; + + Opal.add_stubs('require'); + + self.$require("asciidoctor/js/opal_ext/kernel"); + self.$require("asciidoctor/js/opal_ext/file"); + self.$require("asciidoctor/js/opal_ext/match_data"); + self.$require("asciidoctor/js/opal_ext/string"); + self.$require("asciidoctor/js/opal_ext/uri"); + self.$require("asciidoctor/js/opal_ext/base64"); + self.$require("asciidoctor/js/opal_ext/number"); + + // suppress "not supported" warning messages from Opal + Opal.config.unsupported_features_severity = 'ignore'; + + // Load specific runtime + self.$require("asciidoctor/js/opal_ext/browser"); + }; + + Opal.modules["asciidoctor/js/rx"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $const_set = Opal.const_set, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy, $defs = Opal.defs, $rb_plus = Opal.rb_plus, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('gsub,+,unpack_hex_range'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $const_set($nesting[0], 'HEX_RANGE_RX', /([A-F0-9]{4})(?:-([A-F0-9]{4}))?/); + $defs(self, '$unpack_hex_range', function $$unpack_hex_range(str) { + + return $send(str, 'gsub', [$$('HEX_RANGE_RX')], function $$1(){var $a, $ret_or_1 = nil; + + return "\\u" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + (($truthy(($ret_or_1 = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) ? ("-\\u" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) : ($ret_or_1)))}) + }); + $const_set($nesting[0], 'P_L', $rb_plus("A-Za-z", self.$unpack_hex_range("00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D037F03860388-038A038C038E-03A103A3-03F503F7-0481048A-052F0531-055605590561-058705D0-05EA05F0-05F20620-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280840-085808A0-08B20904-0939093D09500958-09610971-09800985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10CF10CF20D05-0D0C0D0E-0D100D12-0D3A0D3D0D4E0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC-0EDF0F000F40-0F470F49-0F6C0F88-0F8C1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510C710CD10D0-10FA10FC-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA16F1-16F81700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191E1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1BBA-1BE51C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11CF51CF61D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209C21022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2CF22CF32D00-2D252D272D2D2D30-2D672D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31BA31F0-31FF3400-4DB54E00-9FCCA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A66EA67F-A69DA6A0-A6E5A717-A71FA722-A788A78B-A78EA790-A7ADA7B0A7B1A7F7-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFA9E0-A9E4A9E6-A9EFA9FA-A9FEAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA7E-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDAAE0-AAEAAAF2-AAF4AB01-AB06AB09-AB0EAB11-AB16AB20-AB26AB28-AB2EAB30-AB5AAB5C-AB5FAB64AB65ABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC"))); + $const_set($nesting[0], 'P_Nl', self.$unpack_hex_range("16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF")); + $const_set($nesting[0], 'P_Nd', $rb_plus("0-9", self.$unpack_hex_range("0660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0DE6-0DEF0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19D91A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9A9F0-A9F9AA50-AA59ABF0-ABF9FF10-FF19"))); + $const_set($nesting[0], 'P_Pc', self.$unpack_hex_range("005F203F20402054FE33FE34FE4D-FE4FFF3F")); + $const_set($nesting[0], 'CC_ALPHA', "" + ($$('P_L')) + ($$('P_Nl'))); + $const_set($nesting[0], 'CG_ALPHA', "[" + ($$('CC_ALPHA')) + "]"); + $const_set($nesting[0], 'CC_ALNUM', "" + ($$('CC_ALPHA')) + ($$('P_Nd'))); + $const_set($nesting[0], 'CG_ALNUM', "[" + ($$('CC_ALNUM')) + "]"); + $const_set($nesting[0], 'CC_WORD', "" + ($$('CC_ALNUM')) + ($$('P_Pc'))); + $const_set($nesting[0], 'CG_WORD', "[" + ($$('CC_WORD')) + "]"); + $const_set($nesting[0], 'CG_BLANK', "[ \\t]"); + $const_set($nesting[0], 'CC_EOL', "(?=\\n|$)"); + $const_set($nesting[0], 'CG_GRAPH', "[^\\s\\x00-\\x1F\\x7F]"); + $const_set($nesting[0], 'CC_ALL', "[\\s\\S]"); + return $const_set($nesting[0], 'CC_ANY', "[^\\n]"); + })($nesting[0], $nesting) + }; + + Opal.modules["strscan"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $def = Opal.def, $truthy = Opal.truthy, $eqeqeq = Opal.eqeqeq, $Opal = Opal.Opal, $return_ivar = Opal.return_ivar, $send = Opal.send, $alias = Opal.alias, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('attr_reader,anchor,empty?,===,to_s,coerce_to!,scan_until,length,size,rest,pos=,beginning_of_line?,get_byte,private'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'StringScanner'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.pos = $proto.string = $proto.working = $proto.matched = $proto.prev_pos = $proto.match = nil; + + self.$attr_reader("pos", "matched"); + + $def(self, '$initialize', function $$initialize(string) { + var self = this; + + + self.string = string; + self.pos = 0; + self.matched = nil; + self.working = string; + return (self.match = []); + }); + self.$attr_reader("string"); + + $def(self, '$beginning_of_line?', function $StringScanner_beginning_of_line$ques$1() { + var self = this; + + return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n" + }); + + $def(self, '$scan', function $$scan(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + self.prev_pos = self.pos; + self.pos += result[0].length; + self.working = self.working.substring(result[0].length); + self.matched = result[0]; + self.match = result; + + return result[0]; + }); + + $def(self, '$scan_until', function $$scan_until(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var working = self.working; + + for(var i = 0; working.length != i; ++i) { + var result = pattern.exec(working.substr(i)); + if (result !== null) { + var matched_size = i + result[0].length; + var matched = working.substr(0, matched_size); + + self.matched = result[0]; + self.match = result; + self.prev_pos = self.pos + i; // Position of first character of matched + self.pos += matched_size; // Position one after last character of matched + self.working = working.substr(matched_size); + + return matched + } + } + return self.matched = nil; + }); + + $def(self, '$[]', function $StringScanner_$$$2(idx) { + var self = this, $ret_or_1 = nil; + + + if ($truthy(self.match['$empty?']())) { + return nil + } if ($eqeqeq($$('Symbol'), ($ret_or_1 = idx))) { + idx = idx.$to_s(); + } else if (!$eqeqeq($$('String'), $ret_or_1)) { + idx = $Opal['$coerce_to!'](idx, $$('Integer'), "to_int"); + } + var match = self.match; + + if (idx < 0) { + idx += match.length; + } + + if (idx < 0 || idx >= match.length) { + return nil; + } + + if (match[idx] == null) { + return nil; + } + + return match[idx]; + }); + + $def(self, '$check', function $$check(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + + return self.matched = result[0]; + }); + + $def(self, '$check_until', function $$check_until(pattern) { + var self = this; + + + var old_prev_pos = self.prev_pos; + var old_pos = self.pos; + var old_working = self.working; + + var result = self.$scan_until(pattern); + + self.prev_pos = old_prev_pos; + self.pos = old_pos; + self.working = old_working; + + return result; + + }); + + $def(self, '$peek', function $$peek(length) { + var self = this; + + return self.working.substring(0, length) + }); + + $def(self, '$eos?', function $StringScanner_eos$ques$3() { + var self = this; + + return self.working.length === 0 + }); + + $def(self, '$exist?', function $StringScanner_exist$ques$4(pattern) { + var self = this; + + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else if (result.index == 0) { + return 0; + } + else { + return result.index + 1; + } + + }); + + $def(self, '$skip', function $$skip(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + self.match = []; + return self.matched = nil; + } + else { + var match_str = result[0]; + var match_len = match_str.length; + + self.matched = match_str; + self.match = result; + self.prev_pos = self.pos; + self.pos += match_len; + self.working = self.working.substring(match_len); + + return match_len; + } + }); + + $def(self, '$skip_until', function $$skip_until(pattern) { + var self = this; + + + var result = self.$scan_until(pattern); + + if (result === nil) { + return nil; + } + else { + self.matched = result.substr(-1); + + return result.length; + } + + }); + + $def(self, '$get_byte', function $$get_byte() { + var self = this; + + + var result = nil; + + if (self.pos < self.string.length) { + self.prev_pos = self.pos; + self.pos += 1; + result = self.matched = self.working.substring(0, 1); + self.working = self.working.substring(1); + } + else { + self.matched = nil; + } + + return result; + + }); + + $def(self, '$match?', function $StringScanner_match$ques$5(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else { + self.prev_pos = self.pos; + + return result[0].length; + } + }); + + $def(self, '$pos=', function $StringScanner_pos$eq$6(pos) { + var self = this; + + + + if (pos < 0) { + pos += self.string.$length(); + } + self.pos = pos; + return (self.working = self.string.slice(pos)); + }); + + $def(self, '$matched_size', function $$matched_size() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.matched.length + + }); + + $def(self, '$post_match', function $$post_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(self.pos); + + }); + + $def(self, '$pre_match', function $$pre_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(0, self.prev_pos); + + }); + + $def(self, '$reset', function $$reset() { + var self = this; + + + self.working = self.string; + self.matched = nil; + return (self.pos = 0); + }); + + $def(self, '$rest', $return_ivar("working")); + + $def(self, '$rest?', function $StringScanner_rest$ques$7() { + var self = this; + + return self.working.length !== 0 + }); + + $def(self, '$rest_size', function $$rest_size() { + var self = this; + + return self.$rest().$size() + }); + + $def(self, '$terminate', function $$terminate() { + var $a, self = this; + + + self.match = nil; + return ($a = [self.string.$length()], $send(self, 'pos=', $a), $a[$a.length - 1]); + }); + + $def(self, '$unscan', function $$unscan() { + var self = this; + + + self.pos = self.prev_pos; + self.prev_pos = nil; + self.match = nil; + return self; + }); + $alias(self, "bol?", "beginning_of_line?"); + $alias(self, "getch", "get_byte"); + self.$private(); + return $def(self, '$anchor', function $$anchor(pattern) { + + + var flags = pattern.toString().match(/\/([^\/]+)$/); + flags = flags ? flags[1] : undefined; + return new RegExp('^(?:' + pattern.source + ')', flags); + + }); + })($nesting[0], null, $nesting) + }; + + Opal.modules["asciidoctor/js"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var self = Opal.top; Opal.nil; + + Opal.add_stubs('require'); + + self.$require("asciidoctor/js/opal_ext"); + self.$require("asciidoctor/js/rx"); + return self.$require("strscan"); + }; + + Opal.modules["asciidoctor/core_ext/nil_or_empty"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $truthy = Opal.truthy, $alias = Opal.alias, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('method_defined?,nil?,empty?'); + + (function($base, $super) { + var self = $klass($base, $super, 'NilClass'); + + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return $alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null); + (function($base, $super) { + var self = $klass($base, $super, 'String'); + + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return $alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null); + (function($base, $super) { + var self = $klass($base, $super, 'Array'); + + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return $alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null); + (function($base, $super) { + var self = $klass($base, $super, 'Hash'); + + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return $alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null); + return (function($base, $super) { + var self = $klass($base, $super, 'Numeric'); + + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return $alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null); + }; + + Opal.modules["asciidoctor/core_ext/hash/merge"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $eqeq = Opal.eqeq, $send = Opal.send, $slice = Opal.slice, $truthy = Opal.truthy, $rb_lt = Opal.rb_lt, $rb_gt = Opal.rb_gt, $send2 = Opal.send2, $find_super = Opal.find_super, $def = Opal.def, self = Opal.top, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil; + + Opal.add_stubs('==,arity,instance_method,send,new,<,length,dup,>,inject,merge,[]'); + if ($eqeq($$('Hash').$instance_method("merge").$arity(), 1)) { + return $$('Hash').$send("prepend", $send($$('Module'), 'new', [], function $$1(){var self = $$1.$$s == null ? this : $$1.$$s; + + return $def(self, '$merge', function $$merge($a) { + var $post_args, args; $$merge.$$p || nil; var self = this, len = nil; + + $$merge.$$p = null; + + $post_args = $slice(arguments); + args = $post_args; + if ($truthy($rb_lt((len = args.$length()), 1))) { + return self.$dup() + } else { + + if ($truthy($rb_gt(len, 1))) { + return $send(args, 'inject', [self], function $$2(acc, arg){ + + if (acc == null) acc = nil; + if (arg == null) arg = nil; + return acc.$merge(arg);}) + } else { + + return $send2(self, $find_super(self, 'merge', $$merge, false, true), 'merge', [args['$[]'](0)], null); + } } }, -1)}, {$$s: self})) + } else { + return nil + } + }; + + Opal.modules["asciidoctor/core_ext/match_data/names"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $truthy = Opal.truthy, $klass = Opal.klass, $def = Opal.def, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil; + + Opal.add_stubs('method_defined?'); + if ($truthy($$('MatchData')['$method_defined?']("names"))) { + return nil + } else { + return (function($base, $super) { + var self = $klass($base, $super, 'MatchData'); + + + return $def(self, '$names', function $$names() { + + return [] + }) + })($nesting[0], null) + } + }; + + Opal.modules["asciidoctor/core_ext"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var self = Opal.top; Opal.nil; + + + self.$require("asciidoctor/core_ext.rb"+ '/../' + "core_ext/nil_or_empty"); + self.$require("asciidoctor/core_ext.rb"+ '/../' + "core_ext/hash/merge"); + return self.$require("asciidoctor/core_ext.rb"+ '/../' + "core_ext/match_data/names"); + }; + + Opal.modules["asciidoctor/helpers"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $gvars = Opal.gvars, $def = Opal.def, $send = Opal.send, $neqeq = Opal.neqeq, $const_set = Opal.const_set, $hash2 = Opal.hash2, $to_ary = Opal.to_ary, $rb_times = Opal.rb_times, $eqeqeq = Opal.eqeqeq, $rb_plus = Opal.rb_plus, $Class = Opal.Class, $Object = Opal.Object, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('module_function,require,include?,include,==,path,message,raise,warn,logger,chomp,empty?,slice,unpack,[],[]=,byteslice,bytesize,map,rstrip,encode,encoding,nil_or_empty?,!=,tap,each_line,<<,!,start_with?,match?,gsub,rindex,index,basename,extname,length,directory?,dirname,mkdir_p,mkdir,private_constant,join,divmod,*,===,+,to_s,to_i,succ,class_for_name,const_get'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $parent_nesting) { + var self = $module($base, 'Helpers'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$module_function(); + + $def(self, '$require_library', function $$require_library(name, gem_name, on_failure) { + var self = this, details = nil; + if ($gvars["!"] == null) $gvars["!"] = nil; + + + if (gem_name == null) gem_name = true; + if (on_failure == null) on_failure = "abort"; + try { + return self.$require(name) + } catch ($err) { + if (Opal.rescue($err, [$$$('LoadError')])) { + try { + + if (!$truthy(self['$include?']($$('Logging')))) { + self.$include($$('Logging')); + }; + if ($truthy(gem_name)) { + + if ($eqeq(gem_name, true)) { + gem_name = name; + }; + + switch (on_failure) { + case "abort": + + details = ($eqeq($gvars["!"].$path(), gem_name) ? ("") : (" (reason: " + (($truthy($gvars["!"].$path()) ? ("cannot load '" + ($gvars["!"].$path()) + "'") : ($gvars["!"].$message()))) + ")")); + self.$raise($$$('LoadError'), "asciidoctor: FAILED: required gem '" + (gem_name) + "' is not available" + (details) + ". Processing aborted."); + break; + case "warn": + + details = ($eqeq($gvars["!"].$path(), gem_name) ? ("") : (" (reason: " + (($truthy($gvars["!"].$path()) ? ("cannot load '" + ($gvars["!"].$path()) + "'") : ($gvars["!"].$message()))) + ")")); + self.$logger().$warn("optional gem '" + (gem_name) + "' is not available" + (details) + ". Functionality disabled."); + break; + default: + nil; + }; + } else + switch (on_failure) { + case "abort": + self.$raise($$$('LoadError'), "asciidoctor: FAILED: " + ($gvars["!"].$message().$chomp(".")) + ". Processing aborted."); + break; + case "warn": + self.$logger().$warn("" + ($gvars["!"].$message().$chomp(".")) + ". Functionality disabled."); + break; + default: + nil; + }; + return nil; + } finally { Opal.pop_exception(); } + } else { throw $err; } + } }, -2); + + $def(self, '$prepare_source_array', function $$prepare_source_array(data, trim_end) { + var leading_2_bytes = nil, leading_bytes = nil, first = nil; + + + if (trim_end == null) trim_end = true; + if ($truthy(data['$empty?']())) { + return [] + } if ($eqeq((leading_2_bytes = (leading_bytes = (first = data['$[]'](0)).$unpack("C3")).$slice(0, 2)), $$('BOM_BYTES_UTF_16LE'))) { + + data['$[]='](0, first.$byteslice(2, first.$bytesize())); + return ($truthy(trim_end) ? ($send(data, 'map', [], function $$1(line){ + + if (line == null) line = nil; + return line.$encode($$('UTF_8'), $$$($$$('Encoding'), 'UTF_16LE')).$rstrip();})) : ($send(data, 'map', [], function $$2(line){ + + if (line == null) line = nil; + return line.$encode($$('UTF_8'), $$$($$$('Encoding'), 'UTF_16LE')).$chomp();}))); + } else if ($eqeq(leading_2_bytes, $$('BOM_BYTES_UTF_16BE'))) { + + data['$[]='](0, first.$byteslice(2, first.$bytesize())); + return ($truthy(trim_end) ? ($send(data, 'map', [], function $$3(line){ + + if (line == null) line = nil; + return line.$encode($$('UTF_8'), $$$($$$('Encoding'), 'UTF_16BE')).$rstrip();})) : ($send(data, 'map', [], function $$4(line){ + + if (line == null) line = nil; + return line.$encode($$('UTF_8'), $$$($$$('Encoding'), 'UTF_16BE')).$chomp();}))); + } else if ($eqeq(leading_bytes, $$('BOM_BYTES_UTF_8'))) { + data['$[]='](0, first.$byteslice(3, first.$bytesize())); + } if ($eqeq(first.$encoding(), $$('UTF_8'))) { + if ($truthy(trim_end)) { + return $send(data, 'map', [], function $$5(line){ + + if (line == null) line = nil; + return line.$rstrip();}) + } else { + return $send(data, 'map', [], function $$6(line){ + + if (line == null) line = nil; + return line.$chomp();}) + } + } else if ($truthy(trim_end)) { + return $send(data, 'map', [], function $$7(line){ + + if (line == null) line = nil; + return line.$encode($$('UTF_8')).$rstrip();}) + } else { + return $send(data, 'map', [], function $$8(line){ + + if (line == null) line = nil; + return line.$encode($$('UTF_8')).$chomp();}) + } }, -2); + + $def(self, '$prepare_source_string', function $$prepare_source_string(data, trim_end) { + var leading_2_bytes = nil, leading_bytes = nil; + + + if (trim_end == null) trim_end = true; + if ($truthy(data['$nil_or_empty?']())) { + return [] + } if ($eqeq((leading_2_bytes = (leading_bytes = data.$unpack("C3")).$slice(0, 2)), $$('BOM_BYTES_UTF_16LE'))) { + data = data.$byteslice(2, data.$bytesize()).$encode($$('UTF_8'), $$$($$$('Encoding'), 'UTF_16LE')); + } else if ($eqeq(leading_2_bytes, $$('BOM_BYTES_UTF_16BE'))) { + data = data.$byteslice(2, data.$bytesize()).$encode($$('UTF_8'), $$$($$$('Encoding'), 'UTF_16BE')); + } else if ($eqeq(leading_bytes, $$('BOM_BYTES_UTF_8'))) { + + data = data.$byteslice(3, data.$bytesize()); + if (!$eqeq(data.$encoding(), $$('UTF_8'))) { + data = data.$encode($$('UTF_8')); + } } else if ($neqeq(data.$encoding(), $$('UTF_8'))) { + data = data.$encode($$('UTF_8')); + } if ($truthy(trim_end)) { + return $send([], 'tap', [], function $$9(lines){ + + if (lines == null) lines = nil; + return $send(data, 'each_line', [], function $$10(line){ + + if (line == null) line = nil; + return lines['$<<'](line.$rstrip());});}) + } else { + return $send([], 'tap', [], function $$11(lines){ + + if (lines == null) lines = nil; + return $send(data, 'each_line', [], function $$12(line){ + + if (line == null) line = nil; + return lines['$<<'](line.$chomp());});}) + } }, -2); + if ($eqeq($$$('RUBY_ENGINE'), "jruby")) { + + $def(self, '$uriish?', function $Helpers_uriish$ques$13(str) { + var $ret_or_1 = nil, $ret_or_2 = nil; + + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = str['$include?'](":"))) ? (str['$start_with?']("uri:classloader:")['$!']()) : ($ret_or_2))))) { + + return $$('UriSniffRx')['$match?'](str); + } else { + return $ret_or_1 + } + }); + } else { + + $def(self, '$uriish?', function $Helpers_uriish$ques$14(str) { + var $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = str['$include?'](":")))) { + + return $$('UriSniffRx')['$match?'](str); + } else { + return $ret_or_1 + } + }); + } + $def(self, '$encode_uri_component', function $$encode_uri_component(str) { + + + return encodeURIComponent(str).replace(/%20|[!'()*]/g, function (m) { + return m === '%20' ? '+' : '%' + m.charCodeAt(0).toString(16) + }) + + }); + + $def(self, '$encode_spaces_in_uri', function $$encode_spaces_in_uri(str) { + + if ($truthy(str['$include?'](" "))) { + + return str.$gsub(" ", "%20"); + } else { + return str + } + }); + + $def(self, '$rootname', function $$rootname(filename) { + var last_dot_idx = nil; + + if ($truthy((last_dot_idx = filename.$rindex(".")))) { + if ($truthy(filename.$index("/", last_dot_idx))) { + return filename + } else { + + return filename.$slice(0, last_dot_idx); + } + } else { + return filename + } + }); + + $def(self, '$basename', function $$basename(filename, drop_ext) { + var self = this; + + + if (drop_ext == null) drop_ext = nil; + if ($truthy(drop_ext)) { + return $$$('File').$basename(filename, ($eqeq(drop_ext, true) ? (self.$extname(filename)) : (drop_ext))) + } else { + return $$$('File').$basename(filename) + } }, -2); + + $def(self, '$extname?', function $Helpers_extname$ques$15(path) { + var $ret_or_1 = nil, last_dot_idx = nil; + + if ($truthy(($ret_or_1 = (last_dot_idx = path.$rindex("."))))) { + return path.$index("/", last_dot_idx)['$!']() + } else { + return $ret_or_1 + } + }); + if ($truthy($$$($$$('File'), 'ALT_SEPARATOR'))) { + + $def(self, '$extname', function $$extname(path, fallback) { + var last_dot_idx = nil; + + + if (fallback == null) fallback = ""; + if ($truthy((last_dot_idx = path.$rindex(".")))) { + if (($truthy(path.$index("/", last_dot_idx)) || ($truthy(path.$index($$$($$$('File'), 'ALT_SEPARATOR'), last_dot_idx))))) { + return fallback + } else { + + return path.$slice(last_dot_idx, path.$length()); + } + } else { + return fallback + } }, -2); + } else { + + $def(self, '$extname', function $$extname(path, fallback) { + var last_dot_idx = nil; + + + if (fallback == null) fallback = ""; + if ($truthy((last_dot_idx = path.$rindex(".")))) { + if ($truthy(path.$index("/", last_dot_idx))) { + return fallback + } else { + + return path.$slice(last_dot_idx, path.$length()); + } + } else { + return fallback + } }, -2); + } + $def(self, '$mkdir_p', function $$mkdir_p(dir) { + var self = this, parent_dir = nil; + + if ($truthy($$$('File')['$directory?'](dir))) { + return nil + } else { + + if (!$eqeq((parent_dir = $$$('File').$dirname(dir)), ".")) { + self.$mkdir_p(parent_dir); + } + try { + return $$$('Dir').$mkdir(dir) + } catch ($err) { + if (Opal.rescue($err, [$$$('SystemCallError')])) { + try { + if ($truthy($$$('File')['$directory?'](dir))) { + return nil + } else { + return self.$raise() + } + } finally { Opal.pop_exception(); } + } else { throw $err; } + } } + }); + $const_set($nesting[0], 'ROMAN_NUMERALS', $hash2(["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"], {"M": 1000, "CM": 900, "D": 500, "CD": 400, "C": 100, "XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9, "V": 5, "IV": 4, "I": 1})); + self.$private_constant("ROMAN_NUMERALS"); + + $def(self, '$int_to_roman', function $$int_to_roman(val) { + + return $send($$('ROMAN_NUMERALS'), 'map', [], function $$16(l, i){var $a, $b, repeat = nil; + + + if (l == null) l = nil; + if (i == null) i = nil; + $b = val.$divmod(i), $a = $to_ary($b), (repeat = ($a[0] == null ? nil : $a[0])), (val = ($a[1] == null ? nil : $a[1])); + return $rb_times(l, repeat);}).$join() + }); + + $def(self, '$nextval', function $$nextval(current) { + var intval = nil; + + if ($eqeqeq($$$('Integer'), current)) { + return $rb_plus(current, 1) + } else if ($eqeq((intval = current.$to_i()).$to_s(), current.$to_s())) { + return $rb_plus(intval, 1) + } else { + return current.$succ() + } + }); + + $def(self, '$resolve_class', function $$resolve_class(object) { + var self = this; + + if ($eqeqeq($Class, object)) { + return object + } else { + + if ($eqeqeq($$$('String'), object)) { + + return self.$class_for_name(object); + } else { + return nil + } } + }); + return $def(self, '$class_for_name', function $$class_for_name(qualified_name) { + var self = this, resolved = nil; + + try { + + if (!$eqeqeq($Class, (resolved = $Object.$const_get(qualified_name, false)))) { + self.$raise(); + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + return self.$raise($$$('NameError'), "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception(); } + } else { throw $err; } + } + }); + })($nesting[0], $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["logger"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $module = Opal.module, $const_set = Opal.const_set, $send = Opal.send, $def = Opal.def, $eqeqeq = Opal.eqeqeq, $rb_plus = Opal.rb_plus, $truthy = Opal.truthy, $rb_le = Opal.rb_le, $rb_lt = Opal.rb_lt, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('include,to_h,map,constants,const_get,to_s,format,chr,strftime,message_as_string,===,+,message,class,join,backtrace,inspect,attr_reader,attr_accessor,new,key,upcase,raise,add,to_proc,<=,<,write,call,[],now'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Logger'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.level = $proto.progname = $proto.pipe = $proto.formatter = nil; + + (function($base, $parent_nesting) { + var self = $module($base, 'Severity'); + + var $nesting = [self].concat($parent_nesting); + + + $const_set($nesting[0], 'DEBUG', 0); + $const_set($nesting[0], 'INFO', 1); + $const_set($nesting[0], 'WARN', 2); + $const_set($nesting[0], 'ERROR', 3); + $const_set($nesting[0], 'FATAL', 4); + return $const_set($nesting[0], 'UNKNOWN', 5); + })($nesting[0], $nesting); + self.$include($$('Severity')); + $const_set($nesting[0], 'SEVERITY_LABELS', $send($$('Severity').$constants(), 'map', [], function $Logger$1(s){ + + if (s == null) s = nil; + return [$$('Severity').$const_get(s), s.$to_s()];}).$to_h()); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Formatter'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $const_set($nesting[0], 'MESSAGE_FORMAT', "%s, [%s] %5s -- %s: %s\n"); + $const_set($nesting[0], 'DATE_TIME_FORMAT', "%Y-%m-%dT%H:%M:%S.%6N"); + + $def(self, '$call', function $$call(severity, time, progname, msg) { + var self = this; + + return self.$format($$('MESSAGE_FORMAT'), severity.$chr(), time.$strftime($$('DATE_TIME_FORMAT')), severity, progname, self.$message_as_string(msg)) + }); + return $def(self, '$message_as_string', function $$message_as_string(msg) { + var $ret_or_1 = nil, $ret_or_2 = nil; + + if ($eqeqeq($$$('String'), ($ret_or_1 = msg))) { + return msg + } else if ($eqeqeq($$$('Exception'), $ret_or_1)) { + return $rb_plus("" + (msg.$message()) + " (" + (msg.$class()) + ")\n", ($truthy(($ret_or_2 = msg.$backtrace())) ? ($ret_or_2) : ([])).$join("\n")) + } else { + return msg.$inspect() + } + }); + })($nesting[0], null, $nesting); + self.$attr_reader("level"); + self.$attr_accessor("progname"); + self.$attr_accessor("formatter"); + + $def(self, '$initialize', function $$initialize(pipe) { + var self = this; + + + self.pipe = pipe; + self.level = $$('DEBUG'); + return (self.formatter = $$('Formatter').$new()); + }); + + $def(self, '$level=', function $Logger_level$eq$2(severity) { + var self = this, level = nil; + + if ($eqeqeq($$$('Integer'), severity)) { + return (self.level = severity) + } else if ($truthy((level = $$('SEVERITY_LABELS').$key(severity.$to_s().$upcase())))) { + return (self.level = level) + } else { + return self.$raise($$('ArgumentError'), "invalid log level: " + (severity)) + } + }); + + $def(self, '$info', function $$info(progname) { + var block = $$info.$$p || nil, self = this; + + $$info.$$p = null; + if (progname == null) progname = nil; + return $send(self, 'add', [$$('INFO'), nil, progname], block.$to_proc()); + }, -1); + + $def(self, '$debug', function $$debug(progname) { + var block = $$debug.$$p || nil, self = this; + + $$debug.$$p = null; + if (progname == null) progname = nil; + return $send(self, 'add', [$$('DEBUG'), nil, progname], block.$to_proc()); + }, -1); + + $def(self, '$warn', function $$warn(progname) { + var block = $$warn.$$p || nil, self = this; + + $$warn.$$p = null; + if (progname == null) progname = nil; + return $send(self, 'add', [$$('WARN'), nil, progname], block.$to_proc()); + }, -1); + + $def(self, '$error', function $$error(progname) { + var block = $$error.$$p || nil, self = this; + + $$error.$$p = null; + if (progname == null) progname = nil; + return $send(self, 'add', [$$('ERROR'), nil, progname], block.$to_proc()); + }, -1); + + $def(self, '$fatal', function $$fatal(progname) { + var block = $$fatal.$$p || nil, self = this; + + $$fatal.$$p = null; + if (progname == null) progname = nil; + return $send(self, 'add', [$$('FATAL'), nil, progname], block.$to_proc()); + }, -1); + + $def(self, '$unknown', function $$unknown(progname) { + var block = $$unknown.$$p || nil, self = this; + + $$unknown.$$p = null; + if (progname == null) progname = nil; + return $send(self, 'add', [$$('UNKNOWN'), nil, progname], block.$to_proc()); + }, -1); + + $def(self, '$info?', function $Logger_info$ques$3() { + var self = this; + + return $rb_le(self.level, $$('INFO')) + }); + + $def(self, '$debug?', function $Logger_debug$ques$4() { + var self = this; + + return $rb_le(self.level, $$('DEBUG')) + }); + + $def(self, '$warn?', function $Logger_warn$ques$5() { + var self = this; + + return $rb_le(self.level, $$('WARN')) + }); + + $def(self, '$error?', function $Logger_error$ques$6() { + var self = this; + + return $rb_le(self.level, $$('ERROR')) + }); + + $def(self, '$fatal?', function $Logger_fatal$ques$7() { + var self = this; + + return $rb_le(self.level, $$('FATAL')) + }); + return $def(self, '$add', function $$add(severity, message, progname) { + var block = $$add.$$p || nil, self = this, $ret_or_1 = nil; + + $$add.$$p = null; + if (message == null) message = nil; + if (progname == null) progname = nil; + if ($truthy($rb_lt((severity = ($truthy(($ret_or_1 = severity)) ? ($ret_or_1) : ($$('UNKNOWN')))), self.level))) { + return true + } progname = ($truthy(($ret_or_1 = progname)) ? ($ret_or_1) : (self.progname)); + if (!$truthy(message)) { + if ((block !== nil)) { + message = Opal.yieldX(block, []); + } else { + + message = progname; + progname = self.progname; + } + } self.pipe.$write(self.formatter.$call(($truthy(($ret_or_1 = $$('SEVERITY_LABELS')['$[]'](severity))) ? ($ret_or_1) : ("ANY")), $$$('Time').$now(), progname, message)); + return true; + }, -2); + })($nesting[0], null, $nesting) + }; + + Opal.modules["asciidoctor/logging"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $slice = Opal.slice, $send2 = Opal.send2, $find_super = Opal.find_super, $to_a = Opal.to_a, $send = Opal.send, $def = Opal.def, $truthy = Opal.truthy, $rb_gt = Opal.rb_gt, $const_set = Opal.const_set, $hash2 = Opal.hash2, $eqeqeq = Opal.eqeqeq, $gvars = Opal.gvars, $alias = Opal.alias, $defs = Opal.defs, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,attr_reader,progname=,formatter=,new,level=,>,[],===,inspect,to_h,map,constants,const_get,<<,clear,empty?,max,attr_accessor,memoize_logger,private,logger,extend,private_class_method,merge'); + + self.$require("logger"); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Logger'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.max_severity = nil; + + self.$attr_reader("max_severity"); + + $def(self, '$initialize', function $$initialize($a) { + var $post_args, args, $b, $yield = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + + $post_args = $slice(arguments); + args = $post_args; + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', $to_a(args), $yield); + self['$progname=']("asciidoctor"); + self['$formatter=']($$('BasicFormatter').$new()); + return ($b = [$$('WARN')], $send(self, 'level=', $b), $b[$b.length - 1]); + }, -1); + + $def(self, '$add', function $$add(severity, message, progname) { + var $yield = $$add.$$p || nil, self = this, $ret_or_1 = nil; + + $$add.$$p = null; + + if (message == null) message = nil; + if (progname == null) progname = nil; + if ($truthy($rb_gt((severity = ($truthy(($ret_or_1 = severity)) ? ($ret_or_1) : ($$('UNKNOWN')))), (self.max_severity = ($truthy(($ret_or_1 = self.max_severity)) ? ($ret_or_1) : (severity)))))) { + self.max_severity = severity; + } return $send2(self, $find_super(self, 'add', $$add, false, true), 'add', [severity, message, progname], $yield); + }, -2); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'BasicFormatter'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $const_set($nesting[0], 'SEVERITY_LABEL_SUBSTITUTES', $hash2(["WARN", "FATAL"], {"WARN": "WARNING", "FATAL": "FAILED"})); + return $def(self, '$call', function $$call(severity, _, progname, msg) { + var $ret_or_1 = nil; + + return "" + (progname) + ": " + (($truthy(($ret_or_1 = $$('SEVERITY_LABEL_SUBSTITUTES')['$[]'](severity))) ? ($ret_or_1) : (severity))) + ": " + (($eqeqeq($$$('String'), msg) ? (msg) : (msg.$inspect()))) + ($$('LF')) + }); + })($nesting[0], $$('Formatter'), $nesting); + return (function($base) { + var self = $module($base, 'AutoFormattingMessage'); + + + return $def(self, '$inspect', function $$inspect() { + var self = this, sloc = nil; + + if ($truthy((sloc = self['$[]']("source_location")))) { + return "" + (sloc) + ": " + (self['$[]']("text")) + } else { + return self['$[]']("text") + } + }) + })($nesting[0]); + })($nesting[0], $$$('Logger'), $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'MemoryLogger'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.messages = nil; + + $const_set($nesting[0], 'SEVERITY_SYMBOL_BY_VALUE', $send($$('Severity').$constants(false), 'map', [], function $MemoryLogger$1(c){ + + if (c == null) c = nil; + return [$$('Severity').$const_get(c), c];}).$to_h()); + self.$attr_reader("messages"); + + $def(self, '$initialize', function $$initialize() { + var self = this; + + + self['$level=']($$('WARN')); + return (self.messages = []); + }); + + $def(self, '$add', function $$add(severity, message, progname) { + var $yield = $$add.$$p || nil, self = this, $ret_or_1 = nil; + + $$add.$$p = null; + + if (message == null) message = nil; + if (progname == null) progname = nil; + message = ($truthy(($ret_or_1 = message)) ? ($ret_or_1) : (($yield !== nil) ? (Opal.yieldX($yield, [])) : (progname))); + self.messages['$<<']($hash2(["severity", "message"], {"severity": $$('SEVERITY_SYMBOL_BY_VALUE')['$[]'](($truthy(($ret_or_1 = severity)) ? ($ret_or_1) : ($$('UNKNOWN')))), "message": message})); + return true; + }, -2); + + $def(self, '$clear', function $$clear() { + var self = this; + + return self.messages.$clear() + }); + + $def(self, '$empty?', function $MemoryLogger_empty$ques$2() { + var self = this; + + return self.messages['$empty?']() + }); + return $def(self, '$max_severity', function $$max_severity() { + var self = this; + + if ($truthy(self['$empty?']())) { + return nil + } else { + return $send(self.messages, 'map', [], function $$3(m){ + + if (m == null) m = nil; + return $$('Severity').$const_get(m['$[]']("severity"));}).$max() + } + }); + })($nesting[0], $$$('Logger'), $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'NullLogger'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.max_severity = nil; + + self.$attr_reader("max_severity"); + + $def(self, '$initialize', function $$initialize() { + var $a, self = this; + + return ($a = [$$('WARN')], $send(self, 'level=', $a), $a[$a.length - 1]) + }); + return $def(self, '$add', function $$add(severity, message, progname) { + var self = this, $ret_or_1 = nil; + if ($truthy($rb_gt((severity = ($truthy(($ret_or_1 = severity)) ? ($ret_or_1) : ($$('UNKNOWN')))), (self.max_severity = ($truthy(($ret_or_1 = self.max_severity)) ? ($ret_or_1) : (severity)))))) { + self.max_severity = severity; + } return true; + }, -2); + })($nesting[0], $$$('Logger'), $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'LoggerManager'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.logger_class = $$('Logger'); + return (function(self, $parent_nesting) { + + + self.$attr_accessor("logger_class"); + + $def(self, '$logger', function $$logger(pipe) { + var self = this, $ret_or_1 = nil; + if (self.logger == null) self.logger = nil; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + if (pipe == null) pipe = $gvars.stderr; + self.$memoize_logger(); + return (self.logger = ($truthy(($ret_or_1 = self.logger)) ? ($ret_or_1) : (self.logger_class.$new(pipe)))); + }, -1); + + $def(self, '$logger=', function $logger$eq$4(new_logger) { + var self = this, $ret_or_1 = nil; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + return (self.logger = ($truthy(($ret_or_1 = new_logger)) ? ($ret_or_1) : (self.logger_class.$new($gvars.stderr)))) + }); + self.$private(); + return $def(self, '$memoize_logger', function $$memoize_logger() { + var self = this; + + return (function(self, $parent_nesting) { + + + $alias(self, "logger", "logger"); + return self.$attr_reader("logger"); + })(Opal.get_singleton_class(self)) + }); + })(Opal.get_singleton_class(self)); + })($nesting[0], $nesting); + return (function($base, $parent_nesting) { + var self = $module($base, 'Logging'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $defs(self, '$included', function $$included(into) { + + return into.$extend($$('Logging')) + }); + self.$private_class_method("included"); + + $def(self, '$logger', function $$logger() { + + return $$('LoggerManager').$logger() + }); + return $def(self, '$message_with_context', function $$message_with_context(text, context) { + + + if (context == null) context = $hash2([], {}); + return $hash2(["text"], {"text": text}).$merge(context).$extend($$$($$('Logger'), 'AutoFormattingMessage')); + }, -2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); + }; + + Opal.modules["asciidoctor/rx"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $const_set = Opal.const_set, $regexp = Opal.regexp, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $hash = Opal.hash, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('join,to_a,new,[]=,empty?,escape'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $module($nesting[0], 'Rx'); + $const_set($nesting[0], 'AuthorInfoLineRx', $regexp(["^(", $$('CG_WORD'), "[", $$('CC_WORD'), "\\-'.]*)(?: +(", $$('CG_WORD'), "[", $$('CC_WORD'), "\\-'.]*))?(?: +(", $$('CG_WORD'), "[", $$('CC_WORD'), "\\-'.]*))?(?: +<([^>]+)>)?$"])); + $const_set($nesting[0], 'AuthorDelimiterRx', /;(?: |$)/); + $const_set($nesting[0], 'RevisionInfoLineRx', $regexp(["^(?:[^\\d{]*(", $$('CC_ANY'), "*?),)? *(?!:)(", $$('CC_ANY'), "*?)(?: *(?!^),?: *(", $$('CC_ANY'), "*))?$"])); + $const_set($nesting[0], 'ManpageTitleVolnumRx', $regexp(["^(", $$('CC_ANY'), "+?) *\\( *(", $$('CC_ANY'), "+?) *\\)$"])); + $const_set($nesting[0], 'ManpageNamePurposeRx', $regexp(["^(", $$('CC_ANY'), "+?) +- +(", $$('CC_ANY'), "+)$"])); + $const_set($nesting[0], 'ConditionalDirectiveRx', $regexp(["^(\\\\)?(ifdef|ifndef|ifeval|endif)::(\\S*?(?:([,+])\\S*?)?)\\[(", $$('CC_ANY'), "+)?\\]$"])); + $const_set($nesting[0], 'EvalExpressionRx', $regexp(["^(", $$('CC_ANY'), "+?) *([=!><]=|[><]) *(", $$('CC_ANY'), "+)$"])); + $const_set($nesting[0], 'IncludeDirectiveRx', $regexp(["^(\\\\)?include::([^\\s\\[](?:[^\\[]*[^\\s\\[])?)\\[(", $$('CC_ANY'), "+)?\\]$"])); + $const_set($nesting[0], 'TagDirectiveRx', /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m); + $const_set($nesting[0], 'AttributeEntryRx', $regexp(["^:(!?", $$('CG_WORD'), "[^:]*):(?:[ \\t]+(", $$('CC_ANY'), "*))?$"])); + $const_set($nesting[0], 'InvalidAttributeNameCharsRx', $regexp(["[^", $$('CC_WORD'), "-]"])); + $const_set($nesting[0], 'AttributeEntryPassMacroRx', $regexp(["^pass:([a-z]+(?:,[a-z-]+)*)?\\[(", $$('CC_ALL'), "*)\\]$"])); + $const_set($nesting[0], 'AttributeReferenceRx', $regexp(["(\\\\)?\\{(", $$('CG_WORD'), "[", $$('CC_WORD'), "-]*|(set|counter2?):", $$('CC_ANY'), "+?)(\\\\)?\\}"])); + $const_set($nesting[0], 'BlockAnchorRx', $regexp(["^\\[\\[(?:|([", $$('CC_ALPHA'), "_:][", $$('CC_WORD'), "\\-:.]*)(?:, *(", $$('CC_ANY'), "+))?)\\]\\]$"])); + $const_set($nesting[0], 'BlockAttributeListRx', $regexp(["^\\[(|[", $$('CC_WORD'), ".#%{,\"']", $$('CC_ANY'), "*)\\]$"])); + $const_set($nesting[0], 'BlockAttributeLineRx', $regexp(["^\\[(?:|[", $$('CC_WORD'), ".#%{,\"']", $$('CC_ANY'), "*|\\[(?:|[", $$('CC_ALPHA'), "_:][", $$('CC_WORD'), "\\-:.]*(?:, *", $$('CC_ANY'), "+)?)\\])\\]$"])); + $const_set($nesting[0], 'BlockTitleRx', $regexp(["^\\.(\\.?[^ \\t.]", $$('CC_ANY'), "*)$"])); + $const_set($nesting[0], 'AdmonitionParagraphRx', $regexp(["^(", $$('ADMONITION_STYLES').$to_a().$join("|"), "):[ \\t]+"])); + $const_set($nesting[0], 'LiteralParagraphRx', $regexp(["^([ \\t]+", $$('CC_ANY'), "*)$"])); + $const_set($nesting[0], 'AtxSectionTitleRx', $regexp(["^(=={0,5})[ \\t]+(", $$('CC_ANY'), "+?)(?:[ \\t]+\\1)?$"])); + $const_set($nesting[0], 'ExtAtxSectionTitleRx', $regexp(["^(=={0,5}|#\\\#{0,5})[ \\t]+(", $$('CC_ANY'), "+?)(?:[ \\t]+\\1)?$"])); + $const_set($nesting[0], 'SetextSectionTitleRx', $regexp(["^((?!\\.)", $$('CC_ANY'), "*?", $$('CG_ALNUM'), $$('CC_ANY'), "*)$"])); + $const_set($nesting[0], 'InlineSectionAnchorRx', $regexp([" (\\\\)?\\[\\[([", $$('CC_ALPHA'), "_:][", $$('CC_WORD'), "\\-:.]*)(?:, *(", $$('CC_ANY'), "+))?\\]\\]$"])); + $const_set($nesting[0], 'InvalidSectionIdCharsRx', $regexp(["<[^>]+>|&(?:[a-z][a-z]+\\d{0,2}|#\\d\\d\\d{0,4}|#x[\\da-f][\\da-f][\\da-f]{0,3});|[^ ", $$('CC_WORD'), "\\-.]+?"])); + $const_set($nesting[0], 'SectionLevelStyleRx', /^sect\d$/); + $const_set($nesting[0], 'AnyListRx', $regexp(["^(?:[ \\t]*(?:-|\\*\\**|\\.\\.*|\\u2022|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]|(?!//[^/])[ \\t]*[^ \\t]", $$('CC_ANY'), "*?(?::::{0,2}|;;)(?:$|[ \\t])|<(?:\\d+|\\.)>[ \\t])"])); + $const_set($nesting[0], 'UnorderedListRx', $regexp(["^[ \\t]*(-|\\*\\**|\\u2022)[ \\t]+(", $$('CC_ANY'), "*)$"])); + $const_set($nesting[0], 'OrderedListRx', $regexp(["^[ \\t]*(\\.\\.*|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]+(", $$('CC_ANY'), "*)$"])); + $const_set($nesting[0], 'OrderedListMarkerRxMap', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+\./, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/})); + $const_set($nesting[0], 'DescriptionListRx', $regexp(["^(?!//[^/])[ \\t]*([^ \\t]", $$('CC_ANY'), "*?)(:::{0,2}|;;)(?:$|[ \\t]+(", $$('CC_ANY'), "*)$)"])); + $const_set($nesting[0], 'DescriptionListSiblingRx', $hash2(["::", ":::", "::::", ";;"], {"::": $regexp(["^(?!//[^/])[ \\t]*([^ \\t]", $$('CC_ANY'), "*?[^:]|[^ \\t:])(::)(?:$|[ \\t]+(", $$('CC_ANY'), "*)$)"]), ":::": $regexp(["^(?!//[^/])[ \\t]*([^ \\t]", $$('CC_ANY'), "*?[^:]|[^ \\t:])(:::)(?:$|[ \\t]+(", $$('CC_ANY'), "*)$)"]), "::::": $regexp(["^(?!//[^/])[ \\t]*([^ \\t]", $$('CC_ANY'), "*?[^:]|[^ \\t:])(::::)(?:$|[ \\t]+(", $$('CC_ANY'), "*)$)"]), ";;": $regexp(["^(?!//[^/])[ \\t]*([^ \\t]", $$('CC_ANY'), "*?)(;;)(?:$|[ \\t]+(", $$('CC_ANY'), "*)$)"])})); + $const_set($nesting[0], 'CalloutListRx', $regexp(["^<(\\d+|\\.)>[ \\t]+(", $$('CC_ANY'), "*)$"])); + $const_set($nesting[0], 'CalloutExtractRx', /((?:\/\/|#|--|;;) ?)?(\\)?(?=(?: ?\\?)*$)/); + $const_set($nesting[0], 'CalloutExtractRxt', "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)"); + $const_set($nesting[0], 'CalloutExtractRxMap', $send($$$('Hash'), 'new', [], function $Asciidoctor$1(h, k){var $a; + + + if (h == null) h = nil; + if (k == null) k = nil; + return ($a = [k, $regexp(["(", ($truthy(k['$empty?']()) ? ("") : ("" + ($$$('Regexp').$escape(k)) + " ?")), ")?", $$('CalloutExtractRxt')])], $send(h, '[]=', $a), $a[$a.length - 1]);})); + $const_set($nesting[0], 'CalloutScanRx', $regexp(["\\\\?(?=(?: ?\\\\?)*", $$('CC_EOL'), ")"])); + $const_set($nesting[0], 'CalloutSourceRx', $regexp(["((?://|#|--|;;) ?)?(\\\\)?<!?(|--)(\\d+|\\.)\\3>(?=(?: ?\\\\?<!?\\3(?:\\d+|\\.)\\3>)*", $$('CC_EOL'), ")"])); + $const_set($nesting[0], 'CalloutSourceRxt', "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*" + ($$('CC_EOL')) + ")"); + $const_set($nesting[0], 'CalloutSourceRxMap', $send($$$('Hash'), 'new', [], function $Asciidoctor$2(h, k){var $a; + + + if (h == null) h = nil; + if (k == null) k = nil; + return ($a = [k, $regexp(["(", ($truthy(k['$empty?']()) ? ("") : ("" + ($$$('Regexp').$escape(k)) + " ?")), ")?", $$('CalloutSourceRxt')])], $send(h, '[]=', $a), $a[$a.length - 1]);})); + $const_set($nesting[0], 'ListRxMap', $hash2(["ulist", "olist", "dlist", "colist"], {"ulist": $$('UnorderedListRx'), "olist": $$('OrderedListRx'), "dlist": $$('DescriptionListRx'), "colist": $$('CalloutListRx')})); + $const_set($nesting[0], 'ColumnSpecRx', /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?|~)?([a-z])?$/); + $const_set($nesting[0], 'CellSpecStartRx', /^[ \t]*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + $const_set($nesting[0], 'CellSpecEndRx', /[ \t]+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + $const_set($nesting[0], 'CustomBlockMacroRx', $regexp(["^(", $$('CG_WORD'), "[", $$('CC_WORD'), "-]*)::(|\\S|\\S", $$('CC_ANY'), "*?\\S)\\[(", $$('CC_ANY'), "+)?\\]$"])); + $const_set($nesting[0], 'BlockMediaMacroRx', $regexp(["^(image|video|audio)::(\\S|\\S", $$('CC_ANY'), "*?\\S)\\[(", $$('CC_ANY'), "+)?\\]$"])); + $const_set($nesting[0], 'BlockTocMacroRx', $regexp(["^toc::\\[(", $$('CC_ANY'), "+)?\\]$"])); + $const_set($nesting[0], 'InlineAnchorRx', $regexp(["(\\\\)?(?:\\[\\[([", $$('CC_ALPHA'), "_:][", $$('CC_WORD'), "\\-:.]*)(?:, *(", $$('CC_ANY'), "+?))?\\]\\]|anchor:([", $$('CC_ALPHA'), "_:][", $$('CC_WORD'), "\\-:.]*)\\[(?:\\]|(", $$('CC_ANY'), "*?[^\\\\])\\]))"])); + $const_set($nesting[0], 'InlineAnchorScanRx', $regexp(["(?:^|[^\\\\\\[])\\[\\[([", $$('CC_ALPHA'), "_:][", $$('CC_WORD'), "\\-:.]*)(?:, *(", $$('CC_ANY'), "+?))?\\]\\]|(?:^|[^\\\\])anchor:([", $$('CC_ALPHA'), "_:][", $$('CC_WORD'), "\\-:.]*)\\[(?:\\]|(", $$('CC_ANY'), "*?[^\\\\])\\])"])); + $const_set($nesting[0], 'LeadingInlineAnchorRx', $regexp(["^\\[\\[([", $$('CC_ALPHA'), "_:][", $$('CC_WORD'), "\\-:.]*)(?:, *(", $$('CC_ANY'), "+?))?\\]\\]"])); + $const_set($nesting[0], 'InlineBiblioAnchorRx', $regexp(["^\\[\\[\\[([", $$('CC_ALPHA'), "_:][", $$('CC_WORD'), "\\-:.]*)(?:, *(", $$('CC_ANY'), "+?))?\\]\\]\\]"])); + $const_set($nesting[0], 'InlineEmailRx', $regexp(["([\\\\>:/])?", $$('CG_WORD'), "(?:&|[", $$('CC_WORD'), "\\-.%+])*@", $$('CG_ALNUM'), "[", $$('CC_ALNUM'), "_\\-.]*\\.[a-zA-Z]{2,5}\\b"])); + $const_set($nesting[0], 'InlineFootnoteMacroRx', $regexp(["\\\\?footnote(?:(ref):|:([", $$('CC_WORD'), "-]+)?)\\[(?:|(", $$('CC_ALL'), "*?[^\\\\]))\\](?!)"], 'm')); + $const_set($nesting[0], 'InlineImageMacroRx', $regexp(["\\\\?i(?:mage|con):([^:\\s\\[](?:[^\\n\\[]*[^\\s\\[])?)\\[(|", $$('CC_ALL'), "*?[^\\\\])\\]"], 'm')); + $const_set($nesting[0], 'InlineIndextermMacroRx', $regexp(["\\\\?(?:(indexterm2?):\\[(", $$('CC_ALL'), "*?[^\\\\])\\]|\\(\\((", $$('CC_ALL'), "+?)\\)\\)(?!\\)))"], 'm')); + $const_set($nesting[0], 'InlineKbdBtnMacroRx', $regexp(["(\\\\)?(kbd|btn):\\[(", $$('CC_ALL'), "*?[^\\\\])\\]"], 'm')); + $const_set($nesting[0], 'InlineLinkRx', $regexp(["(^|link:|", $$('CG_BLANK'), "|<|[>\\(\\)\\[\\];\"'])(\\\\?(?:https?|file|ftp|irc)://)(?:([^\\s\\[\\]]+)\\[(|", $$('CC_ALL'), "*?[^\\\\])\\]|([^\\s\\[\\]<]*([^\\s,.?!\\[\\]<\\)])))"], 'm')); + $const_set($nesting[0], 'InlineLinkMacroRx', $regexp(["\\\\?(?:link|(mailto)):(|[^:\\s\\[][^\\s\\[]*)\\[(|", $$('CC_ALL'), "*?[^\\\\])\\]"], 'm')); + $const_set($nesting[0], 'MacroNameRx', $regexp(["^", $$('CG_WORD'), "[", $$('CC_WORD'), "-]*$"])); + $const_set($nesting[0], 'InlineStemMacroRx', $regexp(["\\\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z-]+)*)?\\[(", $$('CC_ALL'), "*?[^\\\\])\\]"], 'm')); + $const_set($nesting[0], 'InlineMenuMacroRx', $regexp(["\\\\?menu:(", $$('CG_WORD'), "|[", $$('CC_WORD'), "&][^\\n\\[]*[^\\s\\[])\\[ *(?:|(", $$('CC_ALL'), "*?[^\\\\]))\\]"], 'm')); + $const_set($nesting[0], 'InlineMenuRx', $regexp(["\\\\?\"([", $$('CC_WORD'), "&][^\"]*?[ \\n]+>[ \\n]+[^\"]*)\""])); + $const_set($nesting[0], 'InlinePassRx', $hash(false, ["+", "-]", $regexp(["((?:^|[^", $$('CC_WORD'), ";:\\\\])(?=(\\[)|\\+)|\\\\(?=\\[)|(?=\\\\\\+))(?:\\2(x-|[^\\]]+ x-)\\]|(?:\\[([^\\]]+)\\])?(?=(\\\\)?\\+))(\\5?(\\+|`)(\\S|\\S", $$('CC_ALL'), "*?\\S)\\7)(?!", $$('CG_WORD'), ")"], 'm')], true, ["`", nil, $regexp(["(^|[^`", $$('CC_WORD'), "])(?:(\\Z)()|\\[([^\\]]+)\\](?=(\\\\))?)?(\\5?(`)([^`\\s]|[^`\\s]", $$('CC_ALL'), "*?\\S)\\7)(?![`", $$('CC_WORD'), "])"], 'm')])); + $const_set($nesting[0], 'InlinePassMacroRx', $regexp(["(?:(?:(\\\\?)\\[([^\\]]+)\\])?(\\\\{0,2})(\\+\\+\\+?|\\$\\$)(", $$('CC_ALL'), "*?)\\4|(\\\\?)pass:([a-z]+(?:,[a-z-]+)*)?\\[(|", $$('CC_ALL'), "*?[^\\\\])\\])"], 'm')); + $const_set($nesting[0], 'InlineXrefMacroRx', $regexp(["\\\\?(?:<<([", $$('CC_WORD'), "#/.:{]", $$('CC_ALL'), "*?)>>|xref:([", $$('CC_WORD'), "#/.:{]", $$('CC_ALL'), "*?)\\[(?:\\]|(", $$('CC_ALL'), "*?[^\\\\])\\]))"], 'm')); + $const_set($nesting[0], 'HardLineBreakRx', $regexp(["^(", $$('CC_ANY'), "*) \\+$"], 'm')); + $const_set($nesting[0], 'MarkdownThematicBreakRx', /^ {0,3}([-*_])( *)\1\2\1$/); + $const_set($nesting[0], 'ExtLayoutBreakRx', /^(?:'{3,}|<{3,}|([-*_])( *)\1\2\1)$/); + $const_set($nesting[0], 'BlankLineRx', /\n{2,}/); + $const_set($nesting[0], 'EscapedSpaceRx', /\\([ \t\n])/); + $const_set($nesting[0], 'ReplaceableTextRx', /[&']|--|\.\.\.|\([CRT]M?\)/); + $const_set($nesting[0], 'SpaceDelimiterRx', /([^\\])[ \t\n]+/); + $const_set($nesting[0], 'SubModifierSniffRx', /[+-]/); + $const_set($nesting[0], 'TrailingDigitsRx', /\d+$/); + $const_set($nesting[0], 'UriSniffRx', $regexp(["^", $$('CG_ALPHA'), "[", $$('CC_ALNUM'), ".+-]+:/{0,2}"])); + return $const_set($nesting[0], 'XmlSanitizeRx', /<[^>]+>/); + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/substitutors"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $const_set = Opal.const_set, $hash2 = Opal.hash2, $hash = Opal.hash, $rb_plus = Opal.rb_plus, $regexp = Opal.regexp, $not = Opal.not, $truthy = Opal.truthy, $send = Opal.send, $def = Opal.def, $alias = Opal.alias, $gvars = Opal.gvars, $eqeq = Opal.eqeq, $to_ary = Opal.to_ary, $neqeq = Opal.neqeq, $to_a = Opal.to_a, $eqeqeq = Opal.eqeqeq, $rb_gt = Opal.rb_gt, $slice = Opal.slice, $rb_minus = Opal.rb_minus, $rb_lt = Opal.rb_lt, $rb_times = Opal.rb_times, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('freeze,+,keys,!,empty?,===,[],join,include?,extract_passthroughs,each,sub_specialchars,sub_quotes,sub_attributes,sub_replacements,sub_macros,highlight_source,sub_callouts,sub_post_replacements,warn,logger,restore_passthroughs,clear,split,apply_subs,gsub,match?,compat_mode,convert_quoted_text,attributes,==,shift,store_attribute,!=,attribute_undefined,counter,key?,downcase,attribute_missing,info,squeeze,delete,reject,start_with?,do_replacement,inline_macros?,extensions,inline_macros,regexp,instance,slice,length,names,config,merge,[]=,normalize_text,parse_attributes,process_method,expand_subs,text=,text,convert,class,strip,index,min,compact,>,end_with?,map,chop,new,pop,rstrip,register,tr,basename,parse,lstrip,split_simple_csv,-,partition,extract_attributes_from_text,sub,encode_uri_component,style,extname?,rindex,catalog,info?,fetch,outfilesuffix,natural_xrefs,resolve_id,find,footnotes,id,<,size,<<,attr?,attr,to_s,read_next_id,callouts,highlight?,syntax_highlighter,sub_source,extract_callouts,name,to_i,to_sym,resolve_lines_to_highlight,highlight,nil_or_empty?,restore_callouts,count,to_a,|,sort,*,parse_quoted_text_attributes,resolve_pass_subs,basebackend?,error,chr,drop,&,resolve_subs,resolve_block_subs,parse_into,private,shorthand_property_syntax,each_char'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $parent_nesting) { + var self = $module($base, 'Substitutors'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $const_set($nesting[0], 'SpecialCharsRx', /[<&>]/); + $const_set($nesting[0], 'SpecialCharsTr', $hash2([">", "<", "&"], {">": ">", "<": "<", "&": "&"})); + $const_set($nesting[0], 'QuotedTextSniffRx', $hash(false, /[*_`#^~]/, true, /[*'_+#^~]/)); + $const_set($nesting[0], 'BASIC_SUBS', ["specialcharacters"]).$freeze(); + $const_set($nesting[0], 'HEADER_SUBS', ["specialcharacters", "attributes"]).$freeze(); + $const_set($nesting[0], 'NO_SUBS', []).$freeze(); + $const_set($nesting[0], 'NORMAL_SUBS', ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"]).$freeze(); + $const_set($nesting[0], 'REFTEXT_SUBS', ["specialcharacters", "quotes", "replacements"]).$freeze(); + $const_set($nesting[0], 'VERBATIM_SUBS', ["specialcharacters", "callouts"]).$freeze(); + $const_set($nesting[0], 'SUB_GROUPS', $hash2(["none", "normal", "verbatim", "specialchars"], {"none": $$('NO_SUBS'), "normal": $$('NORMAL_SUBS'), "verbatim": $$('VERBATIM_SUBS'), "specialchars": $$('BASIC_SUBS')})); + $const_set($nesting[0], 'SUB_HINTS', $hash2(["a", "m", "n", "p", "q", "r", "c", "v"], {"a": "attributes", "m": "macros", "n": "normal", "p": "post_replacements", "q": "quotes", "r": "replacements", "c": "specialcharacters", "v": "verbatim"})); + $const_set($nesting[0], 'SUB_OPTIONS', $hash2(["block", "inline"], {"block": $rb_plus($rb_plus($$('SUB_GROUPS').$keys(), $$('NORMAL_SUBS')), ["callouts"]), "inline": $rb_plus($$('SUB_GROUPS').$keys(), $$('NORMAL_SUBS'))})); + $const_set($nesting[0], 'CAN', "\u0018"); + $const_set($nesting[0], 'DEL', "\u007F"); + $const_set($nesting[0], 'PASS_START', "\u0096"); + $const_set($nesting[0], 'PASS_END', "\u0097"); + $const_set($nesting[0], 'PassSlotRx', $regexp([$$('PASS_START'), "(\\d+)", $$('PASS_END')])); + $const_set($nesting[0], 'HighlightedPassSlotRx', $regexp(["]*>", $$('PASS_START'), "[^\\d]*(\\d+)[^\\d]*]*>", $$('PASS_END'), ""])); + $const_set($nesting[0], 'RS', "\\"); + $const_set($nesting[0], 'R_SB', "]"); + $const_set($nesting[0], 'ESC_R_SB', "\\]"); + $const_set($nesting[0], 'PLUS', "+"); + + $def(self, '$apply_subs', function $$apply_subs(text, subs) { + var self = this, is_multiline = nil, passthrus = nil, $ret_or_1 = nil, clear_passthrus = nil; + if (self.passthroughs == null) self.passthroughs = nil; + if (self.passthroughs_locked == null) self.passthroughs_locked = nil; + + + if (subs == null) subs = $$('NORMAL_SUBS'); + if (($truthy(text['$empty?']()) || ($not(subs)))) { + return text + } if ($truthy((is_multiline = $$$('Array')['$==='](text)))) { + text = ($truthy(text['$[]'](1)) ? (text.$join($$('LF'))) : (text['$[]'](0))); + } if ($truthy(subs['$include?']("macros"))) { + + text = self.$extract_passthroughs(text); + if (!$truthy(self.passthroughs['$empty?']())) { + + passthrus = self.passthroughs; + self.passthroughs_locked = ($truthy(($ret_or_1 = self.passthroughs_locked)) ? ($ret_or_1) : ((clear_passthrus = true))); + } } $send(subs, 'each', [], function $$1(type){var self = $$1.$$s == null ? this : $$1.$$s; + + + if (type == null) type = nil; + + switch (type) { + case "specialcharacters": + return (text = self.$sub_specialchars(text)) + case "quotes": + return (text = self.$sub_quotes(text)) + case "attributes": + if ($truthy(text['$include?']($$('ATTR_REF_HEAD')))) { + return (text = self.$sub_attributes(text)) + } else { + return nil + } + case "replacements": + return (text = self.$sub_replacements(text)) + case "macros": + return (text = self.$sub_macros(text)) + case "highlight": + return (text = self.$highlight_source(text, subs['$include?']("callouts"))) + case "callouts": + if ($truthy(subs['$include?']("highlight"))) { + return nil + } else { + return (text = self.$sub_callouts(text)) + } + case "post_replacements": + return (text = self.$sub_post_replacements(text)) + default: + return self.$logger().$warn("unknown substitution type " + (type)) + }}, {$$s: self}); + if ($truthy(passthrus)) { + + text = self.$restore_passthroughs(text); + if ($truthy(clear_passthrus)) { + + passthrus.$clear(); + self.passthroughs_locked = nil; + } } if ($truthy(is_multiline)) { + + return text.$split($$('LF'), -1); + } else { + return text + } }, -2); + + $def(self, '$apply_normal_subs', function $$apply_normal_subs(text) { + var self = this; + + return self.$apply_subs(text, $$('NORMAL_SUBS')) + }); + + $def(self, '$apply_header_subs', function $$apply_header_subs(text) { + var self = this; + + return self.$apply_subs(text, $$('HEADER_SUBS')) + }); + $alias(self, "apply_title_subs", "apply_subs"); + + $def(self, '$apply_reftext_subs', function $$apply_reftext_subs(text) { + var self = this; + + return self.$apply_subs(text, $$('REFTEXT_SUBS')) + }); + + $def(self, '$sub_specialchars', function $$sub_specialchars(text) { + + if ((($truthy(text['$include?'](">")) || ($truthy(text['$include?']("&")))) || ($truthy(text['$include?']("<"))))) { + + return text.$gsub($$('SpecialCharsRx'), $$('SpecialCharsTr')); + } else { + return text + } + }); + $alias(self, "sub_specialcharacters", "sub_specialchars"); + + $def(self, '$sub_quotes', function $$sub_quotes(text) { + var self = this, compat = nil; + if (self.document == null) self.document = nil; + + + if ($truthy($$('QuotedTextSniffRx')['$[]']((compat = self.document.$compat_mode()))['$match?'](text))) { + $send($$('QUOTE_SUBS')['$[]'](compat), 'each', [], function $$2(type, scope, pattern){var self = $$2.$$s == null ? this : $$2.$$s; + + + if (type == null) type = nil; + if (scope == null) scope = nil; + if (pattern == null) pattern = nil; + return (text = $send(text, 'gsub', [pattern], function $$3(){var self = $$3.$$s == null ? this : $$3.$$s; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$convert_quoted_text($gvars["~"], type, scope)}, {$$s: self}));}, {$$s: self}); + } return text; + }); + + $def(self, '$sub_attributes', function $$sub_attributes(text, opts) { + var self = this, doc_attrs = nil, drop = nil, drop_line = nil, drop_line_severity = nil, drop_empty_line = nil, attribute_undefined = nil, attribute_missing = nil, lines = nil; + if (self.document == null) self.document = nil; + + + if (opts == null) opts = $hash2([], {}); + doc_attrs = self.document.$attributes(); + drop = (drop_line = (drop_line_severity = (drop_empty_line = (attribute_undefined = (attribute_missing = nil))))); + text = $send(text, 'gsub', [$$('AttributeReferenceRx')], function $$4(){var $a, $b, self = $$4.$$s == null ? this : $$4.$$s, args = nil, $ret_or_2 = nil, value = nil, $ret_or_3 = nil, key = nil, $ret_or_4 = nil; + if (self.document == null) self.document = nil; + + if (($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), $$('RS')) || ($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), $$('RS'))))) { + return "{" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "}" + } else if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) { + + switch ((args = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$split(":", 3)).$shift()) { + case "set": + + $b = $$('Parser').$store_attribute(args['$[]'](0), ($truthy(($ret_or_2 = args['$[]'](1))) ? ($ret_or_2) : ("")), self.document), $a = $to_ary($b), (($a[0] == null ? nil : $a[0])), (value = ($a[1] == null ? nil : $a[1])); + if (($truthy(value) || ($neqeq((attribute_undefined = ($truthy(($ret_or_2 = attribute_undefined)) ? ($ret_or_2) : (($truthy(($ret_or_3 = doc_attrs['$[]']("attribute-undefined"))) ? ($ret_or_3) : ($$('Compliance').$attribute_undefined()))))), "drop-line")))) { + return (drop = (drop_empty_line = $$('DEL'))) + } else { + return (drop = (drop_line = $$('CAN'))) + } case "counter2": + + $send(self.document, 'counter', $to_a(args)); + return (drop = (drop_empty_line = $$('DEL'))); + default: + return $send(self.document, 'counter', $to_a(args)) + } + } else if ($truthy(doc_attrs['$key?']((key = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$downcase())))) { + return doc_attrs['$[]'](key) + } else if ($truthy((value = $$('INTRINSIC_ATTRIBUTES')['$[]'](key)))) { + return value + } else + switch ((attribute_missing = ($truthy(($ret_or_2 = attribute_missing)) ? ($ret_or_2) : (($truthy(($ret_or_3 = ($truthy(($ret_or_4 = opts['$[]']("attribute_missing"))) ? ($ret_or_4) : (doc_attrs['$[]']("attribute-missing"))))) ? ($ret_or_3) : ($$('Compliance').$attribute_missing())))))) { + case "drop": + return (drop = (drop_empty_line = $$('DEL'))) + case "drop-line": + + if ($eqeq((drop_line_severity = ($truthy(($ret_or_2 = drop_line_severity)) ? ($ret_or_2) : (($truthy(($ret_or_3 = opts['$[]']("drop_line_severity"))) ? ($ret_or_3) : ("info"))))), "info")) { + $send(self.$logger(), 'info', [], function $$5(){ + return "dropping line containing reference to missing attribute: " + (key)}); + } return (drop = (drop_line = $$('CAN'))); + case "warn": + + self.$logger().$warn("skipping reference to missing attribute: " + (key)); + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)); + default: + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + }}, {$$s: self}); + if ($truthy(drop)) { + if ($truthy(drop_empty_line)) { + + lines = text.$squeeze($$('DEL')).$split($$('LF'), -1); + if ($truthy(drop_line)) { + return $send(lines, 'reject', [], function $$6(line){var $ret_or_1 = nil, $ret_or_2 = nil, $ret_or_3 = nil; + + + if (line == null) line = nil; + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = line['$==']($$('DEL')))) ? ($ret_or_3) : (line['$==']($$('CAN')))))) ? ($ret_or_2) : (line['$start_with?']($$('CAN'))))))) { + return $ret_or_1 + } else { + + return line['$include?']($$('CAN')); + }}).$join($$('LF')).$delete($$('DEL')) + } else { + return $send(lines, 'reject', [], function $$7(line){ + + if (line == null) line = nil; + return line['$==']($$('DEL'));}).$join($$('LF')).$delete($$('DEL')) + } } else if ($truthy(text['$include?']($$('LF')))) { + return $send(text.$split($$('LF'), -1), 'reject', [], function $$8(line){var $ret_or_1 = nil, $ret_or_2 = nil; + + + if (line == null) line = nil; + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = line['$==']($$('CAN')))) ? ($ret_or_2) : (line['$start_with?']($$('CAN'))))))) { + return $ret_or_1 + } else { + + return line['$include?']($$('CAN')); + }}).$join($$('LF')) + } else { + return "" + } + } else { + return text + } }, -2); + + $def(self, '$sub_replacements', function $$sub_replacements(text) { + var self = this; + + + if ($truthy($$('ReplaceableTextRx')['$match?'](text))) { + $send($$('REPLACEMENTS'), 'each', [], function $$9(pattern, replacement, restore){var self = $$9.$$s == null ? this : $$9.$$s; + + + if (pattern == null) pattern = nil; + if (replacement == null) replacement = nil; + if (restore == null) restore = nil; + return (text = $send(text, 'gsub', [pattern], function $$10(){var self = $$10.$$s == null ? this : $$10.$$s; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$do_replacement($gvars["~"], replacement, restore)}, {$$s: self}));}, {$$s: self}); + } return text; + }); + + $def(self, '$sub_macros', function $$sub_macros(text) { + var self = this, found_square_bracket = nil, found_colon = nil, found_macroish = nil, $ret_or_1 = nil, found_macroish_short = nil, doc_attrs = nil, doc = nil, extensions = nil; + if (self.document == null) self.document = nil; + if (self.parent == null) self.parent = nil; + if (self.context == null) self.context = nil; + + + found_square_bracket = text['$include?']("["); + found_colon = text['$include?'](":"); + found_macroish = ($truthy(($ret_or_1 = found_square_bracket)) ? (found_colon) : ($ret_or_1)); + found_macroish_short = ($truthy(($ret_or_1 = found_macroish)) ? (text['$include?'](":[")) : ($ret_or_1)); + doc_attrs = (doc = self.document).$attributes(); + if (($truthy((extensions = doc.$extensions())) && ($truthy(extensions['$inline_macros?']())))) { + $send(extensions.$inline_macros(), 'each', [], function $$11(extension){var self = $$11.$$s == null ? this : $$11.$$s; + + + if (extension == null) extension = nil; + return (text = $send(text, 'gsub', [extension.$instance().$regexp()], function $$12(){var $a, $b, self = $$12.$$s == null ? this : $$12.$$s, match = nil, target = nil, content = nil, attributes = nil, default_attrs = nil, ext_config = nil, $ret_or_2 = nil, replacement = nil, inline_subs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + if ($truthy((match = (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)))['$start_with?']($$('RS')))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } if ($truthy($gvars["~"].$names()['$empty?']())) { + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))], (target = $a[0]), (content = $a[1]); + } else { + $a = [(function() { try { + return $gvars["~"]['$[]']("target") + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + return nil + } finally { Opal.pop_exception(); } + } else { throw $err; } + }})(), (function() { try { + return $gvars["~"]['$[]']("content") + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + return nil + } finally { Opal.pop_exception(); } + } else { throw $err; } + }})()], (target = $a[0]), (content = $a[1]); + } attributes = ($truthy((default_attrs = (ext_config = extension.$config())['$[]']("default_attrs"))) ? (default_attrs.$merge()) : ($hash2([], {}))); + if ($truthy(content)) { + + if ($truthy(content['$empty?']())) { + if (!$eqeq(ext_config['$[]']("content_model"), "attributes")) { + attributes['$[]=']("text", content); + } + } else { + + content = self.$normalize_text(content, true, true); + if ($eqeq(ext_config['$[]']("content_model"), "attributes")) { + self.$parse_attributes(content, ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ext_config['$[]']("positional_attrs"))) ? ($ret_or_2) : (ext_config['$[]']("pos_attrs"))))) ? ($ret_or_1) : ([])), $hash2(["into"], {"into": attributes})); + } else { + attributes['$[]=']("text", content); + } } target = ($truthy(($ret_or_1 = target)) ? ($ret_or_1) : ($eqeq(ext_config['$[]']("format"), "short") ? (content) : (target))); + } if ($eqeqeq($$('Inline'), (replacement = extension.$process_method()['$[]'](self, target, attributes)))) { + + if (($truthy((inline_subs = replacement.$attributes().$delete("subs"))) && ($truthy((inline_subs = self.$expand_subs(inline_subs, "custom inline macro")))))) { + replacement['$text='](self.$apply_subs(replacement.$text(), inline_subs)); + } return replacement.$convert(); + } else if ($truthy(replacement)) { + + $send(self.$logger(), 'info', [], function $$13(){ + return "expected substitution value for custom inline macro to be of type Inline; got " + (replacement.$class()) + ": " + (match)}); + return replacement; + } else { + return "" + }}, {$$s: self}));}, {$$s: self}); + } if ($truthy(doc_attrs['$key?']("experimental"))) { + + if (($truthy(found_macroish_short) && (($truthy(text['$include?']("kbd:")) || ($truthy(text['$include?']("btn:"))))))) { + text = $send(text, 'gsub', [$$('InlineKbdBtnMacroRx')], function $$14(){var $a, self = $$14.$$s == null ? this : $$14.$$s, keys = nil, delim_idx = nil, delim = nil; + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } else if ($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "kbd")) { + + if ($truthy((keys = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)).$strip())['$include?']($$('R_SB')))) { + keys = keys.$gsub($$('ESC_R_SB'), $$('R_SB')); + } if (($truthy($rb_gt(keys.$length(), 1)) && ($truthy((delim_idx = ($truthy((delim_idx = keys.$index(",", 1))) ? ([delim_idx, keys.$index("+", 1)].$compact().$min()) : (keys.$index("+", 1)))))))) { + + delim = keys.$slice(delim_idx, 1); + if ($truthy(keys['$end_with?'](delim))) { + + keys = $send(keys.$chop().$split(delim, -1), 'map', [], function $$15(key){ + + if (key == null) key = nil; + return key.$strip();}); + keys['$[]='](-1, $rb_plus(keys['$[]'](-1), delim)); + } else { + keys = $send(keys.$split(delim), 'map', [], function $$16(key){ + + if (key == null) key = nil; + return key.$strip();}); + } } else { + keys = [keys]; + } return $$('Inline').$new(self, "kbd", nil, $hash2(["attributes"], {"attributes": $hash2(["keys"], {"keys": keys})})).$convert(); + } else { + return $$('Inline').$new(self, "button", self.$normalize_text((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), true, true)).$convert() + }}, {$$s: self}); + } if (($truthy(found_macroish) && ($truthy(text['$include?']("menu:"))))) { + text = $send(text, 'gsub', [$$('InlineMenuMacroRx')], function $$17(){var $a, self = $$17.$$s == null ? this : $$17.$$s, menu = nil, items = nil, delim = nil, submenus = nil, menuitem = nil; + + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('RS')))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } menu = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)); + if ($truthy((items = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) { + + if ($truthy(items['$include?']($$('R_SB')))) { + items = items.$gsub($$('ESC_R_SB'), $$('R_SB')); + } if ($truthy((delim = ($truthy(items['$include?'](">")) ? (">") : (($truthy(items['$include?'](",")) ? (",") : (nil))))))) { + + submenus = $send(items.$split(delim), 'map', [], function $$18(it){ + + if (it == null) it = nil; + return it.$strip();}); + menuitem = submenus.$pop(); + } else { + $a = [[], items.$rstrip()], (submenus = $a[0]), (menuitem = $a[1]); + } } else { + $a = [[], nil], (submenus = $a[0]), (menuitem = $a[1]); + } return $$('Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, {$$s: self}); + } if (($truthy(text['$include?']("\"")) && ($truthy(text['$include?'](">"))))) { + text = $send(text, 'gsub', [$$('InlineMenuRx')], function $$19(){var $a, $b, $c, self = $$19.$$s == null ? this : $$19.$$s, menu = nil, submenus = nil, menuitem = nil; + + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('RS')))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } $b = $send((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$split(">"), 'map', [], function $$20(it){ + + if (it == null) it = nil; + return it.$strip();}), $a = $to_ary($b), (menu = ($a[0] == null ? nil : $a[0])), (submenus = $slice($a, 1)); + menuitem = submenus.$pop(); + return $$('Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, {$$s: self}); + } } if (($truthy(found_macroish) && (($truthy(text['$include?']("image:")) || ($truthy(text['$include?']("icon:"))))))) { + text = $send(text, 'gsub', [$$('InlineImageMacroRx')], function $$21(){var $a, self = $$21.$$s == null ? this : $$21.$$s, type = nil, posattrs = nil, target = nil, attrs = nil; + + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('RS')))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } else if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']("icon:"))) { + $a = ["icon", ["size"]], (type = $a[0]), (posattrs = $a[1]); + } else { + $a = ["image", ["alt", "width", "height"]], (type = $a[0]), (posattrs = $a[1]); + } target = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)); + attrs = self.$parse_attributes((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), posattrs, $hash2(["unescape_input"], {"unescape_input": true})); + if (!$eqeq(type, "icon")) { + + doc.$register("images", target); + attrs['$[]=']("imagesdir", doc_attrs['$[]']("imagesdir")); + } if ($truthy(($ret_or_1 = attrs['$[]']("alt")))) ; else { + attrs['$[]=']("alt", ($a = ["default-alt", $$('Helpers').$basename(target, true).$tr("_-", " ")], $send(attrs, '[]=', $a), $a[$a.length - 1])); + } return $$('Inline').$new(self, "image", nil, $hash2(["type", "target", "attributes"], {"type": type, "target": target, "attributes": attrs})).$convert();}, {$$s: self}); + } if ((($truthy(text['$include?']("((")) && ($truthy(text['$include?']("))")))) || (($truthy(found_macroish_short) && ($truthy(text['$include?']("dexterm"))))))) { + text = $send(text, 'gsub', [$$('InlineIndextermMacroRx')], function $$22(){var $a, $b, self = $$22.$$s == null ? this : $$22.$$s, attrlist = nil, primary = nil, attrs = nil, see_also = nil, term = nil, $ret_or_2 = nil, $ret_or_3 = nil, encl_text = nil, visible = nil, before = nil, after = nil, see = nil, subbed_term = nil, terms = nil; + + + switch ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) { + case "indexterm": + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('RS')))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } if ($truthy((attrlist = self.$normalize_text((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), true, true))['$include?']("="))) { + if ($truthy((primary = (attrs = $$('AttributeList').$new(attrlist, self).$parse())['$[]'](1)))) { + + attrs['$[]=']("terms", [primary]); + if ($truthy((see_also = attrs['$[]']("see-also")))) { + attrs['$[]=']("see-also", ($truthy(see_also['$include?'](",")) ? ($send(see_also.$split(","), 'map', [], function $$23(it){ + + if (it == null) it = nil; + return it.$lstrip();})) : ([see_also]))); + } } else { + attrs = $hash2(["terms"], {"terms": attrlist}); + } + } else { + attrs = $hash2(["terms"], {"terms": self.$split_simple_csv(attrlist)}); + } return $$('Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": attrs})).$convert(); + case "indexterm2": + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('RS')))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } if ($truthy((term = self.$normalize_text((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), true, true))['$include?']("="))) { + + term = ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = (attrs = $$('AttributeList').$new(term, self).$parse())['$[]'](1))) ? ($ret_or_3) : ((attrs = nil))))) ? ($ret_or_2) : (term)); + if (($truthy(attrs) && ($truthy((see_also = attrs['$[]']("see-also")))))) { + attrs['$[]=']("see-also", ($truthy(see_also['$include?'](",")) ? ($send(see_also.$split(","), 'map', [], function $$24(it){ + + if (it == null) it = nil; + return it.$lstrip();})) : ([see_also]))); + } } return $$('Inline').$new(self, "indexterm", term, $hash2(["attributes", "type"], {"attributes": attrs, "type": "visible"})).$convert(); + default: + + encl_text = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)); + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('RS')))) { + if (($truthy(encl_text['$start_with?']("(")) && ($truthy(encl_text['$end_with?'](")"))))) { + + encl_text = encl_text.$slice(1, $rb_minus(encl_text.$length(), 2)); + $a = [true, "(", ")"], (visible = $a[0]), (before = $a[1]), (after = $a[2]); + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } + } else { + + visible = true; + if ($truthy(encl_text['$start_with?']("("))) { + if ($truthy(encl_text['$end_with?'](")"))) { + $a = [encl_text.$slice(1, $rb_minus(encl_text.$length(), 2)), false], (encl_text = $a[0]), (visible = $a[1]); + } else { + $a = [encl_text.$slice(1, encl_text.$length()), "(", ""], (encl_text = $a[0]), (before = $a[1]), (after = $a[2]); + } + } else if ($truthy(encl_text['$end_with?'](")"))) { + $a = [encl_text.$chop(), "", ")"], (encl_text = $a[0]), (before = $a[1]), (after = $a[2]); + } } if ($truthy(visible)) { + + if ($truthy((term = self.$normalize_text(encl_text, true))['$include?'](";&"))) { + if ($truthy(term['$include?'](" >> "))) { + + $b = term.$partition(" >> "), $a = $to_ary($b), (term = ($a[0] == null ? nil : $a[0])), (($a[1] == null ? nil : $a[1])), (see = ($a[2] == null ? nil : $a[2])); + attrs = $hash2(["see"], {"see": see}); + } else if ($truthy(term['$include?'](" &> "))) { + + $b = term.$split(" &> "), $a = $to_ary($b), (term = ($a[0] == null ? nil : $a[0])), (see_also = $slice($a, 1)); + attrs = $hash2(["see-also"], {"see-also": see_also}); + } + } subbed_term = $$('Inline').$new(self, "indexterm", term, $hash2(["attributes", "type"], {"attributes": attrs, "type": "visible"})).$convert(); + } else { + + attrs = $hash2([], {}); + if ($truthy((terms = self.$normalize_text(encl_text, true))['$include?'](";&"))) { + if ($truthy(terms['$include?'](" >> "))) { + + $b = terms.$partition(" >> "), $a = $to_ary($b), (terms = ($a[0] == null ? nil : $a[0])), (($a[1] == null ? nil : $a[1])), (see = ($a[2] == null ? nil : $a[2])); + attrs['$[]=']("see", see); + } else if ($truthy(terms['$include?'](" &> "))) { + + $b = terms.$split(" &> "), $a = $to_ary($b), (terms = ($a[0] == null ? nil : $a[0])), (see_also = $slice($a, 1)); + attrs['$[]=']("see-also", see_also); + } + } attrs['$[]=']("terms", self.$split_simple_csv(terms)); + subbed_term = $$('Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": attrs})).$convert(); + } if ($truthy(before)) { + return "" + (before) + (subbed_term) + (after) + } else { + return subbed_term + } }}, {$$s: self}); + } if (($truthy(found_colon) && ($truthy(text['$include?']("://"))))) { + text = $send(text, 'gsub', [$$('InlineLinkRx')], function $$25(){var $a, $b, self = $$25.$$s == null ? this : $$25.$$s, target = nil, rs_idx = nil, prefix = nil, suffix = nil, link_text = nil, attrs = nil, link_opts = nil, new_link_text = nil, bare = nil; + + + if ($truthy((target = $rb_plus((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), ($truthy(($ret_or_1 = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) ? ($ret_or_1) : ((($a = $gvars['~']) === nil ? nil : $a['$[]'](5))))))['$start_with?']($$('RS')))) { + return $rb_plus((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(0, (rs_idx = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$length())), (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice($rb_plus(rs_idx, 1), (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length())) + } $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), ""], (prefix = $a[0]), (suffix = $a[1]); + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](4)))) { + + if ($eqeq(prefix, "link:")) { + prefix = ""; + } if ($truthy((link_text = (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)))['$empty?']())) { + link_text = nil; + } } else { + + + switch (prefix) { + case "link:": + case "\"": + case "'": + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } + switch ((($a = $gvars['~']) === nil ? nil : $a['$[]'](6))) { + case ";": + + if (($truthy(prefix['$start_with?']("<")) && ($truthy(target['$end_with?'](">"))))) { + + prefix = prefix.$slice(4, prefix.$length()); + target = target.$slice(0, $rb_minus(target.$length(), 4)); + } else if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = ");"; + } else { + suffix = ";"; + } if ($truthy(target['$end_with?']("://"))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } break; + case ":": + + if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = "):"; + } else { + suffix = ":"; + } if ($truthy(target['$end_with?']("://"))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } break; + } } $a = [nil, $hash2(["type"], {"type": "link"})], (attrs = $a[0]), (link_opts = $a[1]); + if ($truthy(link_text)) { + + if ($truthy(link_text['$include?']($$('R_SB')))) { + new_link_text = (link_text = link_text.$gsub($$('ESC_R_SB'), $$('R_SB'))); + } if (($not(doc.$compat_mode()) && ($truthy(link_text['$include?']("="))))) { + + $b = self.$extract_attributes_from_text(link_text, ""), $a = $to_ary($b), (link_text = ($a[0] == null ? nil : $a[0])), (attrs = ($a[1] == null ? nil : $a[1])); + new_link_text = link_text; + link_opts['$[]=']("id", attrs['$[]']("id")); + } if ($truthy(link_text['$end_with?']("^"))) { + + new_link_text = (link_text = link_text.$chop()); + if ($truthy(attrs)) { + if ($truthy(($ret_or_1 = attrs['$[]']("window")))) ; else { + attrs['$[]=']("window", "_blank"); + } + } else { + attrs = $hash2(["window"], {"window": "_blank"}); + } } if (($truthy(new_link_text) && ($truthy(new_link_text['$empty?']())))) { + + link_text = ($truthy(doc_attrs['$key?']("hide-uri-scheme")) ? (target.$sub($$('UriSniffRx'), "")) : (target)); + bare = true; + } } else { + + link_text = ($truthy(doc_attrs['$key?']("hide-uri-scheme")) ? (target.$sub($$('UriSniffRx'), "")) : (target)); + bare = true; + } if ($truthy(bare)) { + if ($truthy(attrs)) { + attrs['$[]=']("role", ($truthy(attrs['$key?']("role")) ? ("bare " + (attrs['$[]']("role"))) : ("bare"))); + } else { + attrs = $hash2(["role"], {"role": "bare"}); + } + } doc.$register("links", ($a = ["target", target], $send(link_opts, '[]=', $a), $a[$a.length - 1])); + if ($truthy(attrs)) { + link_opts['$[]=']("attributes", attrs); + } return "" + (prefix) + ($$('Inline').$new(self, "anchor", link_text, link_opts).$convert()) + (suffix);}, {$$s: self}); + } if (($truthy(found_macroish) && (($truthy(text['$include?']("link:")) || ($truthy(text['$include?']("ilto:"))))))) { + text = $send(text, 'gsub', [$$('InlineLinkMacroRx')], function $$26(){var $a, $b, self = $$26.$$s == null ? this : $$26.$$s, mailto = nil, target = nil, mailto_text = nil, attrs = nil, link_opts = nil, link_text = nil; + + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('RS')))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } else if ($truthy((mailto = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))))) { + target = $rb_plus("mailto:", (mailto_text = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))); + } else { + target = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)); + } $a = [nil, $hash2(["type"], {"type": "link"})], (attrs = $a[0]), (link_opts = $a[1]); + if (!$truthy((link_text = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))['$empty?']())) { + + if ($truthy(link_text['$include?']($$('R_SB')))) { + link_text = link_text.$gsub($$('ESC_R_SB'), $$('R_SB')); + } if ($truthy(mailto)) { + if (($not(doc.$compat_mode()) && ($truthy(link_text['$include?'](","))))) { + + $b = self.$extract_attributes_from_text(link_text, ""), $a = $to_ary($b), (link_text = ($a[0] == null ? nil : $a[0])), (attrs = ($a[1] == null ? nil : $a[1])); + link_opts['$[]=']("id", attrs['$[]']("id")); + if ($truthy(attrs['$key?'](2))) { + if ($truthy(attrs['$key?'](3))) { + target = "" + (target) + "?subject=" + ($$('Helpers').$encode_uri_component(attrs['$[]'](2))) + "&body=" + ($$('Helpers').$encode_uri_component(attrs['$[]'](3))); + } else { + target = "" + (target) + "?subject=" + ($$('Helpers').$encode_uri_component(attrs['$[]'](2))); + } + } } + } else if (($not(doc.$compat_mode()) && ($truthy(link_text['$include?']("="))))) { + + $b = self.$extract_attributes_from_text(link_text, ""), $a = $to_ary($b), (link_text = ($a[0] == null ? nil : $a[0])), (attrs = ($a[1] == null ? nil : $a[1])); + link_opts['$[]=']("id", attrs['$[]']("id")); + } if ($truthy(link_text['$end_with?']("^"))) { + + link_text = link_text.$chop(); + if ($truthy(attrs)) { + if ($truthy(($ret_or_1 = attrs['$[]']("window")))) ; else { + attrs['$[]=']("window", "_blank"); + } + } else { + attrs = $hash2(["window"], {"window": "_blank"}); + } } } if ($truthy(link_text['$empty?']())) { + if ($truthy(mailto)) { + link_text = mailto_text; + } else { + + if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + if ($truthy((link_text = target.$sub($$('UriSniffRx'), ""))['$empty?']())) { + link_text = target; + } + } else { + link_text = target; + } if ($truthy(attrs)) { + attrs['$[]=']("role", ($truthy(attrs['$key?']("role")) ? ("bare " + (attrs['$[]']("role"))) : ("bare"))); + } else { + attrs = $hash2(["role"], {"role": "bare"}); + } } + } doc.$register("links", ($a = ["target", target], $send(link_opts, '[]=', $a), $a[$a.length - 1])); + if ($truthy(attrs)) { + link_opts['$[]=']("attributes", attrs); + } return $$('Inline').$new(self, "anchor", link_text, link_opts).$convert();}, {$$s: self}); + } if ($truthy(text['$include?']("@"))) { + text = $send(text, 'gsub', [$$('InlineEmailRx')], function $$27(){var $a, self = $$27.$$s == null ? this : $$27.$$s, target = nil, address = nil; + + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + return ($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), $$('RS')) ? ((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length())) : ((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)))) + } target = $rb_plus("mailto:", (address = (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)))); + doc.$register("links", target); + return $$('Inline').$new(self, "anchor", address, $hash2(["type", "target"], {"type": "link", "target": target})).$convert();}, {$$s: self}); + } if ((($truthy(found_square_bracket) && ($eqeq(self.context, "list_item"))) && ($eqeq(self.parent.$style(), "bibliography")))) { + text = $send(text, 'sub', [$$('InlineBiblioAnchorRx')], function $$28(){var $a, self = $$28.$$s == null ? this : $$28.$$s; + + return $$('Inline').$new(self, "anchor", (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), $hash2(["type", "id"], {"type": "bibref", "id": (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))})).$convert()}, {$$s: self}); + } if ((($truthy(found_square_bracket) && ($truthy(text['$include?']("[[")))) || (($truthy(found_macroish) && ($truthy(text['$include?']("or:"))))))) { + text = $send(text, 'gsub', [$$('InlineAnchorRx')], function $$29(){var $a, self = $$29.$$s == null ? this : $$29.$$s, id = nil, reftext = nil; + + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } if ($truthy((id = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) { + reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)); + } else { + + id = (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)); + if (($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](5)))) && ($truthy(reftext['$include?']($$('R_SB')))))) { + reftext = reftext.$gsub($$('ESC_R_SB'), $$('R_SB')); + } } return $$('Inline').$new(self, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})).$convert();}, {$$s: self}); + } if ((($truthy(text['$include?']("&")) && ($truthy(text['$include?'](";&l")))) || (($truthy(found_macroish) && ($truthy(text['$include?']("xref:"))))))) { + text = $send(text, 'gsub', [$$('InlineXrefMacroRx')], function $$30(){var $a, $b, self = $$30.$$s == null ? this : $$30.$$s, attrs = nil, refid = nil, link_text = nil, macro = nil, fragment = nil, hash_idx = nil, fragment_len = nil, path = nil, src2src = nil, target = nil; + + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('RS')))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } attrs = $hash2([], {}); + if ($truthy((refid = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))))) { + if ($truthy(refid['$include?'](","))) { + + $b = refid.$partition(","), $a = $to_ary($b), (refid = ($a[0] == null ? nil : $a[0])), (($a[1] == null ? nil : $a[1])), (link_text = ($a[2] == null ? nil : $a[2])); + if ($truthy((link_text = link_text.$lstrip())['$empty?']())) { + link_text = nil; + } } + } else { + + macro = true; + refid = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)); + if ($truthy((link_text = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3))))) { + + if ($truthy(link_text['$include?']($$('R_SB')))) { + link_text = link_text.$gsub($$('ESC_R_SB'), $$('R_SB')); + } if (($not(doc.$compat_mode()) && ($truthy(link_text['$include?']("="))))) { + $b = self.$extract_attributes_from_text(link_text), $a = $to_ary($b), (link_text = ($a[0] == null ? nil : $a[0])), (attrs = ($a[1] == null ? nil : $a[1])); + } } } if ($truthy(doc.$compat_mode())) { + fragment = refid; + } else if (($truthy((hash_idx = refid.$index("#"))) && ($neqeq(refid['$[]']($rb_minus(hash_idx, 1)), "&")))) { + if ($truthy($rb_gt(hash_idx, 0))) { + + if ($truthy($rb_gt((fragment_len = $rb_minus($rb_minus(refid.$length(), 1), hash_idx)), 0))) { + $a = [refid.$slice(0, hash_idx), refid.$slice($rb_plus(hash_idx, 1), fragment_len)], (path = $a[0]), (fragment = $a[1]); + } else { + path = refid.$chop(); + } if ($truthy(macro)) { + if ($truthy(path['$end_with?'](".adoc"))) { + src2src = (path = path.$slice(0, $rb_minus(path.$length(), 5))); + } else if ($not($$('Helpers')['$extname?'](path))) { + src2src = path; + } + } else if ($truthy($send(path, 'end_with?', $to_a($$('ASCIIDOC_EXTENSIONS').$keys())))) { + src2src = (path = path.$slice(0, path.$rindex("."))); + } else { + src2src = path; + } } else { + $a = [refid, refid.$slice(1, refid.$length())], (target = $a[0]), (fragment = $a[1]); + } + } else if ($truthy(macro)) { + if ($truthy(refid['$end_with?'](".adoc"))) { + src2src = (path = refid.$slice(0, $rb_minus(refid.$length(), 5))); + } else if ($truthy($$('Helpers')['$extname?'](refid))) { + path = refid; + } else { + fragment = refid; + } + } else { + fragment = refid; + } if ($truthy(target)) { + + refid = fragment; + if (($truthy(self.$logger()['$info?']()) && ($not(doc.$catalog()['$[]']("refs")['$[]'](refid))))) { + self.$logger().$info("possible invalid reference: " + (refid)); + } } else if ($truthy(path)) { + if (($truthy(src2src) && (($eqeq(doc.$attributes()['$[]']("docname"), path) || ($truthy(doc.$catalog()['$[]']("includes")['$[]'](path))))))) { + if ($truthy(fragment)) { + + $a = [fragment, nil, "#" + (fragment)], (refid = $a[0]), (path = $a[1]), (target = $a[2]); + if (($truthy(self.$logger()['$info?']()) && ($not(doc.$catalog()['$[]']("refs")['$[]'](refid))))) { + self.$logger().$info("possible invalid reference: " + (refid)); + } } else { + $a = [nil, nil, "#"], (refid = $a[0]), (path = $a[1]), (target = $a[2]); + } + } else { + + $a = [path, "" + (($truthy(($ret_or_1 = doc.$attributes()['$[]']("relfileprefix"))) ? ($ret_or_1) : (""))) + (path) + (($truthy(src2src) ? (doc.$attributes().$fetch("relfilesuffix", doc.$outfilesuffix())) : ("")))], (refid = $a[0]), (path = $a[1]); + if ($truthy(fragment)) { + $a = ["" + (refid) + "#" + (fragment), "" + (path) + "#" + (fragment)], (refid = $a[0]), (target = $a[1]); + } else { + target = path; + } } + } else if (($truthy(doc.$compat_mode()) || ($not($$('Compliance').$natural_xrefs())))) { + + $a = [fragment, "#" + (fragment)], (refid = $a[0]), (target = $a[1]); + if (($truthy(self.$logger()['$info?']()) && ($not(doc.$catalog()['$[]']("refs")['$[]'](refid))))) { + self.$logger().$info("possible invalid reference: " + (refid)); + } } else if ($truthy(doc.$catalog()['$[]']("refs")['$[]'](fragment))) { + $a = [fragment, "#" + (fragment)], (refid = $a[0]), (target = $a[1]); + } else if ((($truthy(fragment['$include?'](" ")) || ($neqeq(fragment.$downcase(), fragment))) && ($truthy((refid = doc.$resolve_id(fragment)))))) { + $a = [refid, "#" + (refid)], (fragment = $a[0]), (target = $a[1]); + } else { + + $a = [fragment, "#" + (fragment)], (refid = $a[0]), (target = $a[1]); + if ($truthy(self.$logger()['$info?']())) { + self.$logger().$info("possible invalid reference: " + (refid)); + } } attrs['$[]=']("path", path); + attrs['$[]=']("fragment", fragment); + attrs['$[]=']("refid", refid); + return $$('Inline').$new(self, "anchor", link_text, $hash2(["type", "target", "attributes"], {"type": "xref", "target": target, "attributes": attrs})).$convert();}, {$$s: self}); + } if (($truthy(found_macroish) && ($truthy(text['$include?']("tnote"))))) { + text = $send(text, 'gsub', [$$('InlineFootnoteMacroRx')], function $$31(){var $a, $b, $c, self = $$31.$$s == null ? this : $$31.$$s, id = nil, content = nil, footnote = nil, index = nil, type = nil, target = nil; + + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('RS')))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) { + + $b = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)).$split(",", 2), $a = $to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (content = ($a[1] == null ? nil : $a[1])); + if (!$truthy(doc.$compat_mode())) { + self.$logger().$warn("found deprecated footnoteref macro: " + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))) + "; use footnote macro with target instead"); + } } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } + } else { + + id = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)); + content = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)); + } if ($truthy(id)) { + if ($truthy((footnote = $send(doc.$footnotes(), 'find', [], function $$32(candidate){ + + if (candidate == null) candidate = nil; + return candidate.$id()['$=='](id);})))) { + + $a = [footnote.$index(), footnote.$text()], (index = $a[0]), (content = $a[1]); + $a = ["xref", id, nil], (type = $a[0]), (target = $a[1]), (id = $a[2]); + } else if ($truthy(content)) { + + content = self.$restore_passthroughs(self.$normalize_text(content, true, true)); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$('Document'), 'Footnote').$new(index, id, content)); + $a = ["ref", nil], (type = $a[0]), (target = $a[1]); + } else { + + self.$logger().$warn("invalid footnote reference: " + (id)); + $a = ["xref", id, id, nil], (type = $a[0]), (target = $a[1]), (content = $a[2]), (id = $a[3]); + } + } else if ($truthy(content)) { + + content = self.$restore_passthroughs(self.$normalize_text(content, true, true)); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$('Document'), 'Footnote').$new(index, id, content)); + type = (target = nil); + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } return $$('Inline').$new(self, "footnote", content, $hash2(["attributes", "id", "target", "type"], {"attributes": $hash2(["index"], {"index": index}), "id": id, "target": target, "type": type})).$convert();}, {$$s: self}); + } return text; + }); + + $def(self, '$sub_post_replacements', function $$sub_post_replacements(text) { + var self = this, lines = nil, last = nil; + if (self.document == null) self.document = nil; + if (self.attributes == null) self.attributes = nil; + + if (($truthy(self.attributes['$[]']("hardbreaks-option")) || ($truthy(self.document.$attributes()['$[]']("hardbreaks-option"))))) { + + lines = text.$split($$('LF'), -1); + if ($truthy($rb_lt(lines.$size(), 2))) { + return text + } last = lines.$pop(); + return $send(lines, 'map', [], function $$33(line){var self = $$33.$$s == null ? this : $$33.$$s; + + + if (line == null) line = nil; + return $$('Inline').$new(self, "break", ($truthy(line['$end_with?']($$('HARD_LINE_BREAK'))) ? (line.$slice(0, $rb_minus(line.$length(), 2))) : (line)), $hash2(["type"], {"type": "line"})).$convert();}, {$$s: self})['$<<'](last).$join($$('LF')); + } else if (($truthy(text['$include?']($$('PLUS'))) && ($truthy(text['$include?']($$('HARD_LINE_BREAK')))))) { + return $send(text, 'gsub', [$$('HardLineBreakRx')], function $$34(){var $a, self = $$34.$$s == null ? this : $$34.$$s; + + return $$('Inline').$new(self, "break", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), $hash2(["type"], {"type": "line"})).$convert()}, {$$s: self}) + } else { + return text + } + }); + + $def(self, '$sub_source', function $$sub_source(source, process_callouts) { + var self = this; + + if ($truthy(process_callouts)) { + return self.$sub_callouts(self.$sub_specialchars(source)) + } else { + + return self.$sub_specialchars(source); + } + }); + + $def(self, '$sub_callouts', function $$sub_callouts(text) { + var self = this, callout_rx = nil, autonum = nil; + + + callout_rx = ($truthy(self['$attr?']("line-comment")) ? ($$('CalloutSourceRxMap')['$[]'](self.$attr("line-comment"))) : ($$('CalloutSourceRx'))); + autonum = 0; + return $send(text, 'gsub', [callout_rx], function $$35(){var $a, self = $$35.$$s == null ? this : $$35.$$s, $ret_or_1 = nil; + if (self.document == null) self.document = nil; + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$sub($$('RS'), "") + } else { + return $$('Inline').$new(self, "callout", ($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), ".") ? ((autonum = $rb_plus(autonum, 1)).$to_s()) : ((($a = $gvars['~']) === nil ? nil : $a['$[]'](4)))), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": ($truthy(($ret_or_1 = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) ? ($ret_or_1) : (($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), "--") ? ([""]) : (nil))))})})).$convert() + }}, {$$s: self}); + }); + + $def(self, '$highlight_source', function $$highlight_source(source, process_callouts) { + var $a, $b, self = this, syntax_hl = nil, callout_marks = nil, doc_attrs = nil, syntax_hl_name = nil, start_line_number = nil, linenums_mode = nil, $ret_or_1 = nil, highlight_lines = nil, highlighted = nil, source_offset = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + if (!($truthy((syntax_hl = self.document.$syntax_highlighter())) && ($truthy(syntax_hl['$highlight?']())))) { + return self.$sub_source(source, process_callouts) + } if ($truthy(process_callouts)) { + $b = self.$extract_callouts(source), $a = $to_ary($b), (source = ($a[0] == null ? nil : $a[0])), (callout_marks = ($a[1] == null ? nil : $a[1])); + } doc_attrs = self.document.$attributes(); + syntax_hl_name = syntax_hl.$name(); + if (($truthy((linenums_mode = ($truthy(self['$attr?']("linenums")) ? (($truthy(($ret_or_1 = doc_attrs['$[]']("" + (syntax_hl_name) + "-linenums-mode"))) ? ($ret_or_1) : ("table")).$to_sym()) : (nil)))) && ($truthy($rb_lt((start_line_number = self.$attr("start", 1).$to_i()), 1))))) { + start_line_number = 1; + } if ($truthy(self['$attr?']("highlight"))) { + highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight"), start_line_number); + } $b = syntax_hl.$highlight(self, source, self.$attr("language"), $hash2(["callouts", "css_mode", "highlight_lines", "number_lines", "start_line_number", "style"], {"callouts": callout_marks, "css_mode": ($truthy(($ret_or_1 = doc_attrs['$[]']("" + (syntax_hl_name) + "-css"))) ? ($ret_or_1) : ("class")).$to_sym(), "highlight_lines": highlight_lines, "number_lines": linenums_mode, "start_line_number": start_line_number, "style": doc_attrs['$[]']("" + (syntax_hl_name) + "-style")})), $a = $to_ary($b), (highlighted = ($a[0] == null ? nil : $a[0])), (source_offset = ($a[1] == null ? nil : $a[1])); + if (!$truthy(self.passthroughs['$empty?']())) { + highlighted = highlighted.$gsub($$('HighlightedPassSlotRx'), "" + ($$('PASS_START')) + "\\1" + ($$('PASS_END'))); + } if ($truthy(callout_marks['$nil_or_empty?']())) { + return highlighted + } else { + + return self.$restore_callouts(highlighted, callout_marks, source_offset); + } }); + + $def(self, '$resolve_lines_to_highlight', function $$resolve_lines_to_highlight(source, spec, start) { + var lines = nil, shift = nil; + + + if (start == null) start = nil; + lines = []; + if ($truthy(spec['$include?'](" "))) { + spec = spec.$delete(" "); + } $send(($truthy(spec['$include?'](",")) ? (spec.$split(",")) : (spec.$split(";"))), 'map', [], function $$36(entry){var $a, $b, negate = nil, delim = nil, from = nil, to = nil, line = nil; + + + if (entry == null) entry = nil; + if ($truthy(entry['$start_with?']("!"))) { + + entry = entry.$slice(1, entry.$length()); + negate = true; + } if ($truthy((delim = ($truthy(entry['$include?']("..")) ? ("..") : (($truthy(entry['$include?']("-")) ? ("-") : (nil))))))) { + + $b = entry.$partition(delim), $a = $to_ary($b), (from = ($a[0] == null ? nil : $a[0])), (($a[1] == null ? nil : $a[1])), (to = ($a[2] == null ? nil : $a[2])); + if (($truthy(to['$empty?']()) || ($truthy($rb_lt((to = to.$to_i()), 0))))) { + to = $rb_plus(source.$count($$('LF')), 1); + } if ($truthy(negate)) { + return (lines = $rb_minus(lines, Opal.Range.$new(from.$to_i(), to, false).$to_a())) + } else { + return (lines = lines['$|'](Opal.Range.$new(from.$to_i(), to, false).$to_a())) + } } else if ($truthy(negate)) { + return lines.$delete(entry.$to_i()) + } else if ($not(lines['$include?']((line = entry.$to_i())))) { + return lines['$<<'](line) + } else { + return nil + }}); + if (!$eqeq((shift = ($truthy(start) ? ($rb_minus(start, 1)) : (0))), 0)) { + lines = $send(lines, 'map', [], function $$37(it){ + + if (it == null) it = nil; + return $rb_minus(it, shift);}); + } return lines.$sort(); + }, -3); + + $def(self, '$extract_passthroughs', function $$extract_passthroughs(text) { + var $a, $b, self = this, compat_mode = nil, passthrus = nil, pass_inline_char1 = nil, pass_inline_char2 = nil, pass_inline_rx = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + compat_mode = self.document.$compat_mode(); + passthrus = self.passthroughs; + if ((($truthy(text['$include?']("++")) || ($truthy(text['$include?']("$$")))) || ($truthy(text['$include?']("ss:"))))) { + text = $send(text, 'gsub', [$$('InlinePassMacroRx')], function $$38(){var $a, self = $$38.$$s == null ? this : $$38.$$s, boundary = nil, attrlist = nil, escape_count = nil, preceding = nil, old_behavior = nil, attributes = nil, subs = nil, passthru_key = nil, $ret_or_1 = nil; + + + if ($truthy((boundary = (($a = $gvars['~']) === nil ? nil : $a['$[]'](4))))) { + + if (($truthy(compat_mode) && ($eqeq(boundary, "++")))) { + return "" + (($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) ? ("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + "[" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "]" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) : ("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))))) + "++" + (self.$extract_passthroughs((($a = $gvars['~']) === nil ? nil : $a['$[]'](5)))) + "++" + } if ($truthy((attrlist = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) { + if ($truthy($rb_gt((escape_count = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)).$length()), 0))) { + return "" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + "[" + (attrlist) + "]" + ($rb_times($$('RS'), $rb_minus(escape_count, 1))) + (boundary) + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](5))) + (boundary) + } else if ($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), $$('RS'))) { + preceding = "[" + (attrlist) + "]"; + } else if ($eqeq(boundary, "++")) { + if ($eqeq(attrlist, "x-")) { + + old_behavior = true; + attributes = $hash2([], {}); + } else if ($truthy(attrlist['$end_with?'](" x-"))) { + + old_behavior = true; + attributes = self.$parse_quoted_text_attributes(attrlist.$slice(0, $rb_minus(attrlist.$length(), 3))); + } else { + attributes = self.$parse_quoted_text_attributes(attrlist); + } + } else { + attributes = self.$parse_quoted_text_attributes(attrlist); + } + } else if ($truthy($rb_gt((escape_count = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)).$length()), 0))) { + return "" + ($rb_times($$('RS'), $rb_minus(escape_count, 1))) + (boundary) + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](5))) + (boundary) + } subs = ($eqeq(boundary, "+++") ? ([]) : ($$('BASIC_SUBS'))); + if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text", "subs", "type", "attributes"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](5)), "subs": $$('NORMAL_SUBS'), "type": "monospaced", "attributes": attributes})); + } else { + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text", "subs", "type", "attributes"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](5)), "subs": subs, "type": "unquoted", "attributes": attributes})); + } + } else { + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text", "subs"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](5)), "subs": subs})); + } } else { + + if ($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](6)), $$('RS'))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$slice(1, (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length()) + } if ($truthy((subs = (($a = $gvars['~']) === nil ? nil : $a['$[]'](7))))) { + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text", "subs"], {"text": self.$normalize_text((($a = $gvars['~']) === nil ? nil : $a['$[]'](8)), nil, true), "subs": self.$resolve_pass_subs(subs)})); + } else { + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text"], {"text": self.$normalize_text((($a = $gvars['~']) === nil ? nil : $a['$[]'](8)), nil, true)})); + } } return "" + (($truthy(($ret_or_1 = preceding)) ? ($ret_or_1) : (""))) + ($$('PASS_START')) + (passthru_key) + ($$('PASS_END'));}, {$$s: self}); + } $b = $$('InlinePassRx')['$[]'](compat_mode), $a = $to_ary($b), (pass_inline_char1 = ($a[0] == null ? nil : $a[0])), (pass_inline_char2 = ($a[1] == null ? nil : $a[1])), (pass_inline_rx = ($a[2] == null ? nil : $a[2])); + if (($truthy(text['$include?'](pass_inline_char1)) || (($truthy(pass_inline_char2) && ($truthy(text['$include?'](pass_inline_char2))))))) { + text = $send(text, 'gsub', [pass_inline_rx], function $$39(){var $c, self = $$39.$$s == null ? this : $$39.$$s, preceding = nil, attrlist = nil, $ret_or_1 = nil, escaped = nil, quoted_text = nil, format_mark = nil, content = nil, old_behavior = nil, old_behavior_forced = nil, attributes = nil, passthru_key = nil, subs = nil; + + + preceding = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)); + attrlist = ($truthy(($ret_or_1 = (($c = $gvars['~']) === nil ? nil : $c['$[]'](4)))) ? ($ret_or_1) : ((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))); + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](5)))) { + escaped = true; + } quoted_text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](6)); + format_mark = (($c = $gvars['~']) === nil ? nil : $c['$[]'](7)); + content = (($c = $gvars['~']) === nil ? nil : $c['$[]'](8)); + if ($truthy(compat_mode)) { + old_behavior = true; + } else if (($truthy(attrlist) && (($eqeq(attrlist, "x-") || ($truthy(attrlist['$end_with?'](" x-"))))))) { + old_behavior = (old_behavior_forced = true); + } if ($truthy(attrlist)) { + if ($truthy(escaped)) { + return "" + (preceding) + "[" + (attrlist) + "]" + (quoted_text.$slice(1, quoted_text.$length())) + } else if ($eqeq(preceding, $$('RS'))) { + + if (($truthy(old_behavior_forced) && ($eqeq(format_mark, "`")))) { + return "" + (preceding) + "[" + (attrlist) + "]" + (quoted_text) + } preceding = "[" + (attrlist) + "]"; + } else if ($truthy(old_behavior_forced)) { + attributes = ($eqeq(attrlist, "x-") ? ($hash2([], {})) : (self.$parse_quoted_text_attributes(attrlist.$slice(0, $rb_minus(attrlist.$length(), 3))))); + } else { + attributes = self.$parse_quoted_text_attributes(attrlist); + } + } else if ($truthy(escaped)) { + return "" + (preceding) + (quoted_text.$slice(1, quoted_text.$length())) + } else if (($truthy(compat_mode) && ($eqeq(preceding, $$('RS'))))) { + return quoted_text + } if ($truthy(compat_mode)) { + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$('BASIC_SUBS'), "attributes": attributes, "type": "monospaced"})); + } else if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + subs = ($eqeq(format_mark, "`") ? ($$('BASIC_SUBS')) : ($$('NORMAL_SUBS'))); + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": subs, "attributes": attributes, "type": "monospaced"})); + } else { + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$('BASIC_SUBS'), "attributes": attributes, "type": "unquoted"})); + } + } else { + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text", "subs"], {"text": content, "subs": $$('BASIC_SUBS')})); + } return "" + (preceding) + ($$('PASS_START')) + (passthru_key) + ($$('PASS_END'));}, {$$s: self}); + } if (($truthy(text['$include?'](":")) && (($truthy(text['$include?']("stem:")) || ($truthy(text['$include?']("math:"))))))) { + text = $send(text, 'gsub', [$$('InlineStemMacroRx')], function $$40(){var $c, self = $$40.$$s == null ? this : $$40.$$s, type = nil, subs = nil, content = nil, passthru_key = nil; + if (self.document == null) self.document = nil; + + + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$('RS')))) { + return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length()) + } if ($eqeq((type = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$to_sym()), "stem")) { + type = $$('STEM_TYPE_ALIASES')['$[]'](self.document.$attributes()['$[]']("stem")).$to_sym(); + } subs = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + content = self.$normalize_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)), nil, true); + if ((($eqeq(type, "latexmath") && ($truthy(content['$start_with?']("$")))) && ($truthy(content['$end_with?']("$"))))) { + content = content.$slice(1, $rb_minus(content.$length(), 2)); + } subs = ($truthy(subs) ? (self.$resolve_pass_subs(subs)) : (($truthy(self.document['$basebackend?']("html")) ? ($$('BASIC_SUBS')) : (nil)))); + passthrus['$[]=']((passthru_key = passthrus.$size()), $hash2(["text", "subs", "type"], {"text": content, "subs": subs, "type": type})); + return "" + ($$('PASS_START')) + (passthru_key) + ($$('PASS_END'));}, {$$s: self}); + } return text; + }); + + $def(self, '$restore_passthroughs', function $$restore_passthroughs(text) { + var self = this, passthrus = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + passthrus = self.passthroughs; + return $send(text, 'gsub', [$$('PassSlotRx')], function $$41(){var $a, self = $$41.$$s == null ? this : $$41.$$s, pass = nil, subbed_text = nil, type = nil, attributes = nil, id = nil; + + if ($truthy((pass = passthrus['$[]']((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$to_i())))) { + + subbed_text = self.$apply_subs(pass['$[]']("text"), pass['$[]']("subs")); + if ($truthy((type = pass['$[]']("type")))) { + + if ($truthy((attributes = pass['$[]']("attributes")))) { + id = attributes['$[]']("id"); + } subbed_text = $$('Inline').$new(self, "quoted", subbed_text, $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert(); + } if ($truthy(subbed_text['$include?']($$('PASS_START')))) { + return self.$restore_passthroughs(subbed_text) + } else { + return subbed_text + } } else { + + self.$logger().$error("unresolved passthrough detected: " + (text)); + return "??pass??"; + }}, {$$s: self}); + }); + + $def(self, '$resolve_subs', function $$resolve_subs(subs, type, defaults, subject) { + var self = this, candidates = nil, modifiers_present = nil, resolved = nil, invalid = nil; + + + if (type == null) type = "block"; + if (defaults == null) defaults = nil; + if (subject == null) subject = nil; + if ($truthy(subs['$nil_or_empty?']())) { + return nil + } candidates = nil; + if ($truthy(subs['$include?'](" "))) { + subs = subs.$delete(" "); + } modifiers_present = $$('SubModifierSniffRx')['$match?'](subs); + $send(subs.$split(","), 'each', [], function $$42(key){var modifier_operation = nil, first = nil, resolved_keys = nil, resolved_key = nil, candidate = nil, $ret_or_1 = nil; + + + if (key == null) key = nil; + modifier_operation = nil; + if ($truthy(modifiers_present)) { + if ($eqeq((first = key.$chr()), "+")) { + + modifier_operation = "append"; + key = key.$slice(1, key.$length()); + } else if ($eqeq(first, "-")) { + + modifier_operation = "remove"; + key = key.$slice(1, key.$length()); + } else if ($truthy(key['$end_with?']("+"))) { + + modifier_operation = "prepend"; + key = key.$chop(); + } + } key = key.$to_sym(); + if (($eqeq(type, "inline") && (($eqeq(key, "verbatim") || ($eqeq(key, "v")))))) { + resolved_keys = $$('BASIC_SUBS'); + } else if ($truthy($$('SUB_GROUPS')['$key?'](key))) { + resolved_keys = $$('SUB_GROUPS')['$[]'](key); + } else if ((($eqeq(type, "inline") && ($eqeq(key.$length(), 1))) && ($truthy($$('SUB_HINTS')['$key?'](key))))) { + + resolved_key = $$('SUB_HINTS')['$[]'](key); + if ($truthy((candidate = $$('SUB_GROUPS')['$[]'](resolved_key)))) { + resolved_keys = candidate; + } else { + resolved_keys = [resolved_key]; + } } else { + resolved_keys = [key]; + } if ($truthy(modifier_operation)) { + + candidates = ($truthy(($ret_or_1 = candidates)) ? ($ret_or_1) : (($truthy(defaults) ? (defaults.$drop(0)) : ([])))); + + switch (modifier_operation) { + case "append": + return (candidates = $rb_plus(candidates, resolved_keys)) + case "prepend": + return (candidates = $rb_plus(resolved_keys, candidates)) + case "remove": + return (candidates = $rb_minus(candidates, resolved_keys)) + default: + return nil + } } else { + + candidates = ($truthy(($ret_or_1 = candidates)) ? ($ret_or_1) : ([])); + return (candidates = $rb_plus(candidates, resolved_keys)); + }}); + if (!$truthy(candidates)) { + return nil + } resolved = candidates['$&']($$('SUB_OPTIONS')['$[]'](type)); + if (!$truthy($rb_minus(candidates, resolved)['$empty?']())) { + + invalid = $rb_minus(candidates, resolved); + self.$logger().$warn("invalid substitution type" + (($truthy($rb_gt(invalid.$size(), 1)) ? ("s") : (""))) + (($truthy(subject) ? (" for ") : (""))) + (subject) + ": " + (invalid.$join(", "))); + } return resolved; + }, -2); + + $def(self, '$resolve_block_subs', function $$resolve_block_subs(subs, defaults, subject) { + var self = this; + + return self.$resolve_subs(subs, "block", defaults, subject) + }); + + $def(self, '$resolve_pass_subs', function $$resolve_pass_subs(subs) { + var self = this; + + return self.$resolve_subs(subs, "inline", nil, "passthrough macro") + }); + + $def(self, '$expand_subs', function $$expand_subs(subs, subject) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil, expanded_subs = nil; + + + if (subject == null) subject = nil; + if ($eqeqeq($$$('Symbol'), ($ret_or_1 = subs))) { + if ($eqeq(subs, "none")) { + return nil + } else if ($truthy(($ret_or_2 = $$('SUB_GROUPS')['$[]'](subs)))) { + return $ret_or_2 + } else { + return [subs] + } + } else if ($eqeqeq($$$('Array'), $ret_or_1)) { + + expanded_subs = []; + $send(subs, 'each', [], function $$43(key){var sub_group = nil; + + + if (key == null) key = nil; + if ($eqeq(key, "none")) { + return nil + } else if ($truthy((sub_group = $$('SUB_GROUPS')['$[]'](key)))) { + return (expanded_subs = $rb_plus(expanded_subs, sub_group)) + } else { + return expanded_subs['$<<'](key) + }}); + if ($truthy(expanded_subs['$empty?']())) { + return nil + } else { + return expanded_subs + } } else { + return self.$resolve_subs(subs, "inline", nil, subject) + } }, -2); + + $def(self, '$commit_subs', function $$commit_subs() { + var self = this, default_subs = nil, custom_subs = nil, $ret_or_1 = nil, idx = nil, syntax_hl = nil; + if (self.default_subs == null) self.default_subs = nil; + if (self.content_model == null) self.content_model = nil; + if (self.context == null) self.context = nil; + if (self.subs == null) self.subs = nil; + if (self.attributes == null) self.attributes = nil; + if (self.document == null) self.document = nil; + if (self.style == null) self.style = nil; + + + if (!$truthy((default_subs = self.default_subs))) { + + switch (self.content_model) { + case "simple": + default_subs = $$('NORMAL_SUBS'); + break; + case "verbatim": + default_subs = ($eqeq(self.context, "verse") ? ($$('NORMAL_SUBS')) : ($$('VERBATIM_SUBS'))); + break; + case "raw": + default_subs = ($eqeq(self.context, "stem") ? ($$('BASIC_SUBS')) : ($$('NO_SUBS'))); + break; + default: + return self.subs + } + } if ($truthy((custom_subs = self.attributes['$[]']("subs")))) { + self.subs = ($truthy(($ret_or_1 = self.$resolve_block_subs(custom_subs, default_subs, self.context))) ? ($ret_or_1) : ([])); + } else { + self.subs = default_subs.$drop(0); + } if ((((($eqeq(self.context, "listing") && ($eqeq(self.style, "source"))) && ($truthy((syntax_hl = self.document.$syntax_highlighter())))) && ($truthy(syntax_hl['$highlight?']()))) && ($truthy((idx = self.subs.$index("specialcharacters")))))) { + self.subs['$[]='](idx, "highlight"); + } return nil; + }); + + $def(self, '$parse_attributes', function $$parse_attributes(attrlist, posattrs, opts) { + var self = this, block = nil, into = nil; + if (self.document == null) self.document = nil; + + + if (posattrs == null) posattrs = []; + if (opts == null) opts = $hash2([], {}); + if ($truthy(($truthy(attrlist) ? (attrlist['$empty?']()) : (true)))) { + return $hash2([], {}) + } if ($truthy(opts['$[]']("unescape_input"))) { + attrlist = self.$normalize_text(attrlist, true, true); + } if (($truthy(opts['$[]']("sub_input")) && ($truthy(attrlist['$include?']($$('ATTR_REF_HEAD')))))) { + attrlist = self.document.$sub_attributes(attrlist); + } if ($truthy(opts['$[]']("sub_result"))) { + block = self; + } if ($truthy((into = opts['$[]']("into")))) { + return $$('AttributeList').$new(attrlist, block).$parse_into(into, posattrs) + } else { + return $$('AttributeList').$new(attrlist, block).$parse(posattrs) + } }, -2); + self.$private(); + + $def(self, '$extract_attributes_from_text', function $$extract_attributes_from_text(text, default_text) { + var self = this, attrlist = nil, resolved_text = nil, attrs = nil; + + + if (default_text == null) default_text = nil; + attrlist = ($truthy(text['$include?']($$('LF'))) ? (text.$tr($$('LF'), " ")) : (text)); + if ($truthy((resolved_text = (attrs = $$('AttributeList').$new(attrlist, self).$parse())['$[]'](1)))) { + if ($eqeq(resolved_text, attrlist)) { + return [text, attrs.$clear()] + } else { + return [resolved_text, attrs] + } + } else { + return [default_text, attrs] + } }, -2); + + $def(self, '$extract_callouts', function $$extract_callouts(source) { + var self = this, callout_marks = nil, autonum = nil, lineno = nil, last_lineno = nil, callout_rx = nil; + + + callout_marks = $hash2([], {}); + autonum = (lineno = 0); + last_lineno = nil; + callout_rx = ($truthy(self['$attr?']("line-comment")) ? ($$('CalloutExtractRxMap')['$[]'](self.$attr("line-comment"))) : ($$('CalloutExtractRx'))); + source = $send(source.$split($$('LF'), -1), 'map', [], function $$44(line){ + + if (line == null) line = nil; + lineno = $rb_plus(lineno, 1); + return $send(line, 'gsub', [callout_rx], function $$45(){var $a, $ret_or_1 = nil; + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$sub($$('RS'), "") + } else { + + ($truthy(($ret_or_1 = callout_marks['$[]'](lineno))) ? ($ret_or_1) : (($a = [lineno, []], $send(callout_marks, '[]=', $a), $a[$a.length - 1])))['$<<']([($truthy(($ret_or_1 = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) ? ($ret_or_1) : (($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), "--") ? ([""]) : (nil)))), ($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), ".") ? ((autonum = $rb_plus(autonum, 1)).$to_s()) : ((($a = $gvars['~']) === nil ? nil : $a['$[]'](4))))]); + last_lineno = lineno; + return ""; + }});}).$join($$('LF')); + if ($truthy(last_lineno)) { + if ($eqeq(last_lineno, lineno)) { + source = "" + (source) + ($$('LF')); + } + } else { + callout_marks = nil; + } return [source, callout_marks]; + }); + + $def(self, '$restore_callouts', function $$restore_callouts(source, callout_marks, source_offset) { + var self = this, preamble = nil, lineno = nil; + + + if (source_offset == null) source_offset = nil; + if ($truthy(source_offset)) { + + preamble = source.$slice(0, source_offset); + source = source.$slice(source_offset, source.$length()); + } else { + preamble = ""; + } lineno = 0; + return $rb_plus(preamble, $send(source.$split($$('LF'), -1), 'map', [], function $$46(line){var $a, $b, self = $$46.$$s == null ? this : $$46.$$s, conums = nil, guard = nil, numeral = nil; + if (self.document == null) self.document = nil; + + + if (line == null) line = nil; + if ($truthy((conums = callout_marks.$delete((lineno = $rb_plus(lineno, 1)))))) { + if ($eqeq(conums.$size(), 1)) { + + $b = conums['$[]'](0), $a = $to_ary($b), (guard = ($a[0] == null ? nil : $a[0])), (numeral = ($a[1] == null ? nil : $a[1])); + return "" + (line) + ($$('Inline').$new(self, "callout", numeral, $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard})})).$convert()); + } else { + return "" + (line) + ($send(conums, 'map', [], function $$47(guard_it, numeral_it){var self = $$47.$$s == null ? this : $$47.$$s; + if (self.document == null) self.document = nil; + + + if (guard_it == null) guard_it = nil; + if (numeral_it == null) numeral_it = nil; + return $$('Inline').$new(self, "callout", numeral_it, $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard_it})})).$convert();}, {$$s: self}).$join(" ")) + } + } else { + return line + }}, {$$s: self}).$join($$('LF'))); + }, -3); + + $def(self, '$convert_quoted_text', function $$convert_quoted_text(match, type, scope) { + var self = this, attrs = nil, unescaped_attrs = nil, attrlist = nil, id = nil, attributes = nil; + + + if ($truthy(match['$[]'](0)['$start_with?']($$('RS')))) { + if (($eqeq(scope, "constrained") && ($truthy((attrs = match['$[]'](2)))))) { + unescaped_attrs = "[" + (attrs) + "]"; + } else { + return match['$[]'](0).$slice(1, match['$[]'](0).$length()) + } + } if ($eqeq(scope, "constrained")) { + if ($truthy(unescaped_attrs)) { + return "" + (unescaped_attrs) + ($$('Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type"], {"type": type})).$convert()) + } else { + + if ($truthy((attrlist = match['$[]'](2)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist))['$[]']("id"); + if ($eqeq(type, "mark")) { + type = "unquoted"; + } } return "" + (match['$[]'](1)) + ($$('Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert()); + } + } else { + + if ($truthy((attrlist = match['$[]'](1)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist))['$[]']("id"); + if ($eqeq(type, "mark")) { + type = "unquoted"; + } } return $$('Inline').$new(self, "quoted", match['$[]'](2), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert(); + } }); + + $def(self, '$do_replacement', function $$do_replacement(m, replacement, restore) { + var captured = nil; + + if ($truthy((captured = m['$[]'](0))['$include?']($$('RS')))) { + return captured.$sub($$('RS'), "") + } else + switch (restore) { + case "none": + return replacement + case "bounding": + return $rb_plus($rb_plus(m['$[]'](1), replacement), m['$[]'](2)) + default: + return $rb_plus(m['$[]'](1), replacement) + } + }); + + $def(self, '$parse_quoted_text_attributes', function $$parse_quoted_text_attributes(str) { + var $a, $b, self = this, before = nil, after = nil, attrs = nil, id = nil, roles = nil; + + + if ($truthy(str['$include?']($$('ATTR_REF_HEAD')))) { + str = self.$sub_attributes(str); + } if ($truthy(str['$include?'](","))) { + str = str.$slice(0, str.$index(",")); + } if ($truthy((str = str.$strip())['$empty?']())) { + return $hash2([], {}) + } else if (($truthy(str['$start_with?'](".", "#")) && ($truthy($$('Compliance').$shorthand_property_syntax())))) { + + $b = str.$partition("#"), $a = $to_ary($b), (before = ($a[0] == null ? nil : $a[0])), (($a[1] == null ? nil : $a[1])), (after = ($a[2] == null ? nil : $a[2])); + attrs = $hash2([], {}); + if ($truthy(after['$empty?']())) { + if ($truthy($rb_gt(before.$length(), 1))) { + attrs['$[]=']("role", before.$tr(".", " ").$lstrip()); + } + } else { + + $b = after.$partition("."), $a = $to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (($a[1] == null ? nil : $a[1])), (roles = ($a[2] == null ? nil : $a[2])); + if (!$truthy(id['$empty?']())) { + attrs['$[]=']("id", id); + } if ($truthy(roles['$empty?']())) { + if ($truthy($rb_gt(before.$length(), 1))) { + attrs['$[]=']("role", before.$tr(".", " ").$lstrip()); + } + } else if ($truthy($rb_gt(before.$length(), 1))) { + attrs['$[]=']("role", $rb_plus($rb_plus(before, "."), roles).$tr(".", " ").$lstrip()); + } else { + attrs['$[]=']("role", roles.$tr(".", " ")); + } } return attrs; + } else { + return $hash2(["role"], {"role": str}) + } }); + + $def(self, '$normalize_text', function $$normalize_text(text, normalize_whitespace, unescape_closing_square_brackets) { + + + if (normalize_whitespace == null) normalize_whitespace = nil; + if (unescape_closing_square_brackets == null) unescape_closing_square_brackets = nil; + if (!$truthy(text['$empty?']())) { + + if ($truthy(normalize_whitespace)) { + text = text.$strip().$tr($$('LF'), " "); + } if (($truthy(unescape_closing_square_brackets) && ($truthy(text['$include?']($$('R_SB')))))) { + text = text.$gsub($$('ESC_R_SB'), $$('R_SB')); + } } return text; + }, -2); + return $def(self, '$split_simple_csv', function $$split_simple_csv(str) { + var values = nil, accum = nil, quote_open = nil; + + if ($truthy(str['$empty?']())) { + return [] + } else if ($truthy(str['$include?']("\""))) { + + values = []; + accum = ""; + quote_open = nil; + $send(str, 'each_char', [], function $$48(c){ + + if (c == null) c = nil; + + switch (c) { + case ",": + if ($truthy(quote_open)) { + return (accum = $rb_plus(accum, c)) + } else { + + values['$<<'](accum.$strip()); + return (accum = ""); + } + case "\"": + return (quote_open = quote_open['$!']()) + default: + return (accum = $rb_plus(accum, c)) + }}); + return values['$<<'](accum.$strip()); + } else { + return $send(str.$split(","), 'map', [], function $$49(it){ + + if (it == null) it = nil; + return it.$strip();}) + } + }); + })($nesting[0], $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/version"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $const_set = Opal.const_set, $nesting = []; Opal.nil; + + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return $const_set($nesting[0], 'VERSION', "2.0.20") + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/abstract_node"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $eqeq = Opal.eqeq, $truthy = Opal.truthy, $def = Opal.def, $send = Opal.send, $rb_minus = Opal.rb_minus, $eqeqeq = Opal.eqeqeq, $rb_lt = Opal.rb_lt, $not = Opal.not, $to_ary = Opal.to_ary, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('include,attr_reader,attr_accessor,==,document,to_s,[],merge,raise,converter,attributes,key?,[]=,delete,tap,new,each_key,end_with?,<<,slice,-,length,update,split,include?,===,join,empty?,apply_reftext_subs,attr?,attr,extname?,image_uri,<,safe,normalize_web_path,uriish?,encode_spaces_in_uri,generate_data_uri_from_uri,generate_data_uri,extname,normalize_system_path,readable?,strict_encode64,binread,warn,logger,require_library,!,open_uri,content_type,read,base_dir,root?,path_resolver,system_path,web_path,!=,prepare_source_string,fetch,read_asset'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'AbstractNode'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.document = $proto.attributes = $proto.parent = nil; + + self.$include($$('Logging')); + self.$include($$('Substitutors')); + self.$attr_reader("attributes"); + self.$attr_reader("context"); + self.$attr_reader("document"); + self.$attr_accessor("id"); + self.$attr_reader("node_name"); + self.$attr_reader("parent"); + + $def(self, '$initialize', function $$initialize(parent, context, opts) { + var self = this, attrs = nil; + + + if (opts == null) opts = $hash2([], {}); + if ($eqeq(context, "document")) { + self.document = self; + } else if ($truthy(parent)) { + self.document = (self.parent = parent).$document(); + } self.node_name = (self.context = context).$to_s(); + self.attributes = ($truthy((attrs = opts['$[]']("attributes"))) ? (attrs.$merge()) : ($hash2([], {}))); + return (self.passthroughs = []); + }, -3); + + $def(self, '$block?', function $AbstractNode_block$ques$1() { + var self = this; + + return self.$raise($$$('NotImplementedError')) + }); + + $def(self, '$inline?', function $AbstractNode_inline$ques$2() { + var self = this; + + return self.$raise($$$('NotImplementedError')) + }); + + $def(self, '$converter', function $$converter() { + var self = this; + + return self.document.$converter() + }); + + $def(self, '$parent=', function $AbstractNode_parent$eq$3(parent) { + var $a, self = this; + + return $a = [parent, parent.$document()], (self.parent = $a[0]), (self.document = $a[1]), $a + }); + + $def(self, '$attr', function $$attr(name, default_value, fallback_name) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil, $ret_or_3 = nil, $ret_or_4 = nil; + + + if (default_value == null) default_value = nil; + if (fallback_name == null) fallback_name = nil; + if ($truthy(($ret_or_1 = self.attributes['$[]'](name.$to_s())))) { + return $ret_or_1 + } else { + + if ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = ($truthy(($ret_or_4 = fallback_name)) ? (self.parent) : ($ret_or_4)))) ? (self.document.$attributes()['$[]'](($eqeq(fallback_name, true) ? (name) : (fallback_name)).$to_s())) : ($ret_or_3))))) { + return $ret_or_2 + } else { + return default_value + } } }, -2); + + $def(self, '$attr?', function $AbstractNode_attr$ques$4(name, expected_value, fallback_name) { + var self = this, $ret_or_1 = nil; + + + if (expected_value == null) expected_value = nil; + if (fallback_name == null) fallback_name = nil; + if ($truthy(expected_value)) { + return expected_value['$=='](($truthy(($ret_or_1 = self.attributes['$[]'](name.$to_s()))) ? ($ret_or_1) : ((($truthy(fallback_name) && ($truthy(self.parent))) ? (self.document.$attributes()['$[]'](($eqeq(fallback_name, true) ? (name) : (fallback_name)).$to_s())) : (nil))))) + } else if ($truthy(($ret_or_1 = self.attributes['$key?'](name.$to_s())))) { + return $ret_or_1 + } else { + + if (($truthy(fallback_name) && ($truthy(self.parent)))) { + + return self.document.$attributes()['$key?'](($eqeq(fallback_name, true) ? (name) : (fallback_name)).$to_s()); + } else { + return false + } } }, -2); + + $def(self, '$set_attr', function $$set_attr(name, value, overwrite) { + var self = this; + + + if (value == null) value = ""; + if (overwrite == null) overwrite = true; + if (($eqeq(overwrite, false) && ($truthy(self.attributes['$key?'](name))))) { + return false + } else { + + self.attributes['$[]='](name, value); + return true; + } }, -2); + + $def(self, '$remove_attr', function $$remove_attr(name) { + var self = this; + + return self.attributes.$delete(name) + }); + + $def(self, '$option?', function $AbstractNode_option$ques$5(name) { + var self = this; + + if ($truthy(self.attributes['$[]']("" + (name) + "-option"))) { + return true + } else { + return false + } + }); + + $def(self, '$set_option', function $$set_option(name) { + var self = this; + + + self.attributes['$[]=']("" + (name) + "-option", ""); + return nil; + }); + + $def(self, '$enabled_options', function $$enabled_options() { + var self = this; + + return $send($$$('Set').$new(), 'tap', [], function $$6(accum){var self = $$6.$$s == null ? this : $$6.$$s; + if (self.attributes == null) self.attributes = nil; + + + if (accum == null) accum = nil; + return $send(self.attributes, 'each_key', [], function $$7(k){ + + if (k == null) k = nil; + if ($truthy(k.$to_s()['$end_with?']("-option"))) { + return accum['$<<'](k.$slice(0, $rb_minus(k.$length(), 7))) + } else { + return nil + }});}, {$$s: self}) + }); + + $def(self, '$update_attributes', function $$update_attributes(new_attributes) { + var self = this; + + return self.attributes.$update(new_attributes) + }); + + $def(self, '$role', function $$role() { + var self = this; + + return self.attributes['$[]']("role") + }); + + $def(self, '$roles', function $$roles() { + var self = this, val = nil; + + if ($truthy((val = self.attributes['$[]']("role")))) { + return val.$split() + } else { + return [] + } + }); + + $def(self, '$role?', function $AbstractNode_role$ques$8(expected_value) { + var self = this; + + + if (expected_value == null) expected_value = nil; + if ($truthy(expected_value)) { + return expected_value['$=='](self.attributes['$[]']("role")) + } else { + + return self.attributes['$key?']("role"); + } }, -1); + + $def(self, '$has_role?', function $AbstractNode_has_role$ques$9(name) { + var self = this, val = nil; + + if ($truthy((val = self.attributes['$[]']("role")))) { + + return (((" ") + (val)) + " ")['$include?'](" " + (name) + " "); + } else { + return false + } + }); + + $def(self, '$role=', function $AbstractNode_role$eq$10(names) { + var $a, self = this; + + return ($a = ["role", ($eqeqeq($$$('Array'), names) ? (names.$join(" ")) : (names))], $send(self.attributes, '[]=', $a), $a[$a.length - 1]) + }); + + $def(self, '$add_role', function $$add_role(name) { + var self = this, val = nil; + + if ($truthy((val = self.attributes['$[]']("role")))) { + if ($truthy((((" ") + (val)) + " ")['$include?'](" " + (name) + " "))) { + return false + } else { + + self.attributes['$[]=']("role", "" + (val) + " " + (name)); + return true; + } + } else { + + self.attributes['$[]=']("role", name); + return true; + } + }); + + $def(self, '$remove_role', function $$remove_role(name) { + var self = this, val = nil; + + if (($truthy((val = self.attributes['$[]']("role"))) && ($truthy((val = val.$split()).$delete(name))))) { + + if ($truthy(val['$empty?']())) { + self.attributes.$delete("role"); + } else { + self.attributes['$[]=']("role", val.$join(" ")); + } return true; + } else { + return false + } + }); + + $def(self, '$reftext', function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.attributes['$[]']("reftext")))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }); + + $def(self, '$reftext?', function $AbstractNode_reftext$ques$11() { + var self = this; + + return self.attributes['$key?']("reftext") + }); + + $def(self, '$icon_uri', function $$icon_uri(name) { + var self = this, icon = nil; + + + if ($truthy(self['$attr?']("icon"))) { + + icon = self.$attr("icon"); + if (!$truthy($$('Helpers')['$extname?'](icon))) { + icon = "" + (icon) + "." + (self.document.$attr("icontype", "png")); + } } else { + icon = "" + (name) + "." + (self.document.$attr("icontype", "png")); + } return self.$image_uri(icon, "iconsdir"); + }); + + $def(self, '$image_uri', function $$image_uri(target_image, asset_dir_key) { + var self = this, doc = nil, images_base = nil; + + + if (asset_dir_key == null) asset_dir_key = "imagesdir"; + if (($truthy($rb_lt((doc = self.document).$safe(), $$$($$('SafeMode'), 'SECURE'))) && ($truthy(doc['$attr?']("data-uri"))))) { + if ((($truthy($$('Helpers')['$uriish?'](target_image)) && ($truthy((target_image = $$('Helpers').$encode_spaces_in_uri(target_image))))) || (((($truthy(asset_dir_key) && ($truthy((images_base = doc.$attr(asset_dir_key))))) && ($truthy($$('Helpers')['$uriish?'](images_base)))) && ($truthy((target_image = self.$normalize_web_path(target_image, images_base, false)))))))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + + return self.$generate_data_uri_from_uri(target_image, doc['$attr?']("cache-uri")); + } else { + return target_image + } + } else { + return self.$generate_data_uri(target_image, asset_dir_key) + } + } else { + return self.$normalize_web_path(target_image, ($truthy(asset_dir_key) ? (doc.$attr(asset_dir_key)) : (nil))) + } }, -2); + + $def(self, '$media_uri', function $$media_uri(target, asset_dir_key) { + var self = this; + + + if (asset_dir_key == null) asset_dir_key = "imagesdir"; + return self.$normalize_web_path(target, ($truthy(asset_dir_key) ? (self.document.$attr(asset_dir_key)) : (nil))); + }, -2); + + $def(self, '$generate_data_uri', function $$generate_data_uri(target_image, asset_dir_key) { + var self = this, ext = nil, mimetype = nil, image_path = nil; + + + if (asset_dir_key == null) asset_dir_key = nil; + if ($truthy((ext = $$('Helpers').$extname(target_image, nil)))) { + mimetype = ($eqeq(ext, ".svg") ? ("image/svg+xml") : ("image/" + (ext.$slice(1, ext.$length())))); + } else { + mimetype = "application/octet-stream"; + } if ($truthy(asset_dir_key)) { + image_path = self.$normalize_system_path(target_image, self.document.$attr(asset_dir_key), nil, $hash2(["target_name"], {"target_name": "image"})); + } else { + image_path = self.$normalize_system_path(target_image); + } if ($truthy($$$('File')['$readable?'](image_path))) { + return "data:" + (mimetype) + ";base64," + ($$$('Base64').$strict_encode64($$$('File').$binread(image_path))) + } else { + + self.$logger().$warn("image to embed not found or not readable: " + (image_path)); + return "data:" + (mimetype) + ";base64,"; + } }, -2); + + $def(self, '$generate_data_uri_from_uri', function $$generate_data_uri_from_uri(image_uri, cache_uri) { + var $a, $b, self = this, mimetype = nil, bindata = nil; + + + if (cache_uri == null) cache_uri = false; + if ($truthy(cache_uri)) { + $$('Helpers').$require_library("open-uri/cached", "open-uri-cached"); + } else if ($not($$('RUBY_ENGINE_OPAL'))) { + $$$('OpenURI'); + } + try { + + $b = $send($$$('OpenURI'), 'open_uri', [image_uri, $$('URI_READ_MODE')], function $$12(f){ + + if (f == null) f = nil; + return [f.$content_type(), f.$read()];}), $a = $to_ary($b), (mimetype = ($a[0] == null ? nil : $a[0])), (bindata = ($a[1] == null ? nil : $a[1])), $b; + return "data:" + (mimetype) + ";base64," + ($$$('Base64').$strict_encode64(bindata)); + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + + self.$logger().$warn("could not retrieve image data from URI: " + (image_uri)); + return image_uri; + } finally { Opal.pop_exception(); } + } else { throw $err; } + } }, -2); + + $def(self, '$normalize_asset_path', function $$normalize_asset_path(asset_ref, asset_name, autocorrect) { + var self = this; + + + if (asset_name == null) asset_name = "path"; + if (autocorrect == null) autocorrect = true; + return self.$normalize_system_path(asset_ref, self.document.$base_dir(), nil, $hash2(["target_name", "recover"], {"target_name": asset_name, "recover": autocorrect})); + }, -2); + + $def(self, '$normalize_system_path', function $$normalize_system_path(target, start, jail, opts) { + var self = this, doc = nil, $ret_or_1 = nil; + + + if (start == null) start = nil; + if (jail == null) jail = nil; + if (opts == null) opts = $hash2([], {}); + if ($truthy($rb_lt((doc = self.document).$safe(), $$$($$('SafeMode'), 'SAFE')))) { + if ($truthy(start)) { + if (!$truthy(doc.$path_resolver()['$root?'](start))) { + start = $$$('File').$join(doc.$base_dir(), start); + } + } else { + start = doc.$base_dir(); + } + } else { + + start = ($truthy(($ret_or_1 = start)) ? ($ret_or_1) : (doc.$base_dir())); + jail = ($truthy(($ret_or_1 = jail)) ? ($ret_or_1) : (doc.$base_dir())); + } return doc.$path_resolver().$system_path(target, start, jail, opts); + }, -2); + + $def(self, '$normalize_web_path', function $$normalize_web_path(target, start, preserve_uri_target) { + var self = this; + + + if (start == null) start = nil; + if (preserve_uri_target == null) preserve_uri_target = true; + if (($truthy(preserve_uri_target) && ($truthy($$('Helpers')['$uriish?'](target))))) { + return $$('Helpers').$encode_spaces_in_uri(target) + } else { + return self.document.$path_resolver().$web_path(target, start) + } }, -2); + + $def(self, '$read_asset', function $$read_asset(path, opts) { + var self = this, $ret_or_1 = nil; + + + if (opts == null) opts = $hash2([], {}); + if (!$eqeqeq($$$('Hash'), opts)) { + opts = $hash2(["warn_on_failure"], {"warn_on_failure": opts['$!='](false)}); + } if ($truthy($$$('File')['$readable?'](path))) { + if ($truthy(opts['$[]']("normalize"))) { + + return $$('Helpers').$prepare_source_string($$$('File').$read(path, $hash2(["mode"], {"mode": $$('FILE_READ_MODE')}))).$join($$('LF')); + } else { + + return $$$('File').$read(path, $hash2(["mode"], {"mode": $$('FILE_READ_MODE')})); + } + } else if ($truthy(opts['$[]']("warn_on_failure"))) { + + self.$logger().$warn("" + (($truthy(($ret_or_1 = self.$attr("docfile"))) ? ($ret_or_1) : (""))) + ": " + (($truthy(($ret_or_1 = opts['$[]']("label"))) ? ($ret_or_1) : ("file"))) + " does not exist or cannot be read: " + (path)); + return nil; + } else { + return nil + } }, -2); + + $def(self, '$read_contents', function $$read_contents(target, opts) { + var self = this, doc = nil, start = nil, contents = nil, $ret_or_1 = nil; + + + if (opts == null) opts = $hash2([], {}); + doc = self.document; + if (($truthy($$('Helpers')['$uriish?'](target)) || ((($truthy((start = opts['$[]']("start"))) && ($truthy($$('Helpers')['$uriish?'](start)))) && ($truthy((target = doc.$path_resolver().$web_path(target, start)))))))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + + if ($truthy(doc['$attr?']("cache-uri"))) { + $$('Helpers').$require_library("open-uri/cached", "open-uri-cached"); + } + try { + if ($truthy(opts['$[]']("normalize"))) { + contents = $$('Helpers').$prepare_source_string($send($$$('OpenURI'), 'open_uri', [target, $$('URI_READ_MODE')], function $$13(f){ + + if (f == null) f = nil; + return f.$read();})).$join($$('LF')); + } else { + contents = $send($$$('OpenURI'), 'open_uri', [target, $$('URI_READ_MODE')], function $$14(f){ + + if (f == null) f = nil; + return f.$read();}); + } + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("could not retrieve contents of " + (($truthy(($ret_or_1 = opts['$[]']("label"))) ? ($ret_or_1) : ("asset"))) + " at URI: " + (target)); + } + } finally { Opal.pop_exception(); } + } else { throw $err; } + } } else if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("cannot retrieve contents of " + (($truthy(($ret_or_1 = opts['$[]']("label"))) ? ($ret_or_1) : ("asset"))) + " at URI: " + (target) + " (allow-uri-read attribute not enabled)"); + } + } else { + + target = self.$normalize_system_path(target, opts['$[]']("start"), nil, $hash2(["target_name"], {"target_name": ($truthy(($ret_or_1 = opts['$[]']("label"))) ? ($ret_or_1) : ("asset"))})); + contents = self.$read_asset(target, $hash2(["normalize", "warn_on_failure", "label"], {"normalize": opts['$[]']("normalize"), "warn_on_failure": opts.$fetch("warn_on_failure", true), "label": opts['$[]']("label")})); + } if ((($truthy(contents) && ($truthy(opts['$[]']("warn_if_empty")))) && ($truthy(contents['$empty?']())))) { + self.$logger().$warn("contents of " + (($truthy(($ret_or_1 = opts['$[]']("label"))) ? ($ret_or_1) : ("asset"))) + " is empty: " + (target)); + } return contents; + }, -2); + return $def(self, '$is_uri?', function $AbstractNode_is_uri$ques$15(str) { + + return $$('Helpers')['$uriish?'](str) + }); + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/abstract_block"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send2 = Opal.send2, $find_super = Opal.find_super, $eqeq = Opal.eqeq, $eqeqeq = Opal.eqeqeq, $def = Opal.def, $return_val = Opal.return_val, $truthy = Opal.truthy, $alias = Opal.alias, $send = Opal.send, $rb_plus = Opal.rb_plus, $not = Opal.not, $neqeq = Opal.neqeq, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('attr_reader,attr_writer,attr_accessor,==,===,level,file,lineno,playback_attributes,convert,converter,join,map,to_s,parent,parent=,<<,empty?,Integer,find_by_internal,to_proc,find_by,context,[],items,+,find_index,include?,next_adjacent_block,blocks,select,sub_specialchars,match?,sub_replacements,title,apply_title_subs,delete,!,reftext,nil_or_empty?,sub_placeholder,sub_quotes,compat_mode,attributes,chomp,increment_and_store_counter,index=,numbered,sectname,numeral=,counter,caption=,numeral,int_to_roman,each,assign_numeral,reindex_sections,protected,has_role?,raise,header?,!=,flatten,head,rows,merge,body,foot,style,inner_document'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'AbstractBlock'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.source_location = $proto.document = $proto.attributes = $proto.blocks = $proto.numeral = $proto.context = $proto.parent = $proto.caption = $proto.style = $proto.converted_title = $proto.title = $proto.subs = $proto.next_section_index = $proto.next_section_ordinal = $proto.id = $proto.header = nil; + + self.$attr_reader("blocks"); + self.$attr_writer("caption"); + self.$attr_accessor("content_model"); + self.$attr_accessor("level"); + self.$attr_accessor("numeral"); + self.$attr_accessor("source_location"); + self.$attr_accessor("style"); + self.$attr_reader("subs"); + + $def(self, '$initialize', function $$initialize(parent, context, opts) { + var $yield = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + + if (opts == null) opts = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [parent, context, opts], $yield); + self.content_model = "compound"; + self.blocks = []; + self.subs = []; + self.id = (self.title = (self.caption = (self.numeral = (self.style = (self.default_subs = (self.source_location = nil)))))); + if (($eqeq(context, "document") || ($eqeq(context, "section")))) { + + self.level = (self.next_section_index = 0); + return (self.next_section_ordinal = 1); + } else if ($eqeqeq($$('AbstractBlock'), parent)) { + return (self.level = parent.$level()) + } else { + return (self.level = nil) + } }, -3); + + $def(self, '$block?', $return_val(true)); + + $def(self, '$inline?', $return_val(false)); + + $def(self, '$file', function $$file() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.source_location))) { + return self.source_location.$file() + } else { + return $ret_or_1 + } + }); + + $def(self, '$lineno', function $$lineno() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.source_location))) { + return self.source_location.$lineno() + } else { + return $ret_or_1 + } + }); + + $def(self, '$convert', function $$convert() { + var self = this; + + + self.document.$playback_attributes(self.attributes); + return self.$converter().$convert(self); + }); + $alias(self, "render", "convert"); + + $def(self, '$content', function $$content() { + var self = this; + + return $send(self.blocks, 'map', [], function $$1(b){ + + if (b == null) b = nil; + return b.$convert();}).$join($$('LF')) + }); + + $def(self, '$context=', function $AbstractBlock_context$eq$2(context) { + var self = this; + + return (self.node_name = (self.context = context).$to_s()) + }); + + $def(self, '$<<', function $AbstractBlock_$lt$lt$3(block) { + var self = this; + + + if (!$eqeq(block.$parent(), self)) { + block['$parent='](self); + } self.blocks['$<<'](block); + return self; + }); + $alias(self, "append", "<<"); + + $def(self, '$blocks?', function $AbstractBlock_blocks$ques$4() { + var self = this; + + if ($truthy(self.blocks['$empty?']())) { + return false + } else { + return true + } + }); + + $def(self, '$sections?', $return_val(false)); + + $def(self, '$number', function $$number() { + var self = this; + + try { + + return self.$Integer(self.numeral); + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + return self.numeral + } finally { Opal.pop_exception(); } + } else { throw $err; } + } + }); + + $def(self, '$number=', function $AbstractBlock_number$eq$5(val) { + var self = this; + + return (self.numeral = val.$to_s()) + }); + + $def(self, '$find_by', function $$find_by(selector) { + var block = $$find_by.$$p || nil, self = this, result = nil; + + $$find_by.$$p = null; + if (selector == null) selector = $hash2([], {}); + try { + return $send(self, 'find_by_internal', [selector, (result = [])], block.$to_proc()) + } catch ($err) { + if (Opal.rescue($err, [$$$('StopIteration')])) { + try { + return result + } finally { Opal.pop_exception(); } + } else { throw $err; } + } }, -1); + $alias(self, "query", "find_by"); + + $def(self, '$next_adjacent_block', function $$next_adjacent_block() { + var self = this, p = nil, sib = nil; + + if ($eqeq(self.context, "document")) { + return nil + } else if (($eqeq((p = self.parent).$context(), "dlist") && ($eqeq(self.context, "list_item")))) { + if ($truthy((sib = p.$items()['$[]']($rb_plus($send(p.$items(), 'find_index', [], function $$6(terms, desc){var self = $$6.$$s == null ? this : $$6.$$s, $ret_or_1 = nil; + + + if (terms == null) terms = nil; + if (desc == null) desc = nil; + if ($truthy(($ret_or_1 = terms['$include?'](self)))) { + return $ret_or_1 + } else { + return desc['$=='](self) + }}, {$$s: self}), 1))))) { + return sib + } else { + return p.$next_adjacent_block() + } + } else if ($truthy((sib = p.$blocks()['$[]']($rb_plus(p.$blocks().$find_index(self), 1))))) { + return sib + } else { + return p.$next_adjacent_block() + } + }); + + $def(self, '$sections', function $$sections() { + var self = this; + + return $send(self.blocks, 'select', [], function $$7(block){ + + if (block == null) block = nil; + return block.$context()['$==']("section");}) + }); + + $def(self, '$alt', function $$alt() { + var self = this, text = nil; + + if ($truthy((text = self.attributes['$[]']("alt")))) { + if ($eqeq(text, self.attributes['$[]']("default-alt"))) { + return self.$sub_specialchars(text) + } else { + + text = self.$sub_specialchars(text); + if ($truthy($$('ReplaceableTextRx')['$match?'](text))) { + + return self.$sub_replacements(text); + } else { + return text + } } + } else { + return "" + } + }); + + $def(self, '$caption', function $$caption() { + var self = this; + + if ($eqeq(self.context, "admonition")) { + return self.attributes['$[]']("textlabel") + } else { + return self.caption + } + }); + + $def(self, '$captioned_title', function $$captioned_title() { + var self = this; + + return "" + (self.caption) + (self.$title()) + }); + + $def(self, '$list_marker_keyword', function $$list_marker_keyword(list_type) { + var self = this, $ret_or_1 = nil; + + + if (list_type == null) list_type = nil; + return $$('ORDERED_LIST_KEYWORDS')['$[]'](($truthy(($ret_or_1 = list_type)) ? ($ret_or_1) : (self.style))); + }, -1); + + $def(self, '$title', function $$title() { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + return (self.converted_title = ($truthy(($ret_or_1 = self.converted_title)) ? ($ret_or_1) : ($truthy(($ret_or_2 = self.title)) ? (self.$apply_title_subs(self.title)) : ($ret_or_2)))) + }); + + $def(self, '$title?', function $AbstractBlock_title$ques$8() { + var self = this; + + if ($truthy(self.title)) { + return true + } else { + return false + } + }); + + $def(self, '$title=', function $AbstractBlock_title$eq$9(val) { + var self = this; + + + self.converted_title = nil; + return (self.title = val); + }); + + $def(self, '$sub?', function $AbstractBlock_sub$ques$10(name) { + var self = this; + + return self.subs['$include?'](name) + }); + + $def(self, '$remove_sub', function $$remove_sub(sub) { + var self = this; + + + self.subs.$delete(sub); + return nil; + }); + + $def(self, '$xreftext', function $$xreftext(xrefstyle) { + var self = this, val = nil, quoted_title = nil, prefix = nil, caption_attr_name = nil; + + + if (xrefstyle == null) xrefstyle = nil; + if (($truthy((val = self.$reftext())) && ($not(val['$empty?']())))) { + return val + } else if ((($truthy(xrefstyle) && ($truthy(self.title))) && ($not(self.caption['$nil_or_empty?']())))) { + + switch (xrefstyle) { + case "full": + + quoted_title = self.$sub_placeholder(self.$sub_quotes(($truthy(self.document.$compat_mode()) ? ("``%s''") : ("\"`%s`\""))), self.$title()); + if ((($truthy(self.numeral) && ($truthy((caption_attr_name = $$('CAPTION_ATTRIBUTE_NAMES')['$[]'](self.context))))) && ($truthy((prefix = self.document.$attributes()['$[]'](caption_attr_name)))))) { + return "" + (prefix) + " " + (self.numeral) + ", " + (quoted_title) + } else { + return "" + (self.caption.$chomp(". ")) + ", " + (quoted_title) + } case "short": + if ((($truthy(self.numeral) && ($truthy((caption_attr_name = $$('CAPTION_ATTRIBUTE_NAMES')['$[]'](self.context))))) && ($truthy((prefix = self.document.$attributes()['$[]'](caption_attr_name)))))) { + return "" + (prefix) + " " + (self.numeral) + } else { + return self.caption.$chomp(". ") + } + default: + return self.$title() + } + } else { + return self.$title() + } }, -1); + + $def(self, '$assign_caption', function $$assign_caption(value, caption_context) { + var self = this, $ret_or_1 = nil, prefix = nil, attr_name = nil; + + + if (caption_context == null) caption_context = self.context; + if ((($truthy(self.caption) || ($not(self.title))) || ($truthy((self.caption = ($truthy(($ret_or_1 = value)) ? ($ret_or_1) : (self.document.$attributes()['$[]']("caption")))))))) { + return nil + } else if (($truthy((attr_name = $$('CAPTION_ATTRIBUTE_NAMES')['$[]'](caption_context))) && ($truthy((prefix = self.document.$attributes()['$[]'](attr_name)))))) { + + self.caption = "" + (prefix) + " " + ((self.numeral = self.document.$increment_and_store_counter("" + (caption_context) + "-number", self))) + ". "; + return nil; + } else { + return nil + } }, -2); + + $def(self, '$assign_numeral', function $$assign_numeral(section) { + var $a, self = this, like = nil, sectname = nil, caption = nil; + + + self.next_section_index = $rb_plus(($a = [self.next_section_index], $send(section, 'index=', $a), $a[$a.length - 1]), 1); + if ($truthy((like = section.$numbered()))) { + if ($eqeq((sectname = section.$sectname()), "appendix")) { + + section['$numeral='](self.document.$counter("appendix-number", "A")); + section['$caption='](($truthy((caption = self.document.$attributes()['$[]']("appendix-caption"))) ? ("" + (caption) + " " + (section.$numeral()) + ": ") : ("" + (section.$numeral()) + ". "))); + } else if (($eqeq(sectname, "chapter") || ($eqeq(like, "chapter")))) { + section['$numeral='](self.document.$counter("chapter-number", 1).$to_s()); + } else { + + section['$numeral='](($eqeq(sectname, "part") ? ($$('Helpers').$int_to_roman(self.next_section_ordinal)) : (self.next_section_ordinal.$to_s()))); + self.next_section_ordinal = $rb_plus(self.next_section_ordinal, 1); + } + } return nil; + }); + + $def(self, '$reindex_sections', function $$reindex_sections() { + var self = this; + + + self.next_section_index = 0; + self.next_section_ordinal = 1; + return $send(self.blocks, 'each', [], function $$11(block){var self = $$11.$$s == null ? this : $$11.$$s; + + + if (block == null) block = nil; + if ($eqeq(block.$context(), "section")) { + + self.$assign_numeral(block); + return block.$reindex_sections(); + } else { + return nil + }}, {$$s: self}); + }); + self.$protected(); + return $def(self, '$find_by_internal', function $$find_by_internal(selector, result) { + var block = $$find_by_internal.$$p || nil, self = this, id_selector = nil, role_selector = nil, style_selector = nil, any_context = nil, context_selector = nil, verdict = nil; + + $$find_by_internal.$$p = null; + if (selector == null) selector = $hash2([], {}); + if (result == null) result = []; + if ((((($truthy((any_context = ($truthy((context_selector = selector['$[]']("context"))) ? (nil) : (true)))) || ($eqeq(context_selector, self.context))) && (($not((style_selector = selector['$[]']("style"))) || ($eqeq(style_selector, self.style))))) && (($not((role_selector = selector['$[]']("role"))) || ($truthy(self['$has_role?'](role_selector)))))) && (($not((id_selector = selector['$[]']("id"))) || ($eqeq(id_selector, self.id)))))) { + if ((block !== nil)) { + if ($truthy((verdict = Opal.yield1(block, self)))) { + + switch (verdict) { + case "prune": + + result['$<<'](self); + if ($truthy(id_selector)) { + self.$raise($$$('StopIteration')); + } return result; + case "reject": + + if ($truthy(id_selector)) { + self.$raise($$$('StopIteration')); + } return result; + case "stop": + self.$raise($$$('StopIteration')); + break; + default: + + result['$<<'](self); + if ($truthy(id_selector)) { + self.$raise($$$('StopIteration')); + } } + } else if ($truthy(id_selector)) { + self.$raise($$$('StopIteration')); + } + } else { + + result['$<<'](self); + if ($truthy(id_selector)) { + self.$raise($$$('StopIteration')); + } } + } + switch (self.context) { + case "document": + if (!$eqeq(context_selector, "document")) { + + if (($truthy(self['$header?']()) && (($truthy(any_context) || ($eqeq(context_selector, "section")))))) { + $send(self.header, 'find_by_internal', [selector, result], block.$to_proc()); + } $send(self.blocks, 'each', [], function $$12(b){ + + if (b == null) b = nil; + if (($eqeq(context_selector, "section") && ($neqeq(b.$context(), "section")))) { + return nil + } return $send(b, 'find_by_internal', [selector, result], block.$to_proc());}); + } + break; + case "dlist": + if (($truthy(any_context) || ($neqeq(context_selector, "section")))) { + $send(self.blocks.$flatten(), 'each', [], function $$13(b){ + + if (b == null) b = nil; + if ($truthy(b)) { + return $send(b, 'find_by_internal', [selector, result], block.$to_proc()) + } else { + return nil + }}); + } + break; + case "table": + if ($truthy(selector['$[]']("traverse_documents"))) { + + $send(self.$rows().$head(), 'each', [], function $$14(r){ + + if (r == null) r = nil; + return $send(r, 'each', [], function $$15(c){ + + if (c == null) c = nil; + return $send(c, 'find_by_internal', [selector, result], block.$to_proc());});}); + if ($eqeq(context_selector, "inner_document")) { + selector = selector.$merge($hash2(["context"], {"context": "document"})); + } $send($rb_plus(self.$rows().$body(), self.$rows().$foot()), 'each', [], function $$16(r){ + + if (r == null) r = nil; + return $send(r, 'each', [], function $$17(c){ + + if (c == null) c = nil; + $send(c, 'find_by_internal', [selector, result], block.$to_proc()); + if ($eqeq(c.$style(), "asciidoc")) { + return $send(c.$inner_document(), 'find_by_internal', [selector, result], block.$to_proc()) + } else { + return nil + }});}); + } else { + $send($rb_plus($rb_plus(self.$rows().$head(), self.$rows().$body()), self.$rows().$foot()), 'each', [], function $$18(r){ + + if (r == null) r = nil; + return $send(r, 'each', [], function $$19(c){ + + if (c == null) c = nil; + return $send(c, 'find_by_internal', [selector, result], block.$to_proc());});}); + } + break; + default: + $send(self.blocks, 'each', [], function $$20(b){ + + if (b == null) b = nil; + if (($eqeq(context_selector, "section") && ($neqeq(b.$context(), "section")))) { + return nil + } return $send(b, 'find_by_internal', [selector, result], block.$to_proc());}); + } return result; + }, -1); + })($nesting[0], $$('AbstractNode'), $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/attribute_list"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $hash = Opal.hash, $regexp = Opal.regexp, $hash2 = Opal.hash2, $def = Opal.def, $truthy = Opal.truthy, $rb_plus = Opal.rb_plus, $send = Opal.send, $defs = Opal.defs, $eqeqeq = Opal.eqeqeq, $eqeq = Opal.eqeq, $rb_times = Opal.rb_times, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('new,[],update,parse,parse_attribute,eos?,skip_delimiter,+,rekey,each_with_index,[]=,private,skip_blank,===,peek,parse_attribute_value,get_byte,start_with?,scan_name,end_with?,rstrip,string,==,unscan,scan_to_delimiter,*,include?,delete,each,split,empty?,apply_subs,scan_to_quote,gsub,skip,scan'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'AttributeList'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.attributes = $proto.scanner = $proto.delimiter = $proto.block = $proto.delimiter_skip_pattern = $proto.delimiter_boundary_pattern = nil; + + $const_set($nesting[0], 'APOS', "'"); + $const_set($nesting[0], 'BACKSLASH', "\\"); + $const_set($nesting[0], 'QUOT', "\""); + $const_set($nesting[0], 'BoundaryRx', $hash($$('QUOT'), /.*?[^\\](?=")/, $$('APOS'), /.*?[^\\](?=')/, ",", /.*?(?=[ \t]*(,|$))/)); + $const_set($nesting[0], 'EscapedQuotes', $hash($$('QUOT'), "\\\"", $$('APOS'), "\\'")); + $const_set($nesting[0], 'NameRx', $regexp([$$('CG_WORD'), "[", $$('CC_WORD'), "\\-.]*"])); + $const_set($nesting[0], 'BlankRx', /[ \t]+/); + $const_set($nesting[0], 'SkipRx', $hash2([","], {",": /[ \t]*(,|$)/})); + + $def(self, '$initialize', function $$initialize(source, block, delimiter) { + var self = this; + + + if (block == null) block = nil; + if (delimiter == null) delimiter = ","; + self.scanner = $$$('StringScanner').$new(source); + self.block = block; + self.delimiter = delimiter; + self.delimiter_skip_pattern = $$('SkipRx')['$[]'](delimiter); + self.delimiter_boundary_pattern = $$('BoundaryRx')['$[]'](delimiter); + return (self.attributes = nil); + }, -2); + + $def(self, '$parse_into', function $$parse_into(attributes, positional_attrs) { + var self = this; + + + if (positional_attrs == null) positional_attrs = []; + return attributes.$update(self.$parse(positional_attrs)); + }, -2); + + $def(self, '$parse', function $$parse(positional_attrs) { + var self = this, index = nil; + + + if (positional_attrs == null) positional_attrs = []; + if ($truthy(self.attributes)) { + return self.attributes + } self.attributes = $hash2([], {}); + index = 0; + while ($truthy(self.$parse_attribute(index, positional_attrs))) { + + if ($truthy(self.scanner['$eos?']())) { + break + } self.$skip_delimiter(); + index = $rb_plus(index, 1); + } return self.attributes; + }, -1); + + $def(self, '$rekey', function $$rekey(positional_attrs) { + var self = this; + + return $$('AttributeList').$rekey(self.attributes, positional_attrs) + }); + $defs(self, '$rekey', function $$rekey(attributes, positional_attrs) { + + + $send(positional_attrs, 'each_with_index', [], function $$1(key, index){var $a, val = nil; + + + if (key == null) key = nil; + if (index == null) index = nil; + if (($truthy(key) && ($truthy((val = attributes['$[]']($rb_plus(index, 1))))))) { + return ($a = [key, val], $send(attributes, '[]=', $a), $a[$a.length - 1]) + } else { + return nil + }}); + return attributes; + }); + self.$private(); + + $def(self, '$parse_attribute', function $$parse_attribute(index, positional_attrs) { + var self = this, continue$ = nil, $ret_or_1 = nil, name = nil, single_quoted = nil, skipped = nil, $ret_or_2 = nil, $ret_or_3 = nil, c = nil, value = nil, positional_attr_name = nil; + + + continue$ = true; + self.$skip_blank(); + if ($eqeqeq($$('QUOT'), ($ret_or_1 = self.scanner.$peek(1)))) { + name = self.$parse_attribute_value(self.scanner.$get_byte()); + } else if ($eqeqeq($$('APOS'), $ret_or_1)) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + if (!$truthy(name['$start_with?']($$('APOS')))) { + single_quoted = true; + } } else { + + skipped = ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = (name = self.$scan_name()))) ? (self.$skip_blank()) : ($ret_or_3)))) ? ($ret_or_2) : (0)); + if ($truthy(self.scanner['$eos?']())) { + + if (!($truthy(name) || ($truthy(self.scanner.$string().$rstrip()['$end_with?'](self.delimiter))))) { + return nil + } continue$ = nil; + } else if ($eqeq((c = self.scanner.$get_byte()), self.delimiter)) { + self.scanner.$unscan(); + } else if ($truthy(name)) { + if ($eqeq(c, "=")) { + + self.$skip_blank(); + if ($eqeqeq($$('QUOT'), ($ret_or_2 = (c = self.scanner.$get_byte())))) { + value = self.$parse_attribute_value(c); + } else if ($eqeqeq($$('APOS'), $ret_or_2)) { + + value = self.$parse_attribute_value(c); + if (!$truthy(value['$start_with?']($$('APOS')))) { + single_quoted = true; + } } else if ($eqeqeq(self.delimiter, $ret_or_2)) { + + value = ""; + self.scanner.$unscan(); + } else if ($eqeqeq(nil, $ret_or_2)) { + value = ""; + } else { + + value = "" + (c) + (self.$scan_to_delimiter()); + if ($eqeq(value, "None")) { + return true + } } } else { + name = "" + (name) + ($rb_times(" ", skipped)) + (c) + (self.$scan_to_delimiter()); + } + } else { + name = "" + (c) + (self.$scan_to_delimiter()); + } } if ($truthy(value)) { + + switch (name) { + case "options": + case "opts": + if ($truthy(value['$include?'](","))) { + + if ($truthy(value['$include?'](" "))) { + value = value.$delete(" "); + } $send(value.$split(","), 'each', [], function $$2(opt){var $a, self = $$2.$$s == null ? this : $$2.$$s; + if (self.attributes == null) self.attributes = nil; + + + if (opt == null) opt = nil; + if ($truthy(opt['$empty?']())) { + return nil + } else { + return ($a = ["" + (opt) + "-option", ""], $send(self.attributes, '[]=', $a), $a[$a.length - 1]) + }}, {$$s: self}); + } else if (!$truthy(value['$empty?']())) { + self.attributes['$[]=']("" + (value) + "-option", ""); + } + break; + default: + if (($truthy(single_quoted) && ($truthy(self.block)))) { + + switch (name) { + case "title": + case "reftext": + self.attributes['$[]='](name, value); + break; + default: + self.attributes['$[]='](name, self.block.$apply_subs(value)); + } + } else { + self.attributes['$[]='](name, value); + } + } + } else { + + if (($truthy(single_quoted) && ($truthy(self.block)))) { + name = self.block.$apply_subs(name); + } if (($truthy((positional_attr_name = positional_attrs['$[]'](index))) && ($truthy(name)))) { + self.attributes['$[]='](positional_attr_name, name); + } self.attributes['$[]=']($rb_plus(index, 1), name); + } return continue$; + }); + + $def(self, '$parse_attribute_value', function $$parse_attribute_value(quote) { + var self = this, value = nil; + + if ($eqeq(self.scanner.$peek(1), quote)) { + + self.scanner.$get_byte(); + return ""; + } else if ($truthy((value = self.$scan_to_quote(quote)))) { + + self.scanner.$get_byte(); + if ($truthy(value['$include?']($$('BACKSLASH')))) { + + return value.$gsub($$('EscapedQuotes')['$[]'](quote), quote); + } else { + return value + } } else { + return "" + (quote) + (self.$scan_to_delimiter()) + } + }); + + $def(self, '$skip_blank', function $$skip_blank() { + var self = this; + + return self.scanner.$skip($$('BlankRx')) + }); + + $def(self, '$skip_delimiter', function $$skip_delimiter() { + var self = this; + + return self.scanner.$skip(self.delimiter_skip_pattern) + }); + + $def(self, '$scan_name', function $$scan_name() { + var self = this; + + return self.scanner.$scan($$('NameRx')) + }); + + $def(self, '$scan_to_delimiter', function $$scan_to_delimiter() { + var self = this; + + return self.scanner.$scan(self.delimiter_boundary_pattern) + }); + return $def(self, '$scan_to_quote', function $$scan_to_quote(quote) { + var self = this; + + return self.scanner.$scan($$('BoundaryRx')['$[]'](quote)) + }); + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/block"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $hash2 = Opal.hash2, $alias = Opal.alias, $send2 = Opal.send2, $find_super = Opal.find_super, $truthy = Opal.truthy, $eqeqeq = Opal.eqeqeq, $def = Opal.def, $rb_lt = Opal.rb_lt, $eqeq = Opal.eqeq, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('default=,context,attr_accessor,[],key?,===,drop,delete,[]=,to_s,commit_subs,nil_or_empty?,prepare_source_string,apply_subs,join,<,size,empty?,rstrip,shift,pop,==,warn,logger,class,object_id,inspect'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Block'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.attributes = $proto.content_model = $proto.lines = $proto.subs = $proto.blocks = $proto.context = $proto.style = nil; + + $const_set($nesting[0], 'DEFAULT_CONTENT_MODEL', $hash2(["audio", "image", "listing", "literal", "stem", "open", "page_break", "pass", "thematic_break", "video"], {"audio": "empty", "image": "empty", "listing": "verbatim", "literal": "verbatim", "stem": "raw", "open": "compound", "page_break": "empty", "pass": "raw", "thematic_break": "empty", "video": "empty"}))['$default=']("simple"); + $alias(self, "blockname", "context"); + self.$attr_accessor("lines"); + + $def(self, '$initialize', function $$initialize(parent, context, opts) { + var $yield = $$initialize.$$p || nil, self = this, $ret_or_1 = nil, subs = nil, raw_source = nil; + + $$initialize.$$p = null; + + if (opts == null) opts = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [parent, context, opts], $yield); + self.content_model = ($truthy(($ret_or_1 = opts['$[]']("content_model"))) ? ($ret_or_1) : ($$('DEFAULT_CONTENT_MODEL')['$[]'](context))); + if ($truthy(opts['$key?']("subs"))) { + if ($truthy((subs = opts['$[]']("subs")))) { + + if ($eqeqeq("default", ($ret_or_1 = subs))) { + self.default_subs = opts['$[]']("default_subs"); + } else if ($eqeqeq($$$('Array'), $ret_or_1)) { + + self.default_subs = subs.$drop(0); + self.attributes.$delete("subs"); + } else { + + self.default_subs = nil; + self.attributes['$[]=']("subs", subs.$to_s()); + } self.$commit_subs(); + } else { + + self.default_subs = []; + self.attributes.$delete("subs"); + } + } else { + self.default_subs = nil; + } if ($truthy((raw_source = opts['$[]']("source"))['$nil_or_empty?']())) { + return (self.lines = []) + } else if ($eqeqeq($$$('String'), raw_source)) { + return (self.lines = $$('Helpers').$prepare_source_string(raw_source)) + } else { + return (self.lines = raw_source.$drop(0)) + } }, -3); + + $def(self, '$content', function $$content() { + var $yield = $$content.$$p || nil, self = this, result = nil, $ret_or_2 = nil, first = nil, last = nil; + + $$content.$$p = null; + + switch (self.content_model) { + case "compound": + return $send2(self, $find_super(self, 'content', $$content, false, true), 'content', [], $yield) + case "simple": + return self.$apply_subs(self.lines.$join($$('LF')), self.subs) + case "verbatim": + case "raw": + + result = self.$apply_subs(self.lines, self.subs); + if ($truthy($rb_lt(result.$size(), 2))) { + if ($truthy(($ret_or_2 = result['$[]'](0)))) { + return $ret_or_2 + } else { + return "" + } + } else { + + while ($truthy(($truthy(($ret_or_2 = (first = result['$[]'](0)))) ? (first.$rstrip()['$empty?']()) : ($ret_or_2)))) { + result.$shift(); + } while ($truthy(($truthy(($ret_or_2 = (last = result['$[]'](-1)))) ? (last.$rstrip()['$empty?']()) : ($ret_or_2)))) { + result.$pop(); + } return result.$join($$('LF')); + } default: + + if (!$eqeq(self.content_model, "empty")) { + self.$logger().$warn("unknown content model '" + (self.content_model) + "' for block: " + (self)); + } return nil; + } + }); + + $def(self, '$source', function $$source() { + var self = this; + + return self.lines.$join($$('LF')) + }); + return $def(self, '$to_s', function $$to_s() { + var self = this, content_summary = nil; + + + content_summary = ($eqeq(self.content_model, "compound") ? ("blocks: " + (self.blocks.$size())) : ("lines: " + (self.lines.$size()))); + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", content_model: " + (self.content_model.$inspect()) + ", style: " + (self.style.$inspect()) + ", " + (content_summary) + "}>"; + }); + })($nesting[0], $$('AbstractBlock'), $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/callouts"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $def = Opal.def, $hash2 = Opal.hash2, $rb_plus = Opal.rb_plus, $truthy = Opal.truthy, $rb_le = Opal.rb_le, $rb_minus = Opal.rb_minus, $send = Opal.send, $eqeq = Opal.eqeq, $rb_lt = Opal.rb_lt, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('next_list,<<,current_list,to_i,generate_next_callout_id,+,<=,size,[],-,chop,join,map,==,<,private,generate_callout_id'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super) { + var self = $klass($base, $super, 'Callouts'); + + var $proto = self.$$prototype; + + $proto.co_index = $proto.lists = $proto.list_index = nil; + + + $def(self, '$initialize', function $$initialize() { + var self = this; + + + self.lists = []; + self.list_index = 0; + return self.$next_list(); + }); + + $def(self, '$register', function $$register(li_ordinal) { + var self = this, id = nil; + + + self.$current_list()['$<<']($hash2(["ordinal", "id"], {"ordinal": li_ordinal.$to_i(), "id": (id = self.$generate_next_callout_id())})); + self.co_index = $rb_plus(self.co_index, 1); + return id; + }); + + $def(self, '$read_next_id', function $$read_next_id() { + var self = this, id = nil, list = nil; + + + id = nil; + list = self.$current_list(); + if ($truthy($rb_le(self.co_index, list.$size()))) { + id = list['$[]']($rb_minus(self.co_index, 1))['$[]']("id"); + } self.co_index = $rb_plus(self.co_index, 1); + return id; + }); + + $def(self, '$callout_ids', function $$callout_ids(li_ordinal) { + var self = this; + + return $send(self.$current_list(), 'map', [], function $$1(it){ + + if (it == null) it = nil; + if ($eqeq(it['$[]']("ordinal"), li_ordinal)) { + return "" + (it['$[]']("id")) + " " + } else { + return "" + }}).$join().$chop() + }); + + $def(self, '$current_list', function $$current_list() { + var self = this; + + return self.lists['$[]']($rb_minus(self.list_index, 1)) + }); + + $def(self, '$next_list', function $$next_list() { + var self = this; + + + self.list_index = $rb_plus(self.list_index, 1); + if ($truthy($rb_lt(self.lists.$size(), self.list_index))) { + self.lists['$<<']([]); + } self.co_index = 1; + return nil; + }); + + $def(self, '$rewind', function $$rewind() { + var self = this; + + + self.list_index = 1; + self.co_index = 1; + return nil; + }); + self.$private(); + + $def(self, '$generate_next_callout_id', function $$generate_next_callout_id() { + var self = this; + + return self.$generate_callout_id(self.list_index, self.co_index) + }); + return $def(self, '$generate_callout_id', function $$generate_callout_id(list_index, co_index) { + + return "CO" + (list_index) + "-" + (co_index) + }); + })($nesting[0], null) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/converter/composite"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $slice = Opal.slice, $extract_kwargs = Opal.extract_kwargs, $ensure_kwargs = Opal.ensure_kwargs, $send = Opal.send, $truthy = Opal.truthy, $def = Opal.def, $thrower = Opal.thrower, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('attr_reader,each,respond_to?,composed,init_backend_traits,backend_traits,new,[]=,find_converter,convert,converter_for,node_name,[],handles?,raise'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super) { + var self = $klass($base, $super, 'CompositeConverter'); + + var $proto = self.$$prototype; + + $proto.converter_cache = $proto.converters = nil; + + self.$attr_reader("converters"); + + $def(self, '$initialize', function $$initialize(backend, $a, $b) { + var $post_args, $kwargs, converters, backend_traits_source, self = this; + + + $post_args = $slice(arguments, 1); + $kwargs = $extract_kwargs($post_args); + $kwargs = $ensure_kwargs($kwargs); + converters = $post_args; + + backend_traits_source = $kwargs.$$smap["backend_traits_source"];if (backend_traits_source == null) backend_traits_source = nil; + self.backend = backend; + $send((self.converters = converters), 'each', [], function $$1(converter){var self = $$1.$$s == null ? this : $$1.$$s; + + + if (converter == null) converter = nil; + if ($truthy(converter['$respond_to?']("composed"))) { + return converter.$composed(self) + } else { + return nil + }}, {$$s: self}); + if ($truthy(backend_traits_source)) { + self.$init_backend_traits(backend_traits_source.$backend_traits()); + } return (self.converter_cache = $send($$$('Hash'), 'new', [], function $$2(hash, key){var $c, self = $$2.$$s == null ? this : $$2.$$s; + + + if (hash == null) hash = nil; + if (key == null) key = nil; + return ($c = [key, self.$find_converter(key)], $send(hash, '[]=', $c), $c[$c.length - 1]);}, {$$s: self})); + }, -2); + + $def(self, '$convert', function $$convert(node, transform, opts) { + var self = this, $ret_or_1 = nil; + + + if (transform == null) transform = nil; + if (opts == null) opts = nil; + return self.$converter_for((transform = ($truthy(($ret_or_1 = transform)) ? ($ret_or_1) : (node.$node_name())))).$convert(node, transform, opts); + }, -2); + + $def(self, '$converter_for', function $$converter_for(transform) { + var self = this; + + return self.converter_cache['$[]'](transform) + }); + return $def(self, '$find_converter', function $$find_converter(transform) {try { var $t_return = $thrower('return'); + var self = this; + + + $send(self.converters, 'each', [], function $$3(candidate){ + + if (candidate == null) candidate = nil; + if ($truthy(candidate['$handles?'](transform))) { + $t_return.$throw(candidate); + } else { + return nil + };}, {$$ret: $t_return}); + return self.$raise("Could not find a converter to handle transform: " + (transform));} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }); + })($$('Converter'), $$$($$('Converter'), 'Base')) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/converter"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $hash2 = Opal.hash2, $def = Opal.def, $return_val = Opal.return_val, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $defs = Opal.defs, $send = Opal.send, $alias = Opal.alias, $slice = Opal.slice, $to_a = Opal.to_a, $extract_kwargs = Opal.extract_kwargs, $ensure_kwargs = Opal.ensure_kwargs, $eqeqeq = Opal.eqeqeq, $Class = Opal.Class, $klass = Opal.klass, $class_variable_set = Opal.class_variable_set, $class_variable_get = Opal.class_variable_get, $rb_plus = Opal.rb_plus, $gvars = Opal.gvars, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('autoload,attr_reader,raise,class,[],sub,slice,length,==,[]=,backend_traits,derive_backend_traits,register,map,to_s,new,create,default,each,default=,registry,for,===,supports_templates?,merge,private,include,delete,clear,send,extend,private_class_method,node_name,+,name,receiver,warn,logger,respond_to?,content'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $parent_nesting) { + var self = $module($base, 'Converter'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$autoload("CompositeConverter", "" + ("asciidoctor") + "/converter/composite"); + self.$attr_reader("backend"); + + $def(self, '$initialize', function $$initialize(backend, opts) { + var self = this; + + + if (opts == null) opts = $hash2([], {}); + return (self.backend = backend); + }, -2); + + $def(self, '$convert', function $$convert(node, transform, opts) { + var self = this; + if (self.backend == null) self.backend = nil; + return self.$raise($$$('NotImplementedError'), "" + (self.$class()) + " (backend: " + (self.backend) + ") must implement the #" + ("convert") + " method"); + }, -2); + + $def(self, '$handles?', $return_val(true)); + $defs(self, '$derive_backend_traits', function $$derive_backend_traits(backend, basebackend) { + var outfilesuffix = nil, $ret_or_1 = nil, filetype = nil; + + + if (basebackend == null) basebackend = nil; + if (!$truthy(backend)) { + return $hash2([], {}) + } if ($truthy((outfilesuffix = $$('DEFAULT_EXTENSIONS')['$[]']((basebackend = ($truthy(($ret_or_1 = basebackend)) ? ($ret_or_1) : (backend.$sub($$('TrailingDigitsRx'), "")))))))) { + filetype = outfilesuffix.$slice(1, outfilesuffix.$length()); + } else { + outfilesuffix = "." + ((filetype = basebackend)); + } if ($eqeq(filetype, "html")) { + return $hash2(["basebackend", "filetype", "htmlsyntax", "outfilesuffix"], {"basebackend": basebackend, "filetype": filetype, "htmlsyntax": "html", "outfilesuffix": outfilesuffix}) + } else { + return $hash2(["basebackend", "filetype", "outfilesuffix"], {"basebackend": basebackend, "filetype": filetype, "outfilesuffix": outfilesuffix}) + } }, -2); + (function($base, $parent_nesting) { + var self = $module($base, 'BackendTraits'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$basebackend', function $$basebackend(value) { + var $a, self = this; + + + if (value == null) value = nil; + if ($truthy(value)) { + + return ($a = ["basebackend", value], $send(self.$backend_traits(value), '[]=', $a), $a[$a.length - 1]); + } else { + return self.$backend_traits()['$[]']("basebackend") + } }, -1); + + $def(self, '$filetype', function $$filetype(value) { + var $a, self = this; + + + if (value == null) value = nil; + if ($truthy(value)) { + + return ($a = ["filetype", value], $send(self.$backend_traits(), '[]=', $a), $a[$a.length - 1]); + } else { + return self.$backend_traits()['$[]']("filetype") + } }, -1); + + $def(self, '$htmlsyntax', function $$htmlsyntax(value) { + var $a, self = this; + + + if (value == null) value = nil; + if ($truthy(value)) { + + return ($a = ["htmlsyntax", value], $send(self.$backend_traits(), '[]=', $a), $a[$a.length - 1]); + } else { + return self.$backend_traits()['$[]']("htmlsyntax") + } }, -1); + + $def(self, '$outfilesuffix', function $$outfilesuffix(value) { + var $a, self = this; + + + if (value == null) value = nil; + if ($truthy(value)) { + + return ($a = ["outfilesuffix", value], $send(self.$backend_traits(), '[]=', $a), $a[$a.length - 1]); + } else { + return self.$backend_traits()['$[]']("outfilesuffix") + } }, -1); + + $def(self, '$supports_templates', function $$supports_templates(value) { + var $a, self = this; + + + if (value == null) value = true; + return ($a = ["supports_templates", value], $send(self.$backend_traits(), '[]=', $a), $a[$a.length - 1]); + }, -1); + + $def(self, '$supports_templates?', function $BackendTraits_supports_templates$ques$1() { + var self = this; + + return self.$backend_traits()['$[]']("supports_templates") + }); + + $def(self, '$init_backend_traits', function $$init_backend_traits(value) { + var self = this, $ret_or_1 = nil; + + + if (value == null) value = nil; + return (self.backend_traits = ($truthy(($ret_or_1 = value)) ? ($ret_or_1) : ($hash2([], {})))); + }, -1); + + $def(self, '$backend_traits', function $$backend_traits(basebackend) { + var self = this, $ret_or_1 = nil; + if (self.backend_traits == null) self.backend_traits = nil; + if (self.backend == null) self.backend = nil; + + + if (basebackend == null) basebackend = nil; + return (self.backend_traits = ($truthy(($ret_or_1 = self.backend_traits)) ? ($ret_or_1) : ($$('Converter').$derive_backend_traits(self.backend, basebackend)))); + }, -1); + $alias(self, "backend_info", "backend_traits"); + return $defs(self, '$derive_backend_traits', function $$derive_backend_traits(backend, basebackend) { + + + if (basebackend == null) basebackend = nil; + return $$('Converter').$derive_backend_traits(backend, basebackend); + }, -2); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'Config'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$register_for', function $$register_for($a) { + var $post_args, backends, self = this; + + + $post_args = $slice(arguments); + backends = $post_args; + return $send($$('Converter'), 'register', [self].concat($to_a($send(backends, 'map', [], function $$2(backend){ + + if (backend == null) backend = nil; + return backend.$to_s();})))); + }, -1) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'Factory'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + $defs(self, '$new', function $Factory_new$3($a, $b) { + var $post_args, $kwargs, converters, proxy_default; + + + $post_args = $slice(arguments); + $kwargs = $extract_kwargs($post_args); + $kwargs = $ensure_kwargs($kwargs); + + if ($post_args.length > 0) converters = $post_args.shift();if (converters == null) converters = nil; + + proxy_default = $kwargs.$$smap["proxy_default"];if (proxy_default == null) proxy_default = true; + if ($truthy(proxy_default)) { + + return $$('DefaultFactoryProxy').$new(converters); + } else { + + return $$('CustomFactory').$new(converters); + } }, -1); + $defs(self, '$default', function $Factory_default$4($a) { + + + $slice(arguments); + return $$('Converter'); + }, -1); + $defs(self, '$create', function $$create(backend, opts) { + var self = this; + + + if (opts == null) opts = $hash2([], {}); + return self.$default().$create(backend, opts); + }, -2); + + $def(self, '$register', function $$register(converter, $a) { + var $post_args, backends, self = this; + + + $post_args = $slice(arguments, 1); + backends = $post_args; + return $send(backends, 'each', [], function $$5(backend){var $b, self = $$5.$$s == null ? this : $$5.$$s; + + + if (backend == null) backend = nil; + if ($eqeq(backend, "*")) { + + return ($b = [converter], $send(self.$registry(), 'default=', $b), $b[$b.length - 1]); + } else { + + return ($b = [backend, converter], $send(self.$registry(), '[]=', $b), $b[$b.length - 1]); + }}, {$$s: self}); + }, -2); + + $def(self, '$for', function $Factory_for$6(backend) { + var self = this; + + return self.$registry()['$[]'](backend) + }); + + $def(self, '$create', function $$create(backend, opts) { + var self = this, converter = nil, template_dirs = nil, delegate_backend = nil; + + + if (opts == null) opts = $hash2([], {}); + if ($truthy((converter = self.$for(backend)))) { + + if ($eqeqeq($Class, converter)) { + converter = converter.$new(backend, opts); + } if ((($truthy((template_dirs = opts['$[]']("template_dirs"))) && ($eqeqeq($$('BackendTraits'), converter))) && ($truthy(converter['$supports_templates?']())))) { + return $$('CompositeConverter').$new(backend, $$('TemplateConverter').$new(backend, template_dirs, opts), converter, $hash2(["backend_traits_source"], {"backend_traits_source": converter})) + } else { + return converter + } } else if ($truthy((template_dirs = opts['$[]']("template_dirs")))) { + if (($truthy((delegate_backend = opts['$[]']("delegate_backend"))) && ($truthy((converter = self.$for(delegate_backend)))))) { + + if ($eqeqeq($Class, converter)) { + converter = converter.$new(delegate_backend, opts); + } return $$('CompositeConverter').$new(backend, $$('TemplateConverter').$new(backend, template_dirs, opts), converter, $hash2(["backend_traits_source"], {"backend_traits_source": converter})); + } else { + return $$('TemplateConverter').$new(backend, template_dirs, opts) + } + } else { + return nil + } }, -2); + + $def(self, '$converters', function $$converters() { + var self = this; + + return self.$registry().$merge() + }); + self.$private(); + return $def(self, '$registry', function $$registry() { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('Factory')) + " subclass " + (self.$class()) + " must implement the #" + ("registry") + " method") + }); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'CustomFactory'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('Factory')); + + $def(self, '$initialize', function $$initialize(seed_registry) { + var self = this; + + + if (seed_registry == null) seed_registry = nil; + if ($truthy(seed_registry)) { + + seed_registry['$default='](seed_registry.$delete("*")); + return (self.registry = seed_registry); + } else { + return (self.registry = $hash2([], {})) + } }, -1); + + $def(self, '$unregister_all', function $$unregister_all() { + var $a, self = this; + + return ($a = [nil], $send(self.$registry().$clear(), 'default=', $a), $a[$a.length - 1]) + }); + self.$private(); + return self.$attr_reader("registry"); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'DefaultFactory'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('Factory')); + self.$private(); + $class_variable_set($nesting[0], '@@registry', $hash2([], {})); + + $def(self, '$registry', function $$registry() { + + return $class_variable_get($nesting[0], '@@registry', false) + }); + return nil; + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'DefaultFactoryProxy'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('DefaultFactory')); + return nil; + })($nesting[0], $$('CustomFactory'), $nesting); + $defs(self, '$included', function $$included(into) { + + + into.$send("include", $$('BackendTraits')); + return into.$extend($$('Config')); + }); + self.$private_class_method("included"); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Base'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.backend = nil; + + self.$include($$('Logging')); + self.$include($$('Converter')); + + $def(self, '$convert', function $$convert(node, transform, opts) { + var self = this, ex = nil; + if ($gvars["!"] == null) $gvars["!"] = nil; + + + if (transform == null) transform = node.$node_name(); + if (opts == null) opts = nil; + try { + if ($truthy(opts)) { + + return self.$send($rb_plus("convert_", transform), node, opts); + } else { + + return self.$send($rb_plus("convert_", transform), node); + } + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + + if (!(($eqeqeq($$$('NoMethodError'), (ex = $gvars["!"])) && ($eqeq(ex.$receiver(), self))) && ($eqeq(ex.$name().$to_s(), transform)))) { + self.$raise(); + }; + self.$logger().$warn("missing convert handler for " + (ex.$name()) + " node in " + (self.backend) + " backend (" + (self.$class()) + ")"); + return nil; + } finally { Opal.pop_exception(); } + } else { throw $err; } + } }, -2); + + $def(self, '$handles?', function $Base_handles$ques$7(transform) { + var self = this; + + return self['$respond_to?']("convert_" + (transform)) + }); + + $def(self, '$content_only', function $$content_only(node) { + + return node.$content() + }); + return $def(self, '$skip', $return_val(nil)); + })($nesting[0], null, $nesting); + return self.$extend($$('DefaultFactory')); + })($nesting[0], $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/document"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $send = Opal.send, $alias = Opal.alias, $truthy = Opal.truthy, $def = Opal.def, $hash2 = Opal.hash2, $not = Opal.not, $to_ary = Opal.to_ary, $return_ivar = Opal.return_ivar, $send2 = Opal.send2, $find_super = Opal.find_super, $rb_minus = Opal.rb_minus, $eqeq = Opal.eqeq, $eqeqeq = Opal.eqeqeq, $hash = Opal.hash, $rb_ge = Opal.rb_ge, $rb_plus = Opal.rb_plus, $neqeq = Opal.neqeq, $thrower = Opal.thrower, $rb_gt = Opal.rb_gt, $rb_lt = Opal.rb_lt, $gvars = Opal.gvars, $to_a = Opal.to_a, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('new,target,attr_reader,nil?,<<,[],[]=,main,include?,strip,squeeze,gsub,!,empty?,rpartition,attr_accessor,catalog,delete,base_dir,options,merge,instance_variable_get,attributes,safe,compat_mode,outfilesuffix,sourcemap,path_resolver,converter,extensions,syntax_highlighter,each,end_with?,start_with?,slice,-,length,chop,==,downcase,===,extname,value_for_name,key?,freeze,attribute_undefined,attribute_missing,update,&,keys,name_for_value,expand_path,pwd,to_s,>=,+,abs,to_i,delete_if,update_doctype_attributes,cursor,parse,restore_attributes,update_backend_attributes,fetch,fill_datetime_attributes,activate,groups,create,to_proc,preprocessors?,preprocessors,process_method,tree_processors?,tree_processors,!=,counter,nil_or_empty?,attribute_locked?,nextval,value,save_to,increment_and_store_counter,register,tap,xreftext,>,source,source_lines,doctitle,sectname=,title=,first_section,title,reftext,<,find,context,header?,assign_numeral,clear_playback_attributes,save_attributes,name,negate,rewind,replace,apply_attribute_value_subs,delete?,start,doctype,content_model,warn,logger,content,convert,postprocessors?,postprocessors,record,write,respond_to?,chomp,class,write_alternate_pages,map,split,resolve_docinfo_subs,normalize_system_path,read_asset,apply_subs,docinfo_processors?,join,concat,compact,docinfo_processors,object_id,inspect,size,private,=~,resolve_pass_subs,apply_header_subs,limit_bytesize,bytesize,valid_encoding?,byteslice,resolve_subs,utc,at,Integer,now,index,strftime,year,utc_offset,partition,create_converter,basebackend,filetype,htmlsyntax,derive_backend_traits,raise'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Document'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.attributes = $proto.safe = $proto.sourcemap = $proto.reader = $proto.base_dir = $proto.parsed = $proto.parent_document = $proto.extensions = $proto.options = $proto.counters = $proto.catalog = $proto.reftexts = $proto.next_section_index = $proto.header = $proto.blocks = $proto.header_attributes = $proto.attributes_modified = $proto.backend = $proto.attribute_overrides = $proto.timings = $proto.converter = $proto.outfilesuffix = $proto.docinfo_processor_extensions = $proto.document = $proto.max_attribute_value_size = $proto.id = $proto.doctype = nil; + + $const_set($nesting[0], 'ImageReference', $send($$$('Struct'), 'new', ["target", "imagesdir"], function $Document$1(){var self = $Document$1.$$s == null ? this : $Document$1.$$s; + + return $alias(self, "to_s", "target")}, {$$s: self})); + $const_set($nesting[0], 'Footnote', $$$('Struct').$new("index", "id", "text")); + (function($base, $super) { + var self = $klass($base, $super, 'AttributeEntry'); + + + + self.$attr_reader("name", "value", "negate"); + + $def(self, '$initialize', function $$initialize(name, value, negate) { + var self = this; + + + if (negate == null) negate = nil; + self.name = name; + self.value = value; + return (self.negate = ($truthy(negate['$nil?']()) ? (value['$nil?']()) : (negate))); + }, -3); + return $def(self, '$save_to', function $$save_to(block_attributes) { + var $a, self = this, $ret_or_1 = nil; + + + ($truthy(($ret_or_1 = block_attributes['$[]']("attribute_entries"))) ? ($ret_or_1) : (($a = ["attribute_entries", []], $send(block_attributes, '[]=', $a), $a[$a.length - 1])))['$<<'](self); + return self; + }); + })($nesting[0], null); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Title'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.subtitle = nil; + + self.$attr_reader("main"); + $alias(self, "title", "main"); + self.$attr_reader("subtitle"); + self.$attr_reader("combined"); + + $def(self, '$initialize', function $$initialize(val, opts) { + var $a, $b, self = this, sep = nil, $ret_or_1 = nil; + + + if (opts == null) opts = $hash2([], {}); + if (($truthy((self.sanitized = opts['$[]']("sanitize"))) && ($truthy(val['$include?']("<"))))) { + val = val.$gsub($$('XmlSanitizeRx'), "").$squeeze(" ").$strip(); + } if (($truthy((sep = ($truthy(($ret_or_1 = opts['$[]']("separator"))) ? ($ret_or_1) : (":")))['$empty?']()) || ($not(val['$include?']((sep = "" + (sep) + " ")))))) { + + self.main = val; + self.subtitle = nil; + } else { + $b = val.$rpartition(sep), $a = $to_ary($b), (self.main = ($a[0] == null ? nil : $a[0])), (($a[1] == null ? nil : $a[1])), (self.subtitle = ($a[2] == null ? nil : $a[2])); + } return (self.combined = val); + }, -2); + + $def(self, '$sanitized?', $return_ivar("sanitized")); + + $def(self, '$subtitle?', function $Title_subtitle$ques$2() { + var self = this; + + if ($truthy(self.subtitle)) { + return true + } else { + return false + } + }); + return $def(self, '$to_s', $return_ivar("combined")); + })($nesting[0], null, $nesting); + $const_set($nesting[0], 'Author', $$$('Struct').$new("name", "firstname", "middlename", "lastname", "initials", "email")); + self.$attr_reader("safe"); + self.$attr_reader("compat_mode"); + self.$attr_reader("backend"); + self.$attr_reader("doctype"); + self.$attr_accessor("sourcemap"); + self.$attr_reader("catalog"); + $alias(self, "references", "catalog"); + self.$attr_reader("counters"); + self.$attr_reader("header"); + self.$attr_reader("base_dir"); + self.$attr_reader("options"); + self.$attr_reader("outfilesuffix"); + self.$attr_reader("parent_document"); + self.$attr_reader("reader"); + self.$attr_reader("path_resolver"); + self.$attr_reader("converter"); + self.$attr_reader("syntax_highlighter"); + self.$attr_reader("extensions"); + + $def(self, '$initialize', function $$initialize(data, options) { + var $b, $c, $d, $e; $$initialize.$$p || nil; var self = this, parent_doc = nil, $ret_or_1 = nil, attr_overrides = nil, parent_doctype = nil, initialize_extensions = nil, to_file = nil, safe_mode = nil, input_mtime = nil, standalone = nil, attrs = nil, safe_mode_name = nil, base_dir_val = nil, backend_val = nil, doctype_val = nil, size = nil, initial_backend = nil, ext_registry = nil, ext_block = nil; + + $$initialize.$$p = null; + + if (data == null) data = nil; + if (options == null) options = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [self, "document"], null); + if ($truthy((parent_doc = options.$delete("parent")))) { + + self.parent_document = parent_doc; + if ($truthy(($ret_or_1 = options['$[]']("base_dir")))) ; else { + options['$[]=']("base_dir", parent_doc.$base_dir()); + } if ($truthy(parent_doc.$options()['$[]']("catalog_assets"))) { + options['$[]=']("catalog_assets", true); + } if ($truthy(parent_doc.$options()['$[]']("to_dir"))) { + options['$[]=']("to_dir", parent_doc.$options()['$[]']("to_dir")); + } self.catalog = parent_doc.$catalog().$merge($hash2(["footnotes"], {"footnotes": []})); + self.attribute_overrides = (attr_overrides = parent_doc.$instance_variable_get("@attribute_overrides").$merge(parent_doc.$attributes())); + attr_overrides.$delete("compat-mode"); + parent_doctype = attr_overrides.$delete("doctype"); + attr_overrides.$delete("notitle"); + attr_overrides.$delete("showtitle"); + attr_overrides.$delete("toc"); + self.attributes['$[]=']("toc-placement", ($truthy(($ret_or_1 = attr_overrides.$delete("toc-placement"))) ? ($ret_or_1) : ("auto"))); + attr_overrides.$delete("toc-position"); + self.safe = parent_doc.$safe(); + if ($truthy((self.compat_mode = parent_doc.$compat_mode()))) { + self.attributes['$[]=']("compat-mode", ""); + } self.outfilesuffix = parent_doc.$outfilesuffix(); + self.sourcemap = parent_doc.$sourcemap(); + self.timings = nil; + self.path_resolver = parent_doc.$path_resolver(); + self.converter = parent_doc.$converter(); + initialize_extensions = nil; + self.extensions = parent_doc.$extensions(); + self.syntax_highlighter = parent_doc.$syntax_highlighter(); + } else { + + self.parent_document = nil; + self.catalog = $hash2(["ids", "refs", "footnotes", "links", "images", "callouts", "includes"], {"ids": $hash2([], {}), "refs": $hash2([], {}), "footnotes": [], "links": [], "images": [], "callouts": $$('Callouts').$new(), "includes": $hash2([], {})}); + self.attribute_overrides = (attr_overrides = $hash2([], {})); + $send(($truthy(($ret_or_1 = options['$[]']("attributes"))) ? ($ret_or_1) : ($hash2([], {}))), 'each', [], function $$3(key, val){var $a; + + + if (key == null) key = nil; + if (val == null) val = nil; + if ($truthy(key['$end_with?']("@"))) { + if ($truthy(key['$start_with?']("!"))) { + $a = [key.$slice(1, $rb_minus(key.$length(), 2)), false], (key = $a[0]), (val = $a[1]); + } else if ($truthy(key['$end_with?']("!@"))) { + $a = [key.$slice(0, $rb_minus(key.$length(), 2)), false], (key = $a[0]), (val = $a[1]); + } else { + $a = [key.$chop(), "" + (val) + "@"], (key = $a[0]), (val = $a[1]); + } + } else if ($truthy(key['$start_with?']("!"))) { + $a = [key.$slice(1, key.$length()), ($eqeq(val, "@") ? (false) : (nil))], (key = $a[0]), (val = $a[1]); + } else if ($truthy(key['$end_with?']("!"))) { + $a = [key.$chop(), ($eqeq(val, "@") ? (false) : (nil))], (key = $a[0]), (val = $a[1]); + } return ($a = [key.$downcase(), val], $send(attr_overrides, '[]=', $a), $a[$a.length - 1]);}); + if ($eqeqeq($$$('String'), (to_file = options['$[]']("to_file")))) { + attr_overrides['$[]=']("outfilesuffix", $$('Helpers').$extname(to_file)); + } if ($not((safe_mode = options['$[]']("safe")))) { + self.safe = $$$($$('SafeMode'), 'SECURE'); + } else if ($eqeqeq($$$('Integer'), safe_mode)) { + self.safe = safe_mode; + } else { + self.safe = (function() { try { + + return $$('SafeMode').$value_for_name(safe_mode); + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + return $$$($$('SafeMode'), 'SECURE') + } finally { Opal.pop_exception(); } + } else { throw $err; } + }})(); + } input_mtime = options.$delete("input_mtime"); + self.compat_mode = attr_overrides['$key?']("compat-mode"); + self.sourcemap = options['$[]']("sourcemap"); + self.timings = options.$delete("timings"); + self.path_resolver = $$('PathResolver').$new(); + initialize_extensions = (($truthy((($b = $$$('::', 'Asciidoctor', 'skip_raise')) && ($$$($b, 'Extensions', 'skip_raise')) ? 'constant' : nil)) || ($truthy(options['$key?']("extensions")))) ? ($$$($$$('Asciidoctor'), 'Extensions')) : (nil)); + self.extensions = nil; + if (($truthy(options['$key?']("header_footer")) && ($not(options['$key?']("standalone"))))) { + options['$[]=']("standalone", options['$[]']("header_footer")); + } } self.parsed = (self.reftexts = (self.header = (self.header_attributes = nil))); + self.counters = $hash2([], {}); + self.attributes_modified = $$$('Set').$new(); + self.docinfo_processor_extensions = $hash2([], {}); + standalone = options['$[]']("standalone"); + (self.options = options).$freeze(); + attrs = self.attributes; + if (!$truthy(parent_doc)) { + + attrs['$[]=']("attribute-undefined", $$('Compliance').$attribute_undefined()); + attrs['$[]=']("attribute-missing", $$('Compliance').$attribute_missing()); + attrs.$update($$('DEFAULT_ATTRIBUTES')); + } if ($truthy(standalone)) { + + attr_overrides['$[]=']("embedded", nil); + attrs['$[]=']("copycss", ""); + attrs['$[]=']("iconfont-remote", ""); + attrs['$[]=']("stylesheet", ""); + attrs['$[]=']("webfonts", ""); + } else { + + attr_overrides['$[]=']("embedded", ""); + if (($truthy(attr_overrides['$key?']("showtitle")) && ($eqeq(attr_overrides.$keys()['$&'](["notitle", "showtitle"])['$[]'](-1), "showtitle")))) { + attr_overrides['$[]=']("notitle", $hash(nil, "", false, "@", "@", false)['$[]'](attr_overrides['$[]']("showtitle"))); + } else if ($truthy(attr_overrides['$key?']("notitle"))) { + attr_overrides['$[]=']("showtitle", $hash(nil, "", false, "@", "@", false)['$[]'](attr_overrides['$[]']("notitle"))); + } else { + attrs['$[]=']("notitle", ""); + } } attr_overrides['$[]=']("asciidoctor", ""); + attr_overrides['$[]=']("asciidoctor-version", $$$($$$('Asciidoctor'), 'VERSION')); + attr_overrides['$[]=']("safe-mode-name", (safe_mode_name = $$('SafeMode').$name_for_value(self.safe))); + attr_overrides['$[]=']("safe-mode-" + (safe_mode_name), ""); + attr_overrides['$[]=']("safe-mode-level", self.safe); + if ($truthy(($ret_or_1 = attr_overrides['$[]']("max-include-depth")))) ; else { + attr_overrides['$[]=']("max-include-depth", 64); + } if ($truthy(($ret_or_1 = attr_overrides['$[]']("allow-uri-read")))) ; else { + attr_overrides['$[]=']("allow-uri-read", nil); + } if ($truthy(attr_overrides['$key?']("numbered"))) { + attr_overrides['$[]=']("sectnums", attr_overrides.$delete("numbered")); + } if ($truthy(attr_overrides['$key?']("hardbreaks"))) { + attr_overrides['$[]=']("hardbreaks-option", attr_overrides.$delete("hardbreaks")); + } if ($truthy((base_dir_val = options['$[]']("base_dir")))) { + self.base_dir = ($c = ["docdir", $$$('File').$expand_path(base_dir_val)], $send(attr_overrides, '[]=', $c), $c[$c.length - 1]); + } else if ($truthy(attr_overrides['$[]']("docdir"))) { + self.base_dir = attr_overrides['$[]']("docdir"); + } else { + self.base_dir = ($c = ["docdir", $$$('Dir').$pwd()], $send(attr_overrides, '[]=', $c), $c[$c.length - 1]); + } if ($truthy((backend_val = options['$[]']("backend")))) { + attr_overrides['$[]=']("backend", backend_val.$to_s()); + } if ($truthy((doctype_val = options['$[]']("doctype")))) { + attr_overrides['$[]=']("doctype", doctype_val.$to_s()); + } if ($truthy($rb_ge(self.safe, $$$($$('SafeMode'), 'SERVER')))) { + + if ($truthy(($ret_or_1 = attr_overrides['$[]']("copycss")))) ; else { + attr_overrides['$[]=']("copycss", nil); + } if ($truthy(($ret_or_1 = attr_overrides['$[]']("source-highlighter")))) ; else { + attr_overrides['$[]=']("source-highlighter", nil); + } if ($truthy(($ret_or_1 = attr_overrides['$[]']("backend")))) ; else { + attr_overrides['$[]=']("backend", $$('DEFAULT_BACKEND')); + } if (($not(parent_doc) && ($truthy(attr_overrides['$key?']("docfile"))))) { + attr_overrides['$[]=']("docfile", attr_overrides['$[]']("docfile")['$[]'](Opal.Range.$new($rb_plus(attr_overrides['$[]']("docdir").$length(), 1), -1, false))); + } attr_overrides['$[]=']("docdir", ""); + if ($truthy(($ret_or_1 = attr_overrides['$[]']("user-home")))) ; else { + attr_overrides['$[]=']("user-home", "."); + } if ($truthy($rb_ge(self.safe, $$$($$('SafeMode'), 'SECURE')))) { + + if (!$truthy(attr_overrides['$key?']("max-attribute-value-size"))) { + attr_overrides['$[]=']("max-attribute-value-size", 4096); + } if (!$truthy(attr_overrides['$key?']("linkcss"))) { + attr_overrides['$[]=']("linkcss", ""); + } if ($truthy(($ret_or_1 = attr_overrides['$[]']("icons")))) ; else { + attr_overrides['$[]=']("icons", nil); + } } } else if ($truthy(($ret_or_1 = attr_overrides['$[]']("user-home")))) ; else { + attr_overrides['$[]=']("user-home", $$('USER_HOME')); + } self.max_attribute_value_size = ($truthy((size = ($truthy(($ret_or_1 = attr_overrides['$[]']("max-attribute-value-size"))) ? ($ret_or_1) : (($c = ["max-attribute-value-size", nil], $send(attr_overrides, '[]=', $c), $c[$c.length - 1]))))) ? (size.$to_i().$abs()) : (nil)); + $send(attr_overrides, 'delete_if', [], function $$4(key, val){var $d, verdict = nil; + + + if (key == null) key = nil; + if (val == null) val = nil; + if ($truthy(val)) { + + if (($eqeqeq($$$('String'), val) && ($truthy(val['$end_with?']("@"))))) { + $d = [val.$chop(), true], (val = $d[0]), (verdict = $d[1]); + } attrs['$[]='](key, val); + } else { + + attrs.$delete(key); + verdict = val['$=='](false); + } return verdict;}); + if ($truthy(parent_doc)) { + + self.backend = attrs['$[]']("backend"); + if (!$eqeq((self.doctype = ($c = ["doctype", parent_doctype], $send(attrs, '[]=', $c), $c[$c.length - 1])), $$('DEFAULT_DOCTYPE'))) { + self.$update_doctype_attributes($$('DEFAULT_DOCTYPE')); + } self.reader = $$('Reader').$new(data, options['$[]']("cursor")); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor(); + } $$('Parser').$parse(self.reader, self); + self.$restore_attributes(); + return (self.parsed = true); + } else { + + self.backend = nil; + if ($eqeq((initial_backend = ($truthy(($ret_or_1 = attrs['$[]']("backend"))) ? ($ret_or_1) : ($$('DEFAULT_BACKEND')))), "manpage")) { + self.doctype = ($c = ["doctype", ($d = ["doctype", "manpage"], $send(attr_overrides, '[]=', $d), $d[$d.length - 1])], $send(attrs, '[]=', $c), $c[$c.length - 1]); + } else { + self.doctype = ($truthy(($ret_or_1 = attrs['$[]']("doctype"))) ? ($ret_or_1) : (($c = ["doctype", $$('DEFAULT_DOCTYPE')], $send(attrs, '[]=', $c), $c[$c.length - 1]))); + } self.$update_backend_attributes(initial_backend, true); + if ($truthy(($ret_or_1 = attrs['$[]']("stylesdir")))) ; else { + attrs['$[]=']("stylesdir", "."); + } if ($truthy(($ret_or_1 = attrs['$[]']("iconsdir")))) ; else { + attrs['$[]=']("iconsdir", "" + (attrs.$fetch("imagesdir", "./images")) + "/icons"); + } self.$fill_datetime_attributes(attrs, input_mtime); + if ($truthy(initialize_extensions)) { + if ($truthy((ext_registry = options['$[]']("extension_registry")))) { + if (($eqeqeq($$$($$('Extensions'), 'Registry'), ext_registry) || (($truthy((($e = $$$('::', 'AsciidoctorJ', 'skip_raise')) && ($d = $$$($e, 'Extensions', 'skip_raise')) && ($c = $$$($d, 'ExtensionRegistry', 'skip_raise')) ? 'constant' : nil)) && ($eqeqeq($$$($$$($$$('AsciidoctorJ'), 'Extensions'), 'ExtensionRegistry'), ext_registry)))))) { + self.extensions = ext_registry.$activate(self); + } + } else if ($truthy((ext_block = options['$[]']("extensions"))['$nil?']())) { + if (!$truthy($$('Extensions').$groups()['$empty?']())) { + self.extensions = $$$($$('Extensions'), 'Registry').$new().$activate(self); + } + } else if ($eqeqeq($$$('Proc'), ext_block)) { + self.extensions = $send($$('Extensions'), 'create', [], ext_block.$to_proc()).$activate(self); + } + } self.reader = $$('PreprocessorReader').$new(self, data, $$$($$('Reader'), 'Cursor').$new(attrs['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + return (self.source_location = self.reader.$cursor()) + } else { + return nil + } } }, -1); + + $def(self, '$parse', function $$parse(data) { + var self = this, doc = nil, exts = nil; + + + if (data == null) data = nil; + if ($truthy(self.parsed)) { + return self + } else { + + doc = self; + if ($truthy(data)) { + + self.reader = $$('PreprocessorReader').$new(doc, data, $$$($$('Reader'), 'Cursor').$new(self.attributes['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor(); + } } if (($truthy((exts = ($truthy(self.parent_document) ? (nil) : (self.extensions)))) && ($truthy(exts['$preprocessors?']())))) { + $send(exts.$preprocessors(), 'each', [], function $$5(ext){var self = $$5.$$s == null ? this : $$5.$$s, $ret_or_1 = nil; + if (self.reader == null) self.reader = nil; + + + if (ext == null) ext = nil; + return (self.reader = ($truthy(($ret_or_1 = ext.$process_method()['$[]'](doc, self.reader))) ? ($ret_or_1) : (self.reader)));}, {$$s: self}); + } $$('Parser').$parse(self.reader, doc, $hash2(["header_only"], {"header_only": self.options['$[]']("parse_header_only")})); + self.$restore_attributes(); + if (($truthy(exts) && ($truthy(exts['$tree_processors?']())))) { + $send(exts.$tree_processors(), 'each', [], function $$6(ext){var result = nil; + + + if (ext == null) ext = nil; + if ((($truthy((result = ext.$process_method()['$[]'](doc))) && ($eqeqeq($$('Document'), result))) && ($neqeq(result, doc)))) { + return (doc = result) + } else { + return nil + }}); + } self.parsed = true; + return doc; + } }, -1); + + $def(self, '$parsed?', $return_ivar("parsed")); + + $def(self, '$counter', function $$counter(name, seed) { + var $a, self = this, curr_val = nil, locked = nil, next_val = nil; + + + if (seed == null) seed = nil; + if ($truthy(self.parent_document)) { + return self.parent_document.$counter(name, seed) + } if ((($truthy((locked = self['$attribute_locked?'](name))) && ($truthy((curr_val = self.counters['$[]'](name))))) || ($not((curr_val = self.attributes['$[]'](name))['$nil_or_empty?']())))) { + next_val = ($a = [name, $$('Helpers').$nextval(curr_val)], $send(self.counters, '[]=', $a), $a[$a.length - 1]); + } else if ($truthy(seed)) { + next_val = ($a = [name, ($eqeq(seed, seed.$to_i().$to_s()) ? (seed.$to_i()) : (seed))], $send(self.counters, '[]=', $a), $a[$a.length - 1]); + } else { + next_val = ($a = [name, 1], $send(self.counters, '[]=', $a), $a[$a.length - 1]); + } if (!$truthy(locked)) { + self.attributes['$[]='](name, next_val); + } return next_val; + }, -2); + + $def(self, '$increment_and_store_counter', function $$increment_and_store_counter(counter_name, block) { + var self = this; + + return $$('AttributeEntry').$new(counter_name, self.$counter(counter_name)).$save_to(block.$attributes()).$value() + }); + $alias(self, "counter_increment", "increment_and_store_counter"); + + $def(self, '$register', function $$register(type, value) { + var self = this, id = nil, $logical_op_recvr_tmp_1 = nil, ref = nil; + + + switch (type) { + case "ids": + return self.$register("refs", [(id = value['$[]'](0)), $$('Inline').$new(self, "anchor", value['$[]'](1), $hash2(["type", "id"], {"type": "ref", "id": id}))]) + case "refs": + + + $logical_op_recvr_tmp_1 = self.catalog['$[]']("refs"); + if ($truthy(($logical_op_recvr_tmp_1['$[]'](value['$[]'](0))))) ; else { + $logical_op_recvr_tmp_1['$[]='](value['$[]'](0), (ref = value['$[]'](1))); + } return ref; + case "footnotes": + return self.catalog['$[]'](type)['$<<'](value) + default: + if ($truthy(self.options['$[]']("catalog_assets"))) { + return self.catalog['$[]'](type)['$<<'](($eqeq(type, "images") ? ($$('ImageReference').$new(value, self.attributes['$[]']("imagesdir"))) : (value))) + } else { + return nil + } + } + }); + + $def(self, '$resolve_id', function $$resolve_id(text) { + var self = this, resolved_id = nil, accum = nil; + + if ($truthy(self.reftexts)) { + return self.reftexts['$[]'](text) + } else if ($truthy(self.parsed)) { + return $send((self.reftexts = $hash2([], {})), 'tap', [], function $$7(accum){var self = $$7.$$s == null ? this : $$7.$$s; + if (self.catalog == null) self.catalog = nil; + + + if (accum == null) accum = nil; + return $send(self.catalog['$[]']("refs"), 'each', [], function $$8(id, ref){var $a, $ret_or_1 = nil; + + + if (id == null) id = nil; + if (ref == null) ref = nil; + if ($truthy(($ret_or_1 = accum['$[]'](ref.$xreftext())))) { + return $ret_or_1 + } else { + return ($a = [ref.$xreftext(), id], $send(accum, '[]=', $a), $a[$a.length - 1]) + }});}, {$$s: self})['$[]'](text) + } else { + + resolved_id = nil; + self.reftexts = (accum = $hash2([], {})); + (function(){try { var $t_break = $thrower('break'); return $send(self.catalog['$[]']("refs"), 'each', [], function $$9(id, ref){var $a, xreftext = nil, $ret_or_1 = nil; + + + if (id == null) id = nil; + if (ref == null) ref = nil; + if ($eqeq((xreftext = ref.$xreftext()), text)) { + + resolved_id = id; + $t_break.$throw(); + }; + if ($truthy(($ret_or_1 = accum['$[]'](xreftext)))) { + return $ret_or_1 + } else { + return ($a = [xreftext, id], $send(accum, '[]=', $a), $a[$a.length - 1]) + };})} catch($e) { + if ($e === $t_break) return $e.$v; + throw $e; + }})(); + self.reftexts = nil; + return resolved_id; + } + }); + + $def(self, '$sections?', function $Document_sections$ques$10() { + var self = this; + + return $rb_gt(self.next_section_index, 0) + }); + + $def(self, '$footnotes?', function $Document_footnotes$ques$11() { + var self = this; + + if ($truthy(self.catalog['$[]']("footnotes")['$empty?']())) { + return false + } else { + return true + } + }); + + $def(self, '$footnotes', function $$footnotes() { + var self = this; + + return self.catalog['$[]']("footnotes") + }); + + $def(self, '$callouts', function $$callouts() { + var self = this; + + return self.catalog['$[]']("callouts") + }); + + $def(self, '$nested?', function $Document_nested$ques$12() { + var self = this; + + if ($truthy(self.parent_document)) { + return true + } else { + return false + } + }); + + $def(self, '$embedded?', function $Document_embedded$ques$13() { + var self = this; + + return self.attributes['$key?']("embedded") + }); + + $def(self, '$extensions?', function $Document_extensions$ques$14() { + var self = this; + + if ($truthy(self.extensions)) { + return true + } else { + return false + } + }); + + $def(self, '$source', function $$source() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source() + } else { + return nil + } + }); + + $def(self, '$source_lines', function $$source_lines() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source_lines() + } else { + return nil + } + }); + + $def(self, '$basebackend?', function $Document_basebackend$ques$15(base) { + var self = this; + + return self.attributes['$[]']("basebackend")['$=='](base) + }); + + $def(self, '$title', function $$title() { + var self = this; + + return self.$doctitle() + }); + + $def(self, '$title=', function $Document_title$eq$16(title) { + var $a, self = this, sect = nil; + + + if (!$truthy((sect = self.header))) { + (sect = (self.header = $$('Section').$new(self, 0)))['$sectname=']("header"); + } return ($a = [title], $send(sect, 'title=', $a), $a[$a.length - 1]); + }); + + $def(self, '$doctitle', function $$doctitle(opts) { + var self = this, val = nil, sect = nil, $ret_or_1 = nil, separator = nil; + + + if (opts == null) opts = $hash2([], {}); + if (!$truthy((val = self.attributes['$[]']("title")))) { + if ($truthy((sect = self.$first_section()))) { + val = sect.$title(); + } else if ($not(($truthy(($ret_or_1 = opts['$[]']("use_fallback"))) ? ((val = self.attributes['$[]']("untitled-label"))) : ($ret_or_1)))) { + return nil + } + } if ($truthy((separator = opts['$[]']("partition")))) { + return $$('Title').$new(val, opts.$merge($hash2(["separator"], {"separator": ($eqeq(separator, true) ? (self.attributes['$[]']("title-separator")) : (separator))}))) + } else if (($truthy(opts['$[]']("sanitize")) && ($truthy(val['$include?']("<"))))) { + return val.$gsub($$('XmlSanitizeRx'), "").$squeeze(" ").$strip() + } else { + return val + } }, -1); + $alias(self, "name", "doctitle"); + + $def(self, '$xreftext', function $$xreftext(xrefstyle) { + var self = this, val = nil; + if (($truthy((val = self.$reftext())) && ($not(val['$empty?']())))) { + return val + } else { + return self.$title() + } }, -1); + + $def(self, '$author', function $$author() { + var self = this; + + return self.attributes['$[]']("author") + }); + + $def(self, '$authors', function $$authors() { + var self = this, attrs = nil, authors = nil, num_authors = nil, $ret_or_1 = nil, idx = nil; + + if ($truthy((attrs = self.attributes)['$key?']("author"))) { + + authors = [$$('Author').$new(attrs['$[]']("author"), attrs['$[]']("firstname"), attrs['$[]']("middlename"), attrs['$[]']("lastname"), attrs['$[]']("authorinitials"), attrs['$[]']("email"))]; + if ($truthy($rb_gt((num_authors = ($truthy(($ret_or_1 = attrs['$[]']("authorcount"))) ? ($ret_or_1) : (0))), 1))) { + + idx = 1; + while ($truthy($rb_lt(idx, num_authors))) { + + idx = $rb_plus(idx, 1); + authors['$<<']($$('Author').$new(attrs['$[]']("author_" + (idx)), attrs['$[]']("firstname_" + (idx)), attrs['$[]']("middlename_" + (idx)), attrs['$[]']("lastname_" + (idx)), attrs['$[]']("authorinitials_" + (idx)), attrs['$[]']("email_" + (idx)))); + } } return authors; + } else { + return [] + } + }); + + $def(self, '$revdate', function $$revdate() { + var self = this; + + return self.attributes['$[]']("revdate") + }); + + $def(self, '$notitle', function $$notitle() { + var self = this; + + return self.attributes['$key?']("notitle") + }); + + $def(self, '$noheader', function $$noheader() { + var self = this; + + return self.attributes['$key?']("noheader") + }); + + $def(self, '$nofooter', function $$nofooter() { + var self = this; + + return self.attributes['$key?']("nofooter") + }); + + $def(self, '$first_section', function $$first_section() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.header))) { + return $ret_or_1 + } else { + return $send(self.blocks, 'find', [], function $$17(e){ + + if (e == null) e = nil; + return e.$context()['$==']("section");}) + } + }); + + $def(self, '$header?', function $Document_header$ques$18() { + var self = this; + + if ($truthy(self.header)) { + return true + } else { + return false + } + }); + $alias(self, "has_header?", "header?"); + + $def(self, '$<<', function $Document_$lt$lt$19(block) { + var $yield = $Document_$lt$lt$19.$$p || nil, self = this; + + $Document_$lt$lt$19.$$p = null; + + if ($eqeq(block.$context(), "section")) { + self.$assign_numeral(block); + } return $send2(self, $find_super(self, '<<', $Document_$lt$lt$19, false, true), '<<', [block], $yield); + }); + + $def(self, '$finalize_header', function $$finalize_header(unrooted_attributes, header_valid) { + var self = this; + + + if (header_valid == null) header_valid = true; + self.$clear_playback_attributes(unrooted_attributes); + self.$save_attributes(); + if (!$truthy(header_valid)) { + unrooted_attributes['$[]=']("invalid-header", true); + } return unrooted_attributes; + }, -2); + + $def(self, '$playback_attributes', function $$playback_attributes(block_attributes) { + var self = this; + + if ($truthy(block_attributes['$key?']("attribute_entries"))) { + return $send(block_attributes['$[]']("attribute_entries"), 'each', [], function $$20(entry){var self = $$20.$$s == null ? this : $$20.$$s, name = nil; + if (self.attributes == null) self.attributes = nil; + + + if (entry == null) entry = nil; + name = entry.$name(); + if ($truthy(entry.$negate())) { + + self.attributes.$delete(name); + if ($eqeq(name, "compat-mode")) { + return (self.compat_mode = false) + } else { + return nil + } } else { + + self.attributes['$[]='](name, entry.$value()); + if ($eqeq(name, "compat-mode")) { + return (self.compat_mode = true) + } else { + return nil + } }}, {$$s: self}) + } else { + return nil + } + }); + + $def(self, '$restore_attributes', function $$restore_attributes() { + var self = this; + + + if (!$truthy(self.parent_document)) { + self.catalog['$[]']("callouts").$rewind(); + } return self.attributes.$replace(self.header_attributes); + }); + + $def(self, '$set_attribute', function $$set_attribute(name, value) { + var self = this, $ret_or_2 = nil; + + + if (value == null) value = ""; + if ($truthy(self['$attribute_locked?'](name))) { + return nil + } else { + + if (!$truthy(value['$empty?']())) { + value = self.$apply_attribute_value_subs(value); + } if ($truthy(self.header_attributes)) { + self.attributes['$[]='](name, value); + } else { + + + switch (name) { + case "backend": + self.$update_backend_attributes(value, ($truthy(($ret_or_2 = self.attributes_modified['$delete?']("htmlsyntax"))) ? (value['$=='](self.backend)) : ($ret_or_2))); + break; + case "doctype": + self.$update_doctype_attributes(value); + break; + default: + self.attributes['$[]='](name, value); + } self.attributes_modified['$<<'](name); + } return value; + } }, -2); + + $def(self, '$delete_attribute', function $$delete_attribute(name) { + var self = this; + + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + self.attributes.$delete(name); + self.attributes_modified['$<<'](name); + return true; + } + }); + + $def(self, '$attribute_locked?', function $Document_attribute_locked$ques$21(name) { + var self = this; + + return self.attribute_overrides['$key?'](name) + }); + + $def(self, '$set_header_attribute', function $$set_header_attribute(name, value, overwrite) { + var self = this, attrs = nil, $ret_or_1 = nil; + + + if (value == null) value = ""; + if (overwrite == null) overwrite = true; + attrs = ($truthy(($ret_or_1 = self.header_attributes)) ? ($ret_or_1) : (self.attributes)); + if (($eqeq(overwrite, false) && ($truthy(attrs['$key?'](name))))) { + return false + } else { + + attrs['$[]='](name, value); + return true; + } }, -2); + + $def(self, '$convert', function $$convert(opts) { + var $a, self = this, block = nil, $ret_or_1 = nil, output = nil, transform = nil, exts = nil; + + + if (opts == null) opts = $hash2([], {}); + if ($truthy(self.timings)) { + self.timings.$start("convert"); + } if (!$truthy(self.parsed)) { + self.$parse(); + } if (!($truthy($rb_ge(self.safe, $$$($$('SafeMode'), 'SERVER'))) || ($truthy(opts['$empty?']())))) { + + if (!$truthy(($a = ["outfile", opts['$[]']("outfile")], $send(self.attributes, '[]=', $a), $a[$a.length - 1]))) { + self.attributes.$delete("outfile"); + } if (!$truthy(($a = ["outdir", opts['$[]']("outdir")], $send(self.attributes, '[]=', $a), $a[$a.length - 1]))) { + self.attributes.$delete("outdir"); + } } if ($eqeq(self.$doctype(), "inline")) { + if ($truthy((block = ($truthy(($ret_or_1 = self.blocks['$[]'](0))) ? ($ret_or_1) : (self.header))))) { + if (($eqeq(block.$content_model(), "compound") || ($eqeq(block.$content_model(), "empty")))) { + self.$logger().$warn("no inline candidate; use the inline doctype to convert a single paragragh, verbatim, or raw block"); + } else { + output = block.$content(); + } + } + } else { + + if ($truthy(opts['$key?']("standalone"))) { + transform = ($truthy(opts['$[]']("standalone")) ? ("document") : ("embedded")); + } else if ($truthy(opts['$key?']("header_footer"))) { + transform = ($truthy(opts['$[]']("header_footer")) ? ("document") : ("embedded")); + } else { + transform = ($truthy(self.options['$[]']("standalone")) ? ("document") : ("embedded")); + } output = self.converter.$convert(self, transform); + } if (!$truthy(self.parent_document)) { + if (($truthy((exts = self.extensions)) && ($truthy(exts['$postprocessors?']())))) { + $send(exts.$postprocessors(), 'each', [], function $$22(ext){var self = $$22.$$s == null ? this : $$22.$$s; + + + if (ext == null) ext = nil; + return (output = ext.$process_method()['$[]'](self, output));}, {$$s: self}); + } + } if ($truthy(self.timings)) { + self.timings.$record("convert"); + } return output; + }, -1); + $alias(self, "render", "convert"); + + $def(self, '$write', function $$write(output, target) { + var self = this; + + + if ($truthy(self.timings)) { + self.timings.$start("write"); + } if ($eqeqeq($$('Writer'), self.converter)) { + self.converter.$write(output, target); + } else { + + if ($truthy(target['$respond_to?']("write"))) { + if (!$truthy(output['$nil_or_empty?']())) { + + target.$write(output.$chomp()); + target.$write($$('LF')); + } + } else { + $$$('File').$write(target, output, $hash2(["mode"], {"mode": $$('FILE_WRITE_MODE')})); + } if ((($eqeq(self.backend, "manpage") && ($eqeqeq($$$('String'), target))) && ($truthy(self.converter.$class()['$respond_to?']("write_alternate_pages"))))) { + self.converter.$class().$write_alternate_pages(self.attributes['$[]']("mannames"), self.attributes['$[]']("manvolnum"), target); + } } if ($truthy(self.timings)) { + self.timings.$record("write"); + } return nil; + }); + + $def(self, '$content', function $$content() { + var $yield = $$content.$$p || nil, self = this; + + $$content.$$p = null; + + self.attributes.$delete("title"); + return $send2(self, $find_super(self, 'content', $$content, false, true), 'content', [], $yield); + }); + + $def(self, '$docinfo', function $$docinfo(location, suffix) { + var $a, self = this, qualifier = nil, $ret_or_1 = nil, docinfo = nil, content = nil, docinfo_file = nil, docinfo_dir = nil, docinfo_subs = nil, docinfo_path = nil, shared_docinfo = nil, private_docinfo = nil; + + + if (location == null) location = "head"; + if (suffix == null) suffix = nil; + if ($truthy($rb_lt(self.$safe(), $$$($$('SafeMode'), 'SECURE')))) { + + if (!$eqeq(location, "head")) { + qualifier = "-" + (location); + } suffix = ($truthy(($ret_or_1 = suffix)) ? ($ret_or_1) : (self.outfilesuffix)); + if ($truthy((docinfo = self.attributes['$[]']("docinfo"))['$nil_or_empty?']())) { + if ($truthy(self.attributes['$key?']("docinfo2"))) { + docinfo = ["private", "shared"]; + } else if ($truthy(self.attributes['$key?']("docinfo1"))) { + docinfo = ["shared"]; + } else { + docinfo = ($truthy(docinfo) ? (["private"]) : (nil)); + } + } else { + docinfo = $send(docinfo.$split(","), 'map', [], function $$23(it){ + + if (it == null) it = nil; + return it.$strip();}); + } if ($truthy(docinfo)) { + + content = []; + $a = ["docinfo" + (qualifier) + (suffix), self.attributes['$[]']("docinfodir"), self.$resolve_docinfo_subs()], (docinfo_file = $a[0]), (docinfo_dir = $a[1]), (docinfo_subs = $a[2]); + if (!$truthy(docinfo['$&'](["shared", "shared-" + (location)])['$empty?']())) { + + docinfo_path = self.$normalize_system_path(docinfo_file, docinfo_dir); + if ($truthy((shared_docinfo = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(shared_docinfo, docinfo_subs)); + } } if (!($truthy(self.attributes['$[]']("docname")['$nil_or_empty?']()) || ($truthy(docinfo['$&'](["private", "private-" + (location)])['$empty?']())))) { + + docinfo_path = self.$normalize_system_path("" + (self.attributes['$[]']("docname")) + "-" + (docinfo_file), docinfo_dir); + if ($truthy((private_docinfo = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(private_docinfo, docinfo_subs)); + } } } } if (($truthy(self.extensions) && ($truthy(self['$docinfo_processors?'](location))))) { + return ($truthy(($ret_or_1 = content)) ? ($ret_or_1) : ([])).$concat($send(self.docinfo_processor_extensions['$[]'](location), 'map', [], function $$24(ext){var self = $$24.$$s == null ? this : $$24.$$s; + + + if (ext == null) ext = nil; + return ext.$process_method()['$[]'](self);}, {$$s: self}).$compact()).$join($$('LF')) + } else if ($truthy(content)) { + return content.$join($$('LF')) + } else { + return "" + } }, -1); + + $def(self, '$docinfo_processors?', function $Document_docinfo_processors$ques$25(location) { + var $a, self = this; + + + if (location == null) location = "head"; + if ($truthy(self.docinfo_processor_extensions['$key?'](location))) { + return self.docinfo_processor_extensions['$[]'](location)['$!='](false) + } else if (($truthy(self.extensions) && ($truthy(self.document.$extensions()['$docinfo_processors?'](location))))) { + return ($a = [location, self.document.$extensions().$docinfo_processors(location)], $send(self.docinfo_processor_extensions, '[]=', $a), $a[$a.length - 1])['$!']()['$!']() + } else { + return ($a = [location, false], $send(self.docinfo_processor_extensions, '[]=', $a), $a[$a.length - 1]) + } }, -1); + + $def(self, '$to_s', function $$to_s() { + var self = this, $ret_or_1 = nil; + + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {doctype: " + (self.$doctype().$inspect()) + ", doctitle: " + (($truthy(($ret_or_1 = self.header)) ? (self.header.$title()) : ($ret_or_1)).$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>" + }); + self.$private(); + + $def(self, '$apply_attribute_value_subs', function $$apply_attribute_value_subs(value) { + var $a, self = this; + + + if ($truthy($$('AttributeEntryPassMacroRx')['$=~'](value))) { + + value = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)); + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + value = self.$apply_subs(value, self.$resolve_pass_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))); + } } else { + value = self.$apply_header_subs(value); + } if ($truthy(self.max_attribute_value_size)) { + + return self.$limit_bytesize(value, self.max_attribute_value_size); + } else { + return value + } }); + + $def(self, '$limit_bytesize', function $$limit_bytesize(str, max) { + + + if ($truthy($rb_gt(str.$bytesize(), max))) { + while (!($truthy((str = str.$byteslice(0, max))['$valid_encoding?']()))) { + max = $rb_minus(max, 1); + } + } return str; + }); + + $def(self, '$resolve_docinfo_subs', function $$resolve_docinfo_subs() { + var self = this; + + if ($truthy(self.attributes['$key?']("docinfosubs"))) { + + return self.$resolve_subs(self.attributes['$[]']("docinfosubs"), "block", nil, "docinfo"); + } else { + return ["attributes"] + } + }); + + $def(self, '$create_converter', function $$create_converter(backend, delegate_backend) { + var self = this, converter_opts = nil, template_dirs = nil, $ret_or_1 = nil, opts = nil, converter = nil; + + + converter_opts = $hash2(["document", "htmlsyntax"], {"document": self, "htmlsyntax": self.attributes['$[]']("htmlsyntax")}); + if ($truthy((template_dirs = ($truthy(($ret_or_1 = (opts = self.options)['$[]']("template_dirs"))) ? ($ret_or_1) : (opts['$[]']("template_dir")))))) { + + converter_opts['$[]=']("template_dirs", [].concat($to_a(template_dirs))); + converter_opts['$[]=']("template_cache", opts.$fetch("template_cache", true)); + converter_opts['$[]=']("template_engine", opts['$[]']("template_engine")); + converter_opts['$[]=']("template_engine_options", opts['$[]']("template_engine_options")); + converter_opts['$[]=']("eruby", opts['$[]']("eruby")); + converter_opts['$[]=']("safe", self.safe); + if ($truthy(delegate_backend)) { + converter_opts['$[]=']("delegate_backend", delegate_backend); + } } if ($truthy((converter = opts['$[]']("converter")))) { + return $$$($$('Converter'), 'CustomFactory').$new($hash(backend, converter)).$create(backend, converter_opts) + } else { + return opts.$fetch("converter_factory", $$('Converter')).$create(backend, converter_opts) + } }); + + $def(self, '$clear_playback_attributes', function $$clear_playback_attributes(attributes) { + + return attributes.$delete("attribute_entries") + }); + + $def(self, '$save_attributes', function $$save_attributes() { + var self = this, doctitle_val = nil, attrs = nil, $ret_or_1 = nil, toc_val = nil, toc_position_val = nil, toc_placement_val = nil, default_toc_position = nil, default_toc_class = nil, position = nil, icons_val = nil, basebackend = nil, syntax_hl_name = nil, syntax_hl_factory = nil, syntax_hls = nil; + + + if (!($truthy((attrs = self.attributes)['$key?']("doctitle")) || ($not((doctitle_val = self.$doctitle()))))) { + attrs['$[]=']("doctitle", doctitle_val); + } self.id = ($truthy(($ret_or_1 = self.id)) ? ($ret_or_1) : (attrs['$[]']("css-signature"))); + if ($truthy((toc_val = ($truthy(attrs.$delete("toc2")) ? ("left") : (attrs['$[]']("toc")))))) { + + toc_position_val = (($truthy((toc_placement_val = attrs.$fetch("toc-placement", "macro"))) && ($neqeq(toc_placement_val, "auto"))) ? (toc_placement_val) : (attrs['$[]']("toc-position"))); + if (!($truthy(toc_val['$empty?']()) && ($truthy(toc_position_val['$nil_or_empty?']())))) { + + default_toc_position = "left"; + default_toc_class = "toc2"; + position = ($truthy(toc_position_val['$nil_or_empty?']()) ? (($truthy(toc_val['$empty?']()) ? (default_toc_position) : (toc_val))) : (toc_position_val)); + attrs['$[]=']("toc", ""); + attrs['$[]=']("toc-placement", "auto"); + + switch (position) { + case "left": + case "<": + case "<": + attrs['$[]=']("toc-position", "left"); + break; + case "right": + case ">": + case ">": + attrs['$[]=']("toc-position", "right"); + break; + case "top": + case "^": + attrs['$[]=']("toc-position", "top"); + break; + case "bottom": + case "v": + attrs['$[]=']("toc-position", "bottom"); + break; + case "preamble": + case "macro": + + attrs['$[]=']("toc-position", "content"); + attrs['$[]=']("toc-placement", position); + default_toc_class = nil; + break; + default: + + attrs.$delete("toc-position"); + default_toc_class = nil; + } if ($truthy(default_toc_class)) { + if ($truthy(($ret_or_1 = attrs['$[]']("toc-class")))) ; else { + attrs['$[]=']("toc-class", default_toc_class); + } + } } } if (($truthy((icons_val = attrs['$[]']("icons"))) && ($not(attrs['$key?']("icontype"))))) { + + switch (icons_val) { + case "": + case "font": + + break; + default: + + attrs['$[]=']("icons", ""); + if (!$eqeq(icons_val, "image")) { + attrs['$[]=']("icontype", icons_val); + } } + } if (($truthy((self.compat_mode = attrs['$key?']("compat-mode"))) && ($truthy(attrs['$key?']("language"))))) { + attrs['$[]=']("source-language", attrs['$[]']("language")); + } if (!$truthy(self.parent_document)) { + + if ($eqeq((basebackend = attrs['$[]']("basebackend")), "html")) { + if (($truthy((syntax_hl_name = attrs['$[]']("source-highlighter"))) && ($not(attrs['$[]']("" + (syntax_hl_name) + "-unavailable"))))) { + if ($truthy((syntax_hl_factory = self.options['$[]']("syntax_highlighter_factory")))) { + self.syntax_highlighter = syntax_hl_factory.$create(syntax_hl_name, self.backend, $hash2(["document"], {"document": self})); + } else if ($truthy((syntax_hls = self.options['$[]']("syntax_highlighters")))) { + self.syntax_highlighter = $$$($$('SyntaxHighlighter'), 'DefaultFactoryProxy').$new(syntax_hls).$create(syntax_hl_name, self.backend, $hash2(["document"], {"document": self})); + } else { + self.syntax_highlighter = $$('SyntaxHighlighter').$create(syntax_hl_name, self.backend, $hash2(["document"], {"document": self})); + } + } + } else if ($eqeq(basebackend, "docbook")) { + + if (!($truthy(self['$attribute_locked?']("toc")) || ($truthy(self.attributes_modified['$include?']("toc"))))) { + attrs['$[]=']("toc", ""); + } if (!($truthy(self['$attribute_locked?']("sectnums")) || ($truthy(self.attributes_modified['$include?']("sectnums"))))) { + attrs['$[]=']("sectnums", ""); + } } self.outfilesuffix = attrs['$[]']("outfilesuffix"); + $send($$('FLEXIBLE_ATTRIBUTES'), 'each', [], function $$26(name){var self = $$26.$$s == null ? this : $$26.$$s; + if (self.attribute_overrides == null) self.attribute_overrides = nil; + + + if (name == null) name = nil; + if (($truthy(self.attribute_overrides['$key?'](name)) && ($truthy(self.attribute_overrides['$[]'](name))))) { + return self.attribute_overrides.$delete(name) + } else { + return nil + }}, {$$s: self}); + } return (self.header_attributes = attrs.$merge()); + }); + + $def(self, '$fill_datetime_attributes', function $$fill_datetime_attributes(attrs, input_mtime) { + var $a, self = this, now = nil, source_date_epoch = nil, localdate = nil, $ret_or_1 = nil, localtime = nil, $ret_or_2 = nil, docdate = nil, doctime = nil; + + + now = ($truthy($$$('ENV')['$key?']("SOURCE_DATE_EPOCH")) ? ((source_date_epoch = $$$('Time').$at(self.$Integer($$$('ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc())) : ($$$('Time').$now())); + if ($truthy((localdate = attrs['$[]']("localdate")))) { + if ($truthy(($ret_or_1 = attrs['$[]']("localyear")))) ; else { + attrs['$[]=']("localyear", ($eqeq(localdate.$index("-"), 4) ? (localdate.$slice(0, 4)) : (nil))); + } + } else { + + localdate = ($a = ["localdate", now.$strftime("%F")], $send(attrs, '[]=', $a), $a[$a.length - 1]); + if ($truthy(($ret_or_1 = attrs['$[]']("localyear")))) ; else { + attrs['$[]=']("localyear", now.$year().$to_s()); + } } localtime = ($truthy(($ret_or_1 = attrs['$[]']("localtime"))) ? ($ret_or_1) : (($a = ["localtime", now.$strftime("%T " + (($eqeq(now.$utc_offset(), 0) ? ("UTC") : ("%z"))))], $send(attrs, '[]=', $a), $a[$a.length - 1]))); + if ($truthy(($ret_or_1 = attrs['$[]']("localdatetime")))) ; else { + attrs['$[]=']("localdatetime", "" + (localdate) + " " + (localtime)); + } input_mtime = ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = source_date_epoch)) ? ($ret_or_2) : (input_mtime)))) ? ($ret_or_1) : (now)); + if ($truthy((docdate = attrs['$[]']("docdate")))) { + if ($truthy(($ret_or_1 = attrs['$[]']("docyear")))) ; else { + attrs['$[]=']("docyear", ($eqeq(docdate.$index("-"), 4) ? (docdate.$slice(0, 4)) : (nil))); + } + } else { + + docdate = ($a = ["docdate", input_mtime.$strftime("%F")], $send(attrs, '[]=', $a), $a[$a.length - 1]); + if ($truthy(($ret_or_1 = attrs['$[]']("docyear")))) ; else { + attrs['$[]=']("docyear", input_mtime.$year().$to_s()); + } } doctime = ($truthy(($ret_or_1 = attrs['$[]']("doctime"))) ? ($ret_or_1) : (($a = ["doctime", input_mtime.$strftime("%T " + (($eqeq(input_mtime.$utc_offset(), 0) ? ("UTC") : ("%z"))))], $send(attrs, '[]=', $a), $a[$a.length - 1]))); + if ($truthy(($ret_or_1 = attrs['$[]']("docdatetime")))) ; else { + attrs['$[]=']("docdatetime", "" + (docdate) + " " + (doctime)); + } return nil; + }); + + $def(self, '$update_backend_attributes', function $$update_backend_attributes(new_backend, init) { + var $a, $b, self = this, current_backend = nil, current_basebackend = nil, attrs = nil, current_doctype = nil, actual_backend = nil, $ret_or_1 = nil, delegate_backend = nil, converter = nil, new_basebackend = nil, new_filetype = nil, htmlsyntax = nil, backend_traits = nil, current_filetype = nil, page_width = nil; + + + if (init == null) init = nil; + if (($truthy(init) || ($neqeq(new_backend, self.backend)))) { + + current_backend = self.backend; + current_basebackend = (attrs = self.attributes)['$[]']("basebackend"); + current_doctype = self.doctype; + if ($truthy(new_backend['$include?'](":"))) { + $b = new_backend.$partition(":"), $a = $to_ary($b), (actual_backend = ($a[0] == null ? nil : $a[0])), (($a[1] == null ? nil : $a[1])), (new_backend = ($a[2] == null ? nil : $a[2])); + } if ($truthy(new_backend['$start_with?']("xhtml"))) { + + attrs['$[]=']("htmlsyntax", "xml"); + new_backend = new_backend.$slice(1, new_backend.$length()); + } else if ($truthy(new_backend['$start_with?']("html"))) { + if ($truthy(($ret_or_1 = attrs['$[]']("htmlsyntax")))) ; else { + attrs['$[]=']("htmlsyntax", "html"); + } + } new_backend = ($truthy(($ret_or_1 = $$('BACKEND_ALIASES')['$[]'](new_backend))) ? ($ret_or_1) : (new_backend)); + if ($truthy(actual_backend)) { + $a = [actual_backend, new_backend], (new_backend = $a[0]), (delegate_backend = $a[1]); + } if ($truthy(current_doctype)) { + + if ($truthy(current_backend)) { + + attrs.$delete("backend-" + (current_backend)); + attrs.$delete("backend-" + (current_backend) + "-doctype-" + (current_doctype)); + } attrs['$[]=']("backend-" + (new_backend) + "-doctype-" + (current_doctype), ""); + attrs['$[]=']("doctype-" + (current_doctype), ""); + } else if ($truthy(current_backend)) { + attrs.$delete("backend-" + (current_backend)); + } attrs['$[]=']("backend-" + (new_backend), ""); + self.backend = ($a = ["backend", new_backend], $send(attrs, '[]=', $a), $a[$a.length - 1]); + if ($eqeqeq($$$($$('Converter'), 'BackendTraits'), (converter = self.$create_converter(new_backend, delegate_backend)))) { + + new_basebackend = converter.$basebackend(); + new_filetype = converter.$filetype(); + if ($truthy((htmlsyntax = converter.$htmlsyntax()))) { + attrs['$[]=']("htmlsyntax", htmlsyntax); + } if ($truthy(init)) { + if ($truthy(($ret_or_1 = attrs['$[]']("outfilesuffix")))) ; else { + attrs['$[]=']("outfilesuffix", converter.$outfilesuffix()); + } + } else if (!$truthy(self['$attribute_locked?']("outfilesuffix"))) { + attrs['$[]=']("outfilesuffix", converter.$outfilesuffix()); + } } else if ($truthy(converter)) { + + backend_traits = $$('Converter').$derive_backend_traits(new_backend); + new_basebackend = backend_traits['$[]']("basebackend"); + new_filetype = backend_traits['$[]']("filetype"); + if ($truthy(init)) { + if ($truthy(($ret_or_1 = attrs['$[]']("outfilesuffix")))) ; else { + attrs['$[]=']("outfilesuffix", backend_traits['$[]']("outfilesuffix")); + } + } else if (!$truthy(self['$attribute_locked?']("outfilesuffix"))) { + attrs['$[]=']("outfilesuffix", backend_traits['$[]']("outfilesuffix")); + } } else { + self.$raise($$$('NotImplementedError'), "asciidoctor: FAILED: missing converter for backend '" + (new_backend) + "'. Processing aborted."); + } self.converter = converter; + if ($truthy((current_filetype = attrs['$[]']("filetype")))) { + attrs.$delete("filetype-" + (current_filetype)); + } attrs['$[]=']("filetype", new_filetype); + attrs['$[]=']("filetype-" + (new_filetype), ""); + if ($truthy((page_width = $$('DEFAULT_PAGE_WIDTHS')['$[]'](new_basebackend)))) { + attrs['$[]=']("pagewidth", page_width); + } else { + attrs.$delete("pagewidth"); + } if ($neqeq(new_basebackend, current_basebackend)) { + + if ($truthy(current_doctype)) { + + if ($truthy(current_basebackend)) { + + attrs.$delete("basebackend-" + (current_basebackend)); + attrs.$delete("basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype)); + } attrs['$[]=']("basebackend-" + (new_basebackend) + "-doctype-" + (current_doctype), ""); + } else if ($truthy(current_basebackend)) { + attrs.$delete("basebackend-" + (current_basebackend)); + } attrs['$[]=']("basebackend-" + (new_basebackend), ""); + attrs['$[]=']("basebackend", new_basebackend); + } return new_backend; + } else { + return nil + } }, -2); + return $def(self, '$update_doctype_attributes', function $$update_doctype_attributes(new_doctype) { + var $a, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil; + + if (($truthy(new_doctype) && ($neqeq(new_doctype, self.doctype)))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]); + if ($truthy(current_doctype)) { + + attrs.$delete("doctype-" + (current_doctype)); + if ($truthy(current_backend)) { + + attrs.$delete("backend-" + (current_backend) + "-doctype-" + (current_doctype)); + attrs['$[]=']("backend-" + (current_backend) + "-doctype-" + (new_doctype), ""); + } if ($truthy(current_basebackend)) { + + attrs.$delete("basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype)); + attrs['$[]=']("basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""); + } } else { + + if ($truthy(current_backend)) { + attrs['$[]=']("backend-" + (current_backend) + "-doctype-" + (new_doctype), ""); + } if ($truthy(current_basebackend)) { + attrs['$[]=']("basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""); + } } attrs['$[]=']("doctype-" + (new_doctype), ""); + return (self.doctype = ($a = ["doctype", new_doctype], $send(attrs, '[]=', $a), $a[$a.length - 1])); + } else { + return nil + } + }); + })($nesting[0], $$('AbstractBlock'), $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/inline"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send2 = Opal.send2, $find_super = Opal.find_super, $def = Opal.def, $return_val = Opal.return_val, $alias = Opal.alias, $truthy = Opal.truthy, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('attr_accessor,attr_reader,[],convert,converter,attr,==,apply_reftext_subs,reftext'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super) { + var self = $klass($base, $super, 'Inline'); + + var $proto = self.$$prototype; + + $proto.text = $proto.type = nil; + + self.$attr_accessor("text"); + self.$attr_reader("type"); + self.$attr_accessor("target"); + + $def(self, '$initialize', function $$initialize(parent, context, text, opts) { + var self = this; + + $$initialize.$$p = null; + + if (text == null) text = nil; + if (opts == null) opts = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [parent, context, opts], null); + self.node_name = "inline_" + (context); + self.text = text; + self.id = opts['$[]']("id"); + self.type = opts['$[]']("type"); + return (self.target = opts['$[]']("target")); + }, -3); + + $def(self, '$block?', $return_val(false)); + + $def(self, '$inline?', $return_val(true)); + + $def(self, '$convert', function $$convert() { + var self = this; + + return self.$converter().$convert(self) + }); + $alias(self, "render", "convert"); + + $def(self, '$alt', function $$alt() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.$attr("alt")))) { + return $ret_or_1 + } else { + return "" + } + }); + + $def(self, '$reftext?', function $Inline_reftext$ques$1() { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + if ($truthy(($ret_or_1 = self.text))) { + + if ($truthy(($ret_or_2 = self.type['$==']("ref")))) { + return $ret_or_2 + } else { + return self.type['$==']("bibref") + } } else { + return $ret_or_1 + } + }); + + $def(self, '$reftext', function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.text))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }); + return $def(self, '$xreftext', function $$xreftext(xrefstyle) { + var self = this; + return self.$reftext(); + }, -1); + })($nesting[0], $$('AbstractNode')) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/list"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $alias = Opal.alias, $hash2 = Opal.hash2, $send2 = Opal.send2, $find_super = Opal.find_super, $def = Opal.def, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('blocks,blocks?,==,next_list,callouts,convert,class,object_id,inspect,size,items,parent,attr_accessor,level,drop,nil_or_empty?,apply_subs,attr_writer,empty?,===,[],outline?,!,simple?,source,shift,context'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + (function($base, $super) { + var self = $klass($base, $super, 'List'); + + var $proto = self.$$prototype; + + $proto.context = $proto.document = $proto.style = nil; + + $alias(self, "items", "blocks"); + $alias(self, "content", "blocks"); + $alias(self, "items?", "blocks?"); + + $def(self, '$initialize', function $$initialize(parent, context, opts) { + var $yield = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + + if (opts == null) opts = $hash2([], {}); + return $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [parent, context, opts], $yield); + }, -3); + + $def(self, '$outline?', function $List_outline$ques$1() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.context['$==']("ulist")))) { + return $ret_or_1 + } else { + return self.context['$==']("olist") + } + }); + + $def(self, '$convert', function $$convert() { + var $yield = $$convert.$$p || nil, self = this, result = nil; + + $$convert.$$p = null; + if ($eqeq(self.context, "colist")) { + + result = $send2(self, $find_super(self, 'convert', $$convert, false, true), 'convert', [], $yield); + self.document.$callouts().$next_list(); + return result; + } else { + return $send2(self, $find_super(self, 'convert', $$convert, false, true), 'convert', [], $yield) + } + }); + $alias(self, "render", "convert"); + return $def(self, '$to_s', function $$to_s() { + var self = this; + + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", style: " + (self.style.$inspect()) + ", items: " + (self.$items().$size()) + "}>" + }); + })($nesting[0], $$('AbstractBlock')); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'ListItem'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.text = $proto.subs = $proto.blocks = nil; + + $alias(self, "list", "parent"); + self.$attr_accessor("marker"); + + $def(self, '$initialize', function $$initialize(parent, text) { + $$initialize.$$p || nil; var self = this; + + $$initialize.$$p = null; + + if (text == null) text = nil; + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [parent, "list_item"], null); + self.text = text; + self.level = parent.$level(); + return (self.subs = $$('NORMAL_SUBS').$drop(0)); + }, -2); + + $def(self, '$text?', function $ListItem_text$ques$2() { + var self = this; + + if ($truthy(self.text['$nil_or_empty?']())) { + return false + } else { + return true + } + }); + + $def(self, '$text', function $$text() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.text))) { + + return self.$apply_subs(self.text, self.subs); + } else { + return $ret_or_1 + } + }); + self.$attr_writer("text"); + + $def(self, '$simple?', function $ListItem_simple$ques$3() { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil, $ret_or_3 = nil, blk = nil; + + if ($truthy(($ret_or_1 = self.blocks['$empty?']()))) { + return $ret_or_1 + } else { + + if ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = self.blocks.$size()['$=='](1))) ? ($$('List')['$===']((blk = self.blocks['$[]'](0)))) : ($ret_or_3))))) { + return blk['$outline?']() + } else { + return $ret_or_2 + } } + }); + + $def(self, '$compound?', function $ListItem_compound$ques$4() { + var self = this; + + return self['$simple?']()['$!']() + }); + + $def(self, '$fold_first', function $$fold_first() { + var self = this; + + + self.text = ($truthy(self.text['$nil_or_empty?']()) ? (self.blocks.$shift().$source()) : ("" + (self.text) + ($$('LF')) + (self.blocks.$shift().$source()))); + return nil; + }); + return $def(self, '$to_s', function $$to_s() { + var self = this, $ret_or_1 = nil; + + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {list_context: " + (self.$parent().$context().$inspect()) + ", text: " + (self.text.$inspect()) + ", blocks: " + (($truthy(($ret_or_1 = self.blocks)) ? ($ret_or_1) : ([])).$size()) + "}>" + }); + })($nesting[0], $$('AbstractBlock'), $nesting); + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/parser"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $to_ary = Opal.to_ary, $defs = Opal.defs, $eqeq = Opal.eqeq, $not = Opal.not, $gvars = Opal.gvars, $neqeq = Opal.neqeq, $rb_plus = Opal.rb_plus, $rb_lt = Opal.rb_lt, $rb_gt = Opal.rb_gt, $to_a = Opal.to_a, $eqeqeq = Opal.eqeqeq, $rb_minus = Opal.rb_minus, $rb_times = Opal.rb_times, $thrower = Opal.thrower, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('include,new,proc,start_with?,match?,is_delimited_block?,private_class_method,parse_document_header,[],has_more_lines?,next_section,assign_numeral,<<,blocks,skip_blank_lines,parse_block_metadata_lines,attributes,is_next_line_doctitle?,[]=,finalize_header,nil_or_empty?,title=,sourcemap,cursor,parse_section_title,id=,include?,sub_specialchars,sub_attributes,source_location=,header,attribute_locked?,id,clear,delete,instance_variable_get,parse_header_metadata,==,!,register,process_authors,update,doctype,parse_manpage_header,=~,downcase,error,logger,message_with_context,cursor_at_line,backend,save,is_next_line_section?,initialize_section,join,map,read_lines_until,lstrip,split,title,restore_save,discard_save,header?,empty?,context,!=,attr?,attr,key?,document,+,level,special,sectname,to_i,<,>,warn,next_block,blocks?,style,style=,parent=,content_model,content_model=,lines,subs,size,context=,shift,unwrap_standalone_preamble,source_location,merge,fetch,parse_block_metadata_line,extensions,block_macros?,mark,read_line,terminator,to_s,masq,to_sym,registered_for_block?,debug?,debug,cursor_at_mark,strict_verbatim_paragraphs,unshift_line,markdown_syntax,keys,chr,uniform?,length,end_with?,parse_attributes,attribute_missing,tr,basename,assign_caption,registered_for_block_macro?,config,process_method,replace,parse_callout_list,callouts,===,parse_list,parse_description_list,underline_style_section_titles,is_section_title?,peek_line,atx_section_title?,generate_id,level=,read_paragraph_lines,adjust_indentation!,map!,slice,pop,build_block,apply_subs,chop,catalog_inline_anchors,rekey,index,strip,-,parse_table,each,raise,title?,update_attributes,commit_subs,sub?,catalog_callouts,source,remove_sub,block_terminates_paragraph,to_proc,nil?,parse_blocks,parse_list_item,items,scan,gsub,count,advance,dup,match,callout_ids,next_list,catalog_inline_anchor,marker=,catalog_inline_biblio_anchor,set_option,text=,resolve_ordered_list_marker,read_lines_for_list_item,skip_line_comments,unshift_lines,fold_first,text?,is_sibling_list_item?,concat,find,casecmp,sectname=,special=,numbered=,numbered,lineno,peek_lines,setext_section_title?,abs,cursor_at_prev_line,process_attribute_entries,next_line_empty?,apply_header_subs,rstrip,each_with_index,compact,to_h,squeeze,to_a,parse_style_attribute,process_attribute_entry,skip_comment_lines,store_attribute,sanitize_attribute_name,set_attribute,save_to,delete_attribute,ord,int_to_roman,resolve_list_marker,parse_colspecs,create_columns,has_header_option=,format,starts_with_delimiter?,close_open_cell,parse_cellspec,delimiter,match_delimiter,pre_match,post_match,buffer_has_unclosed_quotes?,skip_past_delimiter,buffer=,buffer,skip_past_escaped_delimiter,keep_cell_open,push_cellspec,close_cell,cell_open?,columns,assign_column_widths,partition_header_footer,upto,partition,shorthand_property_syntax,each_char,yield_buffered_attribute,any?,*,each_byte,%'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Parser'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('Logging')); + $const_set($nesting[0], 'BlockMatchData', $$('Struct').$new("context", "masq", "tip", "terminator")); + $const_set($nesting[0], 'TAB', "\t"); + $const_set($nesting[0], 'TabIndentRx', /^\t+/); + $const_set($nesting[0], 'StartOfBlockProc', $send(self, 'proc', [], function $Parser$1(l){var self = $Parser$1.$$s == null ? this : $Parser$1.$$s, $ret_or_1 = nil, $ret_or_2 = nil; + + + if (l == null) l = nil; + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = l['$start_with?']("["))) ? ($$('BlockAttributeLineRx')['$match?'](l)) : ($ret_or_2))))) { + return $ret_or_1 + } else { + + return self['$is_delimited_block?'](l); + }}, {$$s: self})); + $const_set($nesting[0], 'StartOfListProc', $send(self, 'proc', [], function $Parser$2(l){ + + if (l == null) l = nil; + return $$('AnyListRx')['$match?'](l);})); + $const_set($nesting[0], 'StartOfBlockOrListProc', $send(self, 'proc', [], function $Parser$3(l){var self = $Parser$3.$$s == null ? this : $Parser$3.$$s, $ret_or_1 = nil, $ret_or_2 = nil, $ret_or_3 = nil; + + + if (l == null) l = nil; + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = self['$is_delimited_block?'](l))) ? ($ret_or_2) : (($truthy(($ret_or_3 = l['$start_with?']("["))) ? ($$('BlockAttributeLineRx')['$match?'](l)) : ($ret_or_3))))))) { + return $ret_or_1 + } else { + + return $$('AnyListRx')['$match?'](l); + }}, {$$s: self})); + $const_set($nesting[0], 'NoOp', nil); + $const_set($nesting[0], 'AuthorKeys', ["author", "authorinitials", "firstname", "middlename", "lastname", "email"]); + $const_set($nesting[0], 'TableCellHorzAlignments', $hash2(["<", ">", "^"], {"<": "left", ">": "right", "^": "center"})); + $const_set($nesting[0], 'TableCellVertAlignments', $hash2(["<", ">", "^"], {"<": "top", ">": "bottom", "^": "middle"})); + $const_set($nesting[0], 'TableCellStyles', $hash2(["d", "s", "e", "m", "h", "l", "a"], {"d": "none", "s": "strong", "e": "emphasis", "m": "monospaced", "h": "header", "l": "literal", "a": "asciidoc"})); + self.$private_class_method("new"); + $defs(self, '$parse', function $$parse(reader, document, options) { + var $a, $b, self = this, block_attributes = nil, header_only = nil, new_section = nil; + + + if (options == null) options = $hash2([], {}); + block_attributes = self.$parse_document_header(reader, document, (header_only = options['$[]']("header_only"))); + if (!$truthy(header_only)) { + while ($truthy(reader['$has_more_lines?']())) { + + $b = self.$next_section(reader, document, block_attributes), $a = $to_ary($b), (new_section = ($a[0] == null ? nil : $a[0])), (block_attributes = ($a[1] == null ? nil : $a[1])); + if ($truthy(new_section)) { + + document.$assign_numeral(new_section); + document.$blocks()['$<<'](new_section); + } } + } return document; + }, -3); + $defs(self, '$parse_document_header', function $$parse_document_header(reader, document, header_only) { + var $a, $b, $c, self = this, block_attrs = nil, doc_attrs = nil, implicit_doctitle = nil, val = nil, doctitle_attr_val = nil, source_location = nil, l0_section_title = nil, atx = nil, separator = nil, doc_id = nil, role = nil, reftext = nil, modified_attrs = nil, author = nil, author_metadata = nil; + + + if (header_only == null) header_only = false; + block_attrs = ($truthy(reader.$skip_blank_lines()) ? (self.$parse_block_metadata_lines(reader, document)) : ($hash2([], {}))); + doc_attrs = document.$attributes(); + if (($truthy((implicit_doctitle = self['$is_next_line_doctitle?'](reader, block_attrs, doc_attrs['$[]']("leveloffset")))) && ($truthy(block_attrs['$[]']("title"))))) { + + doc_attrs['$[]=']("authorcount", 0); + return document.$finalize_header(block_attrs, false); + } if (!$truthy((val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']())) { + document['$title=']((doctitle_attr_val = val)); + } if ($truthy(implicit_doctitle)) { + + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor(); + } $b = self.$parse_section_title(reader, document), $a = $to_ary($b), ($c = [($a[0] == null ? nil : $a[0])], $send(document, 'id=', $c), $c[$c.length - 1]), (($a[1] == null ? nil : $a[1])), (l0_section_title = ($a[2] == null ? nil : $a[2])), (($a[3] == null ? nil : $a[3])), (atx = ($a[4] == null ? nil : $a[4])); + if ($truthy(doctitle_attr_val)) { + l0_section_title = nil; + } else { + + document['$title='](l0_section_title); + if ($truthy(($a = ["doctitle", (doctitle_attr_val = document.$sub_specialchars(l0_section_title))], $send(doc_attrs, '[]=', $a), $a[$a.length - 1])['$include?']($$('ATTR_REF_HEAD')))) { + doc_attrs['$[]=']("doctitle", (doctitle_attr_val = document.$sub_attributes(doctitle_attr_val, $hash2(["attribute_missing"], {"attribute_missing": "skip"})))); + } } if ($truthy(source_location)) { + document.$header()['$source_location='](source_location); + } if (!($truthy(atx) || ($truthy(document['$attribute_locked?']("compat-mode"))))) { + doc_attrs['$[]=']("compat-mode", ""); + } if ($truthy((separator = block_attrs['$[]']("separator")))) { + if (!$truthy(document['$attribute_locked?']("title-separator"))) { + doc_attrs['$[]=']("title-separator", separator); + } + } if ($truthy((doc_id = block_attrs['$[]']("id")))) { + document['$id='](doc_id); + } else { + doc_id = document.$id(); + } if ($truthy((role = block_attrs['$[]']("role")))) { + doc_attrs['$[]=']("role", role); + } if ($truthy((reftext = block_attrs['$[]']("reftext")))) { + doc_attrs['$[]=']("reftext", reftext); + } block_attrs.$clear(); + (modified_attrs = document.$instance_variable_get("@attributes_modified")).$delete("doctitle"); + self.$parse_header_metadata(reader, document, nil); + if ($truthy(modified_attrs['$include?']("doctitle"))) { + if (($truthy((val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']()) || ($eqeq(val, doctitle_attr_val)))) { + doc_attrs['$[]=']("doctitle", doctitle_attr_val); + } else { + document['$title='](val); + } + } else if ($not(l0_section_title)) { + modified_attrs['$<<']("doctitle"); + } if ($truthy(doc_id)) { + document.$register("refs", [doc_id, document]); + } } else if ($truthy((author = doc_attrs['$[]']("author")))) { + + author_metadata = self.$process_authors(author, true, false); + if ($truthy(doc_attrs['$[]']("authorinitials"))) { + author_metadata.$delete("authorinitials"); + } doc_attrs.$update(author_metadata); + } else if ($truthy((author = doc_attrs['$[]']("authors")))) { + + author_metadata = self.$process_authors(author, true); + doc_attrs.$update(author_metadata); + } else { + doc_attrs['$[]=']("authorcount", 0); + } if ($eqeq(document.$doctype(), "manpage")) { + self.$parse_manpage_header(reader, document, block_attrs, header_only); + } return document.$finalize_header(block_attrs); + }, -3); + $defs(self, '$parse_manpage_header', function $$parse_manpage_header(reader, document, block_attributes, header_only) { + var $a, self = this, doc_attrs = nil, manvolnum = nil, mantitle = nil, $ret_or_1 = nil, $ret_or_2 = nil, manname = nil, name_section_level = nil, name_section = nil, name_section_buffer = nil, mannames = nil, manpurpose = nil, error_msg = nil; + + + if (header_only == null) header_only = false; + if ($truthy($$('ManpageTitleVolnumRx')['$=~']((doc_attrs = document.$attributes())['$[]']("doctitle")))) { + + doc_attrs['$[]=']("manvolnum", (manvolnum = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))); + doc_attrs['$[]=']("mantitle", ($truthy((mantitle = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$('ATTR_REF_HEAD'))) ? (document.$sub_attributes(mantitle)) : (mantitle)).$downcase()); + } else { + + self.$logger().$error(self.$message_with_context("non-conforming manpage title", $hash2(["source_location"], {"source_location": reader.$cursor_at_line(1)}))); + doc_attrs['$[]=']("mantitle", ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = doc_attrs['$[]']("doctitle"))) ? ($ret_or_2) : (doc_attrs['$[]']("docname"))))) ? ($ret_or_1) : ("command"))); + doc_attrs['$[]=']("manvolnum", (manvolnum = "1")); + } if (($truthy((manname = doc_attrs['$[]']("manname"))) && ($truthy(doc_attrs['$[]']("manpurpose"))))) { + + if ($truthy(($ret_or_1 = doc_attrs['$[]']("manname-title")))) ; else { + doc_attrs['$[]=']("manname-title", "Name"); + } doc_attrs['$[]=']("mannames", [manname]); + if ($eqeq(document.$backend(), "manpage")) { + + doc_attrs['$[]=']("docname", manname); + doc_attrs['$[]=']("outfilesuffix", "." + (manvolnum)); + } } else if (!$truthy(header_only)) { + + reader.$skip_blank_lines(); + reader.$save(); + block_attributes.$update(self.$parse_block_metadata_lines(reader, document)); + if ($truthy((name_section_level = self['$is_next_line_section?'](reader, $hash2([], {}))))) { + if ($eqeq(name_section_level, 1)) { + + name_section = self.$initialize_section(reader, document, $hash2([], {})); + name_section_buffer = $send(reader.$read_lines_until($hash2(["break_on_blank_lines", "skip_line_comments"], {"break_on_blank_lines": true, "skip_line_comments": true})), 'map', [], function $$4(l){ + + if (l == null) l = nil; + return l.$lstrip();}).$join(" "); + if ($truthy($$('ManpageNamePurposeRx')['$=~'](name_section_buffer))) { + + if ($truthy((manname = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$('ATTR_REF_HEAD')))) { + manname = document.$sub_attributes(manname); + } if ($truthy(manname['$include?'](","))) { + manname = (mannames = $send(manname.$split(","), 'map', [], function $$5(n){ + + if (n == null) n = nil; + return n.$lstrip();}))['$[]'](0); + } else { + mannames = [manname]; + } if ($truthy((manpurpose = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))['$include?']($$('ATTR_REF_HEAD')))) { + manpurpose = document.$sub_attributes(manpurpose); + } if ($truthy(($ret_or_1 = doc_attrs['$[]']("manname-title")))) ; else { + doc_attrs['$[]=']("manname-title", name_section.$title()); + } if ($truthy(name_section.$id())) { + doc_attrs['$[]=']("manname-id", name_section.$id()); + } doc_attrs['$[]=']("manname", manname); + doc_attrs['$[]=']("mannames", mannames); + doc_attrs['$[]=']("manpurpose", manpurpose); + if ($eqeq(document.$backend(), "manpage")) { + + doc_attrs['$[]=']("docname", manname); + doc_attrs['$[]=']("outfilesuffix", "." + (manvolnum)); + } } else { + error_msg = "non-conforming name section body"; + } } else { + error_msg = "name section must be at level 1"; + } + } else { + error_msg = "name section expected"; + } if ($truthy(error_msg)) { + + reader.$restore_save(); + self.$logger().$error(self.$message_with_context(error_msg, $hash2(["source_location"], {"source_location": reader.$cursor()}))); + doc_attrs['$[]=']("manname", (manname = ($truthy(($ret_or_1 = doc_attrs['$[]']("docname"))) ? ($ret_or_1) : ("command")))); + doc_attrs['$[]=']("mannames", [manname]); + if ($eqeq(document.$backend(), "manpage")) { + + doc_attrs['$[]=']("docname", manname); + doc_attrs['$[]=']("outfilesuffix", "." + (manvolnum)); + } } else { + reader.$discard_save(); + } } return nil; + }, -4); + $defs(self, '$next_section', function $$next_section(reader, parent, attributes) { + var $a, $b, self = this, preamble = nil, intro = nil, part = nil, has_header = nil, book = nil, document = nil, section = nil, current_level = nil, expected_next_level = nil, expected_next_level_alt = nil, title = nil, sectname = nil, next_level = nil, expected_condition = nil, new_section = nil, block_cursor = nil, new_block = nil, $ret_or_1 = nil, first_block = nil, child_block = nil; + + + if (attributes == null) attributes = $hash2([], {}); + preamble = (intro = (part = false)); + if ((($eqeq(parent.$context(), "document") && ($truthy(parent.$blocks()['$empty?']()))) && ((($truthy((has_header = parent['$header?']())) || ($truthy(attributes.$delete("invalid-header")))) || ($not(self['$is_next_line_section?'](reader, attributes))))))) { + + book = (document = parent).$doctype()['$==']("book"); + if (($truthy(has_header) || (($truthy(book) && ($neqeq(attributes['$[]'](1), "abstract")))))) { + + preamble = (intro = $$('Block').$new(parent, "preamble", $hash2(["content_model"], {"content_model": "compound"}))); + if (($truthy(book) && ($truthy(parent['$attr?']("preface-title"))))) { + preamble['$title='](parent.$attr("preface-title")); + } parent.$blocks()['$<<'](preamble); + } section = parent; + current_level = 0; + if ($truthy(parent.$attributes()['$key?']("fragment"))) { + expected_next_level = -1; + } else if ($truthy(book)) { + $a = [1, 0], (expected_next_level = $a[0]), (expected_next_level_alt = $a[1]); + } else { + expected_next_level = 1; + } } else { + + book = (document = parent.$document()).$doctype()['$==']("book"); + section = self.$initialize_section(reader, parent, attributes); + attributes = ($truthy((title = attributes['$[]']("title"))) ? ($hash2(["title"], {"title": title})) : ($hash2([], {}))); + expected_next_level = $rb_plus((current_level = section.$level()), 1); + if ($eqeq(current_level, 0)) { + part = book; + } else if (($eqeq(current_level, 1) && ($truthy(section.$special())))) { + if (!(($eqeq((sectname = section.$sectname()), "appendix") || ($eqeq(sectname, "preface"))) || ($eqeq(sectname, "abstract")))) { + expected_next_level = nil; + } + } } reader.$skip_blank_lines(); + while ($truthy(reader['$has_more_lines?']())) { + + self.$parse_block_metadata_lines(reader, document, attributes); + if ($truthy((next_level = self['$is_next_line_section?'](reader, attributes)))) { + + if ($truthy(document['$attr?']("leveloffset"))) { + + next_level = $rb_plus(next_level, document.$attr("leveloffset").$to_i()); + if ($truthy($rb_lt(next_level, 0))) { + next_level = 0; + } } if ($truthy($rb_gt(next_level, current_level))) { + + if ($truthy(expected_next_level)) { + if (!(($eqeq(next_level, expected_next_level) || (($truthy(expected_next_level_alt) && ($eqeq(next_level, expected_next_level_alt))))) || ($truthy($rb_lt(expected_next_level, 0))))) { + + expected_condition = ($truthy(expected_next_level_alt) ? ("expected levels " + (expected_next_level_alt) + " or " + (expected_next_level)) : ("expected level " + (expected_next_level))); + self.$logger().$warn(self.$message_with_context("section title out of sequence: " + (expected_condition) + ", got level " + (next_level), $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } + } else { + self.$logger().$error(self.$message_with_context("" + (sectname) + " sections do not support nested sections", $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } $b = self.$next_section(reader, section, attributes), $a = $to_ary($b), (new_section = ($a[0] == null ? nil : $a[0])), (attributes = ($a[1] == null ? nil : $a[1])); + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else if (($eqeq(next_level, 0) && ($eqeq(section, document)))) { + + if (!$truthy(book)) { + self.$logger().$error(self.$message_with_context("level 0 sections can only be used when doctype is book", $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } $b = self.$next_section(reader, section, attributes), $a = $to_ary($b), (new_section = ($a[0] == null ? nil : $a[0])), (attributes = ($a[1] == null ? nil : $a[1])); + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else { + break + } } else { + + block_cursor = reader.$cursor(); + if ($truthy((new_block = self.$next_block(reader, ($truthy(($ret_or_1 = intro)) ? ($ret_or_1) : (section)), attributes, $hash2(["parse_metadata"], {"parse_metadata": false}))))) { + + if ($truthy(part)) { + if ($not(section['$blocks?']())) { + if ($neqeq(new_block.$style(), "partintro")) { + if (($eqeq(new_block.$style(), "open") && ($eqeq(new_block.$context(), "open")))) { + new_block['$style=']("partintro"); + } else { + + new_block['$parent=']((intro = $$('Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))); + intro['$style=']("partintro"); + section.$blocks()['$<<'](intro); + } + } else if ($eqeq(new_block.$content_model(), "simple")) { + + new_block['$content_model=']("compound"); + new_block['$<<']($$('Block').$new(new_block, "paragraph", $hash2(["source", "subs"], {"source": new_block.$lines(), "subs": new_block.$subs()}))); + new_block.$lines().$clear(); + new_block.$subs().$clear(); + } + } else if ($eqeq(section.$blocks().$size(), 1)) { + + first_block = section.$blocks()['$[]'](0); + if (($not(intro) && ($eqeq(first_block.$content_model(), "compound")))) { + self.$logger().$error(self.$message_with_context("illegal block content outside of partintro block", $hash2(["source_location"], {"source_location": block_cursor}))); + } else if ($neqeq(first_block.$content_model(), "compound")) { + + new_block['$parent=']((intro = $$('Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))); + if ($eqeq(first_block.$style(), ($a = ["partintro"], $send(intro, 'style=', $a), $a[$a.length - 1]))) { + + first_block['$context=']("paragraph"); + first_block['$style='](nil); + } section.$blocks().$shift(); + intro['$<<'](first_block); + section.$blocks()['$<<'](intro); + } } + } ($truthy(($ret_or_1 = intro)) ? ($ret_or_1) : (section)).$blocks()['$<<'](new_block); + attributes.$clear(); + } } if ($truthy(($ret_or_1 = reader.$skip_blank_lines()))) ; else { + break + } } if ($truthy(part)) { + if (!($truthy(section['$blocks?']()) && ($eqeq(section.$blocks()['$[]'](-1).$context(), "section")))) { + self.$logger().$error(self.$message_with_context("invalid part, must have at least one section (e.g., chapter, appendix, etc.)", $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } + } else if ($truthy(preamble)) { + if ($truthy(preamble['$blocks?']())) { + if ((($truthy(book) || ($truthy(document.$blocks()['$[]'](1)))) || ($not($$('Compliance').$unwrap_standalone_preamble())))) { + if ($truthy(document.$sourcemap())) { + preamble['$source_location='](preamble.$blocks()['$[]'](0).$source_location()); + } + } else { + + document.$blocks().$shift(); + while ($truthy((child_block = preamble.$blocks().$shift()))) { + document['$<<'](child_block); + } } + } else { + document.$blocks().$shift(); + } + } return [($eqeq(section, parent) ? (nil) : (section)), attributes.$merge()]; + }, -3); + $defs(self, '$next_block', function $$next_block(reader, parent, attributes, options) { + var $a, $b, self = this, skipped = nil, text_only = nil, document = nil, $ret_or_1 = nil, extensions = nil, block_extensions = nil, block_macro_extensions = nil, this_line = nil, doc_attrs = nil, style = nil, block = nil, block_context = nil, cloaked_context = nil, terminator = nil, delimited_block = nil, indented = nil, md_syntax = nil, ch0 = nil, layout_break_chars = nil, ll = nil, blk_ctx = nil, target = nil, blk_attrs = nil, posattrs = nil, expanded_target = nil, $ret_or_2 = nil, scaledwidth = nil, block_title = nil, extension = nil, report_unknown_block_macro = nil, content = nil, ext_config = nil, default_attrs = nil, float_id = nil, float_reftext = nil, float_level = nil, lines = nil, content_adjacent = nil, admonition_name = nil, credit_line = nil, attribution = nil, citetitle = nil, language = nil, comma_idx = nil, block_cursor = nil, block_reader = nil, content_model = nil, positional_attrs = nil, block_id = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + if (attributes == null) attributes = $hash2([], {}); + if (options == null) options = $hash2([], {}); + if (!$truthy((skipped = reader.$skip_blank_lines()))) { + return nil + } if (($truthy((text_only = options['$[]']("text_only"))) && ($truthy($rb_gt(skipped, 0))))) { + + options.$delete("text_only"); + text_only = nil; + } document = parent.$document(); + if ($truthy(options.$fetch("parse_metadata", true))) { + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + if ($truthy(($ret_or_1 = reader.$skip_blank_lines()))) ; else { + return nil + } } + } if ($truthy((extensions = document.$extensions()))) { + $a = [extensions['$blocks?'](), extensions['$block_macros?']()], (block_extensions = $a[0]), (block_macro_extensions = $a[1]); + } reader.$mark(); + $a = [reader.$read_line(), document.$attributes(), attributes['$[]'](1)], (this_line = $a[0]), (doc_attrs = $a[1]), (style = $a[2]); + block = (block_context = (cloaked_context = (terminator = nil))); + if ($truthy((delimited_block = self['$is_delimited_block?'](this_line, true)))) { + + block_context = (cloaked_context = delimited_block.$context()); + terminator = delimited_block.$terminator(); + if ($truthy(style)) { + if (!$eqeq(style, block_context.$to_s())) { + if ($truthy(delimited_block.$masq()['$include?'](style))) { + block_context = style.$to_sym(); + } else if (($truthy(delimited_block.$masq()['$include?']("admonition")) && ($truthy($$('ADMONITION_STYLES')['$include?'](style))))) { + block_context = "admonition"; + } else if (($truthy(block_extensions) && ($truthy(extensions['$registered_for_block?'](style, block_context))))) { + block_context = style.$to_sym(); + } else { + + if ($truthy(self.$logger()['$debug?']())) { + self.$logger().$debug(self.$message_with_context("unknown style for " + (block_context) + " block: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + } style = block_context.$to_s(); + } + } + } else { + style = ($a = ["style", block_context.$to_s()], $send(attributes, '[]=', $a), $a[$a.length - 1]); + } } if (!$truthy(delimited_block)) { + while ($truthy(true)) { + + if ((($truthy(style) && ($truthy($$('Compliance').$strict_verbatim_paragraphs()))) && ($truthy($$('VERBATIM_STYLES')['$include?'](style))))) { + + block_context = style.$to_sym(); + reader.$unshift_line(this_line); + break; + } if ($truthy(text_only)) { + indented = this_line['$start_with?'](" ", $$('TAB')); + } else { + + md_syntax = $$('Compliance').$markdown_syntax(); + if ($truthy(this_line['$start_with?'](" "))) { + + $a = [true, " "], (indented = $a[0]), (ch0 = $a[1]); + if ((($truthy(md_syntax) && ($truthy($send(this_line.$lstrip(), 'start_with?', $to_a($$('MARKDOWN_THEMATIC_BREAK_CHARS').$keys()))))) && ($truthy($$('MarkdownThematicBreakRx')['$match?'](this_line))))) { + + block = $$('Block').$new(parent, "thematic_break", $hash2(["content_model"], {"content_model": "empty"})); + break; + } } else if ($truthy(this_line['$start_with?']($$('TAB')))) { + $a = [true, $$('TAB')], (indented = $a[0]), (ch0 = $a[1]); + } else { + + $a = [false, this_line.$chr()], (indented = $a[0]), (ch0 = $a[1]); + layout_break_chars = ($truthy(md_syntax) ? ($$('HYBRID_LAYOUT_BREAK_CHARS')) : ($$('LAYOUT_BREAK_CHARS'))); + if (($truthy(layout_break_chars['$key?'](ch0)) && ($truthy(($truthy(md_syntax) ? ($$('ExtLayoutBreakRx')['$match?'](this_line)) : ($truthy(($ret_or_1 = self['$uniform?'](this_line, ch0, (ll = this_line.$length())))) ? ($rb_gt(ll, 2)) : ($ret_or_1))))))) { + + block = $$('Block').$new(parent, layout_break_chars['$[]'](ch0), $hash2(["content_model"], {"content_model": "empty"})); + break; + } else if (($truthy(this_line['$end_with?']("]")) && ($truthy(this_line['$include?']("::"))))) { + if ((($eqeq(ch0, "i") || ($truthy(this_line['$start_with?']("video:", "audio:")))) && ($truthy($$('BlockMediaMacroRx')['$=~'](this_line))))) { + + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](1)).$to_sym(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (blk_ctx = $a[0]), (target = $a[1]), (blk_attrs = $a[2]); + block = $$('Block').$new(parent, blk_ctx, $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy(blk_attrs)) { + + + switch (blk_ctx) { + case "video": + posattrs = ["poster", "width", "height"]; + break; + case "audio": + posattrs = []; + break; + default: + posattrs = ["alt", "width", "height"]; + } block.$parse_attributes(blk_attrs, posattrs, $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes})); + } if ($truthy(attributes['$key?']("style"))) { + attributes.$delete("style"); + } if ($truthy(target['$include?']($$('ATTR_REF_HEAD')))) { + if ((($truthy((expanded_target = block.$sub_attributes(target))['$empty?']()) && ($eqeq(($truthy(($ret_or_1 = doc_attrs['$[]']("attribute-missing"))) ? ($ret_or_1) : ($$('Compliance').$attribute_missing())), "drop-line"))) && ($truthy(block.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']())))) { + + attributes.$clear(); + return nil; + } else { + target = expanded_target; + } + } if ($eqeq(blk_ctx, "image")) { + + document.$register("images", target); + attributes['$[]=']("imagesdir", doc_attrs['$[]']("imagesdir")); + if ($truthy(($ret_or_1 = attributes['$[]']("alt")))) ; else { + attributes['$[]=']("alt", ($truthy(($ret_or_2 = style)) ? ($ret_or_2) : (($a = ["default-alt", $$('Helpers').$basename(target, true).$tr("_-", " ")], $send(attributes, '[]=', $a), $a[$a.length - 1])))); + } if (!$truthy((scaledwidth = attributes.$delete("scaledwidth"))['$nil_or_empty?']())) { + attributes['$[]=']("scaledwidth", ($truthy($$('TrailingDigitsRx')['$match?'](scaledwidth)) ? ("" + (scaledwidth) + "%") : (scaledwidth))); + } if ($truthy(attributes['$[]']("title"))) { + + block['$title=']((block_title = attributes.$delete("title"))); + block.$assign_caption(attributes.$delete("caption"), "figure"); + } } attributes['$[]=']("target", target); + break; + } else if ((($eqeq(ch0, "t") && ($truthy(this_line['$start_with?']("toc:")))) && ($truthy($$('BlockTocMacroRx')['$=~'](this_line))))) { + + block = $$('Block').$new(parent, "toc", $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + block.$parse_attributes((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), [], $hash2(["into"], {"into": attributes})); + } break; + } else if ($truthy(($truthy(block_macro_extensions) ? (($truthy(($ret_or_1 = ($truthy(($ret_or_2 = $$('CustomBlockMacroRx')['$=~'](this_line))) ? ((extension = extensions['$registered_for_block_macro?']((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))))) : ($ret_or_2)))) ? ($ret_or_1) : ((report_unknown_block_macro = self.$logger()['$debug?']())))) : (($truthy(($ret_or_1 = self.$logger()['$debug?']())) ? ((report_unknown_block_macro = $$('CustomBlockMacroRx')['$=~'](this_line))) : ($ret_or_1)))))) { + if ($truthy(report_unknown_block_macro)) { + self.$logger().$debug(self.$message_with_context("unknown name for block macro: " + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + } else { + + content = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)); + if ($truthy((target = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))['$include?']($$('ATTR_REF_HEAD')))) { + if ((($truthy((expanded_target = parent.$sub_attributes(target))['$empty?']()) && ($eqeq(($truthy(($ret_or_1 = doc_attrs['$[]']("attribute-missing"))) ? ($ret_or_1) : ($$('Compliance').$attribute_missing())), "drop-line"))) && ($truthy(parent.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']())))) { + + attributes.$clear(); + return nil; + } else { + target = expanded_target; + } + } if ($eqeq((ext_config = extension.$config())['$[]']("content_model"), "attributes")) { + if ($truthy(content)) { + document.$parse_attributes(content, ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ext_config['$[]']("positional_attrs"))) ? ($ret_or_2) : (ext_config['$[]']("pos_attrs"))))) ? ($ret_or_1) : ([])), $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes})); + } + } else { + attributes['$[]=']("text", ($truthy(($ret_or_1 = content)) ? ($ret_or_1) : (""))); + } if ($truthy((default_attrs = ext_config['$[]']("default_attrs")))) { + $send(attributes, 'update', [default_attrs], function $$6(_, old_v){ + if (old_v == null) old_v = nil; + return old_v;}); + } if (($truthy((block = extension.$process_method()['$[]'](parent, target, attributes))) && ($neqeq(block, parent)))) { + + attributes.$replace(block.$attributes()); + break; + } else { + + attributes.$clear(); + return nil; + } } + } + } } } if ((($not(indented) && ($eqeq((ch0 = ($truthy(($ret_or_1 = ch0)) ? ($ret_or_1) : (this_line.$chr()))), "<"))) && ($truthy($$('CalloutListRx')['$=~'](this_line))))) { + + reader.$unshift_line(this_line); + block = self.$parse_callout_list(reader, $gvars["~"], parent, document.$callouts()); + attributes['$[]=']("style", "arabic"); + break; + } else if ($truthy($$('UnorderedListRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + if ((($not(style) && ($eqeqeq($$('Section'), parent))) && ($eqeq(parent.$sectname(), "bibliography")))) { + attributes['$[]=']("style", (style = "bibliography")); + } block = self.$parse_list(reader, "ulist", parent, style); + break; + } else if ($truthy($$('OrderedListRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + block = self.$parse_list(reader, "olist", parent, style); + if ($truthy(block.$style())) { + attributes['$[]=']("style", block.$style()); + } break; + } else if ((($truthy(this_line['$include?']("::")) || ($truthy(this_line['$include?'](";;")))) && ($truthy($$('DescriptionListRx')['$=~'](this_line))))) { + + reader.$unshift_line(this_line); + block = self.$parse_description_list(reader, $gvars["~"], parent); + break; + } else if ((($eqeq(style, "float") || ($eqeq(style, "discrete"))) && ($truthy(($truthy($$('Compliance').$underline_style_section_titles()) ? (self['$is_section_title?'](this_line, reader.$peek_line())) : ($truthy(($ret_or_1 = indented['$!']())) ? (self['$atx_section_title?'](this_line)) : ($ret_or_1))))))) { + + reader.$unshift_line(this_line); + $b = self.$parse_section_title(reader, document, attributes['$[]']("id")), $a = $to_ary($b), (float_id = ($a[0] == null ? nil : $a[0])), (float_reftext = ($a[1] == null ? nil : $a[1])), (block_title = ($a[2] == null ? nil : $a[2])), (float_level = ($a[3] == null ? nil : $a[3])); + if ($truthy(float_reftext)) { + attributes['$[]=']("reftext", float_reftext); + } block = $$('Block').$new(parent, "floating_title", $hash2(["content_model"], {"content_model": "empty"})); + block['$title='](block_title); + attributes.$delete("title"); + block['$id='](($truthy(($ret_or_1 = float_id)) ? ($ret_or_1) : (($truthy(doc_attrs['$key?']("sectids")) ? ($$('Section').$generate_id(block.$title(), document)) : (nil))))); + block['$level='](float_level); + break; + } else if (($truthy(style) && ($neqeq(style, "normal")))) { + if ($truthy($$('PARAGRAPH_STYLES')['$include?'](style))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break; + } else if ($truthy($$('ADMONITION_STYLES')['$include?'](style))) { + + block_context = "admonition"; + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break; + } else if (($truthy(block_extensions) && ($truthy(extensions['$registered_for_block?'](style, "paragraph"))))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break; + } else { + + if ($truthy(self.$logger()['$debug?']())) { + self.$logger().$debug(self.$message_with_context("unknown style for paragraph: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + } style = nil; + } + } reader.$unshift_line(this_line); + if (($truthy(indented) && ($not(style)))) { + + lines = self.$read_paragraph_lines(reader, (content_adjacent = ($eqeq(skipped, 0) ? (options['$[]']("list_type")) : (nil))), $hash2(["skip_line_comments"], {"skip_line_comments": text_only})); + self['$adjust_indentation!'](lines); + if (($truthy(text_only) || ($eqeq(content_adjacent, "dlist")))) { + block = $$('Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else { + block = $$('Block').$new(parent, "literal", $hash2(["content_model", "source", "attributes"], {"content_model": "verbatim", "source": lines, "attributes": attributes})); + } } else { + + lines = self.$read_paragraph_lines(reader, ($truthy(($ret_or_1 = skipped['$=='](0))) ? (options['$[]']("list_type")) : ($ret_or_1)), $hash2(["skip_line_comments"], {"skip_line_comments": true})); + if ($truthy(text_only)) { + + if (($truthy(indented) && ($eqeq(style, "normal")))) { + self['$adjust_indentation!'](lines); + } block = $$('Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ((($truthy($$('ADMONITION_STYLE_HEADS')['$include?'](ch0)) && ($truthy(this_line['$include?'](":")))) && ($truthy($$('AdmonitionParagraphRx')['$=~'](this_line))))) { + + lines['$[]='](0, (($a = $gvars['~']) === nil ? nil : $a.$post_match())); + attributes['$[]=']("name", (admonition_name = ($a = ["style", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))], $send(attributes, '[]=', $a), $a[$a.length - 1]).$downcase())); + attributes['$[]=']("textlabel", ($truthy(($ret_or_1 = attributes.$delete("caption"))) ? ($ret_or_1) : (doc_attrs['$[]']("" + (admonition_name) + "-caption")))); + block = $$('Block').$new(parent, "admonition", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ((($truthy(md_syntax) && ($eqeq(ch0, ">"))) && ($truthy(this_line['$start_with?']("> "))))) { + + $send(lines, 'map!', [], function $$7(line){ + + if (line == null) line = nil; + if ($eqeq(line, ">")) { + + return line.$slice(1, line.$length()); + } else { + + if ($truthy(line['$start_with?']("> "))) { + + return line.$slice(2, line.$length()); + } else { + return line + } }}); + if ($truthy(lines['$[]'](-1)['$start_with?']("-- "))) { + + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + if (!$truthy(lines['$empty?']())) { + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop(); + } + } } attributes['$[]=']("style", "quote"); + block = self.$build_block("quote", "compound", false, parent, $$('Reader').$new(lines), attributes); + if ($truthy(credit_line)) { + + $b = block.$apply_subs(credit_line).$split(", ", 2), $a = $to_ary($b), (attribution = ($a[0] == null ? nil : $a[0])), (citetitle = ($a[1] == null ? nil : $a[1])); + if ($truthy(attribution)) { + attributes['$[]=']("attribution", attribution); + } if ($truthy(citetitle)) { + attributes['$[]=']("citetitle", citetitle); + } } } else if (((($eqeq(ch0, "\"") && ($truthy($rb_gt(lines.$size(), 1)))) && ($truthy(lines['$[]'](-1)['$start_with?']("-- ")))) && ($truthy(lines['$[]'](-2)['$end_with?']("\""))))) { + + lines['$[]='](0, this_line.$slice(1, this_line.$length())); + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop(); + } lines['$<<'](lines.$pop().$chop()); + attributes['$[]=']("style", "quote"); + block = $$('Block').$new(parent, "quote", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + $b = block.$apply_subs(credit_line).$split(", ", 2), $a = $to_ary($b), (attribution = ($a[0] == null ? nil : $a[0])), (citetitle = ($a[1] == null ? nil : $a[1])); + if ($truthy(attribution)) { + attributes['$[]=']("attribution", attribution); + } if ($truthy(citetitle)) { + attributes['$[]=']("citetitle", citetitle); + } } else { + + if (($truthy(indented) && ($eqeq(style, "normal")))) { + self['$adjust_indentation!'](lines); + } block = $$('Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } self.$catalog_inline_anchors(lines.$join($$('LF')), block, document, reader); + } break; + } + } if (!$truthy(block)) { + + switch (block_context) { + case "listing": + case "source": + + if (($eqeq(block_context, "source") || (($not(attributes['$[]'](1)) && ($truthy((language = ($truthy(($ret_or_2 = attributes['$[]'](2))) ? ($ret_or_2) : (doc_attrs['$[]']("source-language")))))))))) { + + if ($truthy(language)) { + + attributes['$[]=']("style", "source"); + attributes['$[]=']("language", language); + $$('AttributeList').$rekey(attributes, [nil, nil, "linenums"]); + } else { + + $$('AttributeList').$rekey(attributes, [nil, "language", "linenums"]); + if (!$truthy(attributes['$key?']("language"))) { + if ($truthy(doc_attrs['$key?']("source-language"))) { + attributes['$[]=']("language", doc_attrs['$[]']("source-language")); + } + } } if (!$truthy(attributes['$key?']("linenums"))) { + if (($truthy(attributes['$[]']("linenums-option")) || ($truthy(doc_attrs['$[]']("source-linenums-option"))))) { + attributes['$[]=']("linenums", ""); + } + } if (!$truthy(attributes['$key?']("indent"))) { + if ($truthy(doc_attrs['$key?']("source-indent"))) { + attributes['$[]=']("indent", doc_attrs['$[]']("source-indent")); + } + } } block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes); + break; + case "fenced_code": + + attributes['$[]=']("style", "source"); + if ($truthy($rb_gt((ll = this_line.$length()), 3))) { + if ($truthy((comma_idx = (language = this_line.$slice(3, ll)).$index(",")))) { + if ($truthy($rb_gt(comma_idx, 0))) { + + language = language.$slice(0, comma_idx).$strip(); + if ($truthy($rb_lt(comma_idx, $rb_minus(ll, 4)))) { + attributes['$[]=']("linenums", ""); + } } else if ($truthy($rb_gt(ll, 4))) { + attributes['$[]=']("linenums", ""); + } + } else { + language = language.$lstrip(); + } + } if ($truthy(language['$nil_or_empty?']())) { + if ($truthy(doc_attrs['$key?']("source-language"))) { + attributes['$[]=']("language", doc_attrs['$[]']("source-language")); + } + } else { + attributes['$[]=']("language", language); + } if (!$truthy(attributes['$key?']("linenums"))) { + if (($truthy(attributes['$[]']("linenums-option")) || ($truthy(doc_attrs['$[]']("source-linenums-option"))))) { + attributes['$[]=']("linenums", ""); + } + } if (!$truthy(attributes['$key?']("indent"))) { + if ($truthy(doc_attrs['$key?']("source-indent"))) { + attributes['$[]=']("indent", doc_attrs['$[]']("source-indent")); + } + } terminator = terminator.$slice(0, 3); + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes); + break; + case "table": + + block_cursor = reader.$cursor(); + block_reader = $$('Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_line_comments", "context", "cursor"], {"terminator": terminator, "skip_line_comments": true, "context": "table", "cursor": "at_mark"})), block_cursor); + if (!$truthy(terminator['$start_with?']("|", "!"))) { + if ($truthy(($ret_or_2 = attributes['$[]']("format")))) ; else { + attributes['$[]=']("format", ($truthy(terminator['$start_with?'](",")) ? ("csv") : ("dsv"))); + } + } block = self.$parse_table(block_reader, parent, attributes); + break; + case "sidebar": + block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes); + break; + case "admonition": + + attributes['$[]=']("name", (admonition_name = style.$downcase())); + attributes['$[]=']("textlabel", ($truthy(($ret_or_2 = attributes.$delete("caption"))) ? ($ret_or_2) : (doc_attrs['$[]']("" + (admonition_name) + "-caption")))); + block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes); + break; + case "open": + case "abstract": + case "partintro": + block = self.$build_block("open", "compound", terminator, parent, reader, attributes); + break; + case "literal": + block = self.$build_block(block_context, "verbatim", terminator, parent, reader, attributes); + break; + case "example": + + if ($truthy(attributes['$[]']("collapsible-option"))) { + attributes['$[]=']("caption", ""); + } block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes); + break; + case "quote": + case "verse": + + $$('AttributeList').$rekey(attributes, [nil, "attribution", "citetitle"]); + block = self.$build_block(block_context, ($eqeq(block_context, "verse") ? ("verbatim") : ("compound")), terminator, parent, reader, attributes); + break; + case "stem": + case "latexmath": + case "asciimath": + + if ($eqeq(block_context, "stem")) { + attributes['$[]=']("style", $$('STEM_TYPE_ALIASES')['$[]'](($truthy(($ret_or_2 = attributes['$[]'](2))) ? ($ret_or_2) : (doc_attrs['$[]']("stem"))))); + } block = self.$build_block("stem", "raw", terminator, parent, reader, attributes); + break; + case "pass": + block = self.$build_block(block_context, "raw", terminator, parent, reader, attributes); + break; + case "comment": + + self.$build_block(block_context, "skip", terminator, parent, reader, attributes); + attributes.$clear(); + return nil; + default: + if (($truthy(block_extensions) && ($truthy((extension = extensions['$registered_for_block?'](block_context, cloaked_context)))))) { + + if (!$eqeq((content_model = (ext_config = extension.$config())['$[]']("content_model")), "skip")) { + + if (!$truthy((positional_attrs = ($truthy(($ret_or_2 = ext_config['$[]']("positional_attrs"))) ? ($ret_or_2) : (ext_config['$[]']("pos_attrs"))))['$nil_or_empty?']())) { + $$('AttributeList').$rekey(attributes, $rb_plus([nil], positional_attrs)); + } if ($truthy((default_attrs = ext_config['$[]']("default_attrs")))) { + $send(default_attrs, 'each', [], function $$8(k, v){var $c; + + + if (k == null) k = nil; + if (v == null) v = nil; + if ($truthy(($ret_or_2 = attributes['$[]'](k)))) { + return $ret_or_2 + } else { + return ($c = [k, v], $send(attributes, '[]=', $c), $c[$c.length - 1]) + }}); + } attributes['$[]=']("cloaked-context", cloaked_context); + } if (!$truthy((block = self.$build_block(block_context, content_model, terminator, parent, reader, attributes, $hash2(["extension"], {"extension": extension}))))) { + + attributes.$clear(); + return nil; + } } else { + self.$raise("Unsupported block type " + (block_context) + " at " + (reader.$cursor())); + } + } + } if ($truthy(document.$sourcemap())) { + block['$source_location='](reader.$cursor_at_mark()); + } if ($truthy(attributes['$[]']("title"))) { + + block['$title=']((block_title = attributes.$delete("title"))); + if ($truthy($$('CAPTION_ATTRIBUTE_NAMES')['$[]'](block.$context()))) { + block.$assign_caption(attributes.$delete("caption")); + } } block['$style='](attributes['$[]']("style")); + if ($truthy((block_id = ($truthy(($ret_or_1 = block.$id())) ? ($ret_or_1) : (($a = [attributes['$[]']("id")], $send(block, 'id=', $a), $a[$a.length - 1])))))) { + + if ($truthy(($truthy(block_title) ? (block_title['$include?']($$('ATTR_REF_HEAD'))) : (block['$title?']())))) { + block.$title(); + } if (!$truthy(document.$register("refs", [block_id, block]))) { + self.$logger().$warn(self.$message_with_context("id assigned to block already in use: " + (block_id), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + } } if (!$truthy(attributes['$empty?']())) { + block.$update_attributes(attributes); + } block.$commit_subs(); + if ($truthy(block['$sub?']("callouts"))) { + if (!$truthy(self.$catalog_callouts(block.$source(), document))) { + block.$remove_sub("callouts"); + } + } return block; + }, -3); + $defs(self, '$read_paragraph_lines', function $$read_paragraph_lines(reader, break_at_list, opts) { + var break_condition = nil; + + + if (opts == null) opts = $hash2([], {}); + opts['$[]=']("break_on_blank_lines", true); + opts['$[]=']("break_on_list_continuation", true); + opts['$[]=']("preserve_last_line", true); + break_condition = ($truthy(break_at_list) ? (($truthy($$('Compliance').$block_terminates_paragraph()) ? ($$('StartOfBlockOrListProc')) : ($$('StartOfListProc')))) : (($truthy($$('Compliance').$block_terminates_paragraph()) ? ($$('StartOfBlockProc')) : ($$('NoOp'))))); + return $send(reader, 'read_lines_until', [opts], break_condition.$to_proc()); + }, -3); + $defs(self, '$is_delimited_block?', function $Parser_is_delimited_block$ques$9(line, return_match_data) { + var $a, $b, self = this, line_len = nil, tip = nil, tip_len = nil, context = nil, masq = nil; + + + if (return_match_data == null) return_match_data = nil; + if (!($truthy($rb_gt((line_len = line.$length()), 1)) && ($truthy($$('DELIMITED_BLOCK_HEADS')['$[]'](line.$slice(0, 2)))))) { + return nil + } if ($eqeq(line_len, 2)) { + + tip = line; + tip_len = 2; + } else { + + if ($truthy($rb_lt(line_len, 5))) { + + tip = line; + tip_len = line_len; + } else { + tip = line.$slice(0, (tip_len = 4)); + } if (($truthy($$('Compliance').$markdown_syntax()) && ($truthy(tip['$start_with?']("`"))))) { + if ($eqeq(tip_len, 4)) { + + if (($eqeq(tip, "````") || ($neqeq((tip = tip.$chop()), "```")))) { + return nil + } line = tip; + line_len = (tip_len = 3); + } else if ($neqeq(tip, "```")) { + return nil + } + } else if ($eqeq(tip_len, 3)) { + return nil + } } $b = $$('DELIMITED_BLOCKS')['$[]'](tip), $a = $to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])); + if (($truthy(context) && (($eqeq(line_len, tip_len) || ($truthy(self['$uniform?'](line.$slice(1, line_len), $$('DELIMITED_BLOCK_TAILS')['$[]'](tip), $rb_minus(line_len, 1)))))))) { + if ($truthy(return_match_data)) { + + return $$('BlockMatchData').$new(context, masq, tip, line); + } else { + return true + } + } else { + return nil + } }, -2); + $defs(self, '$build_block', function $$build_block(block_context, content_model, terminator, parent, reader, attributes, options) { + var $a, self = this, skip_processing = nil, parse_as_content_model = nil, lines = nil, block_reader = nil, block_cursor = nil, tab_size = nil, $ret_or_2 = nil, indent = nil, extension = nil, block = nil, $ret_or_1 = nil; + + + if (options == null) options = $hash2([], {}); + + switch (content_model) { + case "skip": + $a = [true, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]); + break; + case "raw": + $a = [false, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]); + break; + default: + $a = [false, content_model], (skip_processing = $a[0]), (parse_as_content_model = $a[1]); + } if ($truthy(terminator['$nil?']())) { + + if ($eqeq(parse_as_content_model, "verbatim")) { + lines = reader.$read_lines_until($hash2(["break_on_blank_lines", "break_on_list_continuation"], {"break_on_blank_lines": true, "break_on_list_continuation": true})); + } else { + + if ($eqeq(content_model, "compound")) { + content_model = "simple"; + } lines = self.$read_paragraph_lines(reader, false, $hash2(["skip_line_comments", "skip_processing"], {"skip_line_comments": true, "skip_processing": skip_processing})); + } block_reader = nil; + } else if ($neqeq(parse_as_content_model, "compound")) { + + lines = reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})); + block_reader = nil; + } else if ($eqeq(terminator, false)) { + + lines = nil; + block_reader = reader; + } else { + + lines = nil; + block_cursor = reader.$cursor(); + block_reader = $$('Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})), block_cursor); + } + switch (content_model) { + case "verbatim": + + tab_size = ($truthy(($ret_or_2 = attributes['$[]']("tabsize"))) ? ($ret_or_2) : (parent.$document().$attributes()['$[]']("tabsize"))).$to_i(); + if ($truthy((indent = attributes['$[]']("indent")))) { + self['$adjust_indentation!'](lines, indent.$to_i(), tab_size); + } else if ($truthy($rb_gt(tab_size, 0))) { + self['$adjust_indentation!'](lines, -1, tab_size); + } break; + case "skip": + return nil + } if ($truthy((extension = options['$[]']("extension")))) { + + attributes.$delete("style"); + if (($truthy((block = extension.$process_method()['$[]'](parent, ($truthy(($ret_or_1 = block_reader)) ? ($ret_or_1) : ($$('Reader').$new(lines))), attributes.$merge()))) && ($neqeq(block, parent)))) { + + attributes.$replace(block.$attributes()); + if ((($eqeq(block.$content_model(), "compound") && ($eqeqeq($$('Block'), block))) && ($not((lines = block.$lines())['$empty?']())))) { + + content_model = "compound"; + block_reader = $$('Reader').$new(lines); + } } else { + return nil + } } else { + block = $$('Block').$new(parent, block_context, $hash2(["content_model", "source", "attributes"], {"content_model": content_model, "source": lines, "attributes": attributes})); + } if ($eqeq(content_model, "compound")) { + self.$parse_blocks(block_reader, block); + } return block; + }, -7); + $defs(self, '$parse_blocks', function $$parse_blocks(reader, parent, attributes) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil, block = nil; + + + if (attributes == null) attributes = nil; + if ($truthy(attributes)) { + while ($truthy(($truthy(($ret_or_1 = ($truthy(($ret_or_2 = (block = self.$next_block(reader, parent, attributes.$merge())))) ? (parent.$blocks()['$<<'](block)) : ($ret_or_2)))) ? ($ret_or_1) : (reader['$has_more_lines?']())))) { + + } + } else { + while ($truthy(($truthy(($ret_or_1 = ($truthy(($ret_or_2 = (block = self.$next_block(reader, parent)))) ? (parent.$blocks()['$<<'](block)) : ($ret_or_2)))) ? ($ret_or_1) : (reader['$has_more_lines?']())))) { + + } + } return nil; + }, -3); + $defs(self, '$parse_list', function $$parse_list(reader, list_type, parent, style) { + var $a, self = this, list_block = nil, list_rx = nil, $ret_or_1 = nil, list_item = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + list_block = $$('List').$new(parent, list_type); + list_rx = $$('ListRxMap')['$[]'](list_type); + while ($truthy(($truthy(($ret_or_1 = reader['$has_more_lines?']())) ? (list_rx['$=~'](reader.$peek_line())) : ($ret_or_1)))) { + + if ($truthy((list_item = self.$parse_list_item(reader, list_block, $gvars["~"], (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), style)))) { + list_block.$items()['$<<'](list_item); + } if ($truthy(($ret_or_1 = reader.$skip_blank_lines()))) ; else { + break + } } return list_block; + }); + $defs(self, '$catalog_callouts', function $$catalog_callouts(text, document) { + var found = nil, autonum = nil; + + + found = false; + autonum = 0; + if ($truthy(text['$include?']("<"))) { + $send(text, 'scan', [$$('CalloutScanRx')], function $$10(){var $a; + + + if (!$truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']("\\"))) { + document.$callouts().$register(($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), ".") ? ((autonum = $rb_plus(autonum, 1)).$to_s()) : ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))); + } return (found = true);}); + } return found; + }); + $defs(self, '$catalog_inline_anchor', function $$catalog_inline_anchor(id, reftext, node, location, doc) { + var self = this; + + + if (doc == null) doc = node.$document(); + if (($truthy(reftext) && ($truthy(reftext['$include?']($$('ATTR_REF_HEAD')))))) { + reftext = doc.$sub_attributes(reftext); + } if (!$truthy(doc.$register("refs", [id, $$('Inline').$new(node, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id}))]))) { + + if ($eqeqeq($$('Reader'), location)) { + location = location.$cursor(); + } self.$logger().$warn(self.$message_with_context("id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + } return nil; + }, -5); + $defs(self, '$catalog_inline_anchors', function $$catalog_inline_anchors(text, block, document, reader) { + var self = this; + + + if (($truthy(text['$include?']("[[")) || ($truthy(text['$include?']("or:"))))) { + $send(text, 'scan', [$$('InlineAnchorScanRx')], function $$11(){var $a, self = $$11.$$s == null ? this : $$11.$$s, id = nil, reftext = nil, location = nil, offset = nil; + + + if ($truthy((id = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))))) { + if ((($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) && ($truthy(reftext['$include?']($$('ATTR_REF_HEAD'))))) && ($truthy((reftext = document.$sub_attributes(reftext))['$empty?']())))) { + return nil + } + } else { + + id = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)); + if ($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](4))))) { + if ($truthy(reftext['$include?']("]"))) { + + reftext = reftext.$gsub("\\]", "]"); + if ($truthy(reftext['$include?']($$('ATTR_REF_HEAD')))) { + reftext = document.$sub_attributes(reftext); + } } else if ($truthy(reftext['$include?']($$('ATTR_REF_HEAD')))) { + if ($truthy((reftext = document.$sub_attributes(reftext))['$empty?']())) { + reftext = nil; + } + } + } } if ($truthy(document.$register("refs", [id, $$('Inline').$new(block, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id}))]))) { + return nil + } else { + + location = reader.$cursor_at_mark(); + if ($truthy($rb_gt((offset = $rb_plus((($a = $gvars['~']) === nil ? nil : $a.$pre_match()).$count($$('LF')), ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']($$('LF'))) ? (1) : (0)))), 0))) { + (location = location.$dup()).$advance(offset); + } return self.$logger().$warn(self.$message_with_context("id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + }}, {$$s: self}); + } return nil; + }); + $defs(self, '$catalog_inline_biblio_anchor', function $$catalog_inline_biblio_anchor(id, reftext, node, reader) { + var self = this, $ret_or_1 = nil; + + + if (!$truthy(node.$document().$register("refs", [id, $$('Inline').$new(node, "anchor", ($truthy(($ret_or_1 = reftext)) ? ("[" + (reftext) + "]") : ($ret_or_1)), $hash2(["type", "id"], {"type": "bibref", "id": id}))]))) { + self.$logger().$warn(self.$message_with_context("id assigned to bibliography anchor already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } return nil; + }); + $defs(self, '$parse_description_list', function $$parse_description_list(reader, match, parent) { + var self = this, list_block = nil, sibling_pattern = nil, current_pair = nil, $ret_or_1 = nil, next_pair = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + list_block = $$('List').$new(parent, "dlist"); + sibling_pattern = $$('DescriptionListSiblingRx')['$[]'](match['$[]'](2)); + list_block.$items()['$<<']((current_pair = self.$parse_list_item(reader, list_block, match, sibling_pattern))); + while ($truthy(($truthy(($ret_or_1 = reader['$has_more_lines?']())) ? (sibling_pattern['$=~'](reader.$peek_line())) : ($ret_or_1)))) { + + next_pair = self.$parse_list_item(reader, list_block, $gvars["~"], sibling_pattern); + if ($truthy(current_pair['$[]'](1))) { + list_block.$items()['$<<']((current_pair = next_pair)); + } else { + + current_pair['$[]'](0)['$<<'](next_pair['$[]'](0)['$[]'](0)); + current_pair['$[]='](1, next_pair['$[]'](1)); + } } return list_block; + }); + $defs(self, '$parse_callout_list', function $$parse_callout_list(reader, match, parent, callouts) { + var self = this, list_block = nil, next_index = nil, autonum = nil, $ret_or_1 = nil, $ret_or_2 = nil, num = nil, list_item = nil, coids = nil; + + + list_block = $$('List').$new(parent, "colist"); + next_index = 1; + autonum = 0; + while ($truthy(($truthy(($ret_or_1 = match)) ? ($ret_or_1) : (($truthy(($ret_or_2 = (match = $$('CalloutListRx').$match(reader.$peek_line())))) ? (reader.$mark()) : ($ret_or_2)))))) { + + if ($eqeq((num = match['$[]'](1)), ".")) { + num = (autonum = $rb_plus(autonum, 1)).$to_s(); + } if (!$eqeq(num, next_index.$to_s())) { + self.$logger().$warn(self.$message_with_context("callout list item index: expected " + (next_index) + ", got " + (num), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + } if ($truthy((list_item = self.$parse_list_item(reader, list_block, match, "<1>")))) { + + list_block.$items()['$<<'](list_item); + if ($truthy((coids = callouts.$callout_ids(list_block.$items().$size()))['$empty?']())) { + self.$logger().$warn(self.$message_with_context("no callout found for <" + (list_block.$items().$size()) + ">", $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + } else { + list_item.$attributes()['$[]=']("coids", coids); + } } next_index = $rb_plus(next_index, 1); + match = nil; + } callouts.$next_list(); + return list_block; + }); + $defs(self, '$parse_list_item', function $$parse_list_item(reader, list_block, match, sibling_trait, style) { + var $a, $b, self = this, list_type = nil, dlist = nil, list_term = nil, term_text = nil, $ret_or_1 = nil, item_text = nil, has_text = nil, list_item = nil, sourcemap_assignment_deferred = nil, ordinal = nil, implicit_style = nil, $ret_or_2 = nil, $ret_or_3 = nil, block_cursor = nil, list_item_reader = nil, comment_lines = nil, subsequent_line = nil, content_adjacent = nil, block = nil, first_block = nil; + + + if (style == null) style = nil; + if ($eqeq((list_type = list_block.$context()), "dlist")) { + + dlist = true; + list_term = $$('ListItem').$new(list_block, (term_text = match['$[]'](1))); + if (($truthy(term_text['$start_with?']("[[")) && ($truthy($$('LeadingInlineAnchorRx')['$=~'](term_text))))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), ($truthy(($ret_or_1 = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) ? ($ret_or_1) : ((($a = $gvars['~']) === nil ? nil : $a.$post_match()).$lstrip())), list_term, reader); + } if ($truthy((item_text = match['$[]'](3)))) { + has_text = true; + } list_item = $$('ListItem').$new(list_block, item_text); + if ($truthy(list_block.$document().$sourcemap())) { + + list_term['$source_location='](reader.$cursor()); + if ($truthy(has_text)) { + list_item['$source_location='](list_term.$source_location()); + } else { + sourcemap_assignment_deferred = true; + } } } else { + + has_text = true; + list_item = $$('ListItem').$new(list_block, (item_text = match['$[]'](2))); + if ($truthy(list_block.$document().$sourcemap())) { + list_item['$source_location='](reader.$cursor()); + } + switch (list_type) { + case "ulist": + + list_item['$marker='](sibling_trait); + if ($truthy(item_text['$start_with?']("["))) { + if (($truthy(style) && ($eqeq(style, "bibliography")))) { + if ($truthy($$('InlineBiblioAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_biblio_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader); + } + } else if ($truthy(item_text['$start_with?']("[["))) { + if ($truthy($$('LeadingInlineAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader); + } + } else if ($truthy(item_text['$start_with?']("[ ] ", "[x] ", "[*] "))) { + + list_block.$set_option("checklist"); + list_item.$attributes()['$[]=']("checkbox", ""); + if (!$truthy(item_text['$start_with?']("[ "))) { + list_item.$attributes()['$[]=']("checked", ""); + } list_item['$text='](item_text.$slice(4, item_text.$length())); + } + } break; + case "olist": + + $b = self.$resolve_ordered_list_marker(sibling_trait, (ordinal = list_block.$items().$size()), true, reader), $a = $to_ary($b), (sibling_trait = ($a[0] == null ? nil : $a[0])), (implicit_style = ($a[1] == null ? nil : $a[1])); + list_item['$marker='](sibling_trait); + if (($eqeq(ordinal, 0) && ($not(style)))) { + list_block['$style='](($truthy(($ret_or_2 = implicit_style)) ? ($ret_or_2) : (($truthy(($ret_or_3 = $$('ORDERED_LIST_STYLES')['$[]']($rb_minus(sibling_trait.$length(), 1)))) ? ($ret_or_3) : ("arabic")).$to_s()))); + } if (($truthy(item_text['$start_with?']("[[")) && ($truthy($$('LeadingInlineAnchorRx')['$=~'](item_text))))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader); + } break; + default: + + list_item['$marker='](sibling_trait); + if (($truthy(item_text['$start_with?']("[[")) && ($truthy($$('LeadingInlineAnchorRx')['$=~'](item_text))))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader); + } } } reader.$shift(); + block_cursor = reader.$cursor(); + list_item_reader = $$('Reader').$new(self.$read_lines_for_list_item(reader, list_type, sibling_trait, has_text), block_cursor); + if ($truthy(list_item_reader['$has_more_lines?']())) { + + if ($truthy(sourcemap_assignment_deferred)) { + list_item['$source_location='](block_cursor); + } comment_lines = list_item_reader.$skip_line_comments(); + if ($truthy((subsequent_line = list_item_reader.$peek_line()))) { + + if (!$truthy(comment_lines['$empty?']())) { + list_item_reader.$unshift_lines(comment_lines); + } if (!$truthy(subsequent_line['$empty?']())) { + + content_adjacent = true; + if (!$truthy(dlist)) { + has_text = nil; + } } } if ($truthy((block = self.$next_block(list_item_reader, list_item, $hash2([], {}), $hash2(["text_only", "list_type"], {"text_only": ($truthy(has_text) ? (nil) : (true)), "list_type": list_type}))))) { + list_item.$blocks()['$<<'](block); + } while ($truthy(list_item_reader['$has_more_lines?']())) { + if ($truthy((block = self.$next_block(list_item_reader, list_item, $hash2([], {}), $hash2(["list_type"], {"list_type": list_type}))))) { + list_item.$blocks()['$<<'](block); + } + } if ((($truthy(content_adjacent) && ($truthy((first_block = list_item.$blocks()['$[]'](0))))) && ($eqeq(first_block.$context(), "paragraph")))) { + list_item.$fold_first(); + } } if ($truthy(dlist)) { + return [[list_term], (($truthy(list_item['$text?']()) || ($truthy(list_item['$blocks?']()))) ? (list_item) : (nil))] + } else { + return list_item + } }, -5); + $defs(self, '$read_lines_for_list_item', function $$read_lines_for_list_item(reader, list_type, sibling_trait, has_text) { + var $a, self = this, buffer = nil, continuation = nil, within_nested_list = nil, detached_continuation = nil, dlist = nil, this_line = nil, prev_line = nil, match = nil, block_attribute_lines = nil, next_line = nil, interrupt = nil, ch0 = nil, nested_list_type = nil, $ret_or_1 = nil, last_line = nil; + + + if (sibling_trait == null) sibling_trait = nil; + if (has_text == null) has_text = true; + buffer = []; + continuation = "inactive"; + within_nested_list = false; + detached_continuation = nil; + dlist = list_type['$==']("dlist"); + while ($truthy(reader['$has_more_lines?']())) { + + this_line = reader.$read_line(); + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break + } prev_line = ($truthy(buffer['$empty?']()) ? (nil) : (buffer['$[]'](-1))); + if ($eqeq(prev_line, $$('LIST_CONTINUATION'))) { + + if ($eqeq(continuation, "inactive")) { + + continuation = "active"; + has_text = true; + if (!$truthy(within_nested_list)) { + buffer['$[]='](-1, ""); + } } if ($eqeq(this_line, $$('LIST_CONTINUATION'))) { + + if ($neqeq(continuation, "frozen")) { + + continuation = "frozen"; + buffer['$<<'](this_line); + } this_line = nil; + continue; + } } if ($truthy((match = self['$is_delimited_block?'](this_line, true)))) { + + if (!$eqeq(continuation, "active")) { + break + } buffer['$<<'](this_line); + buffer.$concat(reader.$read_lines_until($hash2(["terminator", "read_last_line", "context"], {"terminator": match.$terminator(), "read_last_line": true, "context": nil}))); + continuation = "inactive"; + } else if (((($truthy(dlist) && ($neqeq(continuation, "active"))) && ($truthy(this_line['$start_with?']("[")))) && ($truthy($$('BlockAttributeLineRx')['$match?'](this_line))))) { + + block_attribute_lines = [this_line]; + while ($truthy((next_line = reader.$peek_line()))) { + + if ($truthy(self['$is_delimited_block?'](next_line))) { + interrupt = true; + } else if (($truthy(next_line['$empty?']()) || (($truthy(next_line['$start_with?']("[")) && ($truthy($$('BlockAttributeLineRx')['$match?'](next_line))))))) { + + block_attribute_lines['$<<'](reader.$read_line()); + continue; + } else if (($truthy($$('AnyListRx')['$match?'](next_line)) && ($not(self['$is_sibling_list_item?'](next_line, list_type, sibling_trait))))) { + buffer.$concat(block_attribute_lines); + } else { + interrupt = true; + } break; + } if ($truthy(interrupt)) { + + reader.$unshift_lines(block_attribute_lines); + break; + } } else if (($eqeq(continuation, "active") && ($not(this_line['$empty?']())))) { + if ($truthy($$('LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + if ($truthy(dlist)) { + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], function $$12(line){var self = $$12.$$s == null ? this : $$12.$$s; + + + if (line == null) line = nil; + return self['$is_sibling_list_item?'](line, list_type, sibling_trait);}, {$$s: self})); + } else { + buffer.$concat(reader.$read_lines_until($hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true}))); + } continuation = "inactive"; + } else if (((($eqeq((ch0 = this_line.$chr()), ".") && ($truthy($$('BlockTitleRx')['$match?'](this_line)))) || (($eqeq(ch0, "[") && ($truthy($$('BlockAttributeLineRx')['$match?'](this_line)))))) || (($eqeq(ch0, ":") && ($truthy($$('AttributeEntryRx')['$match?'](this_line))))))) { + buffer['$<<'](this_line); + } else { + + if ($truthy((nested_list_type = $send(($truthy(within_nested_list) ? (["dlist"]) : ($$('NESTABLE_LIST_CONTEXTS'))), 'find', [], function $$13(ctx){ + + if (ctx == null) ctx = nil; + return $$('ListRxMap')['$[]'](ctx)['$match?'](this_line);})))) { + + within_nested_list = true; + if (($eqeq(nested_list_type, "dlist") && ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3))['$nil_or_empty?']())))) { + has_text = false; + } } buffer['$<<'](this_line); + continuation = "inactive"; + } + } else if (($truthy(prev_line) && ($truthy(prev_line['$empty?']())))) { + + if ($truthy(this_line['$empty?']())) { + + if (!$truthy((this_line = ($truthy(($ret_or_1 = reader.$skip_blank_lines())) ? (reader.$read_line()) : ($ret_or_1))))) { + break + } if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break + } } if ($eqeq(this_line, $$('LIST_CONTINUATION'))) { + + detached_continuation = buffer.$size(); + buffer['$<<'](this_line); + } else if ($truthy(has_text)) { + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break + } else if ($truthy((nested_list_type = $send($$('NESTABLE_LIST_CONTEXTS'), 'find', [], function $$14(ctx){ + + if (ctx == null) ctx = nil; + return $$('ListRxMap')['$[]'](ctx)['$=~'](this_line);})))) { + + buffer['$<<'](this_line); + within_nested_list = true; + if (($eqeq(nested_list_type, "dlist") && ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3))['$nil_or_empty?']())))) { + has_text = false; + } } else if ($truthy($$('LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + if ($truthy(dlist)) { + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], function $$15(line){var self = $$15.$$s == null ? this : $$15.$$s; + + + if (line == null) line = nil; + return self['$is_sibling_list_item?'](line, list_type, sibling_trait);}, {$$s: self})); + } else { + buffer.$concat(reader.$read_lines_until($hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true}))); + } } else { + break + } + } else { + + if (!$truthy(within_nested_list)) { + buffer.$pop(); + } buffer['$<<'](this_line); + has_text = true; + } } else { + + if (!$truthy(this_line['$empty?']())) { + has_text = true; + } if ($truthy((nested_list_type = $send(($truthy(within_nested_list) ? (["dlist"]) : ($$('NESTABLE_LIST_CONTEXTS'))), 'find', [], function $$16(ctx){ + + if (ctx == null) ctx = nil; + return $$('ListRxMap')['$[]'](ctx)['$=~'](this_line);})))) { + + within_nested_list = true; + if (($eqeq(nested_list_type, "dlist") && ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3))['$nil_or_empty?']())))) { + has_text = false; + } } buffer['$<<'](this_line); + } this_line = nil; + } if ($truthy(this_line)) { + reader.$unshift_line(this_line); + } if ($truthy(detached_continuation)) { + buffer['$[]='](detached_continuation, ""); + } while (!($truthy(buffer['$empty?']()))) { + if ($truthy((last_line = buffer['$[]'](-1))['$empty?']())) { + buffer.$pop(); + } else { + + if ($eqeq(last_line, $$('LIST_CONTINUATION'))) { + buffer.$pop(); + } break; + } + } return buffer; + }, -3); + $defs(self, '$initialize_section', function $$initialize_section(reader, parent, attributes) { + var $a, $b, self = this, document = nil, book = nil, doctype = nil, source_location = nil, sect_style = nil, sect_id = nil, sect_reftext = nil, sect_title = nil, sect_level = nil, sect_atx = nil, sect_name = nil, sect_special = nil, sect_numbered = nil, section = nil, $ret_or_1 = nil, id = nil, generated_id = nil; + + + if (attributes == null) attributes = $hash2([], {}); + document = parent.$document(); + book = (doctype = document.$doctype())['$==']("book"); + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor(); + } sect_style = attributes['$[]'](1); + $b = self.$parse_section_title(reader, document, attributes['$[]']("id")), $a = $to_ary($b), (sect_id = ($a[0] == null ? nil : $a[0])), (sect_reftext = ($a[1] == null ? nil : $a[1])), (sect_title = ($a[2] == null ? nil : $a[2])), (sect_level = ($a[3] == null ? nil : $a[3])), (sect_atx = ($a[4] == null ? nil : $a[4])); + if ($truthy(sect_style)) { + if (($truthy(book) && ($eqeq(sect_style, "abstract")))) { + $a = ["chapter", 1], (sect_name = $a[0]), (sect_level = $a[1]); + } else if (($truthy(sect_style['$start_with?']("sect")) && ($truthy($$('SectionLevelStyleRx')['$match?'](sect_style))))) { + sect_name = "section"; + } else { + + $a = [sect_style, true], (sect_name = $a[0]), (sect_special = $a[1]); + if ($eqeq(sect_level, 0)) { + sect_level = 1; + } sect_numbered = sect_name['$==']("appendix"); + } + } else if ($truthy(book)) { + sect_name = ($eqeq(sect_level, 0) ? ("part") : (($truthy($rb_gt(sect_level, 1)) ? ("section") : ("chapter")))); + } else if (($eqeq(doctype, "manpage") && ($eqeq(sect_title.$casecmp("synopsis"), 0)))) { + $a = ["synopsis", true], (sect_name = $a[0]), (sect_special = $a[1]); + } else { + sect_name = "section"; + } if ($truthy(sect_reftext)) { + attributes['$[]=']("reftext", sect_reftext); + } section = $$('Section').$new(parent, sect_level); + $a = [sect_id, sect_title, sect_name, source_location], ($b = [$a[0]], $send(section, 'id=', $b), $b[$b.length - 1]), ($b = [$a[1]], $send(section, 'title=', $b), $b[$b.length - 1]), ($b = [$a[2]], $send(section, 'sectname=', $b), $b[$b.length - 1]), ($b = [$a[3]], $send(section, 'source_location=', $b), $b[$b.length - 1]); + if ($truthy(sect_special)) { + + section['$special='](true); + if ($truthy(sect_numbered)) { + section['$numbered='](true); + } else if ($eqeq(document.$attributes()['$[]']("sectnums"), "all")) { + section['$numbered=']((($truthy(book) && ($eqeq(sect_level, 1))) ? ("chapter") : (true))); + } } else if (($truthy(document.$attributes()['$[]']("sectnums")) && ($truthy($rb_gt(sect_level, 0))))) { + section['$numbered='](($truthy(section.$special()) ? (($truthy(($ret_or_1 = parent.$numbered())) || ($ret_or_1))) : (true))); + } else if ((($truthy(book) && ($eqeq(sect_level, 0))) && ($truthy(document.$attributes()['$[]']("partnums"))))) { + section['$numbered='](true); + } if ($truthy((id = ($truthy(($ret_or_1 = section.$id())) ? ($ret_or_1) : (($a = [($truthy(document.$attributes()['$key?']("sectids")) ? ((generated_id = $$('Section').$generate_id(section.$title(), document))) : (nil))], $send(section, 'id=', $a), $a[$a.length - 1])))))) { + + if (!($truthy(generated_id) || ($not(sect_title['$include?']($$('ATTR_REF_HEAD')))))) { + section.$title(); + } if (!$truthy(document.$register("refs", [id, section]))) { + self.$logger().$warn(self.$message_with_context("id assigned to section already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor_at_line($rb_minus(reader.$lineno(), ($truthy(sect_atx) ? (1) : (2))))}))); + } } section.$update_attributes(attributes); + reader.$skip_blank_lines(); + return section; + }, -3); + $defs(self, '$is_next_line_section?', function $Parser_is_next_line_section$ques$17(reader, attributes) { + var self = this, style = nil, next_lines = nil, $ret_or_1 = nil; + + + if (($truthy((style = attributes['$[]'](1))) && (($eqeq(style, "discrete") || ($eqeq(style, "float")))))) { + return nil + } if ($truthy($$('Compliance').$underline_style_section_titles())) { + + next_lines = reader.$peek_lines(2, ($truthy(($ret_or_1 = style)) ? (style['$==']("comment")) : ($ret_or_1))); + return self['$is_section_title?'](($truthy(($ret_or_1 = next_lines['$[]'](0))) ? ($ret_or_1) : ("")), next_lines['$[]'](1)); + } else { + return self['$atx_section_title?'](($truthy(($ret_or_1 = reader.$peek_line())) ? ($ret_or_1) : (""))) + } }); + $defs(self, '$is_next_line_doctitle?', function $Parser_is_next_line_doctitle$ques$18(reader, attributes, leveloffset) { + var self = this, $ret_or_1 = nil, sect_level = nil; + + if ($truthy(leveloffset)) { + if ($truthy(($ret_or_1 = (sect_level = self['$is_next_line_section?'](reader, attributes))))) { + + return $rb_plus(sect_level, leveloffset.$to_i())['$=='](0); + } else { + return $ret_or_1 + } + } else { + return self['$is_next_line_section?'](reader, attributes)['$=='](0) + } + }); + $defs(self, '$is_section_title?', function $Parser_is_section_title$ques$19(line1, line2) { + var self = this, $ret_or_1 = nil; + + + if (line2 == null) line2 = nil; + if ($truthy(($ret_or_1 = self['$atx_section_title?'](line1)))) { + return $ret_or_1 + } else { + + if ($truthy(line2['$nil_or_empty?']())) { + return nil + } else { + return self['$setext_section_title?'](line1, line2) + } } }, -2); + $defs(self, '$atx_section_title?', function $Parser_atx_section_title$ques$20(line) { + var $a, $ret_or_1 = nil; + + if ($truthy(($truthy($$('Compliance').$markdown_syntax()) ? (($truthy(($ret_or_1 = line['$start_with?']("=", "#"))) ? ($$('ExtAtxSectionTitleRx')['$=~'](line)) : ($ret_or_1))) : (($truthy(($ret_or_1 = line['$start_with?']("="))) ? ($$('AtxSectionTitleRx')['$=~'](line)) : ($ret_or_1)))))) { + return $rb_minus((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$length(), 1) + } else { + return nil + } + }); + $defs(self, '$setext_section_title?', function $Parser_setext_section_title$ques$21(line1, line2) { + var self = this, line2_len = nil, level = nil, line2_ch0 = nil; + + if (((($truthy((level = $$('SETEXT_SECTION_LEVELS')['$[]']((line2_ch0 = line2.$chr())))) && ($truthy(self['$uniform?'](line2, line2_ch0, (line2_len = line2.$length()))))) && ($truthy($$('SetextSectionTitleRx')['$match?'](line1)))) && ($truthy($rb_lt($rb_minus(line1.$length(), line2_len).$abs(), 2))))) { + return level + } else { + return nil + } + }); + $defs(self, '$parse_section_title', function $$parse_section_title(reader, document, sect_id) { + var $a, $b, self = this, sect_reftext = nil, line1 = nil, $ret_or_1 = nil, sect_level = nil, sect_title = nil, atx = nil, line2_len = nil, line2_ch0 = nil, line2 = nil; + + + if (sect_id == null) sect_id = nil; + sect_reftext = nil; + line1 = reader.$read_line(); + if ($truthy(($truthy($$('Compliance').$markdown_syntax()) ? (($truthy(($ret_or_1 = line1['$start_with?']("=", "#"))) ? ($$('ExtAtxSectionTitleRx')['$=~'](line1)) : ($ret_or_1))) : (($truthy(($ret_or_1 = line1['$start_with?']("="))) ? ($$('AtxSectionTitleRx')['$=~'](line1)) : ($ret_or_1)))))) { + + $a = [$rb_minus((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)).$length(), 1), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), true], (sect_level = $a[0]), (sect_title = $a[1]), (atx = $a[2]); + if (!$truthy(sect_id)) { + if ((($truthy(sect_title['$end_with?']("]]")) && ($truthy($$('InlineSectionAnchorRx')['$=~'](sect_title)))) && ($not((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]); + } + } } else if (((((($truthy($$('Compliance').$underline_style_section_titles()) && ($truthy((line2 = reader.$peek_line(true))))) && ($truthy((sect_level = $$('SETEXT_SECTION_LEVELS')['$[]']((line2_ch0 = line2.$chr())))))) && ($truthy(self['$uniform?'](line2, line2_ch0, (line2_len = line2.$length()))))) && ($truthy((sect_title = ($truthy(($ret_or_1 = $$('SetextSectionTitleRx')['$=~'](line1))) ? ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) : ($ret_or_1)))))) && ($truthy($rb_lt($rb_minus(line1.$length(), line2_len).$abs(), 2))))) { + + atx = false; + if (!$truthy(sect_id)) { + if ((($truthy(sect_title['$end_with?']("]]")) && ($truthy($$('InlineSectionAnchorRx')['$=~'](sect_title)))) && ($not((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]); + } + } reader.$shift(); + } else { + self.$raise("Unrecognized section at " + (reader.$cursor_at_prev_line())); + } if ($truthy(document['$attr?']("leveloffset"))) { + + sect_level = $rb_plus(sect_level, document.$attr("leveloffset").$to_i()); + if ($truthy($rb_lt(sect_level, 0))) { + sect_level = 0; + } } return [sect_id, sect_reftext, sect_title, sect_level, atx]; + }, -3); + $defs(self, '$parse_header_metadata', function $$parse_header_metadata(reader, document, retrieve) { + var $a, self = this, doc_attrs = nil, $ret_or_1 = nil, authorcount = nil, implicit_author_metadata = nil, implicit_author = nil, implicit_authorinitials = nil, implicit_authors = nil, rev_line = nil, match = nil, rev_metadata = nil, component = nil, author_line = nil, author_metadata = nil, authors = nil, author_idx = nil, author_key = nil, explicit = nil, sparse = nil, author_override = nil; + + + if (document == null) document = nil; + if (retrieve == null) retrieve = true; + doc_attrs = ($truthy(($ret_or_1 = document)) ? (document.$attributes()) : ($ret_or_1)); + self.$process_attribute_entries(reader, document); + if (($truthy(reader['$has_more_lines?']()) && ($not(reader['$next_line_empty?']())))) { + + authorcount = (implicit_author_metadata = self.$process_authors(reader.$read_line())).$delete("authorcount"); + if (($truthy(document) && ($truthy($rb_gt(($a = ["authorcount", authorcount], $send(doc_attrs, '[]=', $a), $a[$a.length - 1]), 0))))) { + + $send(implicit_author_metadata, 'each', [], function $$22(key, val){var $b; + + + if (key == null) key = nil; + if (val == null) val = nil; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + return ($b = [key, document.$apply_header_subs(val)], $send(doc_attrs, '[]=', $b), $b[$b.length - 1]) + }}); + implicit_author = doc_attrs['$[]']("author"); + implicit_authorinitials = doc_attrs['$[]']("authorinitials"); + implicit_authors = doc_attrs['$[]']("authors"); + } implicit_author_metadata['$[]=']("authorcount", authorcount); + self.$process_attribute_entries(reader, document); + if (($truthy(reader['$has_more_lines?']()) && ($not(reader['$next_line_empty?']())))) { + + rev_line = reader.$read_line(); + if ($truthy((match = $$('RevisionInfoLineRx').$match(rev_line)))) { + + rev_metadata = $hash2([], {}); + if ($truthy(match['$[]'](1))) { + rev_metadata['$[]=']("revnumber", match['$[]'](1).$rstrip()); + } if (!$truthy((component = match['$[]'](2).$strip())['$empty?']())) { + if (($not(match['$[]'](1)) && ($truthy(component['$start_with?']("v"))))) { + rev_metadata['$[]=']("revnumber", component.$slice(1, component.$length())); + } else { + rev_metadata['$[]=']("revdate", component); + } + } if ($truthy(match['$[]'](3))) { + rev_metadata['$[]=']("revremark", match['$[]'](3).$rstrip()); + } if (($truthy(document) && ($not(rev_metadata['$empty?']())))) { + $send(rev_metadata, 'each', [], function $$23(key, val){var $b; + + + if (key == null) key = nil; + if (val == null) val = nil; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + return ($b = [key, document.$apply_header_subs(val)], $send(doc_attrs, '[]=', $b), $b[$b.length - 1]) + }}); + } } else { + reader.$unshift_line(rev_line); + } } self.$process_attribute_entries(reader, document); + reader.$skip_blank_lines(); + } else { + implicit_author_metadata = $hash2([], {}); + } if ($truthy(document)) { + + if (($truthy(doc_attrs['$key?']("author")) && ($neqeq((author_line = doc_attrs['$[]']("author")), implicit_author)))) { + + author_metadata = self.$process_authors(author_line, true, false); + if ($neqeq(doc_attrs['$[]']("authorinitials"), implicit_authorinitials)) { + author_metadata.$delete("authorinitials"); + } } else if (($truthy(doc_attrs['$key?']("authors")) && ($neqeq((author_line = doc_attrs['$[]']("authors")), implicit_authors)))) { + author_metadata = self.$process_authors(author_line, true); + } else { + + $a = [[], 1, "author_1", false, false], (authors = $a[0]), (author_idx = $a[1]), (author_key = $a[2]), (explicit = $a[3]), (sparse = $a[4]); + while ($truthy(doc_attrs['$key?'](author_key))) { + + if ($eqeq((author_override = doc_attrs['$[]'](author_key)), implicit_author_metadata['$[]'](author_key))) { + + authors['$<<'](nil); + sparse = true; + } else { + + authors['$<<'](author_override); + explicit = true; + } author_key = "author_" + ((author_idx = $rb_plus(author_idx, 1))); + } if ($truthy(explicit)) { + + if ($truthy(sparse)) { + $send(authors, 'each_with_index', [], function $$24(author, idx){var $b, name_idx = nil; + + + if (author == null) author = nil; + if (idx == null) idx = nil; + if ($truthy(author)) { + return nil + } return ($b = [idx, $send([implicit_author_metadata['$[]']("firstname_" + ((name_idx = $rb_plus(idx, 1)))), implicit_author_metadata['$[]']("middlename_" + (name_idx)), implicit_author_metadata['$[]']("lastname_" + (name_idx))].$compact(), 'map', [], function $$25(it){ + + if (it == null) it = nil; + return it.$tr(" ", "_");}).$join(" ")], $send(authors, '[]=', $b), $b[$b.length - 1]);}); + } author_metadata = self.$process_authors(authors, true, false); + } else { + author_metadata = $hash2(["authorcount"], {"authorcount": 0}); + } } if ($eqeq(author_metadata['$[]']("authorcount"), 0)) { + if ($truthy(authorcount)) { + author_metadata = nil; + } else { + doc_attrs['$[]=']("authorcount", 0); + } + } else { + + doc_attrs.$update(author_metadata); + if (($not(doc_attrs['$key?']("email")) && ($truthy(doc_attrs['$key?']("email_1"))))) { + doc_attrs['$[]=']("email", doc_attrs['$[]']("email_1")); + } } } if ($truthy(retrieve)) { + return implicit_author_metadata.$merge(rev_metadata.$to_h(), author_metadata.$to_h()) + } else { + return nil + } }, -2); + $defs(self, '$process_authors', function $$process_authors(author_line, names_only, multiple) { + var author_metadata = nil, author_idx = nil; + + + if (names_only == null) names_only = false; + if (multiple == null) multiple = true; + author_metadata = $hash2([], {}); + author_idx = 0; + $send((($truthy(multiple) && ($truthy(author_line['$include?'](";")))) ? (author_line.$split($$('AuthorDelimiterRx'))) : ([].concat($to_a(author_line)))), 'each', [], function $$26(author_entry){var $a, key_map = nil, segments = nil, match = nil, author = nil, fname = nil, mname = nil, lname = nil; + + + if (author_entry == null) author_entry = nil; + if ($truthy(author_entry['$empty?']())) { + return nil + } key_map = $hash2([], {}); + if ($eqeq((author_idx = $rb_plus(author_idx, 1)), 1)) { + $send($$('AuthorKeys'), 'each', [], function $$27(key){var $a; + + + if (key == null) key = nil; + return ($a = [key.$to_sym(), key], $send(key_map, '[]=', $a), $a[$a.length - 1]);}); + } else { + $send($$('AuthorKeys'), 'each', [], function $$28(key){var $a; + + + if (key == null) key = nil; + return ($a = [key.$to_sym(), "" + (key) + "_" + (author_idx)], $send(key_map, '[]=', $a), $a[$a.length - 1]);}); + } if ($truthy(names_only)) { + + if ($truthy(author_entry['$include?']("<"))) { + + author_metadata['$[]='](key_map['$[]']("author"), author_entry.$tr("_", " ")); + author_entry = author_entry.$gsub($$('XmlSanitizeRx'), ""); + } if ($eqeq((segments = author_entry.$split(nil, 3)).$size(), 3)) { + segments['$<<'](segments.$pop().$squeeze(" ")); + } } else if ($truthy((match = $$('AuthorInfoLineRx').$match(author_entry)))) { + (segments = match.$to_a()).$shift(); + } if ($truthy(segments)) { + + author = ($a = [key_map['$[]']("firstname"), (fname = segments['$[]'](0).$tr("_", " "))], $send(author_metadata, '[]=', $a), $a[$a.length - 1]); + author_metadata['$[]='](key_map['$[]']("authorinitials"), fname.$chr()); + if ($truthy(segments['$[]'](1))) { + if ($truthy(segments['$[]'](2))) { + + author_metadata['$[]='](key_map['$[]']("middlename"), (mname = segments['$[]'](1).$tr("_", " "))); + author_metadata['$[]='](key_map['$[]']("lastname"), (lname = segments['$[]'](2).$tr("_", " "))); + author = $rb_plus($rb_plus($rb_plus($rb_plus(fname, " "), mname), " "), lname); + author_metadata['$[]='](key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (mname.$chr()) + (lname.$chr())); + } else { + + author_metadata['$[]='](key_map['$[]']("lastname"), (lname = segments['$[]'](1).$tr("_", " "))); + author = $rb_plus($rb_plus(fname, " "), lname); + author_metadata['$[]='](key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (lname.$chr())); + } + } if ($truthy((author_metadata['$[]'](key_map['$[]']("author"))))) ; else { + author_metadata['$[]='](key_map['$[]']("author"), author); + } if (!($truthy(names_only) || ($not(segments['$[]'](3))))) { + author_metadata['$[]='](key_map['$[]']("email"), segments['$[]'](3)); + } } else { + + author_metadata['$[]='](key_map['$[]']("author"), ($a = [key_map['$[]']("firstname"), (fname = author_entry.$squeeze(" ").$strip())], $send(author_metadata, '[]=', $a), $a[$a.length - 1])); + author_metadata['$[]='](key_map['$[]']("authorinitials"), fname.$chr()); + } if ($eqeq(author_idx, 1)) { + return ($a = ["authors", author_metadata['$[]'](key_map['$[]']("author"))], $send(author_metadata, '[]=', $a), $a[$a.length - 1]) + } else { + + if ($eqeq(author_idx, 2)) { + $send($$('AuthorKeys'), 'each', [], function $$29(key){var $b; + + + if (key == null) key = nil; + if ($truthy(author_metadata['$key?'](key))) { + return ($b = ["" + (key) + "_1", author_metadata['$[]'](key)], $send(author_metadata, '[]=', $b), $b[$b.length - 1]) + } else { + return nil + }}); + } return ($a = ["authors", "" + (author_metadata['$[]']("authors")) + ", " + (author_metadata['$[]'](key_map['$[]']("author")))], $send(author_metadata, '[]=', $a), $a[$a.length - 1]); + }}); + author_metadata['$[]=']("authorcount", author_idx); + return author_metadata; + }, -2); + $defs(self, '$parse_block_metadata_lines', function $$parse_block_metadata_lines(reader, document, attributes, options) { + var self = this; + + + if (attributes == null) attributes = $hash2([], {}); + if (options == null) options = $hash2([], {}); + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + if ($truthy((reader.$skip_blank_lines()))) ; else { + break + } } return attributes; + }, -3); + $defs(self, '$parse_block_metadata_line', function $$parse_block_metadata_line(reader, document, attributes, options) { + var $a, self = this, normal = nil, next_line = nil, reftext = nil, current_style = nil, $ret_or_1 = nil, ll = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + if (options == null) options = $hash2([], {}); + if (($truthy((next_line = reader.$peek_line())) && ($truthy(($truthy(options['$[]']("text_only")) ? (next_line['$start_with?']("[", "/")) : ((normal = next_line['$start_with?']("[", ".", "/", ":")))))))) { + if ($truthy(next_line['$start_with?']("["))) { + if ($truthy(next_line['$start_with?']("[["))) { + if (($truthy(next_line['$end_with?']("]]")) && ($truthy($$('BlockAnchorRx')['$=~'](next_line))))) { + + attributes['$[]=']("id", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))); + if ($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) { + attributes['$[]=']("reftext", ($truthy(reftext['$include?']($$('ATTR_REF_HEAD'))) ? (document.$sub_attributes(reftext)) : (reftext))); + } return true; + } + } else if (($truthy(next_line['$end_with?']("]")) && ($truthy($$('BlockAttributeListRx')['$=~'](next_line))))) { + + current_style = attributes['$[]'](1); + if ($truthy(document.$parse_attributes((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), [], $hash2(["sub_input", "sub_result", "into"], {"sub_input": true, "sub_result": true, "into": attributes}))['$[]'](1))) { + attributes['$[]='](1, ($truthy(($ret_or_1 = self.$parse_style_attribute(attributes, reader))) ? ($ret_or_1) : (current_style))); + } return true; + } + } else if (($truthy(normal) && ($truthy(next_line['$start_with?']("."))))) { + if ($truthy($$('BlockTitleRx')['$=~'](next_line))) { + + attributes['$[]=']("title", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))); + return true; + } + } else if (($not(normal) || ($truthy(next_line['$start_with?']("/"))))) { + if ($truthy(next_line['$start_with?']("//"))) { + if ($eqeq(next_line, "//")) { + return true + } else if (($truthy(normal) && ($truthy(self['$uniform?'](next_line, "/", (ll = next_line.$length())))))) { + if (!$eqeq(ll, 3)) { + + reader.$read_lines_until($hash2(["terminator", "skip_first_line", "preserve_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "preserve_last_line": true, "skip_processing": true, "context": "comment"})); + return true; + } + } else if (!$truthy(next_line['$start_with?']("///"))) { + return true + } + } + } else if ((($truthy(normal) && ($truthy(next_line['$start_with?'](":")))) && ($truthy($$('AttributeEntryRx')['$=~'](next_line))))) { + + self.$process_attribute_entry(reader, document, attributes, $gvars["~"]); + return true; + } + } return nil; + }, -4); + $defs(self, '$process_attribute_entries', function $$process_attribute_entries(reader, document, attributes) { + var self = this; + + + if (attributes == null) attributes = nil; + reader.$skip_comment_lines(); + while ($truthy(self.$process_attribute_entry(reader, document, attributes))) { + + reader.$shift(); + reader.$skip_comment_lines(); + } }, -3); + $defs(self, '$process_attribute_entry', function $$process_attribute_entry(reader, document, attributes, match) { + var $a, self = this, value = nil, con = nil, $ret_or_1 = nil, next_line = nil, $ret_or_2 = nil, keep_open = nil; + + + if (attributes == null) attributes = nil; + if (match == null) match = nil; + if (($truthy(match) || ($truthy((match = ($truthy(reader['$has_more_lines?']()) ? ($$('AttributeEntryRx').$match(reader.$peek_line())) : (nil))))))) { + + if ($truthy((value = match['$[]'](2))['$nil_or_empty?']())) { + value = ""; + } else if ($truthy(value['$end_with?']($$('LINE_CONTINUATION'), $$('LINE_CONTINUATION_LEGACY')))) { + + $a = [value.$slice($rb_minus(value.$length(), 2), 2), value.$slice(0, $rb_minus(value.$length(), 2)).$rstrip()], (con = $a[0]), (value = $a[1]); + while ($truthy(($truthy(($ret_or_1 = reader.$advance())) ? ((next_line = ($truthy(($ret_or_2 = reader.$peek_line())) ? ($ret_or_2) : ("")))['$empty?']()['$!']()) : ($ret_or_1)))) { + + next_line = next_line.$lstrip(); + if ($truthy((keep_open = next_line['$end_with?'](con)))) { + next_line = next_line.$slice(0, $rb_minus(next_line.$length(), 2)).$rstrip(); + } value = "" + (value) + (($truthy(value['$end_with?']($$('HARD_LINE_BREAK'))) ? ($$('LF')) : (" "))) + (next_line); + if (!$truthy(keep_open)) { + break + } } } self.$store_attribute(match['$[]'](1), value, document, attributes); + return true; + } else { + return nil + } }, -3); + $defs(self, '$store_attribute', function $$store_attribute(name, value, doc, attrs) { + var self = this, resolved_value = nil; + + + if (doc == null) doc = nil; + if (attrs == null) attrs = nil; + if ($truthy(name['$end_with?']("!"))) { + + name = name.$chop(); + value = nil; + } else if ($truthy(name['$start_with?']("!"))) { + + name = name.$slice(1, name.$length()); + value = nil; + } if ($eqeq((name = self.$sanitize_attribute_name(name)), "numbered")) { + name = "sectnums"; + } else if ($eqeq(name, "hardbreaks")) { + name = "hardbreaks-option"; + } else if ($eqeq(name, "showtitle")) { + self.$store_attribute("notitle", ($truthy(value) ? (nil) : ("")), doc, attrs); + } if ($truthy(doc)) { + if ($truthy(value)) { + + if ($eqeq(name, "leveloffset")) { + if ($truthy(value['$start_with?']("+"))) { + value = $rb_plus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s(); + } else if ($truthy(value['$start_with?']("-"))) { + value = $rb_minus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s(); + } + } if ($truthy((resolved_value = doc.$set_attribute(name, value)))) { + + value = resolved_value; + if ($truthy(attrs)) { + $$$($$('Document'), 'AttributeEntry').$new(name, value).$save_to(attrs); + } } } else if (($truthy(doc.$delete_attribute(name)) && ($truthy(attrs)))) { + $$$($$('Document'), 'AttributeEntry').$new(name, value).$save_to(attrs); + } + } else if ($truthy(attrs)) { + $$$($$('Document'), 'AttributeEntry').$new(name, value).$save_to(attrs); + } return [name, value]; + }, -3); + $defs(self, '$resolve_list_marker', function $$resolve_list_marker(list_type, marker, ordinal, validate, reader) { + var self = this; + + + if (ordinal == null) ordinal = 0; + if (validate == null) validate = false; + if (reader == null) reader = nil; + + switch (list_type) { + case "ulist": + return marker + case "olist": + return self.$resolve_ordered_list_marker(marker, ordinal, validate, reader)['$[]'](0) + default: + return "<1>" + } }, -3); + $defs(self, '$resolve_ordered_list_marker', function $$resolve_ordered_list_marker(marker, ordinal, validate, reader) { + var self = this, style = nil, expected = nil, actual = nil; + + + if (ordinal == null) ordinal = 0; + if (validate == null) validate = false; + if (reader == null) reader = nil; + if ($truthy(marker['$start_with?']("."))) { + return [marker] + } + switch ((style = $send($$('ORDERED_LIST_STYLES'), 'find', [], function $$30(s){ + + if (s == null) s = nil; + return $$('OrderedListMarkerRxMap')['$[]'](s)['$match?'](marker);}))) { + case "arabic": + + if ($truthy(validate)) { + + expected = $rb_plus(ordinal, 1); + actual = marker.$to_i(); + } marker = "1."; + break; + case "loweralpha": + + if ($truthy(validate)) { + + expected = $rb_plus("a"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop(); + } marker = "a."; + break; + case "upperalpha": + + if ($truthy(validate)) { + + expected = $rb_plus("A"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop(); + } marker = "A."; + break; + case "lowerroman": + + if ($truthy(validate)) { + + expected = $$('Helpers').$int_to_roman($rb_plus(ordinal, 1)).$downcase(); + actual = marker.$chop(); + } marker = "i)"; + break; + case "upperroman": + + if ($truthy(validate)) { + + expected = $$('Helpers').$int_to_roman($rb_plus(ordinal, 1)); + actual = marker.$chop(); + } marker = "I)"; + break; + } if (($truthy(validate) && ($neqeq(expected, actual)))) { + self.$logger().$warn(self.$message_with_context("list item index: expected " + (expected) + ", got " + (actual), $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } return [marker, style]; + }, -2); + $defs(self, '$is_sibling_list_item?', function $Parser_is_sibling_list_item$ques$31(line, list_type, sibling_trait) { + var $a, self = this, $ret_or_1 = nil; + + if ($eqeqeq($$$('Regexp'), sibling_trait)) { + return sibling_trait['$match?'](line) + } else if ($truthy(($ret_or_1 = $$('ListRxMap')['$[]'](list_type)['$=~'](line)))) { + return sibling_trait['$=='](self.$resolve_list_marker(list_type, (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) + } else { + return $ret_or_1 + } + }); + $defs(self, '$parse_table', function $$parse_table(table_reader, parent, attributes) { + var $a, $b, $c, self = this, table = nil, colspecs = nil, explicit_colspecs = nil, skipped = nil, $ret_or_1 = nil, implicit_header = nil, parser_ctx = nil, format = nil, loop_idx = nil, implicit_header_boundary = nil, line = nil, beyond_first = nil, next_cellspec = nil, m = nil, pre_match = nil, post_match = nil, cell_text = nil, $logical_op_recvr_tmp_2 = nil; + + + table = $$('Table').$new(parent, attributes); + if (($truthy(attributes['$key?']("cols")) && ($not((colspecs = self.$parse_colspecs(attributes['$[]']("cols")))['$empty?']())))) { + + table.$create_columns(colspecs); + explicit_colspecs = true; + } skipped = ($truthy(($ret_or_1 = table_reader.$skip_blank_lines())) ? ($ret_or_1) : (0)); + if ($truthy(attributes['$[]']("header-option"))) { + table['$has_header_option='](true); + } else if (($eqeq(skipped, 0) && ($not(attributes['$[]']("noheader-option"))))) { + + table['$has_header_option=']("implicit"); + implicit_header = true; + } parser_ctx = $$$($$('Table'), 'ParserContext').$new(table_reader, table, attributes); + $a = [parser_ctx.$format(), -1, nil], (format = $a[0]), (loop_idx = $a[1]), (implicit_header_boundary = $a[2]); + while ($truthy((line = table_reader.$read_line()))) { + + if (($truthy((beyond_first = $rb_gt((loop_idx = $rb_plus(loop_idx, 1)), 0))) && ($truthy(line['$empty?']())))) { + + line = nil; + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = $rb_plus(implicit_header_boundary, 1); + } } else if ($eqeq(format, "psv")) { + if ($truthy(parser_ctx['$starts_with_delimiter?'](line))) { + + line = line.$slice(1, line.$length()); + parser_ctx.$close_open_cell(); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil; + } } else { + + $b = self.$parse_cellspec(line, "start", parser_ctx.$delimiter()), $a = $to_ary($b), (next_cellspec = ($a[0] == null ? nil : $a[0])), (line = ($a[1] == null ? nil : $a[1])); + if ($truthy(next_cellspec)) { + + parser_ctx.$close_open_cell(next_cellspec); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil; + } } else if (($truthy(implicit_header_boundary) && ($eqeq(implicit_header_boundary, loop_idx)))) { + table['$has_header_option=']((implicit_header = (implicit_header_boundary = nil))); + } } + } if (!$truthy(beyond_first)) { + + table_reader.$mark(); + if ($truthy(implicit_header)) { + if (($truthy(table_reader['$has_more_lines?']()) && ($truthy(table_reader.$peek_line()['$empty?']())))) { + implicit_header_boundary = 1; + } else { + table['$has_header_option=']((implicit_header = nil)); + } + } } $a = false;while ($a || $truthy(true)) {$a = false; + if (($truthy(line) && ($truthy((m = parser_ctx.$match_delimiter(line)))))) { + + $b = [m.$pre_match(), m.$post_match()], (pre_match = $b[0]), (post_match = $b[1]); + if ($eqeqeq("csv", ($ret_or_1 = format))) { + + if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?'](pre_match))) { + + parser_ctx.$skip_past_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + break + } $a = true;continue; + } parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (pre_match)); + } else if ($eqeqeq("dsv", $ret_or_1)) { + + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + ($$('LF'))); + parser_ctx.$keep_cell_open(); + break; + } $a = true;continue; + } parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (pre_match)); + } else { + + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + ($$('LF'))); + parser_ctx.$keep_cell_open(); + break; + } $a = true;continue; + } $c = self.$parse_cellspec(pre_match), $b = $to_ary($c), (next_cellspec = ($b[0] == null ? nil : $b[0])), (cell_text = ($b[1] == null ? nil : $b[1])); + parser_ctx.$push_cellspec(next_cellspec); + parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (cell_text)); + } if ($truthy((line = post_match)['$empty?']())) { + line = nil; + } parser_ctx.$close_cell(); + } else { + + parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (line) + ($$('LF'))); + + switch (format) { + case "csv": + if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?']())) { + + if (($truthy(implicit_header_boundary) && ($eqeq(loop_idx, 0)))) { + table['$has_header_option=']((implicit_header = (implicit_header_boundary = nil))); + } parser_ctx.$keep_cell_open(); + } else { + parser_ctx.$close_cell(true); + } + break; + case "dsv": + parser_ctx.$close_cell(true); + break; + default: + parser_ctx.$keep_cell_open(); + } break; + } + } if ($truthy(parser_ctx['$cell_open?']())) { + if (!$truthy(table_reader['$has_more_lines?']())) { + parser_ctx.$close_cell(true); + } + } else if ($truthy(($ret_or_1 = table_reader.$skip_blank_lines()))) ; else { + break + } } if (!($eqeq((($logical_op_recvr_tmp_2 = table.$attributes()), ($truthy(($ret_or_1 = $logical_op_recvr_tmp_2['$[]']("colcount"))) ? ($ret_or_1) : (($a = ["colcount", table.$columns().$size()], $send($logical_op_recvr_tmp_2, '[]=', $a), $a[$a.length - 1])))), 0) || ($truthy(explicit_colspecs)))) { + table.$assign_column_widths(); + } if ($truthy(implicit_header)) { + table['$has_header_option='](true); + } table.$partition_header_footer(attributes); + return table; + }); + $defs(self, '$parse_colspecs', function $$parse_colspecs(records) { + var specs = nil; + + + if ($truthy(records['$include?'](" "))) { + records = records.$delete(" "); + } if ($eqeq(records, records.$to_i().$to_s())) { + return $send($$$('Array'), 'new', [records.$to_i()], function $$32(){ + return $hash2(["width"], {"width": 1})}) + } specs = []; + $send(($truthy(records['$include?'](",")) ? (records.$split(",", -1)) : (records.$split(";", -1))), 'each', [], function $$33(record){var $a, $b, m = nil, spec = nil, colspec = nil, rowspec = nil, width = nil; + + + if (record == null) record = nil; + if ($truthy(record['$empty?']())) { + return specs['$<<']($hash2(["width"], {"width": 1})) + } else if ($truthy((m = $$('ColumnSpecRx').$match(record)))) { + + spec = $hash2([], {}); + if ($truthy(m['$[]'](2))) { + + $b = m['$[]'](2).$split("."), $a = $to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])); + if (($not(colspec['$nil_or_empty?']()) && ($truthy($$('TableCellHorzAlignments')['$key?'](colspec))))) { + spec['$[]=']("halign", $$('TableCellHorzAlignments')['$[]'](colspec)); + } if (($not(rowspec['$nil_or_empty?']()) && ($truthy($$('TableCellVertAlignments')['$key?'](rowspec))))) { + spec['$[]=']("valign", $$('TableCellVertAlignments')['$[]'](rowspec)); + } } if ($truthy((width = m['$[]'](3)))) { + spec['$[]=']("width", ($eqeq(width, "~") ? (-1) : (width.$to_i()))); + } else { + spec['$[]=']("width", 1); + } if (($truthy(m['$[]'](4)) && ($truthy($$('TableCellStyles')['$key?'](m['$[]'](4)))))) { + spec['$[]=']("style", $$('TableCellStyles')['$[]'](m['$[]'](4))); + } if ($truthy(m['$[]'](1))) { + return $send((1), 'upto', [m['$[]'](1).$to_i()], function $$34(){ + return specs['$<<'](spec.$merge())}) + } else { + return specs['$<<'](spec) + } } else { + return nil + }}); + return specs; + }); + $defs(self, '$parse_cellspec', function $$parse_cellspec(line, pos, delimiter) { + var $a, $b, m = nil, rest = nil, spec_part = nil, spec = nil, colspec = nil, rowspec = nil; + + + if (pos == null) pos = "end"; + if (delimiter == null) delimiter = nil; + $a = [nil, ""], (m = $a[0]), (rest = $a[1]); + if ($eqeq(pos, "start")) { + if ($truthy(line['$include?'](delimiter))) { + + $b = line.$partition(delimiter), $a = $to_ary($b), (spec_part = ($a[0] == null ? nil : $a[0])), (($a[1] == null ? nil : $a[1])), (rest = ($a[2] == null ? nil : $a[2])); + if ($truthy((m = $$('CellSpecStartRx').$match(spec_part)))) { + if ($truthy(m['$[]'](0)['$empty?']())) { + return [$hash2([], {}), rest] + } + } else { + return [nil, line] + } } else { + return [nil, line] + } + } else if ($truthy((m = $$('CellSpecEndRx').$match(line)))) { + + if ($truthy(m['$[]'](0).$lstrip()['$empty?']())) { + return [$hash2([], {}), line.$rstrip()] + } rest = m.$pre_match(); + } else { + return [$hash2([], {}), line] + } spec = $hash2([], {}); + if ($truthy(m['$[]'](1))) { + + $b = m['$[]'](1).$split("."), $a = $to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])); + colspec = ($truthy(colspec['$nil_or_empty?']()) ? (1) : (colspec.$to_i())); + rowspec = ($truthy(rowspec['$nil_or_empty?']()) ? (1) : (rowspec.$to_i())); + + switch (m['$[]'](2)) { + case "+": + + if (!$eqeq(colspec, 1)) { + spec['$[]=']("colspan", colspec); + } if (!$eqeq(rowspec, 1)) { + spec['$[]=']("rowspan", rowspec); + } break; + case "*": + if (!$eqeq(colspec, 1)) { + spec['$[]=']("repeatcol", colspec); + } + break; + } } if ($truthy(m['$[]'](3))) { + + $b = m['$[]'](3).$split("."), $a = $to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])); + if (($not(colspec['$nil_or_empty?']()) && ($truthy($$('TableCellHorzAlignments')['$key?'](colspec))))) { + spec['$[]=']("halign", $$('TableCellHorzAlignments')['$[]'](colspec)); + } if (($not(rowspec['$nil_or_empty?']()) && ($truthy($$('TableCellVertAlignments')['$key?'](rowspec))))) { + spec['$[]=']("valign", $$('TableCellVertAlignments')['$[]'](rowspec)); + } } if (($truthy(m['$[]'](4)) && ($truthy($$('TableCellStyles')['$key?'](m['$[]'](4)))))) { + spec['$[]=']("style", $$('TableCellStyles')['$[]'](m['$[]'](4))); + } return [spec, rest]; + }, -2); + $defs(self, '$parse_style_attribute', function $$parse_style_attribute(attributes, reader) { + var $a, self = this, raw_style = nil, name = nil, accum = nil, parsed_attrs = nil, parsed_style = nil, existing_role = nil; + + + if (reader == null) reader = nil; + if ((($truthy((raw_style = attributes['$[]'](1))) && ($not(raw_style['$include?'](" ")))) && ($truthy($$('Compliance').$shorthand_property_syntax())))) { + + name = nil; + accum = ""; + parsed_attrs = $hash2([], {}); + $send(raw_style, 'each_char', [], function $$35(c){var self = $$35.$$s == null ? this : $$35.$$s; + + + if (c == null) c = nil; + + switch (c) { + case ".": + + self.$yield_buffered_attribute(parsed_attrs, name, accum, reader); + accum = ""; + return (name = "role"); + case "#": + + self.$yield_buffered_attribute(parsed_attrs, name, accum, reader); + accum = ""; + return (name = "id"); + case "%": + + self.$yield_buffered_attribute(parsed_attrs, name, accum, reader); + accum = ""; + return (name = "option"); + default: + return (accum = $rb_plus(accum, c)) + }}, {$$s: self}); + if ($truthy(name)) { + + self.$yield_buffered_attribute(parsed_attrs, name, accum, reader); + if ($truthy((parsed_style = parsed_attrs['$[]']("style")))) { + attributes['$[]=']("style", parsed_style); + } if ($truthy(parsed_attrs['$key?']("id"))) { + attributes['$[]=']("id", parsed_attrs['$[]']("id")); + } if ($truthy(parsed_attrs['$key?']("role"))) { + attributes['$[]=']("role", ($truthy((existing_role = attributes['$[]']("role"))['$nil_or_empty?']()) ? (parsed_attrs['$[]']("role").$join(" ")) : ("" + (existing_role) + " " + (parsed_attrs['$[]']("role").$join(" "))))); + } if ($truthy(parsed_attrs['$key?']("option"))) { + $send(parsed_attrs['$[]']("option"), 'each', [], function $$36(opt){var $a; + + + if (opt == null) opt = nil; + return ($a = ["" + (opt) + "-option", ""], $send(attributes, '[]=', $a), $a[$a.length - 1]);}); + } return parsed_style; + } else { + return ($a = ["style", raw_style], $send(attributes, '[]=', $a), $a[$a.length - 1]) + } } else { + return ($a = ["style", raw_style], $send(attributes, '[]=', $a), $a[$a.length - 1]) + } }, -2); + $defs(self, '$yield_buffered_attribute', function $$yield_buffered_attribute(attrs, name, value, reader) { + var $a, self = this, $ret_or_1 = nil; + + + if ($truthy(name)) { + if ($truthy(value['$empty?']())) { + if ($truthy(reader)) { + self.$logger().$warn(self.$message_with_context("invalid empty " + (name) + " detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))); + } else { + self.$logger().$warn("invalid empty " + (name) + " detected in style attribute"); + } + } else if ($eqeq(name, "id")) { + + if ($truthy(attrs['$key?']("id"))) { + if ($truthy(reader)) { + self.$logger().$warn(self.$message_with_context("multiple ids detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))); + } else { + self.$logger().$warn("multiple ids detected in style attribute"); + } + } attrs['$[]='](name, value); + } else { + ($truthy(($ret_or_1 = attrs['$[]'](name))) ? ($ret_or_1) : (($a = [name, []], $send(attrs, '[]=', $a), $a[$a.length - 1])))['$<<'](value); + } + } else if (!$truthy(value['$empty?']())) { + attrs['$[]=']("style", value); + } return nil; + }); + $defs(self, '$adjust_indentation!', function $Parser_adjust_indentation$excl$37(lines, indent_size, tab_size) { + var full_tab_space = nil, block_indent = nil, new_block_indent = nil; + + + if (indent_size == null) indent_size = 0; + if (tab_size == null) tab_size = 0; + if ($truthy(lines['$empty?']())) { + return nil + } if (($truthy($rb_gt(tab_size, 0)) && ($truthy($send(lines, 'any?', [], function $$38(line){ + + if (line == null) line = nil; + return line['$include?']($$('TAB'));}))))) { + + full_tab_space = $rb_times(" ", tab_size); + $send(lines, 'map!', [], function $$39(line){var tab_idx = nil, leading_tabs = nil, spaces_added = nil, idx = nil, result = nil; + + + if (line == null) line = nil; + if (($truthy(line['$empty?']()) || ($truthy((tab_idx = line.$index($$('TAB')))['$nil?']())))) { + return line + } else { + + if ($eqeq(tab_idx, 0)) { + + leading_tabs = 0; + (function(){try { var $t_break = $thrower('break'); return $send(line, 'each_byte', [], function $$40(b){ + + if (b == null) b = nil; + if (!$eqeq(b, 9)) { + $t_break.$throw(); + }; + return (leading_tabs = $rb_plus(leading_tabs, 1));})} catch($e) { + if ($e === $t_break) return $e.$v; + throw $e; + }})(); + line = "" + ($rb_times(full_tab_space, leading_tabs)) + (line.$slice(leading_tabs, line.$length())); + if (!$truthy(line['$include?']($$('TAB')))) { + return line + } } spaces_added = 0; + idx = 0; + result = ""; + $send(line, 'each_char', [], function $$41(c){var offset = nil, spaces = nil; + + + if (c == null) c = nil; + if ($eqeq(c, $$('TAB'))) { + if ($eqeq((offset = $rb_plus(idx, spaces_added))['$%'](tab_size), 0)) { + + spaces_added = $rb_plus(spaces_added, $rb_minus(tab_size, 1)); + result = $rb_plus(result, full_tab_space); + } else { + + if (!$eqeq((spaces = $rb_minus(tab_size, offset['$%'](tab_size))), 1)) { + spaces_added = $rb_plus(spaces_added, $rb_minus(spaces, 1)); + } result = $rb_plus(result, $rb_times(" ", spaces)); + } + } else { + result = $rb_plus(result, c); + } return (idx = $rb_plus(idx, 1));}); + return result; + }}); + } if ($truthy($rb_lt(indent_size, 0))) { + return nil + } block_indent = nil; + (function(){try { var $t_break = $thrower('break'); return $send(lines, 'each', [], function $$42(line){var line_indent = nil; + + + if (line == null) line = nil; + if ($truthy(line['$empty?']())) { + return nil + }; + if ($eqeq((line_indent = $rb_minus(line.$length(), line.$lstrip().$length())), 0)) { + + block_indent = nil; + $t_break.$throw(); + }; + if (($truthy(block_indent) && ($truthy($rb_lt(block_indent, line_indent))))) { + return nil + } else { + return (block_indent = line_indent) + };})} catch($e) { + if ($e === $t_break) return $e.$v; + throw $e; + }})(); + if ($eqeq(indent_size, 0)) { + if ($truthy(block_indent)) { + $send(lines, 'map!', [], function $$43(line){ + + if (line == null) line = nil; + if ($truthy(line['$empty?']())) { + return line + } else { + + return line.$slice(block_indent, line.$length()); + }}); + } + } else { + + new_block_indent = $rb_times(" ", indent_size); + if ($truthy(block_indent)) { + $send(lines, 'map!', [], function $$44(line){ + + if (line == null) line = nil; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(new_block_indent, line.$slice(block_indent, line.$length())) + }}); + } else { + $send(lines, 'map!', [], function $$45(line){ + + if (line == null) line = nil; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(new_block_indent, line) + }}); + } } return nil; + }, -2); + $defs(self, '$uniform?', function $Parser_uniform$ques$46(str, chr, len) { + + return str.$count(chr)['$=='](len) + }); + return $defs(self, '$sanitize_attribute_name', function $$sanitize_attribute_name(name) { + + return name.$gsub($$('InvalidAttributeNameCharsRx'), "").$downcase() + }); + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/path_resolver"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $truthy = Opal.truthy, $hash2 = Opal.hash2, $def = Opal.def, $eqeq = Opal.eqeq, $alias = Opal.alias, $rb_plus = Opal.rb_plus, $to_ary = Opal.to_ary, $send = Opal.send, $not = Opal.not, $neqeq = Opal.neqeq, $rb_gt = Opal.rb_gt, $gvars = Opal.gvars, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('include,attr_accessor,root?,posixify,expand_path,pwd,start_with?,==,match?,absolute_path?,+,length,descends_from?,slice,to_s,relative_path_from,new,include?,tr,partition_path,each,pop,<<,join_path,[],web_root?,unc?,index,split,delete,[]=,join,raise,!,fetch,warn,logger,empty?,nil_or_empty?,chomp,!=,>,size,extract_uri_prefix,end_with?,gsub,private,=~'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'PathResolver'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.file_separator = $proto._partition_path_web = $proto._partition_path_sys = $proto.working_dir = nil; + + self.$include($$('Logging')); + $const_set($nesting[0], 'DOT', "."); + $const_set($nesting[0], 'DOT_DOT', ".."); + $const_set($nesting[0], 'DOT_SLASH', "./"); + $const_set($nesting[0], 'SLASH', "/"); + $const_set($nesting[0], 'BACKSLASH', "\\"); + $const_set($nesting[0], 'DOUBLE_SLASH', "//"); + $const_set($nesting[0], 'URI_CLASSLOADER', "uri:classloader:"); + $const_set($nesting[0], 'WindowsRootRx', /^(?:[a-zA-Z]:)?[\\\/]/); + self.$attr_accessor("file_separator"); + self.$attr_accessor("working_dir"); + + $def(self, '$initialize', function $$initialize(file_separator, working_dir) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + + if (file_separator == null) file_separator = nil; + if (working_dir == null) working_dir = nil; + self.file_separator = ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = file_separator)) ? ($ret_or_2) : ($$$($$$('File'), 'ALT_SEPARATOR'))))) ? ($ret_or_1) : ($$$($$$('File'), 'SEPARATOR'))); + self.working_dir = ($truthy(working_dir) ? (($truthy(self['$root?'](working_dir)) ? (self.$posixify(working_dir)) : ($$$('File').$expand_path(working_dir)))) : ($$$('Dir').$pwd())); + self._partition_path_sys = $hash2([], {}); + return (self._partition_path_web = $hash2([], {})); + }, -1); + + $def(self, '$absolute_path?', function $PathResolver_absolute_path$ques$1(path) { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + if ($truthy(($ret_or_1 = path['$start_with?']($$('SLASH'))))) { + return $ret_or_1 + } else { + + if ($truthy(($ret_or_2 = self.file_separator['$==']($$('BACKSLASH'))))) { + + return $$('WindowsRootRx')['$match?'](path); + } else { + return $ret_or_2 + } } + }); + if (($eqeq($$('RUBY_ENGINE'), "opal") && ($eqeq($$$('JAVASCRIPT_IO_MODULE'), "xmlhttprequest")))) { + + $def(self, '$root?', function $PathResolver_root$ques$2(path) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self['$absolute_path?'](path)))) { + return $ret_or_1 + } else { + + return path['$start_with?']("file://", "http://", "https://"); + } + }); + } else if ($eqeq($$$('RUBY_ENGINE'), "jruby")) { + + $def(self, '$root?', function $PathResolver_root$ques$3(path) { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self['$absolute_path?'](path)))) { + return $ret_or_1 + } else { + + return path['$start_with?']($$('URI_CLASSLOADER')); + } + }); + } else { + $alias(self, "root?", "absolute_path?"); + } + $def(self, '$unc?', function $PathResolver_unc$ques$4(path) { + + return path['$start_with?']($$('DOUBLE_SLASH')) + }); + + $def(self, '$web_root?', function $PathResolver_web_root$ques$5(path) { + + return path['$start_with?']($$('SLASH')) + }); + + $def(self, '$descends_from?', function $PathResolver_descends_from$ques$6(path, base) { + var $ret_or_1 = nil; + + if ($eqeq(base, path)) { + return 0 + } else if ($eqeq(base, $$('SLASH'))) { + if ($truthy(($ret_or_1 = path['$start_with?']($$('SLASH'))))) { + return 1 + } else { + return $ret_or_1 + } + } else if ($truthy(($ret_or_1 = path['$start_with?']($rb_plus(base, $$('SLASH')))))) { + + return $rb_plus(base.$length(), 1); + } else { + return $ret_or_1 + } + }); + + $def(self, '$relative_path', function $$relative_path(path, base) { + var self = this, offset = nil; + + if ($truthy(self['$root?'](path))) { + if ($truthy((offset = self['$descends_from?'](path, base)))) { + return path.$slice(offset, path.$length()) + } else { + + try { + return $$('Pathname').$new(path).$relative_path_from($$('Pathname').$new(base)).$to_s() + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + return path + } finally { Opal.pop_exception(); } + } else { throw $err; } + } } + } else { + return path + } + }); + + $def(self, '$posixify', function $$posixify(path) { + var self = this; + + if ($truthy(path)) { + if (($eqeq(self.file_separator, $$('BACKSLASH')) && ($truthy(path['$include?']($$('BACKSLASH')))))) { + + return path.$tr($$('BACKSLASH'), $$('SLASH')); + } else { + return path + } + } else { + return "" + } + }); + $alias(self, "posixfy", "posixify"); + + $def(self, '$expand_path', function $$expand_path(path) { + var $a, $b, self = this, path_segments = nil, path_root = nil, resolved_segments = nil; + + + $b = self.$partition_path(path), $a = $to_ary($b), (path_segments = ($a[0] == null ? nil : $a[0])), (path_root = ($a[1] == null ? nil : $a[1])); + if ($truthy(path['$include?']($$('DOT_DOT')))) { + + resolved_segments = []; + $send(path_segments, 'each', [], function $$7(segment){ + + if (segment == null) segment = nil; + if ($eqeq(segment, $$('DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + }}); + return self.$join_path(resolved_segments, path_root); + } else { + return self.$join_path(path_segments, path_root) + } }); + + $def(self, '$partition_path', function $$partition_path(path, web) { + var $a, self = this, result = nil, cache = nil, posix_path = nil, root = nil, path_segments = nil; + + + if (web == null) web = nil; + if ($truthy((result = (cache = ($truthy(web) ? (self._partition_path_web) : (self._partition_path_sys)))['$[]'](path)))) { + return result + } posix_path = self.$posixify(path); + if ($truthy(web)) { + if ($truthy(self['$web_root?'](posix_path))) { + root = $$('SLASH'); + } else if ($truthy(posix_path['$start_with?']($$('DOT_SLASH')))) { + root = $$('DOT_SLASH'); + } + } else if ($truthy(self['$root?'](posix_path))) { + if ($truthy(self['$unc?'](posix_path))) { + root = $$('DOUBLE_SLASH'); + } else if ($truthy(posix_path['$start_with?']($$('SLASH')))) { + root = $$('SLASH'); + } else if ($truthy(posix_path['$start_with?']($$('URI_CLASSLOADER')))) { + root = posix_path.$slice(0, $$('URI_CLASSLOADER').$length()); + } else { + root = posix_path.$slice(0, $rb_plus(posix_path.$index($$('SLASH')), 1)); + } + } else if ($truthy(posix_path['$start_with?']($$('DOT_SLASH')))) { + root = $$('DOT_SLASH'); + } path_segments = ($truthy(root) ? (posix_path.$slice(root.$length(), posix_path.$length())) : (posix_path)).$split($$('SLASH')); + path_segments.$delete($$('DOT')); + return ($a = [path, [path_segments, root]], $send(cache, '[]=', $a), $a[$a.length - 1]); + }, -2); + + $def(self, '$join_path', function $$join_path(segments, root) { + + + if (root == null) root = nil; + if ($truthy(root)) { + return "" + (root) + (segments.$join($$('SLASH'))) + } else { + + return segments.$join($$('SLASH')); + } }, -2); + + $def(self, '$system_path', function $$system_path(target, start, jail, opts) { + var $a, $b, self = this, target_path = nil, $ret_or_1 = nil, target_segments = nil, jail_segments = nil, jail_root = nil, recheck = nil, start_segments = nil, start_root = nil, resolved_segments = nil, unresolved_segments = nil, warned = nil; + + + if (start == null) start = nil; + if (jail == null) jail = nil; + if (opts == null) opts = $hash2([], {}); + if ($truthy(jail)) { + + if (!$truthy(self['$root?'](jail))) { + self.$raise($$$('SecurityError'), "Jail is not an absolute path: " + (jail)); + } jail = self.$posixify(jail); + } if ($truthy(target)) { + if ($truthy(self['$root?'](target))) { + + target_path = self.$expand_path(target); + if (($truthy(jail) && ($not(self['$descends_from?'](target_path, jail))))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy(($ret_or_1 = opts['$[]']("target_name"))) ? ($ret_or_1) : ("path"))) + " is outside of jail; recovering automatically"); + $b = self.$partition_path(target_path), $a = $to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])); + $b = self.$partition_path(jail), $a = $to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])); + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + self.$raise($$$('SecurityError'), "" + (($truthy(($ret_or_1 = opts['$[]']("target_name"))) ? ($ret_or_1) : ("path"))) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)"); + } + } return target_path; + } else { + $b = self.$partition_path(target), $a = $to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])); + } + } else { + target_segments = []; + } if ($truthy(target_segments['$empty?']())) { + if ($truthy(start['$nil_or_empty?']())) { + return ($truthy(($ret_or_1 = jail)) ? ($ret_or_1) : (self.working_dir)) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start); + } else { + return self.$expand_path(start) + } + } else { + + $b = self.$partition_path(start), $a = $to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])); + start = ($truthy(($ret_or_1 = jail)) ? ($ret_or_1) : (self.working_dir)); + } + } else if ($truthy(start['$nil_or_empty?']())) { + start = ($truthy(($ret_or_1 = jail)) ? ($ret_or_1) : (self.working_dir)); + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start); + } + } else { + start = "" + (($truthy(($ret_or_1 = jail)) ? ($ret_or_1) : (self.working_dir)).$chomp("/")) + "/" + (start); + } if ((($truthy(jail) && ($truthy((recheck = self['$descends_from?'](start, jail)['$!']())))) && ($eqeq(self.file_separator, $$('BACKSLASH'))))) { + + $b = self.$partition_path(start), $a = $to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (start_root = ($a[1] == null ? nil : $a[1])); + $b = self.$partition_path(jail), $a = $to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])); + if ($neqeq(start_root, jail_root)) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("start path for " + (($truthy(($ret_or_1 = opts['$[]']("target_name"))) ? ($ret_or_1) : ("path"))) + " is outside of jail root; recovering automatically"); + start_segments = jail_segments; + recheck = false; + } else { + self.$raise($$$('SecurityError'), "start path for " + (($truthy(($ret_or_1 = opts['$[]']("target_name"))) ? ($ret_or_1) : ("path"))) + " " + (start) + " refers to location outside jail root: " + (jail) + " (disallowed in safe mode)"); + } + } } else { + $b = self.$partition_path(start), $a = $to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])); + } if ($truthy((resolved_segments = $rb_plus(start_segments, target_segments))['$include?']($$('DOT_DOT')))) { + + $a = [resolved_segments, []], (unresolved_segments = $a[0]), (resolved_segments = $a[1]); + if ($truthy(jail)) { + + if (!$truthy(jail_segments)) { + $b = self.$partition_path(jail), $a = $to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])); + } warned = false; + $send(unresolved_segments, 'each', [], function $$8(segment){var self = $$8.$$s == null ? this : $$8.$$s; + + + if (segment == null) segment = nil; + if ($eqeq(segment, $$('DOT_DOT'))) { + if ($truthy($rb_gt(resolved_segments.$size(), jail_segments.$size()))) { + return resolved_segments.$pop() + } else if ($truthy(opts.$fetch("recover", true))) { + if ($truthy(warned)) { + return nil + } else { + + self.$logger().$warn("" + (($truthy(($ret_or_1 = opts['$[]']("target_name"))) ? ($ret_or_1) : ("path"))) + " has illegal reference to ancestor of jail; recovering automatically"); + return (warned = true); + } + } else { + return self.$raise($$$('SecurityError'), "" + (($truthy(($ret_or_1 = opts['$[]']("target_name"))) ? ($ret_or_1) : ("path"))) + " " + (target) + " refers to location outside jail: " + (jail) + " (disallowed in safe mode)") + } + } else { + return resolved_segments['$<<'](segment) + }}, {$$s: self}); + } else { + $send(unresolved_segments, 'each', [], function $$9(segment){ + + if (segment == null) segment = nil; + if ($eqeq(segment, $$('DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + }}); + } } if ($truthy(recheck)) { + + target_path = self.$join_path(resolved_segments, jail_root); + if ($truthy(self['$descends_from?'](target_path, jail))) { + return target_path + } else if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy(($ret_or_1 = opts['$[]']("target_name"))) ? ($ret_or_1) : ("path"))) + " is outside of jail; recovering automatically"); + if (!$truthy(jail_segments)) { + $b = self.$partition_path(jail), $a = $to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])); + } return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + return self.$raise($$$('SecurityError'), "" + (($truthy(($ret_or_1 = opts['$[]']("target_name"))) ? ($ret_or_1) : ("path"))) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + } } else { + return self.$join_path(resolved_segments, jail_root) + } }, -2); + + $def(self, '$web_path', function $$web_path(target, start) { + var $a, $b, self = this, uri_prefix = nil, target_segments = nil, target_root = nil, resolved_segments = nil, resolved_path = nil; + + + if (start == null) start = nil; + target = self.$posixify(target); + start = self.$posixify(start); + if (!($truthy(start['$nil_or_empty?']()) || ($truthy(self['$web_root?'](target))))) { + $b = self.$extract_uri_prefix("" + (start) + (($truthy(start['$end_with?']($$('SLASH'))) ? ("") : ($$('SLASH')))) + (target)), $a = $to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (uri_prefix = ($a[1] == null ? nil : $a[1])); + } $b = self.$partition_path(target, true), $a = $to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (target_root = ($a[1] == null ? nil : $a[1])); + resolved_segments = []; + $send(target_segments, 'each', [], function $$10(segment){ + + if (segment == null) segment = nil; + if ($eqeq(segment, $$('DOT_DOT'))) { + if ($truthy(resolved_segments['$empty?']())) { + if (($truthy(target_root) && ($neqeq(target_root, $$('DOT_SLASH'))))) { + return nil + } else { + return resolved_segments['$<<'](segment) + } + } else if ($eqeq(resolved_segments['$[]'](-1), $$('DOT_DOT'))) { + return resolved_segments['$<<'](segment) + } else { + return resolved_segments.$pop() + } + } else { + return resolved_segments['$<<'](segment) + }}); + if ($truthy((resolved_path = self.$join_path(resolved_segments, target_root))['$include?'](" "))) { + resolved_path = resolved_path.$gsub(" ", "%20"); + } if ($truthy(uri_prefix)) { + return "" + (uri_prefix) + (resolved_path) + } else { + return resolved_path + } }, -2); + self.$private(); + return $def(self, '$extract_uri_prefix', function $$extract_uri_prefix(str) { + var $a; + + if (($truthy(str['$include?'](":")) && ($truthy($$('UriSniffRx')['$=~'](str))))) { + return [str.$slice((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length(), str.$length()), (($a = $gvars['~']) === nil ? nil : $a['$[]'](0))] + } else { + return str + } + }); + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/reader"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $def = Opal.def, $rb_plus = Opal.rb_plus, $alias = Opal.alias, $hash2 = Opal.hash2, $not = Opal.not, $eqeqeq = Opal.eqeqeq, $to_ary = Opal.to_ary, $truthy = Opal.truthy, $rb_gt = Opal.rb_gt, $send = Opal.send, $rb_minus = Opal.rb_minus, $thrower = Opal.thrower, $eqeq = Opal.eqeq, $rb_times = Opal.rb_times, $neqeq = Opal.neqeq, $to_a = Opal.to_a, $assign_ivar_val = Opal.assign_ivar_val, $send2 = Opal.send2, $find_super = Opal.find_super, $rb_ge = Opal.rb_ge, $gvars = Opal.gvars, $rb_lt = Opal.rb_lt, $hash = Opal.hash, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('include,attr_reader,+,line_info,attr_accessor,!,===,split,file,dir,dirname,path,basename,lineno,reverse,prepare_lines,empty?,nil_or_empty?,peek_line,[],>,slice,length,process_line,times,shift,read_line,<<,-,unshift_all,has_more_lines?,read_lines,join,unshift,unshift_line,unshift_lines,replace_next_line,start_with?,==,*,read_lines_until,size,clear,cursor,[]=,fetch,!=,cursor_at_mark,warn,logger,message_with_context,pop,push,respond_to?,reverse_each,new,tap,each,instance_variables,instance_variable_get,drop,instance_variable_set,class,object_id,inspect,private,prepare_source_array,prepare_source_string,chomp,valid_encoding?,to_s,raise,to_i,attributes,catalog,pop_include,parse,path=,dup,end_with?,keys,rindex,rootname,key?,attr,reverse!,>=,exceeds_max_depth?,nil?,include_processors?,extensions,extensions?,include_processors,map,skip_front_matter!,adjust_indentation!,include?,=~,preprocess_conditional_directive,preprocess_include_directive,downcase,error,none?,any?,all?,strip,send,resolve_expr_val,rstrip,sub_attributes,attribute_missing,info,parse_attributes,find,handles?,instance,process_method,safe,resolve_include_path,method,split_delimited_value,partition,<,to_a,uniq,sort,call,each_line,infinite?,push_include,delete,first,values,value?,create_include_cursor,delete_at,keep_if,read,uriish?,attr?,require_library,normalize_system_path,file?,relative_path,path_resolver,base_dir,to_f'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Reader'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.file = $proto.lines = $proto.look_ahead = $proto.unescape_next_line = $proto.lineno = $proto.process_lines = $proto.dir = $proto.path = $proto.mark = $proto.source_lines = $proto.saved = nil; + + self.$include($$('Logging')); + (function($base, $super) { + var self = $klass($base, $super, 'Cursor'); + + var $proto = self.$$prototype; + + $proto.lineno = $proto.path = nil; + + self.$attr_reader("file", "dir", "path", "lineno"); + + $def(self, '$initialize', function $$initialize(file, dir, path, lineno) { + var $a, self = this; + + + if (dir == null) dir = nil; + if (path == null) path = nil; + if (lineno == null) lineno = 1; + return $a = [file, dir, path, lineno], (self.file = $a[0]), (self.dir = $a[1]), (self.path = $a[2]), (self.lineno = $a[3]), $a; + }, -2); + + $def(self, '$advance', function $$advance(num) { + var self = this; + + return (self.lineno = $rb_plus(self.lineno, num)) + }); + + $def(self, '$line_info', function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }); + return $alias(self, "to_s", "line_info"); + })($nesting[0], null); + self.$attr_reader("file"); + self.$attr_reader("dir"); + self.$attr_reader("path"); + self.$attr_reader("lineno"); + self.$attr_reader("source_lines"); + self.$attr_accessor("process_lines"); + self.$attr_accessor("unterminated"); + + $def(self, '$initialize', function $$initialize(data, cursor, opts) { + var $a, $b, self = this, $ret_or_1 = nil; + + + if (data == null) data = nil; + if (cursor == null) cursor = nil; + if (opts == null) opts = $hash2([], {}); + if ($not(cursor)) { + + self.file = nil; + self.dir = "."; + self.path = ""; + self.lineno = 1; + } else if ($eqeqeq($$$('String'), cursor)) { + + self.file = cursor; + $b = $$$('File').$split(self.file), $a = $to_ary($b), (self.dir = ($a[0] == null ? nil : $a[0])), (self.path = ($a[1] == null ? nil : $a[1])); + self.lineno = 1; + } else { + + if ($truthy((self.file = cursor.$file()))) { + + self.dir = ($truthy(($ret_or_1 = cursor.$dir())) ? ($ret_or_1) : ($$$('File').$dirname(self.file))); + self.path = ($truthy(($ret_or_1 = cursor.$path())) ? ($ret_or_1) : ($$$('File').$basename(self.file))); + } else { + + self.dir = ($truthy(($ret_or_1 = cursor.$dir())) ? ($ret_or_1) : (".")); + self.path = ($truthy(($ret_or_1 = cursor.$path())) ? ($ret_or_1) : ("")); + } self.lineno = ($truthy(($ret_or_1 = cursor.$lineno())) ? ($ret_or_1) : (1)); + } self.lines = (self.source_lines = self.$prepare_lines(data, opts)).$reverse(); + self.mark = nil; + self.look_ahead = 0; + self.process_lines = true; + self.unescape_next_line = false; + self.unterminated = nil; + return (self.saved = nil); + }, -1); + + $def(self, '$has_more_lines?', function $Reader_has_more_lines$ques$1() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return false; + } else { + return true + } + }); + + $def(self, '$empty?', function $Reader_empty$ques$2() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return true; + } else { + return false + } + }); + $alias(self, "eof?", "empty?"); + + $def(self, '$next_line_empty?', function $Reader_next_line_empty$ques$3() { + var self = this; + + return self.$peek_line()['$nil_or_empty?']() + }); + + $def(self, '$peek_line', function $$peek_line(direct) { + var self = this, next_line = nil, line = nil; + + + if (direct == null) direct = false; + while ($truthy(true)) { + + next_line = self.lines['$[]'](-1); + if (($truthy(direct) || ($truthy($rb_gt(self.look_ahead, 0))))) { + return ($truthy(self.unescape_next_line) ? (next_line.$slice(1, next_line.$length())) : (next_line)) + } else if ($truthy(next_line)) { + if ($truthy((line = self.$process_line(next_line)))) { + return line + } + } else { + + self.look_ahead = 0; + return nil; + } } }, -1); + + $def(self, '$peek_lines', function $$peek_lines(num, direct) { + var self = this, old_look_ahead = nil, result = nil, $ret_or_1 = nil; + + + if (num == null) num = nil; + if (direct == null) direct = false; + old_look_ahead = self.look_ahead; + result = []; + (function(){try { var $t_break = $thrower('break'); return $send(($truthy(($ret_or_1 = num)) ? ($ret_or_1) : ($$('MAX_INT'))), 'times', [], function $$4(){var self = $$4.$$s == null ? this : $$4.$$s, line = nil; + if (self.lineno == null) self.lineno = nil; + + if ($truthy((line = ($truthy(direct) ? (self.$shift()) : (self.$read_line()))))) { + return result['$<<'](line) + } else { + + if ($truthy(direct)) { + self.lineno = $rb_minus(self.lineno, 1); + }; + $t_break.$throw(); + }}, {$$s: self})} catch($e) { + if ($e === $t_break) return $e.$v; + throw $e; + }})(); + if (!$truthy(result['$empty?']())) { + + self.$unshift_all(result); + if ($truthy(direct)) { + self.look_ahead = old_look_ahead; + } } return result; + }, -1); + + $def(self, '$read_line', function $$read_line() { + var self = this; + + if (($truthy($rb_gt(self.look_ahead, 0)) || ($truthy(self['$has_more_lines?']())))) { + return self.$shift() + } else { + return nil + } + }); + + $def(self, '$read_lines', function $$read_lines() { + var self = this, lines = nil; + + + lines = []; + while ($truthy(self['$has_more_lines?']())) { + lines['$<<'](self.$shift()); + } return lines; + }); + $alias(self, "readlines", "read_lines"); + + $def(self, '$read', function $$read() { + var self = this; + + return self.$read_lines().$join($$('LF')) + }); + + $def(self, '$advance', function $$advance() { + var self = this; + + if ($truthy(self.$shift())) { + return true + } else { + return false + } + }); + + $def(self, '$unshift_line', function $$unshift_line(line_to_restore) { + var self = this; + + + self.$unshift(line_to_restore); + return nil; + }); + $alias(self, "restore_line", "unshift_line"); + + $def(self, '$unshift_lines', function $$unshift_lines(lines_to_restore) { + var self = this; + + return self.$unshift_all(lines_to_restore) + }); + $alias(self, "restore_lines", "unshift_lines"); + + $def(self, '$replace_next_line', function $$replace_next_line(replacement) { + var self = this; + + + self.$shift(); + self.$unshift(replacement); + return true; + }); + $alias(self, "replace_line", "replace_next_line"); + + $def(self, '$skip_blank_lines', function $$skip_blank_lines() { + var self = this, num_skipped = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return nil + } num_skipped = 0; + while ($truthy((next_line = self.$peek_line()))) { + if ($truthy(next_line['$empty?']())) { + + self.$shift(); + num_skipped = $rb_plus(num_skipped, 1); + } else { + return num_skipped + } + } }); + + $def(self, '$skip_comment_lines', function $$skip_comment_lines() { + var self = this, $ret_or_1 = nil, next_line = nil, ll = nil; + + + if ($truthy(self['$empty?']())) { + return nil + } while ($truthy(($truthy(($ret_or_1 = (next_line = self.$peek_line()))) ? (next_line['$empty?']()['$!']()) : ($ret_or_1)))) { + if ($truthy(next_line['$start_with?']("//"))) { + if ($truthy(next_line['$start_with?']("///"))) { + if (($truthy($rb_gt((ll = next_line.$length()), 3)) && ($eqeq(next_line, $rb_times("/", ll))))) { + self.$read_lines_until($hash2(["terminator", "skip_first_line", "read_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "read_last_line": true, "skip_processing": true, "context": "comment"})); + } else { + break + } + } else { + self.$shift(); + } + } else { + break + } + } return nil; + }); + + $def(self, '$skip_line_comments', function $$skip_line_comments() { + var self = this, comment_lines = nil, $ret_or_1 = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return [] + } comment_lines = []; + while ($truthy(($truthy(($ret_or_1 = (next_line = self.$peek_line()))) ? (next_line['$empty?']()['$!']()) : ($ret_or_1)))) { + if ($truthy(next_line['$start_with?']("//"))) { + comment_lines['$<<'](self.$shift()); + } else { + break + } + } return comment_lines; + }); + + $def(self, '$terminate', function $$terminate() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, self.lines.$size()); + self.lines.$clear(); + self.look_ahead = 0; + return nil; + }); + + $def(self, '$read_lines_until', function $$read_lines_until(options) { + var $a, $yield = $$read_lines_until.$$p || nil, self = this, result = nil, restore_process_lines = nil, terminator = nil, start_cursor = nil, $ret_or_1 = nil, break_on_blank_lines = nil, break_on_list_continuation = nil, skip_comments = nil, line_read = nil, line_restored = nil, line = nil, $ret_or_2 = nil, $ret_or_3 = nil, $ret_or_4 = nil, $ret_or_5 = nil, context = nil; + + $$read_lines_until.$$p = null; + + if (options == null) options = $hash2([], {}); + result = []; + if (($truthy(self.process_lines) && ($truthy(options['$[]']("skip_processing"))))) { + + self.process_lines = false; + restore_process_lines = true; + } if ($truthy((terminator = options['$[]']("terminator")))) { + + start_cursor = ($truthy(($ret_or_1 = options['$[]']("cursor"))) ? ($ret_or_1) : (self.$cursor())); + break_on_blank_lines = false; + break_on_list_continuation = false; + } else { + + break_on_blank_lines = options['$[]']("break_on_blank_lines"); + break_on_list_continuation = options['$[]']("break_on_list_continuation"); + } skip_comments = options['$[]']("skip_line_comments"); + line_read = (line_restored = nil); + if ($truthy(options['$[]']("skip_first_line"))) { + self.$shift(); + } while ($truthy((line = self.$read_line()))) { + + if ($truthy(($truthy(terminator) ? (line['$=='](terminator)) : (($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = break_on_blank_lines)) ? (line['$empty?']()) : ($ret_or_3)))) ? ($ret_or_2) : (($truthy(($ret_or_3 = ($truthy(($ret_or_4 = ($truthy(($ret_or_5 = break_on_list_continuation)) ? (line_read) : ($ret_or_5)))) ? (line['$==']($$('LIST_CONTINUATION'))) : ($ret_or_4)))) ? (($a = ["preserve_last_line", true], $send(options, '[]=', $a), $a[$a.length - 1])) : ($ret_or_3)))))) ? ($ret_or_1) : (($truthy(($ret_or_2 = ($yield !== nil))) ? (Opal.yield1($yield, line)) : ($ret_or_2)))))))) { + + if ($truthy(options['$[]']("read_last_line"))) { + result['$<<'](line); + } if ($truthy(options['$[]']("preserve_last_line"))) { + + self.$unshift(line); + line_restored = true; + } break; + } if (!(($truthy(skip_comments) && ($truthy(line['$start_with?']("//")))) && ($not(line['$start_with?']("///"))))) { + + result['$<<'](line); + line_read = true; + } } if ($truthy(restore_process_lines)) { + + self.process_lines = true; + if (($truthy(line_restored) && ($not(terminator)))) { + self.look_ahead = $rb_minus(self.look_ahead, 1); + } } if ((($truthy(terminator) && ($neqeq(terminator, line))) && ($truthy((context = options.$fetch("context", terminator)))))) { + + if ($eqeq(start_cursor, "at_mark")) { + start_cursor = self.$cursor_at_mark(); + } self.$logger().$warn(self.$message_with_context("unterminated " + (context) + " block", $hash2(["source_location"], {"source_location": start_cursor}))); + self.unterminated = true; + } return result; + }, -1); + + $def(self, '$shift', function $$shift() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, 1); + if (!$eqeq(self.look_ahead, 0)) { + self.look_ahead = $rb_minus(self.look_ahead, 1); + } return self.lines.$pop(); + }); + + $def(self, '$unshift', function $$unshift(line) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, 1); + self.look_ahead = $rb_plus(self.look_ahead, 1); + self.lines.$push(line); + return nil; + }); + if ($eqeq($$$('RUBY_ENGINE'), "jruby")) { + + $def(self, '$unshift_all', function $$unshift_all(lines_to_restore) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, lines_to_restore.$size()); + self.look_ahead = $rb_plus(self.look_ahead, lines_to_restore.$size()); + if ($truthy(lines_to_restore['$respond_to?']("reverse"))) { + $send(self.lines, 'push', $to_a(lines_to_restore.$reverse())); + } else { + $send(lines_to_restore, 'reverse_each', [], function $$5(it){var self = $$5.$$s == null ? this : $$5.$$s; + if (self.lines == null) self.lines = nil; + + + if (it == null) it = nil; + return self.lines.$push(it);}, {$$s: self}); + } return nil; + }); + } else { + + $def(self, '$unshift_all', function $$unshift_all(lines_to_restore) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, lines_to_restore.$size()); + self.look_ahead = $rb_plus(self.look_ahead, lines_to_restore.$size()); + $send(self.lines, 'push', $to_a(lines_to_restore.$reverse())); + return nil; + }); + } + $def(self, '$cursor', function $$cursor() { + var self = this; + + return $$('Cursor').$new(self.file, self.dir, self.path, self.lineno) + }); + + $def(self, '$cursor_at_line', function $$cursor_at_line(lineno) { + var self = this; + + return $$('Cursor').$new(self.file, self.dir, self.path, lineno) + }); + + $def(self, '$cursor_at_mark', function $$cursor_at_mark() { + var self = this; + + if ($truthy(self.mark)) { + return $send($$('Cursor'), 'new', $to_a(self.mark)) + } else { + return self.$cursor() + } + }); + + $def(self, '$cursor_before_mark', function $$cursor_before_mark() { + var $a, $b, self = this, m_file = nil, m_dir = nil, m_path = nil, m_lineno = nil; + + if ($truthy(self.mark)) { + + $b = self.mark, $a = $to_ary($b), (m_file = ($a[0] == null ? nil : $a[0])), (m_dir = ($a[1] == null ? nil : $a[1])), (m_path = ($a[2] == null ? nil : $a[2])), (m_lineno = ($a[3] == null ? nil : $a[3])); + return $$('Cursor').$new(m_file, m_dir, m_path, $rb_minus(m_lineno, 1)); + } else { + return $$('Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + } + }); + + $def(self, '$cursor_at_prev_line', function $$cursor_at_prev_line() { + var self = this; + + return $$('Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + }); + + $def(self, '$mark', function $$mark() { + var self = this; + + return (self.mark = [self.file, self.dir, self.path, self.lineno]) + }); + + $def(self, '$line_info', function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }); + + $def(self, '$lines', function $$lines() { + var self = this; + + return self.lines.$reverse() + }); + + $def(self, '$string', function $$string() { + var self = this; + + return self.lines.$reverse().$join($$('LF')) + }); + + $def(self, '$source', function $$source() { + var self = this; + + return self.source_lines.$join($$('LF')) + }); + + $def(self, '$save', function $$save() { + var self = this; + + + self.saved = $send($hash2([], {}), 'tap', [], function $$6(accum){var self = $$6.$$s == null ? this : $$6.$$s; + + + if (accum == null) accum = nil; + return $send(self.$instance_variables(), 'each', [], function $$7(name){var $a, self = $$7.$$s == null ? this : $$7.$$s, val = nil; + + + if (name == null) name = nil; + if (($eqeq(name, "@saved") || ($eqeq(name, "@source_lines")))) { + return nil + } else { + return ($a = [name, ($eqeqeq($$$('Array'), (val = self.$instance_variable_get(name))) ? (val.$drop(0)) : (val))], $send(accum, '[]=', $a), $a[$a.length - 1]) + }}, {$$s: self});}, {$$s: self}); + return nil; + }); + + $def(self, '$restore_save', function $$restore_save() { + var self = this; + + if ($truthy(self.saved)) { + + $send(self.saved, 'each', [], function $$8(name, val){var self = $$8.$$s == null ? this : $$8.$$s; + + + if (name == null) name = nil; + if (val == null) val = nil; + return self.$instance_variable_set(name, val);}, {$$s: self}); + return (self.saved = nil); + } else { + return nil + } + }); + + $def(self, '$discard_save', $assign_ivar_val("saved", nil)); + + $def(self, '$to_s', function $$to_s() { + var self = this; + + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line: " + (self.lineno) + "}>" + }); + self.$private(); + + $def(self, '$prepare_lines', function $$prepare_lines(data, opts) { + var self = this, normalize = nil; + + + if (opts == null) opts = $hash2([], {}); + try { + if ($truthy((normalize = opts['$[]']("normalize")))) { + if ($eqeqeq($$$('Array'), data)) { + + return $$('Helpers').$prepare_source_array(data, normalize['$!=']("chomp")); + } else { + + return $$('Helpers').$prepare_source_string(data, normalize['$!=']("chomp")); + } + } else if ($eqeqeq($$$('Array'), data)) { + return data.$drop(0) + } else if ($truthy(data)) { + return data.$chomp().$split($$('LF'), -1) + } else { + return [] + } + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + if ($truthy(($eqeqeq($$$('Array'), data) ? (data.$join()) : (data.$to_s()))['$valid_encoding?']())) { + return self.$raise() + } else { + return self.$raise($$$('ArgumentError'), "source is either binary or contains invalid Unicode data") + } + } finally { Opal.pop_exception(); } + } else { throw $err; } + } }, -2); + return $def(self, '$process_line', function $$process_line(line) { + var self = this; + + + if ($truthy(self.process_lines)) { + self.look_ahead = $rb_plus(self.look_ahead, 1); + } return line; + }); + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'PreprocessorReader'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.include_stack = $proto.lines = $proto.file = $proto.dir = $proto.path = $proto.lineno = $proto.maxdepth = $proto.process_lines = $proto.includes = $proto.document = $proto.unescape_next_line = $proto.include_processor_extensions = $proto.look_ahead = $proto.skipping = $proto.conditional_stack = nil; + + self.$attr_reader("include_stack"); + + $def(self, '$initialize', function $$initialize(document, data, cursor, opts) { + $$initialize.$$p || nil; var self = this, default_include_depth = nil, $ret_or_1 = nil; + + $$initialize.$$p = null; + + if (data == null) data = nil; + if (cursor == null) cursor = nil; + if (opts == null) opts = $hash2([], {}); + self.document = document; + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [data, cursor, opts], null); + if ($truthy($rb_gt((default_include_depth = ($truthy(($ret_or_1 = document.$attributes()['$[]']("max-include-depth"))) ? ($ret_or_1) : (64)).$to_i()), 0))) { + self.maxdepth = $hash2(["abs", "curr", "rel"], {"abs": default_include_depth, "curr": default_include_depth, "rel": default_include_depth}); + } else { + self.maxdepth = nil; + } self.include_stack = []; + self.includes = document.$catalog()['$[]']("includes"); + self.skipping = false; + self.conditional_stack = []; + return (self.include_processor_extensions = nil); + }, -2); + + $def(self, '$has_more_lines?', function $PreprocessorReader_has_more_lines$ques$9() { + var self = this; + + if ($truthy(self.$peek_line())) { + return true + } else { + return false + } + }); + + $def(self, '$empty?', function $PreprocessorReader_empty$ques$10() { + var self = this; + + if ($truthy(self.$peek_line())) { + return false + } else { + return true + } + }); + $alias(self, "eof?", "empty?"); + + $def(self, '$peek_line', function $$peek_line(direct) { + var $yield = $$peek_line.$$p || nil, self = this, line = nil; + + $$peek_line.$$p = null; + + if (direct == null) direct = false; + if ($truthy((line = $send2(self, $find_super(self, 'peek_line', $$peek_line, false, true), 'peek_line', [direct], $yield)))) { + return line + } else if ($truthy(self.include_stack['$empty?']())) { + return nil + } else { + + self.$pop_include(); + return self.$peek_line(direct); + } }, -1); + + $def(self, '$push_include', function $$push_include(data, file, path, lineno, attributes) { + var self = this, dir = nil, $ret_or_1 = nil, rel_maxdepth = nil, curr_maxdepth = nil, abs_maxdepth = nil, leveloffset = nil; + + + if (file == null) file = nil; + if (path == null) path = nil; + if (lineno == null) lineno = 1; + if (attributes == null) attributes = $hash2([], {}); + self.include_stack['$<<']([self.lines, self.file, self.dir, self.path, self.lineno, self.maxdepth, self.process_lines]); + if ($truthy((self.file = file))) { + + if ($eqeqeq($$$('String'), file)) { + self.dir = $$$('File').$dirname(file); + } else if ($truthy($$('RUBY_ENGINE_OPAL'))) { + self.dir = $$$('URI').$parse($$$('File').$dirname((file = file.$to_s()))); + } else { + + (self.dir = file.$dup())['$path='](($eqeq((dir = $$$('File').$dirname(file.$path())), "/") ? ("") : (dir))); + file = file.$to_s(); + } self.path = (path = ($truthy(($ret_or_1 = path)) ? ($ret_or_1) : ($$$('File').$basename(file)))); + if ($truthy((self.process_lines = $send(file, 'end_with?', $to_a($$('ASCIIDOC_EXTENSIONS').$keys()))))) { + if ($truthy(($ret_or_1 = self.includes['$[]'](path.$slice(0, path.$rindex(".")))))) ; else { + self.includes['$[]='](path.$slice(0, path.$rindex(".")), ($truthy(attributes['$[]']("partial-option")) ? (nil) : (true))); + } + } } else { + + self.dir = "."; + self.process_lines = true; + if ($truthy((self.path = path))) { + if ($truthy(($ret_or_1 = self.includes['$[]']($$('Helpers').$rootname(path))))) ; else { + self.includes['$[]=']($$('Helpers').$rootname(path), ($truthy(attributes['$[]']("partial-option")) ? (nil) : (true))); + } + } else { + self.path = ""; + } } self.lineno = lineno; + if (($truthy(self.maxdepth) && ($truthy(attributes['$key?']("depth"))))) { + if ($truthy($rb_gt((rel_maxdepth = attributes['$[]']("depth").$to_i()), 0))) { + + if ($truthy($rb_gt((curr_maxdepth = $rb_plus(self.include_stack.$size(), rel_maxdepth)), (abs_maxdepth = self.maxdepth['$[]']("abs"))))) { + curr_maxdepth = (rel_maxdepth = abs_maxdepth); + } self.maxdepth = $hash2(["abs", "curr", "rel"], {"abs": abs_maxdepth, "curr": curr_maxdepth, "rel": rel_maxdepth}); + } else { + self.maxdepth = $hash2(["abs", "curr", "rel"], {"abs": self.maxdepth['$[]']("abs"), "curr": self.include_stack.$size(), "rel": 0}); + } + } if ($truthy((self.lines = self.$prepare_lines(data, $hash2(["normalize", "condense", "indent"], {"normalize": ($truthy(($ret_or_1 = self.process_lines)) ? ($ret_or_1) : ("chomp")), "condense": false, "indent": attributes['$[]']("indent")})))['$empty?']())) { + self.$pop_include(); + } else { + + if ($truthy(attributes['$key?']("leveloffset"))) { + + self.lines = $rb_plus($rb_plus([($truthy((leveloffset = self.document.$attr("leveloffset"))) ? (":leveloffset: " + (leveloffset)) : (":leveloffset!:")), ""], self.lines.$reverse()), ["", ":leveloffset: " + (attributes['$[]']("leveloffset"))]); + self.lineno = $rb_minus(self.lineno, 2); + } else { + self.lines['$reverse!'](); + } self.look_ahead = 0; + } return self; + }, -2); + + $def(self, '$include_depth', function $$include_depth() { + var self = this; + + return self.include_stack.$size() + }); + + $def(self, '$exceeds_max_depth?', function $PreprocessorReader_exceeds_max_depth$ques$11() { + var self = this, $ret_or_1 = nil, $ret_or_2 = nil; + + if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = self.maxdepth)) ? ($rb_ge(self.include_stack.$size(), self.maxdepth['$[]']("curr"))) : ($ret_or_2))))) { + return self.maxdepth['$[]']("rel") + } else { + return $ret_or_1 + } + }); + $alias(self, "exceeded_max_depth?", "exceeds_max_depth?"); + + $def(self, '$shift', function $$shift() { + var $yield = $$shift.$$p || nil, self = this, line = nil; + + $$shift.$$p = null; + if ($truthy(self.unescape_next_line)) { + + self.unescape_next_line = false; + return (line = $send2(self, $find_super(self, 'shift', $$shift, false, true), 'shift', [], $yield)).$slice(1, line.$length()); + } else { + return $send2(self, $find_super(self, 'shift', $$shift, false, true), 'shift', [], $yield) + } + }); + + $def(self, '$include_processors?', function $PreprocessorReader_include_processors$ques$12() { + var self = this; + + if ($truthy(self.include_processor_extensions['$nil?']())) { + if (($truthy(self.document['$extensions?']()) && ($truthy(self.document.$extensions()['$include_processors?']())))) { + return (self.include_processor_extensions = self.document.$extensions().$include_processors())['$!']()['$!']() + } else { + return (self.include_processor_extensions = false) + } + } else { + return self.include_processor_extensions['$!='](false) + } + }); + + $def(self, '$create_include_cursor', function $$create_include_cursor(file, path, lineno) { + var dir = nil; + + + if ($eqeqeq($$$('String'), file)) { + dir = $$$('File').$dirname(file); + } else if ($truthy($$('RUBY_ENGINE_OPAL'))) { + dir = $$$('File').$dirname((file = file.$to_s())); + } else { + + dir = ($eqeq((dir = $$$('File').$dirname(file.$path())), "") ? ("/") : (dir)); + file = file.$to_s(); + } return $$('Cursor').$new(file, dir, path, lineno); + }); + + $def(self, '$to_s', function $$to_s() { + var self = this; + + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line: " + (self.lineno) + ", include depth: " + (self.include_stack.$size()) + ", include stack: [" + ($send(self.include_stack, 'map', [], function $$13(inc){ + + if (inc == null) inc = nil; + return inc.$to_s();}).$join(", ")) + "]}>" + }); + self.$private(); + + $def(self, '$prepare_lines', function $$prepare_lines(data, opts) { + var $yield = $$prepare_lines.$$p || nil, self = this, result = nil, front_matter = nil, $ret_or_1 = nil, last = nil; + + $$prepare_lines.$$p = null; + + if (opts == null) opts = $hash2([], {}); + result = $send2(self, $find_super(self, 'prepare_lines', $$prepare_lines, false, true), 'prepare_lines', [data, opts], $yield); + if ((($truthy(self.document) && ($truthy(self.document.$attributes()['$[]']("skip-front-matter")))) && ($truthy((front_matter = self['$skip_front_matter!'](result)))))) { + self.document.$attributes()['$[]=']("front-matter", front_matter.$join($$('LF'))); + } if ($truthy(opts.$fetch("condense", true))) { + while ($truthy(($truthy(($ret_or_1 = (last = result['$[]'](-1)))) ? (last['$empty?']()) : ($ret_or_1)))) { + result.$pop(); + } + } if ($truthy(opts['$[]']("indent"))) { + $$('Parser')['$adjust_indentation!'](result, opts['$[]']("indent").$to_i(), self.document.$attr("tabsize").$to_i()); + } return result; + }, -2); + + $def(self, '$process_line', function $$process_line(line) { + var $a, self = this; + + + if (!$truthy(self.process_lines)) { + return line + } if ($truthy(line['$empty?']())) { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } if ((($truthy(line['$end_with?']("]")) && ($not(line['$start_with?']("[")))) && ($truthy(line['$include?']("::"))))) { + if (($truthy(line['$include?']("if")) && ($truthy($$('ConditionalDirectiveRx')['$=~'](line))))) { + if ($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), "\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_conditional_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](5))))) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else if (($truthy(line['$start_with?']("inc", "\\inc")) && ($truthy($$('IncludeDirectiveRx')['$=~'](line))))) { + if ($eqeq((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), "\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_include_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3))))) { + return nil + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } }); + + $def(self, '$preprocess_conditional_directive', function $$preprocess_conditional_directive(keyword, target, delimiter, text) { + var $a, self = this, no_target = nil, pair = nil, skip = nil, lhs = nil, op = nil, rhs = nil; + + + if (!$truthy((no_target = target['$empty?']()))) { + target = target.$downcase(); + } if ($eqeq(keyword, "endif")) { + + if ($truthy(text)) { + self.$logger().$error(self.$message_with_context("malformed preprocessor directive - text not permitted: endif::" + (target) + "[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))); + } else if ($truthy(self.conditional_stack['$empty?']())) { + self.$logger().$error(self.$message_with_context("unmatched preprocessor directive: endif::" + (target) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))); + } else if (($truthy(no_target) || ($eqeq(target, (pair = self.conditional_stack['$[]'](-1))['$[]']("target"))))) { + + self.conditional_stack.$pop(); + self.skipping = ($truthy(self.conditional_stack['$empty?']()) ? (false) : (self.conditional_stack['$[]'](-1)['$[]']("skipping"))); + } else { + self.$logger().$error(self.$message_with_context("mismatched preprocessor directive: endif::" + (target) + "[], expected endif::" + (pair['$[]']("target")) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))); + } return true; + } else if ($truthy(self.skipping)) { + skip = false; + } else + switch (keyword) { + case "ifdef": + + if ($truthy(no_target)) { + + self.$logger().$error(self.$message_with_context("malformed preprocessor directive - missing target: ifdef::[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return true; + } + switch (delimiter) { + case ",": + skip = $send(target.$split(",", -1), 'none?', [], function $$14(name){var self = $$14.$$s == null ? this : $$14.$$s; + if (self.document == null) self.document = nil; + + + if (name == null) name = nil; + return self.document.$attributes()['$key?'](name);}, {$$s: self}); + break; + case "+": + skip = $send(target.$split("+", -1), 'any?', [], function $$15(name){var self = $$15.$$s == null ? this : $$15.$$s; + if (self.document == null) self.document = nil; + + + if (name == null) name = nil; + return self.document.$attributes()['$key?'](name)['$!']();}, {$$s: self}); + break; + default: + skip = self.document.$attributes()['$key?'](target)['$!'](); + } break; + case "ifndef": + + if ($truthy(no_target)) { + + self.$logger().$error(self.$message_with_context("malformed preprocessor directive - missing target: ifndef::[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return true; + } + switch (delimiter) { + case ",": + skip = $send(target.$split(",", -1), 'any?', [], function $$16(name){var self = $$16.$$s == null ? this : $$16.$$s; + if (self.document == null) self.document = nil; + + + if (name == null) name = nil; + return self.document.$attributes()['$key?'](name);}, {$$s: self}); + break; + case "+": + skip = $send(target.$split("+", -1), 'all?', [], function $$17(name){var self = $$17.$$s == null ? this : $$17.$$s; + if (self.document == null) self.document = nil; + + + if (name == null) name = nil; + return self.document.$attributes()['$key?'](name);}, {$$s: self}); + break; + default: + skip = self.document.$attributes()['$key?'](target); + } break; + case "ifeval": + if ($truthy(no_target)) { + if (($truthy(text) && ($truthy($$('EvalExpressionRx')['$=~'](text.$strip()))))) { + + lhs = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)); + op = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)); + rhs = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)); + skip = (function() { try { + if ($truthy(self.$resolve_expr_val(lhs).$send(op, self.$resolve_expr_val(rhs)))) { + return false + } else { + return true + } + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + return true + } finally { Opal.pop_exception(); } + } else { throw $err; } + }})(); + } else { + + self.$logger().$error(self.$message_with_context("malformed preprocessor directive - " + (($truthy(text) ? ("invalid expression") : ("missing expression"))) + ": ifeval::[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return true; + } + } else { + + self.$logger().$error(self.$message_with_context("malformed preprocessor directive - target not permitted: ifeval::" + (target) + "[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return true; + } + break; + } if (($eqeq(keyword, "ifeval") || ($not(text)))) { + + if ($truthy(skip)) { + self.skipping = true; + } self.conditional_stack['$<<']($hash2(["target", "skip", "skipping"], {"target": target, "skip": skip, "skipping": self.skipping})); + } else if (!($truthy(self.skipping) || ($truthy(skip)))) { + + self.$replace_next_line(text.$rstrip()); + self.$unshift(""); + if ($truthy(text['$start_with?']("include::"))) { + self.look_ahead = $rb_minus(self.look_ahead, 1); + } } return true; + }); + + $def(self, '$preprocess_include_directive', function $$preprocess_include_directive(target, attrlist) { + var $a, $b, self = this, doc = nil, expanded_target = nil, attr_missing = nil, $ret_or_1 = nil, ext = nil, parsed_attrs = nil, inc_path = nil, target_type = nil, relpath = nil, reader = nil, read_mode = nil, enc = nil, read_mode_params = nil, inc_linenos = nil, inc_tags = nil, tag = nil, inc_lines = nil, inc_offset = nil, inc_lineno = nil, tag_stack = nil, tags_selected = nil, active_tag = nil, select = nil, base_select = nil, wildcard = nil, missing_tags = nil, inc_content = nil; + + + doc = self.document; + if (($truthy((expanded_target = target)['$include?']($$('ATTR_REF_HEAD'))) && ($truthy((expanded_target = doc.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": ($eqeq((attr_missing = ($truthy(($ret_or_1 = doc.$attributes()['$[]']("attribute-missing"))) ? ($ret_or_1) : ($$('Compliance').$attribute_missing()))), "warn") ? ("drop-line") : (attr_missing))})))['$empty?']())))) { + if (($eqeq(attr_missing, "drop-line") && ($truthy(doc.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']())))) { + + $send(self.$logger(), 'info', [], function $$18(){var self = $$18.$$s == null ? this : $$18.$$s; + + return self.$message_with_context("include dropped due to missing attribute: include::" + (target) + "[" + (attrlist) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))}, {$$s: self}); + self.$shift(); + return true; + } else if ($truthy(doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true}))['$[]']("optional-option"))) { + + $send(self.$logger(), 'info', [], function $$19(){var self = $$19.$$s == null ? this : $$19.$$s; + + return self.$message_with_context("optional include dropped " + ((($eqeq(attr_missing, "warn") && ($truthy(doc.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']()))) ? ("due to missing attribute") : ("because resolved target is blank"))) + ": include::" + (target) + "[" + (attrlist) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))}, {$$s: self}); + self.$shift(); + return true; + } else { + + self.$logger().$warn(self.$message_with_context("include dropped " + ((($eqeq(attr_missing, "warn") && ($truthy(doc.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']()))) ? ("due to missing attribute") : ("because resolved target is blank"))) + ": include::" + (target) + "[" + (attrlist) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]"); + } + } else if (($truthy(self['$include_processors?']()) && ($truthy((ext = $send(self.include_processor_extensions, 'find', [], function $$20(candidate){ + + if (candidate == null) candidate = nil; + return candidate.$instance()['$handles?'](expanded_target);})))))) { + + self.$shift(); + ext.$process_method()['$[]'](doc, self, expanded_target, doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true}))); + return true; + } else if ($truthy($rb_ge(doc.$safe(), $$$($$('SafeMode'), 'SECURE')))) { + return self.$replace_next_line("link:" + (expanded_target) + "[role=include]") + } else if ($truthy(self.maxdepth)) { + + if ($truthy($rb_ge(self.include_stack.$size(), self.maxdepth['$[]']("curr")))) { + + self.$logger().$error(self.$message_with_context("maximum include depth of " + (self.maxdepth['$[]']("rel")) + " exceeded", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return nil; + } parsed_attrs = doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true})); + $b = self.$resolve_include_path(expanded_target, attrlist, parsed_attrs), $a = $to_ary($b), (inc_path = ($a[0] == null ? nil : $a[0])), (target_type = ($a[1] == null ? nil : $a[1])), (relpath = ($a[2] == null ? nil : $a[2])); + + switch (target_type) { + case "file": + + reader = $$$('File').$method("open"); + read_mode = $$('FILE_READ_MODE'); + break; + case "uri": + + reader = $$$('OpenURI').$method("open_uri"); + read_mode = $$('URI_READ_MODE'); + break; + default: + return inc_path + } if (!$truthy($$('RUBY_ENGINE_OPAL'))) { + if (($truthy((enc = parsed_attrs['$[]']("encoding"))) && ($truthy((function() { try { + return $$$('Encoding').$find(enc) + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + return nil + } finally { Opal.pop_exception(); } + } else { throw $err; } + }})())))) { + + (read_mode_params = read_mode.$split(":"))['$[]='](1, enc); + read_mode = read_mode_params.$join(":"); + } + } inc_linenos = (inc_tags = nil); + if ($truthy(attrlist)) { + if ($truthy(parsed_attrs['$key?']("lines"))) { + + inc_linenos = []; + $send(self.$split_delimited_value(parsed_attrs['$[]']("lines")), 'each', [], function $$21(linedef){var $c, $d, from = nil, to = nil; + + + if (linedef == null) linedef = nil; + if ($truthy(linedef['$include?'](".."))) { + + $d = linedef.$partition(".."), $c = $to_ary($d), (from = ($c[0] == null ? nil : $c[0])), (($c[1] == null ? nil : $c[1])), (to = ($c[2] == null ? nil : $c[2])); + return (inc_linenos = $rb_plus(inc_linenos, (($truthy(to['$empty?']()) || ($truthy($rb_lt((to = to.$to_i()), 0)))) ? ([from.$to_i(), $$$($$$('Float'), 'INFINITY')]) : (Opal.Range.$new(from.$to_i(), to, false).$to_a())))); + } else { + return inc_linenos['$<<'](linedef.$to_i()) + }}); + inc_linenos = ($truthy(inc_linenos['$empty?']()) ? (nil) : (inc_linenos.$sort().$uniq())); + } else if ($truthy(parsed_attrs['$key?']("tag"))) { + if (!($truthy((tag = parsed_attrs['$[]']("tag"))['$empty?']()) || ($eqeq(tag, "!")))) { + inc_tags = ($truthy(tag['$start_with?']("!")) ? ($hash(tag.$slice(1, tag.$length()), false)) : ($hash(tag, true))); + } + } else if ($truthy(parsed_attrs['$key?']("tags"))) { + + inc_tags = $hash2([], {}); + $send(self.$split_delimited_value(parsed_attrs['$[]']("tags")), 'each', [], function $$22(tagdef){var $c; + + + if (tagdef == null) tagdef = nil; + if (($truthy(tagdef['$empty?']()) || ($eqeq(tagdef, "!")))) { + return nil + } else if ($truthy(tagdef['$start_with?']("!"))) { + return ($c = [tagdef.$slice(1, tagdef.$length()), false], $send(inc_tags, '[]=', $c), $c[$c.length - 1]) + } else { + return ($c = [tagdef, true], $send(inc_tags, '[]=', $c), $c[$c.length - 1]) + }}); + if ($truthy(inc_tags['$empty?']())) { + inc_tags = nil; + } } + } if ($truthy(inc_linenos)) { + + $a = [[], nil, 0], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]); + + try { + $send(reader, 'call', [inc_path, read_mode], function $$23(f){var select_remaining = nil; + + + if (f == null) f = nil; + select_remaining = nil; + return (function(){try { var $t_break = $thrower('break'); return $send(f, 'each_line', [], function $$24(l){var select = nil; + + + if (l == null) l = nil; + inc_lineno = $rb_plus(inc_lineno, 1); + if (($truthy(select_remaining) || (($eqeqeq($$$('Float'), (select = inc_linenos['$[]'](0))) && ($truthy((select_remaining = select['$infinite?']()))))))) { + + inc_offset = ($truthy(($ret_or_1 = inc_offset)) ? ($ret_or_1) : (inc_lineno)); + return inc_lines['$<<'](l); + } else { + + if ($eqeq(select, inc_lineno)) { + + inc_offset = ($truthy(($ret_or_1 = inc_offset)) ? ($ret_or_1) : (inc_lineno)); + inc_lines['$<<'](l); + inc_linenos.$shift(); + }; + if ($truthy(inc_linenos['$empty?']())) { + $t_break.$throw(); + } else { + return nil + }; + };})} catch($e) { + if ($e === $t_break) return $e.$v; + throw $e; + }})();}); + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception(); } + } else { throw $err; } + } self.$shift(); + if ($truthy(inc_offset)) { + + parsed_attrs['$[]=']("partial-option", ""); + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs); + } } else if ($truthy(inc_tags)) { + + $a = [[], nil, 0, [], $$$('Set').$new(), nil], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), (tag_stack = $a[3]), (tags_selected = $a[4]), (active_tag = $a[5]); + if ($truthy(inc_tags['$key?']("**"))) { + + select = (base_select = inc_tags.$delete("**")); + if ($truthy(inc_tags['$key?']("*"))) { + wildcard = inc_tags.$delete("*"); + } else if (($not(select) && ($eqeq(inc_tags.$values().$first(), false)))) { + wildcard = true; + } } else if ($truthy(inc_tags['$key?']("*"))) { + if ($eqeq(inc_tags.$keys().$first(), "*")) { + select = (base_select = (wildcard = inc_tags.$delete("*"))['$!']()); + } else { + + select = (base_select = false); + wildcard = inc_tags.$delete("*"); + } + } else { + select = (base_select = inc_tags['$value?'](true)['$!']()); + } + try { + $send(reader, 'call', [inc_path, read_mode], function $$25(f){var $c, self = $$25.$$s == null ? this : $$25.$$s, dbl_co = nil, dbl_sb = nil; + + + if (f == null) f = nil; + $c = ["::", "[]"], (dbl_co = $c[0]), (dbl_sb = $c[1]), $c; + return $send(f, 'each_line', [], function $$26(l){var $d, $e, self = $$26.$$s == null ? this : $$26.$$s, this_tag = nil, include_cursor = nil, idx = nil; + + + if (l == null) l = nil; + inc_lineno = $rb_plus(inc_lineno, 1); + if ((($truthy(l['$include?'](dbl_co)) && ($truthy(l['$include?'](dbl_sb)))) && ($truthy($$('TagDirectiveRx')['$=~'](l))))) { + + this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)); + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + if ($eqeq(this_tag, active_tag)) { + + tag_stack.$pop(); + return $e = ($truthy(tag_stack['$empty?']()) ? ([nil, base_select]) : (tag_stack['$[]'](-1))), $d = $to_ary($e), (active_tag = ($d[0] == null ? nil : $d[0])), (select = ($d[1] == null ? nil : $d[1])), $e; + } else if ($truthy(inc_tags['$key?'](this_tag))) { + + include_cursor = self.$create_include_cursor(inc_path, expanded_target, inc_lineno); + if ($truthy((idx = $send(tag_stack, 'rindex', [], function $$27(key){ + + if (key == null) key = nil; + return key['$=='](this_tag);}, {$$has_trailing_comma_in_args: true})))) { + + if ($eqeq(idx, 0)) { + tag_stack.$shift(); + } else { + + tag_stack.$delete_at(idx); + }; + return self.$logger().$warn(self.$message_with_context("mismatched end tag (expected '" + (active_tag) + "' but found '" + (this_tag) + "') at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))); + } else { + return self.$logger().$warn(self.$message_with_context("unexpected end tag '" + (this_tag) + "' at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))) + }; + } else { + return nil + } + } else if ($truthy(inc_tags['$key?'](this_tag))) { + + if ($truthy((select = inc_tags['$[]'](this_tag)))) { + tags_selected['$<<'](this_tag); + }; + return tag_stack['$<<']([(active_tag = this_tag), select, inc_lineno]); + } else if ($not(wildcard['$nil?']())) { + + select = (($truthy(active_tag) && ($not(select))) ? (false) : (wildcard)); + return tag_stack['$<<']([(active_tag = this_tag), select, inc_lineno]); + } else { + return nil + }; + } else if ($truthy(select)) { + + inc_offset = ($truthy(($ret_or_1 = inc_offset)) ? ($ret_or_1) : (inc_lineno)); + return inc_lines['$<<'](l); + } else { + return nil + };}, {$$s: self});}, {$$s: self}); + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception(); } + } else { throw $err; } + } if (!$truthy(tag_stack['$empty?']())) { + $send(tag_stack, 'each', [], function $$28(tag_name, _, tag_lineno){var self = $$28.$$s == null ? this : $$28.$$s; + + + if (tag_name == null) tag_name = nil; + if (tag_lineno == null) tag_lineno = nil; + return self.$logger().$warn(self.$message_with_context("detected unclosed tag '" + (tag_name) + "' starting at line " + (tag_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": self.$create_include_cursor(inc_path, expanded_target, tag_lineno)})));}, {$$s: self}); + } if (!$truthy((missing_tags = $rb_minus($send(inc_tags, 'keep_if', [], function $$29(_, v){ + if (v == null) v = nil; + return v;}).$keys(), tags_selected.$to_a()))['$empty?']())) { + self.$logger().$warn(self.$message_with_context("tag" + (($truthy($rb_gt(missing_tags.$size(), 1)) ? ("s") : (""))) + " '" + (missing_tags.$join(", ")) + "' not found in include " + (target_type) + ": " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + } self.$shift(); + if ($truthy(inc_offset)) { + + if (!(($truthy(base_select) && ($neqeq(wildcard, false))) && ($truthy(inc_tags['$empty?']())))) { + parsed_attrs['$[]=']("partial-option", ""); + } self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs); + } } else { + + inc_content = nil; + + try { + + inc_content = $send(reader, 'call', [inc_path, read_mode], function $$30(f){ + + if (f == null) f = nil; + return f.$read();}); + self.$shift(); + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception(); } + } else { throw $err; } + } self.$push_include(inc_content, inc_path, relpath, 1, parsed_attrs); + } return true; + } else { + return nil + } }); + + $def(self, '$resolve_include_path', function $$resolve_include_path(target, attrlist, attributes) { + var $b, self = this, doc = nil, inc_path = nil, relpath = nil; + + + doc = self.document; + if (($truthy($$('Helpers')['$uriish?'](target)) || ($truthy(($eqeqeq($$$('String'), self.dir) ? (nil) : ((target = "" + (self.dir) + "/" + (target)))))))) { + + if (!$truthy(doc['$attr?']("allow-uri-read"))) { + return self.$replace_next_line("link:" + (target) + "[role=include]") + } if ($truthy(doc['$attr?']("cache-uri"))) { + if (!$truthy((($b = $$$('::', 'OpenURI', 'skip_raise')) && ($$$($b, 'Cache', 'skip_raise')) ? 'constant' : nil))) { + $$('Helpers').$require_library("open-uri/cached", "open-uri-cached"); + } + } else if ($not($$('RUBY_ENGINE_OPAL'))) { + $$$('OpenURI'); + } return [$$$('URI').$parse(target), "uri", target]; + } else { + + inc_path = doc.$normalize_system_path(target, self.dir, nil, $hash2(["target_name"], {"target_name": "include file"})); + if (!$truthy($$$('File')['$file?'](inc_path))) { + if ($truthy(attributes['$[]']("optional-option"))) { + + $send(self.$logger(), 'info', [], function $$31(){var self = $$31.$$s == null ? this : $$31.$$s; + + return self.$message_with_context("optional include dropped because include file not found: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))}, {$$s: self}); + self.$shift(); + return true; + } else { + + self.$logger().$error(self.$message_with_context("include file not found: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]"); + } + } relpath = doc.$path_resolver().$relative_path(inc_path, doc.$base_dir()); + return [inc_path, "file", relpath]; + } }); + + $def(self, '$pop_include', function $$pop_include() { + var $a, $b, self = this; + + if ($truthy(self.include_stack['$empty?']())) { + return nil + } else { + + $b = self.include_stack.$pop(), $a = $to_ary($b), (self.lines = ($a[0] == null ? nil : $a[0])), (self.file = ($a[1] == null ? nil : $a[1])), (self.dir = ($a[2] == null ? nil : $a[2])), (self.path = ($a[3] == null ? nil : $a[3])), (self.lineno = ($a[4] == null ? nil : $a[4])), (self.maxdepth = ($a[5] == null ? nil : $a[5])), (self.process_lines = ($a[6] == null ? nil : $a[6])); + self.look_ahead = 0; + return nil; + } + }); + + $def(self, '$split_delimited_value', function $$split_delimited_value(val) { + + if ($truthy(val['$include?'](","))) { + + return val.$split(","); + } else { + + return val.$split(";"); + } + }); + + $def(self, '$skip_front_matter!', function $PreprocessorReader_skip_front_matter$excl$32(data, increment_linenos) { + var self = this, delim = nil, original_data = nil, front_matter = nil, $ret_or_1 = nil, eof = nil; + + + if (increment_linenos == null) increment_linenos = true; + if (!$eqeq((delim = data['$[]'](0)), "---")) { + return nil + } original_data = data.$drop(0); + data.$shift(); + front_matter = []; + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1); + } while (!($truthy(($truthy(($ret_or_1 = (eof = data['$empty?']()))) ? ($ret_or_1) : (data['$[]'](0)['$=='](delim)))))) { + + front_matter['$<<'](data.$shift()); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1); + } } if ($truthy(eof)) { + + $send(data, 'unshift', $to_a(original_data)); + if ($truthy(increment_linenos)) { + self.lineno = $rb_minus(self.lineno, original_data.$size()); + } return nil; + } data.$shift(); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1); + } return front_matter; + }, -2); + return $def(self, '$resolve_expr_val', function $$resolve_expr_val(val) { + var self = this, quoted = nil; + + + if ((($truthy(val['$start_with?']("\"")) && ($truthy(val['$end_with?']("\"")))) || (($truthy(val['$start_with?']("'")) && ($truthy(val['$end_with?']("'"))))))) { + + quoted = true; + val = val.$slice(1, $rb_minus(val.$length(), 1)); + } else { + quoted = false; + } if ($truthy(val['$include?']($$('ATTR_REF_HEAD')))) { + val = self.document.$sub_attributes(val, $hash2(["attribute_missing"], {"attribute_missing": "drop"})); + } if ($truthy(quoted)) { + return val + } else if ($truthy(val['$empty?']())) { + return nil + } else if ($eqeq(val, "true")) { + return true + } else if ($eqeq(val, "false")) { + return false + } else if ($truthy(val.$rstrip()['$empty?']())) { + return " " + } else if ($truthy(val['$include?']("."))) { + return val.$to_f() + } else { + return val.$to_i() + } }); + })($nesting[0], $$('Reader'), $nesting); + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/section"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send2 = Opal.send2, $find_super = Opal.find_super, $eqeqeq = Opal.eqeqeq, $truthy = Opal.truthy, $rb_plus = Opal.rb_plus, $def = Opal.def, $alias = Opal.alias, $rb_gt = Opal.rb_gt, $eqeq = Opal.eqeq, $not = Opal.not, $send = Opal.send, $defs = Opal.defs, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('attr_accessor,attr_reader,===,+,level,special,title,generate_id,>,==,sectnum,!,empty?,reftext,sub_placeholder,sub_quotes,compat_mode,[],attributes,context,assign_numeral,class,object_id,inspect,size,[]=,chr,length,gsub,downcase,delete,tr_s,end_with?,chop,start_with?,slice,key?,catalog,unique_id_start_index'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Section'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.document = $proto.next_section_index = $proto.parent = $proto.level = $proto.numeral = $proto.numbered = $proto.sectname = $proto.title = $proto.blocks = nil; + + self.$attr_accessor("index"); + self.$attr_accessor("sectname"); + self.$attr_accessor("special"); + self.$attr_accessor("numbered"); + self.$attr_reader("caption"); + + $def(self, '$initialize', function $$initialize(parent, level, numbered, opts) { + var $a; $$initialize.$$p || nil; var self = this, $ret_or_1 = nil; + + $$initialize.$$p = null; + + if (parent == null) parent = nil; + if (level == null) level = nil; + if (numbered == null) numbered = false; + if (opts == null) opts = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [parent, "section", opts], null); + if ($eqeqeq($$('Section'), parent)) { + $a = [($truthy(($ret_or_1 = level)) ? ($ret_or_1) : ($rb_plus(parent.$level(), 1))), parent.$special()], (self.level = $a[0]), (self.special = $a[1]); + } else { + $a = [($truthy(($ret_or_1 = level)) ? ($ret_or_1) : (1)), false], (self.level = $a[0]), (self.special = $a[1]); + } self.numbered = numbered; + return (self.index = 0); + }, -1); + $alias(self, "name", "title"); + + $def(self, '$generate_id', function $$generate_id() { + var self = this; + + return $$('Section').$generate_id(self.$title(), self.document) + }); + + $def(self, '$sections?', function $Section_sections$ques$1() { + var self = this; + + return $rb_gt(self.next_section_index, 0) + }); + + $def(self, '$sectnum', function $$sectnum(delimiter, append) { + var self = this, $ret_or_1 = nil; + + + if (delimiter == null) delimiter = "."; + if (append == null) append = nil; + append = ($truthy(($ret_or_1 = append)) ? ($ret_or_1) : (($eqeq(append, false) ? ("") : (delimiter)))); + if (($truthy($rb_gt(self.level, 1)) && ($eqeqeq($$('Section'), self.parent)))) { + return "" + (self.parent.$sectnum(delimiter, delimiter)) + (self.numeral) + (append) + } else { + return "" + (self.numeral) + (append) + } }, -1); + + $def(self, '$xreftext', function $$xreftext(xrefstyle) { + var self = this, val = nil, type = nil, quoted_title = nil, signifier = nil; + + + if (xrefstyle == null) xrefstyle = nil; + if (($truthy((val = self.$reftext())) && ($not(val['$empty?']())))) { + return val + } else if ($truthy(xrefstyle)) { + if ($truthy(self.numbered)) { + + switch (xrefstyle) { + case "full": + + if (($eqeq((type = self.sectname), "chapter") || ($eqeq(type, "appendix")))) { + quoted_title = self.$sub_placeholder(self.$sub_quotes("_%s_"), self.$title()); + } else { + quoted_title = self.$sub_placeholder(self.$sub_quotes(($truthy(self.document.$compat_mode()) ? ("``%s''") : ("\"`%s`\""))), self.$title()); + } if ($truthy((signifier = self.document.$attributes()['$[]']("" + (type) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", ",")) + " " + (quoted_title) + } else { + return "" + (self.$sectnum(".", ",")) + " " + (quoted_title) + } case "short": + if ($truthy((signifier = self.document.$attributes()['$[]']("" + (self.sectname) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", "")) + } else { + return self.$sectnum(".", "") + } + default: + if (($eqeq((type = self.sectname), "chapter") || ($eqeq(type, "appendix")))) { + + return self.$sub_placeholder(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + } + } + } else if (($eqeq((type = self.sectname), "chapter") || ($eqeq(type, "appendix")))) { + + return self.$sub_placeholder(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + } + } else { + return self.$title() + } }, -1); + + $def(self, '$<<', function $Section_$lt$lt$2(block) { + var $yield = $Section_$lt$lt$2.$$p || nil, self = this; + + $Section_$lt$lt$2.$$p = null; + + if ($eqeq(block.$context(), "section")) { + self.$assign_numeral(block); + } return $send2(self, $find_super(self, '<<', $Section_$lt$lt$2, false, true), '<<', [block], $yield); + }); + + $def(self, '$to_s', function $$to_s() { + var $yield = $$to_s.$$p || nil, self = this, formal_title = nil; + + $$to_s.$$p = null; + if ($truthy(self.title)) { + + formal_title = ($truthy(self.numbered) ? ("" + (self.$sectnum()) + " " + (self.title)) : (self.title)); + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {level: " + (self.level) + ", title: " + (formal_title.$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>"; + } else { + return $send2(self, $find_super(self, 'to_s', $$to_s, false, true), 'to_s', [], $yield) + } + }); + return $defs(self, '$generate_id', function $$generate_id(title, document) { + var $a, attrs = nil, pre = nil, $ret_or_1 = nil, sep = nil, no_sep = nil, sep_sub = nil, gen_id = nil, ids = nil, cnt = nil, candidate_id = nil; + + + attrs = document.$attributes(); + pre = ($truthy(($ret_or_1 = attrs['$[]']("idprefix"))) ? ($ret_or_1) : ("_")); + if ($truthy((sep = attrs['$[]']("idseparator")))) { + if (($eqeq(sep.$length(), 1) || (($not((no_sep = sep['$empty?']())) && ($truthy((sep = ($a = ["idseparator", sep.$chr()], $send(attrs, '[]=', $a), $a[$a.length - 1])))))))) { + sep_sub = (($eqeq(sep, "-") || ($eqeq(sep, "."))) ? (" .-") : (" " + (sep) + ".-")); + } + } else { + $a = ["_", " _.-"], (sep = $a[0]), (sep_sub = $a[1]); + } gen_id = "" + (pre) + (title.$downcase().$gsub($$('InvalidSectionIdCharsRx'), "")); + if ($truthy(no_sep)) { + gen_id = gen_id.$delete(" "); + } else { + + gen_id = gen_id.$tr_s(sep_sub, sep); + if ($truthy(gen_id['$end_with?'](sep))) { + gen_id = gen_id.$chop(); + } if (($truthy(pre['$empty?']()) && ($truthy(gen_id['$start_with?'](sep))))) { + gen_id = gen_id.$slice(1, gen_id.$length()); + } } if ($truthy(document.$catalog()['$[]']("refs")['$key?'](gen_id))) { + + ids = document.$catalog()['$[]']("refs"); + cnt = $$('Compliance').$unique_id_start_index(); + while ($truthy(ids['$[]']((candidate_id = "" + (gen_id) + (sep) + (cnt))))) { + cnt = $rb_plus(cnt, 1); + } return candidate_id; + } else { + return gen_id + } }); + })($nesting[0], $$('AbstractBlock'), $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/stylesheets"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $return_ivar = Opal.return_ivar, $defs = Opal.defs, $def = Opal.def, $truthy = Opal.truthy, $hash2 = Opal.hash2, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('join,new,rstrip,read,primary_stylesheet_data,write,primary_stylesheet_name,stylesheet_basename,for,read_stylesheet,coderay_stylesheet_data,coderay_stylesheet_name,pygments_stylesheet_data,pygments_stylesheet_name'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Stylesheets'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.primary_stylesheet_data = nil; + + $const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + $const_set($nesting[0], 'STYLESHEETS_DIR', $$$('File').$join($$('DATA_DIR'), "stylesheets")); + self.__instance__ = self.$new(); + $defs(self, '$instance', $return_ivar("__instance__")); + + $def(self, '$primary_stylesheet_name', function $$primary_stylesheet_name() { + + return $$('DEFAULT_STYLESHEET_NAME') + }); + + $def(self, '$primary_stylesheet_data', function $$primary_stylesheet_data() { + var self = this, $ret_or_1 = nil; + + return (self.primary_stylesheet_data = ($truthy(($ret_or_1 = self.primary_stylesheet_data)) ? ($ret_or_1) : ($$$('File').$read($$$('File').$join($$('STYLESHEETS_DIR'), "asciidoctor-default.css"), $hash2(["mode"], {"mode": $$('FILE_READ_MODE')})).$rstrip()))) + }); + + $def(self, '$embed_primary_stylesheet', function $$embed_primary_stylesheet() { + var self = this; + + return "" + }); + + $def(self, '$write_primary_stylesheet', function $$write_primary_stylesheet(target_dir) { + var self = this; + + + if (target_dir == null) target_dir = "."; + return $$$('File').$write($$$('File').$join(target_dir, self.$primary_stylesheet_name()), self.$primary_stylesheet_data(), $hash2(["mode"], {"mode": $$('FILE_WRITE_MODE')})); + }, -1); + + $def(self, '$coderay_stylesheet_name', function $$coderay_stylesheet_name() { + + return $$('SyntaxHighlighter').$for("coderay").$stylesheet_basename() + }); + + $def(self, '$coderay_stylesheet_data', function $$coderay_stylesheet_data() { + + return $$('SyntaxHighlighter').$for("coderay").$read_stylesheet() + }); + + $def(self, '$embed_coderay_stylesheet', function $$embed_coderay_stylesheet() { + var self = this; + + return "" + }); + + $def(self, '$write_coderay_stylesheet', function $$write_coderay_stylesheet(target_dir) { + var self = this; + + + if (target_dir == null) target_dir = "."; + return $$$('File').$write($$$('File').$join(target_dir, self.$coderay_stylesheet_name()), self.$coderay_stylesheet_data(), $hash2(["mode"], {"mode": $$('FILE_WRITE_MODE')})); + }, -1); + + $def(self, '$pygments_stylesheet_name', function $$pygments_stylesheet_name(style) { + + + if (style == null) style = nil; + return $$('SyntaxHighlighter').$for("pygments").$stylesheet_basename(style); + }, -1); + + $def(self, '$pygments_stylesheet_data', function $$pygments_stylesheet_data(style) { + + + if (style == null) style = nil; + return $$('SyntaxHighlighter').$for("pygments").$read_stylesheet(style); + }, -1); + + $def(self, '$embed_pygments_stylesheet', function $$embed_pygments_stylesheet(style) { + var self = this; + + + if (style == null) style = nil; + return ""; + }, -1); + return $def(self, '$write_pygments_stylesheet', function $$write_pygments_stylesheet(target_dir, style) { + var self = this; + + + if (target_dir == null) target_dir = "."; + if (style == null) style = nil; + return $$$('File').$write($$$('File').$join(target_dir, self.$pygments_stylesheet_name(style)), self.$pygments_stylesheet_data(style), $hash2(["mode"], {"mode": $$('FILE_WRITE_MODE')})); + }, -1); + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/table"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $def = Opal.def, $alias = Opal.alias, $hash2 = Opal.hash2, $send2 = Opal.send2, $find_super = Opal.find_super, $truthy = Opal.truthy, $rb_lt = Opal.rb_lt, $rb_gt = Opal.rb_gt, $eqeq = Opal.eqeq, $rb_times = Opal.rb_times, $rb_divide = Opal.rb_divide, $send = Opal.send, $rb_plus = Opal.rb_plus, $rb_minus = Opal.rb_minus, $return_val = Opal.return_val, $to_a = Opal.to_a, $gvars = Opal.gvars, $neqeq = Opal.neqeq, $return_ivar = Opal.return_ivar, $to_ary = Opal.to_ary, $regexp = Opal.regexp, $not = Opal.not, $thrower = Opal.thrower, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('attr_accessor,send,attr_reader,new,[],<,>,to_i,==,[]=,attributes,truncate,*,/,to_f,empty?,body,each,<<,size,+,assign_column_widths,warn,logger,-,update_attributes,assign_width,round,head=,map,shift,reinitialize,nil?,unshift,foot=,pop,parent,sourcemap,dup,header_row?,table,style,merge,delete,start_with?,rstrip,slice,length,advance,lstrip,strip,split,include?,readlines,catalog_inline_anchor,=~,apply_subs,attr_writer,convert,text,!=,file,lineno,include,to_set,mark,key?,nested?,document,error,message_with_context,cursor_at_prev_line,nil_or_empty?,escape,columns,match,chop,end_with?,gsub,!,push_cellspec,cell_open?,close_cell,take_cellspec,squeeze,upto,times,cursor_before_mark,rowspan,activate_rowspan,colspan,end_of_row?,close_row,private,rows,effective_column_visits'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Table'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.attributes = $proto.document = $proto.rows = $proto.has_header_option = $proto.columns = nil; + + $const_set($nesting[0], 'DEFAULT_PRECISION', 4); + (function($base, $super) { + var self = $klass($base, $super, 'Rows'); + + var $proto = self.$$prototype; + + $proto.head = $proto.body = $proto.foot = nil; + + self.$attr_accessor("head", "foot", "body"); + + $def(self, '$initialize', function $$initialize(head, foot, body) { + var self = this; + + + if (head == null) head = []; + if (foot == null) foot = []; + if (body == null) body = []; + self.head = head; + self.foot = foot; + return (self.body = body); + }, -1); + $alias(self, "[]", "send"); + + $def(self, '$by_section', function $$by_section() { + var self = this; + + return [["head", self.head], ["body", self.body], ["foot", self.foot]] + }); + return $def(self, '$to_h', function $$to_h() { + var self = this; + + return $hash2(["head", "body", "foot"], {"head": self.head, "body": self.body, "foot": self.foot}) + }); + })($nesting[0], null); + self.$attr_accessor("columns"); + self.$attr_accessor("rows"); + self.$attr_accessor("has_header_option"); + self.$attr_reader("caption"); + + $def(self, '$initialize', function $$initialize(parent, attributes) { + var $a; $$initialize.$$p || nil; var self = this, pcwidth = nil, pcwidth_intval = nil, abswidth_val = nil; + + $$initialize.$$p = null; + + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [parent, "table"], null); + self.rows = $$('Rows').$new(); + self.columns = []; + self.has_header_option = false; + if ($truthy((pcwidth = attributes['$[]']("width")))) { + if (($truthy($rb_gt((pcwidth_intval = pcwidth.$to_i()), 100)) || ($truthy($rb_lt(pcwidth_intval, 1))))) { + if (!($eqeq(pcwidth_intval, 0) && (($eqeq(pcwidth, "0") || ($eqeq(pcwidth, "0%")))))) { + pcwidth_intval = 100; + } + } + } else { + pcwidth_intval = 100; + } self.attributes['$[]=']("tablepcwidth", pcwidth_intval); + if ($truthy(self.document.$attributes()['$[]']("pagewidth"))) { + self.attributes['$[]=']("tableabswidth", ($eqeq((abswidth_val = $rb_times($rb_divide(pcwidth_intval, 100), self.document.$attributes()['$[]']("pagewidth").$to_f()).$truncate($$('DEFAULT_PRECISION'))), abswidth_val.$to_i()) ? (abswidth_val.$to_i()) : (abswidth_val))); + } if ($truthy(attributes['$[]']("rotate-option"))) { + return ($a = ["orientation", "landscape"], $send(self.attributes, '[]=', $a), $a[$a.length - 1]) + } else { + return nil + } }); + + $def(self, '$header_row?', function $Table_header_row$ques$1() { + var self = this, val = nil; + + if (($truthy((val = self.has_header_option)) && ($truthy(self.rows.$body()['$empty?']())))) { + return val + } else { + return nil + } + }); + + $def(self, '$create_columns', function $$create_columns(colspecs) { + var self = this, cols = nil, autowidth_cols = nil, width_base = nil, num_cols = nil; + + + cols = []; + autowidth_cols = nil; + width_base = 0; + $send(colspecs, 'each', [], function $$2(colspec){var self = $$2.$$s == null ? this : $$2.$$s, colwidth = nil, $ret_or_1 = nil; + + + if (colspec == null) colspec = nil; + colwidth = colspec['$[]']("width"); + cols['$<<']($$('Column').$new(self, cols.$size(), colspec)); + if ($truthy($rb_lt(colwidth, 0))) { + return (autowidth_cols = ($truthy(($ret_or_1 = autowidth_cols)) ? ($ret_or_1) : ([])))['$<<'](cols['$[]'](-1)) + } else { + return (width_base = $rb_plus(width_base, colwidth)) + }}, {$$s: self}); + if ($truthy($rb_gt((num_cols = (self.columns = cols).$size()), 0))) { + + self.attributes['$[]=']("colcount", num_cols); + if (!($truthy($rb_gt(width_base, 0)) || ($truthy(autowidth_cols)))) { + width_base = nil; + } self.$assign_column_widths(width_base, autowidth_cols); + } return nil; + }); + + $def(self, '$assign_column_widths', function $$assign_column_widths(width_base, autowidth_cols) { + var self = this, precision = nil, total_width = nil, col_pcwidth = nil, autowidth = nil, autowidth_attrs = nil; + + + if (width_base == null) width_base = nil; + if (autowidth_cols == null) autowidth_cols = nil; + precision = $$('DEFAULT_PRECISION'); + total_width = (col_pcwidth = 0); + if ($truthy(width_base)) { + + if ($truthy(autowidth_cols)) { + + if ($truthy($rb_gt(width_base, 100))) { + + autowidth = 0; + self.$logger().$warn("total column width must not exceed 100% when using autowidth columns; got " + (width_base) + "%"); + } else { + + autowidth = $rb_divide($rb_minus(100, width_base), autowidth_cols.$size()).$truncate(precision); + if ($eqeq(autowidth.$to_i(), autowidth)) { + autowidth = autowidth.$to_i(); + } width_base = 100; + } autowidth_attrs = $hash2(["width", "autowidth-option"], {"width": autowidth, "autowidth-option": ""}); + $send(autowidth_cols, 'each', [], function $$3(col){ + + if (col == null) col = nil; + return col.$update_attributes(autowidth_attrs);}); + } $send(self.columns, 'each', [], function $$4(col){ + + if (col == null) col = nil; + return (total_width = $rb_plus(total_width, (col_pcwidth = col.$assign_width(nil, width_base, precision))));}); + } else { + + col_pcwidth = $rb_divide(100, self.columns.$size()).$truncate(precision); + if ($eqeq(col_pcwidth.$to_i(), col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i(); + } $send(self.columns, 'each', [], function $$5(col){ + + if (col == null) col = nil; + return (total_width = $rb_plus(total_width, col.$assign_width(col_pcwidth, nil, precision)));}); + } if (!$eqeq(total_width, 100)) { + self.columns['$[]'](-1).$assign_width($rb_plus($rb_minus(100, total_width), col_pcwidth).$round(precision), nil, precision); + } return nil; + }, -1); + return $def(self, '$partition_header_footer', function $$partition_header_footer(attrs) { + var $a, self = this, num_body_rows = nil, body = nil; + + + num_body_rows = ($a = ["rowcount", (body = self.rows.$body()).$size()], $send(self.attributes, '[]=', $a), $a[$a.length - 1]); + if ($truthy($rb_gt(num_body_rows, 0))) { + if ($truthy(self.has_header_option)) { + + self.rows['$head=']([$send(body.$shift(), 'map', [], function $$6(cell){ + + if (cell == null) cell = nil; + return cell.$reinitialize(true);})]); + num_body_rows = $rb_minus(num_body_rows, 1); + } else if ($truthy(self.has_header_option['$nil?']())) { + + self.has_header_option = false; + body.$unshift($send(body.$shift(), 'map', [], function $$7(cell){ + + if (cell == null) cell = nil; + return cell.$reinitialize(false);})); + } + } if (($truthy($rb_gt(num_body_rows, 0)) && ($truthy(attrs['$[]']("footer-option"))))) { + self.rows['$foot=']([body.$pop()]); + } return nil; + }); + })($nesting[0], $$('AbstractBlock'), $nesting); + (function($base, $super) { + var self = $klass($base, $super, 'Column'); + + var $proto = self.$$prototype; + + $proto.attributes = nil; + + self.$attr_accessor("style"); + + $def(self, '$initialize', function $$initialize(table, index, attributes) { + $$initialize.$$p || nil; var self = this; + + $$initialize.$$p = null; + + if (attributes == null) attributes = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [table, "table_column"], null); + self.style = attributes['$[]']("style"); + attributes['$[]=']("colnumber", $rb_plus(index, 1)); + if ($truthy((attributes['$[]']("width")))) ; else { + attributes['$[]=']("width", 1); + } if ($truthy((attributes['$[]']("halign")))) ; else { + attributes['$[]=']("halign", "left"); + } if ($truthy((attributes['$[]']("valign")))) ; else { + attributes['$[]=']("valign", "top"); + } return self.$update_attributes(attributes); + }, -3); + $alias(self, "table", "parent"); + + $def(self, '$assign_width', function $$assign_width(col_pcwidth, width_base, precision) { + var $a, self = this, col_abswidth = nil; + + + if ($truthy(width_base)) { + + col_pcwidth = $rb_divide($rb_times(self.attributes['$[]']("width").$to_f(), 100), width_base).$truncate(precision); + if ($eqeq(col_pcwidth.$to_i(), col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i(); + } } if ($truthy(self.$parent().$attributes()['$[]']("tableabswidth"))) { + self.attributes['$[]=']("colabswidth", ($eqeq((col_abswidth = $rb_times($rb_divide(col_pcwidth, 100), self.$parent().$attributes()['$[]']("tableabswidth")).$truncate(precision)), col_abswidth.$to_i()) ? (col_abswidth.$to_i()) : (col_abswidth))); + } return ($a = ["colpcwidth", col_pcwidth], $send(self.attributes, '[]=', $a), $a[$a.length - 1]); + }); + + $def(self, '$block?', $return_val(false)); + return $def(self, '$inline?', $return_val(false)); + })($$('Table'), $$('AbstractNode')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Cell'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.document = $proto.reinitialize_args = $proto.attributes = $proto.cursor = $proto.text = $proto.subs = $proto.style = $proto.inner_document = $proto.source_location = $proto.colspan = $proto.rowspan = nil; + + $const_set($nesting[0], 'DOUBLE_LF', $rb_times($$('LF'), 2)); + self.$attr_accessor("colspan"); + self.$attr_accessor("rowspan"); + $alias(self, "column", "parent"); + self.$attr_reader("inner_document"); + + $def(self, '$initialize', function $$initialize(column, cell_text, attributes, opts) { + var $a; $$initialize.$$p || nil; var self = this, in_header_row = nil, cell_style = nil, $ret_or_1 = nil, $ret_or_2 = nil, asciidoc = nil, inner_document_cursor = nil, lines_advanced = nil, literal = nil, normal_psv = nil, parent_doctitle = nil, inner_document_lines = nil, unprocessed_line1 = nil, preprocessed_lines = nil; + + $$initialize.$$p = null; + + if (attributes == null) attributes = $hash2([], {}); + if (opts == null) opts = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [column, "table_cell"], null); + self.cursor = (self.reinitialize_args = nil); + if ($truthy(self.document.$sourcemap())) { + self.source_location = opts['$[]']("cursor").$dup(); + } if ($truthy(column)) { + + if ($truthy((in_header_row = column.$table()['$header_row?']()))) { + if (($eqeq(in_header_row, "implicit") && ($truthy((cell_style = ($truthy(($ret_or_1 = column.$style())) ? ($ret_or_1) : (($truthy(($ret_or_2 = attributes)) ? (attributes['$[]']("style")) : ($ret_or_2))))))))) { + + if (($eqeq(cell_style, "asciidoc") || ($eqeq(cell_style, "literal")))) { + self.reinitialize_args = [column, cell_text, ($truthy(($ret_or_1 = attributes)) ? (attributes.$merge()) : ($ret_or_1)), opts]; + } cell_style = nil; + } + } else { + cell_style = column.$style(); + } self.$update_attributes(column.$attributes()); + } if ($truthy(attributes)) { + + if ($truthy(attributes['$empty?']())) { + self.colspan = (self.rowspan = nil); + } else { + + $a = [attributes.$delete("colspan"), attributes.$delete("rowspan")], (self.colspan = $a[0]), (self.rowspan = $a[1]); + if (!$truthy(in_header_row)) { + cell_style = ($truthy(($ret_or_1 = attributes['$[]']("style"))) ? ($ret_or_1) : (cell_style)); + } self.$update_attributes(attributes); + } + switch (cell_style) { + case "asciidoc": + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor"); + if ($truthy((cell_text = cell_text.$rstrip())['$start_with?']($$('LF')))) { + + lines_advanced = 1; + while ($truthy((cell_text = cell_text.$slice(1, cell_text.$length()))['$start_with?']($$('LF')))) { + lines_advanced = $rb_plus(lines_advanced, 1); + } inner_document_cursor.$advance(lines_advanced); + } else { + cell_text = cell_text.$lstrip(); + } break; + case "literal": + + literal = true; + cell_text = cell_text.$rstrip(); + while ($truthy(cell_text['$start_with?']($$('LF')))) { + cell_text = cell_text.$slice(1, cell_text.$length()); + } break; + default: + + normal_psv = true; + cell_text = ($truthy(cell_text) ? (cell_text.$strip()) : ("")); + } } else { + + self.colspan = (self.rowspan = nil); + if ($eqeq(cell_style, "asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor"); + } } if ($truthy(asciidoc)) { + + parent_doctitle = self.document.$attributes().$delete("doctitle"); + inner_document_lines = cell_text.$split($$('LF'), -1); + if (!$truthy(inner_document_lines['$empty?']())) { + if ($truthy((unprocessed_line1 = inner_document_lines['$[]'](0))['$include?']("::"))) { + + preprocessed_lines = $$('PreprocessorReader').$new(self.document, [unprocessed_line1]).$readlines(); + if (!($eqeq(unprocessed_line1, preprocessed_lines['$[]'](0)) && ($truthy($rb_lt(preprocessed_lines.$size(), 2))))) { + + inner_document_lines.$shift(); + if (!$truthy(preprocessed_lines['$empty?']())) { + $send(inner_document_lines, 'unshift', $to_a(preprocessed_lines)); + } } } + } self.inner_document = $$('Document').$new(inner_document_lines, $hash2(["standalone", "parent", "cursor"], {"standalone": false, "parent": self.document, "cursor": inner_document_cursor})); + if (!$truthy(parent_doctitle['$nil?']())) { + self.document.$attributes()['$[]=']("doctitle", parent_doctitle); + } self.subs = nil; + } else if ($truthy(literal)) { + + self.content_model = "verbatim"; + self.subs = $$('BASIC_SUBS'); + } else { + + if ($truthy(normal_psv)) { + if ($truthy(in_header_row)) { + self.cursor = opts['$[]']("cursor"); + } else { + self.$catalog_inline_anchor(cell_text, opts['$[]']("cursor")); + } + } self.content_model = "simple"; + self.subs = $$('NORMAL_SUBS'); + } self.text = cell_text; + return (self.style = cell_style); + }, -3); + + $def(self, '$reinitialize', function $$reinitialize(has_header) { + var self = this; + + + if ($truthy(has_header)) { + self.reinitialize_args = nil; + } else if ($truthy(self.reinitialize_args)) { + return $send($$$($$('Table'), 'Cell'), 'new', $to_a(self.reinitialize_args)) + } else { + self.style = self.attributes['$[]']("style"); + } if ($truthy(self.cursor)) { + self.$catalog_inline_anchor(); + } return self; + }); + + $def(self, '$catalog_inline_anchor', function $$catalog_inline_anchor(cell_text, cursor) { + var $a, self = this; + + + if (cell_text == null) cell_text = self.text; + if (cursor == null) cursor = nil; + if (!$truthy(cursor)) { + $a = [self.cursor, nil], (cursor = $a[0]), (self.cursor = $a[1]); + } if (($truthy(cell_text['$start_with?']("[[")) && ($truthy($$('LeadingInlineAnchorRx')['$=~'](cell_text))))) { + return $$('Parser').$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self, cursor, self.document) + } else { + return nil + } }, -1); + + $def(self, '$text', function $$text() { + var self = this; + + return self.$apply_subs(self.text, self.subs) + }); + self.$attr_writer("text"); + + $def(self, '$content', function $$content() { + var self = this, cell_style = nil, subbed_text = nil; + + if ($eqeq((cell_style = self.style), "asciidoc")) { + return self.inner_document.$convert() + } else if ($truthy(self.text['$include?']($$('DOUBLE_LF')))) { + return $send(self.$text().$split($$('BlankLineRx')), 'map', [], function $$8(para){var self = $$8.$$s == null ? this : $$8.$$s; + + + if (para == null) para = nil; + if (($truthy(cell_style) && ($neqeq(cell_style, "header")))) { + return $$('Inline').$new(self.$parent(), "quoted", para, $hash2(["type"], {"type": cell_style})).$convert() + } else { + return para + }}, {$$s: self}) + } else if ($truthy((subbed_text = self.$text())['$empty?']())) { + return [] + } else if (($truthy(cell_style) && ($neqeq(cell_style, "header")))) { + return [$$('Inline').$new(self.$parent(), "quoted", subbed_text, $hash2(["type"], {"type": cell_style})).$convert()] + } else { + return [subbed_text] + } + }); + + $def(self, '$lines', function $$lines() { + var self = this; + + return self.text.$split($$('LF')) + }); + + $def(self, '$source', $return_ivar("text")); + + $def(self, '$file', function $$file() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.source_location))) { + return self.source_location.$file() + } else { + return $ret_or_1 + } + }); + + $def(self, '$lineno', function $$lineno() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.source_location))) { + return self.source_location.$lineno() + } else { + return $ret_or_1 + } + }); + return $def(self, '$to_s', function $$to_s() { + var $yield = $$to_s.$$p || nil, self = this, $ret_or_1 = nil; + + $$to_s.$$p = null; + return "" + ($send2(self, $find_super(self, 'to_s', $$to_s, false, true), 'to_s', [], $yield)) + " - [text: " + (self.text) + ", colspan: " + (($truthy(($ret_or_1 = self.colspan)) ? ($ret_or_1) : (1))) + ", rowspan: " + (($truthy(($ret_or_1 = self.rowspan)) ? ($ret_or_1) : (1))) + ", attributes: " + (self.attributes) + "]" + }); + })($$('Table'), $$('AbstractBlock'), $nesting); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'ParserContext'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.delimiter = $proto.delimiter_rx = $proto.buffer = $proto.cellspecs = $proto.cell_open = $proto.format = $proto.start_cursor_data = $proto.reader = $proto.table = $proto.current_row = $proto.colcount = $proto.column_visits = $proto.active_rowspans = $proto.linenum = nil; + + self.$include($$('Logging')); + $const_set($nesting[0], 'FORMATS', ["psv", "csv", "dsv", "tsv"].$to_set()); + $const_set($nesting[0], 'DELIMITERS', $hash2(["psv", "csv", "dsv", "tsv", "!sv"], {"psv": ["|", /\|/], "csv": [",", /,/], "dsv": [":", /:/], "tsv": ["\t", /\t/], "!sv": ["!", /!/]})); + self.$attr_accessor("table"); + self.$attr_accessor("format"); + self.$attr_reader("colcount"); + self.$attr_accessor("buffer"); + self.$attr_reader("delimiter"); + self.$attr_reader("delimiter_re"); + + $def(self, '$initialize', function $$initialize(reader, table, attributes) { + var $a, $b, self = this, xsv = nil, sep = nil; + + + if (attributes == null) attributes = $hash2([], {}); + self.start_cursor_data = (self.reader = reader).$mark(); + self.table = table; + if ($truthy(attributes['$key?']("format"))) { + if ($truthy($$('FORMATS')['$include?']((xsv = attributes['$[]']("format"))))) { + if ($eqeq(xsv, "tsv")) { + self.format = "csv"; + } else if (($eqeq((self.format = xsv), "psv") && ($truthy(table.$document()['$nested?']())))) { + xsv = "!sv"; + } + } else { + + self.$logger().$error(self.$message_with_context("illegal table format: " + (xsv), $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))); + $a = ["psv", ($truthy(table.$document()['$nested?']()) ? ("!sv") : ("psv"))], (self.format = $a[0]), (xsv = $a[1]); + } + } else { + $a = ["psv", ($truthy(table.$document()['$nested?']()) ? ("!sv") : ("psv"))], (self.format = $a[0]), (xsv = $a[1]); + } if ($truthy(attributes['$key?']("separator"))) { + if ($truthy((sep = attributes['$[]']("separator"))['$nil_or_empty?']())) { + $b = $$('DELIMITERS')['$[]'](xsv), $a = $to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_rx = ($a[1] == null ? nil : $a[1])); + } else if ($eqeq(sep, "\\t")) { + $b = $$('DELIMITERS')['$[]']("tsv"), $a = $to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_rx = ($a[1] == null ? nil : $a[1])); + } else { + $a = [sep, $regexp([$$$('Regexp').$escape(sep)])], (self.delimiter = $a[0]), (self.delimiter_rx = $a[1]); + } + } else { + $b = $$('DELIMITERS')['$[]'](xsv), $a = $to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_rx = ($a[1] == null ? nil : $a[1])); + } self.colcount = ($truthy(table.$columns()['$empty?']()) ? (-1) : (table.$columns().$size())); + self.buffer = ""; + self.cellspecs = []; + self.cell_open = false; + self.active_rowspans = [0]; + self.column_visits = 0; + self.current_row = []; + return (self.linenum = -1); + }, -3); + + $def(self, '$starts_with_delimiter?', function $ParserContext_starts_with_delimiter$ques$9(line) { + var self = this; + + return line['$start_with?'](self.delimiter) + }); + + $def(self, '$match_delimiter', function $$match_delimiter(line) { + var self = this; + + return self.delimiter_rx.$match(line) + }); + + $def(self, '$skip_past_delimiter', function $$skip_past_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre) + (self.delimiter); + return nil; + }); + + $def(self, '$skip_past_escaped_delimiter', function $$skip_past_escaped_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre.$chop()) + (self.delimiter); + return nil; + }); + + $def(self, '$buffer_has_unclosed_quotes?', function $ParserContext_buffer_has_unclosed_quotes$ques$10(append, q) { + var self = this, record = nil, qq = nil, trailing_quote = nil, $ret_or_1 = nil; + + + if (append == null) append = nil; + if (q == null) q = "\""; + if ($eqeq((record = ($truthy(append) ? ($rb_plus(self.buffer, append).$strip()) : (self.buffer.$strip()))), q)) { + return true + } else if ($truthy(record['$start_with?'](q))) { + + qq = $rb_plus(q, q); + if ((($truthy((trailing_quote = record['$end_with?'](q))) && ($truthy(record['$end_with?'](qq)))) || ($truthy(record['$start_with?'](qq))))) { + if ($truthy(($ret_or_1 = (record = record.$gsub(qq, ""))['$start_with?'](q)))) { + return record['$end_with?'](q)['$!']() + } else { + return $ret_or_1 + } + } else { + return trailing_quote['$!']() + } } else { + return false + } }, -1); + + $def(self, '$take_cellspec', function $$take_cellspec() { + var self = this; + + return self.cellspecs.$shift() + }); + + $def(self, '$push_cellspec', function $$push_cellspec(cellspec) { + var self = this, $ret_or_1 = nil; + + + if (cellspec == null) cellspec = $hash2([], {}); + self.cellspecs['$<<'](($truthy(($ret_or_1 = cellspec)) ? ($ret_or_1) : ($hash2([], {})))); + return nil; + }, -1); + + $def(self, '$keep_cell_open', function $$keep_cell_open() { + var self = this; + + + self.cell_open = true; + return nil; + }); + + $def(self, '$mark_cell_closed', function $$mark_cell_closed() { + var self = this; + + + self.cell_open = false; + return nil; + }); + + $def(self, '$cell_open?', $return_ivar("cell_open")); + + $def(self, '$cell_closed?', function $ParserContext_cell_closed$ques$11() { + var self = this; + + return self.cell_open['$!']() + }); + + $def(self, '$close_open_cell', function $$close_open_cell(next_cellspec) { + var self = this; + + + if (next_cellspec == null) next_cellspec = $hash2([], {}); + self.$push_cellspec(next_cellspec); + if ($truthy(self['$cell_open?']())) { + self.$close_cell(true); + } self.$advance(); + return nil; + }, -1); + + $def(self, '$close_cell', function $$close_cell(eol) {try { var $t_return = $thrower('return'); + var self = this, cell_text = nil, cellspec = nil, repeat = nil, $ret_or_1 = nil, q = nil; + + + if (eol == null) eol = false; + if ($eqeq(self.format, "psv")) { + + cell_text = self.buffer; + self.buffer = ""; + if ($truthy((cellspec = self.$take_cellspec()))) { + repeat = ($truthy(($ret_or_1 = cellspec.$delete("repeatcol"))) ? ($ret_or_1) : (1)); + } else { + + self.$logger().$error(self.$message_with_context("table missing leading separator; recovering automatically", $hash2(["source_location"], {"source_location": $send($$$($$('Reader'), 'Cursor'), 'new', $to_a(self.start_cursor_data))}))); + cellspec = $hash2([], {}); + repeat = 1; + }; + } else { + + cell_text = self.buffer.$strip(); + self.buffer = ""; + cellspec = nil; + repeat = 1; + if ((($eqeq(self.format, "csv") && ($not(cell_text['$empty?']()))) && ($truthy(cell_text['$include?']((q = "\"")))))) { + if (($truthy(cell_text['$start_with?'](q)) && ($truthy(cell_text['$end_with?'](q))))) { + if ($truthy((cell_text = cell_text.$slice(1, $rb_minus(cell_text.$length(), 2))))) { + cell_text = cell_text.$strip().$squeeze(q); + } else { + + self.$logger().$error(self.$message_with_context("unclosed quote in CSV data; setting cell to empty", $hash2(["source_location"], {"source_location": self.reader.$cursor_at_prev_line()}))); + cell_text = ""; + } + } else { + cell_text = cell_text.$squeeze(q); + } + }; + }; + $send((1), 'upto', [repeat], function $$12(i){var self = $$12.$$s == null ? this : $$12.$$s, column = nil, extra_cols = nil, offset = nil, cell = nil; + if (self.colcount == null) self.colcount = nil; + if (self.table == null) self.table = nil; + if (self.current_row == null) self.current_row = nil; + if (self.reader == null) self.reader = nil; + if (self.column_visits == null) self.column_visits = nil; + if (self.linenum == null) self.linenum = nil; + + + if (i == null) i = nil; + if ($eqeq(self.colcount, -1)) { + + self.table.$columns()['$<<']((column = $$$($$('Table'), 'Column').$new(self.table, $rb_minus($rb_plus(self.table.$columns().$size(), i), 1)))); + if ((($truthy(cellspec) && ($truthy(cellspec['$key?']("colspan")))) && ($truthy($rb_gt((extra_cols = $rb_minus(cellspec['$[]']("colspan").$to_i(), 1)), 0))))) { + + offset = self.table.$columns().$size(); + $send(extra_cols, 'times', [], function $$13(j){var self = $$13.$$s == null ? this : $$13.$$s; + if (self.table == null) self.table = nil; + + + if (j == null) j = nil; + return self.table.$columns()['$<<']($$$($$('Table'), 'Column').$new(self.table, $rb_plus(offset, j)));}, {$$s: self}); + }; + } else if (!$truthy((column = self.table.$columns()['$[]'](self.current_row.$size())))) { + + self.$logger().$error(self.$message_with_context("dropping cell because it exceeds specified number of columns", $hash2(["source_location"], {"source_location": self.reader.$cursor_before_mark()}))); + $t_return.$throw(); + }; + cell = $$$($$('Table'), 'Cell').$new(column, cell_text, cellspec, $hash2(["cursor"], {"cursor": self.reader.$cursor_before_mark()})); + self.reader.$mark(); + if (!($not(cell.$rowspan()) || ($eqeq(cell.$rowspan(), 1)))) { + self.$activate_rowspan(cell.$rowspan(), ($truthy(($ret_or_1 = cell.$colspan())) ? ($ret_or_1) : (1))); + }; + self.column_visits = $rb_plus(self.column_visits, ($truthy(($ret_or_1 = cell.$colspan())) ? ($ret_or_1) : (1))); + self.current_row['$<<'](cell); + if (($truthy(self['$end_of_row?']()) && ((($neqeq(self.colcount, -1) || ($truthy($rb_gt(self.linenum, 0)))) || (($truthy(eol) && ($eqeq(i, repeat)))))))) { + return self.$close_row() + } else { + return nil + };}, {$$s: self, $$ret: $t_return}); + self.cell_open = false; + return nil;} catch($e) { + if ($e === $t_return) return $e.$v; + throw $e; + } + }, -1); + self.$private(); + + $def(self, '$close_row', function $$close_row() { + var self = this; + + + self.table.$rows().$body()['$<<'](self.current_row); + if ($eqeq(self.colcount, -1)) { + self.colcount = self.column_visits; + } self.column_visits = 0; + self.current_row = []; + self.active_rowspans.$shift(); + if ($truthy((self.active_rowspans['$[]'](0)))) ; else { + self.active_rowspans['$[]='](0, 0); + } return nil; + }); + + $def(self, '$activate_rowspan', function $$activate_rowspan(rowspan, colspan) { + var self = this; + + + $send((1), 'upto', [$rb_minus(rowspan, 1)], function $$14(i){var $a, self = $$14.$$s == null ? this : $$14.$$s, $ret_or_1 = nil; + if (self.active_rowspans == null) self.active_rowspans = nil; + + + if (i == null) i = nil; + return ($a = [i, $rb_plus(($truthy(($ret_or_1 = self.active_rowspans['$[]'](i))) ? ($ret_or_1) : (0)), colspan)], $send(self.active_rowspans, '[]=', $a), $a[$a.length - 1]);}, {$$s: self}); + return nil; + }); + + $def(self, '$end_of_row?', function $ParserContext_end_of_row$ques$15() { + var self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.colcount['$=='](-1)))) { + return $ret_or_1 + } else { + return self.$effective_column_visits()['$=='](self.colcount) + } + }); + + $def(self, '$effective_column_visits', function $$effective_column_visits() { + var self = this; + + return $rb_plus(self.column_visits, self.active_rowspans['$[]'](0)) + }); + return $def(self, '$advance', function $$advance() { + var self = this; + + return (self.linenum = $rb_plus(self.linenum, 1)) + }); + })($$('Table'), null, $nesting); + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/writer"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $truthy = Opal.truthy, $rb_plus = Opal.rb_plus, $hash2 = Opal.hash2, $def = Opal.def, $return_val = Opal.return_val, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('respond_to?,write,+,chomp,include'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + var self = $module($base, 'Writer'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$write', function $$write(output, target) { + + + if ($truthy(target['$respond_to?']("write"))) { + target.$write($rb_plus(output.$chomp(), $$('LF'))); + } else { + $$$('File').$write(target, output, $hash2(["mode"], {"mode": $$('FILE_WRITE_MODE')})); + } return nil; + }) + })($nesting[0], $nesting); + return (function($base, $parent_nesting) { + var self = $module($base, 'VoidWriter'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('Writer')); + return $def(self, '$write', $return_val(nil)); + })($nesting[0], $nesting); + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/load"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $hash2 = Opal.hash2, $truthy = Opal.truthy, $neqeq = Opal.neqeq, $not = Opal.not, $eqeqeq = Opal.eqeqeq, $send = Opal.send, $to_ary = Opal.to_ary, $rb_plus = Opal.rb_plus, $eqeq = Opal.eqeq, $def = Opal.def, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('merge,[],start,!=,logger,key?,logger=,new,!,===,dup,tap,each,partition,[]=,split,gsub,+,respond_to?,keys,raise,join,ancestors,class,==,at,to_i,mtime,absolute_path,path,dirname,basename,extname,read,rewind,drop,record,parse,exception,message,set_backtrace,backtrace,stack_trace=,stack_trace,open,load'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$load', function $$load(input, options) { + var $a, $b, $c, $d, self = this, timings = nil, logger = nil, $ret_or_1 = nil, attrs = nil, input_path = nil, source = nil, doc = nil, e = nil, context = nil, wrapped_e = nil; + + + if (options == null) options = $hash2([], {}); + try { + + options = options.$merge(); + if ($truthy((timings = options['$[]']("timings")))) { + timings.$start("read"); + }; + if (($truthy(options['$key?']("logger")) && ($neqeq((logger = options['$[]']("logger")), $$('LoggerManager').$logger())))) { + $$('LoggerManager')['$logger='](($truthy(($ret_or_1 = logger)) ? ($ret_or_1) : ($$('NullLogger').$new()))); + }; + if ($not((attrs = options['$[]']("attributes")))) { + attrs = $hash2([], {}); + } else if ($eqeqeq($$$('Hash'), attrs)) { + attrs = attrs.$merge(); + } else if (($truthy((($c = $$$('::', 'Java', 'skip_raise')) && ($b = $$$($c, 'JavaUtil', 'skip_raise')) && ($a = $$$($b, 'Map', 'skip_raise')) ? 'constant' : nil)) && ($eqeqeq($$$($$$($$$('Java'), 'JavaUtil'), 'Map'), attrs)))) { + attrs = attrs.$dup(); + } else if ($eqeqeq($$$('Array'), attrs)) { + attrs = $send($hash2([], {}), 'tap', [], function $$1(accum){ + + if (accum == null) accum = nil; + return $send(attrs, 'each', [], function $$2(entry){var $d, $e, k = nil, _ = nil, v = nil; + + + if (entry == null) entry = nil; + $e = entry.$partition("="), $d = $to_ary($e), (k = ($d[0] == null ? nil : $d[0])), (_ = ($d[1] == null ? nil : $d[1])), (v = ($d[2] == null ? nil : $d[2])), $e; + return ($d = [k, v], $send(accum, '[]=', $d), $d[$d.length - 1]);});}); + } else if ($eqeqeq($$$('String'), attrs)) { + attrs = $send($hash2([], {}), 'tap', [], function $$3(accum){ + + if (accum == null) accum = nil; + return $send(attrs.$gsub($$('SpaceDelimiterRx'), $rb_plus("\\1", $$('NULL'))).$gsub($$('EscapedSpaceRx'), "\\1").$split($$('NULL')), 'each', [], function $$4(entry){var $d, $e, k = nil, _ = nil, v = nil; + + + if (entry == null) entry = nil; + $e = entry.$partition("="), $d = $to_ary($e), (k = ($d[0] == null ? nil : $d[0])), (_ = ($d[1] == null ? nil : $d[1])), (v = ($d[2] == null ? nil : $d[2])), $e; + return ($d = [k, v], $send(accum, '[]=', $d), $d[$d.length - 1]);});}); + } else if (($truthy(attrs['$respond_to?']("keys")) && ($truthy(attrs['$respond_to?']("[]"))))) { + attrs = $send($hash2([], {}), 'tap', [], function $$5(accum){ + + if (accum == null) accum = nil; + return $send(attrs.$keys(), 'each', [], function $$6(k){var $d; + + + if (k == null) k = nil; + return ($d = [k, attrs['$[]'](k)], $send(accum, '[]=', $d), $d[$d.length - 1]);});}); + } else { + self.$raise($$$('ArgumentError'), "illegal type for attributes option: " + (attrs.$class().$ancestors().$join(" < "))); + }; + if ($eqeqeq($$$('File'), input)) { + + options['$[]=']("input_mtime", ($eqeq($$('RUBY_ENGINE'), "jruby") ? ($$$('Time').$at(input.$mtime().$to_i())) : (input.$mtime()))); + attrs['$[]=']("docfile", (input_path = $$$('File').$absolute_path(input.$path()))); + attrs['$[]=']("docdir", $$$('File').$dirname(input_path)); + attrs['$[]=']("docname", $$('Helpers').$basename(input_path, ($d = ["docfilesuffix", $$('Helpers').$extname(input_path)], $send(attrs, '[]=', $d), $d[$d.length - 1]))); + source = input.$read(); + } else if ($truthy(input['$respond_to?']("read"))) { + + try { + input.$rewind(); + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + nil; + } finally { Opal.pop_exception(); } + } else { throw $err; } + }; + source = input.$read(); + } else if ($eqeqeq($$$('String'), input)) { + source = input; + } else if ($eqeqeq($$$('Array'), input)) { + source = input.$drop(0); + } else if ($truthy(input)) { + self.$raise($$$('ArgumentError'), "unsupported input type: " + (input.$class())); + }; + if ($truthy(timings)) { + + timings.$record("read"); + timings.$start("parse"); + }; + options['$[]=']("attributes", attrs); + doc = ($eqeq(options['$[]']("parse"), false) ? ($$('Document').$new(source, options)) : ($$('Document').$new(source, options).$parse())); + if ($truthy(timings)) { + timings.$record("parse"); + }; + return doc; + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) {(e = $err); + try { + + + try { + + context = "asciidoctor: FAILED: " + (($truthy(($ret_or_1 = attrs['$[]']("docfile"))) ? ($ret_or_1) : (""))) + ": Failed to load AsciiDoc document"; + if ($truthy(e['$respond_to?']("exception"))) { + + wrapped_e = e.$exception("" + (context) + " - " + (e.$message())); + wrapped_e.$set_backtrace(e.$backtrace()); + } else { + + wrapped_e = e.$class().$new(context, e); + wrapped_e['$stack_trace='](e.$stack_trace()); + }; + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + wrapped_e = e; + } finally { Opal.pop_exception(); } + } else { throw $err; } + };; + return self.$raise(wrapped_e); + } finally { Opal.pop_exception(); } + } else { throw $err; } + } }, -2); + return $def(self, '$load_file', function $$load_file(filename, options) { + var self = this; + + + if (options == null) options = $hash2([], {}); + return $send($$$('File'), 'open', [filename, $$('FILE_READ_MODE')], function $$7(file){var self = $$7.$$s == null ? this : $$7.$$s; + + + if (file == null) file = nil; + return self.$load(file, options);}, {$$s: self}); + }, -2); + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/convert"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $hash2 = Opal.hash2, $eqeqeq = Opal.eqeqeq, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $rb_ge = Opal.rb_ge, $not = Opal.not, $rb_lt = Opal.rb_lt, $neqeq = Opal.neqeq, $def = Opal.def, $send = Opal.send, $alias = Opal.alias, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('delete,merge,===,absolute_path,path,load,respond_to?,[]=,key?,fetch,[],dirname,expand_path,join,attributes,outfilesuffix,==,raise,pwd,>=,safe,normalize_system_path,mkdir_p,directory?,!,convert,write,attr,uriish?,basebackend?,attr?,<,include?,syntax_highlighter,write_stylesheet?,write_primary_stylesheet,instance,to_s,read_asset,file?,!=,write_stylesheet,open,convert_file'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$convert', function $$convert(input, options) { + var self = this, to_dir = nil, mkdirs = nil, $ret_or_1 = nil, to_file = nil, write_to_target = nil, sibling_path = nil, stream_output = nil, outdir = nil, doc = nil, outfile = nil, working_dir = nil, jail = nil, output = nil, stylesdir = nil, stylesheet = nil, copy_asciidoctor_stylesheet = nil, copy_user_stylesheet = nil, copy_syntax_hl_stylesheet = nil, syntax_hl = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dest = nil, stylesheet_data = nil, stylesheet_outdir = nil; + + + if (options == null) options = $hash2([], {}); + (options = options.$merge()).$delete("parse"); + to_dir = options.$delete("to_dir"); + mkdirs = options.$delete("mkdirs"); + if (($eqeqeq(true, ($ret_or_1 = (to_file = options.$delete("to_file")))) || ($eqeqeq(nil, $ret_or_1)))) { + + if (!$truthy((write_to_target = to_dir))) { + if ($eqeqeq($$$('File'), input)) { + sibling_path = $$$('File').$absolute_path(input.$path()); + } + } to_file = nil; + } else if ($eqeqeq(false, $ret_or_1)) { + to_file = nil; + } else if ($eqeqeq("/dev/null", $ret_or_1)) { + return self.$load(input, options) + } else if (!$truthy((stream_output = to_file['$respond_to?']("write")))) { + options['$[]=']("to_file", (write_to_target = to_file)); + } if (!$truthy(options['$key?']("standalone"))) { + if (($truthy(sibling_path) || ($truthy(write_to_target)))) { + options['$[]=']("standalone", options.$fetch("header_footer", true)); + } else if ($truthy(options['$key?']("header_footer"))) { + options['$[]=']("standalone", options['$[]']("header_footer")); + } + } if ($truthy(sibling_path)) { + options['$[]=']("to_dir", (outdir = $$$('File').$dirname(sibling_path))); + } else if ($truthy(write_to_target)) { + if ($truthy(to_dir)) { + if ($truthy(to_file)) { + options['$[]=']("to_dir", $$$('File').$dirname($$$('File').$expand_path(to_file, to_dir))); + } else { + options['$[]=']("to_dir", $$$('File').$expand_path(to_dir)); + } + } else if ($truthy(to_file)) { + options['$[]=']("to_dir", $$$('File').$dirname($$$('File').$expand_path(to_file))); + } + } doc = self.$load(input, options); + if ($truthy(sibling_path)) { + + outfile = $$$('File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())); + if ($eqeq(outfile, sibling_path)) { + self.$raise($$$('IOError'), "input file and output file cannot be the same: " + (outfile)); + } } else if ($truthy(write_to_target)) { + + working_dir = ($truthy(options['$key?']("base_dir")) ? ($$$('File').$expand_path(options['$[]']("base_dir"))) : ($$$('Dir').$pwd())); + jail = ($truthy($rb_ge(doc.$safe(), $$$($$('SafeMode'), 'SAFE'))) ? (working_dir) : (nil)); + if ($truthy(to_dir)) { + + outdir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, outdir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('File').$dirname(outfile); + } else { + outfile = $$$('File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())); + } } else if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('File').$dirname(outfile); + } if (($eqeqeq($$$('File'), input) && ($eqeq(outfile, $$$('File').$absolute_path(input.$path()))))) { + self.$raise($$$('IOError'), "input file and output file cannot be the same: " + (outfile)); + } if ($truthy(mkdirs)) { + $$('Helpers').$mkdir_p(outdir); + } else if (!$truthy($$$('File')['$directory?'](outdir))) { + self.$raise($$$('IOError'), "target directory does not exist: " + (to_dir) + " (hint: set :mkdirs option)"); + } } else { + + outfile = to_file; + outdir = nil; + } if (($truthy(outfile) && ($not(stream_output)))) { + output = doc.$convert($hash2(["outfile", "outdir"], {"outfile": outfile, "outdir": outdir})); + } else { + output = doc.$convert(); + } if ($truthy(outfile)) { + + doc.$write(output, outfile); + if (((((($not(stream_output) && ($truthy($rb_lt(doc.$safe(), $$$($$('SafeMode'), 'SECURE'))))) && ($truthy(doc['$attr?']("linkcss")))) && ($truthy(doc['$attr?']("copycss")))) && ($truthy(doc['$basebackend?']("html")))) && ($not(($truthy(($ret_or_1 = (stylesdir = doc.$attr("stylesdir")))) ? ($$('Helpers')['$uriish?'](stylesdir)) : ($ret_or_1)))))) { + + if ($truthy((stylesheet = doc.$attr("stylesheet")))) { + if ($truthy($$('DEFAULT_STYLESHEET_KEYS')['$include?'](stylesheet))) { + copy_asciidoctor_stylesheet = true; + } else if ($not($$('Helpers')['$uriish?'](stylesheet))) { + copy_user_stylesheet = true; + } + } copy_syntax_hl_stylesheet = ($truthy(($ret_or_1 = (syntax_hl = doc.$syntax_highlighter()))) ? (syntax_hl['$write_stylesheet?'](doc)) : ($ret_or_1)); + if ((($truthy(copy_asciidoctor_stylesheet) || ($truthy(copy_user_stylesheet))) || ($truthy(copy_syntax_hl_stylesheet)))) { + + stylesoutdir = doc.$normalize_system_path(stylesdir, outdir, ($truthy($rb_ge(doc.$safe(), $$$($$('SafeMode'), 'SAFE'))) ? (outdir) : (nil))); + if ($truthy(mkdirs)) { + $$('Helpers').$mkdir_p(stylesoutdir); + } else if (!$truthy($$$('File')['$directory?'](stylesoutdir))) { + self.$raise($$$('IOError'), "target stylesheet directory does not exist: " + (stylesoutdir) + " (hint: set :mkdirs option)"); + } if ($truthy(copy_asciidoctor_stylesheet)) { + $$('Stylesheets').$instance().$write_primary_stylesheet(stylesoutdir); + } else if ($truthy(copy_user_stylesheet)) { + + if (($eqeq((stylesheet_src = doc.$attr("copycss")), "") || ($eqeq(stylesheet_src, true)))) { + stylesheet_src = doc.$normalize_system_path(stylesheet); + } else { + stylesheet_src = doc.$normalize_system_path(stylesheet_src.$to_s()); + } stylesheet_dest = doc.$normalize_system_path(stylesheet, stylesoutdir, ($truthy($rb_ge(doc.$safe(), $$$($$('SafeMode'), 'SAFE'))) ? (outdir) : (nil))); + if (($neqeq(stylesheet_src, stylesheet_dest) && ($truthy((stylesheet_data = doc.$read_asset(stylesheet_src, $hash2(["warn_on_failure", "label"], {"warn_on_failure": $$$('File')['$file?'](stylesheet_dest)['$!'](), "label": "stylesheet"}))))))) { + + if (($neqeq((stylesheet_outdir = $$$('File').$dirname(stylesheet_dest)), stylesoutdir) && ($not($$$('File')['$directory?'](stylesheet_outdir))))) { + if ($truthy(mkdirs)) { + $$('Helpers').$mkdir_p(stylesheet_outdir); + } else { + self.$raise($$$('IOError'), "target stylesheet directory does not exist: " + (stylesheet_outdir) + " (hint: set :mkdirs option)"); + } + } $$$('File').$write(stylesheet_dest, stylesheet_data, $hash2(["mode"], {"mode": $$('FILE_WRITE_MODE')})); + } } if ($truthy(copy_syntax_hl_stylesheet)) { + syntax_hl.$write_stylesheet(doc, stylesoutdir); + } } } return doc; + } else { + return output + } }, -2); + + $def(self, '$convert_file', function $$convert_file(filename, options) { + var self = this; + + + if (options == null) options = $hash2([], {}); + return $send($$$('File'), 'open', [filename, $$('FILE_READ_MODE')], function $$1(file){var self = $$1.$$s == null ? this : $$1.$$s; + + + if (file == null) file = nil; + return self.$convert(file, options);}, {$$s: self}); + }, -2); + $alias(self, "render", "convert"); + return $alias(self, "render_file", "convert_file"); + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/syntax_highlighter/highlightjs"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $slice = Opal.slice, $send2 = Opal.send2, $find_super = Opal.find_super, $to_a = Opal.to_a, $def = Opal.def, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $return_val = Opal.return_val, $eqeq = Opal.eqeq, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('register_for,merge,proc,[]=,attr,[],==,attr?,join,map,split,lstrip'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'HighlightJsAdapter'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$register_for("highlightjs", "highlight.js"); + + $def(self, '$initialize', function $$initialize($a) { + var $post_args, args, $yield = $$initialize.$$p || nil, self = this; + + $$initialize.$$p = null; + + $post_args = $slice(arguments); + args = $post_args; + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', $to_a(args), $yield); + return (self.name = (self.pre_class = "highlightjs")); + }, -1); + + $def(self, '$format', function $$format(node, lang, opts) { + $$format.$$p || nil; var self = this; + + $$format.$$p = null; + return $send2(self, $find_super(self, 'format', $$format, false, true), 'format', [node, lang, opts.$merge($hash2(["transform"], {"transform": $send(self, 'proc', [], function $$1(_, code){var $a, $ret_or_1 = nil; + if (code == null) code = nil; + return ($a = ["class", "language-" + (($truthy(($ret_or_1 = lang)) ? ($ret_or_1) : ("none"))) + " hljs"], $send(code, '[]=', $a), $a[$a.length - 1]);})}))], null) + }); + + $def(self, '$docinfo?', $return_val(true)); + return $def(self, '$docinfo', function $$docinfo(location, doc, opts) { + var base_url = nil; + + + base_url = doc.$attr("highlightjsdir", "" + (opts['$[]']("cdn_base_url")) + "/highlight.js/" + ($$('HIGHLIGHT_JS_VERSION'))); + if ($eqeq(location, "head")) { + return "" + } else { + return "\n" + (($truthy(doc['$attr?']("highlightjs-languages")) ? ($send(doc.$attr("highlightjs-languages").$split(","), 'map', [], function $$2(lang){ + + if (lang == null) lang = nil; + return "\n";}).$join()) : (""))) + "" + } }); + })($$('SyntaxHighlighter'), $$$($$('SyntaxHighlighter'), 'Base'), $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/syntax_highlighter"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $hash2 = Opal.hash2, $def = Opal.def, $return_val = Opal.return_val, $defs = Opal.defs, $slice = Opal.slice, $send = Opal.send, $to_a = Opal.to_a, $truthy = Opal.truthy, $eqeqeq = Opal.eqeqeq, $Class = Opal.Class, $klass = Opal.klass, $class_variable_set = Opal.class_variable_set, $class_variable_get = Opal.class_variable_get, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('attr_reader,raise,class,extend,private_class_method,register,map,to_s,each,[]=,registry,[],for,===,new,name,private,include,delete,join,content'); + + (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $parent_nesting) { + var self = $module($base, 'SyntaxHighlighter'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$attr_reader("name"); + + $def(self, '$initialize', function $$initialize(name, backend, opts) { + var self = this; + if (opts == null) opts = $hash2([], {}); + return (self.name = (self.pre_class = name)); + }, -2); + + $def(self, '$docinfo?', $return_val(nil)); + + $def(self, '$docinfo', function $$docinfo(location, doc, opts) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('SyntaxHighlighter')) + " subclass " + (self.$class()) + " must implement the #" + ("docinfo") + " method since #docinfo? returns true") + }); + + $def(self, '$highlight?', $return_val(nil)); + + $def(self, '$highlight', function $$highlight(node, source, lang, opts) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('SyntaxHighlighter')) + " subclass " + (self.$class()) + " must implement the #" + ("highlight") + " method since #highlight? returns true") + }); + + $def(self, '$format', function $$format(node, lang, opts) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('SyntaxHighlighter')) + " subclass " + (self.$class()) + " must implement the #" + ("format") + " method") + }); + + $def(self, '$write_stylesheet?', $return_val(nil)); + + $def(self, '$write_stylesheet', function $$write_stylesheet(doc, to_dir) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('SyntaxHighlighter')) + " subclass " + (self.$class()) + " must implement the #" + ("write_stylesheet") + " method since #write_stylesheet? returns true") + }); + $defs(self, '$included', function $$included(into) { + + return into.$extend($$('Config')) + }); + self.$private_class_method("included"); + (function($base, $parent_nesting) { + var self = $module($base, 'Config'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$register_for', function $$register_for($a) { + var $post_args, names, self = this; + + + $post_args = $slice(arguments); + names = $post_args; + return $send($$('SyntaxHighlighter'), 'register', [self].concat($to_a($send(names, 'map', [], function $$1(name){ + + if (name == null) name = nil; + return name.$to_s();})))); + }, -1) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'Factory'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$register', function $$register(syntax_highlighter, $a) { + var $post_args, names, self = this; + + + $post_args = $slice(arguments, 1); + names = $post_args; + return $send(names, 'each', [], function $$2(name){var $b, self = $$2.$$s == null ? this : $$2.$$s; + + + if (name == null) name = nil; + return ($b = [name, syntax_highlighter], $send(self.$registry(), '[]=', $b), $b[$b.length - 1]);}, {$$s: self}); + }, -2); + + $def(self, '$for', function $Factory_for$3(name) { + var self = this; + + return self.$registry()['$[]'](name) + }); + + $def(self, '$create', function $$create(name, backend, opts) { + var self = this, syntax_hl = nil; + + + if (backend == null) backend = "html5"; + if (opts == null) opts = $hash2([], {}); + if ($truthy((syntax_hl = self.$for(name)))) { + + if ($eqeqeq($Class, syntax_hl)) { + syntax_hl = syntax_hl.$new(name, backend, opts); + } if (!$truthy(syntax_hl.$name())) { + self.$raise($$$('NameError'), "" + (syntax_hl.$class()) + " must specify a value for `name'"); + } return syntax_hl; + } else { + return nil + } }, -2); + self.$private(); + return $def(self, '$registry', function $$registry() { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('Factory')) + " subclass " + (self.$class()) + " must implement the #" + ("registry") + " method") + }); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'CustomFactory'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('Factory')); + + $def(self, '$initialize', function $$initialize(seed_registry) { + var self = this, $ret_or_1 = nil; + + + if (seed_registry == null) seed_registry = nil; + return (self.registry = ($truthy(($ret_or_1 = seed_registry)) ? ($ret_or_1) : ($hash2([], {})))); + }, -1); + self.$private(); + return self.$attr_reader("registry"); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'DefaultFactory'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('Factory')); + $class_variable_set($nesting[0], '@@registry', $hash2([], {})); + self.$private(); + + $def(self, '$registry', function $$registry() { + + return $class_variable_get($nesting[0], '@@registry', false) + }); + return nil; + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'DefaultFactoryProxy'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('DefaultFactory')); + return nil; + })($nesting[0], $$('CustomFactory'), $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Base'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.pre_class = nil; + + self.$include($$('SyntaxHighlighter')); + return $def(self, '$format', function $$format(node, lang, opts) { + var self = this, class_attr_val = nil, transform = nil, pre = nil, code = nil; + + + class_attr_val = ($truthy(opts['$[]']("nowrap")) ? ("" + (self.pre_class) + " highlight nowrap") : ("" + (self.pre_class) + " highlight")); + if ($truthy((transform = opts['$[]']("transform")))) { + + transform['$[]']((pre = $hash2(["class"], {"class": class_attr_val})), (code = ($truthy(lang) ? ($hash2(["data-lang"], {"data-lang": lang})) : ($hash2([], {}))))); + if ($truthy((lang = code.$delete("data-lang")))) { + code['$[]=']("data-lang", lang); + } return "" + (node.$content()) + ""; + } else { + return "
" + (node.$content()) + "
" + } }); + })($nesting[0], null, $nesting); + return self.$extend($$('DefaultFactory')); + })($nesting[0], $nesting) + })($nesting[0], $nesting); + self.$require("asciidoctor/syntax_highlighter.rb"+ '/../' + "syntax_highlighter/highlightjs"); + return nil; + }; + + Opal.modules["asciidoctor/timings"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $def = Opal.def, $send = Opal.send, $rb_minus = Opal.rb_minus, $slice = Opal.slice, $rb_plus = Opal.rb_plus, $truthy = Opal.truthy, $rb_gt = Opal.rb_gt, $gvars = Opal.gvars, $eqeq = Opal.eqeq, $const_set = Opal.const_set, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('[]=,now,-,delete,reduce,+,[],>,time,puts,sprintf,to_f,read_parse,convert,read_parse_convert,private,==,const_defined?,clock_gettime'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Timings'); + + var $a, $b, $c, $d, $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.timers = $proto.log = nil; + + + $def(self, '$initialize', function $$initialize() { + var self = this; + + + self.log = $hash2([], {}); + return (self.timers = $hash2([], {})); + }); + + $def(self, '$start', function $$start(key) { + var $a, self = this; + + return ($a = [key, self.$now()], $send(self.timers, '[]=', $a), $a[$a.length - 1]) + }); + + $def(self, '$record', function $$record(key) { + var $a, self = this; + + return ($a = [key, $rb_minus(self.$now(), self.timers.$delete(key))], $send(self.log, '[]=', $a), $a[$a.length - 1]) + }); + + $def(self, '$time', function $$time($a) { + var $post_args, keys, self = this, time = nil; + + + $post_args = $slice(arguments); + keys = $post_args; + time = $send(keys, 'reduce', [0], function $$1(sum, key){var self = $$1.$$s == null ? this : $$1.$$s, $ret_or_1 = nil; + if (self.log == null) self.log = nil; + + + if (sum == null) sum = nil; + if (key == null) key = nil; + return $rb_plus(sum, ($truthy(($ret_or_1 = self.log['$[]'](key))) ? ($ret_or_1) : (0)));}, {$$s: self}); + if ($truthy($rb_gt(time, 0))) { + return time + } else { + return nil + } }, -1); + + $def(self, '$read', function $$read() { + var self = this; + + return self.$time("read") + }); + + $def(self, '$parse', function $$parse() { + var self = this; + + return self.$time("parse") + }); + + $def(self, '$read_parse', function $$read_parse() { + var self = this; + + return self.$time("read", "parse") + }); + + $def(self, '$convert', function $$convert() { + var self = this; + + return self.$time("convert") + }); + + $def(self, '$read_parse_convert', function $$read_parse_convert() { + var self = this; + + return self.$time("read", "parse", "convert") + }); + + $def(self, '$write', function $$write() { + var self = this; + + return self.$time("write") + }); + + $def(self, '$total', function $$total() { + var self = this; + + return self.$time("read", "parse", "convert", "write") + }); + + $def(self, '$print_report', function $$print_report(to, subject) { + var self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + if (to == null) to = $gvars.stdout; + if (subject == null) subject = nil; + if ($truthy(subject)) { + to.$puts("Input file: " + (subject)); + } to.$puts(" Time to read and parse source: " + (self.$sprintf("%05.5f", self.$read_parse().$to_f()))); + to.$puts(" Time to convert document: " + (self.$sprintf("%05.5f", self.$convert().$to_f()))); + return to.$puts(" Total time (read, parse and convert): " + (self.$sprintf("%05.5f", self.$read_parse_convert().$to_f()))); + }, -1); + self.$private(); + if (($truthy($$$('Process')['$const_defined?']("CLOCK_MONOTONIC", false)) && ($eqeq(((($a = $$$('::', 'Process', 'skip_raise')) && ($b = $a, $b) && ($c = $b) && ((($d = $c.$clock_gettime) && !$d.$$stub) || $c['$respond_to_missing?']('clock_gettime'))) ? 'method' : nil), "method")))) { + + $const_set($nesting[0], 'CLOCK_ID', $$$($$$('Process'), 'CLOCK_MONOTONIC')); + return $def(self, '$now', function $$now() { + + return $$$('Process').$clock_gettime($$('CLOCK_ID')) + }); + } else { + return $def(self, '$now', function $$now() { + + return $$$('Time').$now() + }) + } })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/converter/html5"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $hash2 = Opal.hash2, $regexp = Opal.regexp, $eqeq = Opal.eqeq, $def = Opal.def, $send2 = Opal.send2, $find_super = Opal.find_super, $truthy = Opal.truthy, $send = Opal.send, $rb_gt = Opal.rb_gt, $rb_plus = Opal.rb_plus, $not = Opal.not, $neqeq = Opal.neqeq, $rb_le = Opal.rb_le, $rb_lt = Opal.rb_lt, $to_ary = Opal.to_ary, $rb_times = Opal.rb_times, $rb_minus = Opal.rb_minus, $gvars = Opal.gvars, $return_val = Opal.return_val, $alias = Opal.alias, $eqeqeq = Opal.eqeqeq, $slice = Opal.slice, $to_a = Opal.to_a, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('register_for,default=,==,[],init_backend_traits,node_name,convert_inline_quoted,convert_paragraph,convert_inline_anchor,convert_section,convert_listing,convert_literal,convert_ulist,convert_olist,convert_dlist,convert_admonition,convert_colist,convert_embedded,convert_example,convert_floating_title,convert_image,convert_inline_break,convert_inline_button,convert_inline_callout,convert_inline_footnote,convert_inline_image,convert_inline_indexterm,convert_inline_kbd,convert_inline_menu,convert_open,convert_page_break,convert_preamble,convert_quote,convert_sidebar,convert_stem,convert_table,convert_thematic_break,convert_verse,convert_video,convert_document,convert_toc,convert_pass,convert_audio,empty?,attr,attr?,<<,include?,sub_replacements,gsub,extname,slice,length,doctitle,normalize_web_path,primary_stylesheet_data,instance,read_contents,syntax_highlighter,size,docinfo,id,sections?,doctype,role?,role,join,noheader,convert,converter,generate_manname_section,header?,notitle,title,header,each,authors,>,name,email,sub_macros,+,downcase,concat,content,!,footnotes?,footnotes,index,text,nofooter,docinfo?,[]=,delete_at,inspect,!=,to_i,attributes,document,sections,level,caption,captioned_title,<=,numbered,<,sectname,sectnum,convert_outline,title?,icon_uri,compact,media_uri,option?,append_boolean_attribute,style,items,blocks?,text?,chomp,safe,read_svg_contents,alt,image_uri,encode_attribute_value,append_link_constraint_attrs,highlight?,to_sym,format,*,-,count,end_with?,start_with?,list_marker_keyword,parent,warn,logger,context,error,content_only,new,columns,to_h,rows,colspan,rowspan,unshift,shift,split,pop,nil_or_empty?,type,===,catalog,get_root_document,xreftext,target,reftext,chop,sub,match,private,upcase,nested?,parent_document,handles?,to_s,send'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Html5Converter'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.void_element_slash = $proto.xml_mode = $proto.refs = $proto.resolving_xref = nil; + + self.$register_for("html5"); + $const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript", "asciimath", "latexmath"], {"monospaced": ["", "", true], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["“", "”"], "single": ["‘", "’"], "mark": ["", "", true], "superscript": ["", "", true], "subscript": ["", "", true], "asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]}))['$default='](["", ""]); + $const_set($nesting[0], 'DropAnchorRx', /<(?:a\b[^>]*|\/a)>/); + $const_set($nesting[0], 'StemBreakRx', / *\\\n(?:\\?\n)*|\n\n+/); + + $const_set($nesting[0], 'SvgPreambleRx', $regexp(["^", $$('CC_ALL'), "*?(?=])"])); + $const_set($nesting[0], 'SvgStartTagRx', /^]*)?>/); $const_set($nesting[0], 'DimensionAttributeRx', $regexp(["\\s(?:width|height|style)=([\"'])", $$('CC_ANY'), "*?\\1"])); + + $def(self, '$initialize', function $$initialize(backend, opts) { + var self = this, syntax = nil; + + + if (opts == null) opts = $hash2([], {}); + self.backend = backend; + if ($eqeq(opts['$[]']("htmlsyntax"), "xml")) { + + syntax = "xml"; + self.xml_mode = true; + self.void_element_slash = "/"; + } else { + + syntax = "html"; + self.xml_mode = nil; + self.void_element_slash = ""; + } return self.$init_backend_traits($hash2(["basebackend", "filetype", "htmlsyntax", "outfilesuffix", "supports_templates"], {"basebackend": "html", "filetype": "html", "htmlsyntax": syntax, "outfilesuffix": ".html", "supports_templates": true})); + }, -2); + + $def(self, '$convert', function $$convert(node, transform, opts) { + var $yield = $$convert.$$p || nil, self = this; + + $$convert.$$p = null; + + if (transform == null) transform = node.$node_name(); + if (opts == null) opts = nil; + + switch (transform) { + case "inline_quoted": + return self.$convert_inline_quoted(node) + case "paragraph": + return self.$convert_paragraph(node) + case "inline_anchor": + return self.$convert_inline_anchor(node) + case "section": + return self.$convert_section(node) + case "listing": + return self.$convert_listing(node) + case "literal": + return self.$convert_literal(node) + case "ulist": + return self.$convert_ulist(node) + case "olist": + return self.$convert_olist(node) + case "dlist": + return self.$convert_dlist(node) + case "admonition": + return self.$convert_admonition(node) + case "colist": + return self.$convert_colist(node) + case "embedded": + return self.$convert_embedded(node) + case "example": + return self.$convert_example(node) + case "floating_title": + return self.$convert_floating_title(node) + case "image": + return self.$convert_image(node) + case "inline_break": + return self.$convert_inline_break(node) + case "inline_button": + return self.$convert_inline_button(node) + case "inline_callout": + return self.$convert_inline_callout(node) + case "inline_footnote": + return self.$convert_inline_footnote(node) + case "inline_image": + return self.$convert_inline_image(node) + case "inline_indexterm": + return self.$convert_inline_indexterm(node) + case "inline_kbd": + return self.$convert_inline_kbd(node) + case "inline_menu": + return self.$convert_inline_menu(node) + case "open": + return self.$convert_open(node) + case "page_break": + return self.$convert_page_break(node) + case "preamble": + return self.$convert_preamble(node) + case "quote": + return self.$convert_quote(node) + case "sidebar": + return self.$convert_sidebar(node) + case "stem": + return self.$convert_stem(node) + case "table": + return self.$convert_table(node) + case "thematic_break": + return self.$convert_thematic_break(node) + case "verse": + return self.$convert_verse(node) + case "video": + return self.$convert_video(node) + case "document": + return self.$convert_document(node) + case "toc": + return self.$convert_toc(node) + case "pass": + return self.$convert_pass(node) + case "audio": + return self.$convert_audio(node) + default: + return $send2(self, $find_super(self, 'convert', $$convert, false, true), 'convert', [node, transform, opts], $yield) + } }, -2); + + $def(self, '$convert_document', function $$convert_document(node) { + var self = this, br = nil, slash = nil, asset_uri_scheme = nil, cdn_base_url = nil, linkcss = nil, max_width_attr = nil, result = nil, lang_attribute = nil, authors = nil, icon_href = nil, icon_type = nil, icon_ext = nil, webfonts = nil, iconfont_stylesheet = nil, syntax_hl = nil, syntax_hl_docinfo_head_idx = nil, docinfo_content = nil, id_attr = nil, sectioned = nil, classes = nil, details = nil, idx = nil, $ret_or_1 = nil, eqnums_val = nil, eqnums_opt = nil; + + + br = ""; + if (!$truthy((asset_uri_scheme = node.$attr("asset-uri-scheme", "https"))['$empty?']())) { + asset_uri_scheme = "" + (asset_uri_scheme) + ":"; + } cdn_base_url = "" + (asset_uri_scheme) + "//cdnjs.cloudflare.com/ajax/libs"; + linkcss = node['$attr?']("linkcss"); + max_width_attr = ($truthy(node['$attr?']("max-width")) ? (" style=\"max-width: " + (node.$attr("max-width")) + ";\"") : ("")); + result = [""]; + lang_attribute = ($truthy(node['$attr?']("nolang")) ? ("") : (" lang=\"" + (node.$attr("lang", "en")) + "\"")); + result['$<<'](""); + result['$<<']("\n" + "\n" + "\n" + "\n" + ""); + if ($truthy(node['$attr?']("app-name"))) { + result['$<<'](""); + } if ($truthy(node['$attr?']("description"))) { + result['$<<'](""); + } if ($truthy(node['$attr?']("keywords"))) { + result['$<<'](""); + } if ($truthy(node['$attr?']("authors"))) { + result['$<<'](""); + } if ($truthy(node['$attr?']("copyright"))) { + result['$<<'](""); + } if ($truthy(node['$attr?']("favicon"))) { + + if ($truthy((icon_href = node.$attr("favicon"))['$empty?']())) { + + icon_href = "favicon.ico"; + icon_type = "image/x-icon"; + } else if ($truthy((icon_ext = $$('Helpers').$extname(icon_href, nil)))) { + icon_type = ($eqeq(icon_ext, ".ico") ? ("image/x-icon") : ("image/" + (icon_ext.$slice(1, icon_ext.$length())))); + } else { + icon_type = "image/x-icon"; + } result['$<<'](""); + } result['$<<']("" + (node.$doctitle($hash2(["sanitize", "use_fallback"], {"sanitize": true, "use_fallback": true}))) + ""); + if ($truthy($$('DEFAULT_STYLESHEET_KEYS')['$include?'](node.$attr("stylesheet")))) { + + if ($truthy((webfonts = node.$attr("webfonts")))) { + result['$<<'](""); + } if ($truthy(linkcss)) { + result['$<<'](""); + } else { + result['$<<'](""); + } } else if ($truthy(node['$attr?']("stylesheet"))) { + if ($truthy(linkcss)) { + result['$<<'](""); + } else { + result['$<<'](""); + } + } if ($truthy(node['$attr?']("icons", "font"))) { + if ($truthy(node['$attr?']("iconfont-remote"))) { + result['$<<'](""); + } else { + + iconfont_stylesheet = "" + (node.$attr("iconfont-name", "font-awesome")) + ".css"; + result['$<<'](""); + } + } if ($truthy((syntax_hl = node.$syntax_highlighter()))) { + result['$<<']((syntax_hl_docinfo_head_idx = result.$size())); + } if (!$truthy((docinfo_content = node.$docinfo())['$empty?']())) { + result['$<<'](docinfo_content); + } result['$<<'](""); + id_attr = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + if (((($truthy((sectioned = node['$sections?']())) && ($truthy(node['$attr?']("toc-class")))) && ($truthy(node['$attr?']("toc")))) && ($truthy(node['$attr?']("toc-placement", "auto"))))) { + classes = [node.$doctype(), node.$attr("toc-class"), "toc-" + (node.$attr("toc-position", "header"))]; + } else { + classes = [node.$doctype()]; + } if ($truthy(node['$role?']())) { + classes['$<<'](node.$role()); + } result['$<<'](""); + if (!$truthy((docinfo_content = node.$docinfo("header"))['$empty?']())) { + result['$<<'](docinfo_content); + } if (!$truthy(node.$noheader())) { + + result['$<<']("
"); + if ($eqeq(node.$doctype(), "manpage")) { + + result['$<<']("

" + (node.$doctitle()) + " Manual Page

"); + if ((($truthy(sectioned) && ($truthy(node['$attr?']("toc")))) && ($truthy(node['$attr?']("toc-placement", "auto"))))) { + result['$<<']("
\n" + "
" + (node.$attr("toc-title")) + "
\n" + (node.$converter().$convert(node, "outline")) + "\n" + "
"); + } if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node)); + } } else { + + if ($truthy(node['$header?']())) { + + if (!$truthy(node.$notitle())) { + result['$<<']("

" + (node.$header().$title()) + "

"); + } details = []; + idx = 1; + $send(node.$authors(), 'each', [], function $$1(author){ + + if (author == null) author = nil; + details['$<<']("" + (node.$sub_replacements(author.$name())) + "" + (br)); + if ($truthy(author.$email())) { + details['$<<']("" + (node.$sub_macros(author.$email())) + "" + (br)); + } return (idx = $rb_plus(idx, 1));}); + if ($truthy(node['$attr?']("revnumber"))) { + details['$<<']("" + (($truthy(($ret_or_1 = node.$attr("version-label"))) ? ($ret_or_1) : ("")).$downcase()) + " " + (node.$attr("revnumber")) + (($truthy(node['$attr?']("revdate")) ? (",") : (""))) + ""); + } if ($truthy(node['$attr?']("revdate"))) { + details['$<<']("" + (node.$attr("revdate")) + ""); + } if ($truthy(node['$attr?']("revremark"))) { + details['$<<']("" + (br) + "" + (node.$attr("revremark")) + ""); + } if (!$truthy(details['$empty?']())) { + + result['$<<']("
"); + result.$concat(details); + result['$<<']("
"); + } } if ((($truthy(sectioned) && ($truthy(node['$attr?']("toc")))) && ($truthy(node['$attr?']("toc-placement", "auto"))))) { + result['$<<']("
\n" + "
" + (node.$attr("toc-title")) + "
\n" + (node.$converter().$convert(node, "outline")) + "\n" + "
"); + } } result['$<<']("
"); + } result['$<<']("
\n" + (node.$content()) + "\n" + "
"); + if (($truthy(node['$footnotes?']()) && ($not(node['$attr?']("nofootnotes"))))) { + + result['$<<']("
\n" + ""); + $send(node.$footnotes(), 'each', [], function $$2(footnote){ + + if (footnote == null) footnote = nil; + return result['$<<']("
\n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
");}); + result['$<<']("
"); + } if (!$truthy(node.$nofooter())) { + + result['$<<']("
"); + result['$<<']("
"); + if ($truthy(node['$attr?']("revnumber"))) { + result['$<<']("" + (node.$attr("version-label")) + " " + (node.$attr("revnumber")) + (br)); + } if (($truthy(node['$attr?']("last-update-label")) && ($not(node['$attr?']("reproducible"))))) { + result['$<<']("" + (node.$attr("last-update-label")) + " " + (node.$attr("docdatetime"))); + } result['$<<']("
"); + result['$<<']("
"); + } if ($truthy(syntax_hl)) { + + if ($truthy(syntax_hl['$docinfo?']("head"))) { + result['$[]='](syntax_hl_docinfo_head_idx, syntax_hl.$docinfo("head", node, $hash2(["cdn_base_url", "linkcss", "self_closing_tag_slash"], {"cdn_base_url": cdn_base_url, "linkcss": linkcss, "self_closing_tag_slash": slash}))); + } else { + result.$delete_at(syntax_hl_docinfo_head_idx); + } if ($truthy(syntax_hl['$docinfo?']("footer"))) { + result['$<<'](syntax_hl.$docinfo("footer", node, $hash2(["cdn_base_url", "linkcss", "self_closing_tag_slash"], {"cdn_base_url": cdn_base_url, "linkcss": linkcss, "self_closing_tag_slash": slash}))); + } } if ($truthy(node['$attr?']("stem"))) { + + eqnums_val = node.$attr("eqnums", "none"); + if ($truthy(eqnums_val['$empty?']())) { + eqnums_val = "AMS"; + } eqnums_opt = " equationNumbers: { autoNumber: \"" + (eqnums_val) + "\" } "; + result['$<<']("\n" + ""); + } if (!$truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { + result['$<<'](docinfo_content); + } result['$<<'](""); + result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$convert_embedded', function $$convert_embedded(node) { + var self = this, result = nil, id_attr = nil, toc_p = nil; + + + result = []; + if ($eqeq(node.$doctype(), "manpage")) { + + if (!$truthy(node.$notitle())) { + + id_attr = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + result['$<<']("" + (node.$doctitle()) + " Manual Page"); + } if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node)); + } } else if (($truthy(node['$header?']()) && ($not(node.$notitle())))) { + + id_attr = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + result['$<<']("" + (node.$header().$title()) + ""); + } if (((($truthy(node['$sections?']()) && ($truthy(node['$attr?']("toc")))) && ($neqeq((toc_p = node.$attr("toc-placement")), "macro"))) && ($neqeq(toc_p, "preamble")))) { + result['$<<']("
\n" + "
" + (node.$attr("toc-title")) + "
\n" + (node.$converter().$convert(node, "outline")) + "\n" + "
"); + } result['$<<'](node.$content()); + if (($truthy(node['$footnotes?']()) && ($not(node['$attr?']("nofootnotes"))))) { + + result['$<<']("
\n" + ""); + $send(node.$footnotes(), 'each', [], function $$3(footnote){ + + if (footnote == null) footnote = nil; + return result['$<<']("
\n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
");}); + result['$<<']("
"); + } return result.$join($$('LF')); + }); + + $def(self, '$convert_outline', function $$convert_outline(node, opts) { + var self = this, sectnumlevels = nil, $ret_or_1 = nil, $ret_or_2 = nil, toclevels = nil, sections = nil, result = nil; + + + if (opts == null) opts = $hash2([], {}); + if (!$truthy(node['$sections?']())) { + return nil + } sectnumlevels = ($truthy(($ret_or_1 = opts['$[]']("sectnumlevels"))) ? ($ret_or_1) : (($truthy(($ret_or_2 = node.$document().$attributes()['$[]']("sectnumlevels"))) ? ($ret_or_2) : (3)).$to_i())); + toclevels = ($truthy(($ret_or_1 = opts['$[]']("toclevels"))) ? ($ret_or_1) : (($truthy(($ret_or_2 = node.$document().$attributes()['$[]']("toclevels"))) ? ($ret_or_2) : (2)).$to_i())); + sections = node.$sections(); + result = ["
    "]; + $send(sections, 'each', [], function $$4(section){var self = $$4.$$s == null ? this : $$4.$$s, slevel = nil, stitle = nil, signifier = nil, child_toc_level = nil; + + + if (section == null) section = nil; + slevel = section.$level(); + if ($truthy(section.$caption())) { + stitle = section.$captioned_title(); + } else if (($truthy(section.$numbered()) && ($truthy($rb_le(slevel, sectnumlevels))))) { + if (($truthy($rb_lt(slevel, 2)) && ($eqeq(node.$document().$doctype(), "book")))) { + + switch (section.$sectname()) { + case "chapter": + stitle = "" + (($truthy((signifier = node.$document().$attributes()['$[]']("chapter-signifier"))) ? ("" + (signifier) + " ") : (""))) + (section.$sectnum()) + " " + (section.$title()); + break; + case "part": + stitle = "" + (($truthy((signifier = node.$document().$attributes()['$[]']("part-signifier"))) ? ("" + (signifier) + " ") : (""))) + (section.$sectnum(nil, ":")) + " " + (section.$title()); + break; + default: + stitle = "" + (section.$sectnum()) + " " + (section.$title()); + } + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()); + } + } else { + stitle = section.$title(); + } if ($truthy(stitle['$include?']("" + (stitle) + ""); + result['$<<'](child_toc_level); + return result['$<<'](""); + } else { + return result['$<<']("
  • " + (stitle) + "
  • ") + }}, {$$s: self}); + result['$<<']("
"); + return result.$join($$('LF')); + }, -2); + + $def(self, '$convert_section', function $$convert_section(node) { + var doc_attrs = nil, level = nil, title = nil, $ret_or_1 = nil, signifier = nil, id_attr = nil, id = nil, role = nil; + + + doc_attrs = node.$document().$attributes(); + level = node.$level(); + if ($truthy(node.$caption())) { + title = node.$captioned_title(); + } else if (($truthy(node.$numbered()) && ($truthy($rb_le(level, ($truthy(($ret_or_1 = doc_attrs['$[]']("sectnumlevels"))) ? ($ret_or_1) : (3)).$to_i()))))) { + if (($truthy($rb_lt(level, 2)) && ($eqeq(node.$document().$doctype(), "book")))) { + + switch (node.$sectname()) { + case "chapter": + title = "" + (($truthy((signifier = doc_attrs['$[]']("chapter-signifier"))) ? ("" + (signifier) + " ") : (""))) + (node.$sectnum()) + " " + (node.$title()); + break; + case "part": + title = "" + (($truthy((signifier = doc_attrs['$[]']("part-signifier"))) ? ("" + (signifier) + " ") : (""))) + (node.$sectnum(nil, ":")) + " " + (node.$title()); + break; + default: + title = "" + (node.$sectnum()) + " " + (node.$title()); + } + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()); + } + } else { + title = node.$title(); + } if ($truthy(node.$id())) { + + id_attr = " id=\"" + ((id = node.$id())) + "\""; + if ($truthy(doc_attrs['$[]']("sectlinks"))) { + title = "" + (title) + ""; + } if ($truthy(doc_attrs['$[]']("sectanchors"))) { + if ($eqeq(doc_attrs['$[]']("sectanchors"), "after")) { + title = "" + (title) + ""; + } else { + title = "" + (title); + } + } } else { + id_attr = ""; + } if ($eqeq(level, 0)) { + return "" + (title) + "\n" + (node.$content()) + } else { + return "
\n" + "" + (title) + "\n" + (($eqeq(level, 1) ? ("
\n" + (node.$content()) + "\n" + "
") : (node.$content()))) + "\n" + "
" + } }); + + $def(self, '$convert_admonition', function $$convert_admonition(node) { + var self = this, id_attr = nil, name = nil, title_element = nil, label = nil, role = nil; + + + id_attr = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + name = node.$attr("name"); + title_element = ($truthy(node['$title?']()) ? ("
" + (node.$title()) + "
\n") : ("")); + if ($truthy(node.$document()['$attr?']("icons"))) { + if (($truthy(node.$document()['$attr?']("icons", "font")) && ($not(node['$attr?']("icon"))))) { + label = ""; + } else { + label = "\"""; + } + } else { + label = "
" + (node.$attr("textlabel")) + "
"; + } return "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
\n" + (label) + "\n" + "\n" + (title_element) + (node.$content()) + "\n" + "
\n" + ""; + }); + + $def(self, '$convert_audio', function $$convert_audio(node) { + var self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, start_t = nil, end_t = nil, time_anchor = nil, $ret_or_1 = nil; + + + xml = self.xml_mode; + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + classes = ["audioblock", node.$role()].$compact(); + class_attribute = " class=\"" + (classes.$join(" ")) + "\""; + title_element = ($truthy(node['$title?']()) ? ("
" + (node.$title()) + "
\n") : ("")); + start_t = node.$attr("start"); + end_t = node.$attr("end"); + time_anchor = (($truthy(start_t) || ($truthy(end_t))) ? ("#t=" + (($truthy(($ret_or_1 = start_t)) ? ($ret_or_1) : (""))) + (($truthy(end_t) ? ("," + (end_t)) : ("")))) : ("")); + return "\n" + (title_element) + "
\n" + "\n" + "
\n" + ""; + }); + + $def(self, '$convert_colist', function $$convert_colist(node) { + var $a, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, font_icons = nil, num = nil; + + + result = []; + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + classes = ["colist", node.$style(), node.$role()].$compact(); + class_attribute = " class=\"" + (classes.$join(" ")) + "\""; + result['$<<'](""); + if ($truthy(node['$title?']())) { + result['$<<']("
" + (node.$title()) + "
"); + } if ($truthy(node.$document()['$attr?']("icons"))) { + + result['$<<'](""); + $a = [node.$document()['$attr?']("icons", "font"), 0], (font_icons = $a[0]), (num = $a[1]); + $send(node.$items(), 'each', [], function $$5(item){var self = $$5.$$s == null ? this : $$5.$$s, num_label = nil; + if (self.void_element_slash == null) self.void_element_slash = nil; + + + if (item == null) item = nil; + num = $rb_plus(num, 1); + if ($truthy(font_icons)) { + num_label = "" + (num) + ""; + } else { + num_label = "\"""; + } return result['$<<']("\n" + "\n" + "\n" + "");}, {$$s: self}); + result['$<<']("
" + (num_label) + "" + (item.$text()) + (($truthy(item['$blocks?']()) ? ($rb_plus($$('LF'), item.$content())) : (""))) + "
"); + } else { + + result['$<<']("
    "); + $send(node.$items(), 'each', [], function $$6(item){ + + if (item == null) item = nil; + return result['$<<']("
  1. \n" + "

    " + (item.$text()) + "

    " + (($truthy(item['$blocks?']()) ? ($rb_plus($$('LF'), item.$content())) : (""))) + "\n" + "
  2. ");}); + result['$<<']("
"); + } result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$convert_dlist', function $$convert_dlist(node) { + var self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, slash = nil, col_style_attribute = nil, dt_style_attribute = nil; + + + result = []; + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + + switch (node.$style()) { + case "qanda": + classes = ["qlist", "qanda", node.$role()]; + break; + case "horizontal": + classes = ["hdlist", node.$role()]; + break; + default: + classes = ["dlist", node.$style(), node.$role()]; + } class_attribute = " class=\"" + (classes.$compact().$join(" ")) + "\""; + result['$<<'](""); + if ($truthy(node['$title?']())) { + result['$<<']("
" + (node.$title()) + "
"); + } + switch (node.$style()) { + case "qanda": + + result['$<<']("
    "); + $send(node.$items(), 'each', [], function $$7(terms, dd){ + + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<']("
  1. "); + $send(terms, 'each', [], function $$8(dt){ + + if (dt == null) dt = nil; + return result['$<<']("

    " + (dt.$text()) + "

    ");}); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("

    " + (dd.$text()) + "

    "); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } return result['$<<']("
  2. ");}); + result['$<<']("
"); + break; + case "horizontal": + + slash = self.void_element_slash; + result['$<<'](""); + if (($truthy(node['$attr?']("labelwidth")) || ($truthy(node['$attr?']("itemwidth"))))) { + + result['$<<'](""); + col_style_attribute = ($truthy(node['$attr?']("labelwidth")) ? (" style=\"width: " + (node.$attr("labelwidth").$chomp("%")) + "%;\"") : ("")); + result['$<<'](""); + col_style_attribute = ($truthy(node['$attr?']("itemwidth")) ? (" style=\"width: " + (node.$attr("itemwidth").$chomp("%")) + "%;\"") : ("")); + result['$<<'](""); + result['$<<'](""); + } $send(node.$items(), 'each', [], function $$9(terms, dd){var first_term = nil; + + + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<'](""); + result['$<<'](""); + result['$<<'](""); + return result['$<<']("");}); + result['$<<']("
"); + first_term = true; + $send(terms, 'each', [], function $$10(dt){ + + if (dt == null) dt = nil; + if (!$truthy(first_term)) { + result['$<<'](""); + } result['$<<'](dt.$text()); + return (first_term = nil);}); + result['$<<'](""); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("

" + (dd.$text()) + "

"); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } result['$<<']("
"); + break; + default: + + result['$<<']("
"); + dt_style_attribute = ($truthy(node.$style()) ? ("") : (" class=\"hdlist1\"")); + $send(node.$items(), 'each', [], function $$11(terms, dd){ + + if (terms == null) terms = nil; + if (dd == null) dd = nil; + $send(terms, 'each', [], function $$12(dt){ + + if (dt == null) dt = nil; + return result['$<<']("" + (dt.$text()) + "");}); + if (!$truthy(dd)) { + return nil + } result['$<<']("
"); + if ($truthy(dd['$text?']())) { + result['$<<']("

" + (dd.$text()) + "

"); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } return result['$<<']("
");}); + result['$<<']("
"); + } result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$convert_example', function $$convert_example(node) { + var id_attribute = nil, class_attribute = nil, summary_element = nil, title_element = nil, role = nil; + + + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + if ($truthy(node['$option?']("collapsible"))) { + + class_attribute = ($truthy(node.$role()) ? (" class=\"" + (node.$role()) + "\"") : ("")); + summary_element = ($truthy(node['$title?']()) ? ("" + (node.$title()) + "") : ("Details")); + return "\n" + (summary_element) + "\n" + "
\n" + (node.$content()) + "\n" + "
\n" + ""; + } else { + + title_element = ($truthy(node['$title?']()) ? ("
" + (node.$captioned_title()) + "
\n") : ("")); + return "\n" + (title_element) + "
\n" + (node.$content()) + "\n" + "
\n" + ""; + } }); + + $def(self, '$convert_floating_title', function $$convert_floating_title(node) { + var tag_name = nil, id_attribute = nil, classes = nil; + + + tag_name = "h" + ($rb_plus(node.$level(), 1)); + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + classes = [node.$style(), node.$role()].$compact(); + return "<" + (tag_name) + (id_attribute) + " class=\"" + (classes.$join(" ")) + "\">" + (node.$title()) + ""; + }); + + $def(self, '$convert_image', function $$convert_image(node) { + var self = this, target = nil, width_attr = nil, height_attr = nil, img = nil, $ret_or_1 = nil, fallback = nil, id_attr = nil, classes = nil, class_attr = nil, title_el = nil; + + + target = node.$attr("target"); + width_attr = ($truthy(node['$attr?']("width")) ? (" width=\"" + (node.$attr("width")) + "\"") : ("")); + height_attr = ($truthy(node['$attr?']("height")) ? (" height=\"" + (node.$attr("height")) + "\"") : ("")); + if ((($truthy(node['$attr?']("format", "svg")) || ($truthy(target['$include?'](".svg")))) && ($truthy($rb_lt(node.$document().$safe(), $$$($$('SafeMode'), 'SECURE')))))) { + if ($truthy(node['$option?']("inline"))) { + img = ($truthy(($ret_or_1 = self.$read_svg_contents(node, target))) ? ($ret_or_1) : ("" + (node.$alt()) + "")); + } else if ($truthy(node['$option?']("interactive"))) { + + fallback = ($truthy(node['$attr?']("fallback")) ? ("\""") : ("" + (node.$alt()) + "")); + img = "" + (fallback) + ""; + } else { + img = "\"""; + } + } else { + img = "\"""; + } if ($truthy(node['$attr?']("link"))) { + img = "" + (img) + ""; + } id_attr = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + classes = ["imageblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float")); + } if ($truthy(node['$attr?']("align"))) { + classes['$<<']("text-" + (node.$attr("align"))); + } if ($truthy(node.$role())) { + classes['$<<'](node.$role()); + } class_attr = " class=\"" + (classes.$join(" ")) + "\""; + title_el = ($truthy(node['$title?']()) ? ("\n
" + (node.$captioned_title()) + "
") : ("")); + return "\n" + "
\n" + (img) + "\n" + "
" + (title_el) + "\n" + ""; + }); + + $def(self, '$convert_listing', function $$convert_listing(node) { + var nowrap = nil, $ret_or_1 = nil, lang = nil, syntax_hl = nil, opts = nil, doc_attrs = nil, pre_open = nil, pre_close = nil, id_attribute = nil, title_element = nil, role = nil; + + + nowrap = ($truthy(($ret_or_1 = node['$option?']("nowrap"))) ? ($ret_or_1) : (node.$document()['$attr?']("prewrap")['$!']())); + if ($eqeq(node.$style(), "source")) { + + lang = node.$attr("language"); + if ($truthy((syntax_hl = node.$document().$syntax_highlighter()))) { + + opts = ($truthy(syntax_hl['$highlight?']()) ? ($hash2(["css_mode", "style"], {"css_mode": ($truthy(($ret_or_1 = (doc_attrs = node.$document().$attributes())['$[]']("" + (syntax_hl.$name()) + "-css"))) ? ($ret_or_1) : ("class")).$to_sym(), "style": doc_attrs['$[]']("" + (syntax_hl.$name()) + "-style")})) : ($hash2([], {}))); + opts['$[]=']("nowrap", nowrap); + } else { + + pre_open = "
";
+              pre_close = "
"; + } } else { + + pre_open = ""; + pre_close = ""; + } id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + title_element = ($truthy(node['$title?']()) ? ("
" + (node.$captioned_title()) + "
\n") : ("")); + return "\n" + (title_element) + "
\n" + (($truthy(syntax_hl) ? (syntax_hl.$format(node, lang, opts)) : ($rb_plus($rb_plus(pre_open, node.$content()), pre_close)))) + "\n" + "
\n" + ""; + }); + + $def(self, '$convert_literal', function $$convert_literal(node) { + var id_attribute = nil, title_element = nil, nowrap = nil, $ret_or_1 = nil, role = nil; + + + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + title_element = ($truthy(node['$title?']()) ? ("
" + (node.$title()) + "
\n") : ("")); + nowrap = ($truthy(($ret_or_1 = node.$document()['$attr?']("prewrap")['$!']())) ? ($ret_or_1) : (node['$option?']("nowrap"))); + return "\n" + (title_element) + "
\n" + "" + (node.$content()) + "\n" + "
\n" + ""; + }); + + $def(self, '$convert_stem', function $$convert_stem(node) { + var $a, $b, self = this, id_attribute = nil, title_element = nil, style = nil, open = nil, close = nil, equation = nil, br = nil, role = nil; + + + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + title_element = ($truthy(node['$title?']()) ? ("
" + (node.$title()) + "
\n") : ("")); + $b = $$('BLOCK_MATH_DELIMITERS')['$[]']((style = node.$style().$to_sym())), $a = $to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])); + if ($truthy((equation = node.$content()))) { + + if (($eqeq(style, "asciimath") && ($truthy(equation['$include?']($$('LF')))))) { + + br = "" + ($$('LF')) + ""; + equation = $send(equation, 'gsub', [$$('StemBreakRx')], function $$13(){var $c; + + return "" + (close) + ($rb_times(br, $rb_minus((($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$count($$('LF')), 1))) + ($$('LF')) + (open)}); + } if (!($truthy(equation['$start_with?'](open)) && ($truthy(equation['$end_with?'](close))))) { + equation = "" + (open) + (equation) + (close); + } } else { + equation = ""; + } return "\n" + (title_element) + "
\n" + (equation) + "\n" + "
\n" + ""; + }); + + $def(self, '$convert_olist', function $$convert_olist(node) { + var self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, type_attribute = nil, keyword = nil, start_attribute = nil, reversed_attribute = nil; + + + result = []; + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + classes = ["olist", node.$style(), node.$role()].$compact(); + class_attribute = " class=\"" + (classes.$join(" ")) + "\""; + result['$<<'](""); + if ($truthy(node['$title?']())) { + result['$<<']("
" + (node.$title()) + "
"); + } type_attribute = ($truthy((keyword = node.$list_marker_keyword())) ? (" type=\"" + (keyword) + "\"") : ("")); + start_attribute = ($truthy(node['$attr?']("start")) ? (" start=\"" + (node.$attr("start")) + "\"") : ("")); + reversed_attribute = ($truthy(node['$option?']("reversed")) ? (self.$append_boolean_attribute("reversed", self.xml_mode)) : ("")); + result['$<<']("
    "); + $send(node.$items(), 'each', [], function $$14(item){ + + if (item == null) item = nil; + if ($truthy(item.$id())) { + result['$<<']("
  1. "); + } else if ($truthy(item.$role())) { + result['$<<']("
  2. "); + } else { + result['$<<']("
  3. "); + } result['$<<']("

    " + (item.$text()) + "

    "); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content()); + } return result['$<<']("
  4. ");}); + result['$<<']("
"); + result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$convert_open', function $$convert_open(node) { + var self = this, style = nil, id_attr = nil, title_el = nil, role = nil; + + if ($eqeq((style = node.$style()), "abstract")) { + if (($eqeq(node.$parent(), node.$document()) && ($eqeq(node.$document().$doctype(), "book")))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + + id_attr = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + title_el = ($truthy(node['$title?']()) ? ("
" + (node.$title()) + "
\n") : ("")); + return "\n" + (title_el) + "
\n" + (node.$content()) + "\n" + "
\n" + ""; + } + } else if (($eqeq(style, "partintro") && ((($truthy($rb_gt(node.$level(), 0)) || ($neqeq(node.$parent().$context(), "section"))) || ($neqeq(node.$document().$doctype(), "book")))))) { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } else { + + id_attr = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + title_el = ($truthy(node['$title?']()) ? ("
" + (node.$title()) + "
\n") : ("")); + return "\n" + (title_el) + "
\n" + (node.$content()) + "\n" + "
\n" + ""; + } + }); + + $def(self, '$convert_page_break', $return_val("
")); + + $def(self, '$convert_paragraph', function $$convert_paragraph(node) { + var attributes = nil; + + + if ($truthy(node.$role())) { + attributes = "" + (($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : (""))) + " class=\"paragraph " + (node.$role()) + "\""; + } else if ($truthy(node.$id())) { + attributes = " id=\"" + (node.$id()) + "\" class=\"paragraph\""; + } else { + attributes = " class=\"paragraph\""; + } if ($truthy(node['$title?']())) { + return "\n" + "
" + (node.$title()) + "
\n" + "

" + (node.$content()) + "

\n" + "" + } else { + return "\n" + "

" + (node.$content()) + "

\n" + "" + } }); + $alias(self, "convert_pass", "content_only"); + + $def(self, '$convert_preamble', function $$convert_preamble(node) { + var doc = nil, toc = nil; + + + if ((($truthy((doc = node.$document())['$attr?']("toc-placement", "preamble")) && ($truthy(doc['$sections?']()))) && ($truthy(doc['$attr?']("toc"))))) { + toc = "\n" + "
\n" + "
" + (doc.$attr("toc-title")) + "
\n" + (doc.$converter().$convert(doc, "outline")) + "\n" + "
"; + } else { + toc = ""; + } return "
\n" + "
\n" + (node.$content()) + "\n" + "
" + (toc) + "\n" + "
"; + }); + + $def(self, '$convert_quote', function $$convert_quote(node) { + var self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + classes = ["quoteblock", node.$role()].$compact(); + class_attribute = " class=\"" + (classes.$join(" ")) + "\""; + title_element = ($truthy(node['$title?']()) ? ("\n
" + (node.$title()) + "
") : ("")); + attribution = ($truthy(node['$attr?']("attribution")) ? (node.$attr("attribution")) : (nil)); + citetitle = ($truthy(node['$attr?']("citetitle")) ? (node.$attr("citetitle")) : (nil)); + if (($truthy(attribution) || ($truthy(citetitle)))) { + + cite_element = ($truthy(citetitle) ? ("" + (citetitle) + "") : ("")); + attribution_text = ($truthy(attribution) ? ("— " + (attribution) + (($truthy(citetitle) ? ("\n") : ("")))) : ("")); + attribution_element = "\n
\n" + (attribution_text) + (cite_element) + "\n
"; + } else { + attribution_element = ""; + } return "" + (title_element) + "\n" + "
\n" + (node.$content()) + "\n" + "
" + (attribution_element) + "\n" + ""; + }); + + $def(self, '$convert_thematic_break', function $$convert_thematic_break(node) { + var self = this; + + return "" + }); + + $def(self, '$convert_sidebar', function $$convert_sidebar(node) { + var id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + title_element = ($truthy(node['$title?']()) ? ("
" + (node.$title()) + "
\n") : ("")); + return "\n" + "
\n" + (title_element) + (node.$content()) + "\n" + "
\n" + ""; + }); + + $def(self, '$convert_table', function $$convert_table(node) { + var self = this, result = nil, id_attribute = nil, frame = nil, classes = nil, stripes = nil, style_attribute = nil, autowidth = nil, tablewidth = nil, role = nil, class_attribute = nil, slash = nil; + + + result = []; + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + if ($eqeq((frame = node.$attr("frame", "all", "table-frame")), "topbot")) { + frame = "ends"; + } classes = ["tableblock", "frame-" + (frame), "grid-" + (node.$attr("grid", "all", "table-grid"))]; + if ($truthy((stripes = node.$attr("stripes", nil, "table-stripes")))) { + classes['$<<']("stripes-" + (stripes)); + } style_attribute = ""; + if (($truthy((autowidth = node['$option?']("autowidth"))) && ($not(node['$attr?']("width"))))) { + classes['$<<']("fit-content"); + } else if ($eqeq((tablewidth = node.$attr("tablepcwidth")), 100)) { + classes['$<<']("stretch"); + } else { + style_attribute = " style=\"width: " + (tablewidth) + "%;\""; + } if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float")); + } if ($truthy((role = node.$role()))) { + classes['$<<'](role); + } class_attribute = " class=\"" + (classes.$join(" ")) + "\""; + result['$<<'](""); + if ($truthy(node['$title?']())) { + result['$<<']("" + (node.$captioned_title()) + ""); + } if ($truthy($rb_gt(node.$attr("rowcount"), 0))) { + + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(autowidth)) { + result = $rb_plus(result, $$('Array').$new(node.$columns().$size(), "")); + } else { + $send(node.$columns(), 'each', [], function $$15(col){ + + if (col == null) col = nil; + return result['$<<'](($truthy(col['$option?']("autowidth")) ? ("") : ("")));}); + } result['$<<'](""); + $send(node.$rows().$to_h(), 'each', [], function $$16(tsec, rows){ + + if (tsec == null) tsec = nil; + if (rows == null) rows = nil; + if ($truthy(rows['$empty?']())) { + return nil + } result['$<<'](""); + $send(rows, 'each', [], function $$17(row){ + + if (row == null) row = nil; + result['$<<'](""); + $send(row, 'each', [], function $$18(cell){var cell_content = nil, cell_tag_name = nil, cell_class_attribute = nil, cell_colspan_attribute = nil, cell_rowspan_attribute = nil, cell_style_attribute = nil; + + + if (cell == null) cell = nil; + if ($eqeq(tsec, "head")) { + cell_content = cell.$text(); + } else + switch (cell.$style()) { + case "asciidoc": + cell_content = "
" + (cell.$content()) + "
"; + break; + case "literal": + cell_content = "
" + (cell.$text()) + "
"; + break; + default: + cell_content = ($truthy((cell_content = cell.$content())['$empty?']()) ? ("") : ("

" + (cell_content.$join("

\n" + "

")) + "

")); + } cell_tag_name = (($eqeq(tsec, "head") || ($eqeq(cell.$style(), "header"))) ? ("th") : ("td")); + cell_class_attribute = " class=\"tableblock halign-" + (cell.$attr("halign")) + " valign-" + (cell.$attr("valign")) + "\""; + cell_colspan_attribute = ($truthy(cell.$colspan()) ? (" colspan=\"" + (cell.$colspan()) + "\"") : ("")); + cell_rowspan_attribute = ($truthy(cell.$rowspan()) ? (" rowspan=\"" + (cell.$rowspan()) + "\"") : ("")); + cell_style_attribute = ($truthy(node.$document()['$attr?']("cellbgcolor")) ? (" style=\"background-color: " + (node.$document().$attr("cellbgcolor")) + ";\"") : ("")); + return result['$<<']("<" + (cell_tag_name) + (cell_class_attribute) + (cell_colspan_attribute) + (cell_rowspan_attribute) + (cell_style_attribute) + ">" + (cell_content) + "");}); + return result['$<<']("");}); + return result['$<<']("
");}); + } result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$convert_toc', function $$convert_toc(node) { + var doc = nil, id_attr = nil, title_id_attr = nil, title = nil, levels = nil, role = nil; + + + if (!(($truthy((doc = node.$document())['$attr?']("toc-placement", "macro")) && ($truthy(doc['$sections?']()))) && ($truthy(doc['$attr?']("toc"))))) { + return "" + } if ($truthy(node.$id())) { + + id_attr = " id=\"" + (node.$id()) + "\""; + title_id_attr = " id=\"" + (node.$id()) + "title\""; + } else { + + id_attr = " id=\"toc\""; + title_id_attr = " id=\"toctitle\""; + } title = ($truthy(node['$title?']()) ? (node.$title()) : (doc.$attr("toc-title"))); + levels = ($truthy(node['$attr?']("levels")) ? (node.$attr("levels").$to_i()) : (nil)); + role = ($truthy(node['$role?']()) ? (node.$role()) : (doc.$attr("toc-class", "toc"))); + return "\n" + "" + (title) + "\n" + (doc.$converter().$convert(doc, "outline", $hash2(["toclevels"], {"toclevels": levels}))) + "\n" + ""; + }); + + $def(self, '$convert_ulist', function $$convert_ulist(node) { + var self = this, result = nil, id_attribute = nil, div_classes = nil, marker_checked = nil, marker_unchecked = nil, checklist = nil, ul_class_attribute = nil; + + + result = []; + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + div_classes = ["ulist", node.$style(), node.$role()].$compact(); + marker_checked = (marker_unchecked = ""); + if ($truthy((checklist = node['$option?']("checklist")))) { + + div_classes.$unshift(div_classes.$shift(), "checklist"); + ul_class_attribute = " class=\"checklist\""; + if ($truthy(node['$option?']("interactive"))) { + if ($truthy(self.xml_mode)) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = " "; + marker_unchecked = " "; + } + } else if ($truthy(node.$document()['$attr?']("icons", "font"))) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = "✓ "; + marker_unchecked = "❏ "; + } } else { + ul_class_attribute = ($truthy(node.$style()) ? (" class=\"" + (node.$style()) + "\"") : ("")); + } result['$<<'](""); + if ($truthy(node['$title?']())) { + result['$<<']("
" + (node.$title()) + "
"); + } result['$<<'](""); + $send(node.$items(), 'each', [], function $$19(item){ + + if (item == null) item = nil; + if ($truthy(item.$id())) { + result['$<<']("
  • "); + } else if ($truthy(item.$role())) { + result['$<<']("
  • "); + } else { + result['$<<']("
  • "); + } if (($truthy(checklist) && ($truthy(item['$attr?']("checkbox"))))) { + result['$<<']("

    " + (($truthy(item['$attr?']("checked")) ? (marker_checked) : (marker_unchecked))) + (item.$text()) + "

    "); + } else { + result['$<<']("

    " + (item.$text()) + "

    "); + } if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content()); + } return result['$<<']("
  • ");}); + result['$<<'](""); + result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$convert_verse', function $$convert_verse(node) { + var self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + classes = ["verseblock", node.$role()].$compact(); + class_attribute = " class=\"" + (classes.$join(" ")) + "\""; + title_element = ($truthy(node['$title?']()) ? ("\n
    " + (node.$title()) + "
    ") : ("")); + attribution = ($truthy(node['$attr?']("attribution")) ? (node.$attr("attribution")) : (nil)); + citetitle = ($truthy(node['$attr?']("citetitle")) ? (node.$attr("citetitle")) : (nil)); + if (($truthy(attribution) || ($truthy(citetitle)))) { + + cite_element = ($truthy(citetitle) ? ("" + (citetitle) + "") : ("")); + attribution_text = ($truthy(attribution) ? ("— " + (attribution) + (($truthy(citetitle) ? ("\n") : ("")))) : ("")); + attribution_element = "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = ""; + } return "" + (title_element) + "\n" + "
    " + (node.$content()) + "
    " + (attribution_element) + "\n" + ""; + }); + + $def(self, '$convert_video', function $$convert_video(node) { + var $a, $b, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, width_attribute = nil, height_attribute = nil, asset_uri_scheme = nil, start_anchor = nil, delimiter = nil, target = nil, hash = nil, hash_param = nil, $ret_or_2 = nil, autoplay_param = nil, loop_param = nil, muted_param = nil, rel_param_val = nil, start_param = nil, end_param = nil, has_loop_param = nil, mute_param = nil, controls_param = nil, fs_param = nil, fs_attribute = nil, modest_param = nil, theme_param = nil, hl_param = nil, list = nil, list_param = nil, playlist = nil, poster_attribute = nil, val = nil, preload_attribute = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = ($truthy(node.$id()) ? (" id=\"" + (node.$id()) + "\"") : ("")); + classes = ["videoblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float")); + } if ($truthy(node['$attr?']("align"))) { + classes['$<<']("text-" + (node.$attr("align"))); + } if ($truthy(node.$role())) { + classes['$<<'](node.$role()); + } class_attribute = " class=\"" + (classes.$join(" ")) + "\""; + title_element = ($truthy(node['$title?']()) ? ("\n
    " + (node.$title()) + "
    ") : ("")); + width_attribute = ($truthy(node['$attr?']("width")) ? (" width=\"" + (node.$attr("width")) + "\"") : ("")); + height_attribute = ($truthy(node['$attr?']("height")) ? (" height=\"" + (node.$attr("height")) + "\"") : ("")); + + switch (node.$attr("poster")) { + case "vimeo": + + if (!$truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + asset_uri_scheme = "" + (asset_uri_scheme) + ":"; + } start_anchor = ($truthy(node['$attr?']("start")) ? ("#at=" + (node.$attr("start"))) : ("")); + delimiter = ["?"]; + $b = node.$attr("target").$split("/", 2), $a = $to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (hash = ($a[1] == null ? nil : $a[1])); + hash_param = ($truthy((hash = ($truthy(($ret_or_2 = hash)) ? ($ret_or_2) : (node.$attr("hash"))))) ? ("" + (($truthy(($ret_or_2 = delimiter.$pop())) ? ($ret_or_2) : ("&"))) + "h=" + (hash)) : ("")); + autoplay_param = ($truthy(node['$option?']("autoplay")) ? ("" + (($truthy(($ret_or_2 = delimiter.$pop())) ? ($ret_or_2) : ("&"))) + "autoplay=1") : ("")); + loop_param = ($truthy(node['$option?']("loop")) ? ("" + (($truthy(($ret_or_2 = delimiter.$pop())) ? ($ret_or_2) : ("&"))) + "loop=1") : ("")); + muted_param = ($truthy(node['$option?']("muted")) ? ("" + (($truthy(($ret_or_2 = delimiter.$pop())) ? ($ret_or_2) : ("&"))) + "muted=1") : ("")); + return "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + ""; + case "youtube": + + if (!$truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + asset_uri_scheme = "" + (asset_uri_scheme) + ":"; + } rel_param_val = ($truthy(node['$option?']("related")) ? (1) : (0)); + start_param = ($truthy(node['$attr?']("start")) ? ("&start=" + (node.$attr("start"))) : ("")); + end_param = ($truthy(node['$attr?']("end")) ? ("&end=" + (node.$attr("end"))) : ("")); + autoplay_param = ($truthy(node['$option?']("autoplay")) ? ("&autoplay=1") : ("")); + loop_param = ($truthy((has_loop_param = node['$option?']("loop"))) ? ("&loop=1") : ("")); + mute_param = ($truthy(node['$option?']("muted")) ? ("&mute=1") : ("")); + controls_param = ($truthy(node['$option?']("nocontrols")) ? ("&controls=0") : ("")); + if ($truthy(node['$option?']("nofullscreen"))) { + + fs_param = "&fs=0"; + fs_attribute = ""; + } else { + + fs_param = ""; + fs_attribute = self.$append_boolean_attribute("allowfullscreen", xml); + } modest_param = ($truthy(node['$option?']("modest")) ? ("&modestbranding=1") : ("")); + theme_param = ($truthy(node['$attr?']("theme")) ? ("&theme=" + (node.$attr("theme"))) : ("")); + hl_param = ($truthy(node['$attr?']("lang")) ? ("&hl=" + (node.$attr("lang"))) : ("")); + $b = node.$attr("target").$split("/", 2), $a = $to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (list = ($a[1] == null ? nil : $a[1])); + if ($truthy((list = ($truthy(($ret_or_2 = list)) ? ($ret_or_2) : (node.$attr("list")))))) { + list_param = "&list=" + (list); + } else { + + $b = target.$split(",", 2), $a = $to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (playlist = ($a[1] == null ? nil : $a[1])); + if ($truthy((playlist = ($truthy(($ret_or_2 = playlist)) ? ($ret_or_2) : (node.$attr("playlist")))))) { + list_param = "&playlist=" + (target) + "," + (playlist); + } else { + list_param = ($truthy(has_loop_param) ? ("&playlist=" + (target)) : ("")); + } } return "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + ""; + default: + + poster_attribute = ($truthy((val = node.$attr("poster"))['$nil_or_empty?']()) ? ("") : (" poster=\"" + (node.$media_uri(val)) + "\"")); + preload_attribute = ($truthy((val = node.$attr("preload"))['$nil_or_empty?']()) ? ("") : (" preload=\"" + (val) + "\"")); + start_t = node.$attr("start"); + end_t = node.$attr("end"); + time_anchor = (($truthy(start_t) || ($truthy(end_t))) ? ("#t=" + (($truthy(($ret_or_2 = start_t)) ? ($ret_or_2) : (""))) + (($truthy(end_t) ? ("," + (end_t)) : ("")))) : ("")); + return "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + ""; + } }); + + $def(self, '$convert_inline_anchor', function $$convert_inline_anchor(node) { + var self = this, path = nil, attrs = nil, text = nil, $ret_or_2 = nil, ref = nil, $ret_or_3 = nil, refid = nil, top = nil, outer = nil; + + + switch (node.$type()) { + case "xref": + + if ($truthy((path = node.$attributes()['$[]']("path")))) { + + attrs = self.$append_link_constraint_attrs(node, ($truthy(node.$role()) ? ([" class=\"" + (node.$role()) + "\""]) : ([]))).$join(); + text = ($truthy(($ret_or_2 = node.$text())) ? ($ret_or_2) : (path)); + } else { + + attrs = ($truthy(node.$role()) ? (" class=\"" + (node.$role()) + "\"") : ("")); + if (!$truthy((text = node.$text()))) { + if ($eqeqeq($$('AbstractNode'), (ref = ($truthy(($ret_or_2 = (self.refs = ($truthy(($ret_or_3 = self.refs)) ? ($ret_or_3) : (node.$document().$catalog()['$[]']("refs"))))['$[]']((refid = node.$attributes()['$[]']("refid"))))) ? ($ret_or_2) : (($truthy(refid['$nil_or_empty?']()) ? ((top = self.$get_root_document(node))) : (nil))))))) { + if (($truthy((self.resolving_xref = ($truthy(($ret_or_2 = self.resolving_xref)) ? ($ret_or_2) : ((outer = true))))) && ($truthy(outer)))) { + + if ($truthy((text = ref.$xreftext(node.$attr("xrefstyle", nil, true))))) { + if ($truthy(text['$include?']("" + (text) + ""; + case "ref": + return "" + case "link": + + attrs = ($truthy(node.$id()) ? ([" id=\"" + (node.$id()) + "\""]) : ([])); + if ($truthy(node.$role())) { + attrs['$<<'](" class=\"" + (node.$role()) + "\""); + } if ($truthy(node['$attr?']("title"))) { + attrs['$<<'](" title=\"" + (node.$attr("title")) + "\""); + } return "" + (node.$text()) + ""; + case "bibref": + return "[" + (($truthy(($ret_or_2 = node.$reftext())) ? ($ret_or_2) : (node.$id()))) + "]" + default: + + self.$logger().$warn("unknown anchor type: " + (node.$type().$inspect())); + return nil; + } + }); + + $def(self, '$convert_inline_break', function $$convert_inline_break(node) { + var self = this; + + return "" + (node.$text()) + "" + }); + + $def(self, '$convert_inline_button', function $$convert_inline_button(node) { + + return "" + (node.$text()) + "" + }); + + $def(self, '$convert_inline_callout', function $$convert_inline_callout(node) { + var self = this, src = nil, guard = nil; + + if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "(" + (node.$text()) + ")" + } else if ($truthy(node.$document()['$attr?']("icons"))) { + + src = node.$icon_uri("callouts/" + (node.$text())); + return "\"""; + } else if ($eqeqeq($$$('Array'), (guard = node.$attributes()['$[]']("guard")))) { + return "<!--(" + (node.$text()) + ")-->" + } else { + return "" + (guard) + "(" + (node.$text()) + ")" + } + }); + + $def(self, '$convert_inline_footnote', function $$convert_inline_footnote(node) { + var index = nil, id_attr = nil; + + if ($truthy((index = node.$attr("index")))) { + if ($eqeq(node.$type(), "xref")) { + return "[" + (index) + "]" + } else { + + id_attr = ($truthy(node.$id()) ? (" id=\"_footnote_" + (node.$id()) + "\"") : ("")); + return "[" + (index) + "]"; + } + } else if ($eqeq(node.$type(), "xref")) { + return "[" + (node.$text()) + "]" + } else { + return nil + } + }); + + $def(self, '$convert_inline_image', function $$convert_inline_image(node) { + var self = this, target = nil, type = nil, $ret_or_1 = nil, icons = nil, i_class_attr_val = nil, attrs = nil, img = nil, fallback = nil, class_attr_val = nil, role = nil; + + + target = node.$target(); + if ($eqeq((type = ($truthy(($ret_or_1 = node.$type())) ? ($ret_or_1) : ("image"))), "icon")) { + if ($eqeq((icons = node.$document().$attr("icons")), "font")) { + + i_class_attr_val = "fa fa-" + (target); + if ($truthy(node['$attr?']("size"))) { + i_class_attr_val = "" + (i_class_attr_val) + " fa-" + (node.$attr("size")); + } if ($truthy(node['$attr?']("flip"))) { + i_class_attr_val = "" + (i_class_attr_val) + " fa-flip-" + (node.$attr("flip")); + } else if ($truthy(node['$attr?']("rotate"))) { + i_class_attr_val = "" + (i_class_attr_val) + " fa-rotate-" + (node.$attr("rotate")); + } attrs = ($truthy(node['$attr?']("title")) ? (" title=\"" + (node.$attr("title")) + "\"") : ("")); + img = ""; + } else if ($truthy(icons)) { + + attrs = ($truthy(node['$attr?']("width")) ? (" width=\"" + (node.$attr("width")) + "\"") : ("")); + if ($truthy(node['$attr?']("height"))) { + attrs = "" + (attrs) + " height=\"" + (node.$attr("height")) + "\""; + } if ($truthy(node['$attr?']("title"))) { + attrs = "" + (attrs) + " title=\"" + (node.$attr("title")) + "\""; + } img = "\"""; + } else { + img = "[" + (node.$alt()) + "]"; + } + } else { + + attrs = ($truthy(node['$attr?']("width")) ? (" width=\"" + (node.$attr("width")) + "\"") : ("")); + if ($truthy(node['$attr?']("height"))) { + attrs = "" + (attrs) + " height=\"" + (node.$attr("height")) + "\""; + } if ($truthy(node['$attr?']("title"))) { + attrs = "" + (attrs) + " title=\"" + (node.$attr("title")) + "\""; + } if ((($truthy(node['$attr?']("format", "svg")) || ($truthy(target['$include?'](".svg")))) && ($truthy($rb_lt(node.$document().$safe(), $$$($$('SafeMode'), 'SECURE')))))) { + if ($truthy(node['$option?']("inline"))) { + img = ($truthy(($ret_or_1 = self.$read_svg_contents(node, target))) ? ($ret_or_1) : ("" + (node.$alt()) + "")); + } else if ($truthy(node['$option?']("interactive"))) { + + fallback = ($truthy(node['$attr?']("fallback")) ? ("\""") : ("" + (node.$alt()) + "")); + img = "" + (fallback) + ""; + } else { + img = "\"""; + } + } else { + img = "\"""; + } } if ($truthy(node['$attr?']("link"))) { + img = "" + (img) + ""; + } class_attr_val = type; + if ($truthy((role = node.$role()))) { + class_attr_val = ($truthy(node['$attr?']("float")) ? ("" + (class_attr_val) + " " + (node.$attr("float")) + " " + (role)) : ("" + (class_attr_val) + " " + (role))); + } else if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (class_attr_val) + " " + (node.$attr("float")); + } return "" + (img) + ""; + }); + + $def(self, '$convert_inline_indexterm', function $$convert_inline_indexterm(node) { + + if ($eqeq(node.$type(), "visible")) { + return node.$text() + } else { + return "" + } + }); + + $def(self, '$convert_inline_kbd', function $$convert_inline_kbd(node) { + var keys = nil; + + if ($eqeq((keys = node.$attr("keys")).$size(), 1)) { + return "" + (keys['$[]'](0)) + "" + } else { + return "" + (keys.$join("+")) + "" + } + }); + + $def(self, '$convert_inline_menu', function $$convert_inline_menu(node) { + var caret = nil, submenu_joiner = nil, menu = nil, submenus = nil, menuitem = nil; + + + caret = ($truthy(node.$document()['$attr?']("icons", "font")) ? ("  ") : ("  ")); + submenu_joiner = "" + (caret) + ""; + menu = node.$attr("menu"); + if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { + if ($truthy((menuitem = node.$attr("menuitem")))) { + return "" + (menu) + "" + (caret) + "" + (menuitem) + "" + } else { + return "" + (menu) + "" + } + } else { + return "" + (menu) + "" + (caret) + "" + (submenus.$join(submenu_joiner)) + "" + (caret) + "" + (node.$attr("menuitem")) + "" + } }); + + $def(self, '$convert_inline_quoted', function $$convert_inline_quoted(node) { + var $a, $b, open = nil, close = nil, tag = nil, class_attr = nil; + + + $b = $$('QUOTE_TAGS')['$[]'](node.$type()), $a = $to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (tag = ($a[2] == null ? nil : $a[2])); + if ($truthy(node.$id())) { + + class_attr = ($truthy(node.$role()) ? (" class=\"" + (node.$role()) + "\"") : ("")); + if ($truthy(tag)) { + return "" + (open.$chop()) + " id=\"" + (node.$id()) + "\"" + (class_attr) + ">" + (node.$text()) + (close) + } else { + return "" + (open) + (node.$text()) + (close) + "" + } } else if ($truthy(node.$role())) { + if ($truthy(tag)) { + return "" + (open.$chop()) + " class=\"" + (node.$role()) + "\">" + (node.$text()) + (close) + } else { + return "" + (open) + (node.$text()) + (close) + "" + } + } else { + return "" + (open) + (node.$text()) + (close) + } }); + + $def(self, '$read_svg_contents', function $$read_svg_contents(node, target) { + var svg = nil, old_start_tag = nil, new_start_tag = nil, start_tag_match = nil; + + + if ($truthy((svg = node.$read_contents(target, $hash2(["start", "normalize", "label", "warn_if_empty"], {"start": node.$document().$attr("imagesdir"), "normalize": true, "label": "SVG", "warn_if_empty": true}))))) { + + if ($truthy(svg['$empty?']())) { + return nil + } if (!$truthy(svg['$start_with?']("");}); + if ($truthy(new_start_tag)) { + svg = "" + (new_start_tag) + (svg['$[]'](Opal.Range.$new(old_start_tag.$length(), -1, false))); + } } return svg; + }); + self.$private(); + + $def(self, '$append_boolean_attribute', function $$append_boolean_attribute(name, xml) { + + if ($truthy(xml)) { + return " " + (name) + "=\"" + (name) + "\"" + } else { + return " " + (name) + } + }); + + $def(self, '$append_link_constraint_attrs', function $$append_link_constraint_attrs(node, attrs) { + var rel = nil, window = nil; + + + if (attrs == null) attrs = []; + if ($truthy(node['$option?']("nofollow"))) { + rel = "nofollow"; + } if ($truthy((window = node.$attributes()['$[]']("window")))) { + + attrs['$<<'](" target=\"" + (window) + "\""); + if (($eqeq(window, "_blank") || ($truthy(node['$option?']("noopener"))))) { + attrs['$<<'](($truthy(rel) ? (" rel=\"" + (rel) + " noopener\"") : (" rel=\"noopener\""))); + } } else if ($truthy(rel)) { + attrs['$<<'](" rel=\"" + (rel) + "\""); + } return attrs; + }, -2); + + $def(self, '$encode_attribute_value', function $$encode_attribute_value(val) { + + if ($truthy(val['$include?']("\""))) { + + return val.$gsub("\"", """); + } else { + return val + } + }); + + $def(self, '$generate_manname_section', function $$generate_manname_section(node) { + var manname_title = nil, next_section_title = nil, next_section = nil, manname_id_attr = nil, manname_id = nil; + + + manname_title = node.$attr("manname-title", "Name"); + if (($truthy((next_section = node.$sections()['$[]'](0))) && ($eqeq((next_section_title = next_section.$title()), next_section_title.$upcase())))) { + manname_title = manname_title.$upcase(); + } manname_id_attr = ($truthy((manname_id = node.$attr("manname-id"))) ? (" id=\"" + (manname_id) + "\"") : ("")); + return "" + (manname_title) + "\n" + "
    \n" + "

    " + (node.$attr("mannames").$join(", ")) + " - " + (node.$attr("manpurpose")) + "

    \n" + "
    "; + }); + + $def(self, '$get_root_document', function $$get_root_document(node) { + + + while ($truthy((node = node.$document())['$nested?']())) { + node = node.$parent_document(); + } return node; + }); + + $def(self, '$method_missing', function $$method_missing(id, $a) { + var $post_args, args, $yield = $$method_missing.$$p || nil, self = this, name = nil; + + $$method_missing.$$p = null; + + $post_args = $slice(arguments, 1); + args = $post_args; + if (($not((name = id.$to_s())['$start_with?']("convert_")) && ($truthy(self['$handles?'](name))))) { + + return $send(self, 'send', ["convert_" + (name)].concat($to_a(args))); + } else { + return $send2(self, $find_super(self, 'method_missing', $$method_missing, false, true), 'method_missing', [id].concat($to_a(args)), $yield) + } }, -2); + return $def(self, '$respond_to_missing?', function $Html5Converter_respond_to_missing$ques$21(id, $a) { + var self = this, $ret_or_1 = nil, name = nil; + + + $slice(arguments, 1); + if ($truthy(($ret_or_1 = (name = id.$to_s())['$start_with?']("convert_")['$!']()))) { + + return self['$handles?'](name); + } else { + return $ret_or_1 + } }, -2); + })($$('Converter'), $$$($$('Converter'), 'Base'), $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/extensions"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $def = Opal.def, $send = Opal.send, $alias = Opal.alias, $slice = Opal.slice, $rb_plus = Opal.rb_plus, $eqeq = Opal.eqeq, $rb_gt = Opal.rb_gt, $not = Opal.not, $eqeqeq = Opal.eqeqeq, $to_a = Opal.to_a, $to_ary = Opal.to_ary, $const_set = Opal.const_set, $return_val = Opal.return_val, $send2 = Opal.send2, $find_super = Opal.find_super, $NilClass = Opal.NilClass, $class_variable_set = Opal.class_variable_set, $class_variable_get = Opal.class_variable_get, $regexp = Opal.regexp, $Class = Opal.Class, $return_ivar = Opal.return_ivar, $rb_lt = Opal.rb_lt, $rb_minus = Opal.rb_minus, $hash = Opal.hash, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('[]=,config,const_defined?,singleton_class?,include,const_get,extend,enable_dsl,attr_reader,merge,class,update,raise,document,==,doctype,[],+,level,delete,>,casecmp,new,title=,sectname=,special=,fetch,numbered=,attr?,!,key?,special,numbered,id=,generate_id,title,update_attributes,tr,basename,create_block,assign_caption,===,parse_blocks,empty?,include?,sub_attributes,parse,each,define_method,unshift,shift,send,size,receiver,binding,define_singleton_method,instance_exec,to_proc,call,option,content_model,flatten,positional_attributes,default_attributes,respond_to?,to_s,partition,to_i,<<,compact,inspect,resolve_attributes,attr_accessor,to_set,contexts,match?,resolve_regexp,format,method,register,reset,values,groups,arity,activate,add_document_processor,tree_processor,tree_processors?,tree_processors,any?,select,add_syntax_processor,to_sym,instance_variable_get,kind,private,join,map,split,capitalize,instance_variable_set,resolve_args,singleton_class,process_block_given?,source_location,freeze,resolve_class,<,update_config,as_symbol,name,name=,pop,-,-@,next_auto_id,generate_name,each_with_object'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $parent_nesting) { + var self = $module($base, 'Extensions'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Processor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.config = nil; + + (function(self, $parent_nesting) { + + + + $def(self, '$config', function $$config() { + var self = this, $ret_or_1 = nil; + if (self.config == null) self.config = nil; + + return (self.config = ($truthy(($ret_or_1 = self.config)) ? ($ret_or_1) : ($hash2([], {})))) + }); + + $def(self, '$option', function $$option(key, default_value) { + var $a, self = this; + + return ($a = [key, default_value], $send(self.$config(), '[]=', $a), $a[$a.length - 1]) + }); + + $def(self, '$enable_dsl', function $$enable_dsl() { + var self = this; + + if ($truthy(self['$const_defined?']("DSL"))) { + if ($truthy(self['$singleton_class?']())) { + return self.$include(self.$const_get("DSL")) + } else { + return self.$extend(self.$const_get("DSL")) + } + } else { + return nil + } + }); + return $alias(self, "use_dsl", "enable_dsl"); + })(Opal.get_singleton_class(self)); + self.$attr_reader("config"); + + $def(self, '$initialize', function $$initialize(config) { + var self = this; + + + if (config == null) config = $hash2([], {}); + return (self.config = self.$class().$config().$merge(config)); + }, -1); + + $def(self, '$update_config', function $$update_config(config) { + var self = this; + + return self.config.$update(config) + }); + + $def(self, '$process', function $$process($a) { + var self = this; + + + $slice(arguments); + return self.$raise($$$('NotImplementedError'), "" + ($$('Processor')) + " subclass " + (self.$class()) + " must implement the #" + ("process") + " method"); + }, -1); + + $def(self, '$create_section', function $$create_section(parent, title, attrs, opts) { + var $a, $b, doc = nil, book = nil, doctype = nil, level = nil, $ret_or_1 = nil, style = nil, sectname = nil, special = nil, sect = nil, id = nil; + + + if (opts == null) opts = $hash2([], {}); + doc = parent.$document(); + book = (doctype = doc.$doctype())['$==']("book"); + level = ($truthy(($ret_or_1 = opts['$[]']("level"))) ? ($ret_or_1) : ($rb_plus(parent.$level(), 1))); + if ($truthy((style = attrs.$delete("style")))) { + if (($truthy(book) && ($eqeq(style, "abstract")))) { + $a = ["chapter", 1], (sectname = $a[0]), (level = $a[1]); + } else { + + $a = [style, true], (sectname = $a[0]), (special = $a[1]); + if ($eqeq(level, 0)) { + level = 1; + } } + } else if ($truthy(book)) { + sectname = ($eqeq(level, 0) ? ("part") : (($truthy($rb_gt(level, 1)) ? ("section") : ("chapter")))); + } else if (($eqeq(doctype, "manpage") && ($eqeq(title.$casecmp("synopsis"), 0)))) { + $a = ["synopsis", true], (sectname = $a[0]), (special = $a[1]); + } else { + sectname = "section"; + } sect = $$('Section').$new(parent, level); + $a = [title, sectname], ($b = [$a[0]], $send(sect, 'title=', $b), $b[$b.length - 1]), ($b = [$a[1]], $send(sect, 'sectname=', $b), $b[$b.length - 1]); + if ($truthy(special)) { + + sect['$special='](true); + if ($truthy(opts.$fetch("numbered", style['$==']("appendix")))) { + sect['$numbered='](true); + } else if (($not(opts['$key?']("numbered")) && ($truthy(doc['$attr?']("sectnums", "all"))))) { + sect['$numbered=']((($truthy(book) && ($eqeq(level, 1))) ? ("chapter") : (true))); + } } else if ($truthy($rb_gt(level, 0))) { + if ($truthy(opts.$fetch("numbered", doc['$attr?']("sectnums")))) { + sect['$numbered='](($truthy(sect.$special()) ? (($truthy(($ret_or_1 = parent.$numbered())) || ($ret_or_1))) : (true))); + } + } else if ($truthy(opts.$fetch("numbered", ($truthy(($ret_or_1 = book)) ? (doc['$attr?']("partnums")) : ($ret_or_1))))) { + sect['$numbered='](true); + } if ($eqeq((id = attrs['$[]']("id")), false)) { + attrs.$delete("id"); + } else { + sect['$id='](($a = ["id", ($truthy(($ret_or_1 = id)) ? ($ret_or_1) : (($truthy(doc['$attr?']("sectids")) ? ($$('Section').$generate_id(sect.$title(), doc)) : (nil))))], $send(attrs, '[]=', $a), $a[$a.length - 1])); + } sect.$update_attributes(attrs); + return sect; + }, -4); + + $def(self, '$create_block', function $$create_block(parent, context, source, attrs, opts) { + + + if (opts == null) opts = $hash2([], {}); + return $$('Block').$new(parent, context, $hash2(["source", "attributes"], {"source": source, "attributes": attrs}).$merge(opts)); + }, -5); + + $def(self, '$create_list', function $$create_list(parent, context, attrs) { + var list = nil; + + + if (attrs == null) attrs = nil; + list = $$('List').$new(parent, context); + if ($truthy(attrs)) { + list.$update_attributes(attrs); + } return list; + }, -3); + + $def(self, '$create_list_item', function $$create_list_item(parent, text) { + + + if (text == null) text = nil; + return $$('ListItem').$new(parent, text); + }, -2); + + $def(self, '$create_image_block', function $$create_image_block(parent, attrs, opts) { + var $a, self = this, target = nil, title = nil, block = nil; + + + if (opts == null) opts = $hash2([], {}); + if (!$truthy((target = attrs['$[]']("target")))) { + self.$raise($$$('ArgumentError'), "Unable to create an image block, target attribute is required"); + } if ($truthy((attrs['$[]']("alt")))) ; else { + attrs['$[]=']("alt", ($a = ["default-alt", $$('Helpers').$basename(target, true).$tr("_-", " ")], $send(attrs, '[]=', $a), $a[$a.length - 1])); + } title = ($truthy(attrs['$key?']("title")) ? (attrs.$delete("title")) : (nil)); + block = self.$create_block(parent, "image", nil, attrs, opts); + if ($truthy(title)) { + + block['$title='](title); + block.$assign_caption(attrs.$delete("caption"), "figure"); + } return block; + }, -3); + + $def(self, '$create_inline', function $$create_inline(parent, context, text, opts) { + + + if (opts == null) opts = $hash2([], {}); + return $$('Inline').$new(parent, context, text, ($eqeq(context, "quoted") ? ($hash2(["type"], {"type": "unquoted"}).$merge(opts)) : (opts))); + }, -4); + + $def(self, '$parse_content', function $$parse_content(parent, content, attributes) { + var reader = nil; + + + if (attributes == null) attributes = nil; + reader = ($eqeqeq($$('Reader'), content) ? (content) : ($$('Reader').$new(content))); + $$('Parser').$parse_blocks(reader, parent, attributes); + return parent; + }, -3); + + $def(self, '$parse_attributes', function $$parse_attributes(block, attrlist, opts) { + var $ret_or_1 = nil; + + + if (opts == null) opts = $hash2([], {}); + if ($truthy(($truthy(attrlist) ? (attrlist['$empty?']()) : (true)))) { + return $hash2([], {}) + } if (($truthy(opts['$[]']("sub_attributes")) && ($truthy(attrlist['$include?']($$('ATTR_REF_HEAD')))))) { + attrlist = block.$sub_attributes(attrlist); + } return $$('AttributeList').$new(attrlist).$parse(($truthy(($ret_or_1 = opts['$[]']("positional_attributes"))) ? ($ret_or_1) : ([]))); + }, -3); + return $send([["create_paragraph", "create_block", "paragraph"], ["create_open_block", "create_block", "open"], ["create_example_block", "create_block", "example"], ["create_pass_block", "create_block", "pass"], ["create_listing_block", "create_block", "listing"], ["create_literal_block", "create_block", "literal"], ["create_anchor", "create_inline", "anchor"], ["create_inline_pass", "create_inline", "quoted"]], 'each', [], function $Processor$1(method_name, delegate_method_name, context){var self = $Processor$1.$$s == null ? this : $Processor$1.$$s; + + + if (method_name == null) method_name = nil; + if (delegate_method_name == null) delegate_method_name = nil; + if (context == null) context = nil; + return $send(self, 'define_method', [method_name], function $$2($a){var $post_args, args, self = $$2.$$s == null ? this : $$2.$$s; + + + $post_args = $slice(arguments); + args = $post_args; + args.$unshift(args.$shift(), context); + return $send(self, 'send', [delegate_method_name].concat($to_a(args)));}, {$$arity: -1, $$s: self});}, {$$s: self}); + })($nesting[0], null, $nesting); + (function($base) { + var self = $module($base, 'ProcessorDsl'); + + + + + $def(self, '$option', function $$option(key, value) { + var $a, self = this; + + return ($a = [key, value], $send(self.$config(), '[]=', $a), $a[$a.length - 1]) + }); + + $def(self, '$process', function $$process($a) { + var block = $$process.$$p || nil, $post_args, args, $b, self = this, context = nil; + if (self.process_block == null) self.process_block = nil; + + $$process.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + if ((block !== nil)) { + + if (!$truthy(args['$empty?']())) { + self.$raise($$$('ArgumentError'), "wrong number of arguments (given " + (args.$size()) + ", expected 0)"); + } if (!($truthy(block.$binding()) && ($eqeq(self, block.$binding().$receiver())))) { + + context = self; + $send(block, 'define_singleton_method', ["call"], function $$3($b){var $post_args, m_args; + + + $post_args = $slice(arguments); + m_args = $post_args; + return $send(context, 'instance_exec', $to_a(m_args), block.$to_proc());}, -1); + } return (self.process_block = block); + } else if ($truthy((($b = self['process_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return $send(self.process_block, 'call', $to_a(args)) + } else { + return self.$raise($$$('NotImplementedError'), "" + (self.$class()) + " #" + ("process") + " method called before being registered") + } }, -1); + return $def(self, '$process_block_given?', function $ProcessorDsl_process_block_given$ques$4() { + var $a, self = this; + + return (($a = self['process_block'], $a != null && $a !== nil) ? 'instance-variable' : nil) + }); + })($nesting[0]); + (function($base, $parent_nesting) { + var self = $module($base, 'DocumentProcessorDsl'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('ProcessorDsl')); + return $def(self, '$prefer', function $$prefer() { + var self = this; + + return self.$option("position", ">>") + }); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'SyntaxProcessorDsl'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('ProcessorDsl')); + + $def(self, '$named', function $$named(value) { + var self = this; + + if ($eqeqeq($$('Processor'), self)) { + return (self.name = value) + } else { + return self.$option("name", value) + } + }); + + $def(self, '$content_model', function $$content_model(value) { + var self = this; + + return self.$option("content_model", value) + }); + $alias(self, "parse_content_as", "content_model"); + + $def(self, '$positional_attributes', function $$positional_attributes($a) { + var $post_args, value, self = this; + + + $post_args = $slice(arguments); + value = $post_args; + return self.$option("positional_attrs", value.$flatten()); + }, -1); + $alias(self, "name_positional_attributes", "positional_attributes"); + $alias(self, "positional_attrs", "positional_attributes"); + + $def(self, '$default_attributes', function $$default_attributes(value) { + var self = this; + + return self.$option("default_attrs", value) + }); + $alias(self, "default_attrs", "default_attributes"); + + $def(self, '$resolve_attributes', function $$resolve_attributes($a) { + var $post_args, args, $b, self = this, $ret_or_1 = nil, names = nil, defaults = nil; + + + $post_args = $slice(arguments); + args = $post_args; + if (!$truthy($rb_gt(args.$size(), 1))) { + if ($truthy((args = args.$fetch(0, true))['$respond_to?']("to_sym"))) { + args = [args]; + } + } if ($eqeqeq(true, ($ret_or_1 = args))) { + + self.$option("positional_attrs", []); + return self.$option("default_attrs", $hash2([], {})); + } else if ($eqeqeq($$$('Array'), $ret_or_1)) { + + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]); + $send(args, 'each', [], function $$5(arg){var $c, $d, name = nil, value = nil, idx = nil; + + + if (arg == null) arg = nil; + if ($truthy((arg = arg.$to_s())['$include?']("="))) { + + $d = arg.$partition("="), $c = $to_ary($d), (name = ($c[0] == null ? nil : $c[0])), (($c[1] == null ? nil : $c[1])), (value = ($c[2] == null ? nil : $c[2])); + if ($truthy(name['$include?'](":"))) { + + $d = name.$partition(":"), $c = $to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (($c[1] == null ? nil : $c[1])), (name = ($c[2] == null ? nil : $c[2])); + idx = ($eqeq(idx, "@") ? (names.$size()) : (idx.$to_i())); + names['$[]='](idx, name); + } return ($c = [name, value], $send(defaults, '[]=', $c), $c[$c.length - 1]); + } else if ($truthy(arg['$include?'](":"))) { + + $d = arg.$partition(":"), $c = $to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (($c[1] == null ? nil : $c[1])), (name = ($c[2] == null ? nil : $c[2])); + idx = ($eqeq(idx, "@") ? (names.$size()) : (idx.$to_i())); + return ($c = [idx, name], $send(names, '[]=', $c), $c[$c.length - 1]); + } else { + return names['$<<'](arg) + }}); + self.$option("positional_attrs", names.$compact()); + return self.$option("default_attrs", defaults); + } else if ($eqeqeq($$$('Hash'), $ret_or_1)) { + + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]); + $send(args, 'each', [], function $$6(key, val){var $c, $d, name = nil, idx = nil; + + + if (key == null) key = nil; + if (val == null) val = nil; + if ($truthy((name = key.$to_s())['$include?'](":"))) { + + $d = name.$partition(":"), $c = $to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (($c[1] == null ? nil : $c[1])), (name = ($c[2] == null ? nil : $c[2])); + idx = ($eqeq(idx, "@") ? (names.$size()) : (idx.$to_i())); + names['$[]='](idx, name); + } if ($truthy(val)) { + return ($c = [name, val], $send(defaults, '[]=', $c), $c[$c.length - 1]) + } else { + return nil + }}); + self.$option("positional_attrs", names.$compact()); + return self.$option("default_attrs", defaults); + } else { + return self.$raise($$$('ArgumentError'), "unsupported attributes specification for macro: " + (args.$inspect())) + } }, -1); + return $alias(self, "resolves_attributes", "resolve_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Preprocessor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$process', function $$process(document, reader) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('Preprocessor')) + " subclass " + (self.$class()) + " must implement the #" + ("process") + " method") + }) + })($nesting[0], $$('Processor'), $nesting); + $const_set($$('Preprocessor'), 'DSL', $$('DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'TreeProcessor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$process', function $$process(document) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('TreeProcessor')) + " subclass " + (self.$class()) + " must implement the #" + ("process") + " method") + }) + })($nesting[0], $$('Processor'), $nesting); + $const_set($$('TreeProcessor'), 'DSL', $$('DocumentProcessorDsl')); + $const_set($nesting[0], 'Treeprocessor', $$('TreeProcessor')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Postprocessor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$process', function $$process(document, output) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('Postprocessor')) + " subclass " + (self.$class()) + " must implement the #" + ("process") + " method") + }) + })($nesting[0], $$('Processor'), $nesting); + $const_set($$('Postprocessor'), 'DSL', $$('DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'IncludeProcessor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$process', function $$process(document, reader, target, attributes) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('IncludeProcessor')) + " subclass " + (self.$class()) + " must implement the #" + ("process") + " method") + }); + return $def(self, '$handles?', $return_val(true)); + })($nesting[0], $$('Processor'), $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'IncludeProcessorDsl'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('DocumentProcessorDsl')); + return $def(self, '$handles?', function $IncludeProcessorDsl_handles$ques$7($a) { + var block = $IncludeProcessorDsl_handles$ques$7.$$p || nil, $post_args, args, $b, self = this; + if (self.handles_block == null) self.handles_block = nil; + + $IncludeProcessorDsl_handles$ques$7.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + if ((block !== nil)) { + + if (!$truthy(args['$empty?']())) { + self.$raise($$$('ArgumentError'), "wrong number of arguments (given " + (args.$size()) + ", expected 0)"); + } return (self.handles_block = block); + } else if ($truthy((($b = self['handles_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return self.handles_block.$call(args['$[]'](0)) + } else { + return true + } }, -1); + })($nesting[0], $nesting); + $const_set($$('IncludeProcessor'), 'DSL', $$('IncludeProcessorDsl')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'DocinfoProcessor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.config = nil; + + + $def(self, '$initialize', function $$initialize(config) { + var $a; $$initialize.$$p || nil; var self = this, $ret_or_1 = nil; + + $$initialize.$$p = null; + + if (config == null) config = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [config], null); + if ($truthy(($ret_or_1 = self.config['$[]']("location")))) { + return $ret_or_1 + } else { + return ($a = ["location", "head"], $send(self.config, '[]=', $a), $a[$a.length - 1]) + } }, -1); + return $def(self, '$process', function $$process(document) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('DocinfoProcessor')) + " subclass " + (self.$class()) + " must implement the #" + ("process") + " method") + }); + })($nesting[0], $$('Processor'), $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'DocinfoProcessorDsl'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('DocumentProcessorDsl')); + return $def(self, '$at_location', function $$at_location(value) { + var self = this; + + return self.$option("location", value) + }); + })($nesting[0], $nesting); + $const_set($$('DocinfoProcessor'), 'DSL', $$('DocinfoProcessorDsl')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'BlockProcessor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.config = nil; + + self.$attr_accessor("name"); + + $def(self, '$initialize', function $$initialize(name, config) { + var $a; $$initialize.$$p || nil; var self = this, $ret_or_1 = nil; + + $$initialize.$$p = null; + + if (name == null) name = nil; + if (config == null) config = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [config], null); + self.name = ($truthy(($ret_or_1 = name)) ? ($ret_or_1) : (self.config['$[]']("name"))); + if ($eqeqeq($NilClass, ($ret_or_1 = self.config['$[]']("contexts")))) { + if ($truthy((self.config['$[]']("contexts")))) ; else { + self.config['$[]=']("contexts", ["open", "paragraph"].$to_set()); + } + } else if ($eqeqeq($$$('Symbol'), $ret_or_1)) { + self.config['$[]=']("contexts", [self.config['$[]']("contexts")].$to_set()); + } else { + self.config['$[]=']("contexts", self.config['$[]']("contexts").$to_set()); + } if ($truthy(($ret_or_1 = self.config['$[]']("content_model")))) { + return $ret_or_1 + } else { + return ($a = ["content_model", "compound"], $send(self.config, '[]=', $a), $a[$a.length - 1]) + } }, -1); + return $def(self, '$process', function $$process(parent, reader, attributes) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('BlockProcessor')) + " subclass " + (self.$class()) + " must implement the #" + ("process") + " method") + }); + })($nesting[0], $$('Processor'), $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'BlockProcessorDsl'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('SyntaxProcessorDsl')); + + $def(self, '$contexts', function $$contexts($a) { + var $post_args, value, self = this; + + + $post_args = $slice(arguments); + value = $post_args; + return self.$option("contexts", value.$flatten().$to_set()); + }, -1); + $alias(self, "on_contexts", "contexts"); + $alias(self, "on_context", "contexts"); + return $alias(self, "bind_to", "contexts"); + })($nesting[0], $nesting); + $const_set($$('BlockProcessor'), 'DSL', $$('BlockProcessorDsl')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'MacroProcessor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.config = nil; + + self.$attr_accessor("name"); + + $def(self, '$initialize', function $$initialize(name, config) { + var $a; $$initialize.$$p || nil; var self = this, $ret_or_1 = nil; + + $$initialize.$$p = null; + + if (name == null) name = nil; + if (config == null) config = $hash2([], {}); + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [config], null); + self.name = ($truthy(($ret_or_1 = name)) ? ($ret_or_1) : (self.config['$[]']("name"))); + if ($truthy(($ret_or_1 = self.config['$[]']("content_model")))) { + return $ret_or_1 + } else { + return ($a = ["content_model", "attributes"], $send(self.config, '[]=', $a), $a[$a.length - 1]) + } }, -1); + return $def(self, '$process', function $$process(parent, target, attributes) { + var self = this; + + return self.$raise($$$('NotImplementedError'), "" + ($$('MacroProcessor')) + " subclass " + (self.$class()) + " must implement the #" + ("process") + " method") + }); + })($nesting[0], $$('Processor'), $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'MacroProcessorDsl'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('SyntaxProcessorDsl')); + + $def(self, '$resolve_attributes', function $$resolve_attributes($a) { + var $post_args, args, $yield = $$resolve_attributes.$$p || nil, self = this; + + $$resolve_attributes.$$p = null; + + $post_args = $slice(arguments); + args = $post_args; + if (($eqeq(args.$size(), 1) && ($not(args['$[]'](0))))) { + return self.$option("content_model", "text") + } else { + + $send2(self, $find_super(self, 'resolve_attributes', $$resolve_attributes, false, true), 'resolve_attributes', $to_a(args), $yield); + return self.$option("content_model", "attributes"); + } }, -1); + return $alias(self, "resolves_attributes", "resolve_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'BlockMacroProcessor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.name = nil; + return $def(self, '$name', function $$name() { + var self = this; + + + if (!$truthy($$('MacroNameRx')['$match?'](self.name.$to_s()))) { + self.$raise($$$('ArgumentError'), "invalid name for block macro: " + (self.name)); + } return self.name; + }) + })($nesting[0], $$('MacroProcessor'), $nesting); + $const_set($$('BlockMacroProcessor'), 'DSL', $$('MacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'InlineMacroProcessor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.config = $proto.name = nil; + + $class_variable_set($nesting[0], '@@rx_cache', $hash2([], {})); + + $def(self, '$regexp', function $$regexp() { + var $a, self = this, $ret_or_1 = nil; + + if ($truthy(($ret_or_1 = self.config['$[]']("regexp")))) { + return $ret_or_1 + } else { + return ($a = ["regexp", self.$resolve_regexp(self.name.$to_s(), self.config['$[]']("format"))], $send(self.config, '[]=', $a), $a[$a.length - 1]) + } + }); + return $def(self, '$resolve_regexp', function $$resolve_regexp(name, format) { + var $a, self = this, $ret_or_1 = nil; + + + if (!$truthy($$('MacroNameRx')['$match?'](name))) { + self.$raise($$$('ArgumentError'), "invalid name for inline macro: " + (name)); + } if ($truthy(($ret_or_1 = $class_variable_get($nesting[0], '@@rx_cache', false)['$[]']([name, format])))) { + return $ret_or_1 + } else { + return ($a = [[name, format], $regexp(["\\\\?", name, ":", ($eqeq(format, "short") ? ("(){0}") : ("(\\S+?)")), "\\[(|", $$('CC_ANY'), "*?[^\\\\])\\]"])], $send($class_variable_get($nesting[0], '@@rx_cache', false), '[]=', $a), $a[$a.length - 1]) + } }); + })($nesting[0], $$('MacroProcessor'), $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'InlineMacroProcessorDsl'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + self.$include($$('MacroProcessorDsl')); + + $def(self, '$format', function $$format(value) { + var self = this; + + return self.$option("format", value) + }); + $alias(self, "match_format", "format"); + $alias(self, "using_format", "format"); + return $def(self, '$match', function $$match(value) { + var self = this; + + return self.$option("regexp", value) + }); + })($nesting[0], $nesting); + $const_set($$('InlineMacroProcessor'), 'DSL', $$('InlineMacroProcessorDsl')); + (function($base, $super) { + var self = $klass($base, $super, 'Extension'); + + + + self.$attr_reader("kind"); + self.$attr_reader("config"); + self.$attr_reader("instance"); + return $def(self, '$initialize', function $$initialize(kind, instance, config) { + var self = this; + + + self.kind = kind; + self.instance = instance; + return (self.config = config); + }); + })($nesting[0], null); + (function($base, $super) { + var self = $klass($base, $super, 'ProcessorExtension'); + + + + self.$attr_reader("process_method"); + return $def(self, '$initialize', function $$initialize(kind, instance, process_method) { + $$initialize.$$p || nil; var self = this, $ret_or_1 = nil; + + $$initialize.$$p = null; + + if (process_method == null) process_method = nil; + $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [kind, instance, instance.$config()], null); + return (self.process_method = ($truthy(($ret_or_1 = process_method)) ? ($ret_or_1) : (instance.$method("process")))); + }, -3); + })($nesting[0], $$('Extension')); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Group'); + + var $nesting = [self].concat($parent_nesting); + + + (function(self, $parent_nesting) { + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$register', function $$register(name) { + var self = this; + + + if (name == null) name = nil; + return $$('Extensions').$register(name, self); + }, -1) + })(Opal.get_singleton_class(self), $nesting); + return $def(self, '$activate', function $$activate(registry) { + var self = this; + + return self.$raise($$$('NotImplementedError')) + }); + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Registry'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.document = $proto.groups = $proto.preprocessor_extensions = $proto.tree_processor_extensions = $proto.postprocessor_extensions = $proto.include_processor_extensions = $proto.docinfo_processor_extensions = $proto.block_extensions = $proto.block_macro_extensions = $proto.inline_macro_extensions = nil; + + self.$attr_reader("document"); + self.$attr_reader("groups"); + + $def(self, '$initialize', function $$initialize(groups) { + var self = this; + + + if (groups == null) groups = $hash2([], {}); + self.groups = groups; + self.$reset(); + self.preprocessor_extensions = (self.tree_processor_extensions = (self.postprocessor_extensions = (self.include_processor_extensions = (self.docinfo_processor_extensions = (self.block_extensions = (self.block_macro_extensions = (self.inline_macro_extensions = nil))))))); + return (self.document = nil); + }, -1); + + $def(self, '$activate', function $$activate(document) { + var self = this, ext_groups = nil; + + + if ($truthy(self.document)) { + self.$reset(); + } self.document = document; + if (!$truthy((ext_groups = $rb_plus($$('Extensions').$groups().$values(), self.groups.$values()))['$empty?']())) { + $send(ext_groups, 'each', [], function $$8(group){var self = $$8.$$s == null ? this : $$8.$$s, $ret_or_1 = nil; + + + if (group == null) group = nil; + if ($eqeqeq($$$('Proc'), ($ret_or_1 = group))) { + + switch (group.$arity()) { + case 0: + case -1: + return $send(self, 'instance_exec', [], group.$to_proc()) + case 1: + return group.$call(self) + default: + return nil + } + } else if ($eqeqeq($Class, $ret_or_1)) { + return group.$new().$activate(self) + } else { + return group.$activate(self) + }}, {$$s: self}); + } return self; + }); + + $def(self, '$preprocessor', function $$preprocessor($a) { + var block = $$preprocessor.$$p || nil, $post_args, args, self = this; + + $$preprocessor.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'add_document_processor', ["preprocessor", args], block.$to_proc()); + }, -1); + + $def(self, '$preprocessors?', function $Registry_preprocessors$ques$9() { + var self = this; + + return self.preprocessor_extensions['$!']()['$!']() + }); + + $def(self, '$preprocessors', $return_ivar("preprocessor_extensions")); + + $def(self, '$tree_processor', function $$tree_processor($a) { + var block = $$tree_processor.$$p || nil, $post_args, args, self = this; + + $$tree_processor.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'add_document_processor', ["tree_processor", args], block.$to_proc()); + }, -1); + + $def(self, '$tree_processors?', function $Registry_tree_processors$ques$10() { + var self = this; + + return self.tree_processor_extensions['$!']()['$!']() + }); + + $def(self, '$tree_processors', $return_ivar("tree_processor_extensions")); + $alias(self, "treeprocessor", "tree_processor"); + $alias(self, "treeprocessors?", "tree_processors?"); + $alias(self, "treeprocessors", "tree_processors"); + + $def(self, '$postprocessor', function $$postprocessor($a) { + var block = $$postprocessor.$$p || nil, $post_args, args, self = this; + + $$postprocessor.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'add_document_processor', ["postprocessor", args], block.$to_proc()); + }, -1); + + $def(self, '$postprocessors?', function $Registry_postprocessors$ques$11() { + var self = this; + + return self.postprocessor_extensions['$!']()['$!']() + }); + + $def(self, '$postprocessors', $return_ivar("postprocessor_extensions")); + + $def(self, '$include_processor', function $$include_processor($a) { + var block = $$include_processor.$$p || nil, $post_args, args, self = this; + + $$include_processor.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'add_document_processor', ["include_processor", args], block.$to_proc()); + }, -1); + + $def(self, '$include_processors?', function $Registry_include_processors$ques$12() { + var self = this; + + return self.include_processor_extensions['$!']()['$!']() + }); + + $def(self, '$include_processors', $return_ivar("include_processor_extensions")); + + $def(self, '$docinfo_processor', function $$docinfo_processor($a) { + var block = $$docinfo_processor.$$p || nil, $post_args, args, self = this; + + $$docinfo_processor.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'add_document_processor', ["docinfo_processor", args], block.$to_proc()); + }, -1); + + $def(self, '$docinfo_processors?', function $Registry_docinfo_processors$ques$13(location) { + var self = this; + + + if (location == null) location = nil; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'any?', [], function $$14(ext){ + + if (ext == null) ext = nil; + return ext.$config()['$[]']("location")['$=='](location);}) + } else { + return true + } + } else { + return false + } }, -1); + + $def(self, '$docinfo_processors', function $$docinfo_processors(location) { + var self = this; + + + if (location == null) location = nil; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'select', [], function $$15(ext){ + + if (ext == null) ext = nil; + return ext.$config()['$[]']("location")['$=='](location);}) + } else { + return self.docinfo_processor_extensions + } + } else { + return nil + } }, -1); + + $def(self, '$block', function $$block($a) { + var block = $$block.$$p || nil, $post_args, args, self = this; + + $$block.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'add_syntax_processor', ["block", args], block.$to_proc()); + }, -1); + + $def(self, '$blocks?', function $Registry_blocks$ques$16() { + var self = this; + + return self.block_extensions['$!']()['$!']() + }); + + $def(self, '$registered_for_block?', function $Registry_registered_for_block$ques$17(name, context) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_extensions['$[]'](name.$to_sym())))) { + if ($truthy(ext.$config()['$[]']("contexts")['$include?'](context))) { + return ext + } else { + return false + } + } else { + return false + } + }); + + $def(self, '$find_block_extension', function $$find_block_extension(name) { + var self = this; + + return self.block_extensions['$[]'](name.$to_sym()) + }); + + $def(self, '$block_macro', function $$block_macro($a) { + var block = $$block_macro.$$p || nil, $post_args, args, self = this; + + $$block_macro.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'add_syntax_processor', ["block_macro", args], block.$to_proc()); + }, -1); + + $def(self, '$block_macros?', function $Registry_block_macros$ques$18() { + var self = this; + + return self.block_macro_extensions['$!']()['$!']() + }); + + $def(self, '$registered_for_block_macro?', function $Registry_registered_for_block_macro$ques$19(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }); + + $def(self, '$find_block_macro_extension', function $$find_block_macro_extension(name) { + var self = this; + + return self.block_macro_extensions['$[]'](name.$to_sym()) + }); + + $def(self, '$inline_macro', function $$inline_macro($a) { + var block = $$inline_macro.$$p || nil, $post_args, args, self = this; + + $$inline_macro.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + return $send(self, 'add_syntax_processor', ["inline_macro", args], block.$to_proc()); + }, -1); + + $def(self, '$inline_macros?', function $Registry_inline_macros$ques$20() { + var self = this; + + return self.inline_macro_extensions['$!']()['$!']() + }); + + $def(self, '$registered_for_inline_macro?', function $Registry_registered_for_inline_macro$ques$21(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.inline_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }); + + $def(self, '$find_inline_macro_extension', function $$find_inline_macro_extension(name) { + var self = this; + + return self.inline_macro_extensions['$[]'](name.$to_sym()) + }); + + $def(self, '$inline_macros', function $$inline_macros() { + var self = this; + + return self.inline_macro_extensions.$values() + }); + + $def(self, '$prefer', function $$prefer($a) { + var block = $$prefer.$$p || nil, $post_args, args, self = this, extension = nil, arg0 = nil, extensions_store = nil; + + $$prefer.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + extension = ($eqeqeq($$('ProcessorExtension'), (arg0 = args.$shift())) ? (arg0) : ($send(self, 'send', [arg0].concat($to_a(args)), block.$to_proc()))); + extensions_store = self.$instance_variable_get(((("@") + (extension.$kind())) + "_extensions").$to_sym()); + extensions_store.$unshift(extensions_store.$delete(extension)); + return extension; + }, -1); + self.$private(); + + $def(self, '$add_document_processor', function $$add_document_processor(kind, args) { + var block = $$add_document_processor.$$p || nil, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, $ret_or_1 = nil, config = nil, processor = nil, extension = nil, processor_class = nil, processor_instance = nil; + + $$add_document_processor.$$p = null; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], function $$22(it){ + + if (it == null) it = nil; + return it.$capitalize();}).$join().$to_sym(); + kind_class = $$('Extensions').$const_get(kind_class_symbol, false); + kind_java_class = ($truthy((($$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil)) ? ($$$($$$('AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol, false)) : (nil)); + kind_store = ($truthy(($ret_or_1 = self.$instance_variable_get(((("@") + (kind)) + "_extensions").$to_sym()))) ? ($ret_or_1) : (self.$instance_variable_set(((("@") + (kind)) + "_extensions").$to_sym(), []))); + if ((block !== nil)) { + + config = self.$resolve_args(args, 1); + (processor = kind_class.$new(config)).$singleton_class().$enable_dsl(); + if ($eqeq(block.$arity(), 0)) { + $send(processor, 'instance_exec', [], block.$to_proc()); + } else { + Opal.yield1(block, processor); + } if (!$truthy(processor['$process_block_given?']())) { + self.$raise($$$('NoMethodError'), "No block specified to process " + (kind_name) + " extension at " + (block.$source_location().$join(":"))); + } processor.$freeze(); + extension = $$('ProcessorExtension').$new(kind, processor); + } else { + + $c = self.$resolve_args(args, 2), $b = $to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])); + if ($truthy((processor_class = $$('Helpers').$resolve_class(processor)))) { + + if (!($truthy($rb_lt(processor_class, kind_class)) || (($truthy(kind_java_class) && ($truthy($rb_lt(processor_class, kind_java_class))))))) { + self.$raise($$$('ArgumentError'), "Invalid type for " + (kind_name) + " extension: " + (processor)); + } processor_instance = processor_class.$new(config); + processor_instance.$freeze(); + extension = $$('ProcessorExtension').$new(kind, processor_instance); + } else if (($eqeqeq(kind_class, processor) || (($truthy(kind_java_class) && ($eqeqeq(kind_java_class, processor)))))) { + + processor.$update_config(config); + processor.$freeze(); + extension = $$('ProcessorExtension').$new(kind, processor); + } else { + self.$raise($$$('ArgumentError'), "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)); + } } if ($eqeq(extension.$config()['$[]']("position"), ">>")) { + + kind_store.$unshift(extension); + } else { + + kind_store['$<<'](extension); + } return extension; + }); + + $def(self, '$add_syntax_processor', function $$add_syntax_processor(kind, args) { + var block = $$add_syntax_processor.$$p || nil, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, $ret_or_1 = nil, name = nil, config = nil, processor = nil, processor_class = nil, processor_instance = nil; + + $$add_syntax_processor.$$p = null; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], function $$23(it){ + + if (it == null) it = nil; + return it.$capitalize();})['$<<']("Processor").$join().$to_sym(); + kind_class = $$('Extensions').$const_get(kind_class_symbol, false); + kind_java_class = ($truthy((($$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil)) ? ($$$($$$('AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol, false)) : (nil)); + kind_store = ($truthy(($ret_or_1 = self.$instance_variable_get(((("@") + (kind)) + "_extensions").$to_sym()))) ? ($ret_or_1) : (self.$instance_variable_set(((("@") + (kind)) + "_extensions").$to_sym(), $hash2([], {})))); + if ((block !== nil)) { + + $c = self.$resolve_args(args, 2), $b = $to_ary($c), (name = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])); + (processor = kind_class.$new(self.$as_symbol(name), config)).$singleton_class().$enable_dsl(); + if ($eqeq(block.$arity(), 0)) { + $send(processor, 'instance_exec', [], block.$to_proc()); + } else { + Opal.yield1(block, processor); + } if (!$truthy((name = self.$as_symbol(processor.$name())))) { + self.$raise($$$('ArgumentError'), "No name specified for " + (kind_name) + " extension at " + (block.$source_location().$join(":"))); + } if (!$truthy(processor['$process_block_given?']())) { + self.$raise($$$('NoMethodError'), "No block specified to process " + (kind_name) + " extension at " + (block.$source_location().$join(":"))); + } processor.$freeze(); + return ($b = [name, $$('ProcessorExtension').$new(kind, processor)], $send(kind_store, '[]=', $b), $b[$b.length - 1]); + } else { + + $c = self.$resolve_args(args, 3), $b = $to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (name = ($b[1] == null ? nil : $b[1])), (config = ($b[2] == null ? nil : $b[2])); + if ($truthy((processor_class = $$('Helpers').$resolve_class(processor)))) { + + if (!($truthy($rb_lt(processor_class, kind_class)) || (($truthy(kind_java_class) && ($truthy($rb_lt(processor_class, kind_java_class))))))) { + self.$raise($$$('ArgumentError'), "Class specified for " + (kind_name) + " extension does not inherit from " + (kind_class) + ": " + (processor)); + } processor_instance = processor_class.$new(self.$as_symbol(name), config); + if (!$truthy((name = self.$as_symbol(processor_instance.$name())))) { + self.$raise($$$('ArgumentError'), "No name specified for " + (kind_name) + " extension: " + (processor)); + } processor_instance.$freeze(); + return ($b = [name, $$('ProcessorExtension').$new(kind, processor_instance)], $send(kind_store, '[]=', $b), $b[$b.length - 1]); + } else if (($eqeqeq(kind_class, processor) || (($truthy(kind_java_class) && ($eqeqeq(kind_java_class, processor)))))) { + + processor.$update_config(config); + if (!$truthy((name = ($truthy(name) ? (($b = [self.$as_symbol(name)], $send(processor, 'name=', $b), $b[$b.length - 1])) : (self.$as_symbol(processor.$name())))))) { + self.$raise($$$('ArgumentError'), "No name specified for " + (kind_name) + " extension: " + (processor)); + } processor.$freeze(); + return ($b = [name, $$('ProcessorExtension').$new(kind, processor)], $send(kind_store, '[]=', $b), $b[$b.length - 1]); + } else { + return self.$raise($$$('ArgumentError'), "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + } } }); + + $def(self, '$reset', function $$reset() { + var self = this; + + + self.preprocessor_extensions = (self.tree_processor_extensions = (self.postprocessor_extensions = (self.include_processor_extensions = (self.docinfo_processor_extensions = (self.block_extensions = (self.block_macro_extensions = (self.inline_macro_extensions = nil))))))); + return (self.document = nil); + }); + + $def(self, '$resolve_args', function $$resolve_args(args, expect) { + var opts = nil, missing = nil; + + + opts = ($eqeqeq($$$('Hash'), args['$[]'](-1)) ? (args.$pop()) : ($hash2([], {}))); + if ($eqeq(expect, 1)) { + return opts + } if ($truthy($rb_gt((missing = $rb_minus($rb_minus(expect, 1), args.$size())), 0))) { + args = $rb_plus(args, $$$('Array').$new(missing)); + } else if ($truthy($rb_lt(missing, 0))) { + args.$pop(missing['$-@']()); + } args['$<<'](opts); + return args; + }); + return $def(self, '$as_symbol', function $$as_symbol(name) { + + if ($truthy(name)) { + return name.$to_sym() + } else { + return nil + } + }); + })($nesting[0], null, $nesting); + return (function(self, $parent_nesting) { + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + + + $def(self, '$generate_name', function $$generate_name() { + var self = this; + + return "extgrp" + (self.$next_auto_id()) + }); + + $def(self, '$next_auto_id', function $$next_auto_id() { + var self = this, $ret_or_1 = nil; + if (self.auto_id == null) self.auto_id = nil; + + + self.auto_id = ($truthy(($ret_or_1 = self.auto_id)) ? ($ret_or_1) : (-1)); + return (self.auto_id = $rb_plus(self.auto_id, 1)); + }); + + $def(self, '$groups', function $$groups() { + var self = this, $ret_or_1 = nil; + if (self.groups == null) self.groups = nil; + + return (self.groups = ($truthy(($ret_or_1 = self.groups)) ? ($ret_or_1) : ($hash2([], {})))) + }); + + $def(self, '$create', function $$create(name) { + var block = $$create.$$p || nil, self = this, $ret_or_1 = nil; + + $$create.$$p = null; + if (name == null) name = nil; + if ((block !== nil)) { + return $$('Registry').$new($hash(($truthy(($ret_or_1 = name)) ? ($ret_or_1) : (self.$generate_name())), block)) + } else { + return $$('Registry').$new() + } }, -1); + + $def(self, '$register', function $$register($a) { + var block = $$register.$$p || nil, $post_args, args, $b, self = this, argc = nil, resolved_group = nil, group = nil, $ret_or_1 = nil, name = nil; + + $$register.$$p = null; + $post_args = $slice(arguments); + args = $post_args; + argc = args.$size(); + if ((block !== nil)) { + resolved_group = block; + } else if ($truthy((group = args.$pop()))) { + resolved_group = ($truthy(($ret_or_1 = $$('Helpers').$resolve_class(group))) ? ($ret_or_1) : (group)); + } else { + self.$raise($$$('ArgumentError'), "Extension group to register not specified"); + } name = ($truthy(($ret_or_1 = args.$pop())) ? ($ret_or_1) : (self.$generate_name())); + if (!$truthy(args['$empty?']())) { + self.$raise($$$('ArgumentError'), "Wrong number of arguments (" + (argc) + " for 1..2)"); + } return ($b = [name.$to_sym(), resolved_group], $send(self.$groups(), '[]=', $b), $b[$b.length - 1]); + }, -1); + + $def(self, '$unregister_all', function $$unregister_all() { + var self = this; + + + self.groups = $hash2([], {}); + return nil; + }); + return $def(self, '$unregister', function $$unregister($a) { + var $post_args, names, self = this; + + + $post_args = $slice(arguments); + names = $post_args; + $send(names, 'each_with_object', [self.$groups()], function $$24(group, catalog){ + + if (group == null) group = nil; + if (catalog == null) catalog = nil; + return catalog.$delete(group.$to_sym());}); + return nil; + }, -1); + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting) + })($nesting[0], $nesting); + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/stylesheet"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $def = Opal.def, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('rstrip,read,join'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super) { + var self = $klass($base, $super, 'Stylesheets'); + + var $proto = self.$$prototype; + + $proto.primary_stylesheet_data = nil; + return $def(self, '$primary_stylesheet_data', function $$primary_stylesheet_data() { + var self = this, $ret_or_1 = nil; + + return (self.primary_stylesheet_data = ($truthy(($ret_or_1 = self.primary_stylesheet_data)) ? ($ret_or_1) : ($$$('IO').$read($$$('File').$join("css", "asciidoctor.css")).$rstrip()))) + }) + })($nesting[0], null) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/document"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $def = Opal.def, $nesting = []; Opal.nil; + + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super) { + var self = $klass($base, $super, 'Document'); + + + return $def(self, '$fill_datetime_attributes', function $$fill_datetime_attributes(attrs, input_mtime) { + + + var $truthy = Opal.truthy; + var $falsy = Opal.falsy; + var nil = Opal.nil; + var utc_offset; + var source_date_epoch; + var localdate; + var localyear; + var localtime; + var localdatetime; + var docdate; + var doctime; + + var getYear = function (time, utc_offset) { + return utc_offset === 0 ? time.getUTCFullYear() : time.getFullYear() + }; + var getMonth = function (time, utc_offset) { + return utc_offset === 0 ? time.getUTCMonth() : time.getMonth() + }; + var getDay = function (time, utc_offset) { + return utc_offset === 0 ? time.getUTCDate() : time.getDate() + }; + var getHours = function (time, utc_offset) { + return utc_offset === 0 ? time.getUTCHours() : time.getHours() + }; + + var now = new Date(); + // See https://reproducible-builds.org/specs/source-date-epoch/ + if (Opal.const_get_qualified('::', 'ENV')['$key?']('SOURCE_DATE_EPOCH')) { + now.setTime(parseInt(Opal.const_get_qualified('::', 'ENV')['$[]']('SOURCE_DATE_EPOCH')) * 1000); + source_date_epoch = now; + utc_offset = 0; // utc + } else { + utc_offset = -now.getTimezoneOffset() / 60; // local date + } + // localdate and localyear + if ($truthy((localdate = attrs['$[]']('localdate')))) { + if ($falsy(localyear = attrs['$[]']('localyear'))) { + localyear = localdate.indexOf('-') === 4 ? localdate.substring(0, 4) : nil; + attrs['$[]=']('localyear', localyear); + } + } else { + var now_year = getYear(now, utc_offset).toString(); + var now_month = ('0' + (getMonth(now, utc_offset) + 1)).slice(-2); + var now_day = ('0' + getDay(now, utc_offset)).slice(-2); + localdate = now_year + '-' + now_month + '-' + now_day; + attrs['$[]=']('localdate', localdate); + localyear = now_year; + attrs['$[]=']('localyear', now_year); + } + // localtime + if ($falsy((localtime = attrs['$[]']('localtime')))) { + var hours = ('0' + (getHours(now, utc_offset))).slice(-2); + var minutes = ('0' + (now.getMinutes())).slice(-2); + var seconds = ('0' + (now.getSeconds())).slice(-2); + var utc_offset_format; + if (utc_offset === 0) { + utc_offset_format = 'UTC'; + } else if (utc_offset > 0) { + utc_offset_format = ('+0' + (utc_offset * 100)).slice(-5); + } else { + utc_offset_format = ('-0' + (-utc_offset * 100)).slice(-5); + } + localtime = hours + ':' + minutes + ':' + seconds + ' ' + utc_offset_format; + attrs['$[]=']('localtime', localtime); + } + // localdatetime + if ($falsy((localdatetime = attrs['$[]']('localdatetime')))) { + localdatetime = localdate + ' ' + localtime; + attrs['$[]=']('localdatetime', localdatetime); + } + + // docdate, doctime and docdatetime should default to localdate, localtime and localdatetime if not otherwise set + if ($truthy(source_date_epoch)) { + input_mtime = source_date_epoch; + } else if ($truthy(input_mtime)) { + utc_offset = -input_mtime.getTimezoneOffset() / 60; + } else { + input_mtime = now; + } + + // docdate and docyear + if ($truthy(docdate = attrs['$[]']('docdate'))) { + attrs['$[]=']('docyear', docdate.indexOf('-') === 4 ? docdate.substring(0, 4) : nil); + } else { + var mtime_year = getYear(input_mtime, utc_offset).toString(); + var mtime_month = ('0' + (getMonth(input_mtime, utc_offset) + 1)).slice(-2); + var mtime_day = ('0' + (getDay(input_mtime, utc_offset))).slice(-2); + docdate = mtime_year + '-' + mtime_month + '-' + mtime_day; + attrs['$[]=']('docdate', docdate); + if ($falsy(attrs['$[]']('docyear'))) { + attrs['$[]=']('docyear', mtime_year); + } + } + // doctime + if ($falsy(doctime = attrs['$[]']('doctime'))) { + var mtime_hours = ('0' + (getHours(input_mtime, utc_offset))).slice(-2); + var mtime_minutes = ('0' + (input_mtime.getMinutes())).slice(-2); + var mtime_seconds = ('0' + (input_mtime.getSeconds())).slice(-2); + var utc_offset_format; + if (utc_offset === 0) { + utc_offset_format = 'UTC'; + } else if (utc_offset > 0) { + utc_offset_format = ('+0' + (utc_offset * 100)).slice(-5); + } else { + utc_offset_format = ('-0' + (-utc_offset * 100)).slice(-5); + } + doctime = mtime_hours + ':' + mtime_minutes + ':' + mtime_seconds + ' ' + utc_offset_format; + attrs['$[]=']('doctime', doctime); + } + // docdatetime + if ($falsy(attrs['$[]']('docdatetime'))) { + attrs['$[]=']('docdatetime', docdate + ' ' + doctime); + } + return nil + + }) + })($nesting[0], $$('AbstractBlock')) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/substitutors"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $def = Opal.def, $nesting = []; Opal.nil; + + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base) { + var self = $module($base, 'Substitutors'); + + + return $def(self, '$sub_placeholder', function $$sub_placeholder(format_string, replacement) { + + return format_string.replace('%s', replacement); + }) + })($nesting[0]) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/parser"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $defs = Opal.defs, $nesting = []; Opal.nil; + + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $super) { + var self = $klass($base, $super, 'Parser'); + + + if ($truthy(String.prototype.repeat)) { + return $defs(self, '$uniform?', function $Parser_uniform$ques$1(str, chr, len) { + + return chr.repeat(len) === str; + }) + } else { + return $defs(self, '$uniform?', function $Parser_uniform$ques$2(str, chr, len) { + + return Array.apply(null, { length: len }).map(function () { return chr }).join('') === str; + }) + } + })($nesting[0], null) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext/syntax_highlighter"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $truthy = Opal.truthy, $def = Opal.def, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('key?,registry,[],include?,include,empty?,debug,logger,join,keys'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $parent_nesting) { + var self = $module($base, 'SyntaxHighlighter'); + + var $nesting = [self].concat($parent_nesting); + + return (function($base, $parent_nesting) { + var self = $module($base, 'Factory'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return $def(self, '$for', function $Factory_for$1(name) { + var self = this; + + if ($truthy(self.$registry()['$key?'](name))) { + return self.$registry()['$[]'](name) + } else { + + if (!$truthy(self['$include?']($$('Logging')))) { + self.$include($$('Logging')); + } if ($truthy(self.$registry()['$empty?']())) { + self.$logger().$debug("no syntax highlighter available, functionality disabled."); + } else { + self.$logger().$debug("syntax highlighter named '" + (name) + "' is not available, must be one of: '" + (self.$registry().$keys().$join("', '")) + "'."); + } return nil; + } + }) + })($nesting[0], $nesting) + })($nesting[0], $nesting) + })($nesting[0], $nesting) + }; + + Opal.modules["asciidoctor/js/asciidoctor_ext"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var self = Opal.top; Opal.nil; + + Opal.add_stubs('require'); + + self.$require("asciidoctor/js/asciidoctor_ext/stylesheet"); + self.$require("asciidoctor/js/asciidoctor_ext/document"); + self.$require("asciidoctor/js/asciidoctor_ext/substitutors"); + self.$require("asciidoctor/js/asciidoctor_ext/parser"); + self.$require("asciidoctor/js/asciidoctor_ext/syntax_highlighter"); + + // Load specific runtime + self.$require("asciidoctor/js/asciidoctor_ext/browser"); + }; + + Opal.modules["asciidoctor/js/opal_ext/logger"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var $klass = Opal.klass, $def = Opal.def, $truthy = Opal.truthy, $rb_lt = Opal.rb_lt, $nesting = [], nil = Opal.nil; + + Opal.add_stubs('chr,rjust,message_as_string,<,write,call,[]'); + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'Logger'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.level = $proto.progname = $proto.pipe = $proto.formatter = nil; + + (function($base, $super) { + var self = $klass($base, $super, 'Formatter'); + + + return $def(self, '$call', function $$call(severity, time, progname, msg) { + var self = this, time_format = nil; + + + time_format = time.getFullYear() + '-' + ('0'+(time.getMonth()+1)).slice(-2) + '-' + ('0'+time.getDate()).slice(-2) + 'T' + ('0'+time.getHours()).slice(-2) + ':' + ('0'+time.getMinutes()).slice(-2) + ':' + ('0'+time.getSeconds()).slice(-2) + '.' + ('00' + new Date().getMilliseconds() * 1000).slice(-6); + return "" + (severity.$chr()) + ", [" + (time_format) + "] " + (severity.$rjust(5)) + " -- " + (progname) + ": " + (self.$message_as_string(msg)); + }) + })($nesting[0], null); + return $def(self, '$add', function $$add(severity, message, progname) { + var block = $$add.$$p || nil, self = this, $ret_or_1 = nil; + + $$add.$$p = null; + if (message == null) message = nil; + if (progname == null) progname = nil; + if ($truthy($rb_lt((severity = ($truthy(($ret_or_1 = severity)) ? ($ret_or_1) : ($$('UNKNOWN')))), self.level))) { + return true + } progname = ($truthy(($ret_or_1 = progname)) ? ($ret_or_1) : (self.progname)); + if (!$truthy(message)) { + if ((block !== nil)) { + message = Opal.yieldX(block, []); + } else { + + message = progname; + progname = self.progname; + } + } self.pipe.$write(self.formatter.$call(($truthy(($ret_or_1 = $$('SEVERITY_LABELS')['$[]'](severity))) ? ($ret_or_1) : ("ANY")), new Date(), progname, message)); + return true; + }, -2); + })($nesting[0], null, $nesting) + }; + + Opal.modules["asciidoctor/js/postscript"] = function(Opal) {/* Generated by Opal 1.7.3 */ + var self = Opal.top; Opal.nil; + + Opal.add_stubs('require'); + + self.$require("asciidoctor/converter/composite"); + self.$require("asciidoctor/converter/html5"); + self.$require("asciidoctor/extensions"); + self.$require("asciidoctor/js/asciidoctor_ext"); + return self.$require("asciidoctor/js/opal_ext/logger"); + }; + + Opal.queue(function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $const_set = Opal.const_set, $send = Opal.send, $to_ary = Opal.to_ary, $defs = Opal.defs, $def = Opal.def, $truthy = Opal.truthy, $hash2 = Opal.hash2, $eqeq = Opal.eqeq, $rb_minus = Opal.rb_minus, $regexp = Opal.regexp, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('require,==,to_h,sort,map,constants,const_get,downcase,to_s,<=>,upcase,[],values,new,attr_reader,instance_variable_set,send,singleton_class,<<,define,dirname,absolute_path,join,home,pwd,to_set,tap,each,chr,each_key,[]=,slice,length,-,merge,default=,drop,insert'); + + self.$require("set"); + self.$require("asciidoctor/js"); + (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $ret_or_1 = nil; + + + $const_set($nesting[0], 'RUBY_ENGINE_OPAL', $const_set($nesting[0], 'RUBY_ENGINE', $$$('RUBY_ENGINE'))['$==']("opal")); + (function($base, $parent_nesting) { + var self = $module($base, 'SafeMode'); + + var $nesting = [self].concat($parent_nesting); + + + $const_set($nesting[0], 'UNSAFE', 0); + $const_set($nesting[0], 'SAFE', 1); + $const_set($nesting[0], 'SERVER', 10); + $const_set($nesting[0], 'SECURE', 20); + self.names_by_value = $send($send(self.$constants(false), 'map', [], function $SafeMode$1(sym){var self = $SafeMode$1.$$s == null ? this : $SafeMode$1.$$s; + + + if (sym == null) sym = nil; + return [self.$const_get(sym), sym.$to_s().$downcase()];}, {$$s: self}), 'sort', [], function $SafeMode$2($mlhs_tmp1, $mlhs_tmp2){var $a, $b, a = nil, b = nil; + + + if ($mlhs_tmp1 == null) $mlhs_tmp1 = nil; + if ($mlhs_tmp2 == null) $mlhs_tmp2 = nil; + $b = $mlhs_tmp1, $a = $to_ary($b), (a = ($a[0] == null ? nil : $a[0])); + $b = $mlhs_tmp2, $a = $to_ary($b), (b = ($a[0] == null ? nil : $a[0])); + return a['$<=>'](b);}, {$$has_top_level_mlhs_arg: true}).$to_h(); + $defs(self, '$value_for_name', function $$value_for_name(name) { + var self = this; + + return self.$const_get(name.$upcase(), false) + }); + $defs(self, '$name_for_value', function $$name_for_value(value) { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value['$[]'](value) + }); + return $defs(self, '$names', function $$names() { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value.$values() + }); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + var self = $module($base, 'Compliance'); + + + self.keys = $$$('Set').$new(); + (function(self, $parent_nesting) { + + + self.$attr_reader("keys"); + return $def(self, '$define', function $$define(key, value) { + var self = this; + if (self.keys == null) self.keys = nil; + + + self.$instance_variable_set("@" + (key), value); + self.$singleton_class().$send("attr_accessor", key); + self.keys['$<<'](key); + return nil; + }); + })(Opal.get_singleton_class(self)); + self.$define("block_terminates_paragraph", true); + self.$define("strict_verbatim_paragraphs", true); + self.$define("underline_style_section_titles", true); + self.$define("unwrap_standalone_preamble", true); + self.$define("attribute_missing", "skip"); + self.$define("attribute_undefined", "drop-line"); + self.$define("shorthand_property_syntax", true); + self.$define("natural_xrefs", true); + self.$define("unique_id_start_index", 2); + return self.$define("markdown_syntax", true); + })($nesting[0]); + if (!$truthy((($$('ROOT_DIR', 'skip_raise')) ? 'constant' : nil))) { + $const_set($nesting[0], 'ROOT_DIR', $$$('File').$dirname($$$('File').$absolute_path("."))); + } $const_set($nesting[0], 'LIB_DIR', $$$('File').$join($$('ROOT_DIR'), "lib")); + $const_set($nesting[0], 'DATA_DIR', $$$('File').$join($$('ROOT_DIR'), "data")); + $const_set($nesting[0], 'USER_HOME', (function() { try { + return $$$('Dir').$home() + } catch ($err) { + if (Opal.rescue($err, [$$('StandardError')])) { + try { + + if ($truthy(($ret_or_1 = $$$('ENV')['$[]']("HOME")))) { + return $ret_or_1 + } else { + return $$$('Dir').$pwd() + }; + } finally { Opal.pop_exception(); } + } else { throw $err; } + }})()); + $const_set($nesting[0], 'LF', "\n"); + $const_set($nesting[0], 'NULL', "\x00"); + $const_set($nesting[0], 'TAB', "\t"); + $const_set($nesting[0], 'MAX_INT', 9007199254740991); + $const_set($nesting[0], 'UTF_8', $$$($$$('Encoding'), 'UTF_8')); + $const_set($nesting[0], 'BOM_BYTES_UTF_8', [239, 187, 191]); + $const_set($nesting[0], 'BOM_BYTES_UTF_16LE', [255, 254]); + $const_set($nesting[0], 'BOM_BYTES_UTF_16BE', [254, 255]); + $const_set($nesting[0], 'FILE_READ_MODE', ($truthy($$('RUBY_ENGINE_OPAL')) ? ("r") : ("rb:utf-8:utf-8"))); + $const_set($nesting[0], 'URI_READ_MODE', $$('FILE_READ_MODE')); + $const_set($nesting[0], 'FILE_WRITE_MODE', ($truthy($$('RUBY_ENGINE_OPAL')) ? ("w") : ("w:utf-8"))); + $const_set($nesting[0], 'DEFAULT_DOCTYPE', "article"); + $const_set($nesting[0], 'DEFAULT_BACKEND', "html5"); + $const_set($nesting[0], 'DEFAULT_STYLESHEET_KEYS', ["", "DEFAULT"].$to_set()); + $const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + $const_set($nesting[0], 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook5"})); + $const_set($nesting[0], 'DEFAULT_PAGE_WIDTHS', $hash2(["docbook"], {"docbook": 425})); + $const_set($nesting[0], 'DEFAULT_EXTENSIONS', $hash2(["html", "docbook", "pdf", "epub", "manpage", "asciidoc"], {"html": ".html", "docbook": ".xml", "pdf": ".pdf", "epub": ".epub", "manpage": ".man", "asciidoc": ".adoc"})); + $const_set($nesting[0], 'ASCIIDOC_EXTENSIONS', $hash2([".adoc", ".asciidoc", ".asc", ".ad", ".txt"], {".adoc": true, ".asciidoc": true, ".asc": true, ".ad": true, ".txt": true})); + $const_set($nesting[0], 'SETEXT_SECTION_LEVELS', $hash2(["=", "-", "~", "^", "+"], {"=": 0, "-": 1, "~": 2, "^": 3, "+": 4})); + $const_set($nesting[0], 'ADMONITION_STYLES', ["NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION"].$to_set()); + $const_set($nesting[0], 'ADMONITION_STYLE_HEADS', $send($$$('Set').$new(), 'tap', [], function $Asciidoctor$3(accum){ + + if (accum == null) accum = nil; + return $send($$('ADMONITION_STYLES'), 'each', [], function $$4(s){ + + if (s == null) s = nil; + return accum['$<<'](s.$chr());});})); + $const_set($nesting[0], 'PARAGRAPH_STYLES', ["comment", "example", "literal", "listing", "normal", "open", "pass", "quote", "sidebar", "source", "verse", "abstract", "partintro"].$to_set()); + $const_set($nesting[0], 'VERBATIM_STYLES', ["literal", "listing", "source", "verse"].$to_set()); + $const_set($nesting[0], 'DELIMITED_BLOCKS', $hash2(["--", "----", "....", "====", "****", "____", "++++", "|===", ",===", ":===", "!===", "////", "```"], {"--": ["open", ["comment", "example", "literal", "listing", "pass", "quote", "sidebar", "source", "verse", "admonition", "abstract", "partintro"].$to_set()], "----": ["listing", ["literal", "source"].$to_set()], "....": ["literal", ["listing", "source"].$to_set()], "====": ["example", ["admonition"].$to_set()], "****": ["sidebar", $$$('Set').$new()], "____": ["quote", ["verse"].$to_set()], "++++": ["pass", ["stem", "latexmath", "asciimath"].$to_set()], "|===": ["table", $$$('Set').$new()], ",===": ["table", $$$('Set').$new()], ":===": ["table", $$$('Set').$new()], "!===": ["table", $$$('Set').$new()], "////": ["comment", $$$('Set').$new()], "```": ["fenced_code", $$$('Set').$new()]})); + $const_set($nesting[0], 'DELIMITED_BLOCK_HEADS', $send($hash2([], {}), 'tap', [], function $Asciidoctor$5(accum){ + + if (accum == null) accum = nil; + return $send($$('DELIMITED_BLOCKS'), 'each_key', [], function $$6(k){var $b; + + + if (k == null) k = nil; + return ($b = [k.$slice(0, 2), true], $send(accum, '[]=', $b), $b[$b.length - 1]);});})); + $const_set($nesting[0], 'DELIMITED_BLOCK_TAILS', $send($hash2([], {}), 'tap', [], function $Asciidoctor$7(accum){ + + if (accum == null) accum = nil; + return $send($$('DELIMITED_BLOCKS'), 'each_key', [], function $$8(k){var $b; + + + if (k == null) k = nil; + if ($eqeq(k.$length(), 4)) { + return ($b = [k, k['$[]']($rb_minus(k.$length(), 1))], $send(accum, '[]=', $b), $b[$b.length - 1]) + } else { + return nil + }});})); + $const_set($nesting[0], 'CAPTION_ATTRIBUTE_NAMES', $hash2(["example", "figure", "listing", "table"], {"example": "example-caption", "figure": "figure-caption", "listing": "listing-caption", "table": "table-caption"})); + $const_set($nesting[0], 'LAYOUT_BREAK_CHARS', $hash2(["'", "<"], {"'": "thematic_break", "<": "page_break"})); + $const_set($nesting[0], 'MARKDOWN_THEMATIC_BREAK_CHARS', $hash2(["-", "*", "_"], {"-": "thematic_break", "*": "thematic_break", "_": "thematic_break"})); + $const_set($nesting[0], 'HYBRID_LAYOUT_BREAK_CHARS', $$('LAYOUT_BREAK_CHARS').$merge($$('MARKDOWN_THEMATIC_BREAK_CHARS'))); + $const_set($nesting[0], 'NESTABLE_LIST_CONTEXTS', ["ulist", "olist", "dlist"]); + $const_set($nesting[0], 'ORDERED_LIST_STYLES', ["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"]); + $const_set($nesting[0], 'ORDERED_LIST_KEYWORDS', $hash2(["loweralpha", "lowerroman", "upperalpha", "upperroman"], {"loweralpha": "a", "lowerroman": "i", "upperalpha": "A", "upperroman": "I"})); + $const_set($nesting[0], 'ATTR_REF_HEAD', "{"); + $const_set($nesting[0], 'LIST_CONTINUATION', "+"); + $const_set($nesting[0], 'HARD_LINE_BREAK', " +"); + $const_set($nesting[0], 'LINE_CONTINUATION', " \\"); + $const_set($nesting[0], 'LINE_CONTINUATION_LEGACY', " +"); + $const_set($nesting[0], 'BLOCK_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\[", "\\]"]})); + $const_set($nesting[0], 'INLINE_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]})); + $const_set($nesting[0], 'STEM_TYPE_ALIASES', $hash2(["latexmath", "latex", "tex"], {"latexmath": "latexmath", "latex": "latexmath", "tex": "latexmath"}))['$default=']("asciimath"); + $const_set($nesting[0], 'FONT_AWESOME_VERSION', "4.7.0"); + $const_set($nesting[0], 'HIGHLIGHT_JS_VERSION', "9.18.3"); + $const_set($nesting[0], 'MATHJAX_VERSION', "2.7.9"); + $const_set($nesting[0], 'DEFAULT_ATTRIBUTES', $hash2(["appendix-caption", "appendix-refsig", "caution-caption", "chapter-refsig", "example-caption", "figure-caption", "important-caption", "last-update-label", "note-caption", "part-refsig", "prewrap", "sectids", "section-refsig", "table-caption", "tip-caption", "toc-placement", "toc-title", "untitled-label", "version-label", "warning-caption"], {"appendix-caption": "Appendix", "appendix-refsig": "Appendix", "caution-caption": "Caution", "chapter-refsig": "Chapter", "example-caption": "Example", "figure-caption": "Figure", "important-caption": "Important", "last-update-label": "Last updated", "note-caption": "Note", "part-refsig": "Part", "prewrap": "", "sectids": "", "section-refsig": "Section", "table-caption": "Table", "tip-caption": "Tip", "toc-placement": "auto", "toc-title": "Table of Contents", "untitled-label": "Untitled", "version-label": "Version", "warning-caption": "Warning"})); + $const_set($nesting[0], 'FLEXIBLE_ATTRIBUTES', ["sectnums"]); + $const_set($nesting[0], 'INTRINSIC_ATTRIBUTES', $hash2(["startsb", "endsb", "vbar", "caret", "asterisk", "tilde", "plus", "backslash", "backtick", "blank", "empty", "sp", "two-colons", "two-semicolons", "nbsp", "deg", "zwsp", "quot", "apos", "lsquo", "rsquo", "ldquo", "rdquo", "wj", "brvbar", "pp", "cpp", "amp", "lt", "gt"], {"startsb": "[", "endsb": "]", "vbar": "|", "caret": "^", "asterisk": "*", "tilde": "~", "plus": "+", "backslash": "\\", "backtick": "`", "blank": "", "empty": "", "sp": " ", "two-colons": "::", "two-semicolons": ";;", "nbsp": " ", "deg": "°", "zwsp": "​", "quot": """, "apos": "'", "lsquo": "‘", "rsquo": "’", "ldquo": "“", "rdquo": "”", "wj": "⁠", "brvbar": "¦", "pp": "++", "cpp": "C++", "amp": "&", "lt": "<", "gt": ">"})); + $const_set($nesting[0], 'QUOTE_SUBS', $send($hash2([], {}), 'tap', [], function $Asciidoctor$9(accum){var normal = nil, compat = nil; + + + if (accum == null) accum = nil; + accum['$[]='](false, (normal = [["strong", "unconstrained", $regexp(["\\\\?(?:\\[([^\\]]+)\\])?\\*\\*(", $$('CC_ALL'), "+?)\\*\\*"], 'm')], ["strong", "constrained", $regexp(["(^|[^", $$('CC_WORD'), ";:}])(?:\\[([^\\]]+)\\])?\\*(\\S|\\S", $$('CC_ALL'), "*?\\S)\\*(?!", $$('CG_WORD'), ")"], 'm')], ["double", "constrained", $regexp(["(^|[^", $$('CC_WORD'), ";:}])(?:\\[([^\\]]+)\\])?\"`(\\S|\\S", $$('CC_ALL'), "*?\\S)`\"(?!", $$('CG_WORD'), ")"], 'm')], ["single", "constrained", $regexp(["(^|[^", $$('CC_WORD'), ";:`}])(?:\\[([^\\]]+)\\])?'`(\\S|\\S", $$('CC_ALL'), "*?\\S)`'(?!", $$('CG_WORD'), ")"], 'm')], ["monospaced", "unconstrained", $regexp(["\\\\?(?:\\[([^\\]]+)\\])?``(", $$('CC_ALL'), "+?)``"], 'm')], ["monospaced", "constrained", $regexp(["(^|[^", $$('CC_WORD'), ";:\"'`}])(?:\\[([^\\]]+)\\])?`(\\S|\\S", $$('CC_ALL'), "*?\\S)`(?![", $$('CC_WORD'), "\"'`])"], 'm')], ["emphasis", "unconstrained", $regexp(["\\\\?(?:\\[([^\\]]+)\\])?__(", $$('CC_ALL'), "+?)__"], 'm')], ["emphasis", "constrained", $regexp(["(^|[^", $$('CC_WORD'), ";:}])(?:\\[([^\\]]+)\\])?_(\\S|\\S", $$('CC_ALL'), "*?\\S)_(?!", $$('CG_WORD'), ")"], 'm')], ["mark", "unconstrained", $regexp(["\\\\?(?:\\[([^\\]]+)\\])?##(", $$('CC_ALL'), "+?)##"], 'm')], ["mark", "constrained", $regexp(["(^|[^", $$('CC_WORD'), "&;:}])(?:\\[([^\\]]+)\\])?#(\\S|\\S", $$('CC_ALL'), "*?\\S)#(?!", $$('CG_WORD'), ")"], 'm')], ["superscript", "unconstrained", /\\?(?:\[([^\]]+)\])?\^(\S+?)\^/], ["subscript", "unconstrained", /\\?(?:\[([^\]]+)\])?~(\S+?)~/]])); + accum['$[]='](true, (compat = normal.$drop(0))); + compat['$[]='](2, ["double", "constrained", $regexp(["(^|[^", $$('CC_WORD'), ";:}])(?:\\[([^\\]]+)\\])?``(\\S|\\S", $$('CC_ALL'), "*?\\S)''(?!", $$('CG_WORD'), ")"], 'm')]); + compat['$[]='](3, ["single", "constrained", $regexp(["(^|[^", $$('CC_WORD'), ";:}])(?:\\[([^\\]]+)\\])?`(\\S|\\S", $$('CC_ALL'), "*?\\S)'(?!", $$('CG_WORD'), ")"], 'm')]); + compat['$[]='](4, ["monospaced", "unconstrained", $regexp(["\\\\?(?:\\[([^\\]]+)\\])?\\+\\+(", $$('CC_ALL'), "+?)\\+\\+"], 'm')]); + compat['$[]='](5, ["monospaced", "constrained", $regexp(["(^|[^", $$('CC_WORD'), ";:}])(?:\\[([^\\]]+)\\])?\\+(\\S|\\S", $$('CC_ALL'), "*?\\S)\\+(?!", $$('CG_WORD'), ")"], 'm')]); + return compat.$insert(3, ["emphasis", "constrained", $regexp(["(^|[^", $$('CC_WORD'), ";:}])(?:\\[([^\\]]+)\\])?'(\\S|\\S", $$('CC_ALL'), "*?\\S)'(?!", $$('CG_WORD'), ")"], 'm')]);})); + $const_set($nesting[0], 'REPLACEMENTS', [[/\\?\(C\)/, "©", "none"], [/\\?\(R\)/, "®", "none"], [/\\?\(TM\)/, "™", "none"], [/(?: |\n|^|\\)--(?: |\n|$)/, " — ", "none"], [$regexp(["(", $$('CG_WORD'), ")\\\\?--(?=", $$('CG_WORD'), ")"]), "—​", "leading"], [/\\?\.\.\./, "…​", "none"], [/\\?`'/, "’", "none"], [$regexp(["(", $$('CG_ALNUM'), ")\\\\?'(?=", $$('CG_ALPHA'), ")"]), "’", "leading"], [/\\?->/, "→", "none"], [/\\?=>/, "⇒", "none"], [/\\?<-/, "←", "none"], [/\\?<=/, "⇐", "none"], [/\\?(&)amp;((?:[a-zA-Z][a-zA-Z]+\d{0,2}|#\d\d\d{0,4}|#x[\da-fA-F][\da-fA-F][\da-fA-F]{0,3});)/, "", "bounding"]]); + return nil; + })($nesting[0], $nesting); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/core_ext"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/helpers"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/logging"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/rx"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/substitutors"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/version"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/abstract_node"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/abstract_block"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/attribute_list"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/block"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/callouts"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/converter"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/document"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/inline"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/list"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/parser"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/path_resolver"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/reader"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/section"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/stylesheets"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/table"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/writer"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/load"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/convert"); + + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/syntax_highlighter"); + self.$require("asciidoctor.rb"+ '/../' + "asciidoctor/timings"); + return self.$require("asciidoctor/js/postscript");}); + + + /* global Opal */ + + /** + * Convert a JSON to an (Opal) Hash. + * @private + */ + const toHash = function (object) { + return object && !object.$$is_hash ? Opal.hash2(Object.keys(object), object) : object + }; + + /** + * Convert an (Opal) Hash to JSON. + * @private + */ + const fromHash = function (hash) { + const object = {}; + if (hash) { + const stringMap = hash.$$smap; + for (const key in stringMap) { + const value = stringMap[key]; + object[key] = value === Opal.nil ? undefined : value; + } + const numericMap = hash.$$map; + if (numericMap) { + const positional = []; + for (const key in numericMap) { + const entry = numericMap[key]; + const value = entry.value; + const index = entry.key - 1; + positional[index] = value === Opal.nil ? undefined : value; + } + if (positional.length > 0) { + object.$positional = positional; + } + } + } + return object + }; + + const fromHashKeys = function (hash) { + const object = {}; + if (hash) { + const data = hash.$$keys; + for (const key in data) { + const value = data[key].value; + object[key.toString()] = value === Opal.nil ? undefined : value; + } + } + return object + }; + + /** + * @private + */ + const prepareOptions = function (options) { + options = toHash(options); + if (options) { + const converter = options['$[]']('converter'); + if (converter && converter !== Opal.nil) { + options['$[]=']('converter', bridgeConverter(converter)); + } + const attrs = options['$[]']('attributes'); + if (attrs && typeof attrs === 'object' && attrs.constructor.name === 'Object') { + options = options.$dup(); + options['$[]=']('attributes', toHash(attrs)); + } + } + return options + }; + + const bridgeConverter = function (converter) { + const buildBackendTraitsFromObject = function (obj) { + return Object.assign({}, + obj.basebackend ? { basebackend: obj.basebackend } : {}, + obj.outfilesuffix ? { outfilesuffix: obj.outfilesuffix } : {}, + obj.filetype ? { filetype: obj.filetype } : {}, + obj.htmlsyntax ? { htmlsyntax: obj.htmlsyntax } : {}, + obj.supports_templates ? { supports_templates: obj.supports_templates } : {} + ) + }; + const assignBackendTraitsToInstance = function (obj, instance) { + if (obj.backend_traits) { + instance.backend_traits = toHash(obj.backend_traits); + } else if (obj.backendTraits) { + instance.backend_traits = toHash(obj.backendTraits); + } else if (obj.basebackend || obj.outfilesuffix || obj.filetype || obj.htmlsyntax || obj.supports_templates) { + instance.backend_traits = toHash(buildBackendTraitsFromObject(obj)); + } + }; + const bridgeHandlesMethodToInstance = function (obj, instance) { + bridgeMethodToInstance(obj, instance, '$handles?', 'handles', function () { + return true + }); + }; + const bridgeComposedMethodToInstance = function (obj, instance) { + bridgeMethodToInstance(obj, instance, '$composed', 'composed'); + }; + const bridgeEqEqMethodToInstance = function (obj, instance) { + bridgeMethodToInstance(obj, instance, '$==', '==', function (other) { + return instance === other + }); + }; + const bridgeSendMethodToInstance = function (obj, instance) { + bridgeMethodToInstance(obj, instance, '$send', 'send', function (symbol) { + const [, ...args] = Array.from(arguments); + const func = instance['$' + symbol]; + if (func) { + return func.apply(instance, args) + } + throw new Error(`undefined method \`${symbol}\` for \`${instance.toString()}\``) + }); + }; + const bridgeMethodToInstance = function (obj, instance, methodName, functionName, defaultImplementation) { + if (typeof obj[methodName] === 'undefined') { + if (typeof obj[functionName] === 'function') { + instance[methodName] = obj[functionName]; + } else if (defaultImplementation) { + instance[methodName] = defaultImplementation; + } + } + }; + const addRespondToMethod = function (instance) { + if (typeof instance['$respond_to?'] !== 'function') { + instance['$respond_to?'] = function (name) { + return typeof this[name] === 'function' + }; + } + }; + if (typeof converter === 'function') { + // Class + const object = initializeClass(ConverterBase, converter.constructor.name, { + initialize: function (backend, opts) { + const self = this; + const result = new converter(backend, opts); // eslint-disable-line + Object.assign(this, result); + assignBackendTraitsToInstance(result, self); + const propertyNames = Object.getOwnPropertyNames(converter.prototype); + for (let i = 0; i < propertyNames.length; i++) { + const propertyName = propertyNames[i]; + if (propertyName !== 'constructor') { + self[propertyName] = result[propertyName]; + } + } + if (typeof result.$convert === 'undefined' && typeof result.convert === 'function') { + self.$convert = result.convert; + } + bridgeHandlesMethodToInstance(result, self); + bridgeComposedMethodToInstance(result, self); + addRespondToMethod(self); + self.super(backend, opts); + } + }); + object.$extend(ConverterBackendTraits); + return object + } + if (typeof converter === 'object') { + // Instance + if (typeof converter.$convert === 'undefined' && typeof converter.convert === 'function') { + converter.$convert = converter.convert; + } + assignBackendTraitsToInstance(converter, converter); + if (converter.backend_traits) { + // "extends" ConverterBackendTraits + const converterBackendTraitsFunctionNames = [ + 'basebackend', + 'filetype', + 'htmlsyntax', + 'outfilesuffix', + 'supports_templates', + 'supports_templates?', + 'init_backend_traits', + 'backend_traits' + ]; + for (const functionName of converterBackendTraitsFunctionNames) { + converter['$' + functionName] = ConverterBackendTraits.prototype['$' + functionName]; + } + converter.$$meta = ConverterBackendTraits; + } + bridgeHandlesMethodToInstance(converter, converter); + bridgeComposedMethodToInstance(converter, converter); + bridgeEqEqMethodToInstance(converter, converter); + bridgeSendMethodToInstance(converter, converter); + addRespondToMethod(converter); + return converter + } + return converter + }; + + function initializeClass (superClass, className, functions, defaultFunctions, argProxyFunctions) { + const scope = Opal.klass(Opal.Object, superClass, className, function () { }); + let postConstructFunction; + let initializeFunction; + let constructorFunction; + const defaultFunctionsOverridden = {}; + for (const functionName in functions) { + if (Object.prototype.hasOwnProperty.call(functions, functionName)) { + (function (functionName) { + const userFunction = functions[functionName]; + if (functionName === 'postConstruct') { + postConstructFunction = userFunction; + } else if (functionName === 'initialize') { + initializeFunction = userFunction; + } else if (functionName === 'constructor') { + constructorFunction = userFunction; + } else { + if (defaultFunctions && Object.prototype.hasOwnProperty.call(defaultFunctions, functionName)) { + defaultFunctionsOverridden[functionName] = true; + } + let $function; + Opal.def(scope, '$' + functionName, ($function = function () { + let args; + if (argProxyFunctions && Object.prototype.hasOwnProperty.call(argProxyFunctions, functionName)) { + args = argProxyFunctions[functionName](arguments); + } else { + args = arguments; + } + // append Ruby block as the final argument + const $block = $function.$$p; + if ($block) { + args[args.length] = function () { return Opal.yield1($block) }; + args.length += 1; + $function.$$p = null; + } + return userFunction.apply(this, args) + })); + } + }(functionName)); + } + } + let initialize; + if (typeof constructorFunction === 'function') { + initialize = function () { + const args = Array.from(arguments); + for (let i = 0; i < args.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof args[i] === 'object' && '$$smap' in args[i]) { + args[i] = fromHash(args[i]); + } + } + args.unshift(null); + const result = new (Function.prototype.bind.apply(constructorFunction, args)); // eslint-disable-line + Object.assign(this, result); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } else if (typeof initializeFunction === 'function') { + initialize = function () { + const args = Array.from(arguments); + for (let i = 0; i < args.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof args[i] === 'object' && '$$smap' in args[i]) { + args[i] = fromHash(args[i]); + } + } + initializeFunction.apply(this, args); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } else { + initialize = function () { + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize)); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } + Opal.def(scope, '$initialize', initialize); + let $superFunction; + Opal.def(scope, 'super', ($superFunction = function (func) { + if (typeof func === 'function') { + Opal.send(this, Opal.find_super_dispatcher(this, func.name, func)); + } else { + // Bind the initialize function to super(); + const argumentsList = Array.from(arguments); + for (let i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object') { + argumentsList[i] = toHash(argumentsList[i]); + } + } + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize), argumentsList); + } + })); + for (const functionName in functions) { + $superFunction[functionName] = function () { + const argumentsList = Array.from(arguments); + for (let i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object' && typeof argumentsList[i].constructor === 'function' && argumentsList[i].constructor.name === 'Object') { + argumentsList[i] = toHash(argumentsList[i]); + } + } + const self = scope.$$prototype; + return Opal.send(self, Opal.find_super_dispatcher(self, functionName, self[`$${functionName}`]), argumentsList) + }; + } + if (defaultFunctions) { + for (const defaultFunctionName in defaultFunctions) { + if (Object.prototype.hasOwnProperty.call(defaultFunctions, defaultFunctionName) && !Object.prototype.hasOwnProperty.call(defaultFunctionsOverridden, defaultFunctionName)) { + (function (defaultFunctionName) { + const defaultFunction = defaultFunctions[defaultFunctionName]; + Opal.def(scope, '$' + defaultFunctionName, function () { + return defaultFunction.apply(this, arguments) + }); + }(defaultFunctionName)); + } + } + } + return scope + } + + // Asciidoctor API + + /** + * @namespace + * @description + * The main application interface (API) for Asciidoctor. + * This API provides methods to parse AsciiDoc content and convert it to various output formats using built-in or third-party converters. + * + * An AsciiDoc document can be as simple as a single line of content, + * though it more commonly starts with a document header that declares the document title and document attribute definitions. + * The document header is then followed by zero or more section titles, optionally nested, to organize the paragraphs, blocks, lists, etc. of the document. + * + * By default, the processor converts the AsciiDoc document to HTML 5 using a built-in converter. + * However, this behavior can be changed by specifying a different backend (e.g., +docbook+). + * A backend is a keyword for an output format (e.g., DocBook). + * That keyword, in turn, is used to select a converter, which carries out the request to convert the document to that format. + * + * @example + * asciidoctor.convertFile('document.adoc', { 'safe': 'safe' }) // Convert an AsciiDoc file + * + * asciidoctor.convert("I'm using *Asciidoctor* version {asciidoctor-version}.", { 'safe': 'safe' }) // Convert an AsciiDoc string + * + * const doc = asciidoctor.loadFile('document.adoc', { 'safe': 'safe' }) // Parse an AsciiDoc file into a document object + * + * const doc = asciidoctor.load("= Document Title\n\nfirst paragraph\n\nsecond paragraph", { 'safe': 'safe' }) // Parse an AsciiDoc string into a document object + */ + const Asciidoctor = Opal.Asciidoctor.$$class; + + /** + * Get Asciidoctor core version number. + * + * @returns {string} - the version number of Asciidoctor core. + * @memberof Asciidoctor + */ + Asciidoctor.prototype.getCoreVersion = function () { + return this.$$const.VERSION + }; + + /** + * Get Asciidoctor.js runtime environment information. + * + * @returns {Object} - the runtime environment including the ioModule, the platform, the engine and the framework. + * @memberof Asciidoctor + */ + Asciidoctor.prototype.getRuntime = function () { + return { + ioModule: Opal.const_get_qualified('::', 'JAVASCRIPT_IO_MODULE'), + platform: Opal.const_get_qualified('::', 'JAVASCRIPT_PLATFORM'), + engine: Opal.const_get_qualified('::', 'JAVASCRIPT_ENGINE'), + framework: Opal.const_get_qualified('::', 'JAVASCRIPT_FRAMEWORK') + } + }; + + /** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @example + * const input = `= Hello, AsciiDoc! + * Guillaume Grossetie + * + * An introduction to http://asciidoc.org[AsciiDoc]. + * + * == First Section + * + * * item 1 + * * item 2` + * + * const html = asciidoctor.convert(input) + * @memberof Asciidoctor + */ + Asciidoctor.prototype.convert = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + const toFile = options && options.to_file; + if (typeof toFile === 'object' && toFile.constructor.name === 'Writable' && typeof toFile.write === 'function') { + toFile['$respond_to?'] = (name) => name === 'write'; + toFile.$object_id = () => ''; + toFile.$write = function (data) { + this.write(data); + }; + } + const opts = prepareOptions(options); + const result = this.$convert(input, opts); + if (typeof toFile === 'object' && toFile.constructor.name === 'Writable' && typeof toFile.end === 'function') { + toFile.end(); + } + return result === Opal.nil ? '' : result + }; + + /** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @example + * const html = asciidoctor.convertFile('./document.adoc') + * @memberof Asciidoctor + */ + Asciidoctor.prototype.convertFile = function (filename, options) { + return this.$convert_file(filename, prepareOptions(options)) + }; + + /** + * Parse the AsciiDoc source input into an {@link Document} + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - the {@link Document} object + * @memberof Asciidoctor + */ + Asciidoctor.prototype.load = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + return this.$load(input, prepareOptions(options)) + }; + + /** + * Parse the contents of the AsciiDoc source file into an {@link Document} + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - the {@link Document} object + * @memberof Asciidoctor + */ + Asciidoctor.prototype.loadFile = function (filename, options) { + return this.$load_file(filename, prepareOptions(options)) + }; + + // AbstractBlock API + + /** + * @namespace + * @extends AbstractNode + */ + const AbstractBlock = Opal.Asciidoctor.AbstractBlock; + + /** + * Describes the type of content this block accepts and how it should be converted. + * @returns {string} - the type of content this block accepts. + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getContentModel = function () { + const contentModel = this.content_model; + return contentModel === Opal.nil ? undefined : contentModel + }; + + /** + * Set the type of content this block accepts. Acceptable values are: + * - compound - this block contains other blocks + * - simple - this block holds a paragraph of prose that receives normal substitutions + * - verbatim - this block holds verbatim text (displayed "as is") that receives verbatim substitutions + * - raw - this block holds unprocessed content passed directly to the output with no substitutions applied + * - empty - this block has no content + * @param {string} contentModel - type of content, one of: compound, simple, verbatim, raw or empty. + * @memberof AbstractBlock + */ + AbstractBlock.prototype.setContentModel = function (contentModel) { + this.content_model = contentModel; + }; + + /** + * Append a block to this block's list of child blocks. + * @param {AbstractBlock} block - the block to append + * @returns {AbstractBlock} - the parent block to which this block was appended. + * @memberof AbstractBlock + */ + AbstractBlock.prototype.append = function (block) { + this.$append(block); + return this + }; + + /** + * Get the String title of this Block with title substitutions applied + * + * The following substitutions are applied to block and section titles: + * + * specialcharacters, quotes, replacements, macros, attributes and post_replacements + * + * @returns {string} - the converted String title for this Block, or undefined if the title is not set. + * @example + * block.title // "Foo 3^ # {two-colons} Bar(1)" + * block.getTitle(); // "Foo 3^ # :: Bar(1)" + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getTitle = function () { + const title = this.$title(); + return title === Opal.nil ? undefined : title + }; + + /** + * Set the String block title. + * + * @param {string} title - The block title + * @returns {string} - the new String title assigned to this Block. + * @memberof AbstractBlock + */ + AbstractBlock.prototype.setTitle = function (title) { + title = typeof title === 'undefined' ? Opal.nil : title; + return this['$title='](title) + }; + + /** + * Generate and assign caption to block if not already assigned. + * + * If the block has a title and a caption prefix is available for this block, + * then build a caption from this information, assign it a number and store it + * to the caption attribute on the block. + * + * If a caption has already been assigned to this block, do nothing. + * + * The parts of a complete caption are: ` . ` + * This partial caption represents the part the precedes the title. + * + * @param {string} value - the String caption to assign to this block or nil to use document attribute. + * @param {string} captionContext - the String context to use when resolving caption-related attributes. + * If not provided, the name of the context for this block is used. Only certain contexts allow the caption to be looked up. + * + * @memberof AbstractBlock + */ + AbstractBlock.prototype.assignCaption = function (value, captionContext) { + value = typeof value === 'undefined' ? Opal.nil : value; + captionContext = typeof captionContext === 'undefined' ? null : captionContext; + this.$assign_caption(value, captionContext); + }; + + /** + * Convenience method that returns the interpreted title of the Block + * with the caption prepended. + * Concatenates the value of this Block's caption instance variable and the + * return value of this Block's title method. No space is added between the + * two values. If the Block does not have a caption, the interpreted title is + * returned. + * + * @returns {string} - the converted String title prefixed with the caption, or just the converted String title if no caption is set + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getCaptionedTitle = function () { + return this.$captioned_title() + }; + + /** + * Get the style (block type qualifier) for this block. + * + * @returns {string} - the style for this block + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getStyle = function () { + const style = this.style; + return style === Opal.nil ? undefined : style + }; + + /** + * Set the style for this block. + * + * @param {string} style - Style + * @memberof AbstractBlock + */ + AbstractBlock.prototype.setStyle = function (style) { + this.style = style; + }; + + /** + * Get the location in the AsciiDoc source where this block begins. + * + * @returns {Cursor} - the location in the AsciiDoc source where this block begins + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getSourceLocation = function () { + const sourceLocation = this.source_location; + if (sourceLocation === Opal.nil) { + return undefined + } + sourceLocation.getFile = function () { + const file = this.file; + return file === Opal.nil ? undefined : file + }; + sourceLocation.getDirectory = function () { + const dir = this.dir; + return dir === Opal.nil ? undefined : dir + }; + sourceLocation.getPath = function () { + const path = this.path; + return path === Opal.nil ? undefined : path + }; + sourceLocation.getLineNumber = function () { + const lineno = this.lineno; + return lineno === Opal.nil ? undefined : lineno + }; + return sourceLocation + }; + + /** + * Get the caption for this block. + * + * @returns {string} - the caption for this block + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getCaption = function () { + const caption = this.$caption(); + return caption === Opal.nil ? undefined : caption + }; + + /** + * Set the caption for this block. + * + * @param {string} caption - Caption + * @memberof AbstractBlock + */ + AbstractBlock.prototype.setCaption = function (caption) { + this.caption = typeof caption === 'undefined' ? Opal.nil : caption; + }; + + /** + * Get the level of this section or the section level in which this block resides. + * + * @returns {number} - the level (Integer) of this section + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getLevel = function () { + const level = this.level; + return level === Opal.nil ? undefined : level + }; + + /** + * Get the substitution keywords to be applied to the contents of this block. + * + * @returns {Array<string>} - the list of {string} substitution keywords associated with this block. + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getSubstitutions = function () { + return this.subs + }; + + /** + * Check whether a given substitution keyword is present in the substitutions for this block. + * + * @returns {boolean} - whether the substitution is present on this block. + * @memberof AbstractBlock + */ + AbstractBlock.prototype.hasSubstitution = function (substitution) { + return this['$sub?'](substitution) + }; + + /** + * Remove the specified substitution keyword from the list of substitutions for this block. + * + * @memberof AbstractBlock + */ + AbstractBlock.prototype.removeSubstitution = function (substitution) { + this.$remove_sub(substitution); + }; + + /** + * Checks if the {@link AbstractBlock} contains any child blocks. + * + * @returns {boolean} - whether the {@link AbstractBlock} has child blocks. + * @memberof AbstractBlock + */ + AbstractBlock.prototype.hasBlocks = function () { + return this.blocks.length > 0 + }; + + /** + * Get the list of {@link AbstractBlock} sub-blocks for this block. + * + * @returns {Array<AbstractBlock>} - a list of {@link AbstractBlock} sub-blocks + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getBlocks = function () { + return this.blocks + }; + + /** + * Get the converted result of the child blocks by converting the children appropriate to content model that this block supports. + * + * @returns {string} - the converted result of the child blocks + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getContent = function () { + const content = this.$content(); + return content === Opal.nil ? undefined : content + }; + + /** + * Get the converted content for this block. + * If the block has child blocks, the content method should cause them to be converted + * and returned as content that can be included in the parent block's template. + * + * @returns {string} - the converted String content for this block + * @memberof AbstractBlock + */ + AbstractBlock.prototype.convert = function () { + return this.$convert() + }; + + /** + * Query for all descendant block-level nodes in the document tree + * that match the specified selector (context, style, id, and/or role). + * If a function block is given, it's used as an additional filter. + * If no selector or function block is supplied, all block-level nodes in the tree are returned. + * @param {Object} [selector] + * @param {function} [block] + * @example + * doc.findBy({'context': 'section'}); + * // => { level: 0, title: "Hello, AsciiDoc!", blocks: 0 } + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'section'}, function (section) { return section.getLevel() === 1; }); + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'listing', 'style': 'source'}); + * // => { context: :listing, content_model: :verbatim, style: "source", lines: 1 } + * + * @returns {Array<AbstractBlock>} - a list of block-level nodes that match the filter or an empty list if no matches are found + * @memberof AbstractBlock + */ + AbstractBlock.prototype.findBy = function (selector, block) { + if (typeof block === 'undefined' && typeof selector === 'function') { + return Opal.send(this, 'find_by', null, selector) + } else if (typeof block === 'function') { + return Opal.send(this, 'find_by', [toHash(selector)], block) + } else { + return this.$find_by(toHash(selector)) + } + }; + + /** + * Get the source line number where this block started. + * @returns {number} - the source line number where this block started + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getLineNumber = function () { + const lineno = this.$lineno(); + return lineno === Opal.nil ? undefined : lineno + }; + + /** + * Check whether this block has any child Section objects. + * Only applies to Document and Section instances. + * @returns {boolean} - true if this block has child Section objects, otherwise false + * @memberof AbstractBlock + */ + AbstractBlock.prototype.hasSections = function () { + // REMIND: call directly the underlying method "$sections?" + // once https://github.com/asciidoctor/asciidoctor/pull/3591 is merged and a new version is released. + // return this['$sections?']() + return this.next_section_index !== Opal.nil && this.next_section_index > 0 + }; + + /** + * Get the Array of child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {Array<Section>} - an {Array} of {@link Section} objects + */ + AbstractBlock.prototype.getSections = function () { + return this.$sections() + }; + + /** + * Get the numeral of this block (if section, relative to parent, otherwise absolute). + * Only assigned to section if automatic section numbering is enabled. + * Only assigned to formal block (block with title) if corresponding caption attribute is present. + * If the section is an appendix, the numeral is a letter (starting with A). + * @returns {string} - the numeral + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getNumeral = function () { + const numeral = this.$numeral(); + return numeral === Opal.nil ? undefined : numeral + }; + + /** + * Set the numeral of this block. + * @param {string} value - The numeral value + * @memberof AbstractBlock + */ + AbstractBlock.prototype.setNumeral = function (value) { + this['$numeral='](value); + }; + + /** + * A convenience method that checks whether the title of this block is defined. + * + * @returns {boolean} - a {boolean} indicating whether this block has a title. + * @memberof AbstractBlock + */ + AbstractBlock.prototype.hasTitle = function () { + return this['$title?']() + }; + + /** + * Returns the converted alt text for this block image. + * @returns {string} - the {string} value of the alt attribute with XML special character and replacement substitutions applied. + * @memberof AbstractBlock + */ + AbstractBlock.prototype.getAlt = function () { + return this.$alt() + }; + + // Section API + + /** + * @description + * Methods for managing sections of AsciiDoc content in a document. + * + * @example + * <pre> + * section = asciidoctor.Section.create() + * section.setTitle('Section 1') + * section.setId('sect1') + * section.getBlocks().length // 0 + * section.getId() // "sect1" + * section.append(newBlock) + * section.getBlocks().length // 1 + * </pre> + * @namespace + * @extends AbstractBlock + */ + const Section = Opal.Asciidoctor.Section; + + /** + * Create a {Section} object. + * @param {AbstractBlock} [parent] - The parent AbstractBlock. If set, must be a Document or Section object (default: undefined) + * @param {number} [level] - The Integer level of this section (default: 1 more than parent level or 1 if parent not defined) + * @param {boolean} [numbered] - A Boolean indicating whether numbering is enabled for this Section (default: false) + * @param {Object} [opts] - An optional JSON of options (default: {}) + * @returns {Section} - a new {Section} object + * @memberof Section + */ + Section.create = function (parent, level, numbered, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$new(parent, level, numbered, toHash(opts)) + }; + + /** + * Set the level of this section or the section level in which this block resides. + * @param {number} level - Level (Integer) + * @memberof AbstractBlock + */ + Section.prototype.setLevel = function (level) { + this.level = level; + }; + + /** + * Get the 0-based index order of this section within the parent block. + * @returns {number} + * @memberof Section + */ + Section.prototype.getIndex = function () { + return this.index + }; + + /** + * Set the 0-based index order of this section within the parent block. + * @param {string} index - The index order of this section + * @memberof Section + */ + Section.prototype.setIndex = function (index) { + this.index = index; + }; + + /** + * Get the section name of this section. + * @returns {string|undefined} + * @memberof Section + */ + Section.prototype.getSectionName = function () { + const sectname = this.sectname; + return sectname === Opal.nil ? undefined : sectname + }; + + /** + * Set the section name of this section. + * @param {string} value - The section name + * @memberof Section + */ + Section.prototype.setSectionName = function (value) { + this.sectname = value; + }; + + /** + * Get the section numeral of this section. + * @returns {string} + * @memberof Section + */ + Section.prototype.getSectionNumeral = function () { + return this.$sectnum() + }; + + Section.prototype.getSectionNumber = Section.prototype.getSectionNumeral; + + /** + * Get the flag to indicate whether this is a special section or a child of one. + * @returns {boolean} + * @memberof Section + */ + Section.prototype.isSpecial = function () { + return this.special + }; + + /** + * Set the flag to indicate whether this is a special section or a child of one. + * @param {boolean} value - A flag to indicated if this is a special section + * @memberof Section + */ + Section.prototype.setSpecial = function (value) { + this.special = value; + }; + + /** + * Get the state of the numbered attribute at this section (need to preserve for creating TOC). + * @returns {boolean} + * @memberof Section + */ + Section.prototype.isNumbered = function () { + return this.numbered + }; + + /** + * Get the caption for this section (only relevant for appendices). + * @returns {string} + * @memberof Section + */ + Section.prototype.getCaption = function () { + const value = this.caption; + return value === Opal.nil ? undefined : value + }; + + /** + * Get the name of the Section (title) + * @returns {string} + * @see {@link AbstractBlock#getTitle} + * @memberof Section + */ + Section.prototype.getName = function () { + return this.getTitle() + }; + + /** + * @description + * Methods for managing AsciiDoc content blocks. + * + * @example + * block = asciidoctor.Block.create(parent, 'paragraph', {source: '_This_ is a <test>'}) + * block.getContent() + * // "<em>This</em> is a <test>" + * + * @namespace + * @extends AbstractBlock + */ + const Block = Opal.Asciidoctor.Block; + + /** + * Create a {Block} object. + * @param {AbstractBlock} parent - The parent {AbstractBlock} with a compound content model to which this {Block} will be appended. + * @param {string} context - The context name for the type of content (e.g., "paragraph"). + * @param {Object} [opts] - a JSON of options to customize block initialization: (default: {}) + * @param {string} opts.content_model - indicates whether blocks can be nested in this {Block} ("compound"), + * otherwise how the lines should be processed ("simple", "verbatim", "raw", "empty"). (default: "simple") + * @param {Object} opts.attributes - a JSON of attributes (key/value pairs) to assign to this {Block}. (default: {}) + * @param {string|Array<string>} opts.source - a String or {Array} of raw source for this {Block}. (default: undefined) + * + * IMPORTANT: If you don't specify the `subs` option, you must explicitly call the `commit_subs` method to resolve and assign the substitutions + * to this block (which are resolved from the `subs` attribute, if specified, or the default substitutions based on this block's context). + * If you want to use the default subs for a block, pass the option `subs: "default"`. + * You can override the default subs using the `default_subs` option. + * + * @returns {Block} - a new {Block} object + * @memberof Block + */ + Block.create = function (parent, context, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$new(parent, context, toHash(opts)) + }; + + /** + * Get the source of this block. + * @returns {string} - the String source of this block. + * @memberof Block + */ + Block.prototype.getSource = function () { + return this.$source() + }; + + /** + * Get the source lines of this block. + * @returns {Array<string>} - the String {Array} of source lines for this block. + * @memberof Block + */ + Block.prototype.getSourceLines = function () { + return this.lines + }; + + // AbstractNode API + + /** + * @namespace + * @description + * An abstract base class that provides state and methods for managing a node of AsciiDoc content. + * The state and methods on this class are common to all content segments in an AsciiDoc document. + */ + const AbstractNode = Opal.Asciidoctor.AbstractNode; + + /** + * Apply the specified substitutions to the text. + * If no substitutions are specified, the following substitutions are applied: + * <code>specialcharacters</code>, <code>quotes</code>, <code>attributes</code>, <code>replacements</code>, <code>macros</code>, and <code>post_replacements</code>. + * + * @param {string|Array<string>} text - The String or String Array of text to process; must not be undefined. + * @param {Array<string>} [subs] - The substitutions to perform; must be an Array or undefined. + * @returns {string|Array<string>} - a String or String Array to match the type of the text argument with substitutions applied. + * @memberof AbstractNode + */ + AbstractNode.prototype.applySubstitutions = function (text, subs) { + return this.$apply_subs(text, subs) + }; + + /** + * Resolve the list of comma-delimited subs against the possible options. + * + * @param {string} subs - The comma-delimited String of substitution names or aliases. + * @param {string} [type] - A String representing the context for which the subs are being resolved (default: 'block'). + * @param {Array<string>} [defaults] - An Array of substitutions to start with when computing incremental substitutions (default: undefined). + * @param {string} [subject] - The String to use in log messages to communicate the subject for which subs are being resolved (default: undefined) + * + * @returns {Array<string>} - An Array of Strings representing the substitution operation or nothing if no subs are found. + * @memberof AbstractNode + */ + AbstractNode.prototype.resolveSubstitutions = function (subs, type, defaults, subject) { + if (typeof type === 'undefined') { + type = 'block'; + } + if (typeof defaults === 'undefined') { + defaults = Opal.nil; + } + if (typeof subject === 'undefined') { + subject = Opal.nil; + } + const value = this.$resolve_subs(subs, type, defaults, subject); + return value === Opal.nil ? undefined : value + }; + + /** + * Call {@link AbstractNode#resolveSubstitutions} for the 'block' type. + * + * @see {@link AbstractNode#resolveSubstitutions} + */ + AbstractNode.prototype.resolveBlockSubstitutions = function (subs, defaults, subject) { + return this.resolveSubstitutions(subs, 'block', defaults, subject) + }; + + /** + * Call {@link AbstractNode#resolveSubstitutions} for the 'inline' type with the subject set as passthrough macro. + * + * @see {@link AbstractNode#resolveSubstitutions} + */ + AbstractNode.prototype.resolvePassSubstitutions = function (subs) { + return this.resolveSubstitutions(subs, 'inline', undefined, 'passthrough macro') + }; + + /** + * @returns {string} - the String name of this node + * @memberof AbstractNode + */ + AbstractNode.prototype.getNodeName = function () { + return this.node_name + }; + + /** + * @returns {Object} - the JSON of attributes for this node + * @memberof AbstractNode + */ + AbstractNode.prototype.getAttributes = function () { + return fromHash(this.attributes) + }; + + /** + * Get the value of the specified attribute. + * If the attribute is not found on this node, fallback_name is set, and this node is not the Document node, get the value of the specified attribute from the Document node. + * + * Look for the specified attribute in the attributes on this node and return the value of the attribute, if found. + * Otherwise, if fallback_name is set (default: same as name) and this node is not the Document node, look for that attribute on the Document node and return its value, if found. + * Otherwise, return the default value (default: undefined). + * + * @param {string} name - The String of the attribute to resolve. + * @param {*} [defaultValue] - The {Object} value to return if the attribute is not found (default: undefined). + * @param {string} [fallbackName] - The String of the attribute to resolve on the Document if the attribute is not found on this node (default: same as name). + * + * @returns {*} - the {Object} value (typically a String) of the attribute or defaultValue if the attribute is not found. + * @memberof AbstractNode + */ + AbstractNode.prototype.getAttribute = function (name, defaultValue, fallbackName) { + const value = this.$attr(name, defaultValue, fallbackName); + return value === Opal.nil ? undefined : value + }; + + /** + * Check whether the specified attribute is present on this node. + * + * @param {string} name - The String of the attribute to resolve. + * @returns {boolean} - true if the attribute is present, otherwise false + * @memberof AbstractNode + */ + AbstractNode.prototype.hasAttribute = function (name) { + return name in this.attributes.$$smap + }; + + /** + * Check if the specified attribute is defined using the same logic as {AbstractNode#getAttribute}, optionally performing acomparison with the expected value if specified. + * + * Look for the specified attribute in the attributes on this node. + * If not found, fallback_name is specified (default: same as name), and this node is not the Document node, look for that attribute on the Document node. + * In either case, if the attribute is found, and the comparison value is truthy, return whether the two values match. + * Otherwise, return whether the attribute was found. + * + * @param {string} name - The String name of the attribute to resolve. + * @param {*} [expectedValue] - The expected Object value of the attribute (default: undefined). + * @param {string} fallbackName - The String of the attribute to resolve on the Document if the attribute is not found on this node (default: same as name). + * + * @returns {boolean} - a Boolean indicating whether the attribute exists and, if a truthy comparison value is specified, whether the value of the attribute matches the comparison value. + * @memberof AbstractNode + */ + AbstractNode.prototype.isAttribute = function (name, expectedValue, fallbackName) { + return this['$attr?'](name, expectedValue, fallbackName) + }; + + /** + * Assign the value to the attribute name for the current node. + * + * @param {string} name - The String attribute name to assign + * @param {*} value - The Object value to assign to the attribute (default: '') + * @param {boolean} overwrite - A Boolean indicating whether to assign the attribute if currently present in the attributes JSON (default: true) + * + * @returns {boolean} - a Boolean indicating whether the assignment was performed + * @memberof AbstractNode + */ + AbstractNode.prototype.setAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + return this.$set_attr(name, value, overwrite) + }; + + /** + * Remove the attribute from the current node. + * @param {string} name - The String attribute name to remove + * @returns {string} - the previous {string} value, or undefined if the attribute was not present. + * @memberof AbstractNode + */ + AbstractNode.prototype.removeAttribute = function (name) { + const value = this.$remove_attr(name); + return value === Opal.nil ? undefined : value + }; + + /** + * Get the {@link Document} to which this node belongs. + * + * @returns {Document} - the {@link Document} object to which this node belongs. + * @memberof AbstractNode + */ + AbstractNode.prototype.getDocument = function () { + return this.document + }; + + /** + * Get the {@link AbstractNode} to which this node is attached. + * + * @memberof AbstractNode + * @returns {AbstractNode} - the {@link AbstractNode} object to which this node is attached, + * or undefined if this node has no parent. + */ + AbstractNode.prototype.getParent = function () { + const parent = this.parent; + return parent === Opal.nil ? undefined : parent + }; + + /** + * @returns {boolean} - true if this {AbstractNode} is an instance of {Inline} + * @memberof AbstractNode + */ + AbstractNode.prototype.isInline = function () { + return this['$inline?']() + }; + + /** + * @returns {boolean} - true if this {AbstractNode} is an instance of {Block} + * @memberof AbstractNode + */ + AbstractNode.prototype.isBlock = function () { + return this['$block?']() + }; + + /** + * Checks if the role attribute is set on this node and, if an expected value is given, whether the space-separated role matches that value. + * + * @param {string} expectedValue - The expected String value of the role (optional, default: undefined) + * + * @returns {boolean} - a Boolean indicating whether the role attribute is set on this node and, if an expected value is given, whether the space-separated role matches that value. + * @memberof AbstractNode + */ + AbstractNode.prototype.isRole = function (expectedValue) { + return this['$role?'](expectedValue) + }; + + /** + * Retrieves the space-separated String role for this node. + * + * @returns {string} - the role as a space-separated String. + * @memberof AbstractNode + */ + AbstractNode.prototype.getRole = function () { + const role = this.$role(); + return role === Opal.nil ? undefined : role + }; + + /** + * Sets the value of the role attribute on this node. + * + * @param {...string|Array<string>} names - A single role name, a space-separated String of role names, an Array of role names or a list of role names + * + * @returns {string} - the value of the role attribute + * @memberof AbstractNode + */ + AbstractNode.prototype.setRole = function (names) { + if (Array.isArray(names) || (typeof names === 'string' && arguments.length === 1)) { + return this['$role='](names) + } + return this['$role='](Array.from(arguments)) + }; + + /** + * Checks if the specified role is present in the list of roles for this node. + * + * @param {string} name - The String name of the role to find. + * + * @returns {boolean} - a Boolean indicating whether this node has the specified role. + * @memberof AbstractNode + */ + AbstractNode.prototype.hasRole = function (name) { + return this['$has_role?'](name) + }; + + /** + * Retrieves the String role names for this node as an Array. + * + * @returns {Array<string>} - the role names as a String {Array}, which is empty if the role attribute is absent on this node. + * @memberof AbstractNode + */ + AbstractNode.prototype.getRoles = function () { + return this.$roles() + }; + + /** + * Adds the given role directly to this node. + * + * @param {string} name - The name of the role to add + * + * @returns {boolean} - a Boolean indicating whether the role was added. + * @memberof AbstractNode + */ + AbstractNode.prototype.addRole = function (name) { + return this.$add_role(name) + }; + + /** + * Public: Removes the given role directly from this node. + * + * @param {string} name - The name of the role to remove + * + * @returns {boolean} - a Boolean indicating whether the role was removed. + * @memberof AbstractNode + */ + AbstractNode.prototype.removeRole = function (name) { + return this.$remove_role(name) + }; + + /** + * A convenience method that checks if the reftext attribute is defined. + * @returns {boolean} - A Boolean indicating whether the reftext attribute is defined + * @memberof AbstractNode + */ + AbstractNode.prototype.isReftext = function () { + return this['$reftext?']() + }; + + /** + * A convenience method that returns the value of the reftext attribute with substitutions applied. + * @returns {string|undefined} - the value of the reftext attribute with substitutions applied. + * @memberof AbstractNode + */ + AbstractNode.prototype.getReftext = function () { + const reftext = this.$reftext(); + return reftext === Opal.nil ? undefined : reftext + }; + + /** + * @returns {string} - Get the context name for this node + * @memberof AbstractNode + */ + AbstractNode.prototype.getContext = function () { + const context = this.context; + // Automatically convert Opal pseudo-symbol to String + return typeof context === 'string' ? context : context.toString() + }; + + /** + * @returns {string} - the String id of this node + * @memberof AbstractNode + */ + AbstractNode.prototype.getId = function () { + const id = this.id; + return id === Opal.nil ? undefined : id + }; + + /** + * @param {string} id - the String id of this node + * @memberof AbstractNode + */ + AbstractNode.prototype.setId = function (id) { + this.id = id; + }; + + /** + * A convenience method to check if the specified option attribute is enabled on the current node. + * Check if the option is enabled. This method simply checks to see if the <name>-option attribute is defined on the current node. + * + * @param {string} name - the String name of the option + * + * @return {boolean} - a Boolean indicating whether the option has been specified + * @memberof AbstractNode + */ + AbstractNode.prototype.isOption = function (name) { + return this['$option?'](name) + }; + + /** + * Set the specified option on this node. + * This method sets the specified option on this node by setting the <name>-option attribute. + * + * @param {string} name - the String name of the option + * + * @memberof AbstractNode + */ + AbstractNode.prototype.setOption = function (name) { + return this.$set_option(name) + }; + + /** + * @memberof AbstractNode + */ + AbstractNode.prototype.getIconUri = function (name) { + return this.$icon_uri(name) + }; + + /** + * @memberof AbstractNode + */ + AbstractNode.prototype.getMediaUri = function (target, assetDirKey) { + return this.$media_uri(target, assetDirKey) + }; + + /** + * @memberof AbstractNode + */ + AbstractNode.prototype.getImageUri = function (targetImage, assetDirKey) { + return this.$image_uri(targetImage, assetDirKey) + }; + + /** + * Get the {Converter} instance being used to convert the current {Document}. + * @returns {Object} + * @memberof AbstractNode + */ + AbstractNode.prototype.getConverter = function () { + return this.$converter() + }; + + /** + * @memberof AbstractNode + */ + AbstractNode.prototype.readContents = function (target, options) { + return this.$read_contents(target, toHash(options)) + }; + + /** + * Read the contents of the file at the specified path. + * This method assumes that the path is safe to read. + * It checks that the file is readable before attempting to read it. + * + * @param path - the {string} path from which to read the contents + * @param {Object} options - a JSON {Object} of options to control processing (default: {}) + * @param {boolean} options.warn_on_failure - a {boolean} that controls whether a warning is issued if the file cannot be read (default: false) + * @param {boolean} options.normalize - a {boolean} that controls whether the lines are normalized and coerced to UTF-8 (default: false) + * + * @returns {string} - the String content of the file at the specified path, or undefined if the file does not exist. + * @memberof AbstractNode + */ + AbstractNode.prototype.readAsset = function (path, options) { + const result = this.$read_asset(path, toHash(options)); + return result === Opal.nil ? undefined : result + }; + + /** + * @memberof AbstractNode + */ + AbstractNode.prototype.normalizeWebPath = function (target, start, preserveTargetUri) { + return this.$normalize_web_path(target, start, preserveTargetUri) + }; + + /** + * @memberof AbstractNode + */ + AbstractNode.prototype.normalizeSystemPath = function (target, start, jail, options) { + return this.$normalize_system_path(target, start, jail, toHash(options)) + }; + + /** + * @memberof AbstractNode + */ + AbstractNode.prototype.normalizeAssetPath = function (assetRef, assetName, autoCorrect) { + return this.$normalize_asset_path(assetRef, assetName, autoCorrect) + }; + + // Document API + + /** + * The {@link Document} class represents a parsed AsciiDoc document. + * + * Document is the root node of a parsed AsciiDoc document.<br/> + * It provides an abstract syntax tree (AST) that represents the structure of the AsciiDoc document + * from which the Document object was parsed. + * + * Although the constructor can be used to create an empty document object, + * more commonly, you'll load the document object from AsciiDoc source + * using the primary API methods on {@link Asciidoctor}. + * When using one of these APIs, you almost always want to set the safe mode to 'safe' (or 'unsafe') + * to enable all of Asciidoctor's features. + * + * <pre> + * const doc = Asciidoctor.load('= Hello, AsciiDoc!', { 'safe': 'safe' }) + * // => Asciidoctor::Document { doctype: "article", doctitle: "Hello, AsciiDoc!", blocks: 0 } + * </pre> + * + * Instances of this class can be used to extract information from the document or alter its structure. + * As such, the Document object is most often used in extensions and by integrations. + * + * The most basic usage of the Document object is to retrieve the document's title. + * + * <pre> + * const source = '= Document Title' + * const doc = asciidoctor.load(source, { 'safe': 'safe' }) + * console.log(doc.getTitle()) // 'Document Title' + * </pre> + * + * You can also use the Document object to access document attributes defined in the header, such as the author and doctype. + * @namespace + * @extends AbstractBlock + */ + const Document = Opal.Asciidoctor.Document; + + /** + * Append a content Block to this Document. + * If the child block is a Section, assign an index to it. + * @param {AbstractBlock} block - the child Block to append to this parent Block + * @returns {AbstractBlock} - the parent block to which this block was appended. + * @memberof Document + */ + Document.prototype.append = function (block) { + this['$<<'](block); + return this + }; + + /** + * Returns the SyntaxHighlighter associated with this document. + * + * @returns {SyntaxHighlighter} - the SyntaxHighlighter associated with this document. + * @memberof Document + */ + Document.prototype.getSyntaxHighlighter = function () { + const syntaxHighlighter = this.syntax_highlighter; + // eslint-disable-next-line no-proto + const prototype = syntaxHighlighter.__proto__; + if (prototype) { + if (typeof prototype['$highlight?'] === 'function') { + prototype.handlesHighlighting = function () { + const value = prototype['$highlight?'](); + return value === Opal.nil ? false : value + }; + } + if (typeof prototype['$docinfo?'] === 'function') { + prototype.hasDocinfo = prototype['$docinfo?']; + } + if (typeof prototype.$format === 'function') { + prototype.format = function (node, lang, opts) { + return this.$format(node, lang, toHash(opts)) + }; + } + if (typeof prototype.$docinfo === 'function') { + prototype.docinfo = function (location, doc, opts) { + return this.$docinfo(location, doc, toHash(opts)) + }; + } + } + return syntaxHighlighter + }; + + /** + * Returns a JSON {Object} of references captured by the processor. + * + * @returns {Object} - a JSON {Object} of {AbstractNode} in the document. + * @memberof Document + */ + Document.prototype.getRefs = function () { + return fromHash(this.catalog.$$smap.refs) + }; + + /** + * Returns an {Array} of {Document/ImageReference} captured by the processor. + * + * @returns {Array<ImageReference>} - an {Array} of {Document/ImageReference} in the document. + * Will return an empty array if the option "catalog_assets: true" was not defined on the processor. + * @memberof Document + */ + Document.prototype.getImages = function () { + return this.catalog.$$smap.images + }; + + /** + * Returns an {Array} of links captured by the processor. + * + * @returns {Array<string>} - an {Array} of links in the document. + * Will return an empty array if: + * - the function was called before the document was converted + * - the option "catalog_assets: true" was not defined on the processor + * @memberof Document + */ + Document.prototype.getLinks = function () { + return this.catalog.$$smap.links + }; + + /** + * @returns {boolean} - true if the document has footnotes otherwise false + * @memberof Document + */ + Document.prototype.hasFootnotes = function () { + return this['$footnotes?']() + }; + + /** + * Returns an {Array} of {Document/Footnote} captured by the processor. + * + * @returns {Array<Footnote>} - an {Array} of {Document/Footnote} in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ + Document.prototype.getFootnotes = function () { + return this.$footnotes() + }; + + /** + * Returns the level-0 {Section} (i.e. the document title). + * Only stores the title, not the header attributes. + * + * @returns {string} - the level-0 {Section}. + * @memberof Document + */ + Document.prototype.getHeader = function () { + return this.header + }; + + /** + * @memberof Document + */ + Document.prototype.setAttribute = function (name, value) { + return this.$set_attribute(name, value) + }; + + /** + + * @memberof Document + */ + Document.prototype.removeAttribute = function (name) { + this.attributes.$delete(name); + this.attribute_overrides.$delete(name); + }; + + /** + * Convert the AsciiDoc document using the templates loaded by the Converter. + * If a "template_dir" is not specified, or a template is missing, the converter will fall back to using the appropriate built-in template. + * + * @param {Object} [options] - a JSON of options to control processing (default: {}) + * + * @returns {string} + * @memberof Document + */ + Document.prototype.convert = function (options) { + const result = this.$convert(toHash(options)); + return result === Opal.nil ? '' : result + }; + + /** + * Write the output to the specified file. + * + * If the converter responds to "write", delegate the work of writing the file to that method. + * Otherwise, write the output the specified file. + * + * @param {string} output + * @param {string} target + * + * @memberof Document + */ + Document.prototype.write = function (output, target) { + return this.$write(output, target) + }; + + /** + * @returns {string} - the full name of the author as a String + * @memberof Document + */ + Document.prototype.getAuthor = function () { + return this.$author() + }; + + /** + * @returns {string} + * @memberof Document + */ + Document.prototype.getSource = function () { + return this.$source() + }; + + /** + * @returns {Array<string>} + * @memberof Document + */ + Document.prototype.getSourceLines = function () { + return this.$source_lines() + }; + + /** + * @returns {boolean} + * @memberof Document + */ + Document.prototype.isNested = function () { + return this['$nested?']() + }; + + /** + * @returns {boolean} + * @memberof Document + */ + Document.prototype.isEmbedded = function () { + return this['$embedded?']() + }; + + /** + * @returns {boolean} + * @memberof Document + */ + Document.prototype.hasExtensions = function () { + return this['$extensions?']() + }; + + /** + * Get the value of the doctype attribute for this document. + * @returns {string} + * @memberof Document + */ + Document.prototype.getDoctype = function () { + return this.doctype + }; + + /** + * Get the value of the backend attribute for this document. + * @returns {string} + * @memberof Document + */ + Document.prototype.getBackend = function () { + return this.backend + }; + + /** + * @returns {boolean} + * @memberof Document + */ + Document.prototype.isBasebackend = function (base) { + return this['$basebackend?'](base) + }; + + /** + * Get the title explicitly defined in the document attributes. + * @returns {string} + * @see {@link AbstractNode#getAttributes} + * @memberof Document + */ + Document.prototype.getTitle = function () { + const title = this.$title(); + return title === Opal.nil ? undefined : title + }; + + /** + * Set the title on the document header + * + * Set the title of the document header to the specified value. + * If the header does not exist, it is first created. + * + * @param {string} title - the String title to assign as the title of the document header + * + * @returns {string} - the new String title assigned to the document header + * @memberof Document + */ + Document.prototype.setTitle = function (title) { + return this['$title='](title) + }; + + /** + * @returns {Document/Title} - a {@link Document/Title} + * @memberof Document + */ + Document.prototype.getDocumentTitle = function (options) { + const doctitle = this.$doctitle(toHash(options)); + return doctitle === Opal.nil ? undefined : doctitle + }; + + /** + * @see {@link Document#getDocumentTitle} + * @memberof Document + */ + Document.prototype.getDoctitle = Document.prototype.getDocumentTitle; + + /** + * Get the document catalog JSON object. + * @returns {Object} + * @memberof Document + */ + Document.prototype.getCatalog = function () { + return fromHash(this.catalog) + }; + + /** + * + * @returns {Object} + * @see Document#getCatalog + * @memberof Document + */ + Document.prototype.getReferences = Document.prototype.getCatalog; + + /** + * Get the document revision date from document header (document attribute <code>revdate</code>). + * @returns {string} + * @memberof Document + */ + Document.prototype.getRevisionDate = function () { + return this.getAttribute('revdate') + }; + + /** + * @see Document#getRevisionDate + * @returns {string} + * @memberof Document + */ + Document.prototype.getRevdate = function () { + return this.getRevisionDate() + }; + + /** + * Get the document revision number from document header (document attribute <code>revnumber</code>). + * @returns {string} + * @memberof Document + */ + Document.prototype.getRevisionNumber = function () { + return this.getAttribute('revnumber') + }; + + /** + * Get the document revision remark from document header (document attribute <code>revremark</code>). + * @returns {string} + * @memberof Document + */ + Document.prototype.getRevisionRemark = function () { + return this.getAttribute('revremark') + }; + + /** + * Assign a value to the specified attribute in the document header. + * + * The assignment will be visible when the header attributes are restored, + * typically between processor phases (e.g., between parse and convert). + * + * @param {string} name - The {string} attribute name to assign + * @param {Object} value - The {Object} value to assign to the attribute (default: '') + * @param {boolean} overwrite - A {boolean} indicating whether to assign the attribute + * if already present in the attributes Hash (default: true) + * + * @returns {boolean} - true if the assignment was performed otherwise false + * @memberof Document + */ + Document.prototype.setHeaderAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + if (typeof value === 'undefined') value = ''; + return this.$set_header_attribute(name, value, overwrite) + }; + + /** + * Convenience method to retrieve the authors of this document as an {Array} of {Document/Author} objects. + * + * This method is backed by the author-related attributes on the document. + * + * @returns {Array<Author>} - an {Array} of {Document/Author} objects. + * @memberof Document + */ + Document.prototype.getAuthors = function () { + return this.$authors() + }; + + // Document.Footnote API + + /** + * @namespace + * @module Document/Footnote + */ + const Footnote = Document.Footnote; + + /** + * @returns {number} - the footnote's index + * @memberof Document/Footnote + */ + Footnote.prototype.getIndex = function () { + const index = this.$$data.index; + return index === Opal.nil ? undefined : index + }; + + /** + * @returns {number} - the footnote's id + * @memberof Document/Footnote + */ + Footnote.prototype.getId = function () { + const id = this.$$data.id; + return id === Opal.nil ? undefined : id + }; + + /** + * @returns {string} - the footnote's text + * @memberof Document/Footnote + */ + Footnote.prototype.getText = function () { + const text = this.$$data.text; + return text === Opal.nil ? undefined : text + }; + + // Document.ImageReference API + + /** + * @class + * @module Document/ImageReference + */ + const ImageReference = Document.ImageReference; + + /** + * @returns {string} - the image's target + * @memberof Document/ImageReference + */ + ImageReference.prototype.getTarget = function () { + return this.$$data.target + }; + + /** + * @returns {string} - the image's directory (imagesdir attribute) + * @memberof Document/ImageReference + */ + ImageReference.prototype.getImagesDirectory = function () { + const value = this.$$data.imagesdir; + return value === Opal.nil ? undefined : value + }; + + // Document.Author API + + /** + * The Author class represents information about an author extracted from document attributes. + * @namespace + * @module Document/Author + */ + const Author = Document.Author; + + /** + * @returns {string} - the author's full name + * @memberof Document/Author + */ + Author.prototype.getName = function () { + const name = this.$$data.name; + return name === Opal.nil ? undefined : name + }; + + /** + * @returns {string} - the author's first name + * @memberof Document/Author + */ + Author.prototype.getFirstName = function () { + const firstName = this.$$data.firstname; + return firstName === Opal.nil ? undefined : firstName + }; + + /** + * @returns {string} - the author's middle name (or undefined if the author has no middle name) + * @memberof Document/Author + */ + Author.prototype.getMiddleName = function () { + const middleName = this.$$data.middlename; + return middleName === Opal.nil ? undefined : middleName + }; + + /** + * @returns {string} - the author's last name + * @memberof Document/Author + */ + Author.prototype.getLastName = function () { + const lastName = this.$$data.lastname; + return lastName === Opal.nil ? undefined : lastName + }; + + /** + * @returns {string} - the author's initials (by default based on the author's name) + * @memberof Document/Author + */ + Author.prototype.getInitials = function () { + const initials = this.$$data.initials; + return initials === Opal.nil ? undefined : initials + }; + + /** + * @returns {string} - the author's email + * @memberof Document/Author + */ + Author.prototype.getEmail = function () { + const email = this.$$data.email; + return email === Opal.nil ? undefined : email + }; + + // private constructor + Document.RevisionInfo = function (date, number, remark) { + this.date = date; + this.number = number; + this.remark = remark; + }; + + /** + * @class + * @namespace + * @module Document/RevisionInfo + */ + const RevisionInfo = Document.RevisionInfo; + + /** + * Get the document revision date from document header (document attribute <code>revdate</code>). + * @returns {string} + * @memberof Document/RevisionInfo + */ + RevisionInfo.prototype.getDate = function () { + return this.date + }; + + /** + * Get the document revision number from document header (document attribute <code>revnumber</code>). + * @returns {string} + * @memberof Document/RevisionInfo + */ + RevisionInfo.prototype.getNumber = function () { + return this.number + }; + + /** + * Get the document revision remark from document header (document attribute <code>revremark</code>). + * A short summary of changes in this document revision. + * @returns {string} + * @memberof Document/RevisionInfo + */ + RevisionInfo.prototype.getRemark = function () { + return this.remark + }; + + /** + * @returns {boolean} - true if the revision info is empty (ie. not defined), otherwise false + * @memberof Document/RevisionInfo + */ + RevisionInfo.prototype.isEmpty = function () { + return this.date === undefined && this.number === undefined && this.remark === undefined + }; + + // SafeMode API + + /** + * @namespace + */ + const SafeMode = Opal.Asciidoctor.SafeMode; + + /** + * @param {string} name - the name of the security level + * @returns {number} - the integer value of the corresponding security level + */ + SafeMode.getValueForName = function (name) { + return this.$value_for_name(name) + }; + + /** + * @param {number} value - the integer value of the security level + * @returns {string} - the name of the corresponding security level + */ + SafeMode.getNameForValue = function (value) { + const name = this.$name_for_value(value); + return name === Opal.nil ? undefined : name + }; + + /** + * @returns {Array<string>} - the String {Array} of security levels + */ + SafeMode.getNames = function () { + return this.$names() + }; + + // Callouts API + + /** + * Maintains a catalog of callouts and their associations. + * @namespace + */ + const Callouts = Opal.Asciidoctor.Callouts; + + /** + * Create a new Callouts. + * @returns {Callouts} - a new Callouts + * @memberof Callouts + */ + Callouts.create = function () { + return this.$new() + }; + + /** + * Register a new callout for the given list item ordinal. + * Generates a unique id for this callout based on the index of the next callout list in the document and the index of this callout since the end of the last callout list. + * + * @param {number} ordinal - the Integer ordinal (1-based) of the list item to which this callout is to be associated + * @returns {string} - The unique String id of this callout + * @example + * callouts = asciidoctor.Callouts.create() + * callouts.register(1) + * // => "CO1-1" + * callouts.nextList() + * callouts.register(2) + * // => "CO2-1" + * @memberof Callouts + */ + + Callouts.prototype.register = function (ordinal) { + return this.$register(ordinal) + }; + /** + * Get the next callout index in the document. + * + * Reads the next callout index in the document and advances the pointer. + * This method is used during conversion to retrieve the unique id of the callout that was generated during parsing. + * + * @returns {string} - The unique String id of the next callout in the document + * @memberof Callouts + */ + Callouts.prototype.readNextId = function () { + return this.$read_next_id() + }; + + /** + * et a space-separated list of callout ids for the specified list item. + * @param {number} ordinal - the Integer ordinal (1-based) of the list item for which to retrieve the callouts + * @returns {string} - a space-separated String of callout ids associated with the specified list item + * @memberof Callouts + */ + Callouts.prototype.getCalloutIds = function (ordinal) { + return this.$callout_ids(ordinal) + }; + + /** + * @memberof Callouts + */ + Callouts.prototype.getLists = function () { + const lists = this.lists; + if (lists && lists.length > 0) { + for (let i = 0; i < lists.length; i++) { + const list = lists[i]; + if (list && list.length > 0) { + for (let j = 0; j < list.length; j++) { + if (typeof list[j] === 'object' && '$$smap' in list[j]) { + list[j] = fromHash(list[j]); + } + } + } + } + } + return lists + }; + + /** + * @memberof Callouts + */ + Callouts.prototype.getListIndex = function () { + return this.list_index + }; + + /** + * The current list for which callouts are being collected. + * @returns {Array} - The Array of callouts at the position of the list index pointer + * @memberof Callouts + */ + Callouts.prototype.getCurrentList = function () { + const currentList = this.$current_list(); + if (currentList && currentList.length > 0) { + for (let i = 0; i < currentList.length; i++) { + if (typeof currentList[i] === 'object' && '$$smap' in currentList[i]) { + currentList[i] = fromHash(currentList[i]); + } + } + } + return currentList + }; + + /** + * Advance to the next callout list in the document. + * @memberof Callouts + */ + Callouts.prototype.nextList = function () { + return this.$nextList() + }; + + /** + * Rewind the list index pointer, intended to be used when switching from the parsing to conversion phase. + * @memberof Callouts + */ + Callouts.prototype.rewind = function () { + return this.$rewind() + }; + + /** + * @returns {Document/RevisionInfo} - a {@link Document/RevisionInfo} + * @memberof Document + */ + Document.prototype.getRevisionInfo = function () { + return new Document.RevisionInfo(this.getRevisionDate(), this.getRevisionNumber(), this.getRevisionRemark()) + }; + + /** + * @returns {boolean} - true if the document contains revision info, otherwise false + * @memberof Document + */ + Document.prototype.hasRevisionInfo = function () { + const revisionInfo = this.getRevisionInfo(); + return !revisionInfo.isEmpty() + }; + + /** + * @returns {boolean} + * @memberof Document + */ + Document.prototype.getNotitle = function () { + return this.$notitle() + }; + + /** + * @returns {boolean} + * @memberof Document + */ + Document.prototype.getNoheader = function () { + return this.$noheader() + }; + + /** + * @returns {boolean} + * @memberof Document + */ + Document.prototype.getNofooter = function () { + return this.$nofooter() + }; + + /** + * @returns {boolean} + * @memberof Document + */ + Document.prototype.hasHeader = function () { + return this['$header?']() + }; + + /** + * Replay attribute assignments at the block level. + * + * <i>This method belongs to an internal API that deals with how attributes are managed by the processor.</i> + * If you understand why this group of methods are necessary, and what they do, feel free to use them. + * <strong>However, keep in mind they are subject to change at any time.</strong> + * + * @param {Object} blockAttributes - A JSON of attributes + * @memberof Document + */ + Document.prototype.playbackAttributes = function (blockAttributes) { + blockAttributes = toHash(blockAttributes); + if (blockAttributes) { + const attrEntries = blockAttributes['$[]']('attribute_entries'); + if (attrEntries && Array.isArray(attrEntries)) { + const result = []; + for (let i = 0; i < attrEntries.length; i++) { + const attrEntryObject = attrEntries[i]; + if (attrEntryObject && typeof attrEntryObject === 'object' && attrEntryObject.constructor.name === 'Object') { + attrEntryObject.$name = function () { + return this.name + }; + attrEntryObject.$value = function () { + return this.value + }; + attrEntryObject.$negate = function () { + return this.negate + }; + } + result.push(attrEntryObject); + } + blockAttributes['$[]=']('attribute_entries', result); + } + } + this.$playback_attributes(blockAttributes); + }; + + /** + * Delete the specified attribute from the document if the name is not locked. + * If the attribute is locked, false is returned. + * Otherwise, the attribute is deleted. + * + * @param {string} name - the String attribute name + * + * @returns {boolean} - true if the attribute was deleted, false if it was not because it's locked + * @memberof Document + */ + Document.prototype.deleteAttribute = function (name) { + return this.$delete_attribute(name) + }; + + /** + * Determine if the attribute has been locked by being assigned in document options. + * + * @param {string} key - The attribute key to check + * + * @returns {boolean} - true if the attribute is locked, false otherwise + * @memberof Document + */ + Document.prototype.isAttributeLocked = function (key) { + return this['$attribute_locked?'](key) + }; + + /** + * Restore the attributes to the previously saved state (attributes in header). + * + * @memberof Document + */ + Document.prototype.restoreAttributes = function () { + return this.$restore_attributes() + }; + + /** + * Parse the AsciiDoc source stored in the {Reader} into an abstract syntax tree. + * + * If the data parameter is not nil, create a new {PreprocessorReader} and assigned it to the reader property of this object. + * Otherwise, continue with the reader that was created when the {Document} was instantiated. + * Pass the reader to {Parser.parse} to parse the source data into an abstract syntax tree. + * + * If parsing has already been performed, this method returns without performing any processing. + * + * @param {string|Array<string>} [data] - The optional replacement AsciiDoc source data as a String or String Array. (default: undefined) + * + * @returns {Document} - this {Document} + * @memberof Document + */ + Document.prototype.parse = function (data) { + return this.$parse(data) + }; + + /** + * Read the docinfo file(s) for inclusion in the document template + * + * If the docinfo1 attribute is set, read the docinfo.ext file. + * If the docinfo attribute is set, read the doc-name.docinfo.ext file. + * If the docinfo2 attribute is set, read both files in that order. + * + * @param {string} docinfoLocation - The Symbol location of the docinfo (e.g., head, footer, etc). (default: head) + * @param {string|undefined} suffix - The suffix of the docinfo file(s). + * If not set, the extension will be set to the outfilesuffix. (default: undefined) + * + * @returns {string} - the contents of the docinfo file(s) or empty string if no files are found or the safe mode is secure or greater. + * @memberof Document + */ + Document.prototype.getDocinfo = function (docinfoLocation, suffix) { + return this.$docinfo(docinfoLocation, suffix) + }; + + /** + * @param {string} [docinfoLocation] - A {string} for checking docinfo extensions at a given location (head or footer) (default: head) + * @returns {boolean} + * @memberof Document + */ + Document.prototype.hasDocinfoProcessors = function (docinfoLocation) { + return this['$docinfo_processors?'](docinfoLocation) + }; + + /** + * Increment the specified counter and store it in the block's attributes. + * + * @param {string} counterName - the String name of the counter attribute + * @param {Block} block - the {Block} on which to save the counter + * + * @returns {number} - the next number in the sequence for the specified counter + * @memberof Document + */ + Document.prototype.incrementAndStoreCounter = function (counterName, block) { + return this.$increment_and_store_counter(counterName, block) + }; + + /** + * @deprecated Please use {Document#incrementAndStoreCounter} method. + * @memberof Document + */ + Document.prototype.counterIncrement = Document.prototype.incrementAndStoreCounter; + + /** + * Get the named counter and take the next number in the sequence. + * + * @param {string} name - the String name of the counter + * @param {string|number} seed - the initial value as a String or Integer + * + * @returns {number} the next number in the sequence for the specified counter + * @memberof Document + */ + Document.prototype.counter = function (name, seed) { + return this.$counter(name, seed) + }; + + /** + * A read-only integer value indicating the level of security that should be enforced while processing this document. + * The value must be set in the Document constructor using the "safe" option. + * + * A value of 0 (UNSAFE) disables any of the security features enforced by Asciidoctor. + * + * A value of 1 (SAFE) closely parallels safe mode in AsciiDoc. + * In particular, it prevents access to files which reside outside of the parent directory of the source file and disables any macro other than the include directive. + * + * A value of 10 (SERVER) disallows the document from setting attributes that would affect the conversion of the document, + * in addition to all the security features of SafeMode.SAFE. + * For instance, this level forbids changing the backend or source-highlighter using an attribute defined in the source document header. + * This is the most fundamental level of security for server deployments (hence the name). + * + * A value of 20 (SECURE) disallows the document from attempting to read files from the file system and including the contents of them into the document, + * in addition to all the security features of SafeMode.SECURE. + * In particular, it disallows use of the include::[] directive and the embedding of binary content (data uri), stylesheets and JavaScripts referenced by the document. + * (Asciidoctor and trusted extensions may still be allowed to embed trusted content into the document). + * + * Since Asciidoctor is aiming for wide adoption, 20 (SECURE) is the default value and is recommended for server deployments. + * + * A value of 100 (PARANOID) is planned to disallow the use of passthrough macros and prevents the document from setting any known attributes, + * in addition to all the security features of SafeMode.SECURE. + * Please note that this level is not currently implemented (and therefore not enforced)! + * + * @returns {number} - An integer value indicating the level of security + * @memberof Document + */ + Document.prototype.getSafe = function () { + return this.safe + }; + + /** + * Get the Boolean AsciiDoc compatibility mode. + * Enabling this attribute activates the following syntax changes: + * + * * single quotes as constrained emphasis formatting marks + * * single backticks parsed as inline literal, formatted as monospace + * * single plus parsed as constrained, monospaced inline formatting + * * double plus parsed as constrained, monospaced inline formatting + * + * @returns {boolean} + * @memberof Document + */ + Document.prototype.getCompatMode = function () { + return this.compat_mode + }; + + /** + * Get the Boolean flag that indicates whether source map information should be tracked by the parser. + * @returns {boolean} + * @memberof Document + */ + Document.prototype.getSourcemap = function () { + const sourcemap = this.sourcemap; + return sourcemap === Opal.nil ? false : sourcemap + }; + + /** + * Set the Boolean flag that indicates whether source map information should be tracked by the parser. + * @param {boolean} value + * @memberof Document + */ + Document.prototype.setSourcemap = function (value) { + this.sourcemap = value; + }; + + /** + * Get the JSON of document counters. + * @returns {Object} + * @memberof Document + */ + Document.prototype.getCounters = function () { + return fromHash(this.counters) + }; + + /** + * @returns {Object} + * @memberof Document + */ + Document.prototype.getCallouts = function () { + return this.$callouts() + }; + + /** + * Get the String base directory for converting this document. + * + * Defaults to directory of the source file. + * If the source is a string, defaults to the current directory. + * @returns {string} + * @memberof Document + */ + Document.prototype.getBaseDir = function () { + return this.base_dir + }; + + /** + * Get the JSON of resolved options used to initialize this {Document}. + * @returns {Object} + * @memberof Document + */ + Document.prototype.getOptions = function () { + return fromHash(this.options) + }; + + /** + * Get the outfilesuffix defined at the end of the header. + * @returns {string} + * @memberof Document + */ + Document.prototype.getOutfilesuffix = function () { + return this.outfilesuffix + }; + + /** + * Get a reference to the parent Document of this nested document. + * @returns {Document|undefined} + * @memberof Document + */ + Document.prototype.getParentDocument = function () { + const parentDocument = this.parent_document; + return parentDocument === Opal.nil ? undefined : parentDocument + }; + + /** + * Get the {Reader} associated with this document. + * @returns {Object} + * @memberof Document + */ + Document.prototype.getReader = function () { + return this.reader + }; + + /** + * Get the {Converter} instance being used to convert the current {Document}. + * @returns {Object} + * @memberof Document + */ + Document.prototype.getConverter = function () { + return this.converter + }; + + /** + * Get the activated {Extensions.Registry} associated with this document. + * @returns {Extensions/Registry} + * @memberof Document + */ + Document.prototype.getExtensions = function () { + const extensions = this.extensions; + return extensions === Opal.nil ? undefined : extensions + }; + + // Document.Title API + + /** + * A partitioned title (i.e., title & subtitle). + * @namespace + * @module Document/Title + */ + const Title = Document.Title; + + /** + * @returns {string} + * @memberof Document/Title + */ + Title.prototype.getMain = function () { + return this.main + }; + + /** + * @returns {string} + * @memberof Document/Title + */ + Title.prototype.getCombined = function () { + return this.combined + }; + + /** + * @returns {string} + * @memberof Document/Title + */ + Title.prototype.getSubtitle = function () { + const subtitle = this.subtitle; + return subtitle === Opal.nil ? undefined : subtitle + }; + + /** + * @returns {boolean} + * @memberof Document/Title + */ + Title.prototype.isSanitized = function () { + const sanitized = this['$sanitized?'](); + return sanitized === Opal.nil ? false : sanitized + }; + + /** + * @returns {boolean} + * @memberof Document/Title + */ + Title.prototype.hasSubtitle = function () { + return this['$subtitle?']() + }; + + // Inline API + + /** + * Methods for managing inline elements in AsciiDoc block. + * @namespace + * @extends AbstractNode + */ + const Inline = Opal.Asciidoctor.Inline; + + /** + * Create a new Inline element. + * @param {AbstractBlock} parent + * @param {string} context + * @param {string|undefined} text + * @param {Object|undefined} opts + * @returns {Inline} - a new Inline element + * @memberof Inline + */ + Inline.create = function (parent, context, text, opts) { + return this.$new(parent, context, text, prepareOptions(opts)) + }; + + /** + * Get the converted content for this inline node. + * + * @returns {string} - the converted String content for this inline node + * @memberof Inline + */ + Inline.prototype.convert = function () { + return this.$convert() + }; + + /** + * Get the converted String text of this Inline node, if applicable. + * + * @returns {string|undefined} - the converted String text for this Inline node, or undefined if not applicable for this node. + * @memberof Inline + */ + Inline.prototype.getText = function () { + const text = this.$text(); + return text === Opal.nil ? undefined : text + }; + + /** + * Get the String sub-type (aka qualifier) of this Inline node. + * + * This value is used to distinguish different variations of the same node + * category, such as different types of anchors. + * + * @returns {string} - the string sub-type of this Inline node. + * @memberof Inline + */ + Inline.prototype.getType = function () { + return this.$type() + }; + + /** + * Get the primary String target of this Inline node. + * + * @returns {string|undefined} - the string target of this Inline node. + * @memberof Inline + */ + Inline.prototype.getTarget = function () { + const target = this.$target(); + return target === Opal.nil ? undefined : target + }; + + /** + * Returns the converted alt text for this inline image. + * + * @returns {string} - the String value of the alt attribute. + * @memberof Inline + */ + Inline.prototype.getAlt = function () { + return this.$alt() + }; + + // List API + + /** + * Methods for managing AsciiDoc lists (ordered, unordered and description lists). + * @namespace + * @extends AbstractBlock + */ + const List = Opal.Asciidoctor.List; + + /** + * Checks if the {@link List} contains any child {@link ListItem}. + * + * @memberof List + * @returns {boolean} - whether the {@link List} has child {@link ListItem}. + */ + List.prototype.hasItems = function () { + return this['$items?']() + }; + + /** + * Get the Array of {@link ListItem} nodes for this {@link List}. + * + * @returns {Array<ListItem>} - an Array of {@link ListItem} nodes. + * @memberof List + */ + List.prototype.getItems = function () { + return this.blocks + }; + + // ListItem API + + /** + * Methods for managing items for AsciiDoc olists, ulist, and dlists. + * + * In a description list (dlist), each item is a tuple that consists of a 2-item Array of ListItem terms and a ListItem description (i.e., [[term, term, ...], desc]. + * If a description is not set, then the second entry in the tuple is nil. + * @namespace + * @extends AbstractBlock + */ + const ListItem = Opal.Asciidoctor.ListItem; + + /** + * Get the converted String text of this {@link ListItem} node. + * + * @returns {string} - the converted String text for this {@link ListItem} node. + * @memberof ListItem + */ + ListItem.prototype.getText = function () { + return this.$text() + }; + + /** + * Set the String source text of this {@link ListItem} node. + * + * @returns {string} - the new String text assigned to this {@link ListItem} + * @memberof ListItem + */ + ListItem.prototype.setText = function (text) { + return this['$text='](text) + }; + + /** + * A convenience method that checks whether the text of this {@link ListItem} is not blank (i.e. not undefined or empty string). + * + * @returns {boolean} - whether the text is not blank + * @memberof ListItem + */ + ListItem.prototype.hasText = function () { + return this['$text?']() + }; + + /** + * Get the {string} used to mark this {@link ListItem}. + * + * @returns {string} + * @memberof ListItem + */ + ListItem.prototype.getMarker = function () { + return this.marker + }; + + /** + * Set the {string} used to mark this {@link ListItem}. + * + * @param {string} marker - the {string} used to mark this {@link ListItem} + * @memberof ListItem + */ + ListItem.prototype.setMarker = function (marker) { + this.marker = marker; + }; + + /** + * Get the {@link List} to which this {@link ListItem} is attached. + * + * @returns {List} - the {@link List} object to which this {@link ListItem} is attached, + * or undefined if this node has no parent. + * @memberof ListItem + */ + ListItem.prototype.getList = function () { + return this.$list() + }; + + /** + * @see {@link ListItem#getList} + * @memberof ListItem + */ + ListItem.prototype.getParent = ListItem.prototype.getList; + + // Reader API + + /** @namespace */ + const Reader = Opal.Asciidoctor.Reader; + + /** + * Push source onto the front of the reader and switch the context based on the file, document-relative path and line information given. + * + * This method is typically used in an IncludeProcessor to add source read from the target specified. + * + * @param {string} data + * @param {string|undefined} file + * @param {string|undefined} path + * @param {number} lineno - The line number + * @param {Object} attributes - a JSON of attributes + * @returns {Reader} - this {Reader} object. + * @memberof Reader + */ + Reader.prototype.pushInclude = function (data, file, path, lineno, attributes) { + return this.$push_include(data, file, path, lineno, toHash(attributes)) + }; + + /** + * Get the current location of the reader's cursor, which encapsulates the file, dir, path, and lineno of the file being read. + * + * @returns {Cursor} + * @memberof Reader + */ + Reader.prototype.getCursor = function () { + return this.$cursor() + }; + + /** + * Get the remaining unprocessed lines, without consuming them, as an {Array} of {string}. + * + * Lines will not be consumed from the Reader (ie. you will be able to read these lines again). + * + * @returns {Array<string>} - the remaining unprocessed lines as an {Array} of {string}. + * @memberof Reader + */ + Reader.prototype.getLines = function () { + return this.$lines() + }; + + /** + * Get the remaining unprocessed lines, without consuming them, as a {string}. + * + * Lines will not be consumed from the Reader (ie. you will be able to read these lines again). + * + * @returns {string} - the remaining unprocessed lines as a {string} (joined by linefeed characters). + * @memberof Reader + */ + Reader.prototype.getString = function () { + return this.$string() + }; + + /** + * Check whether there are any lines left to read. + * If a previous call to this method resulted in a value of false, immediately returned the cached value. + * Otherwise, delegate to peekLine to determine if there is a next line available. + * + * @returns {boolean} - true if there are more lines, false if there are not. + * @memberof Reader + */ + Reader.prototype.hasMoreLines = function () { + return this['$has_more_lines?']() + }; + + /** + * Check whether this reader is empty (contains no lines). + * + * @returns {boolean} - true if there are no more lines to peek, otherwise false. + * @memberof Reader + */ + Reader.prototype.isEmpty = function () { + return this['$empty?']() + }; + + /** + * Peek at the next line. + * Processes the line if not already marked as processed, but does not consume it (ie. you will be able to read this line again). + * + * This method will probe the reader for more lines. + * If there is a next line that has not previously been visited, the line is passed to the Reader#processLine method to be initialized. + * This call gives sub-classes the opportunity to do preprocessing. + * If the return value of the Reader#processLine is undefined, the data is assumed to be changed and Reader#peekLine is invoked again to perform further processing. + * + * If hasMoreLines is called immediately before peekLine, the direct flag is implicitly true (since the line is flagged as visited). + * + * @param {boolean} direct - A {boolean} flag to bypasses the check for more lines and immediately returns the first element of the internal lines {Array}. (default: false) + * @returns {string} - the next line as a {string} if there are lines remaining. + * @memberof Reader + */ + Reader.prototype.peekLine = function (direct) { + direct = direct || false; + const line = this.$peek_line(direct); + return line === Opal.nil ? undefined : line + }; + + /** + * Consume, preprocess, and return the next line. + * + * Line will be consumed from the Reader (ie. you won't be able to read this line again). + * + * @returns {string} - the next line as a {string} if data is present. + * @memberof Reader + */ + Reader.prototype.readLine = function () { + const line = this.$read_line(); + return line === Opal.nil ? undefined : line + }; + + /** + * Consume, preprocess, and return the remaining lines. + * + * This method calls Reader#readLine repeatedly until all lines are consumed and returns the lines as an {Array} of {string}. + * This method differs from Reader#getLines in that it processes each line in turn, hence triggering any preprocessors implemented in sub-classes. + * + * Lines will be consumed from the Reader (ie. you won't be able to read these lines again). + * + * @returns {Array<string>} - the lines read as an {Array} of {string}. + * @memberof Reader + */ + Reader.prototype.readLines = function () { + return this.$read_lines() + }; + + /** + * Consume, preprocess, and return the remaining lines joined as a {string}. + * + * Delegates to Reader#readLines, then joins the result. + * + * Lines will be consumed from the Reader (ie. you won't be able to read these lines again). + * + * @returns {string} - the lines read joined as a {string} + * @memberof Reader + */ + Reader.prototype.read = function () { + return this.$read() + }; + + /** + * Advance to the next line by discarding the line at the front of the stack. + * + * @returns {boolean} - a Boolean indicating whether there was a line to discard. + * @memberof Reader + */ + Reader.prototype.advance = function () { + return this.$advance() + }; + + // Cursor API + + /** @namespace */ + const Cursor = Opal.Asciidoctor.Reader.Cursor; + + /** + * Get the file associated to the cursor. + * @returns {string|undefined} + * @memberof Cursor + */ + Cursor.prototype.getFile = function () { + const file = this.file; + return file === Opal.nil ? undefined : file + }; + + /** + * Get the directory associated to the cursor. + * @returns {string|undefined} - the directory associated to the cursor + * @memberof Cursor + */ + Cursor.prototype.getDirectory = function () { + const dir = this.dir; + return dir === Opal.nil ? undefined : dir + }; + + /** + * Get the path associated to the cursor. + * @returns {string|undefined} - the path associated to the cursor (or '<stdin>') + * @memberof Cursor + */ + Cursor.prototype.getPath = function () { + const path = this.path; + return path === Opal.nil ? undefined : path + }; + + /** + * Get the line number of the cursor. + * @returns {number|undefined} - the line number of the cursor + * @memberof Cursor + */ + Cursor.prototype.getLineNumber = function () { + return this.lineno + }; + + // Logger API (available in Asciidoctor 1.5.7+) + + function initializeLoggerFormatterClass (className, functions) { + const superclass = Opal.const_get_qualified(Opal.Logger, 'Formatter'); + return initializeClass(superclass, className, functions, {}, { + call: function (args) { + for (let i = 0; i < args.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof args[i] === 'object' && '$$smap' in args[i]) { + args[i] = fromHash(args[i]); + } + } + return args + } + }) + } + + function initializeLoggerClass (className, functions) { + const superClass = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger'); + return initializeClass(superClass, className, functions, {}, { + add: function (args) { + if (args.length >= 2 && typeof args[2] === 'object' && '$$smap' in args[2]) { + const message = args[2]; + const messageObject = fromHash(message); + messageObject.getText = function () { + return this.text + }; + messageObject.getSourceLocation = function () { + return this.source_location + }; + messageObject.$inspect = function () { + const sourceLocation = this.getSourceLocation(); + if (sourceLocation) { + return sourceLocation.getPath() + ': line ' + sourceLocation.getLineNumber() + ': ' + this.getText() + } else { + return this.getText() + } + }; + args[2] = messageObject; + } + if (args.length >= 1) { + args[1] = args[1] === Opal.nil ? undefined : args[1]; + } + return args + } + }) + } + + /** + * @namespace + */ + const LoggerManager = Opal.const_get_qualified(Opal.Asciidoctor, 'LoggerManager', true); + + // Alias + Opal.Asciidoctor.LoggerManager = LoggerManager; + + /** + * @memberof LoggerManager + */ + LoggerManager.getLogger = function () { + return this.$logger() + }; + + /** + * @memberof LoggerManager + */ + LoggerManager.setLogger = function (logger) { + this['$logger='](logger); + }; + + /** + * @memberof LoggerManager + */ + LoggerManager.newLogger = function (name, functions) { + return initializeLoggerClass(name, functions).$new() + }; + + /** + * @memberof LoggerManager + */ + LoggerManager.newFormatter = function (name, functions) { + return initializeLoggerFormatterClass(name, functions).$new() + }; + + /** + * @namespace + */ + const LoggerSeverity = Opal.const_get_qualified(Opal.Logger, 'Severity', true); + + // Alias + Opal.Asciidoctor.LoggerSeverity = LoggerSeverity; + + /** + * @memberof LoggerSeverity + */ + LoggerSeverity.get = function (severity) { + return LoggerSeverity.$constants()[severity] + }; + + /** + * @namespace + */ + const LoggerFormatter = Opal.const_get_qualified(Opal.Logger, 'Formatter', true); + + // Alias + Opal.Asciidoctor.LoggerFormatter = LoggerFormatter; + + /** + * @memberof LoggerFormatter + */ + LoggerFormatter.prototype.call = function (severity, time, programName, message) { + return this.$call(LoggerSeverity.get(severity), time, programName, message) + }; + + /** + * @namespace + */ + const MemoryLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'MemoryLogger', true); + + // Alias + Opal.Asciidoctor.MemoryLogger = MemoryLogger; + + /** + * Create a new MemoryLogger. + * @returns {MemoryLogger} - a MemoryLogger + * @memberof MemoryLogger + */ + MemoryLogger.create = function () { + return this.$new() + }; + + /** + * @returns {Array<Object>} - a list of messages + * @memberof MemoryLogger + */ + MemoryLogger.prototype.getMessages = function () { + const messages = this.messages; + const result = []; + for (let i = 0; i < messages.length; i++) { + const message = messages[i]; + const messageObject = fromHash(message); + if (typeof messageObject.message === 'string') { + messageObject.getText = function () { + return this.message + }; + } else { + // also convert the message attribute + messageObject.message = fromHash(messageObject.message); + messageObject.getText = function () { + return this.message.text + }; + } + messageObject.getSeverity = function () { + return this.severity.toString() + }; + messageObject.getSourceLocation = function () { + return this.message.source_location + }; + result.push(messageObject); + } + return result + }; + + const Logging = Opal.const_get_qualified(Opal.Asciidoctor, 'Logging', true); + + Opal.Asciidoctor.Logging = Logging; + + Logging.getLogger = function () { + return LoggerManager.$logger() + }; + + Logging.createLogMessage = function (text, context) { + return Logging.prototype.$message_with_context(text, toHash(context)) + }; + + // alias + + /** + * @memberof Reader + */ + Reader.prototype.getLogger = Logging.getLogger; + /** + * @memberof Reader + */ + Reader.prototype.createLogMessage = Logging.createLogMessage; + + /** + * @memberof AbstractNode + */ + AbstractNode.prototype.getLogger = Logging.getLogger; + /** + * @memberof AbstractNode + */ + AbstractNode.prototype.createLogMessage = Logging.createLogMessage; + + /** + * @namespace + */ + const Logger = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger', true); + + // Alias + Opal.Asciidoctor.Logger = Logger; + + /** + * @returns {number|undefined} - the maximum severity + * @memberof Logger + */ + Logger.prototype.getMaxSeverity = function () { + const result = this.max_severity; + return result === Opal.nil ? undefined : result + }; + /** + * @returns {LoggerFormatter} - the formatter + * @memberof Logger + */ + Logger.prototype.getFormatter = function () { + return this.formatter + }; + /** + * @param {LoggerFormatter} formatter - the formatter + * @memberof Logger + */ + Logger.prototype.setFormatter = function (formatter) { + this.formatter = formatter; + }; + /** + * @returns {number} - the logging severity threshold + * @memberof Logger + */ + Logger.prototype.getLevel = function () { + return this.level + }; + /** + * @param {number} level - the logging severity threshold + * @memberof Logger + */ + Logger.prototype.setLevel = function (level) { + this.level = level; + }; + /** + * @returns {string} - the program name + * @memberof Logger + */ + Logger.prototype.getProgramName = function () { + return this.progname + }; + /** + * @param {string} programName - the program name + * @memberof Logger + */ + Logger.prototype.setProgramName = function (programName) { + this.progname = programName; + }; + + const RubyLogger = Opal.const_get_qualified('::', 'Logger'); + + const log = function (logger, level, message) { + logger['$' + level](message); + }; + RubyLogger.prototype.add = function (severity, message, programName) { + const severityValue = typeof severity === 'string' ? LoggerSeverity[severity.toUpperCase()] : severity; + this.$add(severityValue, message, programName); + }; + RubyLogger.prototype.log = RubyLogger.prototype.add; + RubyLogger.prototype.debug = function (message) { + log(this, 'debug', message); + }; + RubyLogger.prototype.info = function (message) { + log(this, 'info', message); + }; + RubyLogger.prototype.warn = function (message) { + log(this, 'warn', message); + }; + RubyLogger.prototype.error = function (message) { + log(this, 'error', message); + }; + RubyLogger.prototype.fatal = function (message) { + log(this, 'fatal', message); + }; + RubyLogger.prototype.isDebugEnabled = function () { + return this['$debug?']() + }; + RubyLogger.prototype.isInfoEnabled = function () { + return this['$info?']() + }; + RubyLogger.prototype.isWarnEnabled = function () { + return this['$warn?']() + }; + RubyLogger.prototype.isErrorEnabled = function () { + return this['$error?']() + }; + RubyLogger.prototype.isFatalEnabled = function () { + return this['$fatal?']() + }; + + /** + * @namespace + */ + const NullLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'NullLogger', true); + + // Alias + Opal.Asciidoctor.NullLogger = NullLogger; + + /** + * Create a new NullLogger. + * @returns {NullLogger} - a NullLogger + * @memberof NullLogger + */ + NullLogger.create = function () { + return this.$new() + }; + + /** + * @returns {number|undefined} - the maximum severity + * @memberof NullLogger + */ + NullLogger.prototype.getMaxSeverity = function () { + return this.max_severity + }; + + // Alias + Opal.Asciidoctor.StopIteration = Opal.StopIteration; + + /** + * @namespace + */ + const Timings = Opal.const_get_qualified(Opal.Asciidoctor, 'Timings', true); + + // Alias + Opal.Asciidoctor.Timings = Timings; + + /** + * Create a new Timings. + * @returns {Timings} - a Timings + * @memberof Timings + */ + Timings.create = function () { + return this.$new() + }; + + /** + * Print a report to the specified output. + * The report will include: + * - the time to read and parse source + * - the time to convert document + * - the total time (read, parse and convert) + * @param {RubyLogger|console|Object} [to] - an optional output (by default stdout) + * @param {string} [subject] - an optional subject (usually the file name) + * @memberof Timings + */ + Timings.prototype.printReport = function (to, subject) { + let outputFunction; + if (to) { + if (typeof to.$add === 'function') { + outputFunction = function (message) { + to.$add(1, message); + }; + } else if (typeof to.log === 'function') { + outputFunction = to.log; + } else if (typeof to.write === 'function') { + outputFunction = function (message) { + to.write(message, 'utf-8'); + }; + } else { + throw new Error('The output should be a Stream (with a write function), an object with a log function or a Ruby Logger (with a add function)') + } + } else { + outputFunction = function (message) { + Opal.gvars.stdout.$write(message); + }; + } + if (subject) { + outputFunction('Input file: ' + subject); + } + outputFunction(' Time to read and parse source: ' + this.$read_parse().toFixed(2)); + outputFunction(' Time to convert document: ' + this.$convert().toFixed(2)); + outputFunction(' Total time (read, parse and convert): ' + this.$read_parse_convert().toFixed(2)); + }; + + /** + * @namespace + * @description + * This API is experimental and subject to change. + * + * A pluggable adapter for integrating a syntax (aka code) highlighter into AsciiDoc processing. + * + * There are two types of syntax highlighter adapters. The first performs syntax highlighting during the convert phase. + * This adapter type must define a "handlesHighlighting" method that returns true. + * The companion "highlight" method will then be called to handle the "specialcharacters" substitution for source blocks. + * + * The second assumes syntax highlighting is performed on the client (e.g., when the HTML document is loaded). + * This adapter type must define a "hasDocinfo" method that returns true. + * The companion "docinfo" method will then be called to insert markup into the output document. + * The docinfo functionality is available to both adapter types. + * + * Asciidoctor.js provides several a built-in adapter for highlight.js. + * Additional adapters can be registered using SyntaxHighlighter.register. + */ + const SyntaxHighlighter = Opal.const_get_qualified(Opal.Asciidoctor, 'SyntaxHighlighter', true); + + // Alias + Opal.Asciidoctor.SyntaxHighlighter = SyntaxHighlighter; + + /** + * Associates the syntax highlighter class or object with the specified names. + * + * @description This API is experimental and subject to change. + * + * @param {string|Array} names - A {string} name or an {Array} of {string} names + * @param functions - A list of functions representing a {SyntaxHighlighter} or a {SyntaxHighlighter} class to instantiate + * @memberof SyntaxHighlighter + */ + SyntaxHighlighter.register = function (names, functions) { + const name = typeof names === 'string' ? names : names[0]; + if (typeof functions === 'function') { + const classObject = functions; + const prototype = classObject.prototype; + const properties = Object.getOwnPropertyNames(prototype); + functions = {}; + for (const propertyIdx in properties) { + const propertyName = properties[propertyIdx]; + functions[propertyName] = prototype[propertyName]; + } + } + const scope = initializeClass(SyntaxHighlighterBase, name, functions, {}, { + format: function (args) { + if (args.length >= 2 && typeof args[2] === 'object' && '$$smap' in args[2]) { + args[2] = fromHash(args[2]); + } + if (args.length >= 1) { + args[1] = args[1] === Opal.nil ? undefined : args[1]; + } + return args + }, + highlight: function (args) { + if (args.length >= 3 && typeof args[3] === 'object' && '$$smap' in args[3]) { + let opts = args[3]; + opts = fromHash(opts); + for (const key in opts) { + const value = opts[key]; + if (key === 'callouts') { + const callouts = fromHashKeys(value); + for (const idx in callouts) { + const callout = callouts[idx]; + for (let i = 0; i < callout.length; i++) { + const items = callout[i]; + for (let j = 0; j < items.length; j++) { + items[j] = items[j] === Opal.nil ? undefined : items[j]; + } + } + } + opts[key] = callouts; + } else { + opts[key] = value === Opal.nil ? undefined : value; + } + } + args[3] = opts; + } + if (args.length >= 2) { + args[2] = args[2] === Opal.nil ? undefined : args[2]; + } + return args + } + }); + for (const functionName in functions) { + if (Object.prototype.hasOwnProperty.call(functions, functionName)) { + (function (functionName) { + const userFunction = functions[functionName]; + if (functionName === 'handlesHighlighting') { + Opal.def(scope, '$highlight?', function () { + return userFunction.call() + }); + } else if (functionName === 'hasDocinfo') { + Opal.def(scope, '$docinfo?', function (location) { + return userFunction.apply(this, [location]) + }); + } + }(functionName)); + } + } + Opal.def(scope, '$name', function () { + return name + }); + SyntaxHighlighter.$register(scope, names); + return scope + }; + + /** + * Retrieves the syntax highlighter class or object registered for the specified name. + * + * @description This API is experimental and subject to change. + * + * @param {string} name - The {string} name of the syntax highlighter to retrieve. + * @returns {SyntaxHighlighter} - the {SyntaxHighlighter} registered for this name. + * @memberof SyntaxHighlighter + */ + SyntaxHighlighter.get = function (name) { + const result = SyntaxHighlighter.$for(name); + return result === Opal.nil ? undefined : result + }; + + /** + * @deprecated Please use {SyntaxHighlighter#get} method as "for" is a reserved keyword. + */ + SyntaxHighlighter.for = SyntaxHighlighter.get; + + /** + * @namespace + */ + const SyntaxHighlighterBase = Opal.const_get_qualified(SyntaxHighlighter, 'Base', true); + + // Alias + Opal.Asciidoctor.SyntaxHighlighterBase = SyntaxHighlighterBase; + + /** + * Statically register the current class in the registry for the specified names. + * + * @description This API is experimental and subject to change. + * + * @param {string|Array<string>} names - A {string} name or an {Array} of {string} names + * @memberof SyntaxHighlighterBase + */ + SyntaxHighlighterBase.prototype.registerFor = function (names) { + SyntaxHighlighter.$register(this, names); + }; + + // Table API + + /** + * Methods for managing AsciiDoc tables. + * @namespace + * @extends AbstractBlock + */ + const Table = Opal.Asciidoctor.Table; + + /** + * Create a new Table element. + * @param {AbstractBlock} parent + * @param {Object|undefined} attributes + * @returns {Table} - a new {Table} object + */ + Table.create = function (parent, attributes) { + return this.$new(parent, toHash(attributes)) + }; + + /** + * Get the caption of the table. + * @returns {string} + * @memberof Table + */ + Table.prototype.getCaption = function () { + return this.caption + }; + + /** + * Get the rows of this table. + * @returns {Table.Rows} - an {Table.Rows} object with the members "head", "body" and "foot" + * @memberof Table + */ + Table.prototype.getRows = function () { + return this.rows + }; + + /** + * Get the columns of this table. + * @returns {Array<Column>} + * @memberof Table + */ + Table.prototype.getColumns = function () { + return this.columns + }; + + /** + * Get the head rows of this table. + * @returns {Array<Array<Cell>>} - an Array of Array of Cell + * @memberof Table + */ + Table.prototype.getHeadRows = function () { + return this.rows.head + }; + + /** + * Check if the table has a head rows. + * @returns {boolean} + * @memberof Table + */ + Table.prototype.hasHeadRows = function () { + return this.rows !== Opal.nil && this.rows.head.length > 0 + }; + + /** + * Get the body rows of this table. + * @returns {Array<Array<Cell>>} - an Array of Array of Cell + * @memberof Table + */ + Table.prototype.getBodyRows = function () { + return this.rows.body + }; + + /** + * Check if the table has a body rows. + * @returns {boolean} + */ + Table.prototype.hasBodyRows = function () { + return this.rows !== Opal.nil && this.rows.body.length > 0 + }; + + /** + * Get the foot rows of this table. + * @returns {Array<Array<Cell>>} - an Array of Array of Cell + * @memberof Table + */ + Table.prototype.getFootRows = function () { + return this.rows.foot + }; + + /** + * Check if the table has a foot rows. + * @returns {boolean} + */ + Table.prototype.hasFootRows = function () { + return this.rows !== Opal.nil && this.rows.foot.length > 0 + }; + + /** + * Check if the table has a header option set. + * @returns {boolean} + * @memberof Table + */ + Table.prototype.hasHeaderOption = function () { + return this.has_header_option + }; + + /** + * Check if the table has the footer option set. + * @returns {boolean} + * @memberof Table + */ + Table.prototype.hasFooterOption = function () { + return this.isOption('footer') + }; + + /** + * Check if the table has the autowidth option set. + * @returns {boolean} + * @memberof Table + */ + Table.prototype.hasAutowidthOption = function () { + return this.isOption('autowidth') + }; + + /** + * Get the number of rows in the table. + * Please note that the header and footer rows are also counted. + * @returns {number|undefined} + * @memberof Table + */ + Table.prototype.getRowCount = function () { + return this.getAttribute('rowcount') + }; + + /** + * Set the number of rows in the table. + * Please note that the header and footer rows are also counted. + * @param {number} value - the value + * @memberof Table + */ + Table.prototype.setRowCount = function (value) { + this.setAttribute('rowcount', value); + }; + + /** + * Get the number of columns in the table. + * @returns {number|undefined} + * @memberof Table + */ + Table.prototype.getColumnCount = function () { + return this.getAttribute('colcount') + }; + + /** + * Set the number of columns in the table. + * @param {number} value - the value + * @memberof Table + */ + Table.prototype.setColumnCount = function (value) { + this.setAttribute('colcount', value); + }; + + // Rows + + /** + * @namespace + */ + const Rows = Opal.Asciidoctor.Table.Rows; + + /** + * Create a new Rows element. + * @param {array<array<Cell>>} head + * @param {array<array<Cell>>} foot + * @param {array<array<Cell>>} body + * @returns Rows + */ + Rows.create = function (head, foot, body) { + return this.$new(head, foot, body) + }; + + /** + * Get head rows. + * @returns {array<array<Cell>>} + */ + Rows.prototype.getHead = function () { + return this.head + }; + + /** + * Get foot rows. + * @returns {array<array<Cell>>} + */ + Rows.prototype.getFoot = function () { + return this.foot + }; + + /** + * Get body rows. + * @returns {array<array<Cell>>} + */ + Rows.prototype.getBody = function () { + return this.body + }; + + /** + * Retrieve the rows grouped by section as a nested Array. + * + * Creates a 2-dimensional array of two element entries. + * The first element is the section name as a string. + * The second element is the Array of rows in that section. + * The entries are in document order (head, foot, body). + * @returns {[[string, array<array<Cell>>], [string, array<array<Cell>>], [string, array<array<Cell>>]]} + */ + Rows.prototype.bySection = function () { + return [['head', this.head], ['body', this.body], ['foot', this.foot]] + }; + + // Table Column + + /** + * Methods to manage the columns of an AsciiDoc table. + * In particular, it keeps track of the column specs. + * @namespace + * @extends AbstractNode + */ + const Column = Opal.Asciidoctor.Table.Column; + + /** + * Create a new Column element. + * @param {Table} table + * @param {number} index + * @param {Object|undefined} attributes + * @returns Column + */ + Column.create = function (table, index, attributes) { + return this.$new(table, index, toHash(attributes)) + }; + + /** + * Get the column number of this cell. + * @returns {number|undefined} + * @memberof Column + */ + Column.prototype.getColumnNumber = function () { + return this.getAttribute('colnumber') + }; + + /** + * Get the width of this cell. + * @returns {string|undefined} + * @memberof Column + */ + Column.prototype.getWidth = function () { + return this.getAttribute('width') + }; + + /** + * Get the horizontal align of this cell. + * @returns {string|undefined} + * @memberof Column + */ + Column.prototype.getHorizontalAlign = function () { + return this.getAttribute('halign') + }; + + /** + * Get the vertical align of this cell. + * @returns {string|undefined} + * @memberof Column + */ + Column.prototype.getVerticalAlign = function () { + return this.getAttribute('valign') + }; + + /** + * Get the style of this cell. + * @returns {string} + * @memberof Column + */ + Column.prototype.getStyle = function () { + const style = this.style; + return style === Opal.nil ? undefined : style + }; + + // Table Cell + + /** + * Methods for managing the cells in an AsciiDoc table. + * @namespace + * @extends AbstractBlock + */ + const Cell = Opal.Asciidoctor.Table.Cell; + + /** + * Create a new Cell element + * @param {Column} column + * @param {string} cellText + * @param {Object|undefined} attributes + * @param {Object|undefined} opts + * @returns {Cell} + */ + Cell.create = function (column, cellText, attributes, opts) { + return this.$new(column, cellText, toHash(attributes), toHash(opts)) + }; + + /** + * Get the column span of this {@link Cell} node. + * @returns {number} - An Integer of the number of columns this cell will span (default: undefined) + * @memberof Cell + */ + Cell.prototype.getColumnSpan = function () { + const colspan = this.colspan; + return colspan === Opal.nil ? undefined : colspan + }; + + /** + * Set the column span of this {@link Cell} node. + * @param {number} value + * @returns {number} - The new colspan value + * @memberof Cell + */ + Cell.prototype.setColumnSpan = function (value) { + return this['$colspan='](value) + }; + + /** + * Get the row span of this {@link Cell} node + * @returns {number|undefined} - An Integer of the number of rows this cell will span (default: undefined) + * @memberof Cell + */ + Cell.prototype.getRowSpan = function () { + const rowspan = this.rowspan; + return rowspan === Opal.nil ? undefined : rowspan + }; + + /** + * Set the row span of this {@link Cell} node + * @param {number} value + * @returns {number} - The new rowspan value + * @memberof Cell + */ + Cell.prototype.setRowSpan = function (value) { + return this['$rowspan='](value) + }; + + /** + * Get the content of the cell. + * This method should not be used for cells in the head row or that have the literal style. + * @returns {string} + * @memberof Cell + */ + Cell.prototype.getContent = function () { + return this.$content() + }; + + /** + * Get the text of the cell. + * @returns {string} + * @memberof Cell + */ + Cell.prototype.getText = function () { + return this.$text() + }; + + /** + * Get the source of the cell. + * @returns {string} + * @memberof Cell + */ + Cell.prototype.getSource = function () { + return this.$source() + }; + + /** + * Get the lines of the cell. + * @returns {Array<string>} + * @memberof Cell + */ + Cell.prototype.getLines = function () { + return this.$lines() + }; + + /** + * Get the line number of the cell. + * @returns {number|undefined} + * @memberof Cell + */ + Cell.prototype.getLineNumber = function () { + const lineno = this.$lineno(); + return lineno === Opal.nil ? undefined : lineno + }; + + /** + * Get the source file of the cell. + * @returns {string|undefined} + * @memberof Cell + */ + Cell.prototype.getFile = function () { + const file = this.$file(); + return file === Opal.nil ? undefined : file + }; + + /** + * Get the style of the cell. + * @returns {string|undefined} + * @memberof Cell + */ + Cell.prototype.getStyle = function () { + const style = this.$style(); + return style === Opal.nil ? undefined : style + }; + + /** + * Get the column of this cell. + * @returns {Column|undefined} + * @memberof Cell + */ + Cell.prototype.getColumn = function () { + const column = this.$column(); + return column === Opal.nil ? undefined : column + }; + + /** + * Get the width of this cell. + * @returns {string|undefined} + * @memberof Cell + */ + Cell.prototype.getWidth = function () { + return this.getAttribute('width') + }; + + /** + * Get the column width in percentage of this cell. + * @returns {string|undefined} + * @memberof Cell + */ + Cell.prototype.getColumnPercentageWidth = function () { + return this.getAttribute('colpcwidth') + }; + + /** + * Get the nested {Document} of this cell when style is 'asciidoc'. + * @returns {Document|undefined} - the nested {Document} + * @memberof Cell + */ + Cell.prototype.getInnerDocument = function () { + const innerDocument = this.inner_document; + return innerDocument === Opal.nil ? undefined : innerDocument + }; + + // Templates + + /** + * @description + * This API is experimental and subject to change. + * + * Please note that this API is currently only available in a Node environment. + * We recommend to use a custom converter if you are running in the browser. + * + * @namespace + * @module Converter/TemplateConverter + */ + const TemplateConverter = Opal.Asciidoctor.Converter.TemplateConverter; + + if (TemplateConverter) { + // Alias + Opal.Asciidoctor.TemplateConverter = TemplateConverter; + + /** + * Create a new TemplateConverter. + * @param {string} backend - the backend name + * @param templateDirectories - a list of template directories + * @param {Object} opts - a JSON of options + * @param {string} opts.template_engine - the name of the template engine + * @param {Object} [opts.template_cache] - an optional template cache + * @param {Object} [opts.template_cache.scans] - a JSON of template objects keyed by template name keyed by path patterns + * @param {Object} [opts.template_cache.templates] - a JSON of template objects keyed by file paths + * @returns {TemplateConverter} + * @memberof Converter/TemplateConverter + */ + TemplateConverter.create = function (backend, templateDirectories, opts) { + if (opts && opts.template_cache) { + opts.template_cache = toHash(opts.template_cache); + } + this.$new(backend, templateDirectories, toHash(opts)); + }; + + /** + * @returns {Object} - The global cache + * @memberof Converter/TemplateConverter + */ + TemplateConverter.getCache = function () { + const caches = fromHash(this.caches); + if (caches) { + if (caches.scans) { + caches.scans = fromHash(caches.scans); + for (const key in caches.scans) { + caches.scans[key] = fromHash(caches.scans[key]); + } + } + if (caches.templates) { + caches.templates = fromHash(caches.templates); + } + } + return caches + }; + + /** + * Clear the global cache. + * @memberof Converter/TemplateConverter + */ + TemplateConverter.clearCache = function () { + this.$clear_caches(); + }; + + /** + * Convert an {AbstractNode} to the backend format using the named template. + * + * Looks for a template that matches the value of the template name or, + * if the template name is not specified, the value of the {@see AbstractNode.getNodeName} function. + * + * @param {AbstractNode} node - the AbstractNode to convert + * @param {string} templateName - the {string} name of the template to use, or the node name of the node if a template name is not specified. (optional, default: undefined) + * @param {Object} opts - an optional JSON that is passed as local variables to the template. (optional, default: undefined) + * @returns {string} - The {string} result from rendering the template + * @memberof Converter/TemplateConverter + */ + TemplateConverter.prototype.convert = function (node, templateName, opts) { + return this.$convert(node, templateName, toHash(opts)) + }; + + /** + * Checks whether there is a template registered with the specified name. + * + * @param {string} name - the {string} template name + * @returns {boolean} - a {boolean} that indicates whether a template is registered for the specified template name. + * @memberof Converter/TemplateConverter + */ + TemplateConverter.prototype.handles = function (name) { + return this['$handles?'](name) + }; + + /** + * Converts the {AbstractNode} using only its converted content. + * + * @param {AbstractNode} node + * @returns {string} - the converted {string} content. + * @memberof Converter/TemplateConverter + */ + TemplateConverter.prototype.getContentOnly = function (node) { + return this.$content_only(node) + }; + + /** + * Skips conversion of the {AbstractNode}. + * + * @param {AbstractNode} node + * @memberof Converter/TemplateConverter + */ + TemplateConverter.prototype.skip = function (node) { + this.$skip(node); + }; + + /** + * Retrieves the templates that this converter manages. + * + * @returns {Object} - a JSON of template objects keyed by template name + * @memberof Converter/TemplateConverter + */ + TemplateConverter.prototype.getTemplates = function () { + return fromHash(this.$templates()) + }; + + /** + * Registers a template with this converter. + * + * @param {string} name - the {string} template name + * @param {Object} template - the template object to register + * @returns {Object} - the template object + * @memberof Converter/TemplateConverter + */ + TemplateConverter.prototype.register = function (name, template) { + return this.$register(name, template) + }; + + /** + * @namespace + * @description + * This API is experimental and subject to change. + * + * Please note that this API is currently only available in a Node environment. + * We recommend to use a custom converter if you are running in the browser. + * + * A pluggable adapter for integrating a template engine into the built-in template converter. + */ + const TemplateEngine = {}; + TemplateEngine.registry = {}; + + // Alias + Opal.Asciidoctor.TemplateEngine = TemplateEngine; + + /** + * Register a template engine adapter for the given names. + * @param {string|Array} names - a {string} name or an {Array} of {string} names + * @param {Object} templateEngineAdapter - a template engine adapter instance + * @example + * const fs = require('fs') + * class DotTemplateEngineAdapter { + * constructor () { + * this.doT = require('dot') + * } + * compile (file, _) { + * const templateFn = this.doT.template(fs.readFileSync(file, 'utf8')) + * return { + * render: templateFn + * } + * } + * } + * asciidoctor.TemplateEngine.register('dot, new DotTemplateEngineAdapter()) + * @memberof TemplateEngine + */ + TemplateEngine.register = function (names, templateEngineAdapter) { + if (typeof names === 'string') { + this.registry[names] = templateEngineAdapter; + } else { + // array + for (let i = 0; i < names.length; i++) { + const name = names[i]; + this.registry[name] = templateEngineAdapter; + } + } + }; + } + + /** + * @namespace + * @module Converter/CompositeConverter + */ + const CompositeConverter = Opal.Asciidoctor.Converter.CompositeConverter; + + if (CompositeConverter) { + // Alias + Opal.Asciidoctor.CompositeConverter = CompositeConverter; + + /** + * Delegates to the first converter that identifies itself as the handler for the given transform. + * The optional Hash is passed as the last option to the delegate's convert method. + * + * @param node - the AbstractNode to convert + * @param [transform] - the optional {string} transform, or the name of the node if no transform is specified. (optional, default: undefined) + * @param [opts] - an optional JSON that is passed as local variables to the template. (optional, default: undefined) + * @returns The {string} result from the delegate's convert method + * @memberof Converter/CompositeConverter + */ + CompositeConverter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, toHash(opts)) + }; + + /** + * Converts the {AbstractNode} using only its converted content. + * + * @param {AbstractNode} node + * @returns {string} - the converted {string} content. + * @memberof Converter/CompositeConverter + */ + CompositeConverter.prototype.getContentOnly = function (node) { + return this.$content_only(node) + }; + + /** + * Skips conversion of the {AbstractNode}. + * + * @param {AbstractNode} node + * @memberof Converter/CompositeConverter + */ + CompositeConverter.prototype.skip = function (node) { + this.$skip(node); + }; + + /** + * Get the Array of Converter objects in the chain. + * @returns {[Converter]} + * @memberof Converter/CompositeConverter + */ + CompositeConverter.prototype.getConverters = function () { + return this.converters + }; + + /** + * Retrieve the converter for the specified transform. + * @param transform + * @returns {Converter|undefined} + * @memberof Converter/CompositeConverter + */ + CompositeConverter.prototype.getConverter = function (transform) { + const converter = this.$converter_for(transform); + return converter === Opal.nil ? undefined : converter + }; + + /** + * Find the converter for the specified transform. + * Throw an exception if no converter is found. + * + * @param transform + * @returns {Converter} - the matching converter + * @throws Error if no converter is found + * @memberof Converter/CompositeConverter + */ + CompositeConverter.prototype.findConverter = function (transform) { + return this.$find_converter(transform) + }; + } + + // Converter API + + /** + * @namespace + * @module Converter + */ + const Converter = Opal.const_get_qualified(Opal.Asciidoctor, 'Converter'); + + // Alias + Opal.Asciidoctor.Converter = Converter; + + /** + * Convert the specified node. + * + * @param {AbstractNode} node - the AbstractNode to convert + * @param {string} transform - an optional String transform that hints at + * which transformation should be applied to this node. + * @param {Object} opts - a JSON of options that provide additional hints about how to convert the node (default: {}) + * @returns the {Object} result of the conversion, typically a {string}. + * @memberof Converter + */ + Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, toHash(opts)) + }; + + /** + * Create an instance of the converter bound to the specified backend. + * + * @param {string} backend - look for a converter bound to this keyword. + * @param {Object} opts - a JSON of options to pass to the converter (default: {}) + * @returns {Converter} - a converter instance for converting nodes in an Asciidoctor AST. + * @memberof Converter + */ + Converter.create = function (backend, opts) { + return this.$create(backend, toHash(opts)) + }; + + // Converter Factory API + + /** + * @namespace + * @module Converter/Factory + */ + const ConverterFactory = Opal.Asciidoctor.Converter.Factory; + + const ConverterBase = Opal.Asciidoctor.Converter.Base; + + // Alias + Opal.Asciidoctor.ConverterFactory = ConverterFactory; + + const ConverterBackendTraits = Opal.Asciidoctor.Converter.BackendTraits; + + // Alias + Opal.Asciidoctor.ConverterBackendTraits = ConverterBackendTraits; + + /** + * Register a custom converter in the global converter factory to handle conversion to the specified backends. + * If the backend value is an asterisk, the converter is used to handle any backend that does not have an explicit converter. + * + * @param converter - The Converter instance to register + * @param backends {Array} - A {string} {Array} of backend names that this converter should be registered to handle (optional, default: ['*']) + * @return {*} - Returns nothing + * @memberof Converter/Factory + */ + ConverterFactory.register = function (converter, backends) { + const args = [bridgeConverter(converter)].concat(backends); + return Converter.$register.apply(Converter, args) + }; + + /** + * Retrieves the singleton instance of the converter factory. + * + * @param {boolean} initialize - instantiate the singleton if it has not yet + * been instantiated. If this value is false and the singleton has not yet been + * instantiated, this method returns a fresh instance. + * @returns {Converter/Factory} an instance of the converter factory. + * @memberof Converter/Factory + */ + ConverterFactory.getDefault = function (initialize) { + return this.$default(initialize) + }; + + /** + * Create an instance of the converter bound to the specified backend. + * + * @param {string} backend - look for a converter bound to this keyword. + * @param {Object} opts - a JSON of options to pass to the converter (default: {}) + * @returns {Converter} - a converter instance for converting nodes in an Asciidoctor AST. + * @memberof Converter/Factory + */ + ConverterFactory.prototype.create = function (backend, opts) { + return this.$create(backend, toHash(opts)) + }; + + /** + * Get the converter registry. + * @returns the registry of converter instances or classes keyed by backend name + * @memberof Converter/Factory + */ + ConverterFactory.getRegistry = function () { + return fromHash(Converter.$registry()) + }; + + /** + * Lookup the custom converter registered with this factory to handle the specified backend. + * + * @param {string} backend - The {string} backend name. + * @returns the {Converter} class or instance registered to convert the specified backend or undefined if no match is found. + * @memberof Converter/Factory + */ + ConverterFactory.for = function (backend) { + const converter = Converter.$for(backend); + return converter === Opal.nil ? undefined : converter + }; + + /* + * Unregister any custom converter classes that are registered with this factory. + * Intended for testing only! + */ + ConverterFactory.unregisterAll = function () { + const internalRegistry = Converter.DefaultFactory.$$cvars['@@registry']; + Converter.DefaultFactory.$$cvars['@@registry'] = toHash({ html5: internalRegistry['$[]']('html5') }); + }; + + // Built-in converter + + /** + * @namespace + * @module Converter/Html5Converter + */ + const Html5Converter = Opal.Asciidoctor.Converter.Html5Converter; + + // Alias + Opal.Asciidoctor.Html5Converter = Html5Converter; + + /** + * Create a new Html5Converter. + * @returns {Html5Converter} - a Html5Converter + * @memberof Converter/Html5Converter + */ + Html5Converter.create = function () { + return this.$new() + }; + + /** + * Converts an {AbstractNode} using the given transform. + * This method must be implemented by a concrete converter class. + * + * @param {AbstractNode} node - The concrete instance of AbstractNode to convert. + * @param {string} [transform] - An optional String transform that hints at which transformation should be applied to this node. + * If a transform is not given, the transform is often derived from the value of the {AbstractNode#getNodeName} property. (optional, default: undefined) + * @param {Object} [opts]- An optional JSON of options hints about how to convert the node. (optional, default: undefined) + * + * @returns {string} - the String result. + * @memberof Converter/Html5Converter + */ + Html5Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, opts) + }; + + /* global Opal, fromHash, toHash, initializeClass */ + // Extensions API + + /** + * @private + */ + const toBlock = function (block) { + // arity is a mandatory field + block.$$arity = block.length; + return block + }; + + const registerExtension = function (registry, type, processor, name) { + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return registry['$' + type](processor, name) + } else { + // processor is a function/lambda + return Opal.send(registry, type, name && [name], toBlock(processor)) + } + }; + + /** + * @namespace + * @description + * Extensions provide a way to participate in the parsing and converting + * phases of the AsciiDoc processor or extend the AsciiDoc syntax. + * + * The various extensions participate in AsciiDoc processing as follows: + * + * 1. After the source lines are normalized, {{@link Extensions/Preprocessor}}s modify or replace + * the source lines before parsing begins. {{@link Extensions/IncludeProcessor}}s are used to + * process include directives for targets which they claim to handle. + * 2. The Parser parses the block-level content into an abstract syntax tree. + * Custom blocks and block macros are processed by associated {{@link Extensions/BlockProcessor}}s + * and {{@link Extensions/BlockMacroProcessor}}s, respectively. + * 3. {{@link Extensions/TreeProcessor}}s are run on the abstract syntax tree. + * 4. Conversion of the document begins, at which point inline markup is processed + * and converted. Custom inline macros are processed by associated {InlineMacroProcessor}s. + * 5. {{@link Extensions/Postprocessor}}s modify or replace the converted document. + * 6. The output is written to the output stream. + * + * Extensions may be registered globally using the {Extensions.register} method + * or added to a custom {Registry} instance and passed as an option to a single + * Asciidoctor processor. + * + * @example + * asciidoctor.Extensions.register(function () { + * this.block(function () { + * const self = this + * self.named('shout') + * self.onContext('paragraph') + * self.process(function (parent, reader) { + * const lines = reader.getLines().map(function (l) { return l.toUpperCase(); }) + * return self.createBlock(parent, 'paragraph', lines) + * }) + * }) + * }) + */ + const Extensions = Opal.const_get_qualified(Opal.Asciidoctor, 'Extensions'); + + // Alias + Opal.Asciidoctor.Extensions = Extensions; + + /** + * Create a new {@link Extensions/Registry}. + * @param {string} name + * @param {function} block + * @memberof Extensions + * @returns {Extensions/Registry} - returns a {@link Extensions/Registry} + */ + Extensions.create = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'create', null, toBlock(name)) + } else if (typeof block === 'function') { + return Opal.send(this, 'create', [name], toBlock(block)) + } else { + return this.$create() + } + }; + + /** + * @memberof Extensions + */ + Extensions.register = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'register', null, toBlock(name)) + } else { + return Opal.send(this, 'register', [name], toBlock(block)) + } + }; + + /** + * Get statically-registered extension groups. + * @memberof Extensions + */ + Extensions.getGroups = function () { + return fromHash(this.$groups()) + }; + + /** + * Unregister all statically-registered extension groups. + * @memberof Extensions + */ + Extensions.unregisterAll = function () { + this.$unregister_all(); + }; + + /** + * Unregister the specified statically-registered extension groups. + * + * NOTE Opal cannot delete an entry from a Hash that is indexed by symbol, so + * we have to resort to using low-level operations in this method. + * + * @memberof Extensions + */ + Extensions.unregister = function () { + const names = Array.prototype.concat.apply([], arguments); + const groups = this.$groups(); + const groupNameIdx = {}; + let i = 0; + const groupSymbolNames = groups.$$keys; + for (; i < groupSymbolNames.length; i++) { + const groupSymbolName = groupSymbolNames[i]; + groupNameIdx[groupSymbolName.toString()] = groupSymbolName; + } + for (let j = 0; j < names.length; j++) { + const groupStringName = names[j]; + if (groupStringName in groupNameIdx) Opal.hash_delete(groups, groupNameIdx[groupStringName]); + } + }; + + /** + * @namespace + * @module Extensions/Registry + */ + const Registry = Extensions.Registry; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.getGroups = Extensions.getGroups; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.unregisterAll = function () { + this.groups = Opal.hash(); + }; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.unregister = Extensions.unregister; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.prefer = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return this.$prefer(name, processor) + } else { + // processor is a function/lambda + return Opal.send(this, 'prefer', name && [name], toBlock(processor)) + } + }; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.block = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block', processor, name) + }; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.inlineMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'inline_macro', processor, name) + }; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.includeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'include_processor', processor, name) + }; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.blockMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block_macro', processor, name) + }; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.treeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'tree_processor', processor, name) + }; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.postprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'postprocessor', processor, name) + }; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.preprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'preprocessor', processor, name) + }; + + /** + * @memberof Extensions/Registry + */ + Registry.prototype.docinfoProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'docinfo_processor', processor, name) + }; + + /** + * Checks whether any {{@link Extensions/Preprocessor}} extensions have been registered. + * + * @memberof Extensions/Registry + * @returns a {boolean} indicating whether any {{@link Extensions/Preprocessor}} extensions are registered. + */ + Registry.prototype.hasPreprocessors = function () { + return this['$preprocessors?']() + }; + + /** + * Checks whether any {{@link Extensions/TreeProcessor}} extensions have been registered. + * + * @memberof Extensions/Registry + * @returns a {boolean} indicating whether any {{@link Extensions/TreeProcessor}} extensions are registered. + */ + Registry.prototype.hasTreeProcessors = function () { + return this['$tree_processors?']() + }; + + /** + * Checks whether any {{@link Extensions/IncludeProcessor}} extensions have been registered. + * + * @memberof Extensions/Registry + * @returns a {boolean} indicating whether any {{@link Extensions/IncludeProcessor}} extensions are registered. + */ + Registry.prototype.hasIncludeProcessors = function () { + return this['$include_processors?']() + }; + + /** + * Checks whether any {{@link Extensions/Postprocessor}} extensions have been registered. + * + * @memberof Extensions/Registry + * @returns a {boolean} indicating whether any {{@link Extensions/Postprocessor}} extensions are registered. + */ + Registry.prototype.hasPostprocessors = function () { + return this['$postprocessors?']() + }; + + /** + * Checks whether any {{@link Extensions/DocinfoProcessor}} extensions have been registered. + * + * @memberof Extensions/Registry + * @param location - A {string} for selecting docinfo extensions at a given location (head or footer) (default: undefined) + * @returns a {boolean} indicating whether any {{@link Extensions/DocinfoProcessor}} extensions are registered. + */ + Registry.prototype.hasDocinfoProcessors = function (location) { + return this['$docinfo_processors?'](location) + }; + + /** + * Checks whether any {{@link Extensions/BlockProcessor}} extensions have been registered. + * + * @memberof Extensions/Registry + * @returns a {boolean} indicating whether any {{@link Extensions/BlockProcessor}} extensions are registered. + */ + Registry.prototype.hasBlocks = function () { + return this['$blocks?']() + }; + + /** + * Checks whether any {{@link Extensions/BlockMacroProcessor}} extensions have been registered. + * + * @memberof Extensions/Registry + * @returns a {boolean} indicating whether any {{@link Extensions/BlockMacroProcessor}} extensions are registered. + */ + Registry.prototype.hasBlockMacros = function () { + return this['$block_macros?']() + }; + + /** + * Checks whether any {{@link Extensions/InlineMacroProcessor}} extensions have been registered. + * + * @memberof Extensions/Registry + * @returns a {boolean} indicating whether any {{@link Extensions/InlineMacroProcessor}} extensions are registered. + */ + Registry.prototype.hasInlineMacros = function () { + return this['$inline_macros?']() + }; + + /** + * Retrieves the Extension proxy objects for all the {{@link Extensions/Preprocessor}} instances stored in this registry. + * + * @memberof Extensions/Registry + * @returns an {array} of Extension proxy objects. + */ + Registry.prototype.getPreprocessors = function () { + return this.$preprocessors() + }; + + /** + * Retrieves the Extension proxy objects for all the {{@link Extensions/TreeProcessor}} instances stored in this registry. + * + * @memberof Extensions/Registry + * @returns an {array} of Extension proxy objects. + */ + Registry.prototype.getTreeProcessors = function () { + return this.$tree_processors() + }; + + /** + * Retrieves the Extension proxy objects for all the {{@link Extensions/IncludeProcessor}} instances stored in this registry. + * + * @memberof Extensions/Registry + * @returns an {array} of Extension proxy objects. + */ + Registry.prototype.getIncludeProcessors = function () { + return this.$include_processors() + }; + + /** + * Retrieves the Extension proxy objects for all the {{@link Extensions/Postprocessor}} instances stored in this registry. + * + * @memberof Extensions/Registry + * @returns an {array} of Extension proxy objects. + */ + Registry.prototype.getPostprocessors = function () { + return this.$postprocessors() + }; + + /** + * Retrieves the Extension proxy objects for all the {{@link Extensions/DocinfoProcessor}} instances stored in this registry. + * + * @memberof Extensions/Registry + * @param location - A {string} for selecting docinfo extensions at a given location (head or footer) (default: undefined) + * @returns an {array} of Extension proxy objects. + */ + Registry.prototype.getDocinfoProcessors = function (location) { + return this.$docinfo_processors(location) + }; + + /** + * Retrieves the Extension proxy objects for all the {{@link Extensions/BlockProcessor}} instances stored in this registry. + * + * @memberof Extensions/Registry + * @returns an {array} of Extension proxy objects. + */ + Registry.prototype.getBlocks = function () { + return this.block_extensions.$values() + }; + + /** + * Retrieves the Extension proxy objects for all the {{@link Extensions/BlockMacroProcessor}} instances stored in this registry. + * + * @memberof Extensions/Registry + * @returns an {array} of Extension proxy objects. + */ + Registry.prototype.getBlockMacros = function () { + return this.block_macro_extensions.$values() + }; + + /** + * Retrieves the Extension proxy objects for all the {{@link Extensions/InlineMacroProcessor}} instances stored in this registry. + * + * @memberof Extensions/Registry + * @returns an {array} of Extension proxy objects. + */ + Registry.prototype.getInlineMacros = function () { + return this.$inline_macros() + }; + + /** + * Get any {{@link Extensions/InlineMacroProcessor}} extensions are registered to handle the specified inline macro name. + * + * @param name - the {string} inline macro name + * @memberof Extensions/Registry + * @returns the Extension proxy object for the {{@link Extensions/InlineMacroProcessor}} that matches the inline macro name or undefined if no match is found. + */ + Registry.prototype.getInlineMacroFor = function (name) { + const result = this['$registered_for_inline_macro?'](name); + return result === false ? undefined : result + }; + + /** + * Get any {{@link Extensions/BlockProcessor}} extensions are registered to handle the specified block name appearing on the specified context. + * @param name - the {string} block name + * @param context - the context of the block: paragraph, open... (optional) + * @memberof Extensions/Registry + * @returns the Extension proxy object for the {{@link Extensions/BlockProcessor}} that matches the block name and context or undefined if no match is found. + */ + Registry.prototype.getBlockFor = function (name, context) { + if (typeof context === 'undefined') { + const ext = this.$find_block_extension(name); + return ext === Opal.nil ? undefined : ext + } + const result = this['$registered_for_block?'](name, context); + return result === false ? undefined : result + }; + + /** + * Get any {{@link Extensions/BlockMacroProcessor}} extensions are registered to handle the specified macro name. + * + * @param name - the {string} macro name + * @memberof Extensions/Registry + * @returns the Extension proxy object for the {{@link Extensions/BlockMacroProcessor}} that matches the macro name or undefined if no match is found. + */ + Registry.prototype.getBlockMacroFor = function (name) { + const result = this['$registered_for_block_macro?'](name); + return result === false ? undefined : result + }; + + /** + * @namespace + * @module Extensions/Processor + */ + const Processor = Extensions.Processor; + + /** + * The extension will be added to the beginning of the list for that extension type. (default is append). + * @memberof Extensions/Processor + * @deprecated Please use the <code>prefer</pre> function on the {@link Extensions/Registry}, + * the {@link Extensions/IncludeProcessor}, + * the {@link Extensions/TreeProcessor}, + * the {@link Extensions/Postprocessor}, + * the {@link Extensions/Preprocessor} + * or the {@link Extensions/DocinfoProcessor} + */ + Processor.prototype.prepend = function () { + this.$option('position', '>>'); + }; + + /** + * @memberof Extensions/Processor + */ + Processor.prototype.process = function (block) { + const handler = { + apply: function (target, thisArg, argumentsList) { + for (let i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object' && '$$smap' in argumentsList[i]) { + argumentsList[i] = fromHash(argumentsList[i]); + } + } + return target.apply(thisArg, argumentsList) + } + }; + const blockProxy = new Proxy(block, handler); + return Opal.send(this, 'process', null, toBlock(blockProxy)) + }; + + /** + * @param {string} name + * @memberof Extensions/Processor + */ + Processor.prototype.named = function (name) { + return this.$named(name) + }; + + /** + * Creates a block and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block (Block, Section, or Document) of this new block. + * @param {string} context + * @param {string|Array<string>} source + * @param {Object|undefined} attrs - A JSON of attributes + * @param {Object|undefined} opts - A JSON of options + * @return {Block} + * @memberof Extensions/Processor + */ + Processor.prototype.createBlock = function (parent, context, source, attrs, opts) { + return this.$create_block(parent, context, source, toHash(attrs), toHash(opts)) + }; + + /** + * Creates a list block node and links it to the specified parent. + * + * @param parent - The parent Block (Block, Section, or Document) of this new list block. + * @param {string} context - The list context (e.g., ulist, olist, colist, dlist) + * @param {Object} attrs - An object of attributes to set on this list block + * @returns {List} + * @memberof Extensions/Processor + */ + Processor.prototype.createList = function (parent, context, attrs) { + return this.$create_list(parent, context, toHash(attrs)) + }; + + /** + * Creates a list item node and links it to the specified parent. + * + * @param {List} parent - The parent {List} of this new list item block. + * @param {string} text - The text of the list item. + * @returns {ListItem} + * @memberof Extensions/Processor + */ + Processor.prototype.createListItem = function (parent, text) { + return this.$create_list_item(parent, text) + }; + + /** + * Creates an image block node and links it to the specified parent. + * @param {Block|Section|Document} parent - The parent Block of this new image block. + * @param {Object} attrs - A JSON of attributes + * @param {string} attrs.target - the target attribute to set the source of the image. + * @param {string} attrs.alt - the alt attribute to specify an alternative text for the image. + * @param {Object} opts - A JSON of options + * @returns {Block} + * @memberof Extensions/Processor + */ + Processor.prototype.createImageBlock = function (parent, attrs, opts) { + return this.$create_image_block(parent, toHash(attrs), toHash(opts)) + }; + + /** + * Creates a paragraph block and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block (Block, Section, or Document) of this new block. + * @param {string|Array<string>} source - The source + * @param {Object|undefined} attrs - An object of attributes to set on this block + * @param {Object|undefined} opts - An object of options to set on this block + * @returns {Block} - a paragraph {Block} + * @memberof Extensions/Processor + */ + Processor.prototype.createParagraph = function (parent, source, attrs, opts) { + return this.$create_paragraph(parent, source, toHash(attrs), toHash(opts)) + }; + + /** + * Creates an open block and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block (Block, Section, or Document) of this new block. + * @param {string|Array<string>} source - The source + * @param {Object|undefined} attrs - An object of attributes to set on this block + * @param {Object|undefined} opts - An object of options to set on this block + * @returns {Block} - an open {Block} + * @memberof Extensions/Processor + */ + Processor.prototype.createOpenBlock = function (parent, source, attrs, opts) { + return this.$create_open_block(parent, source, toHash(attrs), toHash(opts)) + }; + + /** + * Creates an example block and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block (Block, Section, or Document) of this new block. + * @param {string|Array<string>} source - The source + * @param {Object|undefined} attrs - An object of attributes to set on this block + * @param {Object|undefined} opts - An object of options to set on this block + * @returns {Block} - an example {Block} + * @memberof Extensions/Processor + */ + Processor.prototype.createExampleBlock = function (parent, source, attrs, opts) { + return this.$create_example_block(parent, source, toHash(attrs), toHash(opts)) + }; + + /** + * Creates a literal block and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block (Block, Section, or Document) of this new block. + * @param {string|Array<string>} source - The source + * @param {Object|undefined} attrs - An object of attributes to set on this block + * @param {Object|undefined} opts - An object of options to set on this block + * @returns {Block} - a literal {Block} + * @memberof Extensions/Processor + */ + Processor.prototype.createPassBlock = function (parent, source, attrs, opts) { + return this.$create_pass_block(parent, source, toHash(attrs), toHash(opts)) + }; + + /** + * Creates a listing block and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block (Block, Section, or Document) of this new block. + * @param {string|Array<string>} source - The source + * @param {Object|undefined} attrs - An object of attributes to set on this block + * @param {Object|undefined} opts - An object of options to set on this block + * @returns {Block} - a listing {Block} + * @memberof Extensions/Processor + */ + Processor.prototype.createListingBlock = function (parent, source, attrs, opts) { + return this.$create_listing_block(parent, source, toHash(attrs), toHash(opts)) + }; + + /** + * Creates a literal block and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block (Block, Section, or Document) of this new block. + * @param {string|Array<string>} source - The source + * @param {Object|undefined} attrs - An object of attributes to set on this block + * @param {Object|undefined} opts - An object of options to set on this block + * @returns {Block} - a literal {Block} + * @memberof Extensions/Processor + */ + Processor.prototype.createLiteralBlock = function (parent, source, attrs, opts) { + return this.$create_literal_block(parent, source, toHash(attrs), toHash(opts)) + }; + + /** + * Creates an inline anchor and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block (Block, Section, or Document) of this new block. + * @param {string} text - The text + * @param {Object|undefined} opts - An object of options to set on this block + * @returns {Inline} - an {Inline} anchor + * @memberof Extensions/Processor + */ + Processor.prototype.createAnchor = function (parent, text, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$create_anchor(parent, text, toHash(opts)) + }; + + /** + * Creates an inline pass and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block (Block, Section, or Document) of this new block. + * @param {string} text - The text + * @param {Object|undefined} opts - An object of options to set on this block + * @returns {Inline} - an {Inline} pass + * @memberof Extensions/Processor + */ + Processor.prototype.createInlinePass = function (parent, text, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$create_inline_pass(parent, text, toHash(opts)) + }; + + /** + * Creates an inline node and links it to the specified parent. + * + * @param {Block|Section|Document} parent - The parent Block of this new inline node. + * @param {string} context - The context name + * @param {string} text - The text + * @param {Object|undefined} opts - A JSON of options + * @returns {Inline} - an {Inline} node + * @memberof Extensions/Processor + */ + Processor.prototype.createInline = function (parent, context, text, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$create_inline(parent, context, text, toHash(opts)) + }; + + /** + * Parses blocks in the content and attaches the block to the parent. + * @param {AbstractBlock} parent - the parent block + * @param {string|Array<string>} content - the content + * @param {Object|undefined} attrs - an object of attributes + * @returns {AbstractNode} - The parent node into which the blocks are parsed. + * @memberof Extensions/Processor + */ + Processor.prototype.parseContent = function (parent, content, attrs) { + return this.$parse_content(parent, content, toHash(attrs)) + }; + + /** + * Parses the attrlist String into a JSON of attributes + * @param {AbstractBlock} block - the current AbstractBlock or the parent AbstractBlock if there is no current block (used for applying subs) + * @param {string} attrlist - the list of attributes as a String + * @param {Object|undefined} opts - an optional JSON of options to control processing: + * - positional_attributes: an Array of attribute names to map positional arguments to (optional, default: []) + * - sub_attributes: enables attribute substitution on the attrlist argument (optional, default: false) + * + * @returns - a JSON of parsed attributes + * @memberof Extensions/Processor + */ + Processor.prototype.parseAttributes = function (block, attrlist, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return fromHash(this.$parse_attributes(block, attrlist, toHash(opts))) + }; + + /** + * @param {string|Array<string>} value - Name of a positional attribute or an Array of positional attribute names + * @memberof Extensions/Processor + */ + Processor.prototype.positionalAttributes = function (value) { + return this.$positional_attrs(value) + }; + + /** + * Specify how to resolve attributes. + * + * @param {string|Array<string>|Object|boolean} [value] - A specification to resolve attributes. + * @memberof Extensions/Processor + */ + Processor.prototype.resolveAttributes = function (value) { + if (typeof value === 'object' && !Array.isArray(value)) { + return this.$resolves_attributes(toHash(value)) + } + if (arguments.length > 1) { + return this.$resolves_attributes(Array.prototype.slice.call(arguments)) + } + if (typeof value === 'undefined') { + // Convert to nil otherwise an exception is thrown at: + // https://github.com/asciidoctor/asciidoctor/blob/0bcb4addc17b307f62975aad203fb556a1bcd8a5/lib/asciidoctor/extensions.rb#L583 + // + // if args.size == 1 && !args[0] + // + // In the above Ruby code, args[0] is undefined and Opal will try to call the function "!" on an undefined object. + return this.$resolves_attributes(Opal.nil) + } + return this.$resolves_attributes(value) + }; + + /** + * @deprecated Please use the <code>resolveAttributes</pre> function on the {@link Extensions/Processor}. + * @memberof Extensions/Processor + * @see {Processor#resolveAttributes} + */ + Processor.prototype.resolvesAttributes = Processor.prototype.resolveAttributes; + + /** + * Get the configuration JSON for this processor instance. + * @memberof Extensions/Processor + */ + Processor.prototype.getConfig = function () { + return fromHash(this.config) + }; + + /** + * @memberof Extensions/Processor + */ + Processor.prototype.option = function (key, value) { + this.$option(key, value); + }; + + /** + * @namespace + * @module Extensions/BlockProcessor + */ + const BlockProcessor = Extensions.BlockProcessor; + + /** + * @param {Object} value - a JSON of default values for attributes + * @memberof Extensions/BlockProcessor + */ + BlockProcessor.prototype.defaultAttributes = function (value) { + this.$default_attributes(toHash(value)); + }; + + /** + * @param {string} context - A context name + * @memberof Extensions/BlockProcessor + */ + BlockProcessor.prototype.onContext = function (context) { + return this.$on_context(context) + }; + + /** + * @param {...string} contexts - A list of context names + * @memberof Extensions/BlockProcessor + */ + BlockProcessor.prototype.onContexts = function (contexts) { + return this.$on_contexts(Array.prototype.slice.call(arguments)) + }; + + /** + * @returns {string} + * @memberof Extensions/BlockProcessor + */ + BlockProcessor.prototype.getName = function () { + const name = this.name; + return name === Opal.nil ? undefined : name + }; + + /** + * @param {string} value + * @memberof Extensions/BlockProcessor + */ + BlockProcessor.prototype.parseContentAs = function (value) { + this.$parse_content_as(value); + }; + + /** + * @namespace + * @module Extensions/BlockMacroProcessor + */ + const BlockMacroProcessor = Extensions.BlockMacroProcessor; + + /** + * @param {Object} value - a JSON of default values for attributes + * @memberof Extensions/BlockMacroProcessor + */ + BlockMacroProcessor.prototype.defaultAttributes = function (value) { + this.$default_attributes(toHash(value)); + }; + + /** + * @returns {string} - the block macro name + * @memberof Extensions/BlockMacroProcessor + */ + BlockMacroProcessor.prototype.getName = function () { + const name = this.name; + return name === Opal.nil ? undefined : name + }; + + /** + * @param {string} value + * @memberof Extensions/BlockMacroProcessor + */ + BlockMacroProcessor.prototype.parseContentAs = function (value) { + this.$parse_content_as(value); + }; + + /** + * @namespace + * @module Extensions/InlineMacroProcessor + */ + const InlineMacroProcessor = Extensions.InlineMacroProcessor; + + /** + * @param {Object} value - a JSON of default values for attributes + * @memberof Extensions/InlineMacroProcessor + */ + InlineMacroProcessor.prototype.defaultAttributes = function (value) { + this.$default_attributes(toHash(value)); + }; + + /** + * @returns {string} - the inline macro name + * @memberof Extensions/InlineMacroProcessor + */ + InlineMacroProcessor.prototype.getName = function () { + const name = this.name; + return name === Opal.nil ? undefined : name + }; + + /** + * @param {string} value + * @memberof Extensions/InlineMacroProcessor + */ + InlineMacroProcessor.prototype.parseContentAs = function (value) { + this.$parse_content_as(value); + }; + + /** + * @param {string} value + * @memberof Extensions/InlineMacroProcessor + */ + InlineMacroProcessor.prototype.matchFormat = function (value) { + this.$match_format(value); + }; + + /** + * @param {RegExp} value + * @memberof Extensions/InlineMacroProcessor + */ + InlineMacroProcessor.prototype.match = function (value) { + this.$match(value); + }; + + /** + * @namespace + * @module Extensions/IncludeProcessor + */ + const IncludeProcessor = Extensions.IncludeProcessor; + + /** + * @memberof Extensions/IncludeProcessor + */ + IncludeProcessor.prototype.handles = function (block) { + return Opal.send(this, 'handles?', null, toBlock(block)) + }; + + /** + * @memberof Extensions/IncludeProcessor + */ + IncludeProcessor.prototype.prefer = function () { + this.$prefer(); + }; + + /** + * @namespace + * @module Extensions/TreeProcessor + */ + const TreeProcessor = Extensions.TreeProcessor; + + /** + * @memberof Extensions/TreeProcessor + */ + TreeProcessor.prototype.prefer = function () { + this.$prefer(); + }; + + /** + * @namespace + * @module Extensions/Postprocessor + */ + const Postprocessor = Extensions.Postprocessor; + + /** + * @memberof Extensions/Postprocessor + */ + Postprocessor.prototype.prefer = function () { + this.$prefer(); + }; + + /** + * @namespace + * @module Extensions/Preprocessor + */ + const Preprocessor = Extensions.Preprocessor; + + /** + * @memberof Extensions/Preprocessor + */ + Preprocessor.prototype.prefer = function () { + this.$prefer(); + }; + + /** + * @namespace + * @module Extensions/DocinfoProcessor + */ + const DocinfoProcessor = Extensions.DocinfoProcessor; + + /** + * @memberof Extensions/DocinfoProcessor + */ + DocinfoProcessor.prototype.prefer = function () { + this.$prefer(); + }; + + /** + * @param {string} value - The docinfo location ("head", "header" or "footer") + * @memberof Extensions/DocinfoProcessor + */ + DocinfoProcessor.prototype.atLocation = function (value) { + this.$at_location(value); + }; + + function initializeProcessorClass (superclassName, className, functions) { + const superClass = Opal.const_get_qualified(Extensions, superclassName); + return initializeClass(superClass, className, functions, { + 'handles?': function () { + return true + } + }) + } + + // Postprocessor + + /** + * Create a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.createPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Postprocessor', name, functions) + }; + + /** + * Create and instantiate a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.newPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPostprocessor(name, functions).$new() + }; + + // Preprocessor + + /** + * Create a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.createPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Preprocessor', name, functions) + }; + + /** + * Create and instantiate a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.newPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPreprocessor(name, functions).$new() + }; + + // Tree Processor + + /** + * Create a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.createTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('TreeProcessor', name, functions) + }; + + /** + * Create and instantiate a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.newTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createTreeProcessor(name, functions).$new() + }; + + // Include Processor + + /** + * Create an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.createIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('IncludeProcessor', name, functions) + }; + + /** + * Create and instantiate an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.newIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createIncludeProcessor(name, functions).$new() + }; + + // Docinfo Processor + + /** + * Create a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.createDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('DocinfoProcessor', name, functions) + }; + + /** + * Create and instantiate a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.newDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createDocinfoProcessor(name, functions).$new() + }; + + // Block Processor + + /** + * Create a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.createBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockProcessor', name, functions) + }; + + /** + * Create and instantiate a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.newBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockProcessor(name, functions).$new() + }; + + // Inline Macro Processor + + /** + * Create an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.createInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('InlineMacroProcessor', name, functions) + }; + + /** + * Create and instantiate an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.newInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createInlineMacroProcessor(name, functions).$new() + }; + + // Block Macro Processor + + /** + * Create a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.createBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockMacroProcessor', name, functions) + }; + + /** + * Create and instantiate a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ + Extensions.newBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockMacroProcessor(name, functions).$new() + }; + + + var ASCIIDOCTOR_JS_VERSION = '3.0.2'; + + /** + * Get Asciidoctor.js version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor.js. + */ + Opal.Asciidoctor.prototype.getVersion = function () { + return ASCIIDOCTOR_JS_VERSION + }; + return Opal.Asciidoctor + } + + const AsciidoctorDocBook = {}; + + function register () { + Opal.queue(function(Opal) {/* Generated by Opal 1.7.3 */ + var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $hash2 = Opal.hash2, $regexp = Opal.regexp, $def = Opal.def, $truthy = Opal.truthy, $eqeq = Opal.eqeq, $rb_plus = Opal.rb_plus, $send = Opal.send, $alias = Opal.alias, $rb_gt = Opal.rb_gt, $return_val = Opal.return_val, $rb_minus = Opal.rb_minus, $to_ary = Opal.to_ary, $gvars = Opal.gvars, $not = Opal.not, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$; + + Opal.add_stubs('register_for,default=,init_backend_traits,attr?,<<,attr,==,doctype,size,id,noheader,document_info_tag,apply_reftext_subs,+,map,empty?,docinfo,blocks?,content,id=,insert,common_attributes,join,content_only,document,[],sectname,option?,special,title,role,reftext,title_tag,enclose_content,skip,title?,each,items,text,style,text?,level,image_uri,alt,!,key?,attributes,to_i,index,subs,delete_at,>,unshift,asciimath_available?,to_mathml,parse,parent,warn,logger,context,error,content_model,blockquote_tag,has_role?,include?,columns,to_h,rows,colspan,column,-,rowspan,type,target,nil_or_empty?,get_root_document,generate_document_id,inspect,icon_uri,chop,private,gsub,strip,squeeze,firstname,sub_replacements,middlename,lastname,email,notitle,subtitle?,doctitle,main,subtitle,=~,header?,authors,author_tag,initials,cover_tag,nested?,parent_document,new,load_asciimath,nil?,require_library'); + return (function($base, $parent_nesting) { + var self = $module($base, 'Asciidoctor'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting); + + return (function($base, $super, $parent_nesting) { + var self = $klass($base, $super, 'DocBook5Converter'); + + var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype; + + $proto.asciimath_status = nil; + + self.$register_for("docbook5"); + $const_set($nesting[0], 'DLIST_TAGS', $hash2(["qanda", "glossary"], {"qanda": $hash2(["list", "entry", "label", "term", "item"], {"list": "qandaset", "entry": "qandaentry", "label": "question", "term": "simpara", "item": "answer"}), "glossary": $hash2(["list", "entry", "term", "item"], {"list": nil, "entry": "glossentry", "term": "glossterm", "item": "glossdef"})}))['$default=']($hash2(["list", "entry", "term", "item"], {"list": "variablelist", "entry": "varlistentry", "term": "term", "item": "listitem"})); + $const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript"], {"monospaced": ["<literal>", "</literal>"], "emphasis": ["<emphasis>", "</emphasis>", true], "strong": ["<emphasis role=\"strong\">", "</emphasis>", true], "double": ["<quote>", "</quote>", true], "single": ["<quote>", "</quote>", true], "mark": ["<emphasis role=\"marked\">", "</emphasis>"], "superscript": ["<superscript>", "</superscript>"], "subscript": ["<subscript>", "</subscript>"]}))['$default='](["", "", true]); + $const_set($nesting[0], 'MANPAGE_SECTION_TAGS', $hash2(["section", "synopsis"], {"section": "refsection", "synopsis": "refsynopsisdiv"})); + $const_set($nesting[0], 'TABLE_PI_NAMES', ["dbhtml", "dbfo", "dblatex"]); + $const_set($nesting[0], 'CopyrightRx', $regexp(["^(", $$('CC_ANY'), "+?)(?: ((?:\\d{4}-)?\\d{4}))?$"])); + $const_set($nesting[0], 'ImageMacroRx', $regexp(["^image::?(\\S|\\S", $$('CC_ANY'), "*?\\S)\\[(", $$('CC_ANY'), "+)?\\]$"])); + + $def(self, '$initialize', function $$initialize(backend, opts) { + var self = this; + + + if (opts == null) opts = $hash2([], {}); + self.backend = backend; + return self.$init_backend_traits($hash2(["basebackend", "filetype", "outfilesuffix", "supports_templates"], {"basebackend": "docbook", "filetype": "xml", "outfilesuffix": ".xml", "supports_templates": true})); + }, -2); + + $def(self, '$convert_document', function $$convert_document(node) { + var $a, $b, self = this, result = nil, lang_attribute = nil, root_tag_name = nil, manpage = nil, root_tag_idx = nil, id = nil, docinfo_content = nil; + + + result = ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>"]; + if ($truthy(node['$attr?']("toc"))) { + result['$<<'](($truthy(node['$attr?']("toclevels")) ? ("<?asciidoc-toc maxdepth=\"" + (node.$attr("toclevels")) + "\"?>") : ("<?asciidoc-toc?>"))); + } if ($truthy(node['$attr?']("sectnums"))) { + result['$<<'](($truthy(node['$attr?']("sectnumlevels")) ? ("<?asciidoc-numbered maxdepth=\"" + (node.$attr("sectnumlevels")) + "\"?>") : ("<?asciidoc-numbered?>"))); + } lang_attribute = ($truthy(node['$attr?']("nolang")) ? ("") : (" xml:lang=\"" + (node.$attr("lang", "en")) + "\"")); + if ($eqeq((root_tag_name = node.$doctype()), "manpage")) { + + manpage = true; + root_tag_name = "article"; + } root_tag_idx = result.$size(); + id = node.$id(); + if (!$truthy(node.$noheader())) { + result['$<<'](self.$document_info_tag(node)); + } if ($truthy(manpage)) { + + result['$<<']("<refentry>"); + result['$<<']("<refmeta>"); + if ($truthy(node['$attr?']("mantitle"))) { + result['$<<']("<refentrytitle>" + (node.$apply_reftext_subs(node.$attr("mantitle"))) + "</refentrytitle>"); + } if ($truthy(node['$attr?']("manvolnum"))) { + result['$<<']("<manvolnum>" + (node.$attr("manvolnum")) + "</manvolnum>"); + } result['$<<']("<refmiscinfo class=\"source\">" + (node.$attr("mansource", " ")) + "</refmiscinfo>"); + result['$<<']("<refmiscinfo class=\"manual\">" + (node.$attr("manmanual", " ")) + "</refmiscinfo>"); + result['$<<']("</refmeta>"); + result['$<<']("<refnamediv>"); + if ($truthy(node['$attr?']("mannames"))) { + result = $rb_plus(result, $send(node.$attr("mannames"), 'map', [], function $$1(n){ + + if (n == null) n = nil; + return "<refname>" + (n) + "</refname>";})); + } if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<']("<refpurpose>" + (node.$attr("manpurpose")) + "</refpurpose>"); + } result['$<<']("</refnamediv>"); + } if (!$truthy((docinfo_content = node.$docinfo("header"))['$empty?']())) { + result['$<<'](docinfo_content); + } if ($truthy(node['$blocks?']())) { + result['$<<'](node.$content()); + } if (!$truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { + result['$<<'](docinfo_content); + } if ($truthy(manpage)) { + result['$<<']("</refentry>"); + } if (!$truthy(id)) { + $a = [node.$id(), nil], (id = $a[0]), ($b = [$a[1]], $send(node, 'id=', $b), $b[$b.length - 1]); + } result.$insert(root_tag_idx, "<" + (root_tag_name) + " xmlns=\"http://docbook.org/ns/docbook\" xmlns:xl=\"http://www.w3.org/1999/xlink\" version=\"5.0\"" + (lang_attribute) + (self.$common_attributes(id)) + ">"); + result['$<<']("</" + (root_tag_name) + ">"); + return result.$join($$('LF')); + }); + $alias(self, "convert_embedded", "content_only"); + + $def(self, '$convert_section', function $$convert_section(node) { + var self = this, tag_name = nil, $ret_or_1 = nil, title_el = nil; + + + if ($eqeq(node.$document().$doctype(), "manpage")) { + tag_name = ($truthy(($ret_or_1 = $$('MANPAGE_SECTION_TAGS')['$[]']((tag_name = node.$sectname())))) ? ($ret_or_1) : (tag_name)); + } else { + tag_name = node.$sectname(); + } title_el = (($truthy(node.$special()) && (($truthy(node['$option?']("notitle")) || ($truthy(node['$option?']("untitled")))))) ? ("") : ("<title>" + (node.$title()) + "\n")); + return "<" + (tag_name) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (title_el) + (node.$content()) + "\n" + ""; + }); + + $def(self, '$convert_admonition', function $$convert_admonition(node) { + var self = this, tag_name = nil; + + return "<" + ((tag_name = node.$attr("name"))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + }); + $alias(self, "convert_audio", "skip"); + + $def(self, '$convert_colist', function $$convert_colist(node) { + var self = this, result = nil; + + + result = []; + result['$<<'](""); + if ($truthy(node['$title?']())) { + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$2(item){ + + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content()); + } return result['$<<']("");}); + result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$convert_dlist', function $$convert_dlist(node) { + var self = this, result = nil, tag_name = nil, tags = nil, list_tag = nil, entry_tag = nil, label_tag = nil, term_tag = nil, item_tag = nil; + + + result = []; + if ($eqeq(node.$style(), "horizontal")) { + + result['$<<']("<" + ((tag_name = ($truthy(node['$title?']()) ? ("table") : ("informaltable")))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + " tabstyle=\"horizontal\" frame=\"none\" colsep=\"0\" rowsep=\"0\">\n" + (self.$title_tag(node)) + "\n" + "\n" + "\n" + ""); + $send(node.$items(), 'each', [], function $$3(terms, dd){ + + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<']("\n" + ""); + $send(terms, 'each', [], function $$4(dt){ + + if (dt == null) dt = nil; + return result['$<<']("" + (dt.$text()) + "");}); + result['$<<']("\n" + ""); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + (dd.$text()) + ""); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } return result['$<<']("\n" + "");}); + result['$<<']("\n" + "\n" + ""); + } else { + + tags = $$('DLIST_TAGS')['$[]'](node.$style()); + list_tag = tags['$[]']("list"); + entry_tag = tags['$[]']("entry"); + label_tag = tags['$[]']("label"); + term_tag = tags['$[]']("term"); + item_tag = tags['$[]']("item"); + if ($truthy(list_tag)) { + + result['$<<']("<" + (list_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"); + if ($truthy(node['$title?']())) { + result['$<<']("" + (node.$title()) + ""); + } } $send(node.$items(), 'each', [], function $$5(terms, dd){ + + if (terms == null) terms = nil; + if (dd == null) dd = nil; + result['$<<']("<" + (entry_tag) + ">"); + if ($truthy(label_tag)) { + result['$<<']("<" + (label_tag) + ">"); + } $send(terms, 'each', [], function $$6(dt){ + + if (dt == null) dt = nil; + return result['$<<']("<" + (term_tag) + ">" + (dt.$text()) + "");}); + if ($truthy(label_tag)) { + result['$<<'](""); + } result['$<<']("<" + (item_tag) + ">"); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + (dd.$text()) + ""); + } if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content()); + } } result['$<<'](""); + return result['$<<']("");}); + if ($truthy(list_tag)) { + result['$<<'](""); + } } return result.$join($$('LF')); + }); + + $def(self, '$convert_example', function $$convert_example(node) { + var self = this; + + if ($truthy(node['$title?']())) { + return "\n" + "" + (node.$title()) + "\n" + (self.$enclose_content(node)) + "\n" + "" + } else { + return "\n" + (self.$enclose_content(node)) + "\n" + "" + } + }); + + $def(self, '$convert_floating_title', function $$convert_floating_title(node) { + var self = this; + + return "" + (node.$title()) + "" + }); + + $def(self, '$convert_image', function $$convert_image(node) { + var self = this, width_attribute = nil, depth_attribute = nil, scale_attribute = nil, align_attribute = nil, mediaobject = nil; + + + if ($truthy(node['$attr?']("scaledwidth"))) { + + width_attribute = " width=\"" + (node.$attr("scaledwidth")) + "\""; + depth_attribute = ""; + scale_attribute = ""; + } else if ($truthy(node['$attr?']("scale"))) { + scale_attribute = " scale=\"" + (node.$attr("scale")) + "\""; + } else { + + width_attribute = ($truthy(node['$attr?']("width")) ? (" contentwidth=\"" + (node.$attr("width")) + "\"") : ("")); + depth_attribute = ($truthy(node['$attr?']("height")) ? (" contentdepth=\"" + (node.$attr("height")) + "\"") : ("")); + scale_attribute = ""; + } align_attribute = ($truthy(node['$attr?']("align")) ? (" align=\"" + (node.$attr("align")) + "\"") : ("")); + mediaobject = "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; + if ($truthy(node['$title?']())) { + return "\n" + "" + (node.$title()) + "\n" + (mediaobject) + "\n" + "" + } else { + return "\n" + (mediaobject) + "\n" + "" + } }); + + $def(self, '$convert_listing', function $$convert_listing(node) { + var self = this, informal = nil, common_attrs = nil, attrs = nil, numbering_attrs = nil, wrapped_content = nil; + + + informal = node['$title?']()['$!'](); + common_attrs = self.$common_attributes(node.$id(), node.$role(), node.$reftext()); + if ($eqeq(node.$style(), "source")) { + + if ($truthy((attrs = node.$attributes())['$key?']("linenums"))) { + numbering_attrs = ($truthy(attrs['$key?']("start")) ? (" linenumbering=\"numbered\" startinglinenumber=\"" + (attrs['$[]']("start").$to_i()) + "\"") : (" linenumbering=\"numbered\"")); + } else { + numbering_attrs = " linenumbering=\"unnumbered\""; + } if ($truthy(attrs['$key?']("language"))) { + wrapped_content = "" + (node.$content()) + ""; + } else { + wrapped_content = "" + (node.$content()) + ""; + } } else { + wrapped_content = "" + (node.$content()) + ""; + } if ($truthy(informal)) { + return wrapped_content + } else { + return "\n" + "" + (node.$title()) + "\n" + "\n" + (wrapped_content) + "\n" + "\n" + "" + } }); + + $def(self, '$convert_literal', function $$convert_literal(node) { + var self = this; + + if ($truthy(node['$title?']())) { + return "\n" + "" + (node.$title()) + "\n" + "\n" + "" + (node.$content()) + "\n" + "\n" + "" + } else { + return "" + (node.$content()) + "" + } + }); + $alias(self, "convert_pass", "content_only"); + + $def(self, '$convert_stem', function $$convert_stem(node) { + var self = this, idx = nil, equation = nil, equation_data = nil; + + + if ($truthy((idx = node.$subs().$index("specialcharacters")))) { + + node.$subs().$delete_at(idx); + equation = node.$content(); + if ($truthy($rb_gt(idx, 0))) { + + node.$subs().$insert(idx, "specialcharacters"); + } else { + + node.$subs().$unshift("specialcharacters"); + } } else { + equation = node.$content(); + } if ($eqeq(node.$style(), "asciimath")) { + equation_data = ($truthy(self['$asciimath_available?']()) ? ($$$('AsciiMath').$parse(equation).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) : ("")); + } else { + equation_data = "\n" + ""; + } if ($truthy(node['$title?']())) { + return "\n" + "" + (node.$title()) + "\n" + (equation_data) + "\n" + "" + } else { + return "\n" + (equation_data) + "\n" + "" + } }); + + $def(self, '$convert_olist', function $$convert_olist(node) { + var self = this, result = nil, num_attribute = nil, start_attribute = nil; + + + result = []; + num_attribute = ($truthy(node.$style()) ? (" numeration=\"" + (node.$style()) + "\"") : ("")); + start_attribute = ($truthy(node['$attr?']("start")) ? (" startingnumber=\"" + (node.$attr("start")) + "\"") : ("")); + result['$<<'](""); + if ($truthy(node['$title?']())) { + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$7(item){var self = $$7.$$s == null ? this : $$7.$$s; + + + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content()); + } return result['$<<']("");}, {$$s: self}); + result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$convert_open', function $$convert_open(node) { + var self = this, id = nil, reftext = nil, role = nil, content_spacer = nil; + + + switch (node.$style()) { + case "abstract": + if (($eqeq(node.$parent(), node.$document()) && ($eqeq(node.$document().$doctype(), "book")))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + } + case "partintro": + if ((($eqeq(node.$level(), 0) && ($eqeq(node.$parent().$context(), "section"))) && ($eqeq(node.$document().$doctype(), "book")))) { + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + } else { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } + default: + + if ($truthy((id = node.$id()))) { + reftext = node.$reftext(); + } role = node.$role(); + if ($truthy(node['$title?']())) { + return "\n" + "" + (node.$title()) + "\n" + "" + ((content_spacer = ($eqeq(node.$content_model(), "compound") ? ($$('LF')) : ("")))) + (node.$content()) + (content_spacer) + "\n" + "" + } else if (($truthy(id) || ($truthy(role)))) { + if ($eqeq(node.$content_model(), "compound")) { + return "\n" + (node.$content()) + "\n" + "" + } else { + return "" + (node.$content()) + "" + } + } else { + return self.$enclose_content(node) + } } + }); + + $def(self, '$convert_page_break', $return_val("")); + + $def(self, '$convert_paragraph', function $$convert_paragraph(node) { + var self = this; + + if ($truthy(node['$title?']())) { + return "\n" + "" + (node.$title()) + "\n" + "" + (node.$content()) + "\n" + "" + } else { + return "" + (node.$content()) + "" + } + }); + + $def(self, '$convert_preamble', function $$convert_preamble(node) { + var self = this; + + if ($eqeq(node.$document().$doctype(), "book")) { + return "\n" + (self.$title_tag(node, false)) + (node.$content()) + "\n" + "" + } else { + return node.$content() + } + }); + + $def(self, '$convert_quote', function $$convert_quote(node) { + var self = this, $ret_or_1 = nil; + + return $send(self, 'blockquote_tag', [node, ($truthy(($ret_or_1 = node['$has_role?']("epigraph"))) ? ("epigraph") : ($ret_or_1))], function $$8(){var self = $$8.$$s == null ? this : $$8.$$s; + + return self.$enclose_content(node)}, {$$s: self}) + }); + + $def(self, '$convert_thematic_break', $return_val("")); + + $def(self, '$convert_sidebar', function $$convert_sidebar(node) { + var self = this; + + return "\n" + (self.$title_tag(node)) + (self.$enclose_content(node)) + "\n" + "" + }); + + $def(self, '$convert_table', function $$convert_table(node) { + var self = this, has_body = nil, result = nil, pgwide_attribute = nil, frame = nil, grid = nil, tag_name = nil, width = nil, col_width_key = nil; + + + has_body = false; + result = []; + pgwide_attribute = ($truthy(node['$option?']("pgwide")) ? (" pgwide=\"1\"") : ("")); + if ($eqeq((frame = node.$attr("frame", "all", "table-frame")), "ends")) { + frame = "topbot"; + } grid = node.$attr("grid", nil, "table-grid"); + result['$<<']("<" + ((tag_name = ($truthy(node['$title?']()) ? ("table") : ("informaltable")))) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + (pgwide_attribute) + " frame=\"" + (frame) + "\" rowsep=\"" + (($truthy(["none", "cols"]['$include?'](grid)) ? (0) : (1))) + "\" colsep=\"" + (($truthy(["none", "rows"]['$include?'](grid)) ? (0) : (1))) + "\"" + (($truthy(node['$attr?']("orientation", "landscape", "table-orientation")) ? (" orient=\"land\"") : (""))) + ">"); + if ($truthy(node['$option?']("unbreakable"))) { + result['$<<'](""); + } else if ($truthy(node['$option?']("breakable"))) { + result['$<<'](""); + } if ($eqeq(tag_name, "table")) { + result['$<<']("" + (node.$title()) + ""); + } if ($truthy((width = ($truthy(node['$attr?']("width")) ? (node.$attr("width")) : (nil))))) { + + $send($$('TABLE_PI_NAMES'), 'each', [], function $$9(pi_name){ + + if (pi_name == null) pi_name = nil; + return result['$<<']("");}); + col_width_key = "colabswidth"; + } else { + col_width_key = "colpcwidth"; + } result['$<<'](""); + $send(node.$columns(), 'each', [], function $$10(col){ + + if (col == null) col = nil; + return result['$<<']("");}); + $send(node.$rows().$to_h(), 'each', [], function $$11(tsec, rows){ + + if (tsec == null) tsec = nil; + if (rows == null) rows = nil; + if ($truthy(rows['$empty?']())) { + return nil + } if ($eqeq(tsec, "body")) { + has_body = true; + } result['$<<'](""); + $send(rows, 'each', [], function $$12(row){ + + if (row == null) row = nil; + result['$<<'](""); + $send(row, 'each', [], function $$13(cell){var colspan_attribute = nil, colnum = nil, rowspan_attribute = nil, entry_start = nil, cell_content = nil, entry_end = nil; + + + if (cell == null) cell = nil; + colspan_attribute = ($truthy(cell.$colspan()) ? (" namest=\"col_" + ((colnum = cell.$column().$attr("colnumber"))) + "\" nameend=\"col_" + ($rb_minus($rb_plus(colnum, cell.$colspan()), 1)) + "\"") : ("")); + rowspan_attribute = ($truthy(cell.$rowspan()) ? (" morerows=\"" + ($rb_minus(cell.$rowspan(), 1)) + "\"") : ("")); + entry_start = ""; + if ($eqeq(tsec, "head")) { + cell_content = cell.$text(); + } else + switch (cell.$style()) { + case "asciidoc": + cell_content = cell.$content(); + break; + case "literal": + cell_content = "" + (cell.$text()) + ""; + break; + case "header": + cell_content = ($truthy((cell_content = cell.$content())['$empty?']()) ? ("") : ("" + (cell_content.$join("")) + "")); + break; + default: + cell_content = ($truthy((cell_content = cell.$content())['$empty?']()) ? ("") : ("" + (cell_content.$join("")) + "")); + } entry_end = ($truthy(node.$document()['$attr?']("cellbgcolor")) ? ("") : ("")); + return result['$<<']("" + (entry_start) + (cell_content) + (entry_end));}); + return result['$<<']("");}); + return result['$<<']("");}); + result['$<<'](""); + result['$<<'](""); + if (!$truthy(has_body)) { + self.$logger().$warn("tables must have at least one body row"); + } return result.$join($$('LF')); + }); + $alias(self, "convert_toc", "skip"); + + $def(self, '$convert_ulist', function $$convert_ulist(node) { + var self = this, result = nil, mark_type = nil, checklist = nil, mark_attribute = nil; + + + result = []; + if ($eqeq(node.$style(), "bibliography")) { + + result['$<<'](""); + if ($truthy(node['$title?']())) { + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$14(item){ + + if (item == null) item = nil; + result['$<<'](""); + result['$<<']("" + (item.$text()) + ""); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content()); + } return result['$<<']("");}); + result['$<<'](""); + } else { + + mark_type = ($truthy((checklist = node['$option?']("checklist"))) ? ("none") : (node.$style())); + mark_attribute = ($truthy(mark_type) ? (" mark=\"" + (mark_type) + "\"") : ("")); + result['$<<'](""); + if ($truthy(node['$title?']())) { + result['$<<']("" + (node.$title()) + ""); + } $send(node.$items(), 'each', [], function $$15(item){var self = $$15.$$s == null ? this : $$15.$$s, text_marker = nil, $ret_or_1 = nil; + + + if (item == null) item = nil; + if (($truthy(checklist) && ($truthy(item['$attr?']("checkbox"))))) { + text_marker = ($truthy(item['$attr?']("checked")) ? ("✓ ") : ("❏ ")); + } result['$<<'](""); + result['$<<']("" + (($truthy(($ret_or_1 = text_marker)) ? ($ret_or_1) : (""))) + (item.$text()) + ""); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content()); + } return result['$<<']("");}, {$$s: self}); + result['$<<'](""); + } return result.$join($$('LF')); + }); + + $def(self, '$convert_verse', function $$convert_verse(node) { + var self = this, $ret_or_1 = nil; + + return $send(self, 'blockquote_tag', [node, ($truthy(($ret_or_1 = node['$has_role?']("epigraph"))) ? ("epigraph") : ($ret_or_1))], function $$16(){ + return "" + (node.$content()) + ""}) + }); + $alias(self, "convert_video", "skip"); + + $def(self, '$convert_inline_anchor', function $$convert_inline_anchor(node) { + var $a, self = this, id = nil, $ret_or_2 = nil, path = nil, linkend = nil, root_doc = nil, text = nil; + + + switch (node.$type()) { + case "ref": + return "" + case "xref": + if ($truthy((path = node.$attributes()['$[]']("path")))) { + return "" + (($truthy(($ret_or_2 = node.$text())) ? ($ret_or_2) : (path))) + "" + } else { + + if ($truthy((linkend = node.$attributes()['$[]']("refid"))['$nil_or_empty?']())) { + + root_doc = self.$get_root_document(node); + linkend = ($truthy(($ret_or_2 = root_doc.$id())) ? ($ret_or_2) : (($a = [self.$generate_document_id(root_doc)], $send(root_doc, 'id=', $a), $a[$a.length - 1]))); + } if ($truthy((text = node.$text()))) { + return "" + (text) + "" + } else { + return "" + } } + case "link": + return "" + (node.$text()) + "" + case "bibref": + return "" + (text) + default: + + self.$logger().$warn("unknown anchor type: " + (node.$type().$inspect())); + return nil; + } + }); + + $def(self, '$convert_inline_break', function $$convert_inline_break(node) { + + return "" + (node.$text()) + "" + }); + + $def(self, '$convert_inline_button', function $$convert_inline_button(node) { + + return "" + (node.$text()) + "" + }); + + $def(self, '$convert_inline_callout', function $$convert_inline_callout(node) { + var self = this; + + return "" + }); + + $def(self, '$convert_inline_footnote', function $$convert_inline_footnote(node) { + var self = this; + + if ($eqeq(node.$type(), "xref")) { + return "" + } else { + return "" + (node.$text()) + "" + } + }); + + $def(self, '$convert_inline_image', function $$convert_inline_image(node) { + var self = this, width_attribute = nil, depth_attribute = nil; + + + width_attribute = ($truthy(node['$attr?']("width")) ? (" contentwidth=\"" + (node.$attr("width")) + "\"") : ("")); + depth_attribute = ($truthy(node['$attr?']("height")) ? (" contentdepth=\"" + (node.$attr("height")) + "\"") : ("")); + return "\n" + "\n" + "\n" + "\n" + "" + (node.$alt()) + "\n" + ""; + }); + + $def(self, '$convert_inline_indexterm', function $$convert_inline_indexterm(node) { + var see = nil, rel = nil, see_also_list = nil, numterms = nil, terms = nil; + + + if ($truthy((see = node.$attr("see")))) { + rel = "\n" + (see) + ""; + } else if ($truthy((see_also_list = node.$attr("see-also")))) { + rel = $send(see_also_list, 'map', [], function $$17(see_also){ + + if (see_also == null) see_also = nil; + return "\n" + (see_also) + "";}).$join(); + } else { + rel = ""; + } if ($eqeq(node.$type(), "visible")) { + return "\n" + "" + (node.$text()) + "" + (rel) + "\n" + "" + (node.$text()) + } else if ($truthy($rb_gt((numterms = (terms = node.$attr("terms")).$size()), 2))) { + return "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "" + (rel) + "\n" + "" + (($truthy(node.$document()['$option?']("indexterm-promotion")) ? ("\n" + "\n" + "" + (terms['$[]'](1)) + "" + (terms['$[]'](2)) + "\n" + "\n" + "\n" + "" + (terms['$[]'](2)) + "\n" + "") : (""))) + } else if ($truthy($rb_gt(numterms, 1))) { + return "\n" + "" + (terms['$[]'](0)) + "" + (terms['$[]'](1)) + "" + (rel) + "\n" + "" + (($truthy(node.$document()['$option?']("indexterm-promotion")) ? ("\n" + "\n" + "" + (terms['$[]'](1)) + "\n" + "") : (""))) + } else { + return "\n" + "" + (terms['$[]'](0)) + "" + (rel) + "\n" + "" + } }); + + $def(self, '$convert_inline_kbd', function $$convert_inline_kbd(node) { + var keys = nil; + + if ($eqeq((keys = node.$attr("keys")).$size(), 1)) { + return "" + (keys['$[]'](0)) + "" + } else { + return "" + (keys.$join("")) + "" + } + }); + + $def(self, '$convert_inline_menu', function $$convert_inline_menu(node) { + var menu = nil, submenus = nil, menuitem = nil; + + + menu = node.$attr("menu"); + if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { + if ($truthy((menuitem = node.$attr("menuitem")))) { + return "" + (menu) + " " + (menuitem) + "" + } else { + return "" + (menu) + "" + } + } else { + return "" + (menu) + " " + (submenus.$join(" ")) + " " + (node.$attr("menuitem")) + "" + } }); + + $def(self, '$convert_inline_quoted', function $$convert_inline_quoted(node) { + var $a, $b, self = this, type = nil, equation = nil, open = nil, close = nil, supports_phrase = nil, text = nil, quoted_text = nil; + + if ($eqeq((type = node.$type()), "asciimath")) { + if ($truthy(self['$asciimath_available?']())) { + return "" + ($$$('AsciiMath').$parse(node.$text()).$to_mathml("mml:", $hash2(["xmlns:mml"], {"xmlns:mml": "http://www.w3.org/1998/Math/MathML"}))) + "" + } else { + return "" + } + } else if ($eqeq(type, "latexmath")) { + return "" + } else { + + $b = $$('QUOTE_TAGS')['$[]'](type), $a = $to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (supports_phrase = ($a[2] == null ? nil : $a[2])); + text = node.$text(); + if ($truthy(node.$role())) { + if ($truthy(supports_phrase)) { + quoted_text = "" + (open) + "" + (text) + "" + (close); + } else { + quoted_text = "" + (open.$chop()) + " role=\"" + (node.$role()) + "\">" + (text) + (close); + } + } else { + quoted_text = "" + (open) + (text) + (close); + } if ($truthy(node.$id())) { + return "" + (quoted_text) + } else { + return quoted_text + } } + }); + self.$private(); + + $def(self, '$common_attributes', function $$common_attributes(id, role, reftext) { + var attrs = nil; + + + if (role == null) role = nil; + if (reftext == null) reftext = nil; + if ($truthy(id)) { + attrs = " xml:id=\"" + (id) + "\"" + (($truthy(role) ? (" role=\"" + (role) + "\"") : (""))); + } else if ($truthy(role)) { + attrs = " role=\"" + (role) + "\""; + } else { + attrs = ""; + } if ($truthy(reftext)) { + + if (($truthy(reftext['$include?']("<")) && ($truthy((reftext = reftext.$gsub($$('XmlSanitizeRx'), ""))['$include?'](" "))))) { + reftext = reftext.$squeeze(" ").$strip(); + } if ($truthy(reftext['$include?']("\""))) { + reftext = reftext.$gsub("\"", """); + } return "" + (attrs) + " xreflabel=\"" + (reftext) + "\""; + } else { + return attrs + } }, -2); + + $def(self, '$author_tag', function $$author_tag(doc, author) { + var result = nil; + + + result = []; + result['$<<'](""); + result['$<<'](""); + if ($truthy(author.$firstname())) { + result['$<<']("" + (doc.$sub_replacements(author.$firstname())) + ""); + } if ($truthy(author.$middlename())) { + result['$<<']("" + (doc.$sub_replacements(author.$middlename())) + ""); + } if ($truthy(author.$lastname())) { + result['$<<']("" + (doc.$sub_replacements(author.$lastname())) + ""); + } result['$<<'](""); + if ($truthy(author.$email())) { + result['$<<']("" + (author.$email()) + ""); + } result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$document_info_tag', function $$document_info_tag(doc) { + var $a, self = this, result = nil, title = nil, date = nil, authors = nil, author = nil, back_cover_tag = nil, front_cover_tag = nil, docinfo_content = nil; + + + result = [""]; + if (!$truthy(doc.$notitle())) { + if ($truthy((title = doc.$doctitle($hash2(["partition", "use_fallback"], {"partition": true, "use_fallback": true})))['$subtitle?']())) { + result['$<<']("" + (title.$main()) + "\n" + "" + (title.$subtitle()) + ""); + } else { + result['$<<']("" + (title) + ""); + } + } if ($truthy((date = ($truthy(doc['$attr?']("revdate")) ? (doc.$attr("revdate")) : (($truthy(doc['$attr?']("reproducible")) ? (nil) : (doc.$attr("docdate")))))))) { + result['$<<']("" + (date) + ""); + } if ($truthy(doc['$attr?']("copyright"))) { + + $$('CopyrightRx')['$=~'](doc.$attr("copyright")); + result['$<<'](""); + result['$<<']("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + ""); + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { + result['$<<']("" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + ""); + } result['$<<'](""); + } if ($truthy(doc['$header?']())) { + + if (!$truthy((authors = doc.$authors())['$empty?']())) { + if ($truthy($rb_gt(authors.$size(), 1))) { + + result['$<<'](""); + $send(authors, 'each', [], function $$18(author){var self = $$18.$$s == null ? this : $$18.$$s; + + + if (author == null) author = nil; + return result['$<<'](self.$author_tag(doc, author));}, {$$s: self}); + result['$<<'](""); + } else { + + result['$<<'](self.$author_tag(doc, (author = authors['$[]'](0)))); + if ($truthy(author.$initials())) { + result['$<<']("" + (author.$initials()) + ""); + } } + } if (($truthy(doc['$attr?']("revdate")) && (($truthy(doc['$attr?']("revnumber")) || ($truthy(doc['$attr?']("revremark"))))))) { + + result['$<<']("\n" + ""); + if ($truthy(doc['$attr?']("revnumber"))) { + result['$<<']("" + (doc.$attr("revnumber")) + ""); + } if ($truthy(doc['$attr?']("revdate"))) { + result['$<<']("" + (doc.$attr("revdate")) + ""); + } if ($truthy(doc['$attr?']("authorinitials"))) { + result['$<<']("" + (doc.$attr("authorinitials")) + ""); + } if ($truthy(doc['$attr?']("revremark"))) { + result['$<<']("" + (doc.$attr("revremark")) + ""); + } result['$<<']("\n" + ""); + } if (($truthy(doc['$attr?']("front-cover-image")) || ($truthy(doc['$attr?']("back-cover-image"))))) { + if ($truthy((back_cover_tag = self.$cover_tag(doc, "back")))) { + + result['$<<'](self.$cover_tag(doc, "front", true)); + result['$<<'](back_cover_tag); + } else if ($truthy((front_cover_tag = self.$cover_tag(doc, "front")))) { + result['$<<'](front_cover_tag); + } + } if ($truthy(doc['$attr?']("orgname"))) { + result['$<<']("" + (doc.$attr("orgname")) + ""); + } if (!$truthy((docinfo_content = doc.$docinfo())['$empty?']())) { + result['$<<'](docinfo_content); + } } result['$<<'](""); + return result.$join($$('LF')); + }); + + $def(self, '$get_root_document', function $$get_root_document(node) { + + + while ($truthy((node = node.$document())['$nested?']())) { + node = node.$parent_document(); + } return node; + }); + + $def(self, '$generate_document_id', function $$generate_document_id(doc) { + + return "__" + (doc.$doctype()) + "-root__" + }); + + $def(self, '$enclose_content', function $$enclose_content(node) { + + if ($eqeq(node.$content_model(), "compound")) { + return node.$content() + } else { + return "" + (node.$content()) + "" + } + }); + + $def(self, '$title_tag', function $$title_tag(node, optional) { + + + if (optional == null) optional = true; + if (($not(optional) || ($truthy(node['$title?']())))) { + return "" + (node.$title()) + "\n" + } else { + return "" + } }, -2); + + $def(self, '$cover_tag', function $$cover_tag(doc, face, use_placeholder) { + var $a, cover_image = nil, width_attr = nil, depth_attr = nil, attrlist = nil, attrs = nil; + + + if (use_placeholder == null) use_placeholder = false; + if ($truthy((cover_image = doc.$attr("" + (face) + "-cover-image")))) { + + width_attr = ""; + depth_attr = ""; + if (($truthy(cover_image['$include?'](":")) && ($truthy($$('ImageMacroRx')['$=~'](cover_image))))) { + + attrlist = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)); + cover_image = doc.$image_uri((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))); + if ($truthy(attrlist)) { + + attrs = $$('AttributeList').$new(attrlist).$parse(["alt", "width", "height"]); + if ($truthy(attrs['$key?']("scaledwidth"))) { + width_attr = " width=\"" + (attrs['$[]']("scaledwidth")) + "\""; + } else { + + if ($truthy(attrs['$key?']("width"))) { + width_attr = " contentwidth=\"" + (attrs['$[]']("width")) + "\""; + } if ($truthy(attrs['$key?']("height"))) { + depth_attr = " contentdepth=\"" + (attrs['$[]']("height")) + "\""; + } } } } return "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + } else if ($truthy(use_placeholder)) { + return "" + } else { + return nil + } }, -3); + + $def(self, '$blockquote_tag', function $$blockquote_tag(node, tag_name) { + var $a, $yield = $$blockquote_tag.$$p || nil, self = this, start_tag = nil, end_tag = nil, result = nil; + + $$blockquote_tag.$$p = null; + + if (tag_name == null) tag_name = nil; + if ($truthy(tag_name)) { + $a = ["<" + (tag_name), ""], (start_tag = $a[0]), (end_tag = $a[1]); + } else { + $a = [""], (start_tag = $a[0]), (end_tag = $a[1]); + } result = ["" + (start_tag) + (self.$common_attributes(node.$id(), node.$role(), node.$reftext())) + ">"]; + if ($truthy(node['$title?']())) { + result['$<<']("" + (node.$title()) + ""); + } if (($truthy(node['$attr?']("attribution")) || ($truthy(node['$attr?']("citetitle"))))) { + + result['$<<'](""); + if ($truthy(node['$attr?']("attribution"))) { + result['$<<'](node.$attr("attribution")); + } if ($truthy(node['$attr?']("citetitle"))) { + result['$<<']("" + (node.$attr("citetitle")) + ""); + } result['$<<'](""); + } result['$<<'](Opal.yieldX($yield, [])); + result['$<<'](end_tag); + return result.$join($$('LF')); + }, -2); + + $def(self, '$asciimath_available?', function $DocBook5Converter_asciimath_available$ques$19() { + var self = this, $ret_or_1 = nil; + + return (self.asciimath_status = ($truthy(($ret_or_1 = self.asciimath_status)) ? ($ret_or_1) : (self.$load_asciimath())))['$==']("loaded") + }); + return $def(self, '$load_asciimath', function $$load_asciimath() { + var $a, $b, $c, $d; + + if ($truthy(((($a = $$$('::', 'AsciiMath', 'skip_raise')) && ($b = $a, $b) && ($c = $b) && ((($d = $c.$parse) && !$d.$$stub) || $c['$respond_to_missing?']('parse'))) ? 'method' : nil))) { + return "loaded" + } else if ($truthy($$('Helpers').$require_library("asciimath", true, "warn")['$nil?']())) { + return "unavailable" + } else { + return "loaded" + } + }); + })($$('Converter'), $$$($$('Converter'), 'Base'), $nesting) + })($nesting[0], $nesting) + }); + + } + + AsciidoctorDocBook.register = register; + + /* global AsciidoctorBrowserSpec, mocha, mochaOpts, testOpts */ + + + (async () => { + let reporter; + if (typeof mochaOpts === 'function') { + const opts = await mochaOpts(); + reporter = opts.reporter; + } else { + reporter = 'html'; + } + mocha.setup({ + ui: 'bdd', + checkLeaks: false, + reporter: reporter + }); + + const asciidoctor = Asciidoctor(); + AsciidoctorDocBook.register(); + + const expect = chai.expect; + await globalThis.AsciidoctorConvertSpec(asciidoctor, expect); + + mocha.run(function (failures) { + if (failures > 0) { + console.error('%d failures', failures); + } + }); + })().catch(err => { + console.error('Unable to start the browser tests suite: ' + err); + }); + +})); diff --git a/test/browser/util.js b/test/browser/util.cjs similarity index 98% rename from test/browser/util.js rename to test/browser/util.cjs index a58e4e7..f94e9db 100644 --- a/test/browser/util.js +++ b/test/browser/util.cjs @@ -42,7 +42,7 @@ module.exports.configure = (mockServer) => { mimetype: 'application/javascript' })) files.push(rootRelativeFile({ - path: '../shared/spec.js', + path: '../shared/spec.cjs', mimetype: 'application/javascript' })) files.push({ diff --git a/test/shared/spec.js b/test/shared/spec.cjs similarity index 100% rename from test/shared/spec.js rename to test/shared/spec.cjs diff --git a/test/spec.js b/test/spec.cjs similarity index 90% rename from test/spec.js rename to test/spec.cjs index c86b843..4149171 100644 --- a/test/spec.js +++ b/test/spec.cjs @@ -1,7 +1,8 @@ -const ospath = require('path') +/* global describe, it */ +const ospath = require('node:path') const asciidoctor = require('@asciidoctor/core')() require('../dist/index.cjs').register() // Asciidoctor DocBook -const AsciidoctorConvertSpec = require('./shared/spec.js') +const AsciidoctorConvertSpec = require('./shared/spec.cjs') const chai = require('chai') const expect = chai.expect