diff --git a/.gitignore b/.gitignore
index a413302..4f5166a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-/cpjs/node_modules/
 
 # Created by https://www.gitignore.io/api/python,sublimetext,vim
 
diff --git a/README.md b/README.md
index 68f3e76..b4d745f 100644
--- a/README.md
+++ b/README.md
@@ -63,7 +63,7 @@ These are the workflow's default keywords in Alfred:
 - `zotconf [<query>]` — View and edit workflow configuration.
     - `An Update is Available` / `Workflow is Up To Date` — Whether a newer version of the workflow is available.
     - `Default Style: …` — Choose a citation style for the `⌘↩` and `⌥↩` hotkeys (on search results).
-    - `Locale: …` — Choose a locale for the formatting of citations. If unset, US English is used.
+    - `Locale: …` — Choose a locale for the formatting of citations. If unset, the default for the style is used, or if none is set, US English.
     - `Reload Zotero Cache` — Clear the workflow's cache of Zotero data. Useful if the workflow gets out of sync with Zotero.
     - `Open Log File` — Open the workflows log file in the default app (usually Console.app). Useful for checking on indexing problems (the indexer output isn't visible in Alfred's debugger).
     - `View Documentation` — Open this README in your browser.
@@ -108,7 +108,9 @@ For `⌘↩` and `⌥↩` to work on search results, you must first choose a def
 <a name="locales"></a>
 ### Locales ###
 
-[CSL][csl] and ZotHero support the following locales. The default locale is `en-US` (American English). Use the `zotconf` keyword to set a different locale.
+[CSL][csl] and ZotHero support the following locales. The default behaviour is to use the locale specified in the style if there is one, and `en-US` (American English) if not. Setting a locale overrides the style's own locale.
+
+Use the `zotconf` keyword to force a specific locale.
 
 |                    Locale                    |   Code  |
 |----------------------------------------------|---------|
diff --git a/ZotHero-0.1.5-beta.alfredworkflow b/ZotHero-0.1.5-beta.alfredworkflow
deleted file mode 100644
index da45a19..0000000
Binary files a/ZotHero-0.1.5-beta.alfredworkflow and /dev/null differ
diff --git a/ZotHero-0.2-beta.alfredworkflow b/ZotHero-0.2-beta.alfredworkflow
new file mode 100644
index 0000000..5e38288
Binary files /dev/null and b/ZotHero-0.2-beta.alfredworkflow differ
diff --git a/cpjs/.gitignore b/cpjs/.gitignore
new file mode 100644
index 0000000..56ab8bd
--- /dev/null
+++ b/cpjs/.gitignore
@@ -0,0 +1,4 @@
+/node_modules/
+
+# Generated script
+/cite
diff --git a/cpjs/README.md b/cpjs/README.md
new file mode 100644
index 0000000..428f447
--- /dev/null
+++ b/cpjs/README.md
@@ -0,0 +1,6 @@
+cpjs
+====
+
+A CSL citation generator based on `[citeproc-js][citeproc-js]`.
+
+[citeproc-js]: https://github.com/Juris-M/citeproc-js
diff --git a/cpjs/bench b/cpjs/bench
new file mode 100755
index 0000000..cfaa6a8
--- /dev/null
+++ b/cpjs/bench
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+# Copyright (c) 2017 Dean Jackson <deanishe@deanishe.net>
+#
+# MIT Licence. See http://opensource.org/licenses/MIT
+#
+# Created on 2017-12-24
+#
+
+"""Benchmark the speed of cite.js."""
+
+
+from __future__ import print_function, absolute_import
+
+from contextlib import contextmanager
+import os
+import subprocess
+import sys
+from time import time
+
+REPS = 20
+TIMES = []
+
+HERE = os.path.dirname(__file__)
+STYLE = os.path.expanduser('~/Zotero/styles/apa.csl')
+LOCALES = os.path.join(HERE, 'locales')
+DATA = os.path.join(HERE, 'test.json')
+
+
+def log(s, *args):
+    """Simple STDERR logger."""
+    if args:
+        s = s % args
+    print(s, file=sys.stderr)
+
+
+@contextmanager
+def timed(name):
+    start = time()
+    yield
+    d = time() - start
+    log('[%s] %0.2fs', name, d)
+    TIMES.append(d)
+
+
+for i in range(REPS):
+    with timed('cite'):
+        subprocess.check_output(['./cite', '-L', LOCALES, STYLE, DATA])
+
+
+log('[average] %0.3fs', sum(TIMES) / len(TIMES))
diff --git a/cpjs/build b/cpjs/build
new file mode 100755
index 0000000..fc6faa4
--- /dev/null
+++ b/cpjs/build
@@ -0,0 +1,66 @@
+#!/bin/zsh
+
+set -e
+
+here="$( cd "$( dirname "$0" )"; pwd )"
+outfile="${here}/cite"
+libfile="${here}/../src/lib/cite/cite"
+minify=false
+
+usage() {
+    cat <<EOS
+build [-m|-h]
+
+Build `cite` from citeproc-js and cite.js.
+
+Usage:
+    build [-m]
+    build -h
+
+Options:
+    -m      Minify generated script
+    -h      Show this help message and exit
+EOS
+}
+
+while getopts ":hm" opt; do
+  case $opt in
+    h)
+      usage
+      exit 0
+      ;;
+    m)
+      minify=true
+      ;;
+    \?)
+      log "Invalid option: -$OPTARG"
+      exit 1
+      ;;
+  esac
+done
+shift $((OPTIND-1))
+
+
+echo '' > "$outfile"
+echo '#!/usr/bin/osascript -l JavaScript' > "$outfile"
+echo "\n" >> "$outfile"
+
+echo "window = this;\n\n" >> "$outfile"
+
+echo "// ======================== citeproc ==========================\n" >> "$outfile"
+
+$minify && {
+  browserify -r citeproc -s CSL | uglifyjs -c -m -r CSL >> "$outfile"
+} || {
+  browserify -r citeproc -s CSL  >> "$outfile"
+}
+
+
+echo "\n\n// ======================== /citeproc =========================\n" >> "$outfile"
+
+
+cat "${here}/cite.js" >> "$outfile"
+
+chmod +x "$outfile"
+
+command cp -vf "$outfile" "$libfile"
diff --git a/cpjs/cite.js b/cpjs/cite.js
new file mode 100755
index 0000000..15c187f
--- /dev/null
+++ b/cpjs/cite.js
@@ -0,0 +1,190 @@
+
+ObjC.import('stdlib')
+ObjC.import('Foundation')
+var fm = $.NSFileManager.defaultManager
+
+
+Array.prototype.contains = function(val) {
+    for (var i; i < this.length; i++) {
+        if (this[i] === val)
+            return true
+    }
+    return false
+}
+
+var usage = `cite [options] <style.csl> <csl.json>
+
+Generate an HTML CSL citation for item defined in <csl.json> using
+the stylesheet specified by <style.csl>.
+
+Usage:
+    cite [-b] [-v] [-l <lang>] [-L <dir>] <style.csl> <csl.json>
+    cite (-h|--help)
+
+Options:
+        -b, --bibliography               Generate bibliography-style citation
+        -l <lang>, --locale <lang>       Locale for citation
+        -L <dir>, --locale-dir <dir>     Directory locale files are in
+        -v, --verbose                    Show status messages
+        -h, --help                       Show this message and exit
+
+`
+
+// Show CLI help and exit.
+function showHelp(errMsg) {
+    var status = 0
+    if (errMsg) {
+        console.log(`error: ${errMsg}`)
+        status = 1
+    }
+    console.log(usage)
+    $.exit(status)
+}
+
+// Parse command-line flags.
+function parseArgs(argv) {
+    argv.forEach(function(s) {
+        if (s == '-h' || s == '--help')
+            showHelp()
+    })
+    if (argv.length == 0)
+        showHelp()
+
+    var args = [],
+        opts = {
+            locale: null,
+            localeDir: './locales',
+            style: null,
+            csl: null,
+            bibliography: false,
+            verbose: false
+        }
+
+    // Extract flags and collect arguments
+    for (var i=0; i < argv.length; i++) {
+        var s = argv[i]
+
+        if (s.startsWith('-')) {
+
+            if (s == '--locale' || s == '-l') {
+                opts.locale = argv[i+1]
+                i++
+            }
+
+            else if (s == '--locale-dir' || s == '-L') {
+                opts.localeDir = argv[i+1]
+                i++
+            }
+
+            else if (s == '--bibliography' || s == '-b')
+                opts.bibliography = true
+
+            else if (s == '--verbose' || s == '-v')
+                opts.verbose = true
+
+            else
+                showHelp('unknown option: ' + s)
+
+        } else {
+            args.push(s)
+        }
+    }
+
+    // Arguments
+    if (args.length > 2)
+        showHelp('script takes 2 arguments')
+
+    if (args.length > 0)
+        opts.style = args[0]
+
+    if (args.length > 1)
+        opts.csl = args[1]
+
+    return opts
+}
+
+// Read file at `path` and return its contents as a string.
+function readFile(path) {
+    var contents = $.NSString.alloc.initWithDataEncoding(fm.contentsAtPath(path), $.NSUTF8StringEncoding)
+    return ObjC.unwrap(contents)
+}
+
+
+function stripOuterDiv(html) {
+    var match = new RegExp('^<div.*?>(.+)</div>$').exec(html)
+    if (match != null)
+        return match[1]
+
+    return html
+}
+
+
+var Citer = function(opts) {
+    this.opts = opts
+    this.item = JSON.parse(readFile(opts.csl))
+    this.style = readFile(opts.style)
+    this.id = this.item.id
+
+    var locale = 'en',
+        force = false
+
+    if (opts.locale) {
+        locale = opts.locale
+        force = true
+    }
+
+    this.citer = new CSL.Engine(this, this.style, locale, force)
+}
+
+
+Citer.prototype.retrieveItem = function(id) {
+    return this.item
+}
+
+Citer.prototype.retrieveLocale = function(lang) {
+    if (this.opts.verbose) {
+        console.log(`locale=${lang}`)
+        console.log(`localeDir=${this.opts.localeDir}`)
+    }
+
+    return readFile(`${this.opts.localeDir}/locales-${lang}.xml`)
+}
+
+Citer.prototype.cite = function() {
+    var data = {html: '', rtf: ''}
+    this.citer.updateItems([this.id])
+
+    if (this.opts.bibliography) {
+
+        // -----------------------------------------------------
+        // HTML
+        var html = this.citer.makeBibliography()[1].join('\n').trim()
+        data.html = stripOuterDiv(html)
+
+        // -----------------------------------------------------
+        // RTF
+        this.citer.setOutputFormat('rtf')
+        data.rtf = this.citer.makeBibliography()[1].join('\n')
+
+    } else {
+        data.html = this.citer.makeCitationCluster([this.id])
+        this.citer.setOutputFormat('rtf')
+        data.rtf = this.citer.makeCitationCluster([this.id])
+    }
+
+    return data
+}
+
+
+function run(argv) {
+
+    var opts = parseArgs(argv)
+
+    if (opts.verbose) {
+        console.log(`bibliography=${opts.bibliography}`)
+        console.log(`csl=${opts.csl}`)
+        console.log(`style=${opts.style}`)
+    }
+
+    return JSON.stringify(new Citer(opts).cite())
+}
diff --git a/cpjs/locales b/cpjs/locales
new file mode 120000
index 0000000..979d569
--- /dev/null
+++ b/cpjs/locales
@@ -0,0 +1 @@
+../src/lib/cite/locales
\ No newline at end of file
diff --git a/cpjs/package-lock.json b/cpjs/package-lock.json
new file mode 100644
index 0000000..e8e6986
--- /dev/null
+++ b/cpjs/package-lock.json
@@ -0,0 +1,45 @@
+{
+  "name": "cpjs",
+  "version": "1.0.0",
+  "lockfileVersion": 1,
+  "requires": true,
+  "dependencies": {
+    "citeproc": {
+      "version": "2.1.183",
+      "resolved": "https://registry.npmjs.org/citeproc/-/citeproc-2.1.183.tgz",
+      "integrity": "sha1-dI1jHlYsbM6IIsWVpHNjLFiyNxc="
+    },
+    "sax": {
+      "version": "0.5.8",
+      "resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz",
+      "integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE="
+    },
+    "xml2js": {
+      "version": "0.2.8",
+      "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.2.8.tgz",
+      "integrity": "sha1-m4FpCTFjH/CdGVdUn69U9PmAs8I=",
+      "requires": {
+        "sax": "0.5.8"
+      }
+    },
+    "xmlbuilder": {
+      "version": "0.4.3",
+      "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-0.4.3.tgz",
+      "integrity": "sha1-xGFLp04K0ZbmCcknLNnh3bKKilg="
+    },
+    "xmldom": {
+      "version": "0.1.27",
+      "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz",
+      "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk="
+    },
+    "xmljson": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/xmljson/-/xmljson-0.2.0.tgz",
+      "integrity": "sha1-4tEh0TxoLGlk9q6cGgvoo8zohmw=",
+      "requires": {
+        "xml2js": "0.2.8",
+        "xmlbuilder": "0.4.3"
+      }
+    }
+  }
+}
diff --git a/cpjs/package.json b/cpjs/package.json
new file mode 100644
index 0000000..9480812
--- /dev/null
+++ b/cpjs/package.json
@@ -0,0 +1,17 @@
+{
+  "name": "cpjs",
+  "version": "1.0.0",
+  "description": "",
+  "main": "cite.js",
+  "dependencies": {
+    "citeproc": "^2.1.183",
+    "xmldom": "^0.1.27",
+    "xmljson": "^0.2.0"
+  },
+  "devDependencies": {},
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "author": "",
+  "license": "ISC"
+}
diff --git a/cpjs/test.json b/cpjs/test.json
new file mode 100644
index 0000000..7888048
--- /dev/null
+++ b/cpjs/test.json
@@ -0,0 +1,35 @@
+{
+  "URL": "http://www.cairn.info/resume.php?ID_ARTICLE=RI_166_0103",
+  "abstract": "De 1871 au tournant des ann\u00e9es 1930, l\u2019ambassade de France \u00e0 Berlin h\u00e9bergea successivement les repr\u00e9sentants du vaincu chez son vainqueur, puis du vainqueur chez son vaincu. Ces hommes furent immerg\u00e9s dans un environnement marqu\u00e9 par le poids des affrontements et des ranc\u0153urs r\u00e9ciproques. Ils trouv\u00e8rent dans la capitale du Reich un terrain o\u00f9 le rappel d\u2019une histoire douloureuse, la difficult\u00e9 du dialogue, la confrontation avec la population berlinoise, pesaient sur la mise en \u0153uvre de leurs missions comme sur le quotidien de leur vie personnelle. Inaugurant l\u2019\u00e8re d\u2019une diplomatie en terrain hostile, leur exp\u00e9rience \u00e9claire tant la relation franco-allemande que la pratique du m\u00e9tier de diplomate dans cette p\u00e9riode troubl\u00e9e.",
+  "accessed": {
+    "date-parts": [
+      [
+        2016,
+        8,
+        4
+      ]
+    ]
+  },
+  "author": [
+    {
+      "family": "Aball\u00e9a",
+      "given": "Marion"
+    }
+  ],
+  "container-title": "Relations internationales",
+  "id": "3I3M4HM7",
+  "issue": "166",
+  "issued": {
+    "date-parts": [
+      [
+        2016,
+        0,
+        0
+      ]
+    ]
+  },
+  "language": "fr-FR",
+  "source": "Cairn.info",
+  "title": "Face \u00e0 Berlin. L\u2019ambassade de France en Allemagne. Exp\u00e9rience singuli\u00e8re d\u2019une diplomatie en terrain hostile (1871-1933)",
+  "type": "article-journal"
+}
diff --git a/src/info.plist b/src/info.plist
index e5fe489..0ea2609 100644
--- a/src/info.plist
+++ b/src/info.plist
@@ -2101,7 +2101,7 @@ Edit the `ZOTERO_DIR` variable to point to Zotero 5's data directory if you aren
 		<string></string>
 	</dict>
 	<key>version</key>
-	<string>0.1.5-beta</string>
+	<string>0.2-beta</string>
 	<key>webaddress</key>
 	<string>https://github.com/deanishe/zothero</string>
 </dict>
diff --git a/src/lib/cite/.gitignore b/src/lib/cite/.gitignore
deleted file mode 100644
index e5664d2..0000000
--- a/src/lib/cite/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-gems/*/*
\ No newline at end of file
diff --git a/src/lib/cite/README.md b/src/lib/cite/README.md
index 3da4d7c..8ba5009 100644
--- a/src/lib/cite/README.md
+++ b/src/lib/cite/README.md
@@ -1,10 +1,6 @@
 cite
 ====
 
-This is a Python library, but all the heavy lifting is done by the `cite` Ruby program because `citeproc-py` sucks.
+This is a Python library, but all the heavy lifting is done by the `cite` JavaScript program because `citeproc-py` isn't very reliable.
 
-The required gems are not included in the repo. There is a Gemfile, but it won't work, as `csl` requires a different version of `namae`.
-
-If you manhandle the gems into place, the code does, however, run.
-
-Check the `cite` program to see where the gems need to be placed.
+The `cite` code and build script is in `/cpjs`.
diff --git a/src/lib/cite/__init__.py b/src/lib/cite/__init__.py
index 11a8f9a..829754a 100644
--- a/src/lib/cite/__init__.py
+++ b/src/lib/cite/__init__.py
@@ -7,7 +7,7 @@
 # Created on 2017-12-22
 #
 
-"""CSL citation generator based on Ruby."""
+"""CSL citation generator based on JavaScript."""
 
 from __future__ import print_function, absolute_import
 
diff --git a/src/lib/cite/cite b/src/lib/cite/cite
index 48fc4c2..7e3b0b4 100755
--- a/src/lib/cite/cite
+++ b/src/lib/cite/cite
@@ -1,88 +1,218 @@
-#!/usr/bin/ruby
-# encoding: utf-8
-#
-# Copyright (c) 2017 Dean Jackson <deanishe@deanishe.net>
-#
-# MIT Licence. See http://opensource.org/licenses/MIT
-#
-# Created on 2017-12-22
-#
-
-$LOAD_PATH.unshift "#{__dir__}/gems/citeproc-1.0.7/lib"
-$LOAD_PATH.unshift "#{__dir__}/gems/citeproc-ruby-1.1.8/lib"
-$LOAD_PATH.unshift "#{__dir__}/gems/csl-1.4.5/lib"
-$LOAD_PATH.unshift "#{__dir__}/gems/namae-1.0.0/lib"
-$LOAD_PATH.unshift "#{__dir__}/gems/unicode_utils-1.4.0/lib"
-
-require 'citeproc'
-require 'csl'
-require 'json'
-require 'optparse'
-
-usage = <<-EOS
-Usage: cite [options] style.csl
-
-Generate a citation based on CSL-JSON (read from STDIN) and a CSL style
-definition.
+#!/usr/bin/osascript -l JavaScript
 
-Options:
-EOS
 
-# CLI options
-options = {:locale => 'en-US'}
+window = this;
+
+
+// ======================== citeproc ==========================
+
+!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.CSL=t()}}(function(){return function t(e,i,s){function r(a,o){if(!i[a]){if(!e[a]){var l="function"==typeof require&&require;if(!o&&l)return l(a,!0);if(n)return n(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var p=i[a]={exports:{}};e[a][0].call(p.exports,function(t){var i=e[a][1][t];return r(i?i:t)},p,p.exports,t,e,i,s)}return i[a].exports}for(var n="function"==typeof require&&require,a=0;a<s.length;a++)r(s[a]);return r}({citeproc:[function(t,e,i){var CSL={PROCESSOR_VERSION:"1.1.183",CONDITION_LEVEL_TOP:1,CONDITION_LEVEL_BOTTOM:2,PLAIN_HYPHEN_REGEX:/(?:[^\\]-|\u2013)/,LOCATOR_LABELS_REGEXP:new RegExp("^((art|ch|subch|col|fig|l|n|no|op|p|pp|para|subpara|pt|r|sec|subsec|sv|sch|tit|vrs|vol)\\.)\\s+(.*)"),STATUTE_SUBDIV_GROUPED_REGEX:/((?:^| )(?:art|bk|ch|subch|col|fig|fol|l|n|no|op|p|pp|para|subpara|pt|r|sec|subsec|sv|sch|tit|vrs|vol)\. *)/g,STATUTE_SUBDIV_PLAIN_REGEX:/(?:(?:^| )(?:art|bk|ch|subch|col|fig|fol|l|n|no|op|p|pp|para|subpara|pt|r|sec|subsec|sv|sch|tit|vrs|vol)\. *)/,STATUTE_SUBDIV_STRINGS:{"art.":"article","bk.":"book","ch.":"chapter","subch.":"subchapter","p.":"page","pp.":"page","para.":"paragraph","subpara.":"subparagraph","pt.":"part","r.":"rule","sec.":"section","subsec.":"subsection","sch.":"schedule","tit.":"title","col.":"column","fig.":"figure","fol.":"folio","l.":"line","n.":"note","no.":"issue","op.":"opus","sv.":"sub-verbo","vrs.":"verse","vol.":"volume"},STATUTE_SUBDIV_STRINGS_REVERSE:{article:"art.",book:"bk.",chapter:"ch.",subchapter:"subch.",page:"p.",paragraph:"para.",subparagraph:"subpara.",part:"pt.",rule:"r.",section:"sec.",subsection:"subsec.",schedule:"sch.",title:"tit.",column:"col.",figure:"fig.",folio:"fol.",line:"l.",note:"n.",issue:"no.",opus:"op.","sub-verbo":"sv.","sub verbo":"sv.",verse:"vrs.",volume:"vol."},LOCATOR_LABELS_MAP:{art:"article",bk:"book",ch:"chapter",subch:"subchapter",col:"column",fig:"figure",fol:"folio",l:"line",n:"note",no:"issue",op:"opus",p:"page",pp:"page",para:"paragraph",subpara:"subparagraph",pt:"part",r:"rule",sec:"section",subsec:"subsection",sv:"sub-verbo",sch:"schedule",tit:"title",vrs:"verse",vol:"volume"},MODULE_MACROS:{"juris-pretitle":!0,"juris-title":!0,"juris-pretitle-short":!0,"juris-title-short":!0,"juris-main":!0,"juris-main-short":!0,"juris-tail":!0,"juris-tail-short":!0,"juris-locator":!0},MODULE_TYPES:{legal_case:!0,legislation:!0,bill:!0,hearing:!0,gazette:!0,report:!0,regulation:!0,standard:!0},NestedBraces:[["(","["],[")","]"]],checkNestedBrace:function(t){"note"===t.opt.xclass?(this.depth=0,this.update=function(t){for(var t=t?t:"",e=t.split(/([\(\)])/),i=1,s=e.length;s>i;i+=2)"("===e[i]?(1===this.depth%2&&(e[i]="["),this.depth+=1):")"===e[i]&&(0===this.depth%2&&(e[i]="]"),this.depth-=1);var r=e.join("");return r}):this.update=function(t){return t}},MULTI_FIELDS:["event","publisher","publisher-place","event-place","title","container-title","collection-title","authority","genre","title-short","medium","jurisdiction","archive","archive-place"],LangPrefsMap:{title:"titles","title-short":"titles",event:"titles",genre:"titles",medium:"titles","container-title":"journals","collection-title":"journals",archive:"journals",publisher:"publishers",authority:"publishers","publisher-place":"places","event-place":"places","archive-place":"places",jurisdiction:"places",number:"number",edition:"number",issue:"number",volume:"number"},AbbreviationSegments:function(){this["container-title"]={},this["collection-title"]={},this["institution-entire"]={},this["institution-part"]={},this.nickname={},this.number={},this.title={},this.place={},this.hereinafter={},this.classic={},this["container-phrase"]={},this["title-phrase"]={}},FIELD_CATEGORY_REMAP:{title:"title","container-title":"container-title","collection-title":"collection-title",number:"number",place:"place",archive:"collection-title","title-short":"title",genre:"title",event:"title",medium:"title","archive-place":"place","publisher-place":"place","event-place":"place",jurisdiction:"place","language-name":"place","language-name-original":"place","call-number":"number","chapter-number":"number","collection-number":"number",edition:"number",page:"number",issue:"number",locator:"number","number-of-pages":"number","number-of-volumes":"number",volume:"number","citation-number":"number",publisher:"institution-part"},parseLocator:function(t){if(this.opt.development_extensions.locator_date_and_revision&&t.locator){t.locator=""+t.locator;var e=t.locator.indexOf("|");if(e>-1){var i=t.locator;t.locator=i.slice(0,e),i=i.slice(e+1);var s=i.match(/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*/);s&&(t["locator-date"]=this.fun.dateparser.parseDateToObject(s[1]),i=i.slice(s[1].length)),t["locator-extra"]=i.replace(/^\s+/,"").replace(/\s+$/,"")}}return t.locator&&(t.locator=(""+t.locator).replace(/\s+$/,"")),t},normalizeLocaleStr:function(t){if(t){var e=t.split("-");return e[0]=e[0].toLowerCase(),e[1]&&(e[1]=e[1].toUpperCase()),e.join("-")}},parseNoteFieldHacks:function(t,e,i){if("string"==typeof t.note){for(var s=[],r=t.note.split("\n"),n=0,a=r.length;a>n;n++){var o=r[n],s=[],l=o.match(CSL.NOTE_FIELDS_REGEXP);if(l){for(var u=o.split(CSL.NOTE_FIELDS_REGEXP),p=0,h=u.length-1;h>p;p++)s.push(u[p]),s.push(l[p]);s.push(u[u.length-1]);for(var p=1,h=s.length;h>p&&(!s[p-1].trim()||!(n>0||p>1)||s[p-1].match(CSL.NOTE_FIELD_REGEXP));p+=2)s[p]="\n"+s[p].slice(2,-1).trim()+"\n";r[n]=s.join("")}}r=r.join("\n").split("\n");for(var c=0,f={},n=0,a=r.length;a>n;n++){var o=r[n],m=o.match(CSL.NOTE_FIELD_REGEXP);if(o.trim()){if(!m){if(0===n)continue;c=n;break}var d=m[1],g=m[2].replace(/^\s+/,"").replace(/\s+$/,"");if("type"===d)t.type=g,r[n]="";else if(CSL.DATE_VARIABLES.indexOf(d)>-1)i&&(t[d]={raw:g},(!e||e[d]&&g.match(/^[0-9]{4}(?:-[0-9]{1,2}(?:-[0-9]{1,2})*)*$/))&&(r[n]=""));else if(!t[d]){if(CSL.NAME_VARIABLES.indexOf(d)>-1){f[d]||(f[d]=[]);var b=g.split(/\s*\|\|\s*/);if(1===b.length)f[d].push({literal:b[0]});else if(2===b.length){var _={family:b[0],given:b[1]};CSL.parseParticles(_),f[d].push(_)}}else t[d]=g;(!e||e[d])&&(r[n]="")}}}for(var d in f)t[d]=f[d];if(e){r[c].trim()&&(r[c]="\n"+r[c]);for(var n=c-1;n>-1;n--)r[n].trim()||(r=r.slice(0,n).concat(r.slice(n+1)))}t.note=r.join("\n").trim()}},GENDERS:["masculine","feminine"],ERROR_NO_RENDERED_FORM:1,PREVIEW:"Just for laughs.",ASSUME_ALL_ITEMS_REGISTERED:2,START:0,END:1,SINGLETON:2,SEEN:6,SUCCESSOR:3,SUCCESSOR_OF_SUCCESSOR:4,SUPPRESS:5,SINGULAR:0,PLURAL:1,LITERAL:!0,BEFORE:1,AFTER:2,DESCENDING:1,ASCENDING:2,ONLY_FIRST:1,ALWAYS:2,ONLY_LAST:3,FINISH:1,POSITION_FIRST:0,POSITION_SUBSEQUENT:1,POSITION_IBID:2,POSITION_IBID_WITH_LOCATOR:3,MARK_TRAILING_NAMES:!0,POSITION_TEST_VARS:["position","first-reference-note-number","near-note"],AREAS:["citation","citation_sort","bibliography","bibliography_sort"],CITE_FIELDS:["first-reference-note-number","locator","locator-extra"],MINIMAL_NAME_FIELDS:["literal","family"],SWAPPING_PUNCTUATION:[".","!","?",":",","],TERMINAL_PUNCTUATION:[":",".",";","!","?"," "],NONE:0,NUMERIC:1,POSITION:2,COLLAPSE_VALUES:["citation-number","year","year-suffix"],DATE_PARTS:["year","month","day"],DATE_PARTS_ALL:["year","month","day","season"],DATE_PARTS_INTERNAL:["year","month","day","year_end","month_end","day_end"],NAME_PARTS:["non-dropping-particle","family","given","dropping-particle","suffix","literal"],DECORABLE_NAME_PARTS:["given","family","suffix"],DISAMBIGUATE_OPTIONS:["disambiguate-add-names","disambiguate-add-givenname","disambiguate-add-year-suffix"],GIVENNAME_DISAMBIGUATION_RULES:["all-names","all-names-with-initials","primary-name","primary-name-with-initials","by-cite"],NAME_ATTRIBUTES:["and","delimiter-precedes-last","delimiter-precedes-et-al","initialize-with","initialize","name-as-sort-order","sort-separator","et-al-min","et-al-use-first","et-al-subsequent-min","et-al-subsequent-use-first","form","prefix","suffix","delimiter"],PARALLEL_MATCH_VARS:["container-title"],PARALLEL_TYPES:["bill","gazette","regulation","legislation","legal_case","treaty","article-magazine","article-journal"],PARALLEL_COLLAPSING_MID_VARSET:["volume","issue","container-title","section","collection-number"],LOOSE:0,STRICT:1,TOLERANT:2,PREFIX_PUNCTUATION:/[.;:]\s*$/,SUFFIX_PUNCTUATION:/^\s*[.;:,\(\)]/,NUMBER_REGEXP:/(?:^\d+|\d+$)/,NAME_INITIAL_REGEXP:/^([A-Z\u0590-\u05ff\u00c0-\u017f\u0400-\u042f\u0600-\u06ff\u0370\u0372\u0376\u0386\u0388-\u03ab\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03fd-\u03ff])([a-zA-Z\u00c0-\u017f\u0400-\u052f\u0600-\u06ff\u0370-\u03ff\u1f00-\u1fff]*|)/,ROMANESQUE_REGEXP:/[-0-9a-zA-Z\u0590-\u05d4\u05d6-\u05ff\u0080-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/,ROMANESQUE_NOT_REGEXP:/[^a-zA-Z\u0590-\u05ff\u00c0-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/g,STARTSWITH_ROMANESQUE_REGEXP:/^[&a-zA-Z\u0590-\u05d4\u05d6-\u05ff\u00c0-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/,ENDSWITH_ROMANESQUE_REGEXP:/[.;:&a-zA-Z\u0590-\u05d4\u05d6-\u05ff\u00c0-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]$/,ALL_ROMANESQUE_REGEXP:/^[a-zA-Z\u0590-\u05ff\u00c0-\u017f\u0400-\u052f\u0370-\u03ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]+$/,VIETNAMESE_SPECIALS:/[\u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]/,VIETNAMESE_NAMES:/^(?:(?:[.AaBbCcDdEeGgHhIiKkLlMmNnOoPpQqRrSsTtUuVvXxYy \u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]{2,6})(\s+|$))+$/,NOTE_FIELDS_REGEXP:/\{:(?:[\-_a-z]+|[A-Z]+):[^\}]+\}/g,NOTE_FIELD_REGEXP:/^([\-_a-z]+|[A-Z]+):\s*([^\}]+)$/,PARTICLE_GIVEN_REGEXP:/^([^ ]+(?:\u02bb |\u2019 | |\' ) *)(.+)$/,PARTICLE_FAMILY_REGEXP:/^([^ ]+(?:\-|\u02bb|\u2019| |\') *)(.+)$/,DISPLAY_CLASSES:["block","left-margin","right-inline","indent"],NAME_VARIABLES:["author","editor","translator","contributor","collection-editor","composer","container-author","director","editorial-director","interviewer","original-author","recipient"],NUMERIC_VARIABLES:["call-number","chapter-number","collection-number","edition","page","issue","locator","number","number-of-pages","number-of-volumes","volume","citation-number"],DATE_VARIABLES:["locator-date","issued","event-date","accessed","container","original-date","publication-date","original-date","available-date","submitted"],TITLE_FIELD_SPLITS:function(t){for(var e=["title","short","main","sub"],i={},s=0,r=e.length;r>s;s++)i[e[s]]=t+"title"+("title"===e[s]?"":"-"+e[s]);return i},TAG_USEALL:function(t){var e,i,s,r;for(e=[""],i=t.indexOf("<"),s=t.indexOf(">");i>-1&&s>-1;)r=i>s?i+1:s+1,s>i&&-1===t.slice(i+1,s).indexOf("<")?(e[e.length-1]+=t.slice(0,i),e.push(t.slice(i,s+1)),e.push(""),t=t.slice(r)):(e[e.length-1]+=t.slice(0,s+1),t=t.slice(r)),i=t.indexOf("<"),s=t.indexOf(">");return e[e.length-1]+=t,e},demoteNoiseWords:function(t,e,i){var s=t.locale[t.opt.lang].opts["leading-noise-words"];if(e&&i){e=e.split(/\s+/),e.reverse();for(var r=[],n=e.length-1;n>-1&&s.indexOf(e[n].toLowerCase())>-1;n+=-1)r.push(e.pop());e.reverse();var a=e.join(" "),o=r.join(" ");"drop"!==i&&o?"demote"===i&&(e=[a,o].join(", ")):e=a}return e},extractTitleAndSubtitle:function(t){for(var e=["","container-"],i=0,s=e.length;s>i;i++){var r=e[i],n=CSL.TITLE_FIELD_SPLITS(r),a=[!1];if(t.multi)for(var o in t.multi._keys[n["short"]])a.push(o);var l=0;for(a.length;s>l;l++){var o=a[l],u={};if(o?(t.multi._keys[n.title]&&(u[n.title]=t.multi._keys[n.title][o]),t.multi._keys[n["short"]]&&(u[n["short"]]=t.multi._keys[n["short"]][o])):(u[n.title]=t[n.title],u[n["short"]]=t[n["short"]]),u[n.main]=u[n.title],u[n.sub]=!1,u[n.title]&&u[n["short"]]){var p=u[n["short"]],h=p.length;u[n.title].slice(0,h)===p&&u[n.title].slice(h).match(/^\s*:/)&&(u[n.main]=u[n.title].slice(0,h).replace(/\s+$/,""),u[n.sub]=u[n.title].slice(h).replace(/^\s*:\s*/,""))}if(o)for(var c in u)t.multi._keys[c]||(t.multi._keys[c]={}),t.multi._keys[c][o]=u[c];else for(var c in u)t[c]=u[c]}}},titlecaseSentenceOrNormal:function(t,e,i,s,r){var n=CSL.TITLE_FIELD_SPLITS(i),a={};if(s&&e.multi?(e.multi._keys[n.title]&&(a[n.title]=e.multi._keys[n.title][s]),e.multi._keys[n.main]&&(a[n.main]=e.multi._keys[n.main][s]),e.multi._keys[n.sub]&&(a[n.sub]=e.multi._keys[n.sub][s])):(a[n.title]=e[n.title],a[n.main]=e[n.main],a[n.sub]=e[n.sub]),a[n.main]&&a[n.sub]){var o=a[n.main],l=a[n.sub];return r?(o=CSL.Output.Formatters.sentence(t,o),l=CSL.Output.Formatters.sentence(t,l)):l=CSL.Output.Formatters["capitalize-first"](t,l),[o,l].join(a[n.title].slice(o.length,-1*l.length))}return r?CSL.Output.Formatters.sentence(t,a[n.title]):a[n.title]},getSafeEscape:function(t){if(["bibliography","citation"].indexOf(t.tmp.area)>-1){var e=[];return t.opt.development_extensions.thin_non_breaking_space_html_hack&&"html"===t.opt.mode&&e.push(function(t){return t.replace(/\u202f/g,'<span style="white-space:nowrap">&thinsp;</span>')}),e.length?function(i){for(var s=0,r=e.length;r>s;s+=1)i=e[s](i);return CSL.Output.Formats[t.opt.mode].text_escape(i)}:CSL.Output.Formats[t.opt.mode].text_escape}return function(t){return t}},SKIP_WORDS:["about","above","across","afore","after","against","along","alongside","amid","amidst","among","amongst","anenst","apropos","apud","around","as","aside","astride","at","athwart","atop","barring","before","behind","below","beneath","beside","besides","between","beyond","but","by","circa","despite","down","during","except","for","forenenst","from","given","in","inside","into","lest","like","modulo","near","next","notwithstanding","of","off","on","onto","out","over","per","plus","pro","qua","sans","since","than","through"," thru","throughout","thruout","till","to","toward","towards","under","underneath","until","unto","up","upon","versus","vs.","v.","vs","v","via","vis-à-vis","with","within","without","according to","ahead of","apart from","as for","as of","as per","as regards","aside from","back to","because of","close to","due to","except for","far from","inside of","instead of","near to","next to","on to","out from","out of","outside of","prior to","pursuant to","rather than","regardless of","such as","that of","up to","where as","or","yet","so","for","and","nor","a","an","the","de","d'","von","van","c","et","ca"],FORMAT_KEY_SEQUENCE:["@strip-periods","@font-style","@font-variant","@font-weight","@text-decoration","@vertical-align","@quotes"],INSTITUTION_KEYS:["font-style","font-variant","font-weight","text-decoration","text-case"],SUFFIX_CHARS:"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z",ROMAN_NUMERALS:[["","i","ii","iii","iv","v","vi","vii","viii","ix"],["","x","xx","xxx","xl","l","lx","lxx","lxxx","xc"],["","c","cc","ccc","cd","d","dc","dcc","dccc","cm"],["","m","mm","mmm","mmmm","mmmmm"]],CREATORS:["author","editor","contributor","translator","recipient","interviewer","composer","original-author","container-author","collection-editor"],LANGS:{"af-ZA":"Afrikaans",ar:"Arabic","bg-BG":"Bulgarian","ca-AD":"Catalan","cs-CZ":"Czech","da-DK":"Danish","de-AT":"Austrian","de-CH":"German (CH)","de-DE":"German (DE)","el-GR":"Greek","en-GB":"English (GB)","en-US":"English (US)","es-ES":"Spanish","et-EE":"Estonian",eu:"European","fa-IR":"Persian","fi-FI":"Finnish","fr-CA":"French (CA)","fr-FR":"French (FR)","he-IL":"Hebrew","hr-HR":"Croatian","hu-HU":"Hungarian","is-IS":"Icelandic","it-IT":"Italian","ja-JP":"Japanese","km-KH":"Khmer","ko-KR":"Korean","lt-LT":"Lithuanian","lv-LV":"Latvian","mn-MN":"Mongolian","nb-NO":"Norwegian (Bokmål)","nl-NL":"Dutch","nn-NO":"Norwegian (Nynorsk)","pl-PL":"Polish","pt-BR":"Portuguese (BR)","pt-PT":"Portuguese (PT)","ro-RO":"Romanian","ru-RU":"Russian","sk-SK":"Slovak","sl-SI":"Slovenian","sr-RS":"Serbian","sv-SE":"Swedish","th-TH":"Thai","tr-TR":"Turkish","uk-UA":"Ukranian","vi-VN":"Vietnamese","zh-CN":"Chinese (CN)","zh-TW":"Chinese (TW)"},LANG_BASES:{af:"af_ZA",ar:"ar",bg:"bg_BG",ca:"ca_AD",cs:"cs_CZ",da:"da_DK",de:"de_DE",el:"el_GR",en:"en_US",es:"es_ES",et:"et_EE",eu:"eu",fa:"fa_IR",fi:"fi_FI",fr:"fr_FR",he:"he_IL",hr:"hr-HR",hu:"hu_HU",is:"is_IS",it:"it_IT",ja:"ja_JP",km:"km_KH",ko:"ko_KR",lt:"lt_LT",lv:"lv-LV",mn:"mn_MN",nb:"nb_NO",nl:"nl_NL",nn:"nn-NO",pl:"pl_PL",pt:"pt_PT",ro:"ro_RO",ru:"ru_RU",sk:"sk_SK",sl:"sl_SI",sr:"sr_RS",sv:"sv_SE",th:"th_TH",tr:"tr_TR",uk:"uk_UA",vi:"vi_VN",zh:"zh_CN"},SUPERSCRIPTS:{"ª":"a","²":"2","³":"3","¹":"1","º":"o","ʰ":"h","ʱ":"ɦ","ʲ":"j","ʳ":"r","ʴ":"ɹ","ʵ":"ɻ","ʶ":"ʁ","ʷ":"w","ʸ":"y","ˠ":"ɣ","ˡ":"l","ˢ":"s","ˣ":"x","ˤ":"ʕ","ᴬ":"A","ᴭ":"Æ","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴲ":"Ǝ","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴽ":"Ȣ","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ᵂ":"W","ᵃ":"a","ᵄ":"ɐ","ᵅ":"ɑ","ᵆ":"ᴂ","ᵇ":"b","ᵈ":"d","ᵉ":"e","ᵊ":"ə","ᵋ":"ɛ","ᵌ":"ɜ","ᵍ":"g","ᵏ":"k","ᵐ":"m","ᵑ":"ŋ","ᵒ":"o","ᵓ":"ɔ","ᵔ":"ᴖ","ᵕ":"ᴗ","ᵖ":"p","ᵗ":"t","ᵘ":"u","ᵙ":"ᴝ","ᵚ":"ɯ","ᵛ":"v","ᵜ":"ᴥ","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"φ","ᵡ":"χ","⁰":"0","ⁱ":"i","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","⁺":"+","⁻":"−","⁼":"=","⁽":"(","⁾":")","ⁿ":"n","℠":"SM","™":"TM","㆒":"一","㆓":"二","㆔":"三","㆕":"四","㆖":"上","㆗":"中","㆘":"下","㆙":"甲","㆚":"乙","㆛":"丙","㆜":"丁","㆝":"天","㆞":"地","㆟":"人","ˀ":"ʔ","ˁ":"ʕ","ۥ":"و","ۦ":"ي"},SUPERSCRIPTS_REGEXP:new RegExp("[ª²³¹ºʰʱʲʳʴʵʶʷʸˠˡˢˣˤᴬᴭᴮᴰᴱᴲᴳᴴᴵᴶᴷᴸᴹᴺᴼᴽᴾᴿᵀᵁᵂᵃᵄᵅᵆᵇᵈᵉᵊᵋᵌᵍᵏᵐᵑᵒᵓᵔᵕᵖᵗᵘᵙᵚᵛᵜᵝᵞᵟᵠᵡ⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ℠™㆒㆓㆔㆕㆖㆗㆘㆙㆚㆛㆜㆝㆞㆟ˀˁۥۦ]","g"),UPDATE_GROUP_CONTEXT_CONDITION:function(t,e,i){if(t.tmp.group_context.tip.condition){if(t.tmp.group_context.tip.condition.test){var s;if("empty-label"===t.tmp.group_context.tip.condition.test)s=!e;else if("comma-safe"===t.tmp.group_context.tip.condition.test){var r=!e,n=e.slice(0,1).match(CSL.ALL_ROMANESQUE_REGEXP),a=t.tmp.just_did_number;s=r?!0:a?n&&!i?!0:!1:n&&!i?!0:!1}t.tmp.group_context.tip.force_suppress=s?!1:!0,t.tmp.group_context.tip.condition.not&&(t.tmp.group_context.tip.force_suppress=!t.tmp.group_context.tip.force_suppress)}}else t.tmp.just_did_number=e.slice(-1).match(/[0-9]/)?!0:!1},locale:{},locale_opts:{},locale_dates:{}};if("undefined"!=typeof t&&"undefined"!=typeof e&&"exports"in e){i.CSL=CSL}if(CSL.TERMINAL_PUNCTUATION_REGEXP=new RegExp("^(["+CSL.TERMINAL_PUNCTUATION.slice(0,-1).join("")+"])(.*)"),CSL.CLOSURES=new RegExp(".*[\\]\\)]"),e.exports=CSL,"undefined"==typeof console?(CSL.debug=function(t){dump("CSL: "+t+"\n")},CSL.error=function(t){dump("CSL error: "+t+"\n")}):(CSL.debug=function(t){console.log("CSL: "+t)},CSL.error=function(t){console.log("CSL error: "+t)}),e.exports=CSL,CSL.XmlJSON=function(t){this.dataObj=t,this.institution={name:"institution",attrs:{"institution-parts":"long",delimiter:", ","substitute-use-first":"1","use-last":"1"},children:[{name:"institution-part",attrs:{name:"long"},children:[]}]}},CSL.XmlJSON.prototype.clean=function(t){return t},CSL.XmlJSON.prototype.getStyleId=function(t,e){var i="id";e&&(i="title");for(var s="",r=t.children,n=0,a=r.length;a>n;n++)if("info"===r[n].name)for(var o=r[n].children,l=0,u=o.length;u>l;l++)o[l].name===i&&(s=o[l].children[0]);return s},CSL.XmlJSON.prototype.children=function(t){return t&&t.children.length?t.children.slice():!1},CSL.XmlJSON.prototype.nodename=function(t){return t?t.name:null},CSL.XmlJSON.prototype.attributes=function(t){var e={};for(var i in t.attrs)e["@"+i]=t.attrs[i];return e},CSL.XmlJSON.prototype.content=function(t){var e="";if(!t||!t.children)return e;for(var i=0,s=t.children.length;s>i;i+=1)"string"==typeof t.children[i]&&(e+=t.children[i]);return e},CSL.XmlJSON.prototype.namespace={},CSL.XmlJSON.prototype.numberofnodes=function(t){return t&&"number"==typeof t.length?t.length:0},CSL.XmlJSON.prototype.getAttributeValue=function(t,e,i){var s="";return i&&(e=i+":"+e),t&&t.attrs&&(s=t.attrs[e]?t.attrs[e]:""),s},CSL.XmlJSON.prototype.getNodeValue=function(t,e){var i="";if(e)for(var s=0,r=t.children.length;r>s;s+=1)t.children[s].name===e&&(i=t.children[s].children.length?t.children[s]:"");else t&&(i=t);return i&&i.children&&1==i.children.length&&"string"==typeof i.children[0]&&(i=i.children[0]),i},CSL.XmlJSON.prototype.setAttributeOnNodeIdentifiedByNameAttribute=function(t,e,i,s,r){"@"===s.slice(0,1)&&(s=s.slice(1));for(var n=0,a=t.children.length;a>n;n+=1)t.children[n].name===e&&t.children[n].attrs.name===i&&(t.children[n].attrs[s]=r)},CSL.XmlJSON.prototype.deleteNodeByNameAttribute=function(t,e){var i,s;for(i=0,s=t.children.length;s>i;i+=1)t.children[i]&&"string"!=typeof t.children[i]&&t.children[i].attrs.name==e&&(t.children=t.children.slice(0,i).concat(t.children.slice(i+1)))},CSL.XmlJSON.prototype.deleteAttribute=function(t,e){"undefined"!=typeof t.attrs[e]&&t.attrs.pop(e)},CSL.XmlJSON.prototype.setAttribute=function(t,e,i){return t.attrs[e]=i,!1},CSL.XmlJSON.prototype.nodeCopy=function(t,e){if(!e)var e={};if("object"==typeof e&&"undefined"==typeof e.length)for(var i in t)"string"==typeof t[i]?e[i]=t[i]:"object"==typeof t[i]&&(e[i]="undefined"==typeof t[i].length?this.nodeCopy(t[i],{}):this.nodeCopy(t[i],[]));else for(var s=0,r=t.length;r>s;s+=1)e[s]="string"==typeof t[s]?t[s]:this.nodeCopy(t[s],{});return e},CSL.XmlJSON.prototype.getNodesByName=function(t,e,i,s){if(!s)var s=[];if(!t||!t.children)return s;e===t.name&&(i?i===t.attrs.name&&s.push(t):s.push(t));for(var r=0,n=t.children.length;n>r;r+=1)"object"==typeof t.children[r]&&this.getNodesByName(t.children[r],e,i,s);return s},CSL.XmlJSON.prototype.nodeNameIs=function(t,e){return"undefined"==typeof t?!1:e==t.name?!0:!1},CSL.XmlJSON.prototype.makeXml=function(t){return"string"==typeof t&&(t="<"===t.slice(0,1)?this.jsonStringWalker.walkToObject(t):JSON.parse(t)),t},CSL.XmlJSON.prototype.insertChildNodeAfter=function(t,e,i,s){for(var r=0,n=t.children.length;n>r;r+=1)if(e===t.children[r]){t.children=t.children.slice(0,r).concat([s]).concat(t.children.slice(r+1));break}return t},CSL.XmlJSON.prototype.insertPublisherAndPlace=function(t){if("group"===t.name){for(var e=!0,i=["publisher","publisher-place"],s=0,r=t.children.length;r>s;s+=1){var n=i.indexOf(t.children[s].attrs.variable),a="text"===t.children[s].name;if(!(a&&n>-1)||t.children[s].attrs.prefix||t.children[s].attrs.suffix){e=!1;break}i=i.slice(0,n).concat(i.slice(n+1))}e&&!i.length&&(t.attrs["has-publisher-and-publisher-place"]=!0)}for(var s=0,r=t.children.length;r>s;s+=1)"object"==typeof t.children[s]&&this.insertPublisherAndPlace(t.children[s])},CSL.XmlJSON.prototype.isChildOfSubstitute=function(t){if(t.length>0){var e=t.slice(),i=e.pop();return"substitute"===i?!0:this.isChildOfSubstitute(e)}return!1},CSL.XmlJSON.prototype.addMissingNameNodes=function(t,e){if(e||(e=[]),"names"===t.name&&!this.isChildOfSubstitute(e)){for(var i=!0,s=0,r=t.children.length;r>s;s++)if("name"===t.children[s].name){i=!1;break}i&&(t.children=[{name:"name",attrs:{},children:[]}].concat(t.children))}e.push(t.name);for(var s=0,r=t.children.length;r>s;s+=1)"object"==typeof t.children[s]&&this.addMissingNameNodes(t.children[s],e);e.pop()},CSL.XmlJSON.prototype.addInstitutionNodes=function(t){var e;if("names"===t.name){for(var i={},s=-1,r=0,n=t.children.length;n>r;r+=1){if("name"==t.children[r].name){for(var a in t.children[r].attrs)i[a]=t.children[r].attrs[a];i.delimiter=t.children[r].attrs.delimiter,i.and=t.children[r].attrs.and,s=r;for(var o=0,l=t.children[r].children.length;l>o;o+=1)if("family"===t.children[r].children[o].attrs.name)for(var a in t.children[r].children[o].attrs)i[a]=t.children[r].children[o].attrs[a]}if("institution"==t.children[r].name){s=-1;break}}if(s>-1){for(var e=this.nodeCopy(this.institution),r=0,n=CSL.INSTITUTION_KEYS.length;n>r;r+=1){var u=CSL.INSTITUTION_KEYS[r];"undefined"!=typeof i[u]&&(e.children[0].attrs[u]=i[u]),i.delimiter&&(e.attrs.delimiter=i.delimiter),i.and&&(e.attrs.and="text")}t.children=t.children.slice(0,s+1).concat([e]).concat(t.children.slice(s+1))}}for(var r=0,n=t.children.length;n>r;r+=1)"string"!=typeof t.children[r]&&this.addInstitutionNodes(t.children[r])},CSL.XmlJSON.prototype.flagDateMacros=function(t){for(var e=0,i=t.children.length;i>e;e+=1)"macro"===t.children[e].name&&this.inspectDateMacros(t.children[e])&&(t.children[e].attrs["macro-has-date"]="true")},CSL.XmlJSON.prototype.inspectDateMacros=function(t){if(!t||!t.children)return!1;if("date"===t.name)return!0;for(var e=0,i=t.children.length;i>e;e+=1)if(this.inspectDateMacros(t.children[e]))return!0;return!1},CSL.stripXmlProcessingInstruction=function(t){return t?(t=t.replace(/^<\?[^?]+\?>/,""),t=t.replace(/<!--[^>]+-->/g,""),t=t.replace(/^\s+/g,""),t=t.replace(/\s+$/g,"")):t},CSL.parseXml=function(t){function e(t){t=t.split(/(?:\r\n|\n|\r)/).join(" ").replace(/>[	 ]+</g,"><").replace(/<\!--.*?-->/g,"");for(var e=t.split("><"),i=null,s=0,r=e.length;r>s;s++)s>0&&(e[s]="<"+e[s]),s<e.length-1&&(e[s]=e[s]+">"),"number"!=typeof i&&("<style "===e[s].slice(0,7)||"<locale "==e[s].slice(0,8))&&(i=s);e=e.slice(i);for(var s=e.length-2;s>-1;s--)if(-1===e[s].slice(1).indexOf("<")){var n=e[s].slice(0,5);"/>"!==e[s].slice(-2)&&("<term"===n?"</term"===e[s+1].slice(0,6)&&(e[s]=e[s]+e[s+1],e=e.slice(0,s+1).concat(e.slice(s+2))):["<sing","<mult"].indexOf(n)>-1&&"/>"!==e[s].slice(-2)&&"<"===e[s+1].slice(0,1)&&(e[s]=e[s]+e[s+1],e=e.slice(0,s+1).concat(e.slice(s+2))))}return e}function i(t){return t.split("&amp;").join("&").split("&quot;").join('"').split("&gt;").join(">").split("&lt;").join("<").replace(/&#([0-9]{1,6});/gi,function(t,e){var i=parseInt(e,10);return String.fromCharCode(i)}).replace(/&#x([a-f0-9]{1,6});/gi,function(t,e){var i=parseInt(e,16);return String.fromCharCode(i)})}function s(t){var e=t.match(/([^\'\"=	 ]+)=(?:\"[^\"]*\"|\'[^\']*\')/g);if(e)for(var i=0,s=e.length;s>i;i++)e[i]=e[i].replace(/=.*/,"");return e}function r(t,e){var i=RegExp("^.*[	 ]+"+e+"=(\"(?:[^\"]*)\"|'(?:[^']*)').*$"),s=t.match(i);return s?s[1].slice(1,-1):null}function n(t){var e=RegExp("^<([^	 />]+)"),i=t.match(e);return i?i[1]:null}function a(t){var e={};e.name=n(t),e.attrs={};var a=s(t);if(a)for(var o=0,l=a.length;l>o;o++){var u={name:a[o],value:r(t,a[o])};e.attrs[u.name]=i(u.value)}return e.children=[],e}function o(t){var e=t.match(/^.*>([^<]*)<.*$/);return i(e[1])}function l(t){c.slice(-1)[0].push(t)}function u(t){c.push(t.children)}function p(t){var e;if(t.slice(1).indexOf("<")>-1){var i=t.slice(0,t.indexOf(">")+1);e=a(i),e.children=[o(t)],l(e)}else"/>"===t.slice(-2)?(e=a(t),"term"===n(t)&&e.children.push(""),l(e)):"</"===t.slice(0,2)?c.pop():(e=a(t),l(e),u(e))}for(var h={children:[]},c=[h.children],f=e(t),m=0,d=f.length;d>m;m++){var g=f[m];p(g)}return h.children[0]},e.exports=CSL,CSL.XmlDOM=function(t){this.dataObj=t,"undefined"==typeof DOMParser?(DOMParser=function(){},DOMParser.prototype.parseFromString=function(t,e){if("undefined"!=typeof ActiveXObject){var i=new ActiveXObject("MSXML.DomDocument");return i.async=!1,i.loadXML(t),i}if("undefined"!=typeof XMLHttpRequest){var i=new XMLHttpRequest;return e||(e="text/xml"),i.open("GET","data:"+e+";charset=utf-8,"+encodeURIComponent(t),!1),i.overrideMimeType&&i.overrideMimeType(e),i.send(null),i.responseXML}if("undefined"!=typeof marknote){var s=new marknote.Parser;return s.parse(t)}},this.hasAttributes=function(t){var e;return e=t.attributes&&t.attributes.length?!0:!1}):this.hasAttributes=function(t){var e;return e=t.attributes&&t.attributes.length?!0:!1},this.importNode=function(t,e){if("undefined"==typeof t.importNode)var i=this._importNode(t,e,!0);else var i=t.importNode(e,!0);return i},this._importNode=function(t,e,i){switch(e.nodeType){case 1:var s=t.createElement(e.nodeName);if(e.attributes&&e.attributes.length>0)for(var r=0,n=e.attributes.length;n>r;)s.setAttribute(e.attributes[r].nodeName,e.getAttribute(e.attributes[r++].nodeName));if(i&&e.childNodes&&e.childNodes.length>0)for(var r=0,n=e.childNodes.length;n>r;)s.appendChild(this._importNode(t,e.childNodes[r++],i));return s;case 3:case 4:case 8:}},this.parser=new DOMParser;var e='<docco><institution institution-parts="long" delimiter=", " substitute-use-first="1" use-last="1"><institution-part name="long"/></institution></docco>',i=this.parser.parseFromString(e,"text/xml"),s=i.getElementsByTagName("institution");this.institution=s.item(0);var r=i.getElementsByTagName("institution-part");this.institutionpart=r.item(0),this.ns="http://purl.org/net/xbiblio/csl"},CSL.XmlDOM.prototype.clean=function(t){return t=t.replace(/<\?[^?]+\?>/g,""),t=t.replace(/<![^>]+>/g,""),t=t.replace(/^\s+/,""),t=t.replace(/\s+$/,""),t=t.replace(/^\n*/,"")},CSL.XmlDOM.prototype.getStyleId=function(t,e){var i="",s="id";e&&(s="title");var r=t.getElementsByTagName(s);return r&&r.length&&(r=r.item(0)),r&&(i=r.textContent),i||(i=r.innerText),i||(i=r.innerHTML),i},CSL.XmlDOM.prototype.children=function(t){var e,i,s,r;if(t){for(r=[],e=t.childNodes,i=0,s=e.length;s>i;i+=1)"#text"!=e[i].nodeName&&r.push(e[i]);return r}return[]},CSL.XmlDOM.prototype.nodename=function(t){var e=t.nodeName;return e},CSL.XmlDOM.prototype.attributes=function(t){var e,i,s,r,n;if(e=new Object,t&&this.hasAttributes(t))for(i=t.attributes,r=0,n=i.length;n>r;r+=1)s=i[r],e["@"+s.name]=s.value;return e},CSL.XmlDOM.prototype.content=function(t){var e;return e="undefined"!=typeof t.textContent?t.textContent:"undefined"!=typeof t.innerText?t.innerText:t.txt},CSL.XmlDOM.prototype.namespace={xml:"http://www.w3.org/XML/1998/namespace"},CSL.XmlDOM.prototype.numberofnodes=function(t){return t?t.length:0},CSL.XmlDOM.prototype.getAttributeName=function(t){var e=t.name;return e},CSL.XmlDOM.prototype.getAttributeValue=function(t,e,i){var s="";return i&&(e=i+":"+e),t&&this.hasAttributes(t)&&t.getAttribute(e)&&(s=t.getAttribute(e)),s},CSL.XmlDOM.prototype.getNodeValue=function(t,e){var i=null;if(e){var s=t.getElementsByTagName(e);s.length>0&&(i="undefined"!=typeof s[0].textContent?s[0].textContent:"undefined"!=typeof s[0].innerText?s[0].innerText:s[0].text)}return null===i&&t&&t.childNodes&&(0==t.childNodes.length||1==t.childNodes.length&&"#text"==t.firstChild.nodeName)&&(i="undefined"!=typeof t.textContent?t.textContent:"undefined"!=typeof t.innerText?t.innerText:t.text),null===i&&(i=t),i},CSL.XmlDOM.prototype.setAttributeOnNodeIdentifiedByNameAttribute=function(t,e,i,s,r){var n,a,o,l;for("@"===s.slice(0,1)&&(s=s.slice(1)),o=t.getElementsByTagName(e),n=0,a=o.length;a>n;n+=1)l=o[n],l.getAttribute("name")==i&&l.setAttribute(s,r)},CSL.XmlDOM.prototype.deleteNodeByNameAttribute=function(t,e){var i,s,r,n;for(n=t.childNodes,i=0,s=n.length;s>i;i+=1)r=n[i],r&&r.nodeType!=r.TEXT_NODE&&this.hasAttributes(r)&&r.getAttribute("name")==e&&t.removeChild(n[i])},CSL.XmlDOM.prototype.deleteAttribute=function(t,e){t.removeAttribute(e)},CSL.XmlDOM.prototype.setAttribute=function(t,e,i){return t.ownerDocument||(t=t.firstChild),["function","unknown"].indexOf(typeof t.setAttribute)>-1&&t.setAttribute(e,i),!1},CSL.XmlDOM.prototype.nodeCopy=function(t){var e=t.cloneNode(!0);return e},CSL.XmlDOM.prototype.getNodesByName=function(t,e,i){var s,r,n,a,o;for(s=[],r=t.getElementsByTagName(e),a=0,o=r.length;o>a;a+=1)n=r.item(a),(!i||this.hasAttributes(n)&&n.getAttribute("name")==i)&&s.push(n);return s},CSL.XmlDOM.prototype.nodeNameIs=function(t,e){return e==t.nodeName?!0:!1},CSL.XmlDOM.prototype.makeXml=function(t){t||(t="<docco><bogus/></docco>"),t=t.replace(/\s*<\?[^>]*\?>\s*\n*/g,"");var e=this.parser.parseFromString(t,"application/xml");return e.firstChild},CSL.XmlDOM.prototype.insertChildNodeAfter=function(t,e,i,s){var r;return r=this.importNode(e.ownerDocument,s),t.replaceChild(r,e),t},CSL.XmlDOM.prototype.insertPublisherAndPlace=function(t){
+for(var e=t.getElementsByTagName("group"),i=0,s=e.length;s>i;i+=1){for(var r=e.item(i),n=[],a=0,o=r.childNodes.length;o>a;a+=1)1!==r.childNodes.item(a).nodeType&&n.push(a);if(r.childNodes.length-n.length===2){for(var l=[],a=0,o=2;o>a;a+=1)if(!(n.indexOf(a)>-1)){for(var u=r.childNodes.item(a),p=[],h=0,c=u.childNodes.length;c>h;h+=1)1!==u.childNodes.item(h).nodeType&&p.push(h);if(u.childNodes.length-p.length===0&&(l.push(u.getAttribute("variable")),u.getAttribute("suffix")||u.getAttribute("prefix"))){l=[];break}}l.indexOf("publisher")>-1&&l.indexOf("publisher-place")>-1&&r.setAttribute("has-publisher-and-publisher-place",!0)}}},CSL.XmlDOM.prototype.isChildOfSubstitute=function(t){return t.parentNode?"substitute"===t.parentNode.tagName.toLowerCase()?!0:this.isChildOfSubstitute(t.parentNode):!1},CSL.XmlDOM.prototype.addMissingNameNodes=function(t){for(var e=t.getElementsByTagName("names"),i=0,s=e.length;s>i;i+=1){var r=e.item(i),n=r.getElementsByTagName("name");if(!(n&&0!==n.length||this.isChildOfSubstitute(r))){var a=r.ownerDocument,o=a.createElement("name");r.appendChild(o)}}},CSL.XmlDOM.prototype.addInstitutionNodes=function(t){var e,i,s,r,n,a,o,l;for(e=t.getElementsByTagName("names"),o=0,l=e.length;l>o;o+=1)if(i=e.item(o),n=i.getElementsByTagName("name"),0!=n.length&&(s=i.getElementsByTagName("institution"),0==s.length)){r=this.importNode(t.ownerDocument,this.institution),theinstitutionpart=r.getElementsByTagName("institution-part").item(0),a=n.item(0),i.insertBefore(r,a.nextSibling);for(var u=0,p=CSL.INSTITUTION_KEYS.length;p>u;u+=1){var h=CSL.INSTITUTION_KEYS[u],c=a.getAttribute(h);c&&theinstitutionpart.setAttribute(h,c)}for(var f=a.getElementsByTagName("name-part"),u=0,p=f.length;p>u;u+=1)if("family"===f[u].getAttribute("name"))for(var m=0,d=CSL.INSTITUTION_KEYS.length;d>m;m+=1){var h=CSL.INSTITUTION_KEYS[m],c=f[u].getAttribute(h);c&&theinstitutionpart.setAttribute(h,c)}}},CSL.XmlDOM.prototype.flagDateMacros=function(t){var e,i,s,r;for(nodes=t.getElementsByTagName("macro"),e=0,i=nodes.length;i>e;e+=1)s=nodes.item(e),r=s.getElementsByTagName("date"),r.length&&s.setAttribute("macro-has-date","true")},e.exports=CSL,"undefined"!=typeof XML)try{}catch(s){throw"OOPS: "+s}e.exports=CSL,CSL.setupXml=function(t){var e={},i=null;if("undefined"!=typeof t?"string"==typeof t?(t=t.replace("^\ufeff","").replace(/^\s+/,""),e="<"===t.slice(0,1)?CSL.parseXml(t):JSON.parse(t),i=new CSL.XmlJSON(e)):i="undefined"!=typeof t.getAttribute?new CSL.XmlDOM(t):"undefined"!=typeof t.toXMLString?new CSL.XmlE4X(t):new CSL.XmlJSON(t):CSL.error("unable to parse XML input"),!i)throw"citeproc-js error: unable to parse CSL style or locale object";return i},e.exports=CSL,CSL.getSortCompare=function(t){if(CSL.stringCompare)return CSL.stringCompare;var e,i={sensitivity:"base",ignorePunctuation:!0,numeric:!0};t||(t="en-US"),e=function(e,s){return e.toLocaleLowerCase().localeCompare(s.toLocaleLowerCase(),t,i)};var s=function(t){return t.replace(/^[\[\]\'\"]*/g,"")},r=function(){return e("[x","x")?function(t,i){return e(s(t),s(i))}:!1},n=r(),a=function(t,i){return n?n(t,i):e(t,i)};return a},e.exports=CSL,CSL.ambigConfigDiff=function(t,e){var i,s,r,n;if(t.names.length!==e.names.length)return 1;for(i=0,s=t.names.length;s>i;i+=1){if(t.names[i]!==e.names[i])return 1;for(r=0,n=t.givens[i];n>r;r+=1)if(t.givens[i][r]!==e.givens[i][r])return 1}return t.disambiguate!=e.disambiguate?1:t.year_suffix!==e.year_suffix?1:0},CSL.cloneAmbigConfig=function(t,e){var i,s,r,n,a,o={};for(o.names=[],o.givens=[],o.year_suffix=!1,o.disambiguate=!1,i=0,s=t.names.length;s>i;i+=1)a=t.names[i],o.names[i]=a;for(i=0,s=t.givens.length;s>i;i+=1){for(a=[],r=0,n=t.givens[i].length;n>r;r+=1)a.push(t.givens[i][r]);o.givens.push(a)}return e?(o.year_suffix=e.year_suffix,o.disambiguate=e.disambiguate):(o.year_suffix=t.year_suffix,o.disambiguate=t.disambiguate),o},CSL.getAmbigConfig=function(){var t,e;t=this.tmp.disambig_request,t||(t=this.tmp.disambig_settings);var e=CSL.cloneAmbigConfig(t);return e},CSL.getMaxVals=function(){return this.tmp.names_max.mystack.slice()},CSL.getMinVal=function(){return this.tmp["et-al-min"]},e.exports=CSL,CSL.tokenExec=function(t,e,i){var s,r,n,a;a=!1,s=t.next,r=!1;var o=function(e){return e?(this.tmp.jump.replace("succeed"),t.succeed):(this.tmp.jump.replace("fail"),t.fail)};t.test&&(s=o.call(this,t.test(e,i)));for(var l=0,u=t.execs.length;u>l;l++)n=t.execs[l],r=n.call(t,this,e,i),r&&(s=r);return s},CSL.expandMacro=function(t,e){var i,s,r,n;i=t.postponed_macro,t=new CSL.Token("group",CSL.START);var a=!1,o=!1;if(s=this.cslXml.getNodesByName(this.cslXml.dataObj,"macro",i),s.length&&(o=this.cslXml.getAttributeValue(s[0],"cslid"),a=this.cslXml.getAttributeValue(s[0],"macro-has-date")),a&&(i=i+"@"+this.build.current_default_locale,n=function(t){t.tmp.extension&&(t.tmp["doing-macro-with-date"]=!0)},t.execs.push(n)),this.build.macro_stack.indexOf(i)>-1)throw'CSL processor error: call to macro "'+i+'" would cause an infinite loop';if(this.build.macro_stack.push(i),t.cslid=o,CSL.MODULE_MACROS[i]&&(t.juris=i,this.opt.update_mode=CSL.POSITION),CSL.Node.group.build.call(t,this,e,!0),!this.cslXml.getNodeValue(s))throw'CSL style error: undefined macro "'+i+'"';var l=CSL.getMacroTarget.call(this,i);if(l&&(CSL.buildMacro.call(this,l,s),CSL.configureMacro.call(this,l)),!this.build.extension){var n=function(t){return function(e,i,s){for(var r=0;r<e.macros[t].length;)r=CSL.tokenExec.call(e,e.macros[t][r],i,s)}}(i),u=new CSL.Token("text",CSL.SINGLETON);u.execs.push(n),e.push(u)}r=new CSL.Token("group",CSL.END),a&&(n=function(t){t.tmp.extension&&(t.tmp["doing-macro-with-date"]=!1)},r.execs.push(n)),t.juris&&(r.juris=i),CSL.Node.group.build.call(r,this,e,!0),this.build.macro_stack.pop()},CSL.getMacroTarget=function(t){var e=!1;return this.build.extension?e=this[this.build.root+this.build.extension].tokens:this.macros[t]||(e=[],this.macros[t]=e),e},CSL.buildMacro=function(t,e){var i,s=CSL.makeBuilder(this,t);i="undefined"==typeof e.length?e:e[0],s(i)},CSL.configureMacro=function(t){this.build.extension||this.configureTokenList(t)},CSL.XmlToToken=function(t,e,i){var s,r,n,a,o,l,u,p;if(s=t.cslXml.nodename(this),!t.build.skip||t.build.skip===s){if(!s)return r=t.cslXml.content(this),void(r&&(t.build.text=r));if(!CSL.Node[t.cslXml.nodename(this)])throw'Undefined node name "'+s+'".';if(n=[],a=t.cslXml.attributes(this),o=CSL.setDecorations.call(this,t,a),l=new CSL.Token(s,e),e!==CSL.END||"if"===s||"else-if"===s||"layout"===s){for(var u in a)if(a.hasOwnProperty(u)){if(e===CSL.END&&"@language"!==u&&"@locale"!==u)continue;if(a.hasOwnProperty(u))if(CSL.Attributes[u])try{CSL.Attributes[u].call(l,t,""+a[u])}catch(h){throw CSL.error(h),"CSL processor error, "+u+" attribute: "+h}else CSL.debug('warning: undefined attribute "'+u+'" in style')}l.decorations=o}else e===CSL.END&&a["@variable"]&&(l.hasVariable=!0,CSL.DATE_VARIABLES.indexOf(a["@variable"])>-1&&(l.variables=a["@variable"].split(/\s+/)));p=i?i:t[t.build.area].tokens,CSL.Node[s].build.call(l,t,p,!0)}},e.exports=CSL,CSL.DateParser=new function(){for(var t=[["明治",1867],["大正",1911],["昭和",1925],["平成",1988]],e={},i=0,s=t.length;s>i;i++){var r=t[i][0],n=t[i][1];e[r]=n}for(var a=[],i=0,s=t.length;s>i;i++){var n=t[i][0];a.push(n)}var o=a.join("|"),l=new RegExp("(?:"+o+")(?:[0-9]+)"),u=new RegExp("(?:"+o+")(?:[0-9]+)","g"),p=/(\u6708|\u5E74)/g,h=/\u65E5/g,c=/\u301c/g,f="(?:[?0-9]{1,2}%%NUMD%%){0,2}[?0-9]{4}(?![0-9])",m="[?0-9]{4}(?:%%NUMD%%[?0-9]{1,2}){0,2}(?![0-9])",d="[?0-9]{1,3}",g="[%%DATED%%]",b="[?~]",_="[^-/~?0-9]+",v="("+m+"|"+f+"|"+d+"|"+g+"|"+b+"|"+_+")",y=new RegExp(v.replace(/%%NUMD%%/g,"-").replace(/%%DATED%%/g,"-")),x=new RegExp(v.replace(/%%NUMD%%/g,"-").replace(/%%DATED%%/g,"/")),I=new RegExp(v.replace(/%%NUMD%%/g,"/").replace(/%%DATED%%/g,"-")),O="january february march april may june july august september october november december spring summer fall winter spring summer";this.monthStrings=O.split(" "),this.setOrderDayMonth=function(){this.monthGuess=1,this.dayGuess=0},this.setOrderMonthDay=function(){this.monthGuess=0,this.dayGuess=1},this.resetDateParserMonths=function(){this.monthSets=[];for(var t=0,e=this.monthStrings.length;e>t;t++)this.monthSets.push([this.monthStrings[t]]);this.monthAbbrevs=[];for(var t=0,e=this.monthSets.length;e>t;t++){this.monthAbbrevs.push([]);for(var i=0,s=this.monthSets[t].length;s>i;i++)this.monthAbbrevs[t].push(this.monthSets[t][0].slice(0,3))}this.monthRexes=[];for(var t=0,e=this.monthAbbrevs.length;e>t;t++)this.monthRexes.push(new RegExp("(?:"+this.monthAbbrevs[t].join("|")+")"))},this.addDateParserMonths=function(t){if("string"==typeof t&&(t=t.split(/\s+/)),12!==t.length&&16!==t.length)return void CSL.debug("month [+season] list of "+t.length+", expected 12 or 16. Ignoring.");for(var e=0,i=t.length;i>e;e++){for(var s=null,r=!1,n=3,a={},o=0,l=this.monthAbbrevs.length;l>o;o++){if(a[o]={},o===e){for(var u=0,p=this.monthAbbrevs[e].length;p>u;u++)if(this.monthAbbrevs[e][u]===t[e].slice(0,this.monthAbbrevs[e][u].length)){r=!0;break}}else for(var u=0,p=this.monthAbbrevs[o].length;p>u;u++)if(s=this.monthAbbrevs[o][u].length,this.monthAbbrevs[o][u]===t[e].slice(0,s)){for(;this.monthSets[o][u].slice(0,s)===t[e].slice(0,s);){if(s>t[e].length||s>this.monthSets[o][u].length){CSL.debug("unable to disambiguate month string in date parser: "+t[e]);break}s+=1}n=s,a[o][u]=s}for(var h in a)for(kKey in a[h])s=a[h][kKey],h=parseInt(h,10),kKey=parseInt(kKey,10),this.monthAbbrevs[h][kKey]=this.monthSets[h][kKey].slice(0,s)}r||(this.monthSets[e].push(t[e]),this.monthAbbrevs[e].push(t[e].slice(0,n)))}this.monthRexes=[],this.monthRexStrs=[];for(var e=0,i=this.monthAbbrevs.length;i>e;e++)this.monthRexes.push(new RegExp("^(?:"+this.monthAbbrevs[e].join("|")+")")),this.monthRexStrs.push("^(?:"+this.monthAbbrevs[e].join("|")+")");if(18===this.monthAbbrevs.length)for(var e=12,i=14;i>e;e++)this.monthRexes[e+4]=new RegExp("^(?:"+this.monthAbbrevs[e].join("|")+")"),this.monthRexStrs[e+4]="^(?:"+this.monthAbbrevs[e].join("|")+")"},this.convertDateObjectToArray=function(t){t["date-parts"]=[],t["date-parts"].push([]);for(var e=0,i=0,s=3;s>i;i++){var r=["year","month","day"][i];if(!t[r])break;e+=1,t["date-parts"][0].push(t[r]),delete t[r]}t["date-parts"].push([]);for(var i=0,s=e;s>i&&(r=["year_end","month_end","day_end"][i],t[r]);i++)t["date-parts"][1].push(t[r]),delete t[r];return t["date-parts"][0].length!==t["date-parts"][1].length&&t["date-parts"].pop(),t},this.convertDateObjectToString=function(t){for(var e=[],i=0,s=3;s>i&&t[DATE_PARTS_ALL[i]];i+=1)e.push(t[DATE_PARTS_ALL[i]]);return e.join("-")},this._parseNumericDate=function(t,e,i,s){i||(i="");for(var r=s.split(e),n=0,a=r.length;a>n;n++)if(4===r[n].length){t["year"+i]=r[n].replace(/^0*/,""),r=n?r.slice(0,n):r.slice(1);break}for(var n=0,a=r.length;a>n;n++)r[n]=parseInt(r[n],10);1===r.length||2===r.length&&!r[1]?t["month"+i]=""+r[0]:2===r.length&&(r[this.monthGuess]>12?(t["month"+i]=""+r[this.dayGuess],t["day"+i]=""+r[this.monthGuess]):(t["month"+i]=""+r[this.monthGuess],t["day"+i]=""+r[this.dayGuess]))},this.parseDateToObject=function(t){var e,i=t,s=-1,r=-1,n=!1;if(t){if("-"===t.slice(0,1)&&(n=!0,t=t.slice(1)),t.match(/^[0-9]{1,3}$/))for(;t.length<4;)t="0"+t;t=""+t,t=t.replace(/\s*[0-9]{2}:[0-9]{2}(?::[0-9]+)/,"");var a=t.match(p);if(a){t=t.replace(/\s+/g,""),t=t.replace(h,""),t=t.replace(p,"-"),t=t.replace(c,"/"),t=t.replace(/\-\//g,"/"),t=t.replace(/-$/g,"");var o=t.split(l);e=[];var f=t.match(u);if(f){for(var m=[],d=0,g=f.length;g>d;d++)m=m.concat(f[d].match(/([^0-9]+)([0-9]+)/).slice(1));for(var d=0,g=o.length;g>d;d++)if(e.push(o[d]),d!==len-1){var b=2*pos;e.push(m[b]),e.push(m[b+1])}}else e=o;for(var d=1,g=e.length;g>d;d+=3)e[d+1]=jiy[e[d]]+parseInt(e[d+1],10),e[d]="";t=e.join(""),t=t.replace(/\s*-\s*$/,"").replace(/\s*-\s*\//,"/"),t=t.replace(/\.\s*$/,""),t=t.replace(/\.(?! )/,""),s=t.indexOf("/"),r=t.indexOf("-")}}t=t.replace(/([A-Za-z])\./g,"$1");var _,v,O="",S="",T={};if('"'===t.slice(0,1)&&'"'===t.slice(-1))return T.literal=t.slice(1,-1),T;if(s>-1&&r>-1){var A=t.split("/");A.length>3?(_="-",t=t.replace(/\_/g,"-"),v="/",e=t.split(I)):(_="/",t=t.replace(/\_/g,"/"),v="-",e=t.split(x))}else t=t.replace(/\//g,"-"),t=t.replace(/\_/g,"-"),_="-",v="-",e=t.split(y);for(var N=[],d=0,g=e.length;g>d;d++){var a=e[d].match(/^\s*([\-\/]|[^\-\/\~\?0-9]+|[\-~?0-9]+)\s*$/);a&&N.push(a[1])}var E=N.indexOf(_),k=[],R=!1;E>-1?(k.push([0,E]),k.push([E+1,N.length]),R=!0):k.push([0,N.length]);for(var w="",d=0,g=k.length;g>d;d++){var L=k[d],C=N.slice(L[0],L[1]);t:for(var j=0,D=C.length;D>j;j++){var P=C[j];if(P.indexOf(v)>-1)this._parseNumericDate(T,v,w,P);else if(P.match(/[0-9]{4}/))T["year"+w]=P.replace(/^0*/,"");else{for(var U=0,B=this.monthRexes.length;B>U;U++)if(P.toLocaleLowerCase().match(this.monthRexes[U])){T["month"+w]=""+(parseInt(U,10)+1);continue t}P.match(/^[0-9]+$/)&&(O=P),P.toLocaleLowerCase().match(/^bc/)&&O?(T["year"+w]=""+-1*O,O=""):P.toLocaleLowerCase().match(/^ad/)&&O?(T["year"+w]=""+O,O=""):"~"===P||"?"===P||"c"===P||P.match(/^cir/)?T.circa="1":!P.toLocaleLowerCase().match(/(?:mic|tri|hil|eas)/)||T["season"+w]||(S=P)}}O&&(T["day"+w]=O,O=""),S&&!T["season"+w]&&(T["season"+w]=S,S=""),w="_end"}if(R)for(var j=0,D=CSL.DATE_PARTS_ALL.length;D>j;j++){var M=CSL.DATE_PARTS_ALL[j];T[M]&&!T[M+"_end"]?T[M+"_end"]=T[M]:!T[M]&&T[M+"_end"]&&(T[M]=T[M+"_end"])}(!T.year||T.year&&T.day&&!T.month)&&(T={literal:i});for(var X=["year","month","day","year_end","month_end","day_end"],d=0,g=X.length;g>d;d++){var q=X[d];"string"==typeof T[q]&&T[q].match(/^[0-9]+$/)&&(T[q]=parseInt(T[q],10))}return n&&Object.keys(T).indexOf("year")>-1&&(T.year=-1*T.year),T},this.parseDateToArray=function(t){return this.convertDateObjectToArray(this.parseDateToObject(t))},this.parseDateToString=function(t){return this.convertDateObjectToString(this.parseDateToObject(t))},this.parse=function(t){return this.parseDateToObject(t)},this.setOrderMonthDay(),this.resetDateParserMonths()},e.exports=CSL,CSL.Engine=function(t,e,i,s){function r(t){var t=t.slice(),e=new RegExp("(?:(?:[?!:]*\\s+|-|^)(?:"+t.join("|")+")(?=[!?:]*\\s+|-|$))","g");return e}var n,a;this.processor_version=CSL.PROCESSOR_VERSION,this.csl_version="1.0",this.sys=t,t.variableWrapper&&(CSL.VARIABLE_WRAPPER_PREPUNCT_REX=new RegExp("^(["+[" "].concat(CSL.SWAPPING_PUNCTUATION).join("")+"]*)(.*)")),CSL.retrieveStyleModule&&(this.sys.retrieveStyleModule=CSL.retrieveStyleModule),CSL.getAbbreviation&&(this.sys.getAbbreviation=CSL.getAbbreviation),this.sys.stringCompare&&(CSL.stringCompare=this.sys.stringCompare),this.sys.AbbreviationSegments=CSL.AbbreviationSegments,this.parallel=new CSL.Parallel(this),this.transform=new CSL.Transform(this),this.setParseNames=function(t){this.opt["parse-names"]=t},this.opt=new CSL.Engine.Opt,this.tmp=new CSL.Engine.Tmp,this.build=new CSL.Engine.Build,this.fun=new CSL.Engine.Fun(this),this.configure=new CSL.Engine.Configure,this.citation_sort=new CSL.Engine.CitationSort,this.bibliography_sort=new CSL.Engine.BibliographySort,this.citation=new CSL.Engine.Citation(this),this.bibliography=new CSL.Engine.Bibliography,this.output=new CSL.Output.Queue(this),this.dateput=new CSL.Output.Queue(this),this.cslXml=CSL.setupXml(e),(this.opt.development_extensions.csl_reverse_lookup_support||this.sys.csl_reverse_lookup_support)&&(this.build.cslNodeId=0,this.setCslNodeIds=function(t,e){var i=this.cslXml.children(t);this.cslXml.setAttribute(t,"cslid",this.build.cslNodeId),this.opt.nodenames.push(e),this.build.cslNodeId+=1;for(var s=0,r=this.cslXml.numberofnodes(i);r>s;s+=1)e=this.cslXml.nodename(i[s]),e&&this.setCslNodeIds(i[s],e)},this.setCslNodeIds(this.cslXml.dataObj,"style")),this.cslXml.addMissingNameNodes(this.cslXml.dataObj),this.cslXml.addInstitutionNodes(this.cslXml.dataObj),this.cslXml.insertPublisherAndPlace(this.cslXml.dataObj),this.cslXml.flagDateMacros(this.cslXml.dataObj),n=this.cslXml.attributes(this.cslXml.dataObj),"undefined"==typeof n["@sort-separator"]&&this.cslXml.setAttribute(this.cslXml.dataObj,"sort-separator",", "),this.opt["initialize-with-hyphen"]=!0,this.setStyleAttributes(),this.opt.xclass=this.cslXml.getAttributeValue(this.cslXml.dataObj,"class"),this.opt["class"]=this.opt.xclass,this.opt.styleID=this.cslXml.getStyleId(this.cslXml.dataObj),CSL.setSuppressedJurisdictions&&CSL.setSuppressedJurisdictions(this.opt.styleID,this.opt.suppressedJurisdictions),this.opt.styleName=this.cslXml.getStyleId(this.cslXml.dataObj,!0),"1.1m"===this.opt.version.slice(0,4)&&(this.opt.development_extensions.static_statute_locator=!0,this.opt.development_extensions.handle_parallel_articles=!0,this.opt.development_extensions.main_title_from_short_title=!0,this.opt.development_extensions.rtl_support=!0,this.opt.development_extensions.expect_and_symbol_form=!0,this.opt.development_extensions.require_explicit_legal_case_title_short=!0,this.opt.development_extensions.force_jurisdiction=!0),i&&(i=i.replace("_","-"),i=CSL.normalizeLocaleStr(i)),this.opt["default-locale"][0]&&(this.opt["default-locale"][0]=this.opt["default-locale"][0].replace("_","-"),this.opt["default-locale"][0]=CSL.normalizeLocaleStr(this.opt["default-locale"][0])),i&&s&&(this.opt["default-locale"]=[i]),i&&!s&&this.opt["default-locale"][0]&&(i=this.opt["default-locale"][0]),0===this.opt["default-locale"].length&&(i||(i="en-US"),this.opt["default-locale"].push("en-US")),i||(i=this.opt["default-locale"][0]),a=CSL.localeResolve(i),this.opt.lang=a.best,this.opt["default-locale"][0]=a.best,this.locale={},this.opt["default-locale-sort"]||(this.opt["default-locale-sort"]=this.opt["default-locale"][0]),this.opt.sort_sep="dale|".localeCompare("daleb",this.opt["default-locale-sort"])>-1?"@":"|",this.localeConfigure(a),this.locale[this.opt.lang].opts["skip-words-regexp"]=r(this.locale[this.opt.lang].opts["skip-words"]),this.output.adjust=new CSL.Output.Queue.adjust(this.getOpt("punctuation-in-quote")),this.registry=new CSL.Registry(this),this.macros={},this.build.area="citation";var o=this.cslXml.getNodesByName(this.cslXml.dataObj,this.build.area);this.buildTokenLists(o,this[this.build.area].tokens),this.build.area="bibliography";var o=this.cslXml.getNodesByName(this.cslXml.dataObj,this.build.area);this.buildTokenLists(o,this[this.build.area].tokens),this.juris={},this.configureTokenLists(),this.disambiguate=new CSL.Disambiguation(this),this.splice_delimiter=!1,this.fun.dateparser=CSL.DateParser,this.fun.flipflopper=new CSL.Util.FlipFlopper(this),this.setCloseQuotesArray(),this.fun.ordinalizer.init(this),this.fun.long_ordinalizer.init(this),this.fun.page_mangler=CSL.Util.PageRangeMangler.getFunction(this,"page"),this.fun.year_mangler=CSL.Util.PageRangeMangler.getFunction(this,"year"),this.setOutputFormat("html")},CSL.Engine.prototype.setCloseQuotesArray=function(){var t;t=[],t.push(this.getTerm("close-quote")),t.push(this.getTerm("close-inner-quote")),t.push('"'),t.push("'"),this.opt.close_quotes_array=t},CSL.makeBuilder=function(t,e){function i(i){CSL.XmlToToken.call(i,t,CSL.START,e)}function s(i){CSL.XmlToToken.call(i,t,CSL.END,e)}function r(i){CSL.XmlToToken.call(i,t,CSL.SINGLETON,e)}function n(e){var a;if(t.cslXml.numberofnodes(t.cslXml.children(e))){a=e,i(a);for(var o=0;o<t.cslXml.numberofnodes(t.cslXml.children(a));o+=1)e=t.cslXml.children(a)[o],null!==t.cslXml.nodename(e)&&("date"===t.cslXml.nodename(e)&&(CSL.Util.fixDateNode.call(t,a,o,e),e=t.cslXml.children(a)[o]),n(e,i,s,r));s(a)}else r(e)}return n},CSL.Engine.prototype.buildTokenLists=function(t,e){if(this.cslXml.getNodeValue(t)){var i,s=CSL.makeBuilder(this,e);i="undefined"==typeof t.length?t:t[0],s(i)}},CSL.Engine.prototype.setStyleAttributes=function(){var t,e,i,t={};t.name=this.cslXml.nodename(this.cslXml.dataObj),e=this.cslXml.attributes(this.cslXml.dataObj);for(i in e)e.hasOwnProperty(i)&&CSL.Attributes[i].call(t,this,e[i])},CSL.Engine.prototype.getTerm=function(t,e,i,s,r,n){t&&t.match(/[A-Z]/)&&t===t.toUpperCase()&&(CSL.debug("Warning: term key is in uppercase form: "+t),t=t.toLowerCase());var a;a=n?this.opt["default-locale"][0]:this.opt.lang;var o=CSL.Engine.getField(CSL.LOOSE,this.locale[a].terms,t,e,i,s);if(o||"range-delimiter"!==t||(o="–"),"undefined"==typeof o){if(r===CSL.STRICT)throw'Error in getTerm: term "'+t+'" does not exist.';r===CSL.TOLERANT&&(o="")}return o&&(this.tmp.cite_renders_content=!0),o},CSL.Engine.prototype.getDate=function(t,e){var i;return i=e?this.opt["default-locale"]:this.opt.lang,this.locale[i].dates[t]?this.locale[i].dates[t]:!1},CSL.Engine.prototype.getOpt=function(t){return"undefined"!=typeof this.locale[this.opt.lang].opts[t]?this.locale[this.opt.lang].opts[t]:!1},CSL.Engine.prototype.getVariable=function(t,e,i,s){return CSL.Engine.getField(CSL.LOOSE,t,e,i,s)},CSL.Engine.prototype.getDateNum=function(t,e){return"undefined"==typeof t?0:t[e]},CSL.Engine.getField=function(t,e,i,s,r,n){var a,o,l,u,p,h;if(a="","undefined"==typeof e[i]){if(t===CSL.STRICT)throw'Error in getField: term "'+i+'" does not exist.';return void 0}for(h=n&&e[i][n]?e[i][n]:e[i],o=[],"symbol"===s?o=["symbol","short"]:"verb-short"===s?o=["verb-short","verb"]:"long"!==s&&(o=[s]),o=o.concat(["long"]),p=o.length,u=0;p>u;u+=1)if(l=o[u],"string"==typeof h||"number"==typeof h)a=h;else if("undefined"!=typeof h[l]){a="string"==typeof h[l]||"number"==typeof h[l]?h[l]:"number"==typeof r?h[l][r]:h[l][0];break}return a},CSL.Engine.prototype.configureTokenLists=function(){var t,e,i;for(i=CSL.AREAS.length,e=0;i>e;e+=1){t=CSL.AREAS[e];var s=this[t].tokens;this.configureTokenList(s)}return this.version=CSL.version,this.state},CSL.Engine.prototype.configureTokenList=function(t){var e,i,s,r,n,a,o,l;for(e=["year","month","day"],o=t.length-1,n=o;n>-1;n+=-1){if(i=t[n],"date"===i.name&&CSL.END===i.tokentype&&(s=[]),"date-part"===i.name&&i.strings.name)for(l=e.length,a=0;l>a;a+=1)r=e[a],r===i.strings.name&&s.push(i.strings.name);"date"===i.name&&CSL.START===i.tokentype&&(s.reverse(),i.dateparts=s),i.next=n+1,i.name&&CSL.Node[i.name].configure&&CSL.Node[i.name].configure.call(i,this,n)}},CSL.Engine.prototype.retrieveItems=function(t){var e;e=[];for(var i=0,s=t.length;s>i;i+=1)e.push(this.retrieveItem(""+t[i]));return e},CSL.ITERATION=0,CSL.Engine.prototype.retrieveItem=function(t){var e,i,s;if(this.tmp.loadedItemIDs[t])return this.registry.refhash[t];if(this.tmp.loadedItemIDs[t]=!0,this.opt.development_extensions.normalize_lang_keys_to_lowercase&&"boolean"==typeof this.opt.development_extensions.normalize_lang_keys_to_lowercase){for(var s=0,r=this.opt["default-locale"].length;r>s;s+=1)this.opt["default-locale"][s]=this.opt["default-locale"][s].toLowerCase();for(var s=0,r=this.opt["locale-translit"].length;r>s;s+=1)this.opt["locale-translit"][s]=this.opt["locale-translit"][s].toLowerCase();for(var s=0,r=this.opt["locale-translat"].length;r>s;s+=1)this.opt["locale-translat"][s]=this.opt["locale-translat"][s].toLowerCase();this.opt.development_extensions.normalize_lang_keys_to_lowercase=100}if(CSL.ITERATION+=1,e=JSON.parse(JSON.stringify(this.sys.retrieveItem(""+t))),this.opt.development_extensions.normalize_lang_keys_to_lowercase){if(e.multi){if(e.multi._keys)for(var n in e.multi._keys)for(var a in e.multi._keys[n])a!==a.toLowerCase()&&(e.multi._keys[n][a.toLowerCase()]=e.multi._keys[n][a],delete e.multi._keys[n][a]);if(e.multi.main)for(var n in e.multi.main)e.multi.main[n]=e.multi.main[n].toLowerCase()}for(var s=0,r=CSL.CREATORS.length;s>r;s+=1){var o=CSL.CREATORS[s];if(e[o]&&e[o].multi)for(var l=0,u=e[o].length;u>l;l+=1){var p=e[o][l];if(p.multi){if(p.multi._key)for(var a in p.multi._key)a!==a.toLowerCase()&&(p.multi._key[a.toLowerCase()]=p.multi._key[a],delete p.multi._key[a]);p.multi.main&&(p.multi.main=p.multi.main.toLowerCase())}}}}if(this.sys.getLanguageName&&e.language&&e.language){e.language=e.language.toLowerCase();var h=e.language.split("<");if(h.length>0){var c=this.sys.getLanguageName(h[0]);c&&(e["language-name"]=c)}if(2===h.length){var f=this.sys.getLanguageName(h[1]);f&&(e["language-name-original"]=f)}}if(e.page){e["page-first"]=e.page;var m=""+e.page,i=m.split(/\s*(?:&|, |-|\u2013)\s*/);"\\"!==i[0].slice(-1)&&(e["page-first"]=i[0])}this.opt.development_extensions.field_hack&&e.note&&CSL.parseNoteFieldHacks(e,!1,this.opt.development_extensions.allow_field_hack_date_override);for(var s=1,r=CSL.DATE_VARIABLES.length;r>s;s+=1){var d=e[CSL.DATE_VARIABLES[s]];d&&(this.opt.development_extensions.raw_date_parsing&&d.raw&&(d=this.fun.dateparser.parseDateToObject(d.raw)),e[CSL.DATE_VARIABLES[s]]=this.dateParseArray(d))}if(this.opt.development_extensions.static_statute_locator&&e.type&&["bill","gazette","legislation","regulation","treaty"].indexOf(e.type)>-1){var g,b=["type","title","jurisdiction","genre","volume","container-title"],_=[];for(s=0,r=b.length;r>s;s+=1)g=b[s],e[g]&&_.push(e[g]);for(b=["original-date","issued"],s=0,b.length;r>s;s+=1)if(g=b[s],e[g]&&e[g].year){var v=e[g].year;_.push(v);break}e.legislation_id=_.join("::")}this.opt.development_extensions.force_jurisdiction&&"string"==typeof e.authority&&(e.authority=[{literal:e.authority}]),e["title-short"]||(e["title-short"]=e.shortTitle),this.opt.development_extensions.main_title_from_short_title&&CSL.extractTitleAndSubtitle(e);var y=["bill","legal_case","legislation","gazette","regulation"].indexOf(e.type)>-1;if(this.opt.development_extensions.force_jurisdiction&&y&&(e.jurisdiction||(e.jurisdiction="us")),!y&&e.title&&this.sys.getAbbreviation){var x=!1;e.jurisdiction||(x=!0);var I=this.transform.loadAbbreviation(e.jurisdiction,"title",e.title,e.type,!0);this.transform.abbrevs[I].title&&this.transform.abbrevs[I].title[e.title]&&(e["title-short"]=this.transform.abbrevs[I].title[e.title])}if(e["container-title-short"]||(e["container-title-short"]=e.journalAbbreviation),e["container-title"]&&this.sys.getAbbreviation){var I=this.transform.loadAbbreviation(e.jurisdiction,"container-title",e["container-title"]);this.transform.abbrevs[I]["container-title"]&&this.transform.abbrevs[I]["container-title"][e["container-title"]]&&(e["container-title-short"]=this.transform.abbrevs[I]["container-title"][e["container-title"]])}return this.registry.refhash[t]=e,e},CSL.Engine.prototype.setOpt=function(t,e,i){"style"===t.name||"cslstyle"===t.name?(this.opt.inheritedAttributes[e]=i,this.citation.opt.inheritedAttributes[e]=i,this.bibliography.opt.inheritedAttributes[e]=i):["citation","bibliography"].indexOf(t.name)>-1?this[t.name].opt.inheritedAttributes[e]=i:t.strings[e]=i},CSL.Engine.prototype.inheritOpt=function(t,e,i,s){if("undefined"!=typeof t.strings[e])return t.strings[e];var r=this[this.tmp.root].opt.inheritedAttributes[i?i:e];return"undefined"!=typeof r?r:s},e.exports=CSL,CSL.Engine.prototype.remapSectionVariable=function(t){for(var e=0,i=t.length;i>e;e+=1){var s=t[e][0],r=t[e][1];if(["bill","gazette","legislation","regulation","treaty"].indexOf(s.type)>-1){if(r.locator){r.locator=r.locator.trim();var n=r.locator.match(CSL.STATUTE_SUBDIV_PLAIN_REGEX);n||(r.locator=r.label?CSL.STATUTE_SUBDIV_STRINGS_REVERSE[r.label]+" "+r.locator:"p. "+r.locator)}var a=null;if(s.section){s.section=s.section.trim();var n=s.section.match(CSL.STATUTE_SUBDIV_PLAIN_REGEX);n?a=n[0].trim():(s.section="sec. "+s.section,a="sec.")}if(s.section)if(r.locator){var n=r.locator.match(/^([^ ]*)\s*(.*)/),o=" ";n?("p."===n[1]&&"p."!==a&&(r.locator=n[2]),["[","(",".",",",";",":","?"].indexOf(r.locator.slice(0,1))>-1&&(o="")):o="",r.locator=s.section+o+r.locator}else r.locator=s.section;r.label=""}}},CSL.Engine.prototype.setNumberLabels=function(t){if(t.number&&["bill","gazette","legislation","regulation","treaty"].indexOf(t.type)>-1&&this.opt.development_extensions.static_statute_locator&&!this.tmp.shadow_numbers.number){this.tmp.shadow_numbers.number={},this.tmp.shadow_numbers.number.values=[],this.tmp.shadow_numbers.number.plural=0,this.tmp.shadow_numbers.number.numeric=!1,this.tmp.shadow_numbers.number.label=!1;var e=""+t.number;e=e.split("\\").join("");var i=e.split(/\s+/)[0],s=CSL.STATUTE_SUBDIV_STRINGS[i];if(s){var r=e.match(CSL.STATUTE_SUBDIV_GROUPED_REGEX),n=e.split(CSL.STATUTE_SUBDIV_PLAIN_REGEX);if(n.length>1){for(var a=[],o=1,l=n.length;l>o;o+=1){{r[o-1].replace(/^\s*/,"")}a.push(n[o].replace(/\s*$/,"").replace(/^\s*/,""))}e=a.join(" ")}else e=n[0];this.tmp.shadow_numbers.number.label=s,this.tmp.shadow_numbers.number.values.push(["Blob",e,!1]),this.tmp.shadow_numbers.number.numeric=!1}else this.tmp.shadow_numbers.number.values.push(["Blob",e,!1]),this.tmp.shadow_numbers.number.numeric=!0}},e.exports=CSL,CSL.substituteOne=function(t){return function(e,i){return i?t.replace("%%STRING%%",i):""}},CSL.substituteTwo=function(t){return function(e){var i=t.replace("%%PARAM%%",e);return function(t,e){return e?i.replace("%%STRING%%",e):""}}},CSL.Mode=function(t){var e,i,s,r,n,a;e={},i=CSL.Output.Formats[t];for(s in i)if("@"===s.slice(0,1)){if(r=!1,n=i[s],a=s.split("/"),"string"==typeof n&&n.indexOf("%%STRING%%")>-1)r=n.indexOf("%%PARAM%%")>-1?CSL.substituteTwo(n):CSL.substituteOne(n);else if("boolean"!=typeof n||n){if("function"!=typeof n)throw"CSL.Compiler: Bad "+t+" config entry for "+s+": "+n;r=n}else r=CSL.Output.Formatters.passthrough;1===a.length?e[a[0]]=r:2===a.length&&(e[a[0]]||(e[a[0]]={}),e[a[0]][a[1]]=r)}else e[s]=i[s];return e},CSL.setDecorations=function(t,e){var i,s,r;i=[];for(r in CSL.FORMAT_KEY_SEQUENCE){var s=CSL.FORMAT_KEY_SEQUENCE[r];e[s]&&(i.push([s,e[s]]),delete e[s])}return i},CSL.Doppeler=function(t,e){function i(t){e&&(t=e(t));var i=t.match(r);if(!i)return{tags:[],strings:[t]};for(var s=t.split(n),a=i.length-1;a>-1;a--){var o=i[a];"'"===o&&s[a+1].length>0&&(s[a+1]=i[a]+s[a+1],i[a]="")}return{tags:i,strings:s,origStrings:s.slice()}}function s(t){for(var e=t.strings.slice(-1),i=t.tags.length-1;i>-1;i--)e.push(t.tags[i]),e.push(t.strings[i]);return e.reverse(),e.join("")}this.split=i,this.join=s;var r=new RegExp("("+t+")","g"),n=new RegExp(t,"g")},CSL.Engine.prototype.normalDecorIsOrphan=function(t,e){if("normal"===e[1]){var i,s=!1;i="citation"===this.tmp.area?[this.citation.opt.layout_decorations].concat(t.alldecor):t.alldecor;for(var r=i.length-1;r>-1;r+=-1)for(var n=i[r].length-1;n>-1;n+=-1)i[r][n][0]===e[0]&&"normal"!==i[r][n][1]&&(s=!0);if(!s)return!0}return!1},CSL.getJurisdictionNameAndSuppress=function(t,e,i,s){var r=null;if(s&&(e=e.split(":").slice(0,s).join(":"),i=t.sys.getHumanForm(e)),i||(i=t.sys.getHumanForm(e)),i){var n=e.split(":"),a=i.split("|"),o=!1;if(1===n.length&&2===a.length?o=!0:n.length>1&&a.length===n.length&&(o=!0),o){for(var l,u=0,p=0,h=n.length;h>p;p++)l=n.slice(0,p+1).join(":"),t.opt.suppressedJurisdictions[l]&&(u=p+1);r=0===u?1===n.length?a[0]:a.join("|"):1===u&&1===n.length?"":a.slice(u).join("|")}else r=a.join("|")}else r=e;return r},e.exports=CSL,CSL.Engine.prototype.getCitationLabel=function(t){var e="",i=this.getTrigraphParams(),s=i[0],r=this.getTerm("reference","short",0);"undefined"==typeof r&&(r="reference"),r=r.replace(".",""),r=r.slice(0,1).toUpperCase()+r.slice(1);for(var n=0,a=CSL.CREATORS.length;a>n;n+=1){var o=CSL.CREATORS[n];if(t[o]){var l=t[o];s=l.length>i.length?i[i.length-1]:i[l.length-1];for(var u=0,p=l.length;p>u&&u!==s.authors.length;u+=1){var h=this.nameOutput.getName(l[u],"locale-translit",!0),c=h.name;c&&c.family?(r=c.family,r=r.replace(/^([ \'\u2019a-z]+\s+)/,"")):c&&c.literal&&(r=c.literal);var f=r.toLowerCase().match(/^(a\s+|the\s+|an\s+)/);if(f&&(r=r.slice(f[1].length)),r=r.replace(CSL.ROMANESQUE_NOT_REGEXP,""),!r)break;r=r.slice(0,s.authors[u]),r.length>1?r=r.slice(0,1).toUpperCase()+r.slice(1).toLowerCase():1===r.length&&(r=r.toUpperCase()),e+=r}break}}if(!e&&t.title){for(var m=this.locale[this.opt.lang].opts["skip-words"],d=t.title.split(/\s+/),n=d.length-1;n>-1;n--)m.indexOf(d[n])>-1&&(d=d.slice(0,n).concat(d.slice(n+1)));var g=d.join("");g=g.slice(0,i[0].authors[0]),g.length>1?g=g.slice(0,1).toUpperCase()+g.slice(1).toLowerCase():1===g.length&&(g=g.toUpperCase()),e=g}var b="0000";return t.issued&&t.issued.year&&(b=""+t.issued.year),b=b.slice(-1*s.year),e+=b},CSL.Engine.prototype.getTrigraphParams=function(){var t=[],e=this.opt.trigraph.split(":");
+
+if(!this.opt.trigraph||"A"!==this.opt.trigraph.slice(0,1))throw"Bad trigraph definition: "+this.opt.trigraph;for(var i=0,s=e.length;s>i;i+=1){for(var r=e[i],n={authors:[],year:0},a=0,o=r.length;o>a;a+=1)switch(r.slice(a,a+1)){case"A":n.authors.push(1);break;case"a":n.authors[n.authors.length-1]+=1;break;case"0":n.year+=1;break;default:throw"Invalid character in trigraph definition: "+this.opt.trigraph}t.push(n)}return t},e.exports=CSL,CSL.Engine.prototype.setOutputFormat=function(t){this.opt.mode=t,this.fun.decorate=CSL.Mode(t),this.output[t]||(this.output[t]={},this.output[t].tmp={})},CSL.Engine.prototype.getSortFunc=function(){return function(t,e){return t=t.split("-"),e=e.split("-"),t.length<e.length?1:t.length>e.length?-1:(t=t.slice(-1)[0],e=e.slice(-1)[0],t.length<e.length?1:t.length>e.length?-1:0)}},CSL.Engine.prototype.setLangTagsForCslSort=function(t){var e,i;if(t)for(this.opt["locale-sort"]=[],e=0,i=t.length;i>e;e+=1)this.opt["locale-sort"].push(t[e]);this.opt["locale-sort"].sort(this.getSortFunc())},CSL.Engine.prototype.setLangTagsForCslTransliteration=function(t){var e,i;if(this.opt["locale-translit"]=[],t)for(e=0,i=t.length;i>e;e+=1)this.opt["locale-translit"].push(t[e]);this.opt["locale-translit"].sort(this.getSortFunc())},CSL.Engine.prototype.setLangTagsForCslTranslation=function(t){var e,i;if(this.opt["locale-translat"]=[],t)for(e=0,i=t.length;i>e;e+=1)this.opt["locale-translat"].push(t[e]);this.opt["locale-translat"].sort(this.getSortFunc())},CSL.Engine.prototype.setLangPrefsForCites=function(t,e){var i=this.opt["cite-lang-prefs"];e||(e=function(t){return t.toLowerCase()});for(var s=["Persons","Institutions","Titles","Journals","Publishers","Places"],r=0,n=s.length;n>r;r+=1){var a=e(s[r]),o=s[r].toLowerCase();if(t[a]){for(var l=[];t[a].length>1;)l.push(t[a].pop());var u={orig:1,translit:2,translat:3};for(2===l.length&&u[l[0]]<u[l[1]]&&l.reverse();l.length;)t[a].push(l.pop());for(var p=i[o];p.length;)p.pop();for(var h=0,c=t[a].length;c>h;h+=1)p.push(t[a][h])}}},CSL.Engine.prototype.setLangPrefsForCiteAffixes=function(t){if(t&&48===t.length){for(var e,i=this.opt.citeAffixes,s=0,r=["persons","institutions","titles","journals","publishers","places"],n=["translit","orig","translit","translat"],a=0,o=r.length;o>a;a+=1)for(var l=0,u=n.length;u>l;l+=1)e="",s%8===4?i[r[a]]["locale-"+n[l]].prefix||i[r[a]]["locale-"+n[l]].suffix||(e=t[s]?t[s]:"",i[r[a]]["locale-"+n[l]].prefix=e,e=t[s]?t[s+1]:"",i[r[a]]["locale-"+n[l]].suffix=e):(e=t[s]?t[s]:"",i[r[a]]["locale-"+n[l]].prefix=e,e=t[s]?t[s+1]:"",i[r[a]]["locale-"+n[l]].suffix=e),s+=2;this.opt.citeAffixes=i}},CSL.Engine.prototype.setAutoVietnameseNamesOption=function(t){this.opt["auto-vietnamese-names"]=t?!0:!1},CSL.Engine.prototype.setAbbreviations=function(t){this.sys.setAbbreviations&&this.sys.setAbbreviations(t)},CSL.Engine.prototype.setSuppressTrailingPunctuation=function(t){this.citation.opt.suppressTrailingPunctuation=!!t},e.exports=CSL,CSL.Output={},CSL.Output.Queue=function(t){this.levelname=["top"],this.state=t,this.queue=[],this.empty=new CSL.Token("empty");var e={};e.empty=this.empty,this.formats=new CSL.Stack(e),this.current=new CSL.Stack(this.queue)},CSL.Output.Queue.prototype.pop=function(){var t=this.current.value();return t.length?t.pop():t.blobs.pop()},CSL.Output.Queue.prototype.getToken=function(t){var e=this.formats.value()[t];return e},CSL.Output.Queue.prototype.mergeTokenStrings=function(t,e){var i,s,r,n;if(i=this.formats.value()[t],s=this.formats.value()[e],r=i,s){i||(i=new CSL.Token(t,CSL.SINGLETON),i.decorations=[]),r=new CSL.Token(t,CSL.SINGLETON);var n="";for(var n in i.strings)i.strings.hasOwnProperty(n)&&(r.strings[n]=i.strings[n]);for(var n in s.strings)s.strings.hasOwnProperty(n)&&(r.strings[n]=s.strings[n]);r.decorations=i.decorations.concat(s.decorations)}return r},CSL.Output.Queue.prototype.addToken=function(t,e,i){var s,r;if(s=new CSL.Token("output"),"string"==typeof i&&(i=this.formats.value()[i]),i&&i.strings){for(r in i.strings)i.strings.hasOwnProperty(r)&&(s.strings[r]=i.strings[r]);s.decorations=i.decorations}"string"==typeof e&&(s.strings.delimiter=e),this.formats.value()[t]=s},CSL.Output.Queue.prototype.pushFormats=function(t){t||(t={}),t.empty=this.empty,this.formats.push(t)},CSL.Output.Queue.prototype.popFormats=function(){this.formats.pop()},CSL.Output.Queue.prototype.startTag=function(t,e){var i={};this.state.tmp["doing-macro-with-date"]&&this.state.tmp.extension&&(e=this.empty,t="empty"),i[t]=e,this.pushFormats(i),this.openLevel(t)},CSL.Output.Queue.prototype.endTag=function(t){this.closeLevel(t),this.popFormats()},CSL.Output.Queue.prototype.openLevel=function(t){var e,i;if("object"==typeof t)e=new CSL.Blob(void 0,t);else if("undefined"==typeof t)e=new CSL.Blob(void 0,this.formats.value().empty,"empty");else{if(!this.formats.value()||!this.formats.value()[t])throw'CSL processor error: call to nonexistent format token "'+t+'"';e=new CSL.Blob(void 0,this.formats.value()[t],t)}i=this.current.value(),!this.state.tmp.just_looking&&this.checkNestedBrace&&(e.strings.prefix=this.checkNestedBrace.update(e.strings.prefix)),i.push(e),this.current.push(e)},CSL.Output.Queue.prototype.closeLevel=function(t){t&&t!==this.current.value().levelname&&CSL.error("Level mismatch error:  wanted "+t+" but found "+this.current.value().levelname);var e=this.current.pop();!this.state.tmp.just_looking&&this.checkNestedBrace&&(e.strings.suffix=this.checkNestedBrace.update(e.strings.suffix))},CSL.Output.Queue.prototype.append=function(t,e,i,s,r){var n,a,o,l=!0;if(i&&(s=!0),this.state.tmp["doing-macro-with-date"]&&!i){if("macro-with-date"!==e)return!1;"macro-with-date"===e&&(e="empty")}if("undefined"==typeof t)return!1;if("number"==typeof t&&(t=""+t),!i&&this.state.tmp.element_trace&&"suppress-me"===this.state.tmp.element_trace.value())return!1;if(a=!1,e?"literal"===e?(n=!0,l=!1):n="string"==typeof e?this.formats.value()[e]:e:n=this.formats.value().empty,!n)throw"CSL processor error: unknown format token name: "+e;if(n.strings&&"undefined"==typeof n.strings.delimiter&&(n.strings.delimiter=""),"string"==typeof t&&t.length&&(t=t.replace(/ ([:;?!\u00bb])/g," $1").replace(/\u00ab /g,"« "),this.last_char_rendered=t.slice(-1),t=t.replace(/\s+'/g," '"),i||(t=t.replace(/^'/g," '")),s?i&&(this.state.tmp.term_predecessor_name=!0):(this.state.tmp.term_predecessor=!0,this.state.tmp.in_cite_predecessor=!0)),a=new CSL.Blob(t,n),o=this.current.value(),"undefined"==typeof o&&0===this.current.mystack.length&&(this.current.mystack.push([]),o=this.current.value()),"string"==typeof a.blobs&&(s?i&&(this.state.tmp.term_predecessor_name=!0):(this.state.tmp.term_predecessor=!0,this.state.tmp.in_cite_predecessor=!0)),i||this.state.parallel.AppendBlobPointer(o),"string"==typeof t){if("string"==typeof a.blobs&&" "!==a.blobs.slice(0,1)){for(var u="",p=a.blobs;CSL.TERMINAL_PUNCTUATION.indexOf(p.slice(0,1))>-1;)u+=p.slice(0,1),p=p.slice(1);p&&u&&(a.strings.prefix=a.strings.prefix+u,a.blobs=p)}a.strings["text-case"]&&(a.blobs=CSL.Output.Formatters[a.strings["text-case"]](this.state,t)),this.state.tmp.strip_periods&&!r&&(a.blobs=a.blobs.replace(/\.([^a-z]|$)/g,"$1"));for(var h=a.decorations.length-1;h>-1;h+=-1)"@quotes"===a.decorations[h][0]&&"false"!==a.decorations[h][1]&&(a.punctuation_in_quote=this.state.getOpt("punctuation-in-quote")),a.blobs.match(CSL.ROMANESQUE_REGEXP)||"@font-style"===a.decorations[h][0]&&(a.decorations=a.decorations.slice(0,h).concat(a.decorations.slice(h+1)));o.push(a),this.state.fun.flipflopper.processTags(a)}else o.push(l?a:t);return!0},CSL.Output.Queue.prototype.string=function(t,e,i){var s,r,n,a,o,l=CSL.getSafeEscape(this.state),u=e.slice(),p=[];if(0===u.length)return p;var h="";i?h=i.strings.delimiter:(t.tmp.count_offset_characters=!1,t.tmp.offset_characters=0),i&&i.new_locale&&(i.old_locale=t.opt.lang,t.opt.lang=i.new_locale);for(var c,f,m,d,s=0,r=u.length;r>s;s+=1){if(c=u[s],c.strings.first_blob&&(t.tmp.count_offset_characters=c.strings.first_blob),"string"==typeof c.blobs){if("number"==typeof c.num)p.push(c);else if(c.blobs){o=l(c.blobs);var g=o.length;if(!t.tmp.suppress_decorations)for(n=0,a=c.decorations.length;a>n;n+=1)d=c.decorations[n],"@showid"!==d[0]&&(t.normalDecorIsOrphan(c,d)||(o=t.fun.decorate[d[0]][d[1]].call(c,t,o,d[2])));if(o&&o.length){if(o=l(c.strings.prefix)+o+l(c.strings.suffix),(t.opt.development_extensions.csl_reverse_lookup_support||t.sys.csl_reverse_lookup_support)&&!t.tmp.suppress_decorations)for(n=0,a=c.decorations.length;a>n;n+=1)d=c.decorations[n],"@showid"===d[0]&&(o=t.fun.decorate[d[0]][d[1]].call(c,t,o,d[2]));p.push(o),t.tmp.count_offset_characters&&(t.tmp.offset_characters+=g+c.strings.suffix.length+c.strings.prefix.length)}}}else if(c.blobs.length){var b=t.output.string(t,c.blobs,c);if(i&&"string"!==b&&b.length>1&&c.strings.delimiter)for(var _=!1,n=0,a=b.length;a>n;n++)"string"!=typeof b[n]?_=!0:_&&(b[n]=c.strings.delimiter+b[n]);p=p.concat(b)}c.strings.first_blob&&t.registry.registry[c.strings.first_blob]&&(t.registry.registry[c.strings.first_blob].offset=t.tmp.offset_characters,t.tmp.count_offset_characters=!1)}for(s=0,r=p.length-1;r>s;s+=1)"number"!=typeof p[s].num||"number"!=typeof p[s+1].num||p[s+1].UGLY_DELIMITER_SUPPRESS_HACK||(p[s].strings.suffix=p[s].strings.suffix+(h?h:""),p[s+1].successor_prefix="",p[s+1].UGLY_DELIMITER_SUPPRESS_HACK=!0);for(var v=0,s=0,r=p.length;r>s;s+=1)"string"==typeof p[s]&&(v=parseInt(s,10)+1,s<p.length-1&&"object"==typeof p[s+1]&&(h&&!p[s+1].UGLY_DELIMITER_SUPPRESS_HACK&&(p[s]+=l(h)),p[s+1].UGLY_DELIMITER_SUPPRESS_HACK=!0));if(i&&(i.decorations.length||i.strings.suffix))v=p.length;else if(i&&i.strings.prefix)for(var s=0,r=p.length;r>s;s++)if("undefined"!=typeof p[s].num){v=s,0===s&&(p[s].strings.prefix=i.strings.prefix+p[s].strings.prefix);break}var y=t.output.renderBlobs(p.slice(0,v),h,!1,i);if(y&&i&&(i.decorations.length||i.strings.suffix||i.strings.prefix)){if(!t.tmp.suppress_decorations)for(var s=0,r=i.decorations.length;r>s;s+=1)d=i.decorations[s],["@cite","@bibliography","@display","@showid"].indexOf(d[0])>-1||t.normalDecorIsOrphan(c,d)||"string"==typeof y&&(y=t.fun.decorate[d[0]][d[1]].call(i,t,y,d[2]));if(o=y,f=i.strings.suffix,o&&o.length&&(m=i.strings.prefix,o=l(m)+o+l(f),t.tmp.count_offset_characters&&(t.tmp.offset_characters+=m.length+f.length)),y=o,!t.tmp.suppress_decorations)for(var s=0,r=i.decorations.length;r>s;s+=1)d=i.decorations[s],-1!==["@cite","@bibliography","@display","@showid"].indexOf(d[0])&&"string"==typeof y&&(y=t.fun.decorate[d[0]][d[1]].call(i,t,y,d[2]))}var x=p.slice(v,p.length);return!x.length&&y?p=[y]:x.length&&!y?p=x:y&&x.length&&(p=[y].concat(x)),"undefined"==typeof i?(this.queue=[],this.current.mystack=[],this.current.mystack.push(this.queue),t.tmp.suppress_decorations&&(p=t.output.renderBlobs(p,void 0,!1))):"boolean"==typeof i&&(p=t.output.renderBlobs(p,void 0,!0)),i&&i.new_locale&&(t.opt.lang=i.old_locale),p},CSL.Output.Queue.prototype.clearlevel=function(){var t,e,i;for(t=this.current.value(),i=t.blobs.length,e=0;i>e;e+=1)t.blobs.pop()},CSL.Output.Queue.prototype.renderBlobs=function(t,e,i,s){var r,n,a,o,l,u,p,h,c,f,m,d;if(d=CSL.getSafeEscape(this.state),e||(e=""),r=this.state,n="",a=[],o="",p=t.length,"citation"===this.state.tmp.area&&!this.state.tmp.just_looking&&1===p&&"object"==typeof t[0]&&s)return t[0].strings.prefix=s.strings.prefix+t[0].strings.prefix,t[0].strings.suffix=t[0].strings.suffix+s.strings.suffix,t[0].decorations=t[0].decorations.concat(s.decorations),t[0].params=s.params,t[0];var g=!0;for(u=0;p>u;u+=1)t[u].checkNext?(t[u].checkNext(t[u+1],g),g=!1):g=t[u+1]&&t[u+1].splice_prefix?!1:!0;var b=!0;for(u=t.length-1;u>0;u+=-1)t[u].checkLast?b&&t[u].checkLast(t[u-1])&&(b=!1):b=!0;for(p=t.length,u=0;p>u;u+=1)if(l=t[u],n&&(o=e),"string"==typeof l)n+=d(o),n+=l,r.tmp.count_offset_characters&&(r.tmp.offset_characters+=o.length);else if(i)n=n?[n,l]:[l];else if(l.status!==CSL.SUPPRESS){f=l.particle?l.particle+l.num:l.formatter.format(l.num,l.gender);var _=f.replace(/<[^>]*>/g,"").length;this.append(f,"empty",!0);var v=this.pop(),y=r.tmp.count_offset_characters;if(f=this.string(r,[v],!1),r.tmp.count_offset_characters=y,l.strings["text-case"]&&(f=CSL.Output.Formatters[l.strings["text-case"]](this.state,f)),f&&this.state.tmp.strip_periods&&(f=f.replace(/\.([^a-z]|$)/g,"$1")),!r.tmp.suppress_decorations)for(c=l.decorations.length,h=0;c>h;h+=1)m=l.decorations[h],r.normalDecorIsOrphan(l,m)||(f=r.fun.decorate[m[0]][m[1]].call(l,r,f,m[2]));f=d(l.strings.prefix)+f+d(l.strings.suffix);var x="";l.status===CSL.END?x=d(l.range_prefix):l.status===CSL.SUCCESSOR?x=d(l.successor_prefix):l.status===CSL.START?x=u>0&&!l.suppress_splice_prefix?d(l.splice_prefix):"":l.status===CSL.SEEN&&(x=d(l.splice_prefix)),n+=x,n+=f,r.tmp.count_offset_characters&&(r.tmp.offset_characters+=x.length+l.strings.prefix.length+_+l.strings.suffix.length)}return n},CSL.Output.Queue.purgeEmptyBlobs=function(t){if("object"==typeof t&&"object"==typeof t.blobs&&t.blobs.length)for(var e=t.blobs.length-1;e>-1;e--){CSL.Output.Queue.purgeEmptyBlobs(t.blobs[e]);var i=t.blobs[e];if(!i||!i.blobs||!i.blobs.length){for(var s=[];t.blobs.length-1>e;)s.push(t.blobs.pop());for(t.blobs.pop();s.length;)t.blobs.push(s.pop())}}},CSL.Output.Queue.adjust=function(t){function e(t){return"number"==typeof t.num||t.blobs&&1===t.blobs.length&&"number"==typeof t.blobs[0].num}function i(t){return"number"==typeof t.num?!0:t.blobs&&"object"==typeof t.blobs?i(t.blobs[t.blobs.length-1])?!0:void 0:!1}function s(t,e){var i=!1,s=["@font-style","@font-variant","@font-weight","@text-decoration","@vertical-align"];if(e&&s.push("@quotes"),t.decorations)for(var r=0,n=t.decorations.length;n>r;r++)if(s.indexOf(t.decorations[r][0])>-1){i=!0;break}return i}function r(t){if(t.decorations)for(var e=0,i=t.decorations.length;i>e;e++)if("@quotes"===t.decorations[e][0]&&"false"!==t.decorations[e][1])return!0;return"object"!=typeof t.blobs?!1:r(t.blobs[t.blobs.length-1])}function n(t,e){var i=e.strings.suffix.slice(-1);i||"string"!=typeof e.blobs||(i=e.blobs.slice(-1));var s=I[t][i];return s&&1===s.length?!0:"object"!=typeof e.blobs?!1:n(t,e.blobs[e.blobs.length-1])?!0:!1}function a(t,e){if(!v[e])return!1;if("string"==typeof t.blobs)return t.blobs.slice(-1)===e?!0:!1;var i=t.blobs[t.blobs.length-1];if(i){var s=i.strings.suffix.slice(-1);return s?i.strings.suffix.slice(-1)==e?!0:!1:a(i,e)}return!1}function o(t,e,i,s,r){function n(){m[s]=m[s].slice(1)}function a(){f[e]=f[e].slice(0,-1)}function o(t){m[s]=t+m[s]}function l(t){f[e]+=t}function u(){return I[b]}function p(){return g[d]}function h(){var t=g[d][b];"string"==typeof t?(a(),n(),o(t)):(o(d),a())}function c(){var t=I[b][d];"string"==typeof t?(a(),n(),l(t)):(l(b),n())}var f="blobs"===e?t:t.strings,m="blobs"===s?i:i.strings,d=f[e].slice(-1),b=m[s].slice(0,1),_=r?a:n,v=r?p:u,y=r?h:c,x=d===b;x?_():v()&&y()}function l(t){if(t.blobs&&"string"==typeof t.blobs)return void(v[t.strings.suffix.slice(0,1)]&&t.strings.suffix.slice(0,1)===t.blobs.slice(-1)&&(t.strings.suffix=t.strings.suffix.slice(1)));if("object"==typeof t&&"object"==typeof t.blobs&&t.blobs.length)for(var e=s(t,!0),i=t.blobs.length-1;i>-1;i--){{i===t.blobs.length-1}this.upward(t.blobs[i]);var r=t.strings,n=t.blobs[i].strings;if(0===i){" "===r.prefix.slice(-1)&&" "===n.prefix.slice(0,1)&&(n.prefix=n.prefix.slice(1));var a=n.prefix.slice(0,1);e||!y[a]||r.prefix||(r.prefix+=a,n.prefix=n.prefix.slice(1))}if(i===t.blobs.length-1){var a=n.suffix.slice(-1);!e&&[" "].indexOf(a)>-1&&(r.suffix.slice(0,1)!==a&&(r.suffix=a+r.suffix),n.suffix=n.suffix.slice(0,-1))}r.delimiter&&i>0&&y[r.delimiter.slice(-1)]&&r.delimiter.slice(-1)===n.prefix.slice(0,1)&&(n.prefix=n.prefix.slice(1))}}function u(t){if("object"==typeof t&&"object"==typeof t.blobs&&t.blobs.length)for(var e=t.blobs.length-1;e>-1;e--)if(this.leftward(t.blobs[e]),e<t.blobs.length-1&&!t.strings.delimiter){var i=t.blobs[e],r=i.strings.suffix.slice(-1),n=t.blobs[e+1],a=n.strings.prefix.slice(0,1),l=s(i)||s(n),u="number"==typeof r||"number"==typeof a;if(!l&&!u&&v[a]&&!u){var p=a===i.strings.suffix.slice(-1),h=!i.strings.suffix&&"string"==typeof i.blobs&&i.blobs.slice(-1)===a;p||h?n.strings.prefix=n.strings.prefix.slice(1):o(i,"suffix",n,"prefix")}}}function p(l){if(l.blobs&&"string"==typeof l.blobs)return void(v[l.strings.suffix.slice(0,1)]&&l.strings.suffix.slice(0,1)===l.blobs.slice(-1)&&(l.strings.suffix=l.strings.suffix.slice(1)));if("object"==typeof l&&"object"==typeof l.blobs&&l.blobs.length){for(var u=l.strings,p=!1,h=0,c=l.blobs.length;c>h;h++)if(e(l.blobs[h])){p=!0;break}if(u.delimiter&&v[u.delimiter.slice(0,1)]){for(var f=u.delimiter.slice(0,1),h=l.blobs.length-2;h>-1;h--){var m=l.blobs[h].strings;m.suffix.slice(-1)!==f&&(m.suffix+=f)}u.delimiter=u.delimiter.slice(1)}for(var h=(s(l,!0),e(l),l.blobs.length-1);h>-1;h--){var d=l.blobs[h],m=l.blobs[h].strings,g=s(d,!0),b=e(d);if(h===l.blobs.length-1){var _=u.suffix.slice(0,1),x=!1;v[_]&&(x=n(_,d),!x&&t&&(x=r(d))),x&&v[_]&&(i(d)||("string"==typeof d.blobs?o(d,"blobs",l,"suffix"):o(d,"suffix",l,"suffix"),"."===u.suffix.slice(0,1)&&(m.suffix+=u.suffix.slice(0,1),u.suffix=u.suffix.slice(1))))," "===m.suffix.slice(-1)&&" "===u.suffix.slice(0,1)&&(u.suffix=u.suffix.slice(1)),y[m.suffix.slice(0,1)]&&("string"==typeof d.blobs&&d.blobs.slice(-1)===m.suffix.slice(0,1)&&(m.suffix=m.suffix.slice(1)),m.suffix.slice(-1)===u.suffix.slice(0,1)&&(u.suffix=u.suffix.slice(0,-1))),a(l,l.strings.suffix.slice(0,1))&&(l.strings.suffix=l.strings.suffix.slice(1))}else if(u.delimiter)y[u.delimiter.slice(0,1)]&&u.delimiter.slice(0,1)===m.suffix.slice(-1)&&(l.blobs[h].strings.suffix=l.blobs[h].strings.suffix.slice(0,-1));else{var I=l.blobs[h+1].strings;e(d)||g||!y[m.suffix.slice(-1)]||m.suffix.slice(-1)!==I.prefix.slice(0,1)||(I.prefix=I.prefix.slice(1))}b||g||!v[m.suffix.slice(0,1)]||"string"!=typeof d.blobs||o(d,"blobs",d,"suffix"),this.downward(l.blobs[h])}}}function h(t){var e=t.strings.suffix.slice(0,1);if("string"==typeof t.blobs)for(;b[e];)o(t,"blobs",t,"suffix"),e=t.strings.suffix.slice(0,1);else for(;b[e];)o(t.blobs[t.blobs.length-1],"suffix",t,"suffix"),e=t.strings.suffix.slice(0,1)}function c(t){if("string"==typeof t.blobs)for(var e=t.blobs.slice(-1);_[e];)o(t,"blobs",t,"suffix",!0),e=t.blobs.slice(-1);else for(var e=t.blobs[t.blobs.length-1].strings.suffix.slice(-1);_[e];)o(t.blobs[t.blobs.length-1],"suffix",t,"suffix",!0),e=t.blobs[t.blobs.length-1].strings.suffix.slice(-1)}function f(e){if("object"==typeof e&&"object"==typeof e.blobs&&e.blobs.length){for(var i,s=0,r=e.blobs.length;r>s;s++){for(var n=e.blobs[s],a=!1,o=0,l=n.decorations.length;l>o;o++){var u=n.decorations[o];"@quotes"===u[0]&&"false"!==u[1]&&(a=!0)}a&&(t?h(n):c(n)),i=this.fix(e.blobs[s]),n.blobs&&"string"==typeof n.blobs&&(i=n.blobs.slice(-1))}return i}}var m={";":!0,":":!0},d={".":!0,"!":!0,"?":!0};this.upward=l,this.leftward=u,this.downward=p,this.fix=f;var g={"!":{".":"!","?":"!?",":":"!",",":"!,",";":"!;"},"?":{"!":"?!",".":"?",":":"?",",":"?,",";":"?;"},".":{"!":".!","?":".?",":":".:",",":".,",";":".;"},":":{"!":"!","?":"?",".":":",",":":,",";":":;"},",":{"!":",!","?":",?",":":",:",".":",.",";":",;"},";":{"!":"!","?":"?",":":";",",":";,",".":";"}},b={},_={},v={},y={};for(var x in g)v[x]=!0,y[x]=!0,m[x]||(b[x]=!0),d[x]||(_[x]=!0);y[" "]=!0,y[" "]=!0;var I={};for(var x in g)for(var O in g[x])I[O]||(I[O]={}),I[O][x]=g[x][O]},e.exports=CSL,CSL.Engine.Opt=function(){this.has_disambiguate=!1,this.mode="html",this.dates={},this.jurisdictions_seen={},this.suppressedJurisdictions={},this.inheritedAttributes={},this["locale-sort"]=[],this["locale-translit"]=[],this["locale-translat"]=[],this.citeAffixes={persons:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},institutions:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},titles:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},journals:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},publishers:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},places:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}}},this["default-locale"]=[],this.update_mode=CSL.NONE,this.bib_mode=CSL.NONE,this.sort_citations=!1,this["et-al-min"]=0,this["et-al-use-first"]=1,this["et-al-use-last"]=!1,this["et-al-subsequent-min"]=!1,this["et-al-subsequent-use-first"]=!1,this["demote-non-dropping-particle"]="display-and-sort",this["parse-names"]=!0,this.citation_number_slug=!1,this.trigraph="Aaaa00:AaAa00:AaAA00:AAAA00",this.nodenames=[],this.gender={},this["cite-lang-prefs"]={persons:["orig"],institutions:["orig"],titles:["orig"],journals:["orig"],publishers:["orig"],places:["orig"],number:["orig"]},this.has_layout_locale=!1,this.development_extensions={},this.development_extensions.field_hack=!0,this.development_extensions.allow_field_hack_date_override=!0,this.development_extensions.locator_date_and_revision=!0,this.development_extensions.locator_parsing_for_plurals=!0,this.development_extensions.locator_label_parse=!0,this.development_extensions.raw_date_parsing=!0,this.development_extensions.clean_up_csl_flaws=!0,this.development_extensions.flip_parentheses_to_braces=!0,this.development_extensions.jurisdiction_subfield=!0,this.development_extensions.static_statute_locator=!1,this.development_extensions.csl_reverse_lookup_support=!1,this.development_extensions.clobber_locator_if_no_statute_section=!1,this.development_extensions.wrap_url_and_doi=!1,this.development_extensions.allow_force_lowercase=!1,this.development_extensions.handle_parallel_articles=!1,this.development_extensions.thin_non_breaking_space_html_hack=!1,this.development_extensions.apply_citation_wrapper=!1,this.development_extensions.main_title_from_short_title=!1,this.development_extensions.uppercase_subtitles=!1,this.development_extensions.normalize_lang_keys_to_lowercase=!1,this.development_extensions.strict_text_case_locales=!1,this.development_extensions.rtl_support=!1,this.development_extensions.expect_and_symbol_form=!1,this.development_extensions.require_explicit_legal_case_title_short=!1,this.development_extensions.spoof_institutional_affiliations=!1,this.development_extensions.force_jurisdiction=!1,this.development_extensions.parse_names=!0},CSL.Engine.Tmp=function(){this.names_max=new CSL.Stack,this.names_base=new CSL.Stack,this.givens_base=new CSL.Stack,this.value=[],this.namepart_decorations={},this.namepart_type=!1,this.area="citation",this.root="citation",this.extension="",this.can_substitute=new CSL.Stack(0,CSL.LITERAL),this.element_rendered_ok=!1,this.element_trace=new CSL.Stack("style"),this.nameset_counter=0,this.group_context=new CSL.Stack({term_intended:!1,variable_attempt:!1,variable_success:!1,output_tip:void 0,label_form:void 0,parallel_conditions:void 0,condition:!1,force_suppress:!1,done_vars:[]}),this.term_predecessor=!1,this.in_cite_predecessor=!1,this.jump=new CSL.Stack(0,CSL.LITERAL),this.decorations=new CSL.Stack,this.tokenstore_stack=new CSL.Stack,this.last_suffix_used="",this.last_names_used=[],this.last_years_used=[],this.years_used=[],this.names_used=[],this.taintedItemIDs={},this.taintedCitationIDs={},this.initialize_with=new CSL.Stack,this.disambig_request=!1,this["name-as-sort-order"]=!1,this.suppress_decorations=!1,this.disambig_settings=new CSL.AmbigConfig,this.bib_sort_keys=[],this.prefix=new CSL.Stack("",CSL.LITERAL),this.suffix=new CSL.Stack("",CSL.LITERAL),this.delimiter=new CSL.Stack("",CSL.LITERAL),this.cite_locales=[],this.cite_affixes={citation:!1,bibliography:!1,citation_sort:!1,bibliography_sort:!1},this.strip_periods=0,this.shadow_numbers={},this.authority_stop_last=0,this.loadedItemIDs={}},CSL.Engine.Fun=function(t){this.match=new CSL.Util.Match,this.suffixator=new CSL.Util.Suffixator(CSL.SUFFIX_CHARS),this.romanizer=new CSL.Util.Romanizer,this.ordinalizer=new CSL.Util.Ordinalizer(t),this.long_ordinalizer=new CSL.Util.LongOrdinalizer},CSL.Engine.Build=function(){this["alternate-term"]=!1,this.in_bibliography=!1,this.in_style=!1,this.skip=!1,this.postponed_macro=!1,this.layout_flag=!1,this.name=!1,this.form=!1,this.term=!1,this.macro={},this.macro_stack=[],this.text=!1,this.lang=!1,this.area="citation",this.root="citation",this.extension="",this.substitute_level=new CSL.Stack(0,CSL.LITERAL),this.names_level=0,this.render_nesting_level=0,this.render_seen=!1},CSL.Engine.Configure=function(){this.fail=[],this.succeed=[]},CSL.Engine.Citation=function(t){this.opt={inheritedAttributes:{}},this.tokens=[],this.srt=new CSL.Registry.Comparifier(t,"citation_sort"),this.opt.collapse=[],this.opt["disambiguate-add-names"]=!1,this.opt["disambiguate-add-givenname"]=!1,this.opt["disambiguate-add-year-suffix"]=!1,this.opt["givenname-disambiguation-rule"]="by-cite",this.opt["near-note-distance"]=5,this.opt.topdecor=[],this.opt.layout_decorations=[],this.opt.layout_prefix="",this.opt.layout_suffix="",this.opt.layout_delimiter="",this.opt.sort_locales=[],this.opt.max_number_of_names=0,this.root="citation"},CSL.Engine.Bibliography=function(){this.opt={inheritedAttributes:{}},this.tokens=[],this.opt.collapse=[],this.opt.topdecor=[],this.opt.layout_decorations=[],this.opt.layout_prefix="",this.opt.layout_suffix="",this.opt.layout_delimiter="",this.opt["line-spacing"]=1,this.opt["entry-spacing"]=1,this.opt.sort_locales=[],this.opt.max_number_of_names=0,this.root="bibliography"},CSL.Engine.BibliographySort=function(){this.tokens=[],this.opt={},this.opt.sort_directions=[],this.keys=[],this.opt.topdecor=[],this.root="bibliography"},CSL.Engine.CitationSort=function(){this.tokens=[],this.opt={},this.opt.sort_directions=[],this.keys=[],this.opt.topdecor=[],this.root="citation"},e.exports=CSL,CSL.Engine.prototype.previewCitationCluster=function(t,e,i,s){var r=this.opt.mode;this.setOutputFormat(s);var n=this.processCitationCluster(t,e,i,CSL.PREVIEW);return this.setOutputFormat(r),n[1]},CSL.Engine.prototype.appendCitationCluster=function(t){for(var e=[],i=this.registry.citationreg.citationByIndex.length,s=0;i>s;s+=1){var r=this.registry.citationreg.citationByIndex[s];e.push([""+r.citationID,r.properties.noteIndex])}return this.processCitationCluster(t,e,[])[1]},CSL.Engine.prototype.processCitationCluster=function(t,e,i,s){var r,n,a,o,l,u,p,h,c,f,m,d,g,b,_,v;this.debug=!1,this.tmp.loadedItemIDs={},this.tmp.citation_errors=[];var y={bibchange:!1};this.setCitationId(t);var x,I,O;if(s===CSL.PREVIEW){x=this.registry.citationreg.citationByIndex.slice(),I=this.registry.reflist.slice();for(var S=e.concat([[""+t.citationID,t.properties.noteIndex]]).concat(i),T={},A=[],n=0,a=S.length;a>n;n+=1)for(r=this.registry.citationreg.citationById[S[n][0]],o=0,l=r.citationItems.length;l>o;o+=1)T[r.citationItems[o].id]=!0,A.push(""+r.citationItems[o].id);O={};for(var n=0,a=I.length;a>n;n+=1)if(!T[I[n].id]){var N=this.registry.registry[I[n].id].ambig,E=this.registry.ambigcites[N];if(E)for(o=0,l=E.length;l>o;o+=1)O[E[o]]=CSL.cloneAmbigConfig(this.registry.registry[E[o]].disambig)}}this.tmp.taintedCitationIDs={};for(var k=[],R={},n=0,a=t.citationItems.length;a>n;n+=1){d={};for(var f in t.citationItems[n])d[f]=t.citationItems[n][f];if(m=this.retrieveItem(""+d.id),m.id&&this.transform.loadAbbreviation("default","hereinafter",m.id),d=CSL.parseLocator.call(this,d),this.opt.development_extensions.static_statute_locator&&this.remapSectionVariable([[m,d]]),this.opt.development_extensions.locator_label_parse&&d.locator&&-1===["bill","gazette","legislation","regulation","treaty"].indexOf(m.type)&&(!d.label||"page"===d.label)){var _=CSL.LOCATOR_LABELS_REGEXP.exec(d.locator);if(_){var w=CSL.LOCATOR_LABELS_MAP[_[2]];this.getTerm(w)&&(d.label=w,d.locator=_[3])}}var L=[m,d];k.push(L),t.citationItems[n].item=m}t.sortedItems=k;for(var C=[],n=0,a=e.length;a>n;n+=1)r=e[n],this.registry.citationreg.citationById[r[0]].properties.noteIndex=r[1],C.push(this.registry.citationreg.citationById[r[0]]);C.push(t);for(var n=0,a=i.length;a>n;n+=1)r=i[n],this.registry.citationreg.citationById[r[0]].properties.noteIndex=r[1],C.push(this.registry.citationreg.citationById[r[0]]);this.registry.citationreg.citationByIndex=C,this.registry.citationreg.citationsByItemId={},this.opt.update_mode===CSL.POSITION&&(b=[],g=[],v={});for(var j=[],n=0,a=C.length;a>n;n+=1){for(C[n].properties||(C[n].properties={}),C[n].properties.index=n,o=0,l=C[n].sortedItems.length;l>o;o+=1)d=C[n].sortedItems[o],this.registry.citationreg.citationsByItemId[d[1].id]||(this.registry.citationreg.citationsByItemId[d[1].id]=[],j.push(""+d[1].id)),-1===this.registry.citationreg.citationsByItemId[d[1].id].indexOf(C[n])&&this.registry.citationreg.citationsByItemId[d[1].id].push(C[n]);this.opt.update_mode===CSL.POSITION&&(C[n].properties.noteIndex?g.push(C[n]):(C[n].properties.noteIndex=0,b.push(C[n])))}if(s!==CSL.ASSUME_ALL_ITEMS_REGISTERED&&this.updateItems(j,null,null,!0),!this.opt.citation_number_sort&&k&&k.length>1&&this.citation_sort.tokens.length>0){for(var n=0,a=k.length;a>n;n+=1)k[n][1].sortkeys=CSL.getSortKeys.call(this,k[n][0],"citation_sort");if(this.opt.grouped_sort&&!t.properties.unsorted){for(var n=0,a=k.length;a>n;n+=1){var D=k[n][1].sortkeys;this.tmp.authorstring_request=!0;var P=this.registry.registry[k[n][0].id].disambig;this.tmp.authorstring_request=!0,CSL.getAmbiguousCite.call(this,k[n][0],P);var U=this.registry.authorstrings[k[n][0].id];this.tmp.authorstring_request=!1,k[n][1].sortkeys=[U].concat(D)}k.sort(this.citation.srt.compareCompositeKeys);for(var B=!1,M=!1,X=!1,n=0,a=k.length;a>n;n+=1)k[n][1].sortkeys[0]!==B&&(X=k[n][1].sortkeys[0],M=k[n][1].sortkeys[1]),k[n][1].sortkeys[0]=""+M+n,B=X}t.properties.unsorted||k.sort(this.citation.srt.compareCompositeKeys)}var q;if(this.opt.update_mode===CSL.POSITION)for(var n=0;2>n;n+=1){q=[b,g][n];var V={},F={};for(o=0,l=q.length;l>o;o+=1){var z=q[o];for(q[o].properties.noteIndex||(q[o].properties.noteIndex=0),q[o].properties.noteIndex=parseInt(q[o].properties.noteIndex,10),o>0&&q[o-1].properties.noteIndex>q[o].properties.noteIndex&&(v={},V={},F={}),u=0,p=z.sortedItems.length;p>u;u+=1)this.registry.registry[z.sortedItems[u][1].id].parallel||(v[z.properties.noteIndex]?v[z.properties.noteIndex]+=1:v[z.properties.noteIndex]=1);for(u=0,p=q[o].sortedItems.length;p>u;u+=1){d=q[o].sortedItems[u];var G=d[0].id,$=d[1].locator,W=d[1].label;d[0].legislation_id&&(G=d[0].legislation_id);var K;if(u>0&&(K=z.sortedItems[u-1][0].legislation_id?z.sortedItems[u-1][0].legislation_id:z.sortedItems[u-1][1].id),s!==CSL.PREVIEW||z.citationID==t.citationID){var H={};if(H.position=d[1].position,H["first-reference-note-number"]=d[1]["first-reference-note-number"],H["near-note"]=d[1]["near-note"],d[1]["first-reference-note-number"]=0,d[1]["near-note"]=!1,this.registry.citationreg.citationsByItemId[G]&&"note"===this.opt.xclass&&this.opt.has_disambiguate){var Q=this.registry.registry[G]["citation-count"],J=this.registry.citationreg.citationsByItemId[G].length;if(this.registry.registry[G]["citation-count"]=this.registry.citationreg.citationsByItemId[G].length,"number"==typeof Q){var Y=2>Q,Z=2>J;if(Y!==Z)for(var tt=0,et=this.registry.citationreg.citationsByItemId[G].length;et>tt;tt++)R[this.registry.registry[G].ambig]=!0,this.tmp.taintedCitationIDs[this.registry.citationreg.citationsByItemId[G][tt].citationID]=!0}else for(var tt=0,et=this.registry.citationreg.citationsByItemId[G].length;et>tt;tt++)R[this.registry.registry[G].ambig]=!0,this.tmp.taintedCitationIDs[this.registry.citationreg.citationsByItemId[G][tt].citationID]=!0}var it;if("undefined"==typeof V[G])V[G]=z.properties.noteIndex,this.registry.registry[G]&&(this.registry.registry[G]["first-reference-note-number"]=z.properties.noteIndex),F[G]=z.properties.noteIndex,d[1].position=CSL.POSITION_FIRST;else{var st=!1,rt=!1;if(o>0&&(it=q[o-1].sortedItems.slice(-1)[0][1].id,
+q[o-1].sortedItems[0].slice(-1)[0].legislation_id&&(it=q[o-1].sortedItems[0].slice(-1)[0].legislation_id)),o>0&&0===parseInt(u,10)&&q[o-1].properties.noteIndex!==q[o].properties.noteIndex){var nt=q[o-1].sortedItems,at=!1,ot=q[o-1].sortedItems[0][0].id;for(q[o-1].sortedItems[0][0].legislation_id&&(ot=q[o-1].sortedItems[0][0].legislation_id),(ot==G&&q[o-1].properties.noteIndex>=q[o].properties.noteIndex-1||q[o-1].sortedItems[0][1].id==this.registry.registry[d[1].id].parallel)&&(1===v[q[o-1].properties.noteIndex]||0===q[o-1].properties.noteIndex)&&(at=!0),h=0,c=nt.slice(1).length;c>h;h+=1){var lt=nt.slice(1)[h];this.registry.registry[lt[1].id].parallel&&this.registry.registry[lt[1].id].parallel!=this.registry.registry[lt[1].id]||(at=!1)}at?st=!0:rt=!0}else u>0&&K==G?st=!0:0===u&&q[o-1].properties.noteIndex==q[o].properties.noteIndex&&q[o-1].sortedItems.length&&it==G?st=!0:rt=!0;var ut,pt,ht,ct,ft;if(st&&(ut=u>0?z.sortedItems[u-1][1]:q[o-1].sortedItems[0][1],ut.locator?(ht=ut.label?ut.label:"",pt=""+ut.locator+ht):pt=ut.locator,$?(ft=W?W:"",ct=""+$+ft):ct=$),st&&pt&&!ct&&(st=!1,rt=!0),st&&(!pt&&ct?d[1].position=CSL.POSITION_IBID_WITH_LOCATOR:pt||ct?pt&&ct===pt?d[1].position=CSL.POSITION_IBID:pt&&ct&&ct!==pt?d[1].position=CSL.POSITION_IBID_WITH_LOCATOR:(st=!1,rt=!0):d[1].position=CSL.POSITION_IBID),rt&&(d[1].position=CSL.POSITION_SUBSEQUENT),(rt||st)&&V[G]!=z.properties.noteIndex&&(d[1]["first-reference-note-number"]=V[G],this.registry.registry[G])){var mt=this.registry.citationreg.citationsByItemId[G][0].properties.noteIndex,dt=z.properties.noteIndex;this.registry.registry[G]["first-reference-note-number"]=mt>dt?dt:mt}}if(z.properties.noteIndex){var gt=parseInt(z.properties.noteIndex,10)-parseInt(F[G],10);d[1].position!==CSL.POSITION_FIRST&&gt<=this.citation.opt["near-note-distance"]&&(d[1]["near-note"]=!0),F[G]=z.properties.noteIndex}if(z.citationID!=t.citationID)for(h=0,c=CSL.POSITION_TEST_VARS.length;c>h;h+=1){var bt=CSL.POSITION_TEST_VARS[h];d[1][bt]!==H[bt]&&(this.registry.registry[G]&&"first-reference-note-number"===bt&&(R[this.registry.registry[G].ambig]=!0,this.tmp.taintedItemIDs[G]=!0),this.tmp.taintedCitationIDs[z.citationID]=!0)}this.sys.variableWrapper&&(d[1].index=z.properties.index,d[1].noteIndex=z.properties.noteIndex)}else"undefined"==typeof V[d[1].id]?(V[G]=z.properties.noteIndex,F[G]=z.properties.noteIndex):F[G]=z.properties.noteIndex}}}if(this.opt.citation_number_sort&&k&&k.length>1&&this.citation_sort.tokens.length>0&&!t.properties.unsorted){for(var n=0,a=k.length;a>n;n+=1)k[n][1].sortkeys=CSL.getSortKeys.call(this,k[n][0],"citation_sort");k.sort(this.citation.srt.compareCompositeKeys)}for(var f in this.tmp.taintedItemIDs)if(this.tmp.taintedItemIDs.hasOwnProperty(f)&&(q=this.registry.citationreg.citationsByItemId[f]))for(var n=0,a=q.length;a>n;n+=1)this.tmp.taintedCitationIDs[q[n].citationID]=!0;var _t=[];if(s===CSL.PREVIEW){try{_t=this.process_CitationCluster.call(this,t.sortedItems,t.citationID)}catch(vt){CSL.error("Error running CSL processor for preview: "+vt)}this.registry.citationreg.citationByIndex=x,this.registry.citationreg.citationById={};for(var n=0,a=x.length;a>n;n+=1)this.registry.citationreg.citationById[x[n].citationID]=x[n];for(var yt=[],n=0,a=I.length;a>n;n+=1)yt.push(""+I[n].id);this.updateItems(yt,null,null,!0);for(var f in O)O.hasOwnProperty(f)&&(this.registry.registry[f].disambig=O[f])}else{for(var xt in R)this.disambiguate.run(xt,t);var It;for(var f in this.tmp.taintedCitationIDs)if(f!=t.citationID){var Ot=this.registry.citationreg.citationById[f];if(!Ot.properties.unsorted){for(var n=0,a=Ot.sortedItems.length;a>n;n+=1)Ot.sortedItems[n][1].sortkeys=CSL.getSortKeys.call(this,Ot.sortedItems[n][0],"citation_sort");Ot.sortedItems.sort(this.citation.srt.compareCompositeKeys)}this.tmp.citation_pos=Ot.properties.index,this.tmp.citation_note_index=Ot.properties.noteIndex,this.tmp.citation_id=""+Ot.citationID,It=[],It.push(Ot.properties.index),It.push(this.process_CitationCluster.call(this,Ot.sortedItems,Ot.citationID)),It.push(Ot.citationID),_t.push(It)}this.tmp.taintedItemIDs={},this.tmp.taintedCitationIDs={},this.tmp.citation_pos=t.properties.index,this.tmp.citation_note_index=t.properties.noteIndex,this.tmp.citation_id=""+t.citationID,It=[],It.push(e.length),It.push(this.process_CitationCluster.call(this,k,t.citationID)),It.push(t.citationID),_t.push(It),_t.sort(function(t,e){return t[0]>e[0]?1:t[0]<e[0]?-1:0})}return y.citation_errors=this.tmp.citation_errors.slice(),[y,_t]},CSL.Engine.prototype.process_CitationCluster=function(t,e){var i;return this.parallel.StartCitation(t),i=CSL.getCitationCluster.call(this,t,e)},CSL.Engine.prototype.makeCitationCluster=function(t){var e,i,s,r,n,a,o;for(e=[],n=t.length,r=0;n>r;r+=1){a={};for(var l in t[r])a[l]=t[r][l];if(o=this.retrieveItem(""+a.id),this.opt.development_extensions.locator_label_parse&&a.locator&&-1===["bill","gazette","legislation","regulation","treaty"].indexOf(o.type)&&(!a.label||"page"===a.label)){var u=CSL.LOCATOR_LABELS_REGEXP.exec(a.locator);if(u){var p=CSL.LOCATOR_LABELS_MAP[u[2]];this.getTerm(p)&&(a.label=p,a.locator=u[3])}}a.locator&&(a.locator=(""+a.locator).replace(/\s+$/,"")),i=[o,a],e.push(i)}if(this.opt.development_extensions.static_statute_locator&&this.remapSectionVariable(e),e&&e.length>1&&this.citation_sort.tokens.length>0){for(n=e.length,r=0;n>r;r+=1)e[r][1].sortkeys=CSL.getSortKeys.call(this,e[r][0],"citation_sort");e.sort(this.citation.srt.compareCompositeKeys)}return this.tmp.citation_errors=[],this.parallel.StartCitation(e),s=CSL.getCitationCluster.call(this,e)},CSL.getAmbiguousCite=function(t,e,i,s){var r,n=this.tmp.group_context.tip,a={term_intended:n.term_intended,variable_attempt:n.variable_attempt,variable_success:n.variable_success,output_tip:n.output_tip,label_form:n.label_form,parallel_conditions:n.parallel_conditions,condition:n.condition,force_suppress:n.force_suppress,done_vars:n.done_vars.slice()};this.tmp.disambig_request=e?e:!1;var o={position:1,"near-note":!0};s&&(o.locator=s.locator,o.label=s.label),this.registry.registry[t.id]&&this.registry.citationreg.citationsByItemId&&this.registry.citationreg.citationsByItemId[t.id]&&this.registry.citationreg.citationsByItemId[t.id].length&&i&&"by-cite"===this.citation.opt["givenname-disambiguation-rule"]&&(o["first-reference-note-number"]=this.registry.registry[t.id]["first-reference-note-number"]),this.tmp.area="citation",this.tmp.root="citation",this.parallel.use_parallels=this.parallel.use_parallels===!0||null===this.parallel.use_parallels?null:!1,this.tmp.suppress_decorations=!0,this.tmp.just_looking=!0,CSL.getCite.call(this,t,o,null,!1);for(var l=0,u=this.output.queue.length;u>l;l+=1)CSL.Output.Queue.purgeEmptyBlobs(this.output.queue[l]);if(this.opt.development_extensions.clean_up_csl_flaws)for(var p=0,h=this.output.queue.length;h>p;p+=1)this.output.adjust.upward(this.output.queue[p]),this.output.adjust.leftward(this.output.queue[p]),this.output.adjust.downward(this.output.queue[p]),this.output.adjust.fix(this.output.queue[p]);var r=this.output.string(this,this.output.queue);return this.tmp.just_looking=!1,this.tmp.suppress_decorations=!1,this.parallel.use_parallels=null===this.parallel.use_parallels?!0:!1,this.tmp.group_context.replace(a),r},CSL.getSpliceDelimiter=function(t,e){if(t&&!this.tmp.have_collapsed&&"string"==typeof this.citation.opt["after-collapse-delimiter"])this.tmp.splice_delimiter=this.citation.opt["after-collapse-delimiter"];else if(this.tmp.use_cite_group_delimiter)this.tmp.splice_delimiter=this.citation.opt.cite_group_delimiter;else if(this.tmp.have_collapsed&&"in-text"===this.opt.xclass&&this.opt.update_mode!==CSL.NUMERIC)this.tmp.splice_delimiter=", ";else if(this.tmp.cite_locales[e-1]){var i=this.tmp.cite_affixes[this.tmp.area][this.tmp.cite_locales[e-1]];i&&i.delimiter&&(this.tmp.splice_delimiter=i.delimiter)}else this.tmp.splice_delimiter||(this.tmp.splice_delimiter="");return this.tmp.splice_delimiter},CSL.getCitationCluster=function(t,e){var i,s,r,n,a,o,l,u,p,h,c,f,m,d,g,b,_,v,y;t=t?t:[],this.tmp.last_primary_names_string=!1,v=CSL.getSafeEscape(this),this.tmp.area="citation",this.tmp.root="citation",i="",s=[],this.tmp.last_suffix_used="",this.tmp.last_names_used=[],this.tmp.last_years_used=[],this.tmp.backref_index=[],this.tmp.cite_locales=[],this.output.checkNestedBrace=new CSL.checkNestedBrace(this);var x=this.output.checkNestedBrace.update(this.citation.opt.layout_prefix),I=!1;if("note"===this.opt.xclass&&this.citation.opt.suppressTrailingPunctuation&&(I=!0),e&&this.registry.citationreg.citationById[e].properties["suppress-trailing-punctuation"]&&(I=!0),"note"===this.opt.xclass){for(var O=[],S=!1,T=!1,A=!1,N=[],E=0,k=t.length;k>E;E+=1){var R=t[E][0].type,w=t[E][0].title,L=t[E][1].position,C=t[E][0].id;w&&"legal_case"===R&&C!==A&&L&&((w!==S||0===O.length)&&(N=[],O.push(N)),N.push(t[E][1])),S=w,T=L,A=C}for(E=0,k=O.length;k>E;E+=1)if(N=O[E],!(N.length<2)){var j=N.slice(-1)[0].locator;if(j)for(var D=0,P=N.length-1;P>D;D+=1)N[D].locator&&(j=!1);j&&(N[0].locator=j,delete N.slice(-1)[0].locator,N[0].label=N.slice(-1)[0].label,N.slice(-1)[0].label&&delete N.slice(-1)[0].label)}}for(r=[],n=t.length,a=0;n>a;a+=1){if(m=t[a][0],o=t[a][1],o=CSL.parseLocator.call(this,o),l=this.tmp.have_collapsed,u={},this.tmp.shadow_numbers={},!this.tmp.just_looking&&this.opt.hasPlaceholderTerm){var U=this.output;this.output=new CSL.Output.Queue(this),this.output.adjust=new CSL.Output.Queue.adjust,CSL.getAmbiguousCite.call(this,m,null,!1,o),this.output=U}if(this.tmp.in_cite_predecessor=!1,a>0?CSL.getCite.call(this,m,o,""+t[a-1][0].id,!0):(this.tmp.term_predecessor=!1,CSL.getCite.call(this,m,o,null,!0)),this.tmp.cite_renders_content||(y={citationID:""+this.tmp.citation_id,index:this.tmp.citation_pos,noteIndex:this.tmp.citation_note_index,itemID:""+m.id,citationItems_pos:a,error_code:CSL.ERROR_NO_RENDERED_FORM},this.tmp.citation_errors.push(y)),a===t.length-1&&this.parallel.ComposeSet(),u.splice_delimiter=CSL.getSpliceDelimiter.call(this,l,a),o&&o["author-only"]&&(this.tmp.suppress_decorations=!0),a>0){_=t[a-1][1];var B=_.suffix&&[".",","].indexOf(_.suffix.slice(-1))>-1,M=!_.suffix&&o.prefix&&[".",","].indexOf(o.prefix.slice(0,1))>-1;if(B||M){var X=u.splice_delimiter.indexOf(" ");u.splice_delimiter=X>-1&&!M?u.splice_delimiter.slice(X):""}}u.suppress_decorations=this.tmp.suppress_decorations,u.have_collapsed=this.tmp.have_collapsed,r.push(u)}this.tmp.has_purged_parallel=!1,this.parallel.PruneOutputQueue(this),p=0,f=this.output.queue.slice();var q=({strings:{suffix:this.citation.opt.layout_suffix,delimiter:this.citation.opt.layout_delimiter}},this.citation.opt.layout_suffix),V=this.tmp.cite_locales[this.tmp.cite_locales.length-1];V&&this.tmp.cite_affixes[this.tmp.area][V]&&this.tmp.cite_affixes[this.tmp.area][V].suffix&&(q=this.tmp.cite_affixes[this.tmp.area][V].suffix),CSL.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(q.slice(0,1))>-1&&(q=q.slice(0,1));var F=this.citation.opt.layout_delimiter;F||(F=""),CSL.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(F.slice(0,1))>-1&&(F=F.slice(0,1)),q=this.output.checkNestedBrace.update(q);for(var E=0,k=this.output.queue.length;k>E;E+=1)CSL.Output.Queue.purgeEmptyBlobs(this.output.queue[E]);if(!this.tmp.suppress_decorations&&this.output.queue.length&&(this.opt.development_extensions.apply_citation_wrapper&&this.sys.wrapCitationEntry&&!this.tmp.just_looking&&"citation"===this.tmp.area||(I||(this.output.queue[this.output.queue.length-1].strings.suffix=q),this.output.queue[0].strings.prefix=x)),this.opt.development_extensions.clean_up_csl_flaws)for(var D=0,P=this.output.queue.length;P>D;D+=1)this.output.adjust.upward(this.output.queue[D]),this.output.adjust.leftward(this.output.queue[D]),this.output.adjust.downward(this.output.queue[D]),this.tmp.last_chr=this.output.adjust.fix(this.output.queue[D]);for(a=0,n=f.length;n>a;a+=1){var z=[];if(this.output.queue=[f[a]],this.tmp.suppress_decorations=r[a].suppress_decorations,this.tmp.splice_delimiter=r[a].splice_delimiter,f[a].parallel_delimiter&&(this.tmp.splice_delimiter=f[a].parallel_delimiter),this.tmp.have_collapsed=r[a].have_collapsed,h=this.output.string(this,this.output.queue),this.tmp.suppress_decorations=!1,"string"==typeof h)return this.tmp.suppress_decorations=!1,h;if("object"==typeof h&&0===h.length&&!o["suppress-author"])if(this.tmp.has_purged_parallel)h.push("");else{var G="[CSL STYLE ERROR: reference with no printed form.]",$=0===a?v(this.citation.opt.layout_prefix):"",W=a===f.length-1?v(this.citation.opt.layout_suffix):"";h.push($+G+W)}if(z.length&&"string"==typeof h[0]){h.reverse();var K=h.pop();K&&","===K.slice(0,1)?z.push(K):"string"==typeof z.slice(-1)[0]&&","===z.slice(-1)[0].slice(-1)?z.push(" "+K):K&&z.push(v(this.tmp.splice_delimiter)+K)}else h.reverse(),c=h.pop(),"undefined"!=typeof c&&(z.length&&"string"==typeof z[z.length-1]&&(z[z.length-1]+=c.successor_prefix),z.push(c));for(d=h.length,g=0;d>g;g+=1)b=h[g],"string"!=typeof b?(c=h.pop(),"undefined"!=typeof c&&z.push(c)):z.push(v(this.tmp.splice_delimiter)+b);0!==z.length||t[a][1]["suppress-author"]||(p+=1),z.length>1&&"string"!=typeof z[0]&&(z=[this.output.renderBlobs(z)]),z.length&&("string"==typeof z[0]?a>0&&(f.length-1>a&&r[a+1].have_collapsed&&!r[a].have_collapsed&&(this.tmp.splice_delimiter=r[a-1].splice_delimiter),z[0]=v(this.tmp.splice_delimiter)+z[0]):z[0].splice_prefix=a>0?this.tmp.splice_delimiter:""),s=s.concat(z)}if(i+=this.output.renderBlobs(s),i&&!this.tmp.suppress_decorations)for(n=this.citation.opt.layout_decorations.length,a=0;n>a;a+=1)u=this.citation.opt.layout_decorations[a],"normal"!==u[1]&&(o&&o["author-only"]||(i=this.fun.decorate[u[0]][u[1]](this,i)));return this.tmp.suppress_decorations=!1,i},CSL.getCite=function(t,e,i,s){var r,n;for(this.tmp.cite_renders_content=!1,this.parallel.StartCite(t,e,i),CSL.citeStart.call(this,t,e,s),r=0,this.tmp.name_node={},this.nameOutput=new CSL.NameOutput(this,t,e);r<this[this.tmp.area].tokens.length;)r=CSL.tokenExec.call(this,this[this.tmp.area].tokens[r],t,e);return CSL.citeEnd.call(this,t,e),this.parallel.CloseCite(this),this.tmp.cite_renders_content||this.tmp.just_looking||"bibliography"===this.tmp.area&&(n={index:this.tmp.bibliography_pos,itemID:""+t.id,error_code:CSL.ERROR_NO_RENDERED_FORM},this.tmp.bibliography_errors.push(n)),""+t.id},CSL.citeStart=function(t,e,i){if(i||(this.tmp.shadow_numbers={}),this.tmp.disambiguate_count=0,this.tmp.disambiguate_maxMax=0,this.tmp.same_author_as_previous_cite=!1,this.tmp.subsequent_author_substitute_ok=this.tmp.suppress_decorations?!1:!0,this.tmp.lastchr="",this.tmp.have_collapsed="citation"===this.tmp.area&&this.citation.opt.collapse&&this.citation.opt.collapse.length?!0:!1,this.tmp.render_seen=!1,this.tmp.disambig_request&&!this.tmp.disambig_override?this.tmp.disambig_settings=this.tmp.disambig_request:this.registry.registry[t.id]&&!this.tmp.disambig_override?(this.tmp.disambig_request=this.registry.registry[t.id].disambig,this.tmp.disambig_settings=this.registry.registry[t.id].disambig):this.tmp.disambig_settings=new CSL.AmbigConfig,"citation"!==this.tmp.area)if(this.registry.registry[t.id]){if(this.tmp.disambig_restore=CSL.cloneAmbigConfig(this.registry.registry[t.id].disambig),"bibliography"===this.tmp.area&&this.tmp.disambig_settings&&this.tmp.disambig_override&&(this.opt["disambiguate-add-names"]&&(this.tmp.disambig_settings.names=this.registry.registry[t.id].disambig.names.slice(),this.tmp.disambig_request&&(this.tmp.disambig_request.names=this.registry.registry[t.id].disambig.names.slice())),this.opt["disambiguate-add-givenname"])){this.tmp.disambig_request=this.tmp.disambig_settings,this.tmp.disambig_settings.givens=this.registry.registry[t.id].disambig.givens.slice(),this.tmp.disambig_request.givens=this.registry.registry[t.id].disambig.givens.slice();for(var s=0,r=this.tmp.disambig_settings.givens.length;r>s;s+=1)this.tmp.disambig_settings.givens[s]=this.registry.registry[t.id].disambig.givens[s].slice();for(var s=0,r=this.tmp.disambig_request.givens.length;r>s;s+=1)this.tmp.disambig_request.givens[s]=this.registry.registry[t.id].disambig.givens[s].slice()}}else this.tmp.disambig_restore=new CSL.AmbigConfig;this.tmp.names_used=[],this.tmp.nameset_counter=0,this.tmp.years_used=[],this.tmp.names_max.clear(),this.tmp.splice_delimiter=this[this.tmp.area].opt.layout_delimiter,this.bibliography_sort.keys=[],this.citation_sort.keys=[],this.tmp.has_done_year_suffix=!1,this.tmp.last_cite_locale=!1,!this.tmp.just_looking&&e&&!e.position&&this.registry.registry[t.id]&&(this.tmp.disambig_restore=CSL.cloneAmbigConfig(this.registry.registry[t.id].disambig)),this.tmp.first_name_string=!1,this.tmp.authority_stop_last=0},CSL.citeEnd=function(t,e){if(this.tmp.disambig_restore&&this.registry.registry[t.id]){this.registry.registry[t.id].disambig.names=this.tmp.disambig_restore.names.slice(),this.registry.registry[t.id].disambig.givens=this.tmp.disambig_restore.givens.slice();for(var i=0,s=this.registry.registry[t.id].disambig.givens.length;s>i;i+=1)this.registry.registry[t.id].disambig.givens[i]=this.tmp.disambig_restore.givens[i].slice()}if(this.tmp.disambig_restore=!1,this.tmp.last_suffix_used=e&&e.suffix?e.suffix:"",this.tmp.last_years_used=this.tmp.years_used.slice(),this.tmp.last_names_used=this.tmp.names_used.slice(),this.tmp.cut_var=!1,this.tmp.disambig_request=!1,this.tmp.cite_locales.push(this.tmp.last_cite_locale),this.tmp.issued_date&&this.tmp.renders_collection_number){for(var r=[],i=this.tmp.issued_date.list.length-1;i>this.tmp.issued_date.pos;i+=-1)r.push(this.tmp.issued_date.list.pop());for(this.tmp.issued_date.list.pop(),i=r.length-1;i>-1;i+=-1)this.tmp.issued_date.list.push(r.pop());this.parallel.use_parallels&&(this.parallel.cite.issued=!1)}this.tmp.issued_date=!1,this.tmp.renders_collection_number=!1},e.exports=CSL,CSL.Engine.prototype.makeBibliography=function(t){var e,i,s,r,n,a,o,l,u;if(e=!1,!this.bibliography.tokens.length)return!1;"string"==typeof t&&(this.opt.citation_number_slug=t,t=!1),i=CSL.getBibliographyEntries.call(this,t),l=i[0],u=i[1];var p=i[2];for(s={maxoffset:0,entryspacing:this.bibliography.opt["entry-spacing"],linespacing:this.bibliography.opt["line-spacing"],"second-field-align":!1,entry_ids:l,bibliography_errors:this.tmp.bibliography_errors.slice(),done:p},this.bibliography.opt["second-field-align"]&&(s["second-field-align"]=this.bibliography.opt["second-field-align"]),r=0,a=this.registry.reflist.length,o=0;a>o;o+=1)n=this.registry.reflist[o],n.offset>s.maxoffset&&(s.maxoffset=n.offset);return this.bibliography.opt.hangingindent&&(s.hangingindent=this.bibliography.opt.hangingindent),s.bibstart=this.fun.decorate.bibstart,s.bibend=this.fun.decorate.bibend,this.opt.citation_number_slug=!1,[s,u]},CSL.getBibliographyEntries=function(t){function e(t,e){return t===e?!0:!1}function i(t,i){for(f=i.length,m=0;f>m;m+=1)if(e(t,i[m]))return!0;return!1}function s(t,s){return"none"!==t&&t||s?"string"==typeof s?e(t,s):s?i(t,s):!1:!0}var r,n,a,o,l,u,p,h,c,f,m,d,g,b,_,v,y,x,I,O,S,T,A;r=[],S=[],this.tmp.area="bibliography",this.tmp.root="bibliography",this.tmp.last_rendered_name=!1,this.tmp.bibliography_errors=[],this.tmp.bibliography_pos=0,n=t&&t.page_start&&t.page_length?this.registry.getSortedIds():this.retrieveItems(this.registry.getSortedIds()),this.tmp.disambig_override=!0,x={};var N;if(t&&t.page_start&&t.page_length&&(N=0,t.page_start!==!0))for(var _=0,v=n.length;v>_&&(x[n[_]]=!0,t.page_start!=n[_]);_+=1);for(var E=[],_=0,v=n.length;v>_;_+=1){if(t&&t.page_start&&t.page_length){if(x[n[_]])continue;if(h=this.retrieveItem(n[_]),N===t.page_length)break}else if(h=n[_],x[h.id])continue;if(t){if(a=!0,t.include){for(a=!1,T=0,A=t.include.length;A>T;T+=1)if(c=t.include[T],s(c.value,h[c.field])){a=!0;break}}else if(t.exclude){for(o=!1,T=0,A=t.exclude.length;A>T;T+=1)if(c=t.exclude[T],s(c.value,h[c.field])){o=!0;break}o&&(a=!1)}else if(t.select){for(a=!1,l=!0,T=0,A=t.select.length;A>T;T+=1)c=t.select[T],s(c.value,h[c.field])||(l=!1);l&&(a=!0)}if(t.quash){for(l=!0,T=0,A=t.quash.length;A>T;T+=1)c=t.quash[T],s(c.value,h[c.field])||(l=!1);l&&(a=!1)}if(!a)continue}if(u=new CSL.Token("group",CSL.START),u.decorations=[["@bibliography","entry"]].concat(this.bibliography.opt.layout_decorations),this.output.startTag("bib_entry",u),h.system_id&&this.sys.embedBibliographyEntry?this.output.current.value().item_id=h.system_id:this.output.current.value().system_id=h.id,I=[[{id:""+h.id},h]],g=[],!this.registry.registry[h.id].master||t&&t.page_start&&t.page_length)this.registry.registry[h.id].siblings||(this.parallel.StartCitation(I),this.tmp.term_predecessor=!1,g.push(""+CSL.getCite.call(this,h)),t&&t.page_start&&t.page_length&&(N+=1));else{for(b=!0,this.parallel.StartCitation(I),this.output.queue[0].strings.delimiter=", ",this.tmp.term_predecessor=!1,g.push(""+CSL.getCite.call(this,h)),x[h.id]=!0,y=this.registry.registry[h.id].siblings,T=0,A=y.length;A>T;T+=1){var k=this.registry.registry[h.id].siblings[T];O=this.retrieveItem(k),g.push(""+CSL.getCite.call(this,O)),x[O.id]=!0}this.parallel.ComposeSet(),this.parallel.PruneOutputQueue()}S.push(""),this.tmp.bibliography_pos+=1,E.push(g),this.output.endTag("bib_entry"),this.output.queue[0].blobs.length&&this.output.queue[0].blobs[0].blobs.length&&(b||!this.output.queue[0].blobs[0].blobs[0].strings?(d=this.output.queue[0].blobs,b=!1):d=this.output.queue[0].blobs[0].blobs,d[0].strings.prefix=this.bibliography.opt.layout_prefix+d[0].strings.prefix);for(var T=0,A=this.output.queue.length;A>T;T+=1)CSL.Output.Queue.purgeEmptyBlobs(this.output.queue[T]);for(var T=0,A=this.output.queue.length;A>T;T+=1)this.output.adjust.upward(this.output.queue[T]),this.output.adjust.leftward(this.output.queue[T]),this.output.adjust.downward(this.output.queue[T],!0),this.output.adjust.fix(this.output.queue[T]);var p=this.output.string(this,this.output.queue)[0];if(!p&&this.opt.update_mode===CSL.NUMERIC){var R=r.length+1+". [CSL STYLE ERROR: reference with no printed form.]";p=CSL.Output.Formats[this.opt.mode]["@bibliography/entry"](this,R)}p&&r.push(p)}var w=!1;if(t&&t.page_start&&t.page_length){var L=n.slice(-1)[0],C=E.slice(-1)[0];L&&C&&L!=C||(w=!0)}return this.tmp.disambig_override=!1,[E,r,w]},e.exports=CSL,CSL.Engine.prototype.setCitationId=function(t,e){var i,s,r;if(i=!1,!t.citationID||e){for(s=Math.floor(1e14*Math.random());;){if(r=0,!this.registry.citationreg.citationById[s]){t.citationID="a"+s.toString(32);break}r=!r&&5e13>s?1:-1,s+=1===r?1:-1}i=""+s}return this.registry.citationreg.citationById[t.citationID]=t,i},e.exports=CSL,CSL.Engine.prototype.rebuildProcessorState=function(t,e,i){t||(t=[]),e||(e="html");for(var s={},r=[],n=0,a=t.length;a>n;n+=1)for(var o=0,l=t[n].citationItems.length;l>o;o+=1){var u=""+t[n].citationItems[o].id;s[u]||r.push(u),s[u]=!0}this.updateItems(r);var p=[],h=[],c=[],f=this.opt.mode;this.setOutputFormat(e);for(var n=0,a=t.length;a>n;n+=1){var m=this.processCitationCluster(t[n],p,h,CSL.ASSUME_ALL_ITEMS_REGISTERED);p.push([t[n].citationID,t[n].properties.noteIndex]);for(var o=0,l=m[1].length;l>o;o+=1){var d=m[1][o][0];c[d]=[p[d][0],p[d][1],m[1][o][1]]}}return this.updateUncitedItems(i),this.setOutputFormat(f),c},CSL.Engine.prototype.restoreProcessorState=function(t){var e,i,s,r,n,a,o,l,u,p;l=[],u=[],t||(t=[]);var h=[],c={};for(e=0,i=t.length;i>e;e+=1)c[t[e].citationID]&&this.setCitationId(t[e],!0),c[t[e].citationID]=!0,h.push(t[e].properties.index);var f=t.slice();for(f.sort(function(t,e){return t.properties.index<e.properties.index?-1:t.properties.index>e.properties.index?1:0}),e=0,i=f.length;i>e;e+=1)f[e].properties.index=e;for(e=0,i=f.length;i>e;e+=1){for(p=[],s=0,r=f[e].citationItems.length;r>s;s+=1)n=f[e].citationItems[s],"undefined"==typeof n.sortkeys&&(n.sortkeys=[]),a=this.retrieveItem(""+n.id),o=[a,n],p.push(o),f[e].citationItems[s].item=a,u.push(""+n.id);f[e].properties.unsorted||p.sort(this.citation.srt.compareCompositeKeys),f[e].sortedItems=p,this.registry.citationreg.citationById[f[e].citationID]=f[e]}for(this.updateItems(u),e=0,i=t.length;i>e;e+=1)l.push([""+t[e].citationID,t[e].properties.noteIndex]);var m=[];return t&&t.length?m=this.processCitationCluster(t[0],[],l.slice(1)):(this.registry=new CSL.Registry(this),this.tmp=new CSL.Engine.Tmp,this.disambiguate=new CSL.Disambiguation(this)),m},CSL.Engine.prototype.updateItems=function(t,e,i,s){var r=this.tmp.area,n=this.tmp.root,a=this.tmp.extension;if(this.tmp.area="citation",this.tmp.root="citation",this.tmp.extension="",s||(this.tmp.loadedItemIDs={}),this.registry.init(t),i)for(var o in this.registry.ambigcites)this.registry.ambigsTouched[o]=!0;return this.registry.dodeletes(this.registry.myhash),this.registry.doinserts(this.registry.mylist),this.registry.dorefreshes(),this.registry.rebuildlist(),this.registry.setsortkeys(),this.registry.setdisambigs(),e||this.registry.sorttokens(),this.registry.renumber(),this.tmp.extension=a,this.tmp.area=r,this.tmp.root=n,this.registry.getSortedIds()},CSL.Engine.prototype.updateUncitedItems=function(t,e){var i=this.tmp.area,s=this.tmp.root,r=this.tmp.extension;if(this.tmp.area="citation",this.tmp.root="citation",this.tmp.extension="",this.tmp.loadedItemIDs={},t||(t=[]),"object"==typeof t)if("undefined"==typeof t.length){var n=t;t=[];for(var a in n)t.push(a)}else if("number"==typeof t.length)for(var n={},o=0,l=t.length;l>o;o+=1)n[t[o]]=!0;return this.registry.init(t,!0),this.registry.dopurge(n),this.registry.doinserts(this.registry.mylist),this.registry.dorefreshes(),this.registry.rebuildlist(),this.registry.setsortkeys(),this.registry.setdisambigs(),e||this.registry.sorttokens(),this.registry.renumber(),this.tmp.extension=r,this.tmp.area=i,this.tmp.root=s,this.registry.getSortedIds()},e.exports=CSL,CSL.localeResolve=function(t,e){var i,s;return e||(e="en-US"),t||(t=e),i={},s=t.split(/[\-_]/),i.base=CSL.LANG_BASES[s[0]],"undefined"==typeof i.base?{base:e,best:t,bare:s[0]}:(1===s.length&&(i.generic=!0),i.best=1===s.length||"x"===s[1]?i.base.replace("_","-"):s.slice(0,2).join("-"),i.base=i.base.replace("_","-"),i.bare=s[0],i)},CSL.Engine.prototype.localeConfigure=function(t,e){var i;if((!e||!this.locale[t.best])&&("en-US"===t.best?(i=CSL.setupXml(this.sys.retrieveLocale("en-US")),this.localeSet(i,"en-US",t.best)):"en-US"!==t.best&&(t.base!==t.best&&(i=CSL.setupXml(this.sys.retrieveLocale(t.base)),this.localeSet(i,t.base,t.best)),i=CSL.setupXml(this.sys.retrieveLocale(t.best)),this.localeSet(i,t.best,t.best)),this.localeSet(this.cslXml,"",t.best),this.localeSet(this.cslXml,t.bare,t.best),t.base!==t.best&&this.localeSet(this.cslXml,t.base,t.best),this.localeSet(this.cslXml,t.best,t.best),"undefined"==typeof this.locale[t.best].terms["page-range-delimiter"]&&(this.locale[t.best].terms["page-range-delimiter"]=["fr","pt"].indexOf(t.best.slice(0,2).toLowerCase())>-1?"-":"–"),"undefined"==typeof this.locale[t.best].terms["year-range-delimiter"]&&(this.locale[t.best].terms["year-range-delimiter"]="–"),"undefined"==typeof this.locale[t.best].terms["citation-range-delimiter"]&&(this.locale[t.best].terms["citation-range-delimiter"]="–"),this.opt.development_extensions.normalize_lang_keys_to_lowercase)){for(var s=["default-locale","locale-sort","locale-translit","locale-translat"],r=0,n=s.length;n>r;r+=1)for(var a=0,o=this.opt[s[r]].length;o>a;a+=1)this.opt[s[r]][a]=this.opt[s[r]][a].toLowerCase();this.opt.lang=this.opt.lang.toLowerCase()}},CSL.Engine.prototype.localeSet=function(t,e,i){var s,r,n,a,o,l,u,p,h,c,f,m,d,g,b,_;if(e=e.replace("_","-"),i=i.replace("_","-"),this.opt.development_extensions.normalize_lang_keys_to_lowercase&&(e=e.toLowerCase(),i=i.toLowerCase()),this.locale[i]||(this.locale[i]={},this.locale[i].terms={},this.locale[i].opts={},this.locale[i].opts["skip-words"]=CSL.SKIP_WORDS,this.locale[i].opts["leading-noise-words"]||(this.locale[i].opts["leading-noise-words"]=[]),this.locale[i].dates={},this.locale[i].ord={"1.0.1":!1,keys:{}},this.locale[i]["noun-genders"]={}),r=t.makeXml(),t.nodeNameIs(t.dataObj,"locale"))r=t.dataObj;else for(n=t.getNodesByName(t.dataObj,"locale"),o=0,m=t.numberofnodes(n);m>o;o+=1)if(s=n[o],t.getAttributeValue(s,"lang","xml")===e){r=s;break}for(n=t.getNodesByName(r,"type"),b=0,_=t.numberofnodes(n);_>b;b+=1){var v=n[b],y=t.getAttributeValue(v,"name"),x=t.getAttributeValue(v,"gender");this.opt.gender[y]=x}var I=t.getNodesByName(r,"term","ordinal").length;if(I){for(var O in this.locale[i].ord.keys)delete this.locale[i].terms[O];this.locale[i].ord={"1.0.1":!1,keys:{}}}n=t.getNodesByName(r,"term");var S={"last-digit":{},"last-two-digits":{},"whole-number":{}},T=!1,A={};for(o=0,m=t.numberofnodes(n);m>o;o+=1){if(l=n[o],p=t.getAttributeValue(l,"name"),"sub verbo"===p&&(p="sub-verbo"),"ordinal"===p.slice(0,7)){{t.getNodeValue(l)}if("ordinal"===p)T=!0;else{var N=t.getAttributeValue(l,"match"),E=p.slice(8),d=t.getAttributeValue(l,"gender-form");d||(d="neuter"),N||(N="last-two-digits","0"===E.slice(0,1)&&(N="last-digit")),"0"===E.slice(0,1)&&(E=E.slice(1)),S[N][E]||(S[N][E]={}),S[N][E][d]=p}this.locale[i].ord.keys[p]=!0}"undefined"==typeof this.locale[i].terms[p]&&(this.locale[i].terms[p]={}),u="long",d=!1,t.getAttributeValue(l,"form")&&(u=t.getAttributeValue(l,"form")),t.getAttributeValue(l,"gender-form")&&(d=t.getAttributeValue(l,"gender-form")),t.getAttributeValue(l,"gender")&&(this.locale[i]["noun-genders"][p]=t.getAttributeValue(l,"gender")),d?(this.locale[i].terms[p][d]={},this.locale[i].terms[p][d][u]=[],g=this.locale[i].terms[p][d],A[p]=!0):(this.locale[i].terms[p][u]=[],g=this.locale[i].terms[p]),t.numberofnodes(t.getNodesByName(l,"multiple"))?(g[u][0]=t.getNodeValue(l,"single"),g[u][0].indexOf("%s")>-1&&(this.opt.hasPlaceholderTerm=!0),g[u][1]=t.getNodeValue(l,"multiple"),g[u][1].indexOf("%s")>-1&&(this.opt.hasPlaceholderTerm=!0)):(g[u]=t.getNodeValue(l),g[u].indexOf("%s")>-1&&(this.opt.hasPlaceholderTerm=!0))}if(T){for(var k in A){var R={},w=0;for(var L in this.locale[i].terms[k])["masculine","feminine"].indexOf(L)>-1?R[L]=this.locale[i].terms[k][L]:w+=1;if(!w)if(R.feminine)for(var L in R.feminine)this.locale[i].terms[k][L]=R.feminine[L];else if(R.masculine)for(var L in R.masculine)this.locale[i].terms[k][L]=R.masculine[L]}this.locale[i].ord["1.0.1"]=S}for(p in this.locale[i].terms)for(b=0,_=2;_>b;b+=1)if(d=CSL.GENDERS[b],this.locale[i].terms[p][d])for(u in this.locale[i].terms[p])this.locale[i].terms[p][d][u]||(this.locale[i].terms[p][d][u]=this.locale[i].terms[p][u]);for(n=t.getNodesByName(r,"style-options"),o=0,m=t.numberofnodes(n);m>o;o+=1){h=n[o],a=t.attributes(h);for(f in a)if(a.hasOwnProperty(f))if("@punctuation-in-quote"===f||"@limit-day-ordinals-to-day-1"===f)this.locale[i].opts[f.slice(1)]="true"===a[f]?!0:!1;else if("@jurisdiction-preference"===f){var C=a[f].split(/\s*,\s*/);this.locale[i].opts[f.slice(1)]=C}else if("@skip-words"===f){var j=a[f].split(/\s*,\s*/);this.locale[i].opts[f.slice(1)]=j}else if("@leading-noise-words"===f){var D=a[f].split(/\s*,\s*/);this.locale[i].opts["leading-noise-words"]=D}else if("@name-as-sort-order"===f){this.locale[i].opts["name-as-sort-order"]={};for(var P=a[f].split(/\s+/),b=0,_=P.length;_>b;b+=1)this.locale[i].opts["name-as-sort-order"][P[b]]=!0}else if("@name-as-reverse-order"===f){this.locale[i].opts["name-as-reverse-order"]={};for(var P=a[f].split(/\s+/),b=0,_=P.length;_>b;b+=1)this.locale[i].opts["name-as-reverse-order"][P[b]]=!0}else if("@name-never-short"===f){this.locale[i].opts["name-never-short"]={};for(var P=a[f].split(/\s+/),b=0,_=P.length;_>b;b+=1)this.locale[i].opts["name-never-short"][P[b]]=!0}}for(n=t.getNodesByName(r,"date"),o=0,m=t.numberofnodes(n);m>o;o+=1){var c=n[o];this.locale[i].dates[t.getAttributeValue(c,"form")]=c}},e.exports=CSL,CSL.getLocaleNames=function(t,e){function i(t,e){var i=["base","best"];if(e){normalizedLocale=CSL.localeResolve(e);for(var s=0,r=i.length;r>s;s++)normalizedLocale[i[s]]&&-1===t.indexOf(normalizedLocale[i[s]])&&t.push(normalizedLocale[i[s]])}}function s(t){for(var e=r.getNodesByName(r.dataObj,t),i=0,s=e.length;s>i;i++){var a=r.getAttributeValue(e[i],"locale");if(a){a=a.split(/ +/);for(var o=0,l=a.length;l>o;o++)this.extendLocaleList(n,a[o]);
+
+}}}var r=CSL.setupXml(t),n=["en-US"];i(n,e);var a=r.getNodesByName(r.dataObj,"style")[0],o=r.getAttributeValue(a,"default-locale");i(n,o);for(var l=["layout","if","else-if","condition"],u=0,p=l.length;p>u;u++)s(r,n,l[u]);return n},e.exports=CSL,CSL.Node={},CSL.Node.bibliography={build:function(t,e){if(this.tokentype===CSL.START){t.build.area="bibliography",t.build.root="bibliography",t.build.extension="";var i=function(t){t.tmp.area="bibliography",t.tmp.root="bibliography",t.tmp.extension=""};this.execs.push(i)}e.push(this)}},e.exports=CSL,CSL.Node.choose={build:function(t,e){var i;this.tokentype===CSL.START&&(i=function(t){t.tmp.jump.push(void 0,CSL.LITERAL)}),this.tokentype===CSL.END&&(i=function(t){t.tmp.jump.pop()}),this.execs.push(i),e.push(this)},configure:function(t,e){this.tokentype===CSL.END?(t.configure.fail.push(e),t.configure.succeed.push(e)):(t.configure.fail.pop(),t.configure.succeed.pop())}},e.exports=CSL,CSL.Node.citation={build:function(t,e){if(this.tokentype===CSL.START){t.build.area="citation",t.build.root="citation",t.build.extension="";var i=function(t){t.tmp.area="citation",t.tmp.root="citation",t.tmp.extension=""};this.execs.push(i)}if(this.tokentype===CSL.END){if(t.opt.grouped_sort="in-text"===t.opt.xclass&&t.citation.opt.collapse&&t.citation.opt.collapse.length||t.citation.opt.cite_group_delimiter&&t.citation.opt.cite_group_delimiter.length&&t.opt.update_mode!==CSL.POSITION&&t.opt.update_mode!==CSL.NUMERIC,t.opt.grouped_sort&&t.citation_sort.opt.sort_directions.length){var s=t.citation_sort.opt.sort_directions[0].slice();t.citation_sort.opt.sort_directions=[s].concat(t.citation_sort.opt.sort_directions)}t.citation.srt=new CSL.Registry.Comparifier(t,"citation_sort")}e.push(this)}},e.exports=CSL,CSL.Node["#comment"]={build:function(){}},e.exports=CSL,CSL.Node.date={build:function(t,e){var i,s,r,n,a,o,l,u,p,h;(this.tokentype===CSL.START||this.tokentype===CSL.SINGLETON)&&(t.build.date_parts=[],t.build.date_variables=this.variables,t.build.extension||CSL.Util.substituteStart.call(this,t,e),i=t.build.extension?CSL.dateMacroAsSortKey:function(t,e,i){var c;if(t.tmp.element_rendered_ok=!1,t.tmp.donesies=[],t.tmp.dateparts=[],c=[],!this.variables.length||t.tmp.just_looking&&"accessed"===this.variables[0])t.tmp.date_object=!1;else{for(s=e[this.variables[0]],"undefined"==typeof s&&(s={"date-parts":[[0]]},t.opt.development_extensions.locator_date_and_revision&&i&&"locator-date"===this.variables[0]&&i["locator-date"]&&(s=i["locator-date"])),t.tmp.date_object=s,r=this.dateparts.length,n=0;r>n;n+=1)a=this.dateparts[n],"undefined"!=typeof t.tmp.date_object[a+"_end"]?c.push(a):"month"===a&&"undefined"!=typeof t.tmp.date_object.season_end&&c.push(a);for(o=[],l=["year","month","day"],r=l.length,n=0;r>n;n+=1)c.indexOf(l[n])>-1&&o.push(l[n]);for(c=o.slice(),u=2,r=c.length,n=0;r>n;n+=1)if(a=c[n],p=t.tmp.date_object[a],h=t.tmp.date_object[a+"_end"],p!==h){u=n;break}t.tmp.date_collapse_at=c.slice(u)}},this.execs.push(i),i=function(t,e){if(e[this.variables[0]]&&(t.parallel.StartVariable(this.variables[0]),t.output.startTag("date",this),"issued"===this.variables[0]&&"legal_case"===e.type&&!t.tmp.extension&&""+e["collection-number"]==""+t.tmp.date_object.year&&1===this.dateparts.length&&"year"===this.dateparts[0]))for(var i in t.tmp.date_object)if(t.tmp.date_object.hasOwnProperty(i)&&"year"===i.slice(0,4)){t.tmp.issued_date={};var s=t.output.current.mystack.slice(-2)[0].blobs;t.tmp.issued_date.list=s,t.tmp.issued_date.pos=s.length-1}},this.execs.push(i)),t.build.extension||this.tokentype!==CSL.END&&this.tokentype!==CSL.SINGLETON||(i=function(t,e){e[this.variables[0]]&&(t.output.endTag(),t.parallel.CloseVariable(this.variables[0]))},this.execs.push(i)),e.push(this),(this.tokentype===CSL.END||this.tokentype===CSL.SINGLETON)&&(t.build.extension||CSL.Util.substituteEnd.call(this,t,e))}},e.exports=CSL,CSL.Node["date-part"]={build:function(t,e){var i,s,r,n,a,o,l,u,p,h,c,f,m,d,g,b,_,v,y,x,I,O;this.strings.form||(this.strings.form="long"),t.build.date_parts.push(this.strings.name);var S=t.build.date_variables[0];i=function(t,e){if(t.tmp.date_object){if(n=!0,a="",o="",t.tmp.donesies.push(this.strings.name),t.tmp.date_object.literal&&"year"===this.strings.name&&(t.parallel.AppendToVariable(t.tmp.date_object.literal),t.output.append(t.tmp.date_object.literal,this)),t.tmp.date_object&&(a=t.tmp.date_object[this.strings.name],o=t.tmp.date_object[this.strings.name+"_end"]),"year"!==this.strings.name||0!==a||t.tmp.suppress_decorations||(a=!1),l=!t.tmp.suppress_decorations,u=t.tmp.have_collapsed,p="year-suffix"===t[t.tmp.area].opt.collapse||"year-suffix-ranged"===t[t.tmp.area].opt.collapse,h=t.opt["disambiguate-add-year-suffix"],l&&h&&p&&(t.tmp.years_used.push(a),c=t.tmp.last_years_used.length>=t.tmp.years_used.length,c&&u&&t.tmp.last_years_used[t.tmp.years_used.length-1]===a&&(a=!1)),"undefined"!=typeof a){f=!1,m=!1,d=!1,g=!1,"year"===this.strings.name&&(parseInt(a,10)<500&&parseInt(a,10)>0&&(m=t.getTerm("ad")),parseInt(a,10)<0&&(f=t.getTerm("bc"),a=-1*parseInt(a,10)),o&&(parseInt(o,10)<500&&parseInt(o,10)>0&&(g=t.getTerm("ad")),parseInt(o,10)<0&&(d=t.getTerm("bc"),o=-1*parseInt(o,10)))),t.parallel.AppendToVariable(a);for(var i=""+t.tmp.date_object.month;i.length<2;)i="0"+i;i="month-"+i;var T=t.locale[t.opt.lang]["noun-genders"][i];if(this.strings.form){var A=this.strings.form;if("day"===this.strings.name&&"ordinal"===A&&t.locale[t.opt.lang].opts["limit-day-ordinals-to-day-1"]&&""+a!="1"&&(A="numeric"),a=CSL.Util.Dates[this.strings.name][A](t,a,T,this.default_locale),"month"===this.strings.name)if(t.tmp.strip_periods)a=a.replace(/\./g,"");else for(var N=0,E=this.decorations.length;E>N;N+=1)if("@strip-periods"===this.decorations[N][0]&&"true"===this.decorations[N][1]){a=a.replace(/\./g,"");break}if(o)if(o=CSL.Util.Dates[this.strings.name][A](t,o,T,"accessed"===S,"_end"),t.tmp.strip_periods)o=o.replace(/\./g,"");else for(var N=0,E=this.decorations.length;E>N;N+=1)if("@strip-periods"===this.decorations[N][0]&&"true"===this.decorations[N][1]){o=o.replace(/\./g,"");break}}if(t.output.openLevel("empty"),t.tmp.date_collapse_at.length){for(b=!0,r=t.tmp.date_collapse_at.length,s=0;r>s;s+=1)if(O=t.tmp.date_collapse_at[s],-1===t.tmp.donesies.indexOf(O)){b=!1;break}if(b){if(""+o!="0"){if(0===t.dateput.queue.length&&(n=!0),t.opt["year-range-format"]&&"expanded"!==t.opt["year-range-format"]&&!t.tmp.date_object.day&&!t.tmp.date_object.month&&!t.tmp.date_object.season&&"year"===this.strings.name&&a&&o){o=t.fun.year_mangler(a+"-"+o,!0);var k=t.getTerm("year-range-delimiter");o=o.slice(o.indexOf(k)+1)}t.dateput.append(o,this),n&&(t.dateput.current.value()[0].strings.prefix="")}t.output.append(a,this),_=t.output.current.value(),_.blobs[_.blobs.length-1].strings.suffix="",t.output.append(t.getTerm("year-range-delimiter"),"empty"),v=t.dateput.current.value(),_.blobs=_.blobs.concat(v),t.dateput.string(t,t.dateput.queue),t.tmp.date_collapse_at=[]}else t.output.append(a,this),t.tmp.date_collapse_at.indexOf(this.strings.name)>-1&&""+o!="0"&&(0===t.dateput.queue.length&&(n=!0),t.dateput.openLevel("empty"),t.dateput.append(o,this),n&&(t.dateput.current.value().blobs[0].strings.prefix=""),f&&t.dateput.append(f),m&&t.dateput.append(m),t.dateput.closeLevel())}else t.output.append(a,this);f&&t.output.append(f),m&&t.output.append(m),t.output.closeLevel()}else"month"===this.strings.name&&t.tmp.date_object.season&&(a=""+t.tmp.date_object.season,a&&a.match(/^[1-4]$/)?(t.tmp.group_context.tip.variable_success=!0,t.output.append(t.getTerm("season-0"+a),this)):a&&t.output.append(a,this));t.tmp.value=[],!e[S]||!a&&!t.tmp.have_collapsed||t.opt.has_year_suffix||"year"!==this.strings.name||t.tmp.just_looking||t.registry.registry[e.id]&&t.registry.registry[e.id].disambig.year_suffix!==!1&&!t.tmp.has_done_year_suffix&&(t.tmp.has_done_year_suffix=!0,x=parseInt(t.registry.registry[e.id].disambig.year_suffix,10),y=new CSL.NumericBlob(!1,x,this,e.id),this.successor_prefix=t[t.build.area].opt.layout_delimiter,this.splice_prefix=t[t.build.area].opt.layout_delimiter,I=new CSL.Util.Suffixator(CSL.SUFFIX_CHARS),y.setFormatter(I),"year-suffix-ranged"===t[t.tmp.area].opt.collapse&&(y.range_prefix=t.getTerm("citation-range-delimiter")),y.successor_prefix=t[t.tmp.area].opt.cite_group_delimiter?t[t.tmp.area].opt.cite_group_delimiter:t[t.tmp.area].opt["year-suffix-delimiter"]?t[t.tmp.area].opt["year-suffix-delimiter"]:t[t.tmp.area].opt.layout_delimiter,y.UGLY_DELIMITER_SUPPRESS_HACK=!0,t.output.append(y,"literal"))}},this.execs.push(i),e.push(this)}},e.exports=CSL,CSL.Node["else-if"]={build:function(t,e){CSL.Conditions.TopNode.call(this,t,e),e.push(this)},configure:function(t,e){CSL.Conditions.Configure.call(this,t,e)}},e.exports=CSL,CSL.Node["else"]={build:function(t,e){e.push(this)},configure:function(t,e){this.tokentype===CSL.START&&(t.configure.fail[t.configure.fail.length-1]=e)}},e.exports=CSL,CSL.Node["et-al"]={build:function(t,e){if("citation"===t.build.area||"bibliography"===t.build.area){var i=function(t){t.tmp.etal_node=this,"string"==typeof this.strings.term&&(t.tmp.etal_term=this.strings.term)};this.execs.push(i)}e.push(this)}},e.exports=CSL,CSL.Node.group={build:function(t,e,i){var s,r,n;if(this.realGroup=i,this.tokentype===CSL.START&&(CSL.Util.substituteStart.call(this,t,e),t.build.substitute_level.value()&&t.build.substitute_level.replace(t.build.substitute_level.value()+1),this.juris||e.push(this),s=function(t){if(t.output.startTag("group",this),this.strings.label_form_override&&(t.tmp.group_context.tip.label_form||(t.tmp.group_context.tip.label_form=this.strings.label_form_override)),this.realGroup){var e=!1,i=!1;t.tmp.group_context.mystack.length&&(t.output.current.value().parent=t.tmp.group_context.tip.output_tip);var s=t.tmp.group_context.tip.label_form;s||(s=this.strings.label_form_override),t.tmp.group_context.tip.condition?(e=t.tmp.group_context.tip.condition,i=t.tmp.group_context.tip.force_suppress):this.strings.reject?(e={test:this.strings.reject,not:!0},i=!0,n=[]):this.strings.require&&(e={test:this.strings.require,not:!1},n=[]),t.tmp.group_context.push({term_intended:!1,variable_attempt:!1,variable_success:!1,variable_success_parent:t.tmp.group_context.tip.variable_success,output_tip:t.output.current.tip,label_form:s,parallel_conditions:this.strings.set_parallel_condition,condition:e,force_suppress:i,done_vars:t.tmp.group_context.tip.done_vars.slice()})}},r=[],r.push(s),this.execs=r.concat(this.execs),this.strings["has-publisher-and-publisher-place"]&&(t.build["publisher-special"]=!0,s=function(t,e){if(this.strings["subgroup-delimiter"]&&e.publisher&&e["publisher-place"]){var i=e.publisher.split(/;\s*/),s=e["publisher-place"].split(/;\s*/);i.length>1&&i.length===s.length&&(t.publisherOutput=new CSL.PublisherOutput(t,this),t.publisherOutput["publisher-list"]=i,t.publisherOutput["publisher-place-list"]=s)}},this.execs.push(s)),this.juris)){for(var a=0,o=e.length;o>a;a++){e[a]}var l=new CSL.Token("choose",CSL.START);CSL.Node.choose.build.call(l,t,e);var u=new CSL.Token("if",CSL.START);s=function(e){return function(i){if(!t.sys.retrieveStyleModule||!CSL.MODULE_MACROS[e]||!i.jurisdiction)return!1;var s=t.getJurisdictionList(i.jurisdiction);if(!t.opt.jurisdictions_seen[s[0]]){var r=t.retrieveAllStyleModules(s);for(var n in r){var a=0;t.juris[n]={};for(var o=CSL.setupXml(r[n]),l=o.getNodesByName(o.dataObj,"law-module"),u=0,p=l.length;p>u;u++){var h=o.getAttributeValue(l[u],"types");if(h){t.juris[n].types={},h=h.split(/\s+/);for(var c=0,f=h.length;f>c;c++)t.juris[n].types[h[c]]=!0}}t.juris[n].types||(t.juris[n].types=CSL.MODULE_TYPES);for(var l=o.getNodesByName(o.dataObj,"macro"),u=0,p=l.length;p>u;u++){var m=o.getAttributeValue(l[u],"name");CSL.MODULE_MACROS[m]?(a++,t.juris[n][m]=[],t.buildTokenLists(l[u],t.juris[n][m]),t.configureTokenList(t.juris[n][m])):CSL.debug('CSL: skipping non-modular macro name "'+m+'" in module context')}}}for(var u=0,p=s.length;p>u;u++){var n=s[u];if(t.juris[n]&&t.juris[n].types[i.type])return i["best-jurisdiction"]=n,!0}return!1}}(this.juris),u.tests.push(s),u.test=t.fun.match.any(u,t,u.tests),e.push(u);var p=new CSL.Token("text",CSL.SINGLETON);s=function(t,e,i){var s=0;if(t.juris[e["best-jurisdiction"]][this.juris])for(;s<t.juris[e["best-jurisdiction"]][this.juris].length;)s=CSL.tokenExec.call(t,t.juris[e["best-jurisdiction"]][this.juris][s],e,i)},p.juris=this.juris,p.execs.push(s),e.push(p);var h=new CSL.Token("if",CSL.END);CSL.Node["if"].build.call(h,t,e);var c=new CSL.Token("else",CSL.START);CSL.Node["else"].build.call(c,t,e)}if(this.tokentype===CSL.END&&(t.build["publisher-special"]&&(t.build["publisher-special"]=!1,"string"==typeof t[t.build.root].opt["name-delimiter"]&&(s=function(t){t.publisherOutput&&(t.publisherOutput.render(),t.publisherOutput=!1)},this.execs.push(s))),s=function(t,e){if(t.output.endTag(),this.realGroup){var i=t.tmp.group_context.pop();if(t.tmp.group_context.tip.condition&&(t.tmp.group_context.tip.force_suppress=i.force_suppress),!i.force_suppress&&(i.variable_success||i.term_intended&&!i.variable_attempt)){this.isJurisLocatorLabel||(t.tmp.group_context.tip.variable_success=!0);var s=t.output.current.value().blobs,r=t.output.current.value().blobs.length-1;if(!t.tmp.just_looking&&"undefined"!=typeof i.parallel_conditions){var n={blobs:s,conditions:i.parallel_conditions,id:e.id,pos:r};t.parallel.parallel_conditional_blobs_list.push(n)}}else{if(t.tmp.group_context.tip.variable_attempt=i.variable_attempt,i.force_suppress&&!t.tmp.group_context.tip.condition){t.tmp.group_context.tip.variable_attempt=!0,t.tmp.group_context.tip.variable_success=i.variable_success_parent;for(var a=0,o=i.done_vars.length;o>a;a++)t.tmp.done_vars.indexOf(i.done_vars[a])>-1&&(t.tmp.done_vars=t.tmp.done_vars.slice(0,a).concat(t.tmp.done_vars.slice(a+1)))}t.output.current.value().blobs&&t.output.current.value().blobs.pop()}}},this.execs.push(s),this.juris)){var f=new CSL.Token("else",CSL.END);CSL.Node["else"].build.call(f,t,e);var m=new CSL.Token("choose",CSL.END);CSL.Node.choose.build.call(m,t,e)}this.tokentype===CSL.END&&(this.juris||e.push(this),t.build.substitute_level.value()&&t.build.substitute_level.replace(t.build.substitute_level.value()-1),CSL.Util.substituteEnd.call(this,t,e))}},e.exports=CSL,CSL.Node["if"]={build:function(t,e){CSL.Conditions.TopNode.call(this,t,e),e.push(this)},configure:function(t,e){CSL.Conditions.Configure.call(this,t,e)}},e.exports=CSL,CSL.Node.conditions={build:function(t){this.tokentype===CSL.START&&t.tmp.conditions.addMatch(this.match),this.tokentype===CSL.END&&t.tmp.conditions.matchCombine()}},e.exports=CSL,CSL.Node.condition={build:function(t){if(this.tokentype===CSL.SINGLETON){var e=t.fun.match[this.match](this,t,this.tests);t.tmp.conditions.addTest(e)}}},e.exports=CSL,CSL.Conditions={},CSL.Conditions.TopNode=function(t){var e;(this.tokentype===CSL.START||this.tokentype===CSL.SINGLETON)&&(this.locale&&(t.opt.lang=this.locale),this.tests&&this.tests.length?this.test=t.fun.match[this.match](this,t,this.tests):t.tmp.conditions=new CSL.Conditions.Engine(t,this)),(this.tokentype===CSL.END||this.tokentype===CSL.SINGLETON)&&(e=function(t){this.locale_default&&(t.output.current.value().old_locale=this.locale_default,t.output.closeLevel("empty"),t.opt.lang=this.locale_default);var e=this[t.tmp.jump.value()];return e},this.execs.push(e),this.locale_default&&(t.opt.lang=this.locale_default))},CSL.Conditions.Configure=function(t,e){this.tokentype===CSL.START?(this.fail=t.configure.fail.slice(-1)[0],this.succeed=this.next,t.configure.fail[t.configure.fail.length-1]=e):this.tokentype===CSL.SINGLETON?(this.fail=this.next,this.succeed=t.configure.succeed.slice(-1)[0],t.configure.fail[t.configure.fail.length-1]=e):(this.succeed=t.configure.succeed.slice(-1)[0],this.fail=this.next)},CSL.Conditions.Engine=function(t,e){this.token=e,this.state=t},CSL.Conditions.Engine.prototype.addTest=function(t){this.token.tests.push(t)},CSL.Conditions.Engine.prototype.addMatch=function(t){this.token.match=t},CSL.Conditions.Engine.prototype.matchCombine=function(){this.token.test=this.state.fun.match[this.token.match](this.token,this.state,this.token.tests)},e.exports=CSL,CSL.Node.info={build:function(t){t.build.skip=this.tokentype===CSL.START?"info":!1}},e.exports=CSL,CSL.Node.institution={build:function(t,e){if([CSL.SINGLETON,CSL.START].indexOf(this.tokentype)>-1){var i=function(t){t.tmp.institution_delimiter="string"==typeof this.strings.delimiter?this.strings.delimiter:t.tmp.name_delimiter;"text"===t.inheritOpt(this,"and")?this.and_term=t.getTerm("and","long",0):"symbol"===t.inheritOpt(this,"and")?this.and_term=t.opt.development_extensions.expect_and_symbol_form?t.getTerm("and","symbol",0):"&":"none"===t.inheritOpt(this,"and")&&(this.and_term=t.tmp.institution_delimiter),"undefined"==typeof this.and_term&&t.tmp.and_term&&(this.and_term=t.getTerm("and","long",0)),CSL.STARTSWITH_ROMANESQUE_REGEXP.test(this.and_term)?(this.and_prefix_single=" ",this.and_prefix_multiple=", ","string"==typeof t.tmp.institution_delimiter&&(this.and_prefix_multiple=t.tmp.institution_delimiter),this.and_suffix=" "):(this.and_prefix_single="",this.and_prefix_multiple="",this.and_suffix=""),"always"===t.inheritOpt(this,"delimiter-precedes-last")?this.and_prefix_single=t.tmp.institution_delimiter:"never"===t.inheritOpt(this,"delimiter-precedes-last")&&this.and_prefix_multiple&&(this.and_prefix_multiple=" "),this.and={},"undefined"!=typeof this.and_term?(t.output.append(this.and_term,"empty",!0),this.and.single=t.output.pop(),this.and.single.strings.prefix=this.and_prefix_single,this.and.single.strings.suffix=this.and_suffix,t.output.append(this.and_term,"empty",!0),this.and.multiple=t.output.pop(),this.and.multiple.strings.prefix=this.and_prefix_multiple,this.and.multiple.strings.suffix=this.and_suffix):"undefined"!==this.strings.delimiter&&(this.and.single=new CSL.Blob(t.tmp.institution_delimiter),this.and.single.strings.prefix="",this.and.single.strings.suffix="",this.and.multiple=new CSL.Blob(t.tmp.institution_delimiter),this.and.multiple.strings.prefix="",this.and.multiple.strings.suffix=""),t.nameOutput.institution=this};this.execs.push(i)}e.push(this)},configure:function(t){[CSL.SINGLETON,CSL.START].indexOf(this.tokentype)>-1&&(t.build.has_institution=!0)}},e.exports=CSL,CSL.Node["institution-part"]={build:function(t,e){var i;"long"===this.strings.name?i=this.strings["if-short"]?function(t){t.nameOutput.institutionpart["long-with-short"]=this}:function(t){t.nameOutput.institutionpart["long"]=this}:"short"===this.strings.name&&(i=function(t){t.nameOutput.institutionpart["short"]=this}),this.execs.push(i),e.push(this)}},e.exports=CSL,CSL.Node.key={build:function(t,e){e=t[t.build.root+"_sort"].tokens;var i,s=new CSL.Token("key",CSL.START);t.tmp.root=t.build.root,s.strings["et-al-min"]=t.inheritOpt(this,"et-al-min"),s.strings["et-al-use-first"]=t.inheritOpt(this,"et-al-use-first"),s.strings["et-al-use-last"]=t.inheritOpt(this,"et-al-use-last"),i=function(t){t.tmp.done_vars=[]},s.execs.push(i),t.opt.citation_number_sort_direction=this.strings.sort_direction,i=function(t){t.output.openLevel("empty")},s.execs.push(i);var r=[];if(this.strings.sort_direction===CSL.DESCENDING?(r.push(1),r.push(-1)):(r.push(-1),r.push(1)),t[t.build.area].opt.sort_directions.push(r),CSL.DATE_VARIABLES.indexOf(this.variables[0])>-1&&(t.build.date_key=!0),i=function(t){t.tmp.sort_key_flag=!0,t.inheritOpt(this,"et-al-min")&&(t.tmp["et-al-min"]=t.inheritOpt(this,"et-al-min")),t.inheritOpt(this,"et-al-use-first")&&(t.tmp["et-al-use-first"]=t.inheritOpt(this,"et-al-use-first")),"boolean"==typeof t.inheritOpt(this,"et-al-use-last")&&(t.tmp["et-al-use-last"]=t.inheritOpt(this,"et-al-use-last"))},s.execs.push(i),e.push(s),this.variables.length){var n=this.variables[0];if("citation-number"===n&&("citation"===t.build.area&&"_sort"===t.build.extension&&(t.opt.citation_number_sort=!1),"bibliography"===t.build.root&&"_sort"===t.build.extension&&(t.opt.citation_number_sort_used=!1)),CSL.CREATORS.indexOf(n)>-1){var a=new CSL.Token("names",CSL.START);a.tokentype=CSL.START,a.variables=this.variables,CSL.Node.names.build.call(a,t,e);var o=new CSL.Token("name",CSL.SINGLETON);o.tokentype=CSL.SINGLETON,o.strings["name-as-sort-order"]="all",o.strings["sort-separator"]=" ",o.strings["et-al-use-last"]=t.inheritOpt(this,"et-al-use-last"),o.strings["et-al-min"]=t.inheritOpt(this,"et-al-min"),o.strings["et-al-use-first"]=t.inheritOpt(this,"et-al-use-first"),CSL.Node.name.build.call(o,t,e);var l=new CSL.Token("institution",CSL.SINGLETON);l.tokentype=CSL.SINGLETON,CSL.Node.institution.build.call(l,t,e);var u=new CSL.Token("names",CSL.END);u.tokentype=CSL.END,CSL.Node.names.build.call(u,t,e)}else{var p=new CSL.Token("text",CSL.SINGLETON);if(p.dateparts=this.dateparts,CSL.NUMERIC_VARIABLES.indexOf(n)>-1)i=function(t,e){var i;i=!1,i="citation-number"===n?t.registry.registry[e.id].seq.toString():e[n],i&&(i=CSL.Util.padding(i)),t.output.append(i,this)};else if("citation-label"===n)i=function(t,e){var i=t.getCitationLabel(e);t.output.append(i,this)};else if(CSL.DATE_VARIABLES.indexOf(n)>-1)i=CSL.dateAsSortKey,p.variables=this.variables;else if("title"===n){var h="title",c=!1,f=!1,m=!0;i=t.transform.getOutputFunction(this.variables,h,c,f,m)}else i=function(t,e){var i=e[n];t.output.append(i,"empty")};p.execs.push(i),e.push(p)}}else{var d=new CSL.Token("text",CSL.SINGLETON);d.postponed_macro=this.postponed_macro,CSL.expandMacro.call(t,d,e)}var g=new CSL.Token("key",CSL.END);i=function(t){var e=t.output.string(t,t.output.queue);t.sys.normalizeUnicode&&(e=t.sys.normalizeUnicode(e)),e=e?e.split(" ").join(t.opt.sort_sep)+t.opt.sort_sep:"",""===e&&(e=void 0),("string"!=typeof e||t.tmp.empty_date)&&(e=void 0,t.tmp.empty_date=!1),t[t[t.tmp.area].root+"_sort"].keys.push(e),t.tmp.value=[]},g.execs.push(i),t.build.date_key&&("citation"===t.build.area&&"_sort"===t.build.extension&&(t[t.build.area].opt.sort_directions.push([-1,1]),i=function(t,e){var i=t.registry.registry[e.id].disambig.year_suffix;i||(i=0);var s=CSL.Util.padding(""+i);t[t.tmp.area].keys.push(s)},g.execs.push(i)),t.build.date_key=!1),i=function(t){t.tmp["et-al-min"]=void 0,t.tmp["et-al-use-first"]=void 0,t.tmp["et-al-use-last"]=void 0,t.tmp.sort_key_flag=!1},g.execs.push(i),e.push(g)}},e.exports=CSL,CSL.Node.label={build:function(t,e){if(this.strings.term){!this.strings.form;var i=function(t,e,i){var s=CSL.evaluateLabel(this,t,e,i);i&&"locator"===this.strings.term&&(t.parallel.StartVariable("label"),t.parallel.AppendToVariable(i.label),i.section_form_override=this.strings.form),s&&(t.tmp.group_context.tip.term_intended=!0),CSL.UPDATE_GROUP_CONTEXT_CONDITION(t,s),-1===s.indexOf("%s")&&t.output.append(s,this),i&&"locator"===this.strings.term&&t.parallel.CloseVariable()};this.execs.push(i)}else{var s=t.build.names_variables.slice(-1)[0];t.build.name_label||(t.build.name_label={});for(var r=0,n=s.length;n>r;r+=1)t.build.name_label[s[r]]||(t.build.name_label[s[r]]={});if(t.build.name_flag)for(var r=0,n=s.length;n>r;r+=1)t.build.name_label[s[r]].after=this;else for(var r=0,n=s.length;n>r;r+=1)t.build.name_label[s[r]].before=this}e.push(this)}},e.exports=CSL,CSL.Node.layout={build:function(t,e){function i(){"bibliography"===t.build.area&&(n=new CSL.Token("text",CSL.SINGLETON),s=function(t){{var e;t.tmp.cite_locales[t.tmp.cite_locales.length-1]}e=t.tmp.cite_affixes[t.tmp.area][t.tmp.last_cite_locale]?t.tmp.cite_affixes[t.tmp.area][t.tmp.last_cite_locale].suffix:t.bibliography.opt.layout_suffix;var i=t.output.current.value();t.opt.using_display?i.blobs[i.blobs.length-1].strings.suffix=e:i.strings.suffix=e,t.bibliography.opt["second-field-align"]&&t.output.endTag("bib_other")},n.execs.push(s),e.push(n))}var s,r,n,a;this.tokentype===CSL.START&&(t.build.current_default_locale=this.locale_raw?this.locale_raw:t.opt["default-locale"],s=function(t,e,i){t.opt.development_extensions.apply_citation_wrapper&&t.sys.wrapCitationEntry&&!t.tmp.just_looking&&e.system_id&&"citation"===t.tmp.area&&(cite_entry=new CSL.Token("group",CSL.START),cite_entry.decorations=[["@cite","entry"]],t.output.startTag("cite_entry",cite_entry),t.output.current.value().item_id=e.system_id,i&&(t.output.current.value().locator_txt=i.locator_txt,t.output.current.value().suffix_txt=i.suffix_txt))},this.execs.push(s)),this.tokentype!==CSL.START||t.tmp.cite_affixes[t.build.area]||(s=function(t,e){t.tmp.done_vars=[],!t.tmp.just_looking&&t.registry.registry[e.id]&&t.registry.registry[e.id].parallel&&t.tmp.done_vars.push("first-reference-note-number"),t.tmp.rendered_name=!1},this.execs.push(s),s=function(t){t.tmp.sort_key_flag=!1},this.execs.push(s),s=function(t){t.tmp.nameset_counter=0},this.execs.push(s),s=function(t,e){var i=new CSL.Token;t.opt.development_extensions.rtl_support&&["ar","he","fa","ur","yi","ps","syr"].indexOf(e.language)>-1&&(i=new CSL.Token,i.strings.prefix="‫",i.strings.suffix="‬"),t.output.openLevel(i)},this.execs.push(s),e.push(this),t.opt.development_extensions.rtl_support,1,"citation"===t.build.area&&(r=new CSL.Token("text",CSL.SINGLETON),s=function(t,e,i){var s;if(i&&i.prefix){s="";var r=i.prefix.replace(/<[^>]+>/g,"").replace(/["'\u201d\u2019\u00bb\u202f\u00a0 ]+$/g,""),n=r.slice(-1);r.match(CSL.ENDSWITH_ROMANESQUE_REGEXP)?s=" ":CSL.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(n)>-1?s=" ":n.match(/[\)\],0-9]/)&&(s=" ");var a=!1;CSL.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(n)>-1&&i.prefix.trim().indexOf(" ")>-1&&(t.tmp.term_predecessor=!1,a=!0);var o=(i.prefix+s).replace(/\s+/g," ");t.tmp.just_looking||(o=t.output.checkNestedBrace.update(o)),t.output.append(o,this,!1,a)}},r.execs.push(s),e.push(r)));var o;if(this.locale_raw&&(o=new CSL.Token("dummy",CSL.START),o.locale=this.locale_raw,o.strings.delimiter=this.strings.delimiter,o.strings.suffix=this.strings.suffix,t.tmp.cite_affixes[t.build.area]||(t.tmp.cite_affixes[t.build.area]={})),this.tokentype===CSL.START&&(t.build.layout_flag=!0,this.locale_raw||(t[t.tmp.area].opt.topdecor=[this.decorations],t[t.tmp.area+"_sort"].opt.topdecor=[this.decorations],t[t.build.area].opt.layout_prefix=this.strings.prefix,t[t.build.area].opt.layout_suffix=this.strings.suffix,t[t.build.area].opt.layout_delimiter=this.strings.delimiter,t[t.build.area].opt.layout_decorations=this.decorations,t.tmp.cite_affixes[t.build.area]&&(a=new CSL.Token("else",CSL.START),CSL.Node["else"].build.call(a,t,e))),this.locale_raw)){if(t.build.layout_locale_flag)o.name="else-if",CSL.Attributes["@locale-internal"].call(o,t,this.locale_raw),CSL.Node["else-if"].build.call(o,t,e);else{var l=new CSL.Token("choose",CSL.START);CSL.Node.choose.build.call(l,t,e),o.name="if",CSL.Attributes["@locale-internal"].call(o,t,this.locale_raw),CSL.Node["if"].build.call(o,t,e)}t.tmp.cite_affixes[t.build.area][o.locale]={},t.tmp.cite_affixes[t.build.area][o.locale].delimiter=this.strings.delimiter,t.tmp.cite_affixes[t.build.area][o.locale].suffix=this.strings.suffix}this.tokentype===CSL.END&&(this.locale_raw&&(i(),t.build.layout_locale_flag?(o.name="else-if",o.tokentype=CSL.END,CSL.Attributes["@locale-internal"].call(o,t,this.locale_raw),CSL.Node["else-if"].build.call(o,t,e)):(o.name="if",o.tokentype=CSL.END,CSL.Attributes["@locale-internal"].call(o,t,this.locale_raw),CSL.Node["if"].build.call(o,t,e),t.build.layout_locale_flag=!0)),this.locale_raw||(i(),t.tmp.cite_affixes[t.build.area]&&t.build.layout_locale_flag&&(a=new CSL.Token("else",CSL.END),CSL.Node["else"].build.call(a,t,e),a=new CSL.Token("choose",CSL.END),CSL.Node.choose.build.call(a,t,e)),t.build_layout_locale_flag=!0,"citation"===t.build.area&&(n=new CSL.Token("text",CSL.SINGLETON),s=function(t,e,i){var s;if(i&&i.suffix){s="",(i.suffix.match(CSL.STARTSWITH_ROMANESQUE_REGEXP)||["[","("].indexOf(i.suffix.slice(0,1))>-1)&&(s=" ");var r=i.suffix;t.tmp.just_looking||(r=t.output.checkNestedBrace.update(r)),t.output.append(s+r,this)}},n.execs.push(s),e.push(n)),s=function(t){t.output.closeLevel()},this.execs.push(s),s=function(t,e){t.opt.development_extensions.apply_citation_wrapper&&t.sys.wrapCitationEntry&&!t.tmp.just_looking&&e.system_id&&"citation"===t.tmp.area&&t.output.endTag()},this.execs.push(s),e.push(this),t.build.layout_flag=!1,t.build.layout_locale_flag=!1))}},e.exports=CSL,CSL.Node.macro={build:function(){}},e.exports=CSL,CSL.NameOutput=function(t,e,i){this.debug=!1,this.state=t,this.Item=e,this.item=i,this.nameset_base=0,this.etal_spec={},this._first_creator_variable=!1,this._please_chop=!1},CSL.NameOutput.prototype.init=function(t){this.state.tmp.term_predecessor&&(this.state.tmp.subsequent_author_substitute_ok=!1),this.nameset_offset&&(this.nameset_base=this.nameset_base+this.nameset_offset),this.nameset_offset=0,this.names=t,this.variables=t.variables,this.state.tmp.value=[],this.state.tmp.rendered_name=[],this.state.tmp.label_blob=!1,this.state.tmp.etal_node=!1,this.state.tmp.etal_term=!1;for(var e=0,i=this.variables.length;i>e;e+=1)this.Item[this.variables[e]]&&this.Item[this.variables[e]].length&&(this.state.tmp.value=this.state.tmp.value.concat(this.Item[this.variables[e]]));this["et-al"]=void 0,this["with"]=void 0,this.name=void 0,this.institutionpart={},this.state.tmp.group_context.tip.variable_attempt=!0,this.labelVariable=this.variables[0],!this.state.tmp.value.length},CSL.NameOutput.prototype.reinit=function(t,e){if(this.labelVariable=e,this.state.tmp.can_substitute.value()){this.nameset_offset=0,this.variables=t.variables;var i=this.state.tmp.value.slice();this.state.tmp.value=[];for(var s=0,r=this.variables.length;r>s;s+=1)this.Item[this.variables[s]]&&this.Item[this.variables[s]].length&&(this.state.tmp.value=this.state.tmp.value.concat(this.Item[this.variables[s]]));this.state.tmp.value.length&&this.state.tmp.can_substitute.replace(!1,CSL.LITERAL),this.state.tmp.value=i}},CSL.NameOutput.prototype.outputNames=function(){var t,e,i=this.variables;if(this.institution.and&&(this.institution.and.single.blobs&&this.institution.and.single.blobs.length||(this.institution.and.single.blobs=this.name.and.single.blobs),this.institution.and.multiple.blobs&&this.institution.and.multiple.blobs.length||(this.institution.and.multiple.blobs=this.name.and.multiple.blobs)),this.variable_offset={},this.family)for(this.family_decor=CSL.Util.cloneToken(this.family),this.family_decor.strings.prefix="",this.family_decor.strings.suffix="",t=0,e=this.family.execs.length;e>t;t+=1)this.family.execs[t].call(this.family_decor,this.state,this.Item);else this.family_decor=!1;if(this.given)for(this.given_decor=CSL.Util.cloneToken(this.given),this.given_decor.strings.prefix="",this.given_decor.strings.suffix="",t=0,e=this.given.execs.length;e>t;t+=1)this.given.execs[t].call(this.given_decor,this.state,this.Item);else this.given_decor=!1;if(this.getEtAlConfig(),this.divideAndTransliterateNames(),this.truncatePersonalNameLists(),this.disambigNames(),this.constrainNames(),"count"===this.name.strings.form)return void((this.state.tmp.extension||0!=this.names_count)&&(this.state.output.append(this.names_count,"empty"),this.state.tmp.group_context.tip.variable_success=!0));this.setEtAlParameters(),this.setCommonTerm(),this.state.tmp.name_node={},this.state.tmp.name_node.children=[],this.renderAllNames();var s=[];for(t=0,e=i.length;e>t;t+=1){var r=i[t],n=[],a=!1,o=null;if(this.state.opt.development_extensions.spoof_institutional_affiliations){for(var l=0,u=this.institutions[r].length;u>l;l+=1)n.push(this.joinPersonsAndInstitutions([this.persons[r][l],this.institutions[r][l]]));if(this.institutions[r].length){var p=this.nameset_base+this.variable_offset[r];this.freeters[r].length&&(p+=1),a=this.joinInstitutionSets(n,p)}var o=this.joinFreetersAndInstitutionSets([this.freeters[r],a])}else o=this._join([this.freeters[r]],"");if(o&&(this.state.tmp.extension||(o=this._applyLabels(o,r)),s.push(o)),this.common_term)break}for(this.state.output.openLevel("empty"),this.state.output.current.value().strings.delimiter=this.state.inheritOpt(this.names,"delimiter","names-delimiter"),t=0,e=s.length;e>t;t+=1)this.state.output.append(s[t],"literal",!0);this.state.output.closeLevel("empty");
+
+var h=this.state.output.pop(),c=CSL.Util.cloneToken(this.names);if(this.state.output.append(h,c),this.state.tmp.term_predecessor_name&&(this.state.tmp.term_predecessor=!0),this.state.tmp.name_node.top=this.state.output.current.value(),"authority"!==i[0]){var f=[],m=this.Item[i[0]];if(m)for(var t=0,e=m.length;e>t;t+=1){var d=CSL.Util.Names.getRawName(m[t]);d&&f.push(d)}f=f.join(", "),f&&(this.state.tmp.name_node.string=f)}if(this.state.tmp.name_node.string&&!this.state.tmp.first_name_string&&(this.state.tmp.first_name_string=this.state.tmp.name_node.string),"classic"===this.Item.type){var g=[];this.state.tmp.first_name_string&&g.push(this.state.tmp.first_name_string),this.Item.title&&g.push(this.Item.title),g=g.join(", "),g&&this.state.sys.getAbbreviation&&(this.state.transform.loadAbbreviation("default","classic",g),this.state.transform.abbrevs["default"].classic[g]&&(this.state.tmp.done_vars.push("title"),this.state.output.append(this.state.transform.abbrevs["default"].classic[g],"empty",!0),h=this.state.output.pop(),this.state.tmp.name_node.top.blobs.pop(),this.state.tmp.name_node.top.blobs.push(h)))}this._collapseAuthor(),this.variables=[]},CSL.NameOutput.prototype._applyLabels=function(t,e){var i;if(!this.label||!this.label[this.labelVariable])return t;var s=0,r=this.freeters_count[e]+this.institutions_count[e];if(r>1)s=1;else{for(var n=0,a=this.persons[e].length;a>n;n+=1)r+=this.persons_count[e][n];r>1&&(s=1)}return this.label[this.labelVariable].before?("number"==typeof this.label[this.labelVariable].before.strings.plural&&(s=this.label[this.labelVariable].before.strings.plural),i=this._buildLabel(e,s,"before",this.labelVariable),this.state.output.openLevel("empty"),this.state.output.append(i,this.label[this.labelVariable].before,!0),this.state.output.append(t,"literal",!0),this.state.output.closeLevel("empty"),t=this.state.output.pop()):this.label[this.labelVariable].after&&("number"==typeof this.label[this.labelVariable].after.strings.plural&&(s=this.label[this.labelVariable].after.strings.plural),i=this._buildLabel(e,s,"after",this.labelVariable),this.state.output.openLevel("empty"),this.state.output.append(t,"literal",!0),this.state.output.append(i,this.label[this.labelVariable].after,!0),this.state.tmp.label_blob=this.state.output.pop(),this.state.output.append(this.state.tmp.label_blob,"literal",!0),this.state.output.closeLevel("empty"),t=this.state.output.pop()),t},CSL.NameOutput.prototype._buildLabel=function(t,e,i,s){this.common_term&&(t=this.common_term);var r=!1,n=this.label[s][i];return n&&(r=CSL.castLabel(this.state,n,t,e,CSL.TOLERANT)),r},CSL.NameOutput.prototype._collapseAuthor=function(){var t,e,i;0===this.nameset_base&&this.Item[this.variables[0]]&&!this._first_creator_variable&&(this._first_creator_variable=this.variables[0]),(this.item&&this.item["suppress-author"]&&this._first_creator_variable==this.variables[0]||this.state[this.state.tmp.area].opt.collapse&&this.state[this.state.tmp.area].opt.collapse.length||this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter.length)&&(this.state.tmp.authorstring_request?(e="",t=this.state.tmp.name_node.top.blobs.slice(-1)[0].blobs,i=this.state.tmp.offset_characters,t&&(e=this.state.output.string(this.state,t,!1)),this.state.tmp.offset_characters=i,this.state.registry.authorstrings[this.Item.id]=e):this.state.tmp.just_looking||this.state.tmp.suppress_decorations||!(this.item["suppress-author"]||this.state[this.state.tmp.area].opt.collapse&&this.state[this.state.tmp.area].opt.collapse.length||this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter)||(e="",t=this.state.tmp.name_node.top.blobs.slice(-1)[0].blobs,i=this.state.tmp.offset_characters,t&&(e=this.state.output.string(this.state,t,!1)),e===this.state.tmp.last_primary_names_string?((this.item["suppress-author"]||this.state[this.state.tmp.area].opt.collapse&&this.state[this.state.tmp.area].opt.collapse.length)&&(this.state.tmp.name_node.top.blobs.pop(),this.state.tmp.name_node.children=[],this.state.tmp.offset_characters=i),this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter&&(this.state.tmp.use_cite_group_delimiter=!0)):(this.state.tmp.last_primary_names_string=e,this.variables.indexOf(this._first_creator_variable)>-1&&this.item&&this.item["suppress-author"]&&"legal_case"!==this.Item.type&&(this.state.tmp.name_node.top.blobs.pop(),this.state.tmp.name_node.children=[],this.state.tmp.offset_characters=i,this.state.tmp.term_predecessor=!1),this.state.tmp.have_collapsed=!1,this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter&&(this.state.tmp.use_cite_group_delimiter=!1))))},e.exports=CSL,CSL.NameOutput.prototype.isPerson=function(t){return t.literal||!t.given&&t.family&&t.isInstitution?!1:!0},e.exports=CSL,CSL.NameOutput.prototype.truncatePersonalNameLists=function(){var t,e,i,s,r,n,a;this.freeters_count={},this.persons_count={},this.institutions_count={};for(t in this.freeters)this.freeters.hasOwnProperty(t)&&(this.freeters_count[t]=this.freeters[t].length,this.freeters[t]=this._truncateNameList(this.freeters,t));for(t in this.persons)if(this.persons.hasOwnProperty(t))for(this.institutions_count[t]=this.institutions[t].length,this._truncateNameList(this.institutions,t),this.persons[t]=this.persons[t].slice(0,this.institutions[t].length),this.persons_count[t]=[],s=0,r=this.persons[t].length;r>s;s+=1)this.persons_count[t][s]=this.persons[t][s].length,this.persons[t][s]=this._truncateNameList(this.persons,t,s);if(n=1!==this.etal_min||1!==this.etal_use_first||this.state.tmp.extension||this.state.tmp.just_looking?!1:t,n||this._please_chop)for(e=0,i=this.variables.length;i>e;e+=1){t=this.variables[e],this.freeters[t].length&&(this._please_chop===t?(this.freeters[t]=this.freeters[t].slice(1),this.freeters_count[t]+=-1,this._please_chop=!1):n&&!this._please_chop&&(this.freeters[t]=this.freeters[t].slice(0,1),this.freeters_count[t]=1,this.institutions[t]=[],this.persons[t]=[],this._please_chop=n));for(var s=0,r=this.persons[t].length;r>s;s++)if(this.persons[t][s].length){if(this._please_chop===t){this.persons[t][s]=this.persons[t][s].slice(1),this.persons_count[t][s]+=-1,this._please_chop=!1;break}if(n&&!this._please_chop){this.freeters[t]=this.persons[t][s].slice(0,1),this.freeters_count[t]=1,this.institutions[t]=[],this.persons[t]=[],a=[],this._please_chop=n;break}}this.institutions[t].length&&(this._please_chop===t?(this.institutions[t]=this.institutions[t].slice(1),this.institutions_count[t]+=-1,this._please_chop=!1):n&&!this._please_chop&&(this.institutions[t]=this.institutions[t].slice(0,1),this.institutions_count[t]=1,a=[],this._please_chop=n))}for(e=0,i=this.variables.length;i>e;e+=1){this.institutions[t].length&&(this.nameset_offset+=1);for(var s=0,r=this.persons[t].length;r>s;s++)this.persons[t][s].length&&(this.nameset_offset+=1)}},CSL.NameOutput.prototype._truncateNameList=function(t,e,i){var s;if(s="undefined"==typeof i?t[e]:t[e][i],this.state[this.state[this.state.tmp.area].root].opt.max_number_of_names&&s.length>50&&s.length>this.state[this.state[this.state.tmp.area].root].opt.max_number_of_names+2){var r=this.state[this.state[this.state.tmp.area].root].opt.max_number_of_names;s=s.slice(0,r+1).concat(s.slice(-1))}return s},e.exports=CSL,CSL.NameOutput.prototype.divideAndTransliterateNames=function(){var t,e,i,s,r=this.Item,n=this.variables;for(this.varnames=n.slice(),this.freeters={},this.persons={},this.institutions={},t=0,e=n.length;e>t;t+=1){var a=n[t];this.variable_offset[a]=this.nameset_offset;var o=this._normalizeVariableValue(r,a);if(this.name.strings["suppress-min"]&&o.length>=this.name.strings["suppress-min"]&&(o=[]),this.name.strings["suppress-max"]&&o.length<=this.name.strings["suppress-max"]&&(o=[]),this._getFreeters(a,o),this._getPersonsAndInstitutions(a,o),this.state.opt.development_extensions.spoof_institutional_affiliations)if(0===this.name.strings["suppress-min"])for(this.freeters[a]=[],i=0,s=this.persons[a].length;s>i;i+=1)this.persons[a][i]=[];else if(0===this.institution.strings["suppress-min"]){for(this.institutions[a]=[],this.freeters[a]=this.freeters[a].concat(this.persons[a]),i=0,s=this.persons[a].length;s>i;i+=1)for(var l=0,u=this.persons[a][i].length;u>l;l+=1)this.freeters[a].push(this.persons[a][i][l]);this.persons[a]=[]}}},CSL.NameOutput.prototype._normalizeVariableValue=function(t,e){var i;return"string"==typeof t[e]||"number"==typeof t[e]?(CSL.debug('name variable "'+e+'" is string or number, not array. Attempting to fix.'),i=[{literal:t[e]+""}]):t[e]?"number"!=typeof t[e].length?(CSL.debug('name variable "'+e+'" is object, not array. Attempting to fix.'),t[e]=[t[e]],i=t[e].slice()):i=t[e].slice():i=[],i},CSL.NameOutput.prototype._getFreeters=function(t,e){if(this.freeters[t]=[],this.state.opt.development_extensions.spoof_institutional_affiliations)for(var i=e.length-1;i>-1&&this.isPerson(e[i]);i--){var s=this._checkNickname(e.pop());s&&this.freeters[t].push(s)}else for(var i=e.length-1;i>-1;i--){var s=e.pop();if(this.isPerson(s))var s=this._checkNickname(s);this.freeters[t].push(s)}this.freeters[t].reverse(),this.freeters[t].length&&(this.nameset_offset+=1)},CSL.NameOutput.prototype._getPersonsAndInstitutions=function(t,e){if(this.persons[t]=[],this.institutions[t]=[],this.state.opt.development_extensions.spoof_institutional_affiliations){for(var i=[],s=!1,r=!0,n=e.length-1;n>-1;n+=-1)if(this.isPerson(e[n])){var a=this._checkNickname(e[n]);a&&i.push(a)}else s=!0,this.institutions[t].push(e[n]),r||(i.reverse(),this.persons[t].push(i),i=[]),r=!1;s&&(i.reverse(),this.persons[t].push(i),this.persons[t].reverse(),this.institutions[t].reverse())}},CSL.NameOutput.prototype._clearValues=function(t){for(var e=t.length-1;e>-1;e+=-1)t.pop()},CSL.NameOutput.prototype._checkNickname=function(t){if(["interview","personal_communication"].indexOf(this.Item.type)>-1){var e="";if(e=CSL.Util.Names.getRawName(t),e&&this.state.sys.getAbbreviation&&(!this.item||!this.item["suppress-author"])){var i=e;this.state.sys.normalizeAbbrevsKey&&(i=this.state.sys.normalizeAbbrevsKey(e)),this.state.transform.loadAbbreviation("default","nickname",i);var s=this.state.transform.abbrevs["default"].nickname[i];s&&(t="!here>>>"===s?!1:{family:s,given:""})}}return t},e.exports=CSL,CSL.NameOutput.prototype.joinPersons=function(t,e,i,s){var r;return s||(s="name"),r="undefined"==typeof i?1===this.etal_spec[e].freeters?this._joinEtAl(t,s):2===this.etal_spec[e].freeters?this._joinEllipsis(t,s):this.state.tmp.sort_key_flag?this._join(t," "):this._joinAnd(t,s):1===this.etal_spec[e].persons[i]?this._joinEtAl(t,s):2===this.etal_spec[e].persons[i]?this._joinEllipsis(t,s):this.state.tmp.sort_key_flag?this._join(t," "):this._joinAnd(t,s)},CSL.NameOutput.prototype.joinInstitutionSets=function(t,e){var i;return i=1===this.etal_spec[e].institutions?this._joinEtAl(t,"institution"):2===this.etal_spec[e].institutions?this._joinEllipsis(t,"institution"):this._joinAnd(t,"institution")},CSL.NameOutput.prototype.joinPersonsAndInstitutions=function(t){return this._join(t,this.state.tmp.name_delimiter)},CSL.NameOutput.prototype.joinFreetersAndInstitutionSets=function(t){var e=this._join(t,"[never here]",this["with"].single,this["with"].multiple);return e},CSL.NameOutput.prototype._joinEtAl=function(t,e){var i=this._join(t,this.state.tmp.name_delimiter);return this.state.output.openLevel(this._getToken(e)),this.state.output.current.value().strings.delimiter="",this.state.output.append(i,"literal",!0),t.length>1?this.state.output.append(this["et-al"].multiple,"literal",!0):1===t.length&&this.state.output.append(this["et-al"].single,"literal",!0),this.state.output.closeLevel(),this.state.output.pop()},CSL.NameOutput.prototype._joinEllipsis=function(t,e){return this._join(t,this.state.tmp.name_delimiter,this.name.ellipsis.single,this.name.ellipsis.multiple,e)},CSL.NameOutput.prototype._joinAnd=function(t,e){return this._join(t,this.state.inheritOpt(this[e],"delimiter",e+"-delimiter",", "),this[e].and.single,this[e].and.multiple,e)},CSL.NameOutput.prototype._join=function(t,e,i,s){var r,n;if(!t)return!1;for(r=t.length-1;r>-1;r+=-1)t[r]&&0!==t[r].length&&t[r].blobs.length||(t=t.slice(0,r).concat(t.slice(r+1)));if(!t.length)return!1;if(i&&2===t.length)i&&(i=new CSL.Blob(i.blobs,i)),t=[t[0],i,t[1]];else{var a;for(a=s?2:1,r=0,n=t.length-a;n>r;r+=1)t[r].strings.suffix+=e;if(t.length>1){var o=t.pop();s?(s=new CSL.Blob(s.blobs,s),t.push(s)):(i&&(i=new CSL.Blob(i.blobs,i)),t.push(i)),t.push(o)}}for(this.state.output.openLevel(),i&&s&&(this.state.output.current.value().strings.delimiter=""),r=0,n=t.length;n>r;r+=1)this.state.output.append(t[r],!1,!0);return this.state.output.closeLevel(),this.state.output.pop()},CSL.NameOutput.prototype._getToken=function(t){var e=this[t];if("institution"===t){var i=new CSL.Token;return i}return e},e.exports=CSL,CSL.NameOutput.prototype.setCommonTerm=function(){var t=this.variables,e=t.slice();if(e.sort(),this.common_term=e.join(""),!this.common_term)return!1;var i=!1;if(this.label&&this.label[this.variables[0]]&&(this.label[this.variables[0]].before?i=this.state.getTerm(this.common_term,this.label[this.variables[0]].before.strings.form,0):this.label[this.variables[0]].after&&(i=this.state.getTerm(this.common_term,this.label[this.variables[0]].after.strings.form,0))),!this.state.locale[this.state.opt.lang].terms[this.common_term]||!i||this.variables.length<2)return void(this.common_term=!1);for(var s=0,r=0,n=this.variables.length-1;n>r;r+=1){var a=this.variables[r],o=this.variables[r+1];if(this.freeters[a].length||this.freeters[o].length){if(this.etal_spec[a].freeters!==this.etal_spec[o].freeters||!this._compareNamesets(this.freeters[a],this.freeters[o]))return void(this.common_term=!1);s+=1}if(this.persons[a].length!==this.persons[o].length)return void(this.common_term=!1);for(var l=0,u=this.persons[a].length;u>l;l+=1)if(this.etal_spec[a].persons[l]!==this.etal_spec[o].persons[l]||!this._compareNamesets(this.persons[a][l],this.persons[o][l]))return void(this.common_term=!1)}},CSL.NameOutput.prototype._compareNamesets=function(t,e){if(t.length!==e.length)return!1;for(var i=0,s=e.length;s>i;i+=1)for(var r=(e[i],0),n=CSL.NAME_PARTS.length;n>r;r+=1){var a=CSL.NAME_PARTS[r];if(!t[i]||t[i][a]!=e[i][a])return!1}return!0},e.exports=CSL,CSL.NameOutput.prototype.constrainNames=function(){this.names_count=0;for(var t,e=0,i=this.variables.length;i>e;e+=1){var s=this.variables[e];t=this.nameset_base+e,this.freeters[s].length&&(this.state.tmp.names_max.push(this.freeters[s].length,"literal"),this._imposeNameConstraints(this.freeters,this.freeters_count,s,t),this.names_count+=this.freeters[s].length),this.institutions[s].length&&(this.state.tmp.names_max.push(this.institutions[s].length,"literal"),this._imposeNameConstraints(this.institutions,this.institutions_count,s,t),this.persons[s]=this.persons[s].slice(0,this.institutions[s].length),this.names_count+=this.institutions[s].length);for(var r=0,n=this.persons[s].length;n>r;r+=1)this.persons[s][r].length&&(this.state.tmp.names_max.push(this.persons[s][r].length,"literal"),this._imposeNameConstraints(this.persons[s],this.persons_count[s],r,t),this.names_count+=this.persons[s][r].length)}},CSL.NameOutput.prototype._imposeNameConstraints=function(t,e,i,s){var r=t[i],n=this.state.tmp["et-al-min"];this.state.tmp.suppress_decorations?this.state.tmp.disambig_request&&this.state.tmp.disambig_request.names[s]?n=this.state.tmp.disambig_request.names[s]:e[i]>=this.etal_min&&(n=this.etal_use_first):(this.state.tmp.disambig_request&&this.state.tmp.disambig_request.names[s]>this.etal_use_first?n=e[i]<this.etal_min?e[i]:this.state.tmp.disambig_request.names[s]:e[i]>=this.etal_min&&(n=this.etal_use_first),this.etal_use_last&&n>this.etal_min-2&&(n=this.etal_min-2));var a=this.etal_min>=this.etal_use_first,o=e[i]>n;n>e[i]&&(n=r.length),a&&o&&(t[i]=this.etal_use_last?r.slice(0,n).concat(r.slice(-1)):r.slice(0,n)),this.state.tmp.disambig_settings.names[s]=t[i].length,this.state.disambiguate.padBase(this.state.tmp.disambig_settings)},e.exports=CSL,CSL.NameOutput.prototype.disambigNames=function(){for(var t,e=0,i=this.variables.length;i>e;e+=1){var s=this.variables[e];if(t=this.nameset_base+e,this.freeters[s].length&&this._runDisambigNames(this.freeters[s],t),this.institutions[s].length){"undefined"==typeof this.state.tmp.disambig_settings.givens[t]&&(this.state.tmp.disambig_settings.givens[t]=[]);for(var r=0,n=this.institutions[s].length;n>r;r+=1)"undefined"==typeof this.state.tmp.disambig_settings.givens[t][r]&&this.state.tmp.disambig_settings.givens[t].push(2)}for(var r=0,n=this.persons[s].length;n>r;r+=1)this.persons[s][r].length&&this._runDisambigNames(this.persons[s][r],t)}},CSL.NameOutput.prototype._runDisambigNames=function(t,e){var i,s,r,n,a,o,l;for(a=0,o=t.length;o>a;a+=1)if(t[a].given||t[a].family){if(r=this.state.inheritOpt(this.name,"initialize-with"),this.state.registry.namereg.addname(""+this.Item.id,t[a],a),i=this.state.tmp.disambig_settings.givens[e],"undefined"==typeof i)for(var u=0,p=e+1;p>u;u+=1)this.state.tmp.disambig_settings.givens[u]||(this.state.tmp.disambig_settings.givens[u]=[]);if(i=this.state.tmp.disambig_settings.givens[e][a],"undefined"==typeof i&&(s=this.state.inheritOpt(this.name,"form","name-form"),n=this.state.registry.namereg.evalname(""+this.Item.id,t[a],a,0,s,r),this.state.tmp.disambig_settings.givens[e].push(n)),s=this.state.inheritOpt(this.name,"form","name-form"),l=this.state.registry.namereg.evalname(""+this.Item.id,t[a],a,0,s,r),this.state.tmp.disambig_request){var h=this.state.tmp.disambig_settings.givens[e][a];1!==h||"by-cite"!==this.state.citation.opt["givenname-disambiguation-rule"]||"undefined"!=typeof this.state.inheritOpt(this.name,"initialize-with")&&"undefined"!=typeof t[a].given||(h=2),n=h,this.state.opt["disambiguate-add-givenname"]&&t[a].given&&(n=this.state.registry.namereg.evalname(""+this.Item.id,t[a],a,n,this.state.inheritOpt(this.name,"form","name-form"),this.state.inheritOpt(this.name,"initialize-with")))}else n=l;!this.state.tmp.just_looking&&this.item&&this.item.position===CSL.POSITION_FIRST&&l>n&&(n=l),this.state.tmp.sort_key_flag||(this.state.tmp.disambig_settings.givens[e][a]=n,"string"!=typeof r||"undefined"!=typeof this.name.strings.initialize&&!0!==this.name.strings.initialize||(this.state.tmp.disambig_settings.use_initials=!0))}},e.exports=CSL,CSL.NameOutput.prototype.getEtAlConfig=function(){var t=this.item;this["et-al"]={},this.state.output.append(this.etal_term,this.etal_style,!0),this["et-al"].single=this.state.output.pop(),this["et-al"].single.strings.suffix=this.etal_suffix,this["et-al"].single.strings.prefix=this.etal_prefix_single,this.state.output.append(this.etal_term,this.etal_style,!0),this["et-al"].multiple=this.state.output.pop(),this["et-al"].multiple.strings.suffix=this.etal_suffix,this["et-al"].multiple.strings.prefix=this.etal_prefix_multiple,"undefined"==typeof t&&(t={}),t.position?(this.etal_min=this.state.inheritOpt(this.name,"et-al-subsequent-min")?this.state.inheritOpt(this.name,"et-al-subsequent-min"):this.state.inheritOpt(this.name,"et-al-min"),this.etal_use_first=this.state.inheritOpt(this.name,"et-al-subsequent-use-first")?this.state.inheritOpt(this.name,"et-al-subsequent-use-first"):this.state.inheritOpt(this.name,"et-al-use-first")):(this.etal_min=this.state.tmp["et-al-min"]?this.state.tmp["et-al-min"]:this.state.inheritOpt(this.name,"et-al-min"),this.etal_use_first=this.state.tmp["et-al-use-first"]?this.state.tmp["et-al-use-first"]:this.state.inheritOpt(this.name,"et-al-use-first"),this.etal_use_last="boolean"==typeof this.state.tmp["et-al-use-last"]?this.state.tmp["et-al-use-last"]:this.state.inheritOpt(this.name,"et-al-use-last")),this.state.tmp["et-al-min"]||(this.state.tmp["et-al-min"]=this.etal_min)},e.exports=CSL,CSL.NameOutput.prototype.setEtAlParameters=function(){var t,e,i,s;for(t=0,e=this.variables.length;e>t;t+=1){var r=this.variables[t];for("undefined"==typeof this.etal_spec[r]&&(this.etal_spec[r]={freeters:0,institutions:0,persons:[]}),this.etal_spec[this.nameset_base+t]=this.etal_spec[r],this.freeters[r].length&&this._setEtAlParameter("freeters",r),i=0,s=this.persons[r].length;s>i;i+=1)"undefined"==typeof this.etal_spec[r][i]&&(this.etal_spec[r].persons[i]=0),this._setEtAlParameter("persons",r,i);this.institutions[r].length&&this._setEtAlParameter("institutions",r)}},CSL.NameOutput.prototype._setEtAlParameter=function(t,e,i){var s,r;"persons"===t?(s=this.persons[e][i],r=this.persons_count[e][i]):(s=this[t][e],r=this[t+"_count"][e]),s.length<r&&!this.state.tmp.sort_key_flag?this.etal_use_last?"persons"===t?this.etal_spec[e].persons[i]=2:this.etal_spec[e][t]=2:"persons"===t?this.etal_spec[e].persons[i]=1:this.etal_spec[e][t]=1:"persons"===t?this.etal_spec[e].persons[i]=0:this.etal_spec[e][t]=0},e.exports=CSL,CSL.NameOutput.prototype.renderAllNames=function(){for(var t,e=0,i=this.variables.length;i>e;e+=1){var s=this.variables[e];(this.freeters[s].length||this.institutions[s].length)&&(this.state.tmp.group_context.tip.condition||(this.state.tmp.just_did_number=!1)),t=this.nameset_base+e,this.freeters[s].length&&(this.freeters[s]=this._renderNames(s,this.freeters[s],t));for(var r=0,n=this.institutions[s].length;n>r;r+=1)this.persons[s][r]=this._renderNames(s,this.persons[s][r],t,r)}this.renderInstitutionNames()},CSL.NameOutput.prototype.renderInstitutionNames=function(){for(var t=0,e=this.variables.length;e>t;t+=1)for(var i=this.variables[t],s=0,r=this.institutions[i].length;r>s;s+=1){var n,s,r,a,o=this.institutions[i][s];a=this.state.tmp.extension?["sort"]:o.isInstitution||o.literal?this.state.opt["cite-lang-prefs"].institutions:this.state.opt["cite-lang-prefs"].persons;var l={primary:"locale-orig",secondary:!1,tertiary:!1};if(a)for(var u=["primary","secondary","tertiary"],p=0,h=u.length;h>p&&!(a.length-1<p);p+=1)a[p]&&(l[u[p]]="locale-"+a[p]);else l.primary="locale-translat";"bibliography"===this.state.tmp.area||"citation"===this.state.tmp.area&&"note"===this.state.opt.xclass&&this.item&&!this.item.position||(l.secondary=!1,l.tertiary=!1);this.setRenderedName(o);var n=this._renderInstitutionName(i,o,l,s);this.institutions[i][s]=n}},CSL.NameOutput.prototype._renderInstitutionName=function(t,e,i,s){var r,n,a,o,l,u,p,h=this.getName(e,i.primary,!0),c=h.name,f=h.usedOrig;if(c&&(c=this.fixupInstitution(c,t,s)),r=!1,i.secondary){h=this.getName(e,i.secondary,!1,f);var r=h.name;f=h.usedOrig,r&&(r=this.fixupInstitution(r,t,s))}n=!1,i.tertiary&&(h=this.getName(e,i.tertiary,!1,f),n=h.name,n&&(n=this.fixupInstitution(n,t,s)));var m={l:{pri:!1,sec:!1,ter:!1},s:{pri:!1,sec:!1,ter:!1}};switch(c&&(m.l.pri=c["long"],m.s.pri=c["short"].length?c["short"]:c["long"]),r&&(m.l.sec=r["long"],m.s.sec=r["short"].length?r["short"]:r["long"]),n&&(m.l.ter=n["long"],m.s.ter=n["short"].length?n["short"]:n["long"]),this.institution.strings["institution-parts"]){case"short":c["short"].length?(o=this._getShortStyle(),l=[this._composeOneInstitutionPart([m.s.pri,m.s.sec,m.s.ter],i,o,t)]):(a=this._getLongStyle(c,t,s),l=[this._composeOneInstitutionPart([m.l.pri,m.l.sec,m.l.ter],i,a,t)]);break;case"short-long":a=this._getLongStyle(c,t,s),o=this._getShortStyle(),u=this._renderOneInstitutionPart(c["short"],o),p=this._composeOneInstitutionPart([m.l.pri,m.l.sec,m.l.ter],i,a,t),l=[u,p];break;case"long-short":a=this._getLongStyle(c,t,s),o=this._getShortStyle(),u=this._renderOneInstitutionPart(c["short"],o),p=this._composeOneInstitutionPart([m.l.pri,m.l.sec,m.l.ter],i,a,t),l=[p,u];break;default:a=this._getLongStyle(c,t,s),l=[this._composeOneInstitutionPart([m.l.pri,m.l.sec,m.l.ter],i,a,t)]}var d=this._join(l," ");return this.state.tmp.name_node.children.push(d),d},CSL.NameOutput.prototype._composeOneInstitutionPart=function(t,e,i){var s,r,n,a=!1,o=!1,l=!1;if(t[0]){if(s=CSL.Util.cloneToken(i),this.state.opt.citeAffixes[e.primary]&&"<i>"===this.state.opt.citeAffixes.institutions[e.primary].prefix){for(var u=!1,p=0,h=s.decorations.length;h>p;p+=1)"@font-style"===i.decorations[p][0]&&"italic"===s.decorations[p][1]&&(u=!0);u||s.decorations.push(["@font-style","italic"])}a=this._renderOneInstitutionPart(t[0],s)}t[1]&&(o=this._renderOneInstitutionPart(t[1],i)),t[2]&&(l=this._renderOneInstitutionPart(t[2],i));var c;if(o||l){this.state.output.openLevel("empty"),this.state.output.append(a),r=CSL.Util.cloneToken(i),e.secondary&&(r.strings.prefix=this.state.opt.citeAffixes.institutions[e.secondary].prefix,r.strings.suffix=this.state.opt.citeAffixes.institutions[e.secondary].suffix,r.strings.prefix||(r.strings.prefix=" "));var f=new CSL.Token;f.decorations.push(["@font-style","normal"]),f.decorations.push(["@font-weight","normal"]),this.state.output.openLevel(f),this.state.output.append(o,r),this.state.output.closeLevel(),n=CSL.Util.cloneToken(i),e.tertiary&&(n.strings.prefix=this.state.opt.citeAffixes.institutions[e.tertiary].prefix,n.strings.suffix=this.state.opt.citeAffixes.institutions[e.tertiary].suffix,n.strings.prefix||(n.strings.prefix=" "));var m=new CSL.Token;m.decorations.push(["@font-style","normal"]),m.decorations.push(["@font-weight","normal"]),this.state.output.openLevel(m),this.state.output.append(l,n),this.state.output.closeLevel(),this.state.output.closeLevel(),c=this.state.output.pop()}else c=a;return c},CSL.NameOutput.prototype._renderOneInstitutionPart=function(t,e){for(var i=0,s=t.length;s>i;i+=1)if(t[i]){var r=t[i];if(this.state.tmp.strip_periods)r=r.replace(/\./g,"");else for(var n=0,a=e.decorations.length;a>n;n+=1)if("@strip-periods"===e.decorations[n][0]&&"true"===e.decorations[n][1]){r=r.replace(/\./g,"");break}this.state.tmp.group_context.tip.variable_success=!0,this.state.tmp.can_substitute.replace(!1,CSL.LITERAL),"!here>>>"===r?t[i]=!1:(this.state.output.append(r,e,!0),t[i]=this.state.output.pop())}return"undefined"==typeof this.institution.strings["part-separator"]&&(this.institution.strings["part-separator"]=this.state.tmp.name_delimiter),this._join(t,this.institution.strings["part-separator"])},CSL.NameOutput.prototype._renderNames=function(t,e,i,s){var r=!1;if(e.length){for(var n=[],a=0,o=e.length;o>a;a+=1){var r,l,u=e[a];l=this.state.tmp.extension?["sort"]:u.isInstitution||u.literal?this.state.opt["cite-lang-prefs"].institutions:this.state.opt["cite-lang-prefs"].persons;var p={primary:"locale-orig",secondary:!1,tertiary:!1};if(l)for(var h=["primary","secondary","tertiary"],c=0,f=h.length;f>c&&!(l.length-1<c);c+=1)p[h[c]]="locale-"+l[c];else p.primary="locale-translat";if((this.state.tmp.sort_key_flag||"bibliography"!==this.state.tmp.area&&("citation"!==this.state.tmp.area||"note"!==this.state.opt.xclass||!this.item||this.item.position))&&(p.secondary=!1,p.tertiary=!1),this.setRenderedName(u),u.literal||u.isInstitution)n.push(this._renderInstitutionName(t,u,p,s));else{var m=this._renderPersonalName(t,u,p,i,a,s),d=CSL.Util.cloneToken(this.name);this.state.output.append(m,d,!0),n.push(this.state.output.pop())}}r=this.joinPersons(n,i,s)}return r},CSL.NameOutput.prototype._renderPersonalName=function(t,e,i,s,r,n){var a=this.getName(e,i.primary,!0),o=this._renderOnePersonalName(a.name,s,r,n),l=!1;i.secondary&&(a=this.getName(e,i.secondary,!1,a.usedOrig),a.name&&(l=this._renderOnePersonalName(a.name,s,r,n)));var u=!1;i.tertiary&&(a=this.getName(e,i.tertiary,!1,a.usedOrig),a.name&&(u=this._renderOnePersonalName(a.name,s,r,n)));var p;if(l||u){this.state.output.openLevel("empty"),this.state.output.append(o);var h=new CSL.Token;i.secondary&&(h.strings.prefix=this.state.opt.citeAffixes.persons[i.secondary].prefix,h.strings.suffix=this.state.opt.citeAffixes.persons[i.secondary].suffix,h.strings.prefix||(h.strings.prefix=" ")),this.state.output.append(l,h);var c=new CSL.Token;i.tertiary&&(c.strings.prefix=this.state.opt.citeAffixes.persons[i.tertiary].prefix,c.strings.suffix=this.state.opt.citeAffixes.persons[i.tertiary].suffix,c.strings.prefix||(c.strings.prefix=" ")),this.state.output.append(u,c),this.state.output.closeLevel(),p=this.state.output.pop()}else p=o;return p},CSL.NameOutput.prototype._isRomanesque=function(t){var e=2;if(t.family.replace(/\"/g,"").match(CSL.ROMANESQUE_REGEXP)||(e=0),!e&&t.given&&t.given.match(CSL.STARTSWITH_ROMANESQUE_REGEXP)&&(e=1),2==e){if(t.multi&&t.multi.main)var i=t.multi.main.slice(0,2);else this.Item.language&&(i=this.Item.language.slice(0,2));["ja","zh"].indexOf(i)>-1&&(e=1)}return e},CSL.NameOutput.prototype._renderOnePersonalName=function(t,e,i,s){function r(t){return t?"string"==typeof t.blobs?["’","'","-"," "].indexOf(t.blobs.slice(-1))>-1?!0:!1:r(t.blobs[t.blobs.length-1]):!1}var n=t,a=this._droppingParticle(n,e,s),o=this._familyName(n),l=this._nonDroppingParticle(n),u=this._givenName(n,e,i),p=this._nameSuffix(n);this._isShort(e,i)&&!n["full-form-always"]&&(a=!1,u=!1,p=!1);var h=this.state.inheritOpt(this.name,"sort-separator");h||(h="");var c;c=n["comma-suffix"]?", ":" ";var f,m,d,g,b=this._isRomanesque(n),_=r(l);if(0===b)f=this._join([l,o,u],"");else if(1===b||n["static-ordering"])f=this._join([l,o,u]," ");else if(n["reverse-ordering"])f=this._join([u,l,o]," ");else if(this.state.tmp.sort_key_flag)"never"===this.state.opt["demote-non-dropping-particle"]?(d=this._join([l,o,a]," "),m=this._join([d,u],this.state.opt.sort_sep),f=this._join([m,p]," ")):(g=this._join([u,a,l]," "),m=this._join([o,g],this.state.opt.sort_sep),f=this._join([m,p]," "));else if("all"===this.state.inheritOpt(this.name,"name-as-sort-order")||"first"===this.state.inheritOpt(this.name,"name-as-sort-order")&&0===i&&(0===s||"undefined"==typeof s))["Lord","Lady"].indexOf(n.given)>-1&&(h=", "),["always","display-and-sort"].indexOf(this.state.opt["demote-non-dropping-particle"])>-1?(g=this._join([u,a],n["comma-dropping-particle"]+" "),g=this._join([g,l]," "),g&&this.given&&(g.strings.prefix=this.given.strings.prefix,g.strings.suffix=this.given.strings.suffix),o&&this.family&&(o.strings.prefix=this.family.strings.prefix,o.strings.suffix=this.family.strings.suffix),m=this._join([o,g],h),f=this._join([m,p],h)):(d=_?this._join([l,o],""):this._join([l,o]," "),d&&this.family&&(d.strings.prefix=this.family.strings.prefix,d.strings.suffix=this.family.strings.suffix),g=this._join([u,a],n["comma-dropping-particle"]+" "),g&&this.given&&(g.strings.prefix=this.given.strings.prefix,g.strings.suffix=this.given.strings.suffix),m=this._join([d,g],h),f=this._join([m,p],h));else{n["dropping-particle"]&&n.family&&!n["non-dropping-particle"]&&["'","ʼ","’","-"].indexOf(n["dropping-particle"].slice(-1))>-1&&(o=this._join([a,o],""),a=!1),!this.state.tmp.term_predecessor;var v=" ";this.state.inheritOpt(this.name,"initialize-with")&&this.state.inheritOpt(this.name,"initialize-with").match(/[\u00a0\ufeff]/)&&["fr","ru","cs"].indexOf(this.state.opt["default-locale"][0].slice(0,2))>-1&&(v=" "),_?(g=this._join([l,o],""),g=this._join([a,g],v)):g=this._join([a,l,o],v),g=this._join([g,p],c),g&&this.family&&(g.strings.prefix=this.family.strings.prefix,g.strings.suffix=this.family.strings.suffix),u&&this.given&&(u.strings.prefix=this.given.strings.prefix,u.strings.suffix=this.given.strings.suffix),g.strings.prefix&&(n["comma-dropping-particle"]=""),f=this._join([u,g],n["comma-dropping-particle"]+v)}return this.state.tmp.group_context.tip.variable_success=!0,this.state.tmp.can_substitute.replace(!1,CSL.LITERAL),this.state.tmp.term_predecessor=!0,this.state.tmp.name_node.children.push(f),f},CSL.NameOutput.prototype._isShort=function(t,e){return 0===this.state.tmp.disambig_settings.givens[t][e]?!0:!1},CSL.NameOutput.prototype._normalizeNameInput=function(t){var e={literal:t.literal,family:t.family,isInstitution:t.isInstitution,given:t.given,suffix:t.suffix,"comma-suffix":t["comma-suffix"],"non-dropping-particle":t["non-dropping-particle"],"dropping-particle":t["dropping-particle"],"static-ordering":t["static-ordering"],"static-particles":t["static-particles"],"reverse-ordering":t["reverse-ordering"],
+"full-form-always":t["full-form-always"],"parse-names":t["parse-names"],"comma-dropping-particle":"",block_initialize:t.block_initialize,multi:t.multi};return this._parseName(e),e},CSL.NameOutput.prototype._stripPeriods=function(t,e){var i=this[t+"_decor"];if(e)if(this.state.tmp.strip_periods)e=e.replace(/\./g,"");else if(i)for(var s=0,r=i.decorations.length;r>s;s+=1)if("@strip-periods"===i.decorations[s][0]&&"true"===i.decorations[s][1]){e=e.replace(/\./g,"");break}return e},CSL.NameOutput.prototype._nonDroppingParticle=function(t){var e=t["non-dropping-particle"];e&&this.state.tmp.sort_key_flag&&(e=e.replace(/[\'\u2019]/,""));var i=this._stripPeriods("family",e);return this.state.output.append(i,this.family_decor,!0)?this.state.output.pop():!1},CSL.NameOutput.prototype._droppingParticle=function(t,e,i){var s=t["dropping-particle"];s&&this.state.tmp.sort_key_flag&&(s=s.replace(/[\'\u2019]/,""));var r=this._stripPeriods("given",s);if(t["dropping-particle"]&&t["dropping-particle"].match(/^et.?al[^a-z]$/))this.state.inheritOpt(this.name,"et-al-use-last")?"undefined"==typeof i?this.etal_spec[e].freeters=2:this.etal_spec[e].persons=2:"undefined"==typeof i?this.etal_spec[e].freeters=1:this.etal_spec[e].persons=1,t["comma-dropping-particle"]="";else if(this.state.output.append(r,this.given_decor,!0))return this.state.output.pop();return!1},CSL.NameOutput.prototype._familyName=function(t){var e=this._stripPeriods("family",t.family);return this.state.output.append(e,this.family_decor,!0)?this.state.output.pop():!1},CSL.NameOutput.prototype._givenName=function(t,e,i){var s;if(this.state.inheritOpt(this.name,"initialize")===!1)t.family&&t.given&&this.state.inheritOpt(this.name,"initialize")===!1&&(t.given=CSL.Util.Names.initializeWith(this.state,t.given,this.state.inheritOpt(this.name,"initialize-with"),!0)),t.given=CSL.Util.Names.unInitialize(this.state,t.given);else if(t.family&&1===this.state.tmp.disambig_settings.givens[e][i]&&!t.block_initialize){var r=this.state.inheritOpt(this.name,"initialize-with");t.given=CSL.Util.Names.initializeWith(this.state,t.given,r)}else t.given=CSL.Util.Names.unInitialize(this.state,t.given);var n=this._stripPeriods("given",t.given),a=this.state.output.append(n,this.given_decor,!0);return a?s=this.state.output.pop():!1},CSL.NameOutput.prototype._nameSuffix=function(t){var e,i=t.suffix;"string"==typeof this.state.inheritOpt(this.name,"initialize-with")&&(i=CSL.Util.Names.initializeWith(this.state,t.suffix,this.state.inheritOpt(this.name,"initialize-with"),!0)),i=this._stripPeriods("family",i);var s="";i&&"."===i.slice(-1)&&(i=i.slice(0,-1),s=".");var r=this.state.output.append(i,"empty",!0);return r?(e=this.state.output.pop(),e.strings.suffix=s+e.strings.suffix,e):!1},CSL.NameOutput.prototype._getLongStyle=function(t){var e;return e=t["short"].length&&this.institutionpart["long-with-short"]?this.institutionpart["long-with-short"]:this.institutionpart["long"],e||(e=new CSL.Token),e},CSL.NameOutput.prototype._getShortStyle=function(){var t;return t=this.institutionpart["short"]?this.institutionpart["short"]:new CSL.Token},CSL.NameOutput.prototype._parseName=function(t){if(!t["parse-names"]&&"undefined"!=typeof t["parse-names"])return t;t.family&&!t.given&&t.isInstitution&&(t.literal=t.family,t.family=void 0,t.isInstitution=void 0);var e;t.family&&'"'===t.family.slice(0,1)&&'"'===t.family.slice(-1)||!t["parse-names"]&&"undefined"!=typeof t["parse-names"]?(t.family=t.family.slice(1,-1),e=!0,t["parse-names"]=0):e=!1,this.state.opt.development_extensions.parse_names&&!t["non-dropping-particle"]&&t.family&&!e&&t.given&&(t["static-particles"]||CSL.parseParticles(t,!0))},CSL.NameOutput.prototype.getName=function(t,e,i,s){if(s&&"locale-orig"===e)return{name:!1,usedOrig:s};t.family||(t.family=""),t.given||(t.given="");var r={};r["static-ordering"]=this.getStaticOrder(t);var n=!0;if("locale-orig"!==e&&(n=!1,t.multi))for(var a=this.state.opt[e],o=0,l=a.length;l>o;o+=1)if(p=a[o],t.multi._key[p]){n=!0;var u=t.isInstitution;t=t.multi._key[p],t.isInstitution=u,r=this.getNameParams(p),r.transliterated=!0;break}if(!n){var p=!1;t.multi&&t.multi.main?p=t.multi.main:this.Item.language&&(p=this.Item.language),p&&(r=this.getNameParams(p))}if(!i&&!n)return{name:!1,usedOrig:s};t.family||(t.family=""),t.given||(t.given=""),t={family:t.family,given:t.given,"non-dropping-particle":t["non-dropping-particle"],"dropping-particle":t["dropping-particle"],suffix:t.suffix,"static-ordering":r["static-ordering"],"static-particles":t["static-particles"],"reverse-ordering":r["reverse-ordering"],"full-form-always":r["full-form-always"],"parse-names":t["parse-names"],"comma-suffix":t["comma-suffix"],"comma-dropping-particle":t["comma-dropping-particle"],transliterated:r.transliterated,block_initialize:r["block-initialize"],literal:t.literal,isInstitution:t.isInstitution,multi:t.multi},!t.literal&&!t.given&&t.family&&t.isInstitution&&(t.literal=t.family),t.literal&&(delete t.family,delete t.given),t=this._normalizeNameInput(t);var h;return h=s?s:!n,{name:t,usedOrig:h}},CSL.NameOutput.prototype.getNameParams=function(t){var e={},i=CSL.localeResolve(this.Item.language,this.state.opt["default-locale"][0]),s=this.state.locale[i.best]?i.best:this.state.opt["default-locale"][0],r=this.state.locale[s].opts["name-as-sort-order"],n=this.state.locale[s].opts["name-as-reverse-order"],a=this.state.locale[s].opts["name-never-short"],o=t.split("-")[0];return r&&r[o]&&(e["static-ordering"]=!0,e["reverse-ordering"]=!1),n&&n[o]&&(e["reverse-ordering"]=!0,e["static-ordering"]=!1),a&&a[o]&&(e["full-form-always"]=!0),e["static-ordering"]&&(e["block-initialize"]=!0),e},CSL.NameOutput.prototype.setRenderedName=function(t){if("bibliography"===this.state.tmp.area){for(var e="",i=0,s=CSL.NAME_PARTS.length;s>i;i+=1)t[CSL.NAME_PARTS[i]]&&(e+=t[CSL.NAME_PARTS[i]]);this.state.tmp.rendered_name.push(e)}},CSL.NameOutput.prototype.fixupInstitution=function(t,e,i){this.state.sys.getHumanForm&&"legal_case"===this.Item.type&&"authority"===e&&(t.literal=this.state.sys.getHumanForm(this.Item.jurisdiction,t.literal,!0)),t=this._splitInstitution(t,e,i),this.institution.strings["reverse-order"]&&t["long"].reverse();var s=t["long"],r=t["long"].slice(),n=!1;if(this.state.sys.getAbbreviation)for(var a=this.Item.jurisdiction,o=0,l=s.length;l>o;o+=1){var u=s[o];this.state.sys.normalizeAbbrevsKey&&(u=this.state.sys.normalizeAbbrevsKey(s[o])),a=this.state.transform.loadAbbreviation(a,"institution-part",u),this.state.transform.abbrevs[a]["institution-part"][u]&&(r[o]=this.state.transform.abbrevs[a]["institution-part"][u],n=!0)}return t["short"]=n?r:[],t},CSL.NameOutput.prototype.getStaticOrder=function(t,e){var i=!1;return!e&&t["static-ordering"]?i=!0:0===this._isRomanesque(t)?i=!0:(!t.multi||!t.multi.main)&&this.Item.language&&["vi","hu"].indexOf(this.Item.language)>-1?i=!0:t.multi&&t.multi.main&&["vi","hu"].indexOf(t.multi.main.slice(0,2))>-1?i=!0:this.state.opt["auto-vietnamese-names"]&&CSL.VIETNAMESE_NAMES.exec(t.family+" "+t.given)&&CSL.VIETNAMESE_SPECIALS.exec(t.family+t.given)&&(i=!0),i},CSL.NameOutput.prototype._splitInstitution=function(t,e,i){var s={};!t.literal&&t.family&&(t.literal=t.family,delete t.family);var r=t.literal.replace(/\s*\|\s*/g,"|");if(r=r.split("|"),"short"===this.institution.strings.form&&this.state.sys.getAbbreviation)for(var n=this.Item.jurisdiction,a=r.length;a>0;a+=-1){var o=r.slice(0,a).join("|"),l=o;if(this.state.sys.normalizeAbbrevsKey&&(l=this.state.sys.normalizeAbbrevsKey(o)),n=this.state.transform.loadAbbreviation(n,"institution-entire",l),this.state.transform.abbrevs[n]["institution-entire"][l]){var u=this.state.transform.abbrevs[n]["institution-entire"][l];u=this.state.transform.quashCheck(u);var p=u.split(/>>[0-9]{4}>>/),h=u.match(/>>([0-9]{4})>>/);if(u=p.pop(),p.length>0&&this.Item["original-date"]&&this.Item["original-date"].year)for(var c=h.length-1;c>0&&!(parseInt(this.Item["original-date"].year,10)>=parseInt(h[c],10));c+=-1)u=p.pop();u=u.replace(/\s*\|\s*/g,"|"),r=[u];break}}return r.reverse(),s["long"]=this._trimInstitution(r,e,i),s},CSL.NameOutput.prototype._trimInstitution=function(t,e){var i=!1,s=!1,r=t.slice(),n=!1;return this.institution&&("undefined"!=typeof this.institution.strings["use-first"]&&(i=this.institution.strings["use-first"]),"undefined"!=typeof this.institution.strings["stop-last"]?n=this.institution.strings["stop-last"]:"authority"===e&&this.state.tmp.authority_stop_last&&(n=this.state.tmp.authority_stop_last),n&&(r=r.slice(0,n),t=t.slice(0,n)),"undefined"!=typeof this.institution.strings["use-last"]&&(s=this.institution.strings["use-last"]),"authority"===e&&(n&&(this.state.tmp.authority_stop_last=n),s&&(this.state.tmp.authority_stop_last+=-1*s))),!1===i&&(0===this.persons[e].length&&(i=this.institution.strings["substitute-use-first"]),i||(i=0)),!1===s&&(s=i?0:t.length),i>t.length-s&&(i=t.length-s),t=t.slice(0,i),r=r.slice(i),s&&(s>r.length&&(s=r.length),s&&(t=t.concat(r.slice(r.length-s)))),t},e.exports=CSL,CSL.PublisherOutput=function(t,e){this.state=t,this.group_tok=e,this.varlist=[]},CSL.PublisherOutput.prototype.render=function(){this.clearVars(),this.composeAndBlob(),this.composeElements(),this.composePublishers(),this.joinPublishers()},CSL.PublisherOutput.prototype.composeAndBlob=function(){this.and_blob={};var t=!1;"text"===this.group_tok.strings.and?t=this.state.getTerm("and"):"symbol"===this.group_tok.strings.and&&(t="&");var e=new CSL.Token;e.strings.suffix=" ",e.strings.prefix=" ",this.state.output.append(t,e,!0);var i=this.state.output.pop();e.strings.prefix=this.group_tok.strings["subgroup-delimiter"],this.state.output.append(t,e,!0);var s=this.state.output.pop();this.and_blob.single=!1,this.and_blob.multiple=!1,t&&("always"===this.group_tok.strings["subgroup-delimiter-precedes-last"]?this.and_blob.single=s:"never"===this.group_tok.strings["subgroup-delimiter-precedes-last"]?(this.and_blob.single=i,this.and_blob.multiple=i):(this.and_blob.single=i,this.and_blob.multiple=s))},CSL.PublisherOutput.prototype.composeElements=function(){for(var t=0,e=2;e>t;t+=1)for(var i=["publisher","publisher-place"][t],s=0,r=this["publisher-list"].length;r>s;s+=1){var n=this[i+"-list"][s],a=this[i+"-token"];this.state.output.append(n,a,!0),this[i+"-list"][s]=this.state.output.pop()}},CSL.PublisherOutput.prototype.composePublishers=function(){for(var t,e=0,i=this["publisher-list"].length;i>e;e+=1){t=[this[this.varlist[0]+"-list"][e],this[this.varlist[1]+"-list"][e]],this["publisher-list"][e]=this._join(t,this.group_tok.strings.delimiter)}},CSL.PublisherOutput.prototype.joinPublishers=function(){var t=this["publisher-list"],e=(this.name_delimiter,this._join(t,this.group_tok.strings["subgroup-delimiter"],this.and_blob.single,this.and_blob.multiple,this.group_tok));this.state.output.append(e,"literal")},CSL.PublisherOutput.prototype._join=CSL.NameOutput.prototype._join,CSL.PublisherOutput.prototype._getToken=CSL.NameOutput.prototype._getToken,CSL.PublisherOutput.prototype.clearVars=function(){this.state.tmp["publisher-list"]=!1,this.state.tmp["publisher-place-list"]=!1,this.state.tmp["publisher-group-token"]=!1,this.state.tmp["publisher-token"]=!1,this.state.tmp["publisher-place-token"]=!1},e.exports=CSL,CSL.evaluateLabel=function(t,e,i,s){var r;"locator"===t.strings.term?(s&&s.label&&(r="sub verbo"===s.label?"sub-verbo":s.label),r||(r="page")):r=t.strings.term;var n=t.strings.plural;if("number"!=typeof n){var a="locator"===t.strings.term?s:i;e.processNumber(!1,a,t.strings.term,i.type),n=e.tmp.shadow_numbers[t.strings.term].plural,e.tmp.shadow_numbers[t.strings.term].labelForm||e.tmp.shadow_numbers[t.strings.term].labelDecorations||(e.tmp.shadow_numbers[t.strings.term].labelForm=t.strings.form,e.tmp.shadow_numbers[t.strings.term].labelDecorations=t.decorations.slice()),["locator","number","page"].indexOf(t.strings.term)>-1&&e.tmp.shadow_numbers[t.strings.term].label&&(r=e.tmp.shadow_numbers[t.strings.term].label),t.decorations&&(e.opt.development_extensions.csl_reverse_lookup_support||e.sys.csl_reverse_lookup_support)&&(t.decorations.reverse(),t.decorations.push(["@showid","true",t.cslid]),t.decorations.reverse())}return CSL.castLabel(e,t,r,n,CSL.TOLERANT)},CSL.castLabel=function(t,e,i,s,r){var n=e.strings.form;t.tmp.group_context.tip.label_form&&"static"!==n&&(n=t.tmp.group_context.tip.label_form);var a=t.getTerm(i,n,s,!1,r,e.default_locale);if(t.tmp.strip_periods)a=a.replace(/\./g,"");else for(var o=0,l=e.decorations.length;l>o;o+=1)if("@strip-periods"===e.decorations[o][0]&&"true"===e.decorations[o][1]){a=a.replace(/\./g,"");break}return a},e.exports=CSL,CSL.Node.name={build:function(t,e){var i;if([CSL.SINGLETON,CSL.START].indexOf(this.tokentype)>-1){if("undefined"==typeof t.tmp.root){var s=void 0;t.tmp.root="citation"}else var s=t.tmp.root;t.inheritOpt(this,"et-al-subsequent-min")&&t.inheritOpt(this,"et-al-subsequent-min")!==t.inheritOpt(this,"et-al-min")&&(t.opt.update_mode=CSL.POSITION),t.inheritOpt(this,"et-al-subsequent-use-first")&&t.inheritOpt(this,"et-al-subsequent-use-first")!==t.inheritOpt(this,"et-al-use-first")&&(t.opt.update_mode=CSL.POSITION),t.tmp.root=s,i=function(t){t.tmp.etal_term="et-al",t.tmp.name_delimiter=t.inheritOpt(this,"delimiter","name-delimiter",", "),t.tmp["delimiter-precedes-et-al"]=t.inheritOpt(this,"delimiter-precedes-et-al"),"text"===t.inheritOpt(this,"and")?this.and_term=t.getTerm("and","long",0):"symbol"===t.inheritOpt(this,"and")&&(this.and_term=t.opt.development_extensions.expect_and_symbol_form?t.getTerm("and","symbol",0):"&"),t.tmp.and_term=this.and_term,CSL.STARTSWITH_ROMANESQUE_REGEXP.test(this.and_term)?(this.and_prefix_single=" ",this.and_prefix_multiple=", ","string"==typeof t.tmp.name_delimiter&&(this.and_prefix_multiple=t.tmp.name_delimiter),this.and_suffix=" "):(this.and_prefix_single="",this.and_prefix_multiple="",this.and_suffix=""),"always"===t.inheritOpt(this,"delimiter-precedes-last")?this.and_prefix_single=t.tmp.name_delimiter:"never"===t.inheritOpt(this,"delimiter-precedes-last")?this.and_prefix_multiple&&(this.and_prefix_multiple=" "):"after-inverted-name"===t.inheritOpt(this,"delimiter-precedes-last")&&(this.and_prefix_single&&(this.and_prefix_single=t.tmp.name_delimiter),this.and_prefix_multiple&&(this.and_prefix_multiple=" ")),this.and={},t.inheritOpt(this,"and")?(t.output.append(this.and_term,"empty",!0),this.and.single=t.output.pop(),this.and.single.strings.prefix=this.and_prefix_single,this.and.single.strings.suffix=this.and_suffix,t.output.append(this.and_term,"empty",!0),this.and.multiple=t.output.pop(),this.and.multiple.strings.prefix=this.and_prefix_multiple,this.and.multiple.strings.suffix=this.and_suffix):t.tmp.name_delimiter&&(this.and.single=new CSL.Blob(t.tmp.name_delimiter),this.and.single.strings.prefix="",this.and.single.strings.suffix="",this.and.multiple=new CSL.Blob(t.tmp.name_delimiter),this.and.multiple.strings.prefix="",this.and.multiple.strings.suffix=""),this.ellipsis={},t.inheritOpt(this,"et-al-use-last")&&(this.ellipsis_term="…",this.ellipsis_prefix_single=" ",this.ellipsis_prefix_multiple=t.inheritOpt(this,"delimiter","name-delimiter",", "),this.ellipsis_suffix=" ",this.ellipsis.single=new CSL.Blob(this.ellipsis_term),this.ellipsis.single.strings.prefix=this.ellipsis_prefix_single,this.ellipsis.single.strings.suffix=this.ellipsis_suffix,this.ellipsis.multiple=new CSL.Blob(this.ellipsis_term),this.ellipsis.multiple.strings.prefix=this.ellipsis_prefix_multiple,this.ellipsis.multiple.strings.suffix=this.ellipsis_suffix),"undefined"==typeof t.tmp["et-al-min"]&&(t.tmp["et-al-min"]=t.inheritOpt(this,"et-al-min")),"undefined"==typeof t.tmp["et-al-use-first"]&&(t.tmp["et-al-use-first"]=t.inheritOpt(this,"et-al-use-first")),"undefined"==typeof t.tmp["et-al-use-last"]&&(t.tmp["et-al-use-last"]=t.inheritOpt(this,"et-al-use-last")),t.nameOutput.name=this},t.build.name_flag=!0,this.execs.push(i)}e.push(this)}},e.exports=CSL,CSL.Node["name-part"]={build:function(t){t.build[this.strings.name]=this}},e.exports=CSL,CSL.Node.names={build:function(t,e){var i;if((this.tokentype===CSL.START||this.tokentype===CSL.SINGLETON)&&(CSL.Util.substituteStart.call(this,t,e),t.build.substitute_level.push(1)),this.tokentype===CSL.SINGLETON&&(t.build.names_variables.push(this.variables),i=function(t){var e=t.nameOutput.labelVariable;t.nameOutput.reinit(this,e)},this.execs.push(i)),this.tokentype===CSL.START&&(t.build.names_flag=!0,t.build.names_level+=1,1===t.build.names_level&&(t.build.names_variables=[],t.build.name_label={}),t.build.names_variables.push(this.variables),i=function(t){t.tmp.can_substitute.push(!0),t.parallel.StartVariable("names",this.variables[0]),t.nameOutput.init(this)},this.execs.push(i)),this.tokentype===CSL.END){for(var s=0,r=3;r>s;s+=1){var n=["family","given","et-al"][s];this[n]=t.build[n],1===t.build.names_level&&(t.build[n]=void 0)}this.label=t.build.name_label,1===t.build.names_level&&(t.build.name_label={}),t.build.names_level+=-1,t.build.names_variables.pop(),i=function(t){this.etal_style=t.tmp.etal_node?t.tmp.etal_node:"empty",this.etal_term=t.getTerm(t.tmp.etal_term,"long",0),CSL.STARTSWITH_ROMANESQUE_REGEXP.test(this.etal_term)?(this.etal_prefix_single=" ",this.etal_prefix_multiple=t.tmp.name_delimiter,"always"===t.tmp["delimiter-precedes-et-al"]?this.etal_prefix_single=t.tmp.name_delimiter:"never"===t.tmp["delimiter-precedes-et-al"]?this.etal_prefix_multiple=" ":"after-inverted-name"===t.tmp["delimiter-precedes-et-al"]&&(this.etal_prefix_single=t.tmp.name_delimiter,this.etal_prefix_multiple=" "),this.etal_suffix=""):(this.etal_prefix_single="",this.etal_prefix_multiple="",this.etal_suffix="");for(var e=0,i=3;i>e;e+=1){var s=["family","given"][e];t.nameOutput[s]=this[s]}t.nameOutput["with"]=this["with"];var r="with",n="",a="";CSL.STARTSWITH_ROMANESQUE_REGEXP.test(r)&&(n=" ",a=" ");var o={};o.single=new CSL.Blob(r),o.single.strings.suffix=a,o.multiple=new CSL.Blob(r),o.multiple.strings.suffix=a,"always"===t.inheritOpt(t.nameOutput.name,"delimiter-precedes-last")?(o.single.strings.prefix=t.inheritOpt(this,"delimiter","names-delimiter"),o.multiple.strings.prefix=t.inheritOpt(this,"delimiter","names-delimiter")):"contextual"===t.inheritOpt(t.nameOutput.name,"delimiter-precedes-last")?(o.single.strings.prefix=n,o.multiple.strings.prefix=t.inheritOpt(this,"delimiter","names-delimiter")):"after-inverted-name"===t.inheritOpt(t.nameOutput.name,"delimiter-precedes-last")?(o.single.strings.prefix=t.inheritOpt(this,"delimiter","names-delimiter"),o.multiple.strings.prefix=n):(o.single.strings.prefix=n,o.multiple.strings.prefix=n),t.nameOutput["with"]=o,t.nameOutput.label=this.label,t.nameOutput.etal_style=this.etal_style,t.nameOutput.etal_term=this.etal_term,t.nameOutput.etal_prefix_single=this.etal_prefix_single,t.nameOutput.etal_prefix_multiple=this.etal_prefix_multiple,t.nameOutput.etal_suffix=this.etal_suffix,t.nameOutput.outputNames(),t.tmp["et-al-use-first"]=void 0,t.tmp["et-al-min"]=void 0,t.tmp["et-al-use-last"]=void 0},this.execs.push(i),i=function(t){t.tmp.can_substitute.pop()||t.tmp.can_substitute.replace(!1,CSL.LITERAL),t.parallel.CloseVariable("names"),1===t.tmp.can_substitute.mystack.length&&(t.tmp.can_block_substitute=!1)},this.execs.push(i),t.build.name_flag=!1}e.push(this),(this.tokentype===CSL.END||this.tokentype===CSL.SINGLETON)&&(t.build.substitute_level.pop(),CSL.Util.substituteEnd.call(this,t,e))}},e.exports=CSL,CSL.Node.number={build:function(t,e){var i;CSL.Util.substituteStart.call(this,t,e),"roman"===this.strings.form?this.formatter=t.fun.romanizer:"ordinal"===this.strings.form?this.formatter=t.fun.ordinalizer:"long-ordinal"===this.strings.form&&(this.formatter=t.fun.long_ordinalizer),"undefined"==typeof this.successor_prefix&&(this.successor_prefix=t[t.build.area].opt.layout_delimiter),"undefined"==typeof this.splice_prefix&&(this.splice_prefix=t[t.build.area].opt.layout_delimiter),i=function(t,e,i){if(0!==this.variables.length){if("undefined"==typeof i)var i={};var s;if(s=this.variables[0],"locator"!==s||!t.tmp.just_looking){t.parallel.StartVariable(this.variables[0]),t.parallel.AppendToVariable("locator"===this.variables[0]?e.section:e[this.variables[0]]);{new RegExp("(?:&|, | and |"+t.getTerm("page-range-delimiter")+")")}"collection-number"===s&&"legal_case"===e.type&&(t.tmp.renders_collection_number=!0);var r=(e[this.variables[0]],"long");this.strings.label_form_override&&(r=this.strings.label_form_override);var n=this;if(t.tmp.group_context.tip.force_suppress)return!1;"locator"===s?t.processNumber(n,i,s,e.type):(!t.tmp.group_context.tip.condition&&e[s]&&(t.tmp.just_did_number=!0),t.processNumber(n,e,s,e.type)),CSL.Util.outputNumericField(t,s,e.id),t.parallel.CloseVariable("number"),["locator","locator-extra"].indexOf(this.variables_real[0])>-1&&!t.tmp.just_looking&&(t.tmp.done_vars.push(this.variables_real[0]),t.tmp.group_context.tip.done_vars.push(this.variables_real[0]))}}},this.execs.push(i),e.push(this),CSL.Util.substituteEnd.call(this,t,e)}},e.exports=CSL,CSL.Node.sort={build:function(t,e){if(e=t[t.build.root+"_sort"].tokens,this.tokentype===CSL.START){"citation"===t.build.area&&(t.parallel.use_parallels=!1,t.opt.sort_citations=!0),t.build.area=t.build.root+"_sort",t.build.extension="_sort";var i=function(t,e){if(t.opt.has_layout_locale){for(var i,s=CSL.localeResolve(e.language,t.opt["default-locale"][0]),r=t[t.tmp.area.slice(0,-5)].opt.sort_locales,n=0,a=r.length;a>n&&(i=r[n][s.bare],i||(i=r[n][s.best]),!i);n+=1);i||(i=t.opt["default-locale"][0]),t.tmp.lang_sort_hold=t.opt.lang,t.opt.lang=i}};this.execs.push(i)}if(this.tokentype===CSL.END){t.build.area=t.build.root,t.build.extension="";var i=function(t){t.opt.has_layout_locale&&(t.opt.lang=t.tmp.lang_sort_hold,delete t.tmp.lang_sort_hold)};this.execs.push(i)}e.push(this)}},e.exports=CSL,CSL.Node.substitute={build:function(t,e){var i;this.tokentype===CSL.START&&(i=function(t){t.tmp.can_block_substitute=!0,t.tmp.value.length&&t.tmp.can_substitute.replace(!1,CSL.LITERAL)},this.execs.push(i)),e.push(this)}},e.exports=CSL,CSL.Node.text={build:function(t,e){var i,s,r,n,a,o,l,u,p,h,c,f,m;if(this.postponed_macro){var d=CSL.Util.cloneToken(this);d.name="group",d.tokentype=CSL.START,CSL.Node.group.build.call(d,t,e),CSL.expandMacro.call(t,this,e);var g=CSL.Util.cloneToken(this);g.name="group",g.tokentype=CSL.END,"juris-locator-label"===this.postponed_macro&&(g.isJurisLocatorLabel=!0),CSL.Node.group.build.call(g,t,e)}else{if(CSL.Util.substituteStart.call(this,t,e),this.variables_real||(this.variables_real=[]),this.variables||(this.variables=[]),s="long",r=0,this.strings.form&&(s=this.strings.form),this.strings.plural&&(r=this.strings.plural),"citation-number"===this.variables_real[0]||"year-suffix"===this.variables_real[0]||"citation-label"===this.variables_real[0])"citation-number"===this.variables_real[0]?("citation"===t.build.root&&(t.opt.update_mode=CSL.NUMERIC),"bibliography"===t.build.root&&(t.opt.bib_mode=CSL.NUMERIC),"bibliography_sort"===t.build.area&&(t.opt.citation_number_sort_used=!0),"citation-number"===t[t.tmp.area].opt.collapse&&(this.range_prefix=t.getTerm("citation-range-delimiter")),this.successor_prefix=t[t.build.area].opt.layout_delimiter,this.splice_prefix=t[t.build.area].opt.layout_delimiter,i=function(t,e,i){if(n=""+e.id,!t.tmp.just_looking){if(i&&i["author-only"]){t.tmp.element_trace.replace("do-not-suppress-me");var s=t.getTerm("reference","long","singular");"undefined"==typeof s&&(s="reference"),f=CSL.Output.Formatters["capitalize-first"](t,s),t.output.append(f+" "),t.tmp.last_element_trace=!0}i&&i["suppress-author"]&&(t.tmp.last_element_trace&&t.tmp.element_trace.replace("suppress-me"),t.tmp.last_element_trace=!1),a=t.registry.registry[n].seq,t.opt.citation_number_slug?t.output.append(t.opt.citation_number_slug,this):(o=new CSL.NumericBlob(!1,a,this,e.id),t.tmp.in_cite_predecessor&&(!t.tmp.just_looking,o.suppress_splice_prefix=!0),t.output.append(o,"literal"))}},this.execs.push(i)):"year-suffix"===this.variables_real[0]?(t.opt.has_year_suffix=!0,"year-suffix-ranged"===t[t.tmp.area].opt.collapse&&(this.range_prefix=t.getTerm("citation-range-delimiter")),this.successor_prefix=t[t.build.area].opt.layout_delimiter,t[t.tmp.area].opt["year-suffix-delimiter"]&&(this.successor_prefix=t[t.build.area].opt["year-suffix-delimiter"]),i=function(t,e){if(t.registry.registry[e.id]&&t.registry.registry[e.id].disambig.year_suffix!==!1&&!t.tmp.just_looking){a=parseInt(t.registry.registry[e.id].disambig.year_suffix,10),t[t.tmp.area].opt.cite_group_delimiter&&(this.successor_prefix=t[t.tmp.area].opt.cite_group_delimiter),o=new CSL.NumericBlob(!1,a,this,e.id),l=new CSL.Util.Suffixator(CSL.SUFFIX_CHARS),o.setFormatter(l),t.output.append(o,"literal"),u=!1;for(var i=0,s=t.tmp.group_context.mystack.length;s>i;i++){var r=t.tmp.group_context.mystack[i];if(!r.variable_success&&(r.variable_attempt||!r.variable_attempt&&!r.term_intended)){u=!0;break}}p=t[t.tmp.area].opt["year-suffix-delimiter"],u&&p&&!t.tmp.sort_key_flag&&(t.tmp.splice_delimiter=t[t.tmp.area].opt["year-suffix-delimiter"])}},this.execs.push(i)):"citation-label"===this.variables_real[0]&&(t.opt.has_year_suffix=!0,i=function(t,e){h=e["citation-label"],h||(h=t.getCitationLabel(e)),t.tmp.just_looking||(c="",t.registry.registry[e.id]&&t.registry.registry[e.id].disambig.year_suffix!==!1&&(a=parseInt(t.registry.registry[e.id].disambig.year_suffix,10),c=t.fun.suffixator.format(a)),h+=c),t.output.append(h,this)},this.execs.push(i));else if(this.strings.term)i=function(t,e){var i=t.opt.gender[e.type],n=this.strings.term;n=t.getTerm(n,s,r,i,CSL.TOLERANT,this.default_locale);var a;if(""!==n&&(t.tmp.group_context.tip.term_intended=!0),CSL.UPDATE_GROUP_CONTEXT_CONDITION(t,n),a=t.tmp.term_predecessor||"in-text"===t.opt["class"]&&"citation"===t.tmp.area?n:CSL.Output.Formatters["capitalize-first"](t,n),t.tmp.strip_periods)a=a.replace(/\./g,"");else for(var o=0,l=this.decorations.length;l>o;o+=1)if("@strip-periods"===this.decorations[o][0]&&"true"===this.decorations[o][1]){a=a.replace(/\./g,"");break}t.output.append(a,this)},this.execs.push(i),t.build.term=!1,t.build.form=!1,t.build.plural=!1;else if(this.variables_real.length){if(i=function(t,e){"locator"!==this.variables_real[0]&&(t.tmp.have_collapsed=!1);var i=this.variables[0];"title"!==i||"short"!==s&&!e["title-short"]||(i="title-short"),t.parallel.StartVariable(i),t.parallel.AppendToVariable(e[i],i),!t.tmp.group_context.tip.condition&&e[this.variables[0]]&&(t.tmp.just_did_number=!1)},this.execs.push(i),CSL.MULTI_FIELDS.indexOf(this.variables_real[0])>-1||["language-name","language-name-original"].indexOf(this.variables_real[0])>-1){var b=this.variables[0],_=!1,v=!1,y=!1;"short"===s?"container-title"===this.variables_real[0]?v="journalAbbreviation":"title"===this.variables_real[0]&&(v="title-short"):b=!1,t.build.extension?y=!0:(y=!0,_=!0),i=t.transform.getOutputFunction(this.variables,b,_,v,y)}else i=CSL.CITE_FIELDS.indexOf(this.variables_real[0])>-1?function(t,e,i){i&&i[this.variables[0]]&&(t.processNumber(this,i,this.variables[0],e.type),CSL.Util.outputNumericField(t,this.variables[0],e.id),t.output.append(m,this,!1,!1,!0),["locator","locator-extra"].indexOf(this.variables_real[0])>-1&&!t.tmp.just_looking&&t.tmp.done_vars.push(this.variables_real[0]))}:["page","page-first","chapter-number","collection-number","edition","issue","number","number-of-pages","number-of-volumes","volume"].indexOf(this.variables_real[0])>-1?function(t,e){t.processNumber(this,e,this.variables[0],e.type),CSL.Util.outputNumericField(t,this.variables[0],e.id)}:["URL","DOI"].indexOf(this.variables_real[0])>-1?function(t,e){var i;if(this.variables[0]&&(i=t.getVariable(e,this.variables[0],s)))if(t.opt.development_extensions.wrap_url_and_doi)if(this.decorations.length&&this.decorations[0][0]==="@"+this.variables[0])t.output.append(i,this,!1,!1,!0);else if("DOI"===this.variables_real[0]&&"https://doi.org/"===this.strings.prefix){var r=CSL.Util.cloneToken(this),n=new CSL.Blob(null,null,"url-wrapper");if(n.decorations.push(["@DOI","true"]),i=i.replace(/^https?:\/\/doi\.org\//,""),i.match(/^https?:\/\//))var a="";else var a="https://doi.org/";var o=new CSL.Blob(a),l=new CSL.Blob(i);r.strings.prefix="",n.push(o),n.push(l),t.output.append(n,r,!1,!1,!0)}else this.decorations=[["@"+this.variables[0],"true"]].concat(this.decorations),t.output.append(i,this,!1,!1,!0);else{if(this.decorations.length)for(var u=this.decorations.length-1;u>-1;u--)this.decorations[u][0]==="@"+this.variables[0]&&(this.decorations=this.decorations.slice(0,u).concat(this.decorations.slice(u+1)));t.output.append(i,this,!1,!1,!0)}}:"section"===this.variables_real[0]?function(t,e){var i;i=t.getVariable(e,this.variables[0],s),i&&t.output.append(i,this)}:"hereinafter"===this.variables_real[0]?function(t,e){var i=t.transform.abbrevs["default"].hereinafter[e.id];i&&(t.output.append(i,this),t.tmp.group_context.tip.variable_success=!0)}:function(t,e){var i;this.variables[0]&&(i=t.getVariable(e,this.variables[0],s),i&&(i=""+i,i=i.split("\\").join(""),t.output.append(i,this)))};this.execs.push(i),i=function(t){t.parallel.CloseVariable("text")},this.execs.push(i)}else this.strings.value&&(i=function(t){t.tmp.group_context.tip.term_intended=!0,CSL.UPDATE_GROUP_CONTEXT_CONDITION(t,this.strings.value,!0),t.output.append(this.strings.value,this)},this.execs.push(i));e.push(this),CSL.Util.substituteEnd.call(this,t,e)}}},e.exports=CSL,CSL.Attributes={},CSL.Attributes["@genre"]=function(t,e){e=e.replace("-"," ");var i=function(t){return e===t.genre?!0:!1};this.tests.push(i)},CSL.Attributes["@disambiguate"]=function(t,e){if("true"===e){t.opt.has_disambiguate=!0;var i=function(){return t.tmp.disambiguate_maxMax+=1,t.tmp.disambig_settings.disambiguate&&t.tmp.disambiguate_count<t.tmp.disambig_settings.disambiguate?(t.tmp.disambiguate_count+=1,!0):!1};this.tests.push(i)}else if("check-ambiguity-and-backreference"===e){var i=function(e){return t.registry.registry[e.id].disambig.disambiguate&&t.registry.registry[e.id]["citation-count"]>1?!0:!1};this.tests.push(i)}},CSL.Attributes["@is-numeric"]=function(t,e){for(var i=e.split(/\s+/),s=function(e){return function(i,s){var r=i;if(["locator","locator-extra"].indexOf(e)>-1&&(r=s),"undefined"==typeof r)return!1;if(CSL.NUMERIC_VARIABLES.indexOf(e)>-1){if(t.tmp.shadow_numbers[e]||t.processNumber(!1,r,e,i.type),r[e]&&t.tmp.shadow_numbers[e].numeric)return!0}else if(["title","locator-extra","version"].indexOf(e)>-1&&r[e]&&r[e].slice(-1)===""+parseInt(r[e].slice(-1),10))return!0;return!1}},r=0;r<i.length;r+=1)this.tests.push(s(i[r]))},CSL.Attributes["@is-uncertain-date"]=function(t,e){for(var i=e.split(/\s+/),s=function(t){return function(e){return e[t]&&e[t].circa?!0:!1}},r=0,n=i.length;n>r;r+=1)this.tests.push(s(i[r]))},CSL.Attributes["@locator"]=function(t,e){var i=e.replace("sub verbo","sub-verbo");i=i.split(/\s+/);for(var s=function(e){return function(i,s){var r;return t.processNumber(!1,s,"locator"),r=t.tmp.shadow_numbers.locator.label,e===r?!0:!1}},r=0,n=i.length;n>r;r+=1)this.tests.push(s(i[r]))},CSL.Attributes["@position"]=function(t,e){var i;t.opt.update_mode=CSL.POSITION,t.parallel.use_parallels=null;for(var s=e.split(/\s+/),r=function(e){return function(i,s){if("bibliography"===t.tmp.area)return!1;if(s&&"undefined"==typeof s.position&&(s.position=0),s&&"number"==typeof s.position){if(0===s.position&&0===e)return!0;if(e>0&&s.position>=e)return!0}else if(0===e)return!0;return!1}},n=0,a=s.length;a>n;n+=1){var i=s[n];"first"===i?i=CSL.POSITION_FIRST:"subsequent"===i?i=CSL.POSITION_SUBSEQUENT:"ibid"===i?i=CSL.POSITION_IBID:"ibid-with-locator"===i&&(i=CSL.POSITION_IBID_WITH_LOCATOR),this.tests.push("near-note"===i?function(t,e){return e&&e.position>=CSL.POSITION_SUBSEQUENT&&e["near-note"]?!0:!1}:"far-note"===i?function(t,e){return e&&e.position==CSL.POSITION_SUBSEQUENT&&!e["near-note"]?!0:!1}:r(i))}},CSL.Attributes["@type"]=function(t,e){for(var i=e.split(/\s+/),s=function(t){return function(e){var i=e.type===t;return i?!0:!1}},r=[],n=0,a=i.length;a>n;n+=1)r.push(s(i[n]));this.tests.push(t.fun.match.any(this,t,r));
+
+},CSL.Attributes["@variable"]=function(t,e){var i;if(this.variables=e.split(/\s+/),this.variables_real=this.variables.slice(),"label"===this.name&&this.variables[0])this.strings.term=this.variables[0];else if(["names","date","text","number"].indexOf(this.name)>-1)i=function(t,e,i){for(var s=this.variables.length-1;s>-1;s+=-1)this.variables.pop();for(var s=0,r=this.variables_real.length;r>s;s++)-1!==t.tmp.done_vars.indexOf(this.variables_real[s])||i&&"legal_case"===e.type&&i["suppress-author"]&&"title"===this.variables_real[s]||this.variables.push(this.variables_real[s]),t.tmp.can_block_substitute&&t.tmp.done_vars.push(this.variables_real[s])},this.execs.push(i),i=function(t,e,i){for(var s=!1,r=0,n=this.variables.length;n>r;r++){var a=this.variables[r];if(["authority","committee"].indexOf(a)>-1&&"string"==typeof e[a]&&"names"===this.name){var o=!0,l=e[a].split(/\s*;\s*/),u={};if(e.multi&&e.multi._keys[a])for(var p in e.multi._keys[a])if(u[p]=e.multi._keys[a][p].split(/\s*;\s*/),u[p].length!==l.length){o=!1;break}o||(l=[e[a]],u=e.multi._keys[a]);for(var h=0,c=l.length;c>h;h++){var f={literal:l[h],multi:{_key:{}}};for(var p in u){var m={literal:u[p][h]};f.multi._key[p]=m}l[h]=f}e[a]=l}if("short"!==this.strings.form||e[a]||("title"===a?a="title-short":"container-title"===a&&(a="journalAbbreviation")),"year-suffix"===a){s=!0;break}if(CSL.DATE_VARIABLES.indexOf(a)>-1){if(t.opt.development_extensions.locator_date_and_revision&&"locator-date"===a){s=!0;break}if(e[a]){for(var d in e[a])if((-1!==this.dateparts.indexOf(d)||"literal"===d)&&e[a][d]){s=!0;break}if(s)break}}else{if("locator"===a){i&&i.locator&&(s=!0);break}if("locator-extra"===a){i&&i["locator-extra"]&&(s=!0);break}if(["citation-number","citation-label"].indexOf(a)>-1){s=!0;break}if("first-reference-note-number"===a){i&&i["first-reference-note-number"]&&(s=!0);break}if("hereinafter"===a){t.transform.abbrevs["default"].hereinafter[e.id]&&t.sys.getAbbreviation&&e.id&&(s=!0);break}if("object"==typeof e[a]){e[a].length;break}if("string"==typeof e[a]&&e[a]){s=!0;break}if("number"==typeof e[a]){s=!0;break}}if(s)break}if(s){for(var r=0,n=this.variables_real.length;n>r;r++){var a=this.variables_real[r];("citation-number"!==a||"bibliography"!==t.tmp.area)&&(t.tmp.cite_renders_content=!0),t.tmp.group_context.tip.variable_success=!0,t.tmp.can_substitute.value()&&"bibliography"===t.tmp.area&&"string"==typeof e[a]&&(t.tmp.name_node.top=t.output.current.value(),t.tmp.rendered_name.push(e[a]))}t.tmp.can_substitute.replace(!1,CSL.LITERAL)}else t.tmp.group_context.tip.variable_attempt=!0},this.execs.push(i);else if(["if","else-if","condition"].indexOf(this.name)>-1)for(var s=function(e){return function(i,s){var r=i;if(s&&["locator","locator-extra","first-reference-note-number","locator-date"].indexOf(e)>-1&&(r=s),"hereinafter"===e&&t.sys.getAbbreviation&&r.id){if(t.transform.abbrevs["default"].hereinafter[r.id])return!0}else if(r[e]){if("number"==typeof r[e]||"string"==typeof r[e])return!0;if("object"==typeof r[e])for(var n in r[e])if(r[e][n])return!0}return!1}},r=0,n=this.variables.length;n>r;r+=1)this.tests.push(s(this.variables[r]))},CSL.Attributes["@page"]=function(t,e){var i=e.replace("sub verbo","sub-verbo");i=i.split(/\s+/);for(var s=function(e){return function(i){var s;return t.processNumber(!1,i,"page",i.type),s=t.tmp.shadow_numbers.page.label?"sub verbo"===t.tmp.shadow_numbers.page.label?"sub-verbo":t.tmp.shadow_numbers.page.label:"page",e===s?!0:!1}},r=0,n=i.length;n>r;r+=1)this.tests.push(s(i[r]))},CSL.Attributes["@number"]=function(t,e){var i=e.replace("sub verbo","sub-verbo");i=i.split(/\s+/);for(var s=function(e){return function(i){var s;return t.processNumber(!1,i,"number",i.type),s=t.tmp.shadow_numbers.number.label?"sub verbo"===t.tmp.shadow_numbers.number.label?"sub-verbo":t.tmp.shadow_numbers.number.label:"number",e===s?!0:!1}},r=0,n=i.length;n>r;r+=1)this.tests.push(s(i[r]))},CSL.Attributes["@jurisdiction"]=function(t,e){for(var i=e.split(/\s+/),s=0,r=i.length;r>s;s+=1)i[s]=i[s].split(":");for(var n=function(t){return function(e){if(!e.jurisdiction)return!1;for(var i=e.jurisdiction.split(":"),s=0,r=i.length;r>s;s+=1)i[s]=i[s].split(":");for(s=t.length;s>0;s+=-1){var n=t.slice(0,s).join(":"),a=i.slice(0,s).join(":");if(n!==a)return!1}return!0}},s=0,r=i.length;r>s;s+=1){var a=i[s].slice();this.tests.push(n(a))}},CSL.Attributes["@context"]=function(t,e){var i=function(){var i=t.tmp.area.slice(0,e.length);return i===e?!0:!1};this.tests.push(i)},CSL.Attributes["@has-year-only"]=function(t,e){for(var i=e.split(/\s+/),s=function(t){return function(e){var i=e[t];return!i||i.month||i.season?!1:!0}},r=0,n=i.length;n>r;r+=1)this.tests.push(s(i[r]))},CSL.Attributes["@has-to-month-or-season"]=function(t,e){for(var i=e.split(/\s+/),s=function(t){return function(e){var i=e[t];return!i||!i.month&&!i.season||i.day?!1:!0}},r=0,n=i.length;n>r;r+=1)this.tests.push(s(i[r]))},CSL.Attributes["@has-day"]=function(t,e){for(var i=e.split(/\s+/),s=function(t){return function(e){var i=e[t];return i&&i.day?!0:!1}},r=0,n=i.length;n>r;r+=1)this.tests.push(s(i[r]))},CSL.Attributes["@subjurisdictions"]=function(t,e){var i=parseInt(e,10),s=function(t){var e=0;return t.jurisdiction&&(e=t.jurisdiction.split(":").length),e&&(e+=-1),e>=i?!0:!1};this.tests.push(s)},CSL.Attributes["@is-plural"]=function(t,e){var i=function(i){var s=i[e];if(s&&s.length){for(var r=0,n=0,a=!1,o=0,l=s.length;l>o;o+=1)t.opt.development_extensions.spoof_institutional_affiliations&&(s[o].literal||s[o].isInstitution&&s[o].family&&!s[o].given)?(n+=1,a=!1):(r+=1,a=!0);if(r>1)return!0;if(n>1)return!0;if(n&&a)return!0}return!1};this.tests.push(i)},CSL.Attributes["@locale"]=function(t,e){var i,s,r,n,a,o,l=t.opt["default-locale"][0];if("layout"===this.name){if(this.locale_raw=e,this.tokentype===CSL.START){var u=e.split(/\s+/),p={},h=CSL.localeResolve(u[0],l);h.generic?p[h.generic]=h.best:p[h.best]=h.best;for(var a=1,o=u.length;o>a;a+=1){var c=CSL.localeResolve(u[a],l);c.generic?p[c.generic]=h.best:p[c.best]=h.best}t[t.build.area].opt.sort_locales.push(p)}t.opt.has_layout_locale=!0}else{n=e.split(/\s+/);var f=[];for(a=0,o=n.length;o>a;a+=1)r=n[a],s=CSL.localeResolve(r,l),2===n[a].length&&f.push(s.bare),t.localeConfigure(s,!0),n[a]=s;var m=n.slice(),d=function(t,e,s){return function(r){var n;i=[],n=!1;var l,u=!1;for(l=r.language?r.language:e,u=CSL.localeResolve(l,e),a=0,o=t.length;o>a;a+=1)if(u.best===t[a].best){n=!0;break}return!n&&s.indexOf(u.bare)>-1&&(n=!0),n}};this.tests.push(d(m,l,f))}},CSL.Attributes["@authority-residue"]=function(t,e){var i=function(){var i="true"===e?!0:!1;return function(e){if(!e.authority||!e.authority[0]||!e.authority[0].family)return!i;var s=e.authority[0].family.split("|").length,r=t.tmp.authority_stop_last;return s+r>0?i:!i}};this.tests.push(i())},CSL.Attributes["@locale-internal"]=function(t,e){var i,s,r,n,a,o;for(n=e.split(/\s+/),this.locale_bares=[],a=0,o=n.length;o>a;a+=1)r=n[a],s=CSL.localeResolve(r,t.opt["default-locale"][0]),2===n[a].length&&this.locale_bares.push(s.bare),t.localeConfigure(s),n[a]=s;this.locale_default=t.opt["default-locale"][0],this.locale=n[0].best,this.locale_list=n.slice();var l=function(e){return function(s){var n;i=[],n=!1;var l=!1;if(s.language&&(r=s.language,l=CSL.localeResolve(r,t.opt["default-locale"][0]),l.best===t.opt["default-locale"][0]&&(l=!1)),l){for(a=0,o=e.locale_list.length;o>a;a+=1)if(l.best===e.locale_list[a].best){t.opt.lang=e.locale,t.tmp.last_cite_locale=e.locale,t.output.openLevel("empty"),t.output.current.value().new_locale=e.locale,n=!0;break}!n&&e.locale_bares.indexOf(l.bare)>-1&&(t.opt.lang=e.locale,t.tmp.last_cite_locale=e.locale,t.output.openLevel("empty"),t.output.current.value().new_locale=e.locale,n=!0)}return n}},u=this;this.tests.push(l(u))},CSL.Attributes["@is-parallel"]=function(t,e){for(var i=e.split(" "),s=0,r=i.length;r>s;s+=1)"true"===i[s]?i[s]=!0:"false"===i[s]&&(i[s]=!1);this.strings.set_parallel_condition=i},CSL.Attributes["@jurisdiction-depth"]=function(t,e){this.strings.jurisdiction_depth=parseInt(e,10)},CSL.Attributes["@require"]=function(t,e){this.strings.require=e},CSL.Attributes["@reject"]=function(t,e){this.strings.reject=e},CSL.Attributes["@gender"]=function(t,e){this.gender=e},CSL.Attributes["@cslid"]=function(t,e){this.cslid=parseInt(e,10)},CSL.Attributes["@label-form"]=function(t,e){this.strings.label_form_override=e},CSL.Attributes["@part-separator"]=function(t,e){this.strings["part-separator"]=e},CSL.Attributes["@leading-noise-words"]=function(t,e){this["leading-noise-words"]=e},CSL.Attributes["@name-never-short"]=function(t,e){this["name-never-short"]=e},CSL.Attributes["@class"]=function(t,e){t.opt["class"]=e},CSL.Attributes["@version"]=function(t,e){t.opt.version=e},CSL.Attributes["@value"]=function(t,e){this.strings.value=e},CSL.Attributes["@name"]=function(t,e){this.strings.name=e},CSL.Attributes["@form"]=function(t,e){this.strings.form=e},CSL.Attributes["@date-parts"]=function(t,e){this.strings["date-parts"]=e},CSL.Attributes["@range-delimiter"]=function(t,e){this.strings["range-delimiter"]=e},CSL.Attributes["@macro"]=function(t,e){this.postponed_macro=e},CSL.Attributes["@term"]=function(t,e){this.strings.term="sub verbo"===e?"sub-verbo":e},CSL.Attributes["@xmlns"]=function(){},CSL.Attributes["@lang"]=function(t,e){e&&(t.build.lang=e)},CSL.Attributes["@lingo"]=function(){},CSL.Attributes["@macro-has-date"]=function(){this["macro-has-date"]=!0},CSL.Attributes["@suffix"]=function(t,e){this.strings.suffix=e},CSL.Attributes["@prefix"]=function(t,e){this.strings.prefix=e},CSL.Attributes["@delimiter"]=function(t,e){this.strings.delimiter=e},CSL.Attributes["@match"]=function(t,e){this.match=e},CSL.Attributes["@names-min"]=function(t,e){var i=parseInt(e,10);t[t.build.area].opt.max_number_of_names<i&&(t[t.build.area].opt.max_number_of_names=i),this.strings["et-al-min"]=i},CSL.Attributes["@names-use-first"]=function(t,e){this.strings["et-al-use-first"]=parseInt(e,10)},CSL.Attributes["@names-use-last"]=function(t,e){this.strings["et-al-use-last"]="true"===e?!0:!1},CSL.Attributes["@sort"]=function(t,e){"descending"===e&&(this.strings.sort_direction=CSL.DESCENDING)},CSL.Attributes["@plural"]=function(t,e){"always"===e||"true"===e?this.strings.plural=1:"never"===e||"false"===e?this.strings.plural=0:"contextual"===e&&(this.strings.plural=!1)},CSL.Attributes["@has-publisher-and-publisher-place"]=function(){this.strings["has-publisher-and-publisher-place"]=!0},CSL.Attributes["@publisher-delimiter-precedes-last"]=function(t,e){this.strings["publisher-delimiter-precedes-last"]=e},CSL.Attributes["@publisher-delimiter"]=function(t,e){this.strings["publisher-delimiter"]=e},CSL.Attributes["@publisher-and"]=function(t,e){this.strings["publisher-and"]=e},CSL.Attributes["@newdate"]=function(){},CSL.Attributes["@givenname-disambiguation-rule"]=function(t,e){CSL.GIVENNAME_DISAMBIGUATION_RULES.indexOf(e)>-1&&(t.citation.opt["givenname-disambiguation-rule"]=e)},CSL.Attributes["@collapse"]=function(t,e){e&&(t[this.name].opt.collapse=e)},CSL.Attributes["@cite-group-delimiter"]=function(t,e){e&&(t[t.tmp.area].opt.cite_group_delimiter=e)},CSL.Attributes["@names-delimiter"]=function(t,e){t.setOpt(this,"names-delimiter",e)},CSL.Attributes["@name-form"]=function(t,e){t.setOpt(this,"name-form",e)},CSL.Attributes["@subgroup-delimiter"]=function(t,e){this.strings["subgroup-delimiter"]=e},CSL.Attributes["@subgroup-delimiter-precedes-last"]=function(t,e){this.strings["subgroup-delimiter-precedes-last"]=e},CSL.Attributes["@name-delimiter"]=function(t,e){t.setOpt(this,"name-delimiter",e)},CSL.Attributes["@et-al-min"]=function(t,e){var i=parseInt(e,10);t[t.build.area].opt.max_number_of_names<i&&(t[t.build.area].opt.max_number_of_names=i),t.setOpt(this,"et-al-min",i)},CSL.Attributes["@et-al-use-first"]=function(t,e){t.setOpt(this,"et-al-use-first",parseInt(e,10))},CSL.Attributes["@et-al-use-last"]=function(t,e){"true"===e?t.setOpt(this,"et-al-use-last",!0):t.setOpt(this,"et-al-use-last",!1)},CSL.Attributes["@et-al-subsequent-min"]=function(t,e){var i=parseInt(e,10);t[t.build.area].opt.max_number_of_names<i&&(t[t.build.area].opt.max_number_of_names=i),t.setOpt(this,"et-al-subsequent-min",i)},CSL.Attributes["@et-al-subsequent-use-first"]=function(t,e){t.setOpt(this,"et-al-subsequent-use-first",parseInt(e,10))},CSL.Attributes["@suppress-min"]=function(t,e){this.strings["suppress-min"]=parseInt(e,10)},CSL.Attributes["@suppress-max"]=function(t,e){this.strings["suppress-max"]=parseInt(e,10)},CSL.Attributes["@and"]=function(t,e){t.setOpt(this,"and",e)},CSL.Attributes["@delimiter-precedes-last"]=function(t,e){t.setOpt(this,"delimiter-precedes-last",e)},CSL.Attributes["@delimiter-precedes-et-al"]=function(t,e){t.setOpt(this,"delimiter-precedes-et-al",e)},CSL.Attributes["@initialize-with"]=function(t,e){t.setOpt(this,"initialize-with",e)},CSL.Attributes["@initialize"]=function(t,e){"false"===e&&t.setOpt(this,"initialize",!1)},CSL.Attributes["@name-as-reverse-order"]=function(t,e){this["name-as-reverse-order"]=e},CSL.Attributes["@name-as-sort-order"]=function(t,e){"style-options"===this.name?this["name-as-sort-order"]=e:t.setOpt(this,"name-as-sort-order",e)},CSL.Attributes["@sort-separator"]=function(t,e){t.setOpt(this,"sort-separator",e)},CSL.Attributes["@year-suffix-delimiter"]=function(t,e){t[this.name].opt["year-suffix-delimiter"]=e},CSL.Attributes["@after-collapse-delimiter"]=function(t,e){t[this.name].opt["after-collapse-delimiter"]=e},CSL.Attributes["@subsequent-author-substitute"]=function(t,e){t[this.name].opt["subsequent-author-substitute"]=e},CSL.Attributes["@subsequent-author-substitute-rule"]=function(t,e){t[this.name].opt["subsequent-author-substitute-rule"]=e},CSL.Attributes["@disambiguate-add-names"]=function(t,e){"true"===e&&(t.opt["disambiguate-add-names"]=!0)},CSL.Attributes["@disambiguate-add-givenname"]=function(t,e){"true"===e&&(t.opt["disambiguate-add-givenname"]=!0)},CSL.Attributes["@disambiguate-add-year-suffix"]=function(t,e){"true"===e&&"numeric"!==t.opt.xclass&&(t.opt["disambiguate-add-year-suffix"]=!0)},CSL.Attributes["@second-field-align"]=function(t,e){("flush"===e||"margin"===e)&&(t[this.name].opt["second-field-align"]=e)},CSL.Attributes["@hanging-indent"]=function(t,e){"true"===e&&(t[this.name].opt.hangingindent=2)},CSL.Attributes["@line-spacing"]=function(t,e){e&&e.match(/^[.0-9]+$/)&&(t[this.name].opt["line-spacing"]=parseFloat(e,10))},CSL.Attributes["@entry-spacing"]=function(t,e){e&&e.match(/^[.0-9]+$/)&&(t[this.name].opt["entry-spacing"]=parseFloat(e,10))},CSL.Attributes["@near-note-distance"]=function(t,e){t[this.name].opt["near-note-distance"]=parseInt(e,10)},CSL.Attributes["@text-case"]=function(t,e){var i=function(t,i){if("normal"===e)this.text_case_normal=!0;else if(this.strings["text-case"]=e,"title"===e){{t.opt["default-locale"][0].slice(0,2)}i.jurisdiction&&(this.strings["text-case"]="passthrough")}};this.execs.push(i)},CSL.Attributes["@page-range-format"]=function(t,e){t.opt["page-range-format"]=e},CSL.Attributes["@year-range-format"]=function(t,e){t.opt["year-range-format"]=e},CSL.Attributes["@default-locale"]=function(t,e){if("style"===this.name){var i,s,r,n,a,n=e.match(/-x-(sort|translit|translat)-/g);if(n)for(r=0,s=n.length;s>r;r+=1)n[r]=n[r].replace(/^-x-/,"").replace(/-$/,"");for(i=e.split(/-x-(?:sort|translit|translat)-/),a=[i[0]],r=1,s=i.length;s>r;r+=1)a.push(n[r-1]),a.push(i[r]);for(i=a.slice(),s=i.length,r=1;s>r;r+=2)t.opt["locale-"+i[r]].push(i[r+1].replace(/^\s*/g,"").replace(/\s*$/g,""));t.opt["default-locale"]=i.length?i.slice(0,1):["en"]}else"true"===e&&(this.default_locale=!0)},CSL.Attributes["@default-locale-sort"]=function(t,e){t.opt["default-locale-sort"]=e},CSL.Attributes["@demote-non-dropping-particle"]=function(t,e){t.opt["demote-non-dropping-particle"]=e},CSL.Attributes["@initialize-with-hyphen"]=function(t,e){"false"===e&&(t.opt["initialize-with-hyphen"]=!1)},CSL.Attributes["@institution-parts"]=function(t,e){this.strings["institution-parts"]=e},CSL.Attributes["@if-short"]=function(t,e){"true"===e&&(this.strings["if-short"]=!0)},CSL.Attributes["@substitute-use-first"]=function(t,e){this.strings["substitute-use-first"]=parseInt(e,10)},CSL.Attributes["@use-first"]=function(t,e){this.strings["use-first"]=parseInt(e,10)},CSL.Attributes["@stop-last"]=function(t,e){this.strings["stop-last"]=-1*parseInt(e,10)},CSL.Attributes["@use-last"]=function(t,e){this.strings["use-last"]=parseInt(e,10)},CSL.Attributes["@reverse-order"]=function(t,e){"true"===e&&(this.strings["reverse-order"]=!0)},CSL.Attributes["@display"]=function(t,e){2===t.bibliography.tokens.length&&(t.opt.using_display=!0),this.strings.cls=e},e.exports=CSL,CSL.Stack=function(t,e){this.mystack=[],(e||t)&&this.mystack.push(t),this.tip=this.mystack[0]},CSL.Stack.prototype.push=function(t,e){this.mystack.push(e||t?t:""),this.tip=this.mystack[this.mystack.length-1]},CSL.Stack.prototype.clear=function(){this.mystack=[],this.tip={}},CSL.Stack.prototype.replace=function(t,e){if(0===this.mystack.length)throw"Internal CSL processor error: attempt to replace nonexistent stack item with "+t;this.mystack[this.mystack.length-1]=e||t?t:"",this.tip=this.mystack[this.mystack.length-1]},CSL.Stack.prototype.pop=function(){var t=this.mystack.pop();return this.tip=this.mystack.length?this.mystack[this.mystack.length-1]:{},t},CSL.Stack.prototype.value=function(){return this.mystack.slice(-1)[0]},CSL.Stack.prototype.length=function(){return this.mystack.length},e.exports=CSL,CSL.Parallel=function(t){this.state=t,this.sets=new CSL.Stack([]),this.try_cite=!0,this.use_parallels=!1,this.midVars=["section","volume","container-title","collection-number","issue","page-first","page","number"],this.ignoreVarsLawGeneral=["first-reference-note-number","locator","label","page-first","page","genre"],this.ignoreVarsLawProceduralHistory=["issued","first-reference-note-number","locator","label","page-first","page","genre","jurisdiction"],this.ignoreVarsOrders=["first-reference-note-number"],this.ignoreVarsOther=["first-reference-note-number","locator","label","section","page-first","page"]},CSL.Parallel.prototype.isMid=function(t){return this.midVars.indexOf(t)>-1},CSL.Parallel.prototype.StartCitation=function(t,e){this.parallel_conditional_blobs_list=[],this.use_parallels&&(this.sortedItems=t,this.sortedItemsPos=-1,this.sets.clear(),this.sets.push([]),this.in_series=!0,this.delim_counter=0,this.delim_pointers=[],this.out=e?e:this.state.output.queue,this.master_was_neutral_cite=!0)},CSL.Parallel.prototype.StartCite=function(t,e,i){var s,r,n,a,o,l,u,p;if(this.use_parallels){this.sets.value().length&&this.sets.value()[0].itemId==t.id&&this.ComposeSet(),this.sortedItemsPos+=1,e&&(s=e.position),this.try_cite=!0;for(var h=!1,c=0,f=CSL.PARALLEL_MATCH_VARS.length;f>c;c+=1)if(t[CSL.PARALLEL_MATCH_VARS[c]]){h=!0;break}var m=!0,d=this.sets.value().slice(-1)[0];if(d&&d.Item){var g=d.Item.jurisdiction?d.Item.jurisdiction.split(":")[0]:"",b=t.jurisdiction?t.jurisdiction.split(":")[0]:"";d.Item.title!==t.title?m=!1:g!==b?m=!1:d.Item.type!==t.type?m=!1:["article-journal","article-magazine"].indexOf(t.type)>-1&&(this.state.opt.development_extensions.handle_parallel_articles&&d.Item["container-title"]===t["container-title"]||(m=!1))}if(m&&h&&-1!==CSL.PARALLEL_TYPES.indexOf(t.type)||(this.try_cite=!0,this.in_series&&(this.in_series=!1)),this.cite={},this.cite.front=[],this.cite.mid=[],this.cite.back=[],this.cite.front_collapse={},this.cite.back_forceme=[],this.cite.position=s,this.cite.Item=t,this.cite.itemId=""+t.id,this.cite.prevItemID=""+i,this.target="front",["treaty"].indexOf(t.type)>-1)this.ignoreVars=this.ignoreVarsOrders;else if(["article-journal","article-magazine"].indexOf(t.type)>-1)this.ignoreVars=this.ignoreVarsOther;else if(e&&e.prefix){this.ignoreVars=this.ignoreVarsLawProceduralHistory,this.cite.useProceduralHistory=!0;var _=this.sets.value()[this.sets.value().length-1];if(_&&_.back)for(var c=_.back.length-1;c>-1;c+=-1)_.back[c]&&_[_.back[c]]&&delete _[_.back[c]]}else this.ignoreVars=this.ignoreVarsLawGeneral;if(this.sortedItems&&this.sortedItemsPos>0&&this.sortedItemsPos<this.sortedItems.length){if(a=this.sortedItems[this.sortedItemsPos][1],l=""+this.sortedItems[this.sortedItemsPos-1][1].id,o=this.state.registry.registry[l].parallel,u=!1,o==a.id){for(r=this.sortedItemsPos-1,n=r;n>-1;n+=-1)if(this.sortedItems[n][1].id==t.id){u=this.sortedItems[n][1].locator;break}p=this.sortedItems[this.sortedItemsPos][1].locator,a.position=!u&&p?CSL.POSITION_IBID_WITH_LOCATOR:p===u?CSL.POSITION_IBID:CSL.POSITION_IBID_WITH_LOCATOR}}else{if(!this.state.registry.registry[t.id])return this.try_cite=!1,void(this.force_collapse=!1);this.state.registry.registry[t.id].parallel=!1}this.force_collapse=!1,this.state.registry.registry[t.id].parallel&&(this.force_collapse=!0)}},CSL.Parallel.prototype.StartVariable=function(t,e){if(this.use_parallels&&(this.try_cite||this.force_collapse)){if(this.variable="names"===t?t+":"+this.target:t,this.ignoreVars.indexOf(t)>-1)return;"container-title"===t&&0===this.sets.value().length&&(this.master_was_neutral_cite=!1),this.data={},this.data.value="",this.data.blobs=[];var i=this.isMid(t);if("authority"===e&&"names:front"===this.variable&&this.sets.value().length){var s=this.sets.value()[this.sets.value().length-1].Item,r=!1;this.cite.Item.authority&&this.cite.Item.authority.length&&(r=this.cite.Item.authority[0].literal);var n=!1;s.authority&&s.authority.length&&(n=s.authority[0].literal),r!==n&&(this.try_cite=!0,this.in_series=!1)}else"front"===this.target&&i?this.target="mid":"mid"===this.target&&!i&&this.cite.Item.title&&"names"!==t?this.target="back":"back"===this.target&&i&&(this.try_cite=!0,this.in_series=!1);"number"===t?this.cite.front.push(this.variable):CSL.PARALLEL_COLLAPSING_MID_VARSET.indexOf(t)>-1?["article-journal","article-magazine"].indexOf(this.cite.Item.type)>-1?this.cite.mid.push(this.variable):this.cite.front.push(this.variable):this.cite[this.target].push(this.variable)}},CSL.Parallel.prototype.AppendBlobPointer=function(t){if(this.use_parallels){if(this.ignoreVars.indexOf(this.variable)>-1)return;if(this.use_parallels&&(this.force_collapse||this.try_cite)){if(["article-journal","article-magazine"].indexOf(this.cite.Item.type)>-1){if(["volume","page","page-first","issue"].indexOf(this.variable)>-1)return;if("container-title"===this.variable&&this.cite.mid.length>1)return}this.variable&&(this.try_cite||this.force_collapse)&&t&&t.blobs&&(this.cite.useProceduralHistory&&"back"===this.target||this.data.blobs.push([t,t.blobs.length]))}}},CSL.Parallel.prototype.AppendToVariable=function(t){if(this.use_parallels){if(this.ignoreVars.indexOf(this.variable)>-1)return;if(this.try_cite||this.force_collapse)if("back"!==this.target,0){var e=this.sets.value()[this.sets.value().length-1];e&&e[this.variable]&&e[this.variable].value&&(this.data.value+="::"+t)}else this.data.value+="::"+t}},CSL.Parallel.prototype.CloseVariable=function(){if(this.use_parallels){if(this.ignoreVars.indexOf(this.variable)>-1)return;if((this.try_cite||this.force_collapse)&&(this.cite[this.variable]=this.data,this.sets.value().length>0)){var t=this.sets.value()[this.sets.value().length-1];"front"===this.target&&"issued"===this.variable&&this.data.value&&this.master_was_neutral_cite&&(this.target="mid"),"front"===this.target?!t[this.variable]&&!this.data.value||t[this.variable]&&this.data.value===t[this.variable].value||"issued"!==this.variable&&(this.in_series=!1):"mid"===this.target?CSL.PARALLEL_COLLAPSING_MID_VARSET.indexOf(this.variable)>-1&&(this.cite.front_collapse[this.variable]=t[this.variable]&&t[this.variable].value===this.data.value?!0:!1):"back"===this.target&&t[this.variable]&&this.data.value!==t[this.variable].value&&-1===this.sets.value().slice(-1)[0].back_forceme.indexOf(this.variable)&&(this.in_series=!1)}this.variable=!1}},CSL.Parallel.prototype.CloseCite=function(){var t,e,i,s,r,n,a;if(this.use_parallels&&(this.force_collapse||this.try_cite)){if(s=!1,this.cite.front_collapse["container-title"]||(s=!0),this.cite.front_collapse.volume===!1&&(s=!0),this.cite.front_collapse["collection-number"]===!1&&(s=!0),this.cite.front_collapse.section===!1&&(s=!0),s){this.cite.use_journal_info=!0,a=this.cite.front.indexOf("section"),a>-1&&(this.cite.front=this.cite.front.slice(0,a).concat(this.cite.front.slice(a+1))),r=this.cite.front.indexOf("volume"),r>-1&&(this.cite.front=this.cite.front.slice(0,r).concat(this.cite.front.slice(r+1))),n=this.cite.front.indexOf("container-title"),n>-1&&(this.cite.front=this.cite.front.slice(0,n).concat(this.cite.front.slice(n+1)));var o=this.cite.front.indexOf("collection-number");o>-1&&(this.cite.front=this.cite.front.slice(0,o).concat(this.cite.front.slice(o+1)))}if(this.in_series||this.force_collapse||this.ComposeSet(!0),0===this.sets.value().length){var l=!1;for(e=0,i=this.cite.back.length;i>e;e+=1)if(t=this.cite.back[e],"issued"===t&&this.cite.issued&&this.cite.issued.value){l=!0;break}l||this.cite.back_forceme.push("issued")}else{var u=this.cite.front.indexOf("issued");if((-1===u||this.master_was_neutral_cite)&&(this.cite.back_forceme=this.sets.value().slice(-1)[0].back_forceme),u>-1){var p=this.sets.value()[this.sets.value().length-1];p.issued||(this.cite.front=this.cite.front.slice(0,u).concat(this.cite.front.slice(u+1)))}this.master_was_neutral_cite&&this.cite.mid.indexOf("names:mid")>-1&&this.cite.front.push("names:mid")}this.sets.value().push(this.cite)}},CSL.Parallel.prototype.ComposeSet=function(){var t,e,i;if(this.use_parallels&&(this.force_collapse||this.try_cite)){var s=this.sets.value().length;if(1===this.sets.value().length)this.in_series||(this.sets.value().pop(),this.delim_counter+=1);else{for(i=this.sets.value().length,e=0;i>e;e+=1)t=this.sets.value()[e],0===e?this.delim_counter+=1:(this.delim_pointers.push(!t.Item.title&&t.use_journal_info?!1:this.delim_counter),this.delim_counter+=1),CSL.POSITION_FIRST===t.position&&(0===e?(this.state.registry.registry[t.itemId].master=!0,this.state.registry.registry[t.itemId].siblings=[],this.state.registry.registry[t.itemId].parallel=!1):t.prevItemID&&(this.state.registry.registry[t.itemId].parallel=this.state.registry.registry[t.prevItemID].parallel?this.state.registry.registry[t.prevItemID].parallel:t.prevItemID,this.state.registry.registry[t.itemId].siblings=this.state.registry.registry[t.prevItemID].siblings,this.state.registry.registry[t.itemId].siblings||(this.state.registry.registry[t.itemId].siblings=[],CSL.debug("WARNING: adding missing siblings array to registry object")),this.state.registry.registry[t.itemId].siblings.push(t.itemId)));this.sets.push([])}this.purgeGroupsIfParallel(2>s?!1:!0),this.in_series=!0}},CSL.Parallel.prototype.PruneOutputQueue=function(){var t,e,i,s,r,n;if(this.use_parallels)for(t=this.sets.mystack.length,e=0;t>e;e+=1)if(i=this.sets.mystack[e],i.length>1)for(r=i.length,s=0;r>s;s+=1)n=i[s],0===s?this.purgeVariableBlobs(n,n.back):s===i.length-1?this.purgeVariableBlobs(n,n.front.concat(n.back_forceme)):this.purgeVariableBlobs(n,n.front.concat(n.back))},CSL.Parallel.prototype.purgeVariableBlobs=function(t,e){var i,s,r,n,a,o,l;if(this.use_parallels){for(l=this.state.output.current.value(),"undefined"==typeof l.length&&(l=l.blobs),s=0,i=this.delim_pointers.length;i>s;s+=1)o=this.delim_pointers[s],o!==!1&&(l[o].parallel_delimiter=", ");for(i=e.length-1,s=i;s>-1;s+=-1)if(r=e[s],t[r])for(a=t[r].blobs.length-1,o=a;o>-1;o+=-1)n=t[r].blobs[o],n[0].blobs=n[0].blobs.slice(0,n[1]).concat(n[0].blobs.slice(n[1]+1)),this.state.tmp.has_purged_parallel=!0,n[0]&&n[0].strings&&"string"==typeof n[0].strings.oops&&n[0].parent&&n[0].parent&&(n[0].parent.parent.strings.delimiter=n[0].strings.oops)}},CSL.Parallel.prototype.purgeGroupsIfParallel=function(t){for(var e=this.parallel_conditional_blobs_list.length-1;e>-1;e+=-1){for(var i=this.parallel_conditional_blobs_list[e],s=!0,r=0,n=i.conditions.length;n>r;r+=1)if(!i.conditions[r]!=!!t&&("master"!==i.conditions[r]||this.state.registry.registry[i.id].master)&&("servant"!==i.conditions[r]||this.state.registry.registry[i.id].parallel)){var s=!1;break}if(s){for(var a=[];i.blobs.length>i.pos;)a.push(i.blobs.pop());for(a.length&&a.pop();a.length;)i.blobs.push(a.pop())}this.parallel_conditional_blobs_list.pop()}},e.exports=CSL,CSL.Util={},CSL.Util.Match=function(){this.any=function(t,e,i){return function(t,e){for(var s=0,r=i.length;r>s;s+=1){var n=i[s](t,e);if(n)return!0}return!1}},this.none=function(t,e,i){return function(t,e){for(var s=0,r=i.length;r>s;s+=1){var n=i[s](t,e);if(n)return!1}return!0}},this.all=function(t,e,i){return function(t,e){for(var s=0,r=i.length;r>s;s+=1){var n=i[s](t,e);if(!n)return!1}return!0}},this[void 0]=this.all,this.nand=function(t,e,i){return function(t,e){for(var s=0,r=i.length;r>s;s+=1){var n=i[s](t,e);if(!n)return!0}return!1}}},e.exports=CSL,CSL.Transform=function(t){function e(t,e,i,s,r,n){var a;if(r=CSL.FIELD_CATEGORY_REMAP[r],!r)return s;var o=r;if(a="",t.sys.getAbbreviation){var l=s;t.sys.normalizeAbbrevsKey&&(l=t.sys.normalizeAbbrevsKey(s));var u=t.transform.loadAbbreviation(e.jurisdiction,r,l,e.type,!0);t.transform.abbrevs[u][r]&&l&&t.sys.getAbbreviation&&t.transform.abbrevs[u][r][l]&&(a=t.transform.abbrevs[u][r][l].replace("{stet}",s))}return a||t.opt.development_extensions.require_explicit_legal_case_title_short&&"legal_case"===e.type||!i||!e[i]||!n||(a=e[i]),a||(a=s),a&&a.match(/^\!(?:[^>]+,)*here(?:,[^>]+)*>>>/)&&(a="jurisdiction"===o&&["treaty","patent"].indexOf(e.type)>-1?a.replace(/^\![^>]*>>>\s*/,""):!1),a}function i(e,i){var s,r=t.opt["default-locale"][0].slice(0,2);if(s=new RegExp(t.opt.development_extensions.strict_text_case_locales?"^([a-zA-Z]{2})(?:$|-.*| .*)":"^([a-zA-Z]{2})(?:$|-.*|.*)"),e.language){var n=(""+e.language).match(s);r=n?n[1]:"tlh"}return e.multi&&e.multi&&e.multi.main&&e.multi.main[i]&&(r=e.multi.main[i]),(!t.opt.development_extensions.strict_text_case_locales||t.opt.development_extensions.normalize_lang_keys_to_lowercase)&&(r=r.toLowerCase()),r}function s(e,s,r,n,a){var o,l,u,p,h=a,c=!1;if(!e[s])return{name:"",usedOrig:a,token:CSL.Util.cloneToken(this)};u={name:"",usedOrig:a,locale:i(e,s)},p=t.opt[r];var f=!1,m=!1;if("locale-orig"===r)u=a?{name:"",usedOrig:a}:{name:e[s],usedOrig:!1,locale:i(e,s)},f=!0,c=!0;else if(n&&("undefined"==typeof p||0===p.length)){var u={name:e[s],usedOrig:!0,locale:i(e,s)};f=!0,c=!0}if(!f){for(var d=0,g=p.length;g>d;d+=1){if(o=p[d],l=o.split(/[\-_]/)[0],o&&e.multi&&e.multi._keys[s]&&e.multi._keys[s][o]){u.name=e.multi._keys[s][o],u.locale=o,"jurisdiction"===s&&(m=u.name);break}if(l&&e.multi&&e.multi._keys[s]&&e.multi._keys[s][l]){u.name=e.multi._keys[s][l],u.locale=l,"jurisdiction"===s&&(m=u.name);break}}!u.name&&n&&(u={name:e[s],usedOrig:!0,locale:i(e,s)},c=!0)}if(u.token=CSL.Util.cloneToken(this),t.sys.getHumanForm&&u.name&&"jurisdiction"===s)u.name=CSL.getJurisdictionNameAndSuppress(t,e[s],m,this.strings.jurisdiction_depth);else if(["title","container-title"].indexOf(s)>-1&&!(h||u.token.strings["text-case"]&&"sentence"!==u.token.strings["text-case"]&&"normal"!==u.token.strings["text-case"])){var b=c?!1:u.locale,_=s.slice(0,-5),v="sentence"===u.token.strings["text-case"]?!0:!1;u.name=CSL.titlecaseSentenceOrNormal(t,e,_,b,v),delete u.token.strings["text-case"]}return u}function r(e,i,s,r){return e||(e="default"),s?(t.sys.getAbbreviation&&(e=t.sys.getAbbreviation(t.opt.styleID,t.transform.abbrevs,e,i,s,r,!0),e||(e="default")),e):(t.transform.abbrevs[e]||(t.transform.abbrevs[e]=new t.sys.AbbreviationSegments),t.transform.abbrevs[e][i]||(t.transform.abbrevs[e][i]={}),e)}function n(i,s,r,n){var a=i.variables[0];if(t.publisherOutput&&r){if(-1===["publisher","publisher-place"].indexOf(a))return!1;t.publisherOutput[a+"-token"]=i,t.publisherOutput.varlist.push(a);var o=r.split(/;\s*/);o.length===t.publisherOutput[a+"-list"].length&&(t.publisherOutput[a+"-list"]=o);for(var l=0,u=o.length;u>l;l+=1)o[l]=e(t,s,!1,o[l],n,!0);return t.tmp[a+"-token"]=i,!0}return!1}function a(i,r,a,l){var u,p=CSL.LangPrefsMap[i[0]];return u=p?t.opt["cite-lang-prefs"][p]:!1,
+function(t,a,h){var c,f,m,d,g,b,_;if(!i[0]||!a[i[0]]&&!a[l])return null;var v={primary:!1,secondary:!1,tertiary:!1};if("_sort"===t.tmp.area.slice(-5))v.primary="locale-sort";else if(u)for(var y=["primary","secondary","tertiary"],x=0,I=y.length;I>x&&!(u.length-1<x);x+=1)u[x]&&(v[y[x]]="locale-"+u[x]);else v.primary="locale-orig";if(("title-short"===i[0]||"bibliography"!==t.tmp.area&&("citation"!==t.tmp.area||"note"!==t.opt.xclass||!h||h.position))&&(v.secondary=!1,v.tertiary=!1),t.tmp["publisher-list"])return"publisher"===i[0]?t.tmp["publisher-token"]=this:"publisher-place"===i[0]&&(t.tmp["publisher-place-token"]=this),null;var O=s.call(this,a,i[0],v.primary,!0);c=O.name,f=O.locale;var _=O.token,S=O.usedOrig;if(n(this,a,c,r))return null;if(m=!1,g=!1,v.secondary){O=s.call(this,a,i[0],v.secondary,!1,O.usedOrig),m=O.name,d=O.locale;var T=O.token}if(v.tertiary){O=s.call(this,a,i[0],v.tertiary,!1,O.usedOrig),g=O.name,b=O.locale;var A=O.token}r&&(c=e(t,a,l,c,r,!0),c&&(c=o(c)),m=e(t,a,!1,m,r,!0),g=e(t,a,!1,g,r,!0));var N;if("locale-translit"===v.primary&&(N=t.opt.citeAffixes[p][v.primary].prefix),"<i>"===N&&"title"===i[0]&&!S){for(var E=!1,x=0,I=_.decorations.length;I>x;x+=1)"@font-style"===_.decorations[x][0]&&"italic"===_.decorations[x][1]&&(E=!0);E||_.decorations.push(["@font-style","italic"])}if("en"!==f&&"title"===_.strings["text-case"]&&(_.strings["text-case"]="passthrough"),"title"===i[0]&&(c=CSL.demoteNoiseWords(t,c,this["leading-noise-words"])),m||g){if(t.output.openLevel("empty"),_.strings.suffix=_.strings.suffix.replace(/[ .,]+$/,""),t.output.append(c,_),m){T.strings.prefix=t.opt.citeAffixes[p][v.secondary].prefix,T.strings.suffix=t.opt.citeAffixes[p][v.secondary].suffix,T.strings.prefix||(T.strings.prefix=" ");for(var x=T.decorations.length-1;x>-1;x+=-1)["@quotes/true","@font-style/italic","@font-style/oblique","@font-weight/bold"].indexOf(T.decorations[x].join("/"))>-1&&(T.decorations=T.decorations.slice(0,x).concat(T.decorations.slice(x+1)));"en"!==d&&"title"===T.strings["text-case"]&&(T.strings["text-case"]="passthrough");var k=new CSL.Token;k.decorations.push(["@font-style","normal"]),k.decorations.push(["@font-weight","normal"]),t.output.openLevel(k),t.output.append(m,T),t.output.closeLevel();var R=t.output.current.value(),w=t.output.current.value().blobs.length-1;t.parallel.use_parallels&&(t.parallel.cite.front.push(i[0]+":secondary"),t.parallel.cite[i[0]+":secondary"]={blobs:[[R,w]]})}if(g){A.strings.prefix=t.opt.citeAffixes[p][v.tertiary].prefix,A.strings.suffix=t.opt.citeAffixes[p][v.tertiary].suffix,A.strings.prefix||(A.strings.prefix=" ");for(var x=A.decorations.length-1;x>-1;x+=-1)["@quotes/true","@font-style/italic","@font-style/oblique","@font-weight/bold"].indexOf(A.decorations[x].join("/"))>-1&&(A.decorations=A.decorations.slice(0,x).concat(A.decorations.slice(x+1)));"en"!==b&&"title"===A.strings["text-case"]&&(A.strings["text-case"]="passthrough");var L=new CSL.Token;L.decorations.push(["@font-style","normal"]),L.decorations.push(["@font-weight","normal"]),t.output.openLevel(L),t.output.append(g,A),t.output.closeLevel();var R=t.output.current.value(),w=t.output.current.value().blobs.length-1;t.parallel.use_parallels&&(t.parallel.cite.front.push(i[0]+":tertiary"),t.parallel.cite[i[0]+":tertiary"]={blobs:[[R,w]]})}t.output.closeLevel()}else t.output.append(c,_);return null}}function o(e){var i=e.match(/^!([-,_a-z]+)>>>/);if(i){var s=i[1].split(",");e=e.slice(i[0].length);for(var r=0,n=s.length;n>r;r+=1)-1===t.tmp.done_vars.indexOf(s[r])&&t.tmp.done_vars.push(s[r])}return e}this.abbrevs={},this.abbrevs["default"]=new t.sys.AbbreviationSegments,this.getTextSubField=s,this.loadAbbreviation=r,this.getOutputFunction=a,this.quashCheck=o},e.exports=CSL,CSL.Token=function(t,e){this.name=t,this.strings={},this.strings.delimiter=void 0,this.strings.prefix="",this.strings.suffix="",this.decorations=[],this.variables=[],this.execs=[],this.tokentype=e,this.evaluator=!1,this.tests=[],this.rawtests=[],this.succeed=!1,this.fail=!1,this.next=!1},CSL.Util.cloneToken=function(t){var e,i,s,r;if("string"==typeof t)return t;e=new CSL.Token(t.name,t.tokentype);for(var i in t.strings)t.strings.hasOwnProperty(i)&&(e.strings[i]=t.strings[i]);if(t.decorations)for(e.decorations=[],s=0,r=t.decorations.length;r>s;s+=1)e.decorations.push(t.decorations[s].slice());return t.variables&&(e.variables=t.variables.slice()),t.execs&&(e.execs=t.execs.slice(),e.tests=t.tests.slice(),e.rawtests=t.tests.slice()),e},e.exports=CSL,CSL.AmbigConfig=function(){this.maxvals=[],this.minval=1,this.names=[],this.givens=[],this.year_suffix=!1,this.disambiguate=0},e.exports=CSL,CSL.Blob=function(t,e,i){var s,r,n;if(this.levelname=i,e){this.strings={prefix:"",suffix:""};for(var n in e.strings)e.strings.hasOwnProperty(n)&&(this.strings[n]=e.strings[n]);for(this.decorations=[],s=void 0===e.decorations?0:e.decorations.length,r=0;s>r;r+=1)this.decorations.push(e.decorations[r].slice())}else this.strings={},this.strings.prefix="",this.strings.suffix="",this.strings.delimiter="",this.decorations=[];this.blobs="string"==typeof t?t:t?[t]:[],this.alldecor=[this.decorations]},CSL.Blob.prototype.push=function(t){if("string"==typeof this.blobs)throw"Attempt to push blob onto string object";!1!==t&&(t.alldecor=t.alldecor.concat(this.alldecor),this.blobs.push(t))},e.exports=CSL,CSL.NumericBlob=function(t,e,i,s){this.id=s,this.alldecor=[],this.num=e,this.particle=t,this.blobs=e.toString(),this.status=CSL.START,this.strings={},i?(this.gender=i.gender,this.decorations=i.decorations,this.strings.prefix=i.strings.prefix,this.strings.suffix=i.strings.suffix,this.strings["text-case"]=i.strings["text-case"],this.successor_prefix=i.successor_prefix,this.range_prefix=i.range_prefix,this.splice_prefix=i.splice_prefix,this.formatter=i.formatter,this.formatter||(this.formatter=new CSL.Output.DefaultFormatter),this.formatter&&(this.type=this.formatter.format(1))):(this.decorations=[],this.strings.prefix="",this.strings.suffix="",this.successor_prefix="",this.range_prefix="",this.splice_prefix="",this.formatter=new CSL.Output.DefaultFormatter)},CSL.NumericBlob.prototype.setFormatter=function(t){this.formatter=t,this.type=this.formatter.format(1)},CSL.Output.DefaultFormatter=function(){},CSL.Output.DefaultFormatter.prototype.format=function(t){return t.toString()},CSL.NumericBlob.prototype.checkNext=function(t,e){e?(this.status=CSL.START,"object"==typeof t&&(t.status=t.num===this.num+1?CSL.SUCCESSOR:CSL.SEEN)):t&&t.num&&this.type===t.type&&t.num===this.num+1?this.status===CSL.START||this.status===CSL.SEEN?t.status=CSL.SUCCESSOR:(this.status===CSL.SUCCESSOR||this.status===CSL.SUCCESSOR_OF_SUCCESSOR)&&(this.range_prefix?(t.status=CSL.SUCCESSOR_OF_SUCCESSOR,this.status=CSL.SUPPRESS):t.status=CSL.SUCCESSOR):(this.status===CSL.SUCCESSOR_OF_SUCCESSOR&&(this.status=CSL.END),"object"==typeof t&&(t.status=CSL.SEEN))},CSL.NumericBlob.prototype.checkLast=function(t){return this.status===CSL.SEEN||t.num!==this.num-1&&this.status===CSL.SUCCESSOR?(this.status=CSL.SUCCESSOR,!0):!1},e.exports=CSL,CSL.Util.fixDateNode=function(t,e,i){var s,r,n,a,o,l,u,p,h,c,f,m,d,g,b=this.cslXml.getAttributeValue(i,"lingo"),_=this.cslXml.getAttributeValue(i,"default-locale");this.build.date_key=!0,s=this.cslXml.getAttributeValue(i,"form");var b;if(b=_?this.opt["default-locale"][0]:this.cslXml.getAttributeValue(i,"lingo"),!this.getDate(s,_))return t;var v=this.cslXml.getAttributeValue(i,"date-parts");r=this.cslXml.getAttributeValue(i,"variable"),p=this.cslXml.getAttributeValue(i,"prefix"),h=this.cslXml.getAttributeValue(i,"suffix"),d=this.cslXml.getAttributeValue(i,"display"),g=this.cslXml.getAttributeValue(i,"cslid"),n=this.cslXml.nodeCopy(this.getDate(s,_)),this.cslXml.setAttribute(n,"lingo",this.opt.lang),this.cslXml.setAttribute(n,"form",s),this.cslXml.setAttribute(n,"date-parts",v),this.cslXml.setAttribute(n,"cslid",g),this.cslXml.setAttribute(n,"variable",r),this.cslXml.setAttribute(n,"default-locale",_),p&&this.cslXml.setAttribute(n,"prefix",p),h&&this.cslXml.setAttribute(n,"suffix",h),d&&this.cslXml.setAttribute(n,"display",d),c=this.cslXml.children(n);for(var f in c)a=c[f],"date-part"===this.cslXml.nodename(a)&&(o=this.cslXml.getAttributeValue(a,"name"),_&&this.cslXml.setAttributeOnNodeIdentifiedByNameAttribute(n,"date-part",o,"@default-locale","true"));c=this.cslXml.children(i);for(var f in c)if(a=c[f],"date-part"===this.cslXml.nodename(a)){o=this.cslXml.getAttributeValue(a,"name"),m=this.cslXml.attributes(a);for(l in m)"@name"!==l&&(b&&b!==this.opt.lang&&["@suffix","@prefix","@form"].indexOf(l)>-1||(u=m[l],this.cslXml.setAttributeOnNodeIdentifiedByNameAttribute(n,"date-part",o,l,u)))}if("year"===this.cslXml.getAttributeValue(i,"date-parts"))this.cslXml.deleteNodeByNameAttribute(n,"month"),this.cslXml.deleteNodeByNameAttribute(n,"day");else if("year-month"===this.cslXml.getAttributeValue(i,"date-parts"))this.cslXml.deleteNodeByNameAttribute(n,"day");else if("month-day"===this.cslXml.getAttributeValue(i,"date-parts")){for(var y=this.cslXml.children(n),x=1,I=this.cslXml.numberofnodes(y);I>x;x++)if("year"===this.cslXml.getAttributeValue(y[x],"name")){this.cslXml.setAttribute(y[x-1],"suffix","");break}this.cslXml.deleteNodeByNameAttribute(n,"year")}return this.cslXml.insertChildNodeAfter(t,i,e,n)},e.exports=CSL,CSL.dateMacroAsSortKey=function(t,e){CSL.dateAsSortKey.call(this,t,e,!0)},CSL.dateAsSortKey=function(t,e,i){var s,r,n,a,o,l,u,p,h=this.variables[0],c="empty";for(i&&t.tmp.extension&&(c="macro-with-date"),s=e[h],"undefined"==typeof s&&(s={"date-parts":[[0]]},s.year||(t.tmp.empty_date=!0)),"undefined"==typeof this.dateparts&&(this.dateparts=["year","month","day"]),s.raw?s=t.fun.dateparser.parseDateToArray(s.raw):s["date-parts"]&&(s=t.dateParseArray(s)),"undefined"==typeof s&&(s={}),u=0,p=CSL.DATE_PARTS_INTERNAL.length;p>u;u+=1)if(r=CSL.DATE_PARTS_INTERNAL[u],n=0,a=r,"_end"===a.slice(-4)&&(a=a.slice(0,-4)),s[r]&&this.dateparts.indexOf(a)>-1&&(n=s[r]),"year"===r.slice(0,4)){o=CSL.Util.Dates[a].numeric(t,n);var l="Y";"-"===o[0]&&(l="X",o=o.slice(1),o=9999-parseInt(o,10)),t.output.append(CSL.Util.Dates[r.slice(0,4)].numeric(t,l+o),c)}else n=CSL.Util.Dates[a]["numeric-leading-zeros"](t,n),n||(n="00"),t.output.append(n,c)},CSL.Engine.prototype.dateParseArray=function(t){var e,i,s,r;e={};for(i in t)if("date-parts"===i){s=t["date-parts"],s.length>1&&s[0].length!==s[1].length&&CSL.error("CSL data error: element mismatch in date range input."),r=["","_end"];for(var n=0,a=s.length;a>n;n+=1)for(var o=0,l=CSL.DATE_PARTS.length;l>o;o+=1)e[CSL.DATE_PARTS[o]+r[n]]="undefined"==typeof s[n][o]?s[n][o]:parseInt(s[n][o],10)}else t.hasOwnProperty(i)&&("literal"===i&&"object"==typeof t.literal&&"string"==typeof t.literal.part?(CSL.debug("Warning: fixing up weird literal date value"),e.literal=t.literal.part):e[i]=t[i]);return e},e.exports=CSL,CSL.Util.Names={},CSL.Util.Names.compareNamesets=CSL.NameOutput.prototype._compareNamesets,CSL.Util.Names.unInitialize=function(t,e){var i,s,r,n,a;if(!e)return"";for(r=e.split(/(?:\-|\s+)/),n=e.match(/(\-|\s+)/g),a="",i=0,s=r.length;s>i;i+=1)a+=r[i],s-1>i&&(a+=n[i]);return a},CSL.Util.Names.initializeWith=function(t,e,i,s){var r,n,a,o,l,u,p;if(!e)return"";if(i||(i=""),["Lord","Lady"].indexOf(e)>-1||!e.match(CSL.STARTSWITH_ROMANESQUE_REGEXP)&&!i.match("%s"))return e;var h=e;if(t.opt["initialize-with-hyphen"]===!1&&(h=h.replace(/\-/g," ")),h=h.replace(/\s*\-\s*/g,"-").replace(/\s+/g," "),h=h.replace(/-([a-z])/g,"–$1"),l=h.match(/[\-\s]+/g),u=h.split(/[\-\s]+/),0===u.length)h=l;else for(h=[u[0]],r=1,n=u.length;n>r;r+=1)h.push(l[r-1]),h.push(u[r]);for(u=h,r=u.length-1;r>-1;r+=-1)if(u[r]&&u[r].slice(0,-1).indexOf(".")>-1){var c=u.slice(r+1),f=u[r].slice(0,-1).split(".");for(u=u.slice(0,r),a=0,o=f.length;o>a;a+=1)u.push(f[a]+"."),a<f.length-1&&u.push(" ");u=u.concat(c)}return p=s?CSL.Util.Names.doNormalize(t,u,i):CSL.Util.Names.doInitialize(t,u,i),p=p.replace(/\u2013([a-z])/g,"-$1")},CSL.Util.Names.doNormalize=function(t,e,i){var s,r;i=i?i:"";var n=[];for(s=0,r=e.length;r>s;s+=1)e[s].length>1&&"."===e[s].slice(-1)?(e[s]=e[s].slice(0,-1),n.push(!0)):n.push(1===e[s].length&&e[s].toUpperCase()===e[s]?!0:!1);for(s=0,r=e.length;r>s;s+=2)if(n[s]){if(s<e.length-2){e[s+1]="";var a=i.match(/^[\u0009\u000a\u000b\u000c\u000d\u0020\u00a0]+$/);(a||(!i||i.slice(-1)&&!i.slice(-1).match(/[\u0009\u000a\u000b\u000c\u000d\u0020\u00a0]/))&&e[s].length&&e[s].match(CSL.ALL_ROMANESQUE_REGEXP)&&(e[s].length>1||e[s+2].length>1))&&(e[s+1]=" "),e[s]=e[s+2].length>1?e[s]+i.replace(/\ufeff$/,""):e[s]+i}s===e.length-1&&(e[s]=e[s]+i)}return e.join("").replace(/[\u0009\u000a\u000b\u000c\u000d\u0020\ufeff\u00a0]+$/,"").replace(/\s*\-\s*/g,"-").replace(/[\u0009\u000a\u000b\u000c\u000d\u0020]+/g," ")},CSL.Util.Names.doInitialize=function(t,e,i){var s,r,n,a,o,l,u;for(s=0,r=e.length;r>s;s+=2)if(u=e[s])if(n=u.match(CSL.NAME_INITIAL_REGEXP),!n&&!u.match(CSL.STARTSWITH_ROMANESQUE_REGEXP)&&u.length>1&&i.match("%s")&&(n=u.match(/(.)(.*)/)),n&&n[1]===n[1].toUpperCase()){var p="";if(n[2]){var h="";for(l=n[2].split(""),a=0,o=l.length;o>a;a+=1){var c=l[a];if(c!==c.toUpperCase())break;h+=c}h.length<n[2].length&&(p=h.toLocaleLowerCase())}e[s]=n[1].toLocaleUpperCase()+p,r-1>s?i.match("%s")?e[s]=i.replace("%s",e[s]):e[s+1]=e[s+1].indexOf("-")>-1?i+e[s+1]:i:i.match("%s")?e[s]=i.replace("%s",e[s]):e.push(i)}else u.match(CSL.ROMANESQUE_REGEXP)&&(e[s]=" "+u);var f=e.join("");return f=f.replace(/[\u0009\u000a\u000b\u000c\u000d\u0020\ufeff\u00a0]+$/,"").replace(/\s*\-\s*/g,"-").replace(/[\u0009\u000a\u000b\u000c\u000d\u0020]+/g," ")},CSL.Util.Names.getRawName=function(t){var e=[];return t.given&&e.push(t.given),t.family&&e.push(t.family),e.join(" ")},e.exports=CSL,CSL.Util.Dates={},CSL.Util.Dates.year={},CSL.Util.Dates.year["long"]=function(t,e){return e||(e="boolean"==typeof e?"":0),e.toString()},CSL.Util.Dates.year.imperial=function(t,e,i){var s="";e||(e="boolean"==typeof e?"":0),i=i?"_end":"";var r=t.tmp.date_object["month"+i];for(r=r?""+r:"1";r.length<2;)r="0"+r;var n=t.tmp.date_object["day"+i];for(n=n?""+n:"1";n.length<2;)n="0"+n;var a,o,l=parseInt(e+r+n,10);if(l>=18680908&&19120730>l?(a="明治",o=1867):l>=19120730&&19261225>l?(a="大正",o=1911):l>=19261225&&19890108>l?(a="昭和",o=1925):l>=19890108&&(a="平成",o=1988),a&&o){var u=a;t.sys.normalizeAbbrevsKey&&(u=t.sys.normalizeAbbrevsKey(a)),t.transform.abbrevs["default"].number[u]||t.transform.loadAbbreviation("default","number",u),t.transform.abbrevs["default"].number[u]&&(a=t.transform.abbrevs["default"].number[u]),s=a+(e-o)}return s},CSL.Util.Dates.year["short"]=function(t,e){return e=e.toString(),e&&4===e.length?e.substr(2):void 0},CSL.Util.Dates.year.numeric=function(t,e){var i,s;e=""+e;var i=e.match(/([0-9]*)$/);for(i?(s=e.slice(0,-1*i[1].length),e=i[1]):(s=e,e="");e.length<4;)e="0"+e;return s+e},CSL.Util.Dates.normalizeMonth=function(t,e){var i;if(t||(t=0),t=""+t,t.match(/^[0-9]+$/)||(t=0),t=parseInt(t,10),e){var s={stub:"month-",num:t};s.num<1||s.num>20?s.num=0:s.num>16?(s.stub="season-",s.num=s.num-16):s.num>12&&(s.stub="season-",s.num=s.num-12),i=s}else(1>t||t>12)&&(t=0),i=t;return i},CSL.Util.Dates.month={},CSL.Util.Dates.month.numeric=function(t,e){var e=CSL.Util.Dates.normalizeMonth(e);return e||(e=""),e},CSL.Util.Dates.month["numeric-leading-zeros"]=function(t,e){var e=CSL.Util.Dates.normalizeMonth(e);if(e)for(e=""+e;e.length<2;)e="0"+e;else e="";return e},CSL.Util.Dates.month["long"]=function(t,e,i,s){var r=CSL.Util.Dates.normalizeMonth(e,!0),e=r.num;if(e){for(e=""+e;e.length<2;)e="0"+e;e=t.getTerm(r.stub+e,"long",0,0,!1,s)}else e="";return e},CSL.Util.Dates.month["short"]=function(t,e,i,s){var r=CSL.Util.Dates.normalizeMonth(e,!0),e=r.num;if(e){for(e=""+e;e.length<2;)e="0"+e;e=t.getTerm(r.stub+e,"short",0,0,!1,s)}else e="";return e},CSL.Util.Dates.day={},CSL.Util.Dates.day.numeric=function(t,e){return e.toString()},CSL.Util.Dates.day["long"]=CSL.Util.Dates.day.numeric,CSL.Util.Dates.day["numeric-leading-zeros"]=function(t,e){for(e||(e=0),e=e.toString();e.length<2;)e="0"+e;return e.toString()},CSL.Util.Dates.day.ordinal=function(t,e,i){return t.fun.ordinalizer.format(e,i)},e.exports=CSL,CSL.Util.Sort={},CSL.Util.Sort.strip_prepositions=function(t){var e;return"string"==typeof t&&(e=t.toLocaleLowerCase(),e=t.match(/^((a|an|the)\s+)/)),e&&(t=t.substr(e[1].length)),t},e.exports=CSL,CSL.Util.substituteStart=function(t,e){var i,s,r,n,a,o,l;n=function(t){for(var e=0,i=this.decorations.length;i>e;e+=1)if("@strip-periods"===this.decorations[e][0]&&"true"===this.decorations[e][1]){t.tmp.strip_periods+=1;break}},this.execs.push(n),this.decorations&&(t.opt.development_extensions.csl_reverse_lookup_support||t.sys.csl_reverse_lookup_support)&&(this.decorations.reverse(),this.decorations.push(["@showid","true",this.cslid]),this.decorations.reverse()),l=["number","date","names"],("text"===this.name&&!this.postponed_macro||l.indexOf(this.name)>-1)&&(i=function(t,e,i){"author"===t.tmp.element_trace.value()||"names"===this.name?i&&i["author-only"]?t.tmp.element_trace.push("do-not-suppress-me"):i&&i["suppress-author"]:i&&i["author-only"]?t.tmp.element_trace.push("suppress-me"):i&&i["suppress-author"]&&t.tmp.element_trace.push("do-not-suppress-me")},this.execs.push(i)),s=this.strings.cls,this.strings.cls=!1,0===t.build.render_nesting_level&&("bibliography"===t.build.area&&t.bibliography.opt["second-field-align"]?(r=new CSL.Token("group",CSL.START),r.decorations=[["@display","left-margin"]],n=function(t,e){t.tmp.render_seen||(r.strings.first_blob=e.id,t.output.startTag("bib_first",r))},r.execs.push(n),e.push(r)):CSL.DISPLAY_CLASSES.indexOf(s)>-1&&(r=new CSL.Token("group",CSL.START),r.decorations=[["@display",s]],n=function(t,e){r.strings.first_blob=e.id,t.output.startTag("bib_first",r)},r.execs.push(n),e.push(r)),t.build.cls=s),t.build.render_nesting_level+=1,1===t.build.substitute_level.value()&&(a=new CSL.Token("choose",CSL.START),CSL.Node.choose.build.call(a,t,e),o=new CSL.Token("if",CSL.START),n=function(){return t.tmp.can_substitute.value()?!0:!1},o.tests.push(n),o.test=t.fun.match.any(this,t,o.tests),e.push(o)),t.sys.variableWrapper&&this.variables_real&&this.variables_real.length&&(n=function(t,e,i){if(!t.tmp.just_looking&&!t.tmp.suppress_decorations){var s=new CSL.Token("text",CSL.START);s.decorations=[["@showid","true"]],t.output.startTag("variable_entry",s);var r=null;i&&(r=i.position),r||(r=0);var n=["first","subsequent","ibid","ibid-with-locator"],a=0;i&&i.noteIndex&&(a=i.noteIndex);var o=0;i&&i["first-reference-note-number"]&&(o=i["first-reference-note-number"]);var l=0;i&&i["citation-number"]&&(l=i["citation-number"]);var u=0;i&&i.index&&(u=i.index);var p={itemData:e,variableNames:this.variables,context:t.tmp.area,xclass:t.opt.xclass,position:n[r],"note-number":a,"first-reference-note-number":o,"citation-number":l,index:u,mode:t.opt.mode};t.output.current.value().params=p}},this.execs.push(n))},CSL.Util.substituteEnd=function(t,e){var i,s,r,n,a,o,l;t.sys.variableWrapper&&(this.hasVariable||this.variables_real&&this.variables_real.length)&&(i=function(t){t.tmp.just_looking||t.tmp.suppress_decorations||t.output.endTag("variable_entry")},this.execs.push(i)),i=function(t){for(var e=0,i=this.decorations.length;i>e;e+=1)if("@strip-periods"===this.decorations[e][0]&&"true"===this.decorations[e][1]){t.tmp.strip_periods+=-1;break}},this.execs.push(i),t.build.render_nesting_level+=-1,0===t.build.render_nesting_level&&(t.build.cls?(i=function(t){t.output.endTag("bib_first")},this.execs.push(i),t.build.cls=!1):"bibliography"===t.build.area&&t.bibliography.opt["second-field-align"]&&(s=new CSL.Token("group",CSL.END),i=function(t){t.tmp.render_seen||t.output.endTag("bib_first")},s.execs.push(i),e.push(s),r=new CSL.Token("group",CSL.START),r.decorations=[["@display","right-inline"]],i=function(t){t.tmp.render_seen||(t.tmp.render_seen=!0,t.output.startTag("bib_other",r))},r.execs.push(i),e.push(r))),1===t.build.substitute_level.value()&&(n=new CSL.Token("if",CSL.END),e.push(n),a=new CSL.Token("choose",CSL.END),CSL.Node.choose.build.call(a,t,e)),("names"===this.name||"text"===this.name&&"title"!==this.variables_real)&&(o=new CSL.Token("text",CSL.SINGLETON),i=function(t,e){if("bibliography"===t.tmp.area&&"string"==typeof t.bibliography.opt["subsequent-author-substitute"]&&(!this.variables_real||e[this.variables_real])&&t.tmp.substituted_variable===this.variables_real){var i,s,r=t.bibliography.opt["subsequent-author-substitute-rule"],n=!t.tmp.suppress_decorations;if(n&&t.tmp.subsequent_author_substitute_ok&&t.tmp.rendered_name){if("partial-each"===r||"partial-first"===r){var a=!0,o=[];for(i=0,s=t.tmp.name_node.children.length;s>i;i+=1){var u=t.tmp.rendered_name[i];a&&t.tmp.last_rendered_name&&t.tmp.last_rendered_name.length>i-1&&u&&!u.localeCompare(t.tmp.last_rendered_name[i])?(l=new CSL.Blob(t[t.tmp.area].opt["subsequent-author-substitute"]),t.tmp.name_node.children[i].blobs=[l],"partial-first"===r&&(a=!1)):a=!1,o.push(u)}t.tmp.last_rendered_name=o}else if("complete-each"===r){var o=t.tmp.rendered_name.join(",");if(o){if(t.tmp.last_rendered_name&&!o.localeCompare(t.tmp.last_rendered_name))for(i=0,s=t.tmp.name_node.children.length;s>i;i+=1)l=new CSL.Blob(t[t.tmp.area].opt["subsequent-author-substitute"]),t.tmp.name_node.children[i].blobs=[l];t.tmp.last_rendered_name=o}}else{var o=t.tmp.rendered_name.join(",");o&&(t.tmp.last_rendered_name&&!o.localeCompare(t.tmp.last_rendered_name)&&(l=new CSL.Blob(t[t.tmp.area].opt["subsequent-author-substitute"]),t.tmp.label_blob?t.tmp.name_node.top.blobs=[l,t.tmp.label_blob]:t.tmp.name_node.top.blobs.length?t.tmp.name_node.top.blobs[0].blobs=[l]:t.tmp.name_node.top.blobs=[l],t.tmp.substituted_variable=this.variables_real),t.tmp.last_rendered_name=o)}t.tmp.subsequent_author_substitute_ok=!1}}},this.execs.push(i)),("text"===this.name&&!this.postponed_macro||["number","date","names"].indexOf(this.name)>-1)&&(i=function(t){t.tmp.element_trace.pop()},this.execs.push(i))},e.exports=CSL,CSL.Util.padding=function(t){var e=t.match(/\s*(-{0,1}[0-9]+)/);if(e)for(t=parseInt(e[1],10),0>t&&(t=1e20+t),t=""+t;t.length<20;)t="0"+t;return t},CSL.Util.LongOrdinalizer=function(){},CSL.Util.LongOrdinalizer.prototype.init=function(t){this.state=t},CSL.Util.LongOrdinalizer.prototype.format=function(t,e){10>t&&(t="0"+t);var i=CSL.Engine.getField(CSL.LOOSE,this.state.locale[this.state.opt.lang].terms,"long-ordinal-"+t,"long",0,e);return i||(i=this.state.fun.ordinalizer.format(t,e)),this.state.tmp.cite_renders_content=!0,i},CSL.Util.Ordinalizer=function(t){this.state=t,this.suffixes={}},CSL.Util.Ordinalizer.prototype.init=function(){if(!this.suffixes[this.state.opt.lang]){this.suffixes[this.state.opt.lang]={};for(var t=0,e=3;e>t;t+=1){var i=[void 0,"masculine","feminine"][t];this.suffixes[this.state.opt.lang][i]=[];for(var s=1;5>s;s+=1){var r=this.state.getTerm("ordinal-0"+s,"long",!1,i);if("undefined"==typeof r){delete this.suffixes[this.state.opt.lang][i];break}this.suffixes[this.state.opt.lang][i].push(r)}}}},CSL.Util.Ordinalizer.prototype.format=function(t,e){var i;t=parseInt(t,10),i=""+t;var s="",r=[];if(e&&r.push(e),r.push("neuter"),this.state.locale[this.state.opt.lang].ord["1.0.1"]){s=this.state.getTerm("ordinal",!1,0,e);for(var n,a=0,o=r.length;o>a;a+=1){n=r[a];var l=this.state.locale[this.state.opt.lang].ord["1.0.1"];if(l["whole-number"][i]&&l["whole-number"][i][n]?s=this.state.getTerm(this.state.locale[this.state.opt.lang].ord["1.0.1"]["whole-number"][i][n],!1,0,e):l["last-two-digits"][i.slice(i.length-2)]&&l["last-two-digits"][i.slice(i.length-2)][n]?s=this.state.getTerm(this.state.locale[this.state.opt.lang].ord["1.0.1"]["last-two-digits"][i.slice(i.length-2)][n],!1,0,e):l["last-digit"][i.slice(i.length-1)]&&l["last-digit"][i.slice(i.length-1)][n]&&(s=this.state.getTerm(this.state.locale[this.state.opt.lang].ord["1.0.1"]["last-digit"][i.slice(i.length-1)][n],!1,0,e)),s)break}}else e||(e=void 0),this.state.fun.ordinalizer.init(),s=t/10%10===1||t>10&&20>t?this.suffixes[this.state.opt.lang][e][3]:t%10===1&&t%100!==11?this.suffixes[this.state.opt.lang][e][0]:t%10===2&&t%100!==12?this.suffixes[this.state.opt.lang][e][1]:t%10===3&&t%100!==13?this.suffixes[this.state.opt.lang][e][2]:this.suffixes[this.state.opt.lang][e][3];return i=i+=s},CSL.Util.Romanizer=function(){},CSL.Util.Romanizer.prototype.format=function(t){var e,i,s,r,n;if(e="",6e3>t)for(r=t.toString().split(""),r.reverse(),i=0,s=0,n=r.length,i=0;n>i;i+=1)s=parseInt(r[i],10),e=CSL.ROMAN_NUMERALS[i][s]+e;return e},CSL.Util.Suffixator=function(t){t||(t=CSL.SUFFIX_CHARS),this.slist=t.split(",")},CSL.Util.Suffixator.prototype.format=function(t){var e;t+=1;var i="";do{e=t%26===0?26:t%26;var i=this.slist[e-1]+i;t=(t-e)/26}while(0!==t);return i},CSL.Engine.prototype.processNumber=function(t,e,i){function s(t){t=t.trim();var s=t.match(/^([^ ]+)/);if(s&&!CSL.STATUTE_SUBDIV_STRINGS[s[1]]){var r=null;r="locator"===i?e.label?CSL.STATUTE_SUBDIV_STRINGS_REVERSE[e.label]:"p.":CSL.STATUTE_SUBDIV_STRINGS_REVERSE[i],r&&(t=r+" "+t)}return t}function r(t,e,s,r){r=r?r:"";var n={};if(e||CSL.STATUTE_SUBDIV_STRINGS_REVERSE[i]||(e="var:"+i),e){var a=e.match(/(\s*)([^\s]*)(\s*)/);n.label=a[2],n.origLabel=t,n.labelSuffix=a[3]?a[3]:"",n.plural=0,n.labelVisibility=!1}var a=s.match(/^([a-zA-Z0]*)([0-9]+(?:[a-zA-Z]*|[-,a-zA-Z]+))$/);return a?(n.particle=a[1],n.value=a[2]):(n.particle="",n.value=s),n.joiningSuffix=r.replace(/\s*-\s*/,"-"),n}function n(t){for(var e=t.length-2;e>-1;e-=2)"-"===t[e]&&t[e-1].match(/^(?:(?:[a-z]|[a-z][a-z]|[a-z][a-z][a-z]|[a-z][a-z][a-z][a-z])\.  *)*[0-9]+[,a-zA-Z]+$/)&&t[e+1].match(/^[,a-zA-Z]+$/)&&(t[e-1]=t.slice(e-1,e+2).join(""),t=t.slice(0,e).concat(t.slice(e+2)));return t}function a(t,e){e=e?e:"",t=s(t,e);var a=[],o=t.match(/(,\s+|\s*\\*[\-\u2013]+\s*|\s*&\s*)/g);if(o){for(var l=t.split(/(?:,\s+|\s*\\*[\-\u2013]+\s*|\s*&\s*)/),u=0,p=l.length-1;p>u;u++)a.push(l[u]),a.push(o[u]);a.push(l[l.length-1]),a=n(a)}else var a=[t];for(var h=[],c=e,f="",u=0,p=a.length;p>u;u+=2){var o=a[u].match(/((?:^| )(?:[a-z]|[a-z][a-z]|[a-z][a-z][a-z]|[a-z][a-z][a-z][a-z])\. *)/g);if(o){for(var l=a[u].split(/(?:(?:^| )(?:[a-z]|[a-z][a-z]|[a-z][a-z][a-z]|[a-z][a-z][a-z][a-z])\. *)/),m=l.length-1;m>0;m--)!l[m-1]||l[m].match(/^[0-9]+([-,:a-zA-Z]*)$/)&&l[m-1].match(/^[0-9]+([-,:a-zA-Z]*)$/)||(l[m-1]=l[m-1]+o[m-1]+l[m],l=l.slice(0,m).concat(l.slice(m+1)),o=o.slice(0,m-1).concat(o.slice(m)));if(o.length>0&&0===u){var d=o[0].trim();(!CSL.STATUTE_SUBDIV_STRINGS[d]||!v.getTerm(CSL.STATUTE_SUBDIV_STRINGS[d])||-1===["locator","number"].indexOf(i)&&CSL.STATUTE_SUBDIV_STRINGS[d]!==i)&&(o=o.slice(1),l[0]=l[0]+" "+d+" "+l[1],l=l.slice(0,1).concat(l.slice(2)))}for(var m=0,g=l.length;g>m;m++)if(l[m]||m===l.length-1){c=o[m-1]?o[m-1]:c;var f=m>1?o[m-1]:"",t=l[m]?l[m].trim():"";h.push(m===l.length-1?r(f,c,t,a[u+1]):r(f,c,t))}}else h.push(r(f,c,a[u],a[u+1]))}return h}function o(t){for(var e=0,i=t.length-1;i>e;e++)!t[e].joiningSuffix&&t[e+1].label&&(t[e].joiningSuffix=" ")}function l(t,e,i){var s=t[i.pos],r=t[e].value,n="\\-"===s.joiningSuffix;r.particle&&r.particle!==s.particle&&(i.collapsible=!1);var a=r.match(/^[0-9]+([-,:a-zA-Z]*)$/),o=s.value.match(/^[0-9]+([-,:a-zA-Z]*)$/);r&&a&&o&&!n||(i.collapsible=!1,r&&o||(i.numeric=!1),n&&i.count--),(a&&a[1]||o&&o[1])&&(i.collapsible=!1);var l=i.collapsible;!l&&e>0&&r.match(/^[ivxlcmIVXLCM]+$/)&&t[e-1].value.match(/^[ivxlcmIVXLCM]+$/)&&(l=!0);for(var u=i.pos,p=t.length;p>u;u++)i.label===t[u].label&&i.count>1&&l&&(t[u].plural=1),t[u].numeric=i.numeric,t[u].collapsible=i.collapsible;i.label=t[e].label,i.count=1,i.pos=e,i.numeric=!0,i.collapsible=!0}function u(t){for(var s={label:null,count:1,numeric:!0,collapsible:!0,pos:0},r=(t.length?t[0].label:null,0),n=t.length;n>r;r++)t[r].label&&(t[r].label===s.label?s.count++:(l(t,r,s),0===s.pos?(("locator"===i||"number"===i)&&(v.getTerm(CSL.STATUTE_SUBDIV_STRINGS[s.label])||"var:"===s.label.slice(0,4)||(t[s.pos].labelVisibility=!0)),-1===["locator","number"].indexOf(i)&&CSL.STATUTE_SUBDIV_STRINGS[s.label]!==i&&"var:"!==s.label.slice(0,4)&&(t[0].labelVisibility=!0)):t[r-1].label!==t[r].label&&"var:"!==s.label.slice(0,4)&&(t[s.pos].labelVisibility=!0)));l(t,t.length-1,s),t.length&&t[0].numeric&&"number-of-"===i.slice(0,10)&&parseInt(e[i],10)>1&&(t[0].plural=1);for(var r=0,n=t.length;n>r;r++)if(!t[r].numeric){var a=t[r].origLabel?t[r].origLabel:"";t[r].value=(a+t[r].value).trim(),t[r].label!==t[0].label&&(t[r].label="")}}function p(e){var i=CSL.Util.cloneToken(t),s=new CSL.Token;if(!v.tmp.just_looking){for(var r=i.decorations.length-1;r>-1;r--)"@quotes"===i.decorations[r][0]&&(s.decorations=s.decorations.concat(i.decorations.slice(r,r+1)),i.decorations=i.decorations.slice(0,r).concat(i.decorations.slice(r+1)));s.strings.prefix=i.strings.prefix,i.strings.prefix="",s.strings.suffix=i.strings.suffix,i.strings.suffix=""}var n=e.length?e[0].label:null;if(e.length){for(var a=0,o=e.length;o>a;a++){var l=e[a],u=CSL.Util.cloneToken(i);u.gender=t.gender,n===l.label&&(u.formatter=t.formatter),l.numeric&&(u.successor_prefix=l.successor_prefix),u.strings.suffix=u.strings.suffix+h(l.joiningSuffix),l.styling=u}v.tmp.just_looking||'"'===e[0].value.slice(0,1)&&'"'===e[e.length-1].value.slice(-1)&&(e[0].value=e[0].value.slice(1),e[e.length-1].value=e[e.length-1].value.slice(0,-1),s.decorations.push(["@quotes",!0]))}return s}function h(t){return t.replace("\\-","-")}function c(t,e,i,s){var r=f(t,e),n=m(t,e);return n&&"-"===i&&s&&((r||["locator","issue","volume","edition","number"].indexOf(t)>-1)&&(i=v.getTerm("page-range-delimiter"),i||(i="–")),"collection-number"===t&&(i=v.getTerm("year-range-delimiter"),i||(i="–"))),i}function f(t,e){return"page"===t||"locator"===t&&["p."].indexOf(e.label)>-1}function m(t,e){var i=!0;return"locator"===t&&(i=!!v.getTerm(CSL.STATUTE_SUBDIV_STRINGS[e.label])),i}function d(t,e,s){if(!(1>e)&&2===s.count&&t[e-1].particle===t[e].particle){if("-"!==t[e-1].joiningSuffix)return void(s.count=1);if(!v.opt["page-range-format"]&&parseInt(t[e-1].value,10)>parseInt(t[e].value,10))return void(t[e-1].joiningSuffix=c(i,t[e],t[e-1].joiningSuffix,!0));var r=t[e],n=f(i,r);if(n){var a=t[e-1].particle+t[e-1].value+" - "+t[e].particle+t[e].value;a=v.fun.page_mangler(a)}else a=t[e-1].value+h(t[e-1].joiningSuffix)+t[e].value;var o=a.match(/^([a-zA-Z]?0*)([0-9]+)(\s*[^0-9]+\s*)([-,a-zA-Z]?0*)([0-9]+)$/);if(o){var l=o[3];l=c(i,r,l,t[e].numeric),t[e-1].particle=o[1],t[e-1].value=o[2],t[e-1].joiningSuffix=l,t[e].particle=o[4],t[e].value=o[5]}s.count=0}}function g(e){if(t&&-1!==["page","page-first","chapter-number","collection-number","edition","issue","number","number-of-pages","number-of-volumes","volume","locator"].indexOf(i)){for(var s={count:0,label:null,lastHadRangeDelimiter:!1},r=0,n=e.length;n>r;r++){var a=e[r];if(a.collapsible)s.label===a.label&&"-"===a.joiningSuffix?s.count=1:s.label===a.label&&"-"!==a.joiningSuffix?(s.count++,2===s.count&&d(e,r,s)):s.label!==a.label?(s.label=a.label,s.count=1):(s.count=1,s.label=a.label);else{s.count=0,s.label=null;var o=a.numeric;r<e.length-1&&!o&&a.value.match(/^[ivxlcmIVXLCM]+$/)&&e[r+1].value.match(/^[ivxlcmIVXLCM]+$/)&&(o=!0),a.joiningSuffix=c(i,a,a.joiningSuffix,o)}}2===s.count&&d(e,e.length-1,s)}}function b(t,e,i){var s=t[e];i.length&&(s.numeric=i[0].numeric,s.collapsible=i[0].collapsible,s.plural=i[0].plural,s.label=CSL.STATUTE_SUBDIV_STRINGS[i[0].label],"number"===e&&"issue"===s.label&&v.getTerm("number")&&(s.label="number"))}var _,v=this;if(t&&this.tmp.shadow_numbers[i]&&this.tmp.shadow_numbers[i].values.length){var y=this.tmp.shadow_numbers[i].values;return g(y),void(this.tmp.shadow_numbers[i].masterStyling=p(y))}if(this.tmp.shadow_numbers[i]||(this.tmp.shadow_numbers[i]={values:[]}),e){var x=CSL.LangPrefsMap[i];if(x){var I=this.opt["cite-lang-prefs"][x][0];_=this.transform.getTextSubField(e,i,"locale-"+I,!0),_=_.name}else _=e[i];if(_&&this.sys.getAbbreviation){var O=this.transform.loadAbbreviation(e.jurisdiction,"number",_);this.transform.abbrevs[O].number&&(this.transform.abbrevs[O].number[_]?_=this.transform.abbrevs[O].number[_]:"undefined"!=typeof this.transform.abbrevs[O].number[_]&&delete this.transform.abbrevs[O].number[_]);
+
+}if("undefined"!=typeof _&&("string"==typeof _||"number"==typeof _)){"number"==typeof _&&(_=""+_);var S=CSL.STATUTE_SUBDIV_STRINGS_REVERSE[i];if(!this.tmp.shadow_numbers.values){var y=a(_,S);o(y),u(y),this.tmp.shadow_numbers[i].values=y}t&&(g(y),this.tmp.shadow_numbers[i].masterStyling=p(y)),b(this.tmp.shadow_numbers,i,y)}}},CSL.Util.outputNumericField=function(t,e,i){t.output.openLevel(t.tmp.shadow_numbers[e].masterStyling);var s,r=t.tmp.shadow_numbers[e].values,n=r.length?r[0].label:null,a=t.tmp.shadow_numbers[e].labelForm;s=a?a:"short";for(var o=t.tmp.shadow_numbers[e].labelDecorations,l=null,u=0,p=r.length;p>u;u++){var h=r[u],c="";if(h.label){var f;f="var:"===h.label.slice(0,4)?h.label.slice(4):CSL.STATUTE_SUBDIV_STRINGS[h.label],f&&(c=h.label===n?t.getTerm(f,a,h.plural):t.getTerm(f,s,h.plural))}var m=-1;c&&(m=c.indexOf("%s"));var d=CSL.Util.cloneToken(h.styling);if(d.formatter=h.styling.formatter,d.type=h.styling.type,d.num=h.styling.num,d.gender=h.styling.gender,m>0&&m<c.length-2)d.strings.prefix+=c.slice(0,m),d.strings.suffix=c.slice(m+2)+d.strings.suffix;else if(h.labelVisibility)if(c||(c=h.label,f=h.label),m>0){var g=new CSL.Token;g.decorations=o,t.output.append(c.slice(0,m),g)}else(m===c.length-2||-1===m)&&t.output.append(c+h.labelSuffix,"empty");if(h.collapsible){if(h.value.match(/^[0-9]+$/))var b=new CSL.NumericBlob(h.particle,parseInt(h.value,10),d,i);else var b=new CSL.NumericBlob(h.particle,h.value,d,i);"undefined"==typeof b.gender&&(b.gender=t.locale[t.opt.lang]["noun-genders"][e]),t.output.append(b,"literal")}else t.output.append(h.particle+h.value,d);if(0===m&&m<c.length-2&&(null===l&&(l=f),f!==l||u===r.length-1)){var _=new CSL.Token;_.decorations=o,t.output.append(c.slice(m+2),_)}}t.output.closeLevel()},e.exports=CSL,CSL.Util.PageRangeMangler={},CSL.Util.PageRangeMangler.getFunction=function(t,e){var i,s,r,n,a,o,l,u,p,h,c,f,m,d,g,b,_,v=t.getTerm(e+"-range-delimiter");i=/([a-zA-Z]*)([0-9]+)\s*(?:\u2013|-)\s*([a-zA-Z]*)([0-9]+)/,n=function(i){for(r=i.length,s=1;r>s;s+=2)"object"==typeof i[s]&&(i[s]=i[s].join(""));var n=i.join("");return n=n.replace(/([^\\])\-/g,"$1"+t.getTerm(e+"-range-delimiter"))},a=function(t){var e,i,n,a="\\s+\\-\\s+",o="-"===v?"":v,l=new RegExp("([^\\\\])[-"+o+"\\u2013]","g");t=t.replace(l,"$1 - ").replace(/\s+-\s+/g," - ");var u=new RegExp("([a-zA-Z]*[0-9]+"+a+"[a-zA-Z]*[0-9]+)","g"),p=new RegExp("[a-zA-Z]*[0-9]+"+a+"[a-zA-Z]*[0-9]+");if(e=t.match(u),i=t.split(p),0===i.length)n=e;else for(n=[i[0]],s=1,r=i.length;r>s;s+=1)n.push(e[s-1].replace(/\s*\-\s*/g,"-")),n.push(i[s]);return n},o=function(t){for(t=""+t,h=a(t),r=h.length,s=1;r>s;s+=2)c=h[s].match(i),c&&(c[3]&&c[1]!==c[3]||(c[4].length<c[2].length&&(c[4]=c[2].slice(0,c[2].length-c[4].length)+c[4]),parseInt(c[2],10)<parseInt(c[4],10)&&(c[3]=v+c[1],h[s]=c.slice(1)))),"string"==typeof h[s]&&(h[s]=h[s].replace(/\-/g,v));return h},l=function(t,e,i){r=t.length;for(var s=1,a=t.length;a>s;s+=2)t[s][3]=u(t[s][1],t[s][3],e,i),t[s][2].slice(1)===t[s][0]&&(t[s][2]=v);return n(t)},u=function(t,e,i,s){if(i||(i=0),f=(""+t).split(""),m=(""+e).split(""),d=m.slice(),d.reverse(),f.length===m.length)for(var r=0,n=f.length;n>r;r+=1){if(!(f[r]===m[r]&&d.length>i)){if(i&&s&&3===d.length){var a=f.slice(0,r);a.reverse(),d=d.concat(a)}break}d.pop()}return d.reverse(),d.join("")},p=function(t){for(r=t.length,s=1;r>s;s+=2)"object"==typeof t[s]&&(c=t[s],g=parseInt(c[1],10),b=parseInt(c[3],10),g>100&&g%100&&parseInt(g/100,10)===parseInt(b/100,10)?c[3]=""+b%100:g>=1e4&&(c[3]=""+b%1e3)),c[2].slice(1)===c[0]&&(c[2]=v);return n(t)};var y=function(t,e,i,s){var r;t=""+t;var n=o(t),r=e(n,i,s);return r};return t.opt[e+"-range-format"]?"expanded"===t.opt[e+"-range-format"]?_=function(t){return y(t,n)}:"minimal"===t.opt[e+"-range-format"]?_=function(t){return y(t,l)}:"minimal-two"===t.opt[e+"-range-format"]?_=function(t,e){return y(t,l,2,e)}:"chicago"===t.opt[e+"-range-format"]&&(_=function(t){return y(t,p)}):_=function(t){return y(t,n)},_},e.exports=CSL,CSL.Util.FlipFlopper=function(t){function e(t){var e={" '":' "',' "':" '",'("':"('","('":'("'};c[t].outer="true",c[e[t]].outer="inner"}function i(t){for(var e=[],i=Object.keys(c),s=0,r=i.length;r>s;s++){var n=i[s];"quote"===c[t].type&&c[t]||e.push(n)}var a=c[t];return a.opener=new RegExp("^(?:"+e.map(function(t){return t.replace("(","\\(")}).join("|")+")"),a}function s(t,e){return r(t,e)}function r(t,e){return t.match(_.open)?n(t,e):a(t,e)}function n(t,e){var i=h[h.length-1];return!i||t.match(i.opener)?(h.push({type:b[t].type,opener:b[t].opener,closer:b[t].closer,pos:e}),!1):(h.pop(),h.push({type:b[t].type,opener:b[t].opener,closer:b[t].closer,pos:e}),{fixtag:i.pos})}function a(t,e){var i=h[h.length-1];return i&&t===i.closer?(h.pop(),"nocase"===i.type?{nocase:{open:i.pos,close:e}}:!1):i?{fixtag:i.pos}:{fixtag:e}}function o(t){var e=[];t=t.replace(/(<span)\s+(style=\"font-variant:)\s*(small-caps);?\"[^>]*(>)/g,'$1 $2$3;"$4'),t=t.replace(/(<span)\s+(class=\"no(?:case|decor)\")[^>]*(>)/g,"$1 $2$3");var i=t.match(_.matchAll);if(!i)return{tags:[],strings:[t],forcedSpaces:[]};for(var s=t.split(_.splitAll),r=0,n=i.length-1;n>r;r++)c[i[r]]&&(""===s[r+1]&&['"',"'"].indexOf(i[r+1])>-1?(i[r+1]=" "+i[r+1],e.push(!0)):e.push(!1));return{tags:i,strings:s,forcedSpaces:e}}function l(t,e){if("'"===t){if(e&&e.match(/^[^\,\.\?\:\;\ ]/))return!0}else if(" '"===t&&e&&e.match(/^[\ ]/))return!0;return!1}function u(e,i,s){function r(e){this.stack=[e],this.latest=e,this.addStyling=function(e,i){if(n&&(" "===e.slice(0,1)&&(e=e.slice(1))," "===e.slice(0,1)&&(e=e.slice(1)),n=!1),this.latest=this.stack[this.stack.length-1],i){if("string"==typeof this.latest.blobs){var s=new CSL.Blob;s.blobs=this.latest.blobs,s.alldecor=this.latest.alldecor.slice(),this.latest.blobs=[s]}var r=new CSL.Token,a=new CSL.Blob(null,r);if(a.alldecor=this.latest.alldecor.slice(),"@class"===i[0]&&"nodecor"===i[1]){for(var o=[],l={},u=[t[t.tmp.area].opt.layout_decorations].concat(a.alldecor),p=u.length-1;p>-1;p--){var h=u[p];if(h)for(var c=h.length-1;c>-1;c--){var f=h[c];["@font-weight","@font-style","@font-variant"].indexOf(f[0])>-1&&!l[f[0]]&&("normal"!==i[1]&&(a.decorations.push([f[0],"normal"]),o.push([f[0],"normal"])),l[f[0]]=!0)}}a.alldecor.push(o)}else a.decorations.push(i),a.alldecor.push([i]);if(this.latest.blobs.push(a),this.stack.push(a),this.latest=a,e){var r=new CSL.Token,a=new CSL.Blob(null,r);a.blobs=e,a.alldecor=this.latest.alldecor.slice(),this.latest.blobs.push(a)}}else if(e){var s=new CSL.Blob;s.blobs=e,s.alldecor=this.latest.alldecor.slice(),this.latest.blobs.push(s)}},this.popStyling=function(){this.stack.pop()}}var n=!0,a=new v(e);e.blobs=[];var o=new r(e);if(i.strings.length){var l=i.strings[0];s&&(l=" "+l),o.addStyling(l)}for(var u=0,p=i.tags.length;p>u;u++){var h=i.tags[u],l=i.strings[u+1];h.match(_.open)?(a.set(h),o.addStyling(l,a.pair())):(a.pop(),o.popStyling(),o.addStyling(l))}}function p(t){var i=t.blobs,r=!1;" "!==i.slice(0,1)||i.match(/^\s+[\'\"]/)||(r=!0);var i=" "+i,n=o(i);if(0!==n.tags.length){for(var a=!1,p=0,c=n.tags.length;c>p;p++){var f=n.tags[p],i=n.strings[p+1];if(l(f,i))n.strings[p+1]=" '"===f?" ’"+n.strings[p+1]:"’"+n.strings[p+1],n.tags[p]="";else{for(var m;;){if(m=s(f,p),!m)break;if(!(Object.keys(m).indexOf("fixtag")>-1)){if(m.nocase){n.tags[m.nocase.open]="",n.tags[m.nocase.close]="";break}break}if(f.match(_.close)&&"'"===f)n.strings[p+1]="’"+n.strings[p+1],n.tags[p]="";else{var d=n.tags[m.fixtag];n.forcedSpaces[m.fixtag-1]&&(d=d.slice(1)),n.strings[m.fixtag+1]=d+n.strings[m.fixtag+1],n.tags[m.fixtag]=""}if(!(h.length>0))break;h.pop()}m&&(m.fixtag||0===m.fixtag)&&(n.strings[p+1]=n.tags[p]+n.strings[p+1],n.tags[p]="")}}for(var p=h.length-1;p>-1;p--){var g=h[p].pos,f=n.tags[g];n.strings[g+1]=" '"===f||"'"===f?" ’"+n.strings[g+1]:n.tags[g]+n.strings[g+1],n.tags[g]="",h.pop()}for(var p=n.tags.length-1;p>-1;p--)n.tags[p]||(n.tags=n.tags.slice(0,p).concat(n.tags.slice(p+1)),n.strings[p]=n.strings[p]+n.strings[p+1],n.strings=n.strings.slice(0,p+1).concat(n.strings.slice(p+2)));for(var p=0,c=n.tags.length;c>p;p++){var f=n.tags[p],b=n.forcedSpaces[p-1];[' "'," '",'("',"('"].indexOf(f)>-1&&(a||(e(f),a=!0),b||(n.strings[p]+=f.slice(0,1)))}u(t,n,r)}}this.processTags=p;var h=[],c={'<span class="nocase">':{type:"nocase",opener:'<span class="nocase">',closer:"</span>",attr:null,outer:null,flipflop:null},'<span class="nodecor">':{type:"nodecor",opener:'<span class="nodecor">',closer:"</span>",attr:"@class",outer:"nodecor",flipflop:{nodecor:"nodecor"}},'<span style="font-variant:small-caps;">':{type:"tag",opener:'<span style="font-variant:small-caps;">',closer:"</span>",attr:"@font-variant",outer:"small-caps",flipflop:{"small-caps":"normal",normal:"small-caps"}},"<sc>":{type:"tag",opener:"<sc>",closer:"</sc>",attr:"@font-variant",outer:"small-caps",flipflop:{"small-caps":"normal",normal:"small-caps"}},"<i>":{type:"tag",opener:"<i>",closer:"</i>",attr:"@font-style",outer:"italic",flipflop:{italic:"normal",normal:"italic"}},"<b>":{type:"tag",opener:"<b>",closer:"</b>",attr:"@font-weight",outer:"bold",flipflop:{bold:"normal",normal:"bold"}},"<sup>":{type:"tag",opener:"<sup>",closer:"</sup>",attr:"@vertical-align",outer:"sup",flipflop:{sub:"sup",sup:"sup"}},"<sub>":{type:"tag",opener:"<sub>",closer:"</sub>",attr:"@vertical-align",outer:"sub",flipflop:{sup:"sub",sub:"sub"}},' "':{type:"quote",opener:' "',closer:'"',attr:"@quotes",outer:"true",flipflop:{"true":"inner",inner:"true","false":"true"}}," '":{type:"quote",opener:" '",closer:"'",attr:"@quotes",outer:"inner",flipflop:{"true":"inner",inner:"true","false":"true"}}};c['("']=c[' "'],c["('"]=c[" '"];var f=t.getTerm("open-quote"),m=t.getTerm("close-quote"),d=t.getTerm("open-inner-quote"),g=t.getTerm("close-inner-quote");f&&m&&-1===[' "'," '",'"',"'"].indexOf(f)&&(c[f]=JSON.parse(JSON.stringify(c[' "'])),c[f].opener=f,c[f].closer=m),d&&g&&-1===[' "'," '",'"',"'"].indexOf(d)&&(c[d]=JSON.parse(JSON.stringify(c[" '"])),c[d].opener=d,c[d].closer=g);var b=(function(){for(var t={},e=Object.keys(c),i=0,s=e.length;s>i;i++){var r=e[i];"quote"===c[r].type&&(t[c[r].closer]=c[r])}return t}(),function(){for(var t={},e=Object.keys(c),i=0,s=e.length;s>i;i++){var r=e[i];if("nocase"!==c[r].type){var n=c[r].attr,a=c[r].outer,o=c[r].flipflop[c[r].outer];t[n+"/"+a]=c[r],t[n+"/"+o]=c[r]}}return t}(),function(){for(var t={},e=Object.keys(c),s=0,r=e.length;r>s;s++){var n=e[s];t[n]=i(n)}return t}()),_=function(){var t=[],e=[],i={};for(var s in b)t.push(s),i[b[s].closer]=!0;for(var r=Object.keys(i),n=0,a=r.length;a>n;n++){var o=r[n];e.push(o)}var l=t.concat(e).map(function(t){return t.replace("(","\\(")}).join("|");return{matchAll:new RegExp("((?:"+l+"))","g"),splitAll:new RegExp("(?:"+l+")","g"),open:new RegExp("(^(?:"+t.map(function(t){return t.replace("(","\\(")}).join("|")+")$)"),close:new RegExp("(^(?:"+e.join("|")+")$)")}}(),v=function(e){function i(i){for(var s=c[i].attr,r=null,a=n.length-1;a>-1;a--){var o=n[a];if(o[0]===s){r=o;break}}if(!r){var l=[t[t.tmp.area].opt.layout_decorations].concat(e.alldecor);t:for(var a=l.length-1;a>-1;a--){var u=l[a];if(u)for(var p=u.length-1;p>-1;p--){var o=u[p];if(o[0]===s){r=o;break t}}}}r=r?[s,c[i].flipflop[r[1]]]:[s,c[i].outer],n.push(r)}function s(){return n[n.length-1]}function r(){n.pop()}this.set=i,this.pair=s,this.pop=r;var n=[]}},e.exports=CSL,CSL.Output.Formatters=new function(){function t(t){var e=t.match(/(^\s*)((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))(.*)/);return!e||e[2].match(/^[\u0370-\u03FF]$/)&&!e[3]?t:e[1]+e[2].toUpperCase()+e[3]}function e(e,i){function s(t,e){var i=t.match(/(^(?:\u2018|\u2019|\u201C|\u201D|\"|\')|(?: \"| \')$)/);return i?r(i[1],e):void 0}function r(t,e){var i=["“","‘",' "'," '"].indexOf(t)>-1?!0:!1;return i?n(t,e):a(t,e)}function n(t,i){if(0===e.quoteState.length||t===e.quoteState[e.quoteState.length-1].opener)return e.quoteState.push({opener:o[t].opener,closer:o[t].closer,pos:i}),!1;var s=e.quoteState[e.quoteState.length-1].pos;return e.quoteState.pop(),e.quoteState.push({opener:o[t].opener,closer:o[t].closer,positions:i}),s}function a(t,i){return e.quoteState.length>0&&t===e.quoteState[e.quoteState.length-1].closer?void e.quoteState.pop():i}if(!i)return"";e.doppel=p.split(i);var o={' "':{opener:" '",closer:'"'}," '":{opener:' "',closer:"'"},"‘":{opener:"‘",closer:"’"},"“":{opener:"“",closer:"”"}};e.doppel.strings.length&&e.doppel.strings[0].trim()&&(e.doppel.strings[0]=e.capitaliseWords(e.doppel.strings[0],0,e.doppel.tags[0]));for(var l=0,u=e.doppel.tags.length;u>l;l++){var f=e.doppel.tags[l],m=e.doppel.strings[l+1];if(null!==e.tagState&&(c[f]?e.tagState.push(c[f]):e.tagState.length&&f===e.tagState[e.tagState.length-1]&&e.tagState.pop()),null!==e.afterPunct&&f.match(/[\!\?\:]$/)&&(e.afterPunct=!0),0===e.tagState.length?e.doppel.strings[l+1]=e.capitaliseWords(m,l+1,e.doppel,e.doppel.tags[l+1]):e.doppel.strings[l+1].trim()&&(e.lastWordPos=null),null!==e.quoteState){var d=s(f,l);if(d||0===d){var g=e.doppel.origStrings[d+1].slice(0,1);e.doppel.strings[d+1]=g+e.doppel.strings[d+1].slice(1),e.lastWordPos=null}}e.isFirst&&m.trim()&&(e.isFirst=!1),e.afterPunct&&m.trim()&&(e.afterPunct=!1)}if(e.quoteState)for(var l=0,u=e.quoteState.length;u>l;l++){var d=e.quoteState[l].pos;if("undefined"!=typeof d){var g=e.doppel.origStrings[d+1].slice(0,1);e.doppel.strings[d+1]=g+e.doppel.strings[d+1].slice(1)}}if(e.lastWordPos){var b=h.split(e.doppel.strings[e.lastWordPos.strings]),_=t(b.strings[e.lastWordPos.words]);b.strings[e.lastWordPos.words]=_,e.doppel.strings[e.lastWordPos.strings]=h.join(b)}return p.join(e.doppel)}function i(t,e){return e}function s(t,i){var s={quoteState:null,capitaliseWords:function(t){for(var e=t.split(" "),i=0,s=e.length;s>i;i++){var r=e[i];r&&(e[i]=r.toLowerCase())}return e.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:null};return e(s,i)}function r(t,i){var s={quoteState:null,capitaliseWords:function(t){for(var e=t.split(" "),i=0,s=e.length;s>i;i++){var r=e[i];r&&(e[i]=r.toUpperCase())}return e.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:null};return e(s,i)}function n(i,s){var r={quoteState:[],capitaliseWords:function(e){for(var i=e.split(" "),s=0,n=i.length;n>s;s++){var a=i[s];a&&(r.isFirst?(i[s]=t(a),r.isFirst=!1):i[s]=a.toLowerCase())}return i.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:!0};return e(r,s)}function a(i,s){var r={quoteState:[],capitaliseWords:function(e,i,s){if(e.trim()){for(var n=e.split(/[ \u00A0]+/),a=h.split(e),n=a.strings,o=0,l=n.length;l>o;o++){var u=n[o];u&&(u.length>1&&!u.toLowerCase().match(r.skipWordsRex)?n[o]=t(n[o]):o===n.length-1&&"-"===s?n[o]=t(n[o]):r.isFirst?n[o]=t(n[o]):r.afterPunct&&(n[o]=t(n[o])),r.afterPunct=!1,r.isFirst=!1,r.lastWordPos={strings:i,words:o})}e=h.join(a)}return e},skipWordsRex:i.locale[i.opt.lang].opts["skip-words-regexp"],tagState:[],afterPunct:!1,isFirst:!0};return e(r,s)}function o(i,s){var r={quoteState:[],capitaliseWords:function(e){for(var i=e.split(" "),s=0,n=i.length;n>s;s++){var a=i[s];if(a&&r.isFirst){i[s]=t(a),r.isFirst=!1;break}}return i.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:!0};return e(r,s)}function l(i,s){var r={quoteState:[],capitaliseWords:function(e){for(var i=e.split(" "),s=0,r=i.length;r>s;s++){var n=i[s];n&&(i[s]=t(n))}return i.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:null};return e(r,s)}this.passthrough=i,this.lowercase=s,this.uppercase=r,this.sentence=n,this.title=a,this["capitalize-first"]=o,this["capitalize-all"]=l;var u='(?:‘|’|“|”| "| \'|"|\'|[-–—/.,;?!:]|\\[|\\]|\\(|\\)|<span style="font-variant: small-caps;">|<span class="no(?:case|decor)">|</span>|</?(?:i|sc|b|sub|sup)>)',p=new CSL.Doppeler(u,function(t){return t.replace(/(<span)\s+(class=\"no(?:case|decor)\")[^>]*(>)/g,"$1 $2$3").replace(/(<span)\s+(style=\"font-variant:)\s*(small-caps);?(\")[^>]*(>)/g,"$1 $2 $3;$4$5")}),h=new CSL.Doppeler("(?:[   -​  ]+)"),c={'<span style="font-variant: small-caps;">':"</span>",'<span class="nocase">':"</span>",'<span class="nodecor">':"</span>"}},e.exports=CSL,CSL.Output.Formats=function(){},CSL.Output.Formats.prototype.html={text_escape:function(t){return t||(t=""),t.replace(/&/g,"&#38;").replace(/</g,"&#60;").replace(/>/g,"&#62;").replace(/\s\s/g,"  ").replace(CSL.SUPERSCRIPTS_REGEXP,function(t){return"<sup>"+CSL.SUPERSCRIPTS[t]+"</sup>"})},bibstart:'<div class="csl-bib-body">\n',bibend:"</div>","@font-style/italic":"<i>%%STRING%%</i>","@font-style/oblique":"<em>%%STRING%%</em>","@font-style/normal":'<span style="font-style:normal;">%%STRING%%</span>',"@font-variant/small-caps":'<span style="font-variant:small-caps;">%%STRING%%</span>',"@passthrough/true":CSL.Output.Formatters.passthrough,"@font-variant/normal":'<span style="font-variant:normal;">%%STRING%%</span>',"@font-weight/bold":"<b>%%STRING%%</b>","@font-weight/normal":'<span style="font-weight:normal;">%%STRING%%</span>',"@font-weight/light":!1,"@text-decoration/none":'<span style="text-decoration:none;">%%STRING%%</span>',"@text-decoration/underline":'<span style="text-decoration:underline;">%%STRING%%</span>',"@vertical-align/sup":"<sup>%%STRING%%</sup>","@vertical-align/sub":"<sub>%%STRING%%</sub>","@vertical-align/baseline":'<span style="baseline">%%STRING%%</span>',"@strip-periods/true":CSL.Output.Formatters.passthrough,"@strip-periods/false":CSL.Output.Formatters.passthrough,"@quotes/true":function(t,e){return"undefined"==typeof e?t.getTerm("open-quote"):t.getTerm("open-quote")+e+t.getTerm("close-quote")},"@quotes/inner":function(t,e){return"undefined"==typeof e?"’":t.getTerm("open-inner-quote")+e+t.getTerm("close-inner-quote")},"@quotes/false":!1,"@cite/entry":function(t,e){return t.sys.wrapCitationEntry(e,this.item_id,this.locator_txt,this.suffix_txt)},"@bibliography/entry":function(t,e){var i="";return t.sys.embedBibliographyEntry&&(i=t.sys.embedBibliographyEntry(this.item_id)+"\n"),'  <div class="csl-entry">'+e+"</div>\n"+i},"@display/block":function(t,e){return'\n\n    <div class="csl-block">'+e+"</div>\n"},"@display/left-margin":function(t,e){return'\n    <div class="csl-left-margin">'+e+"</div>"},"@display/right-inline":function(t,e){return'<div class="csl-right-inline">'+e+"</div>\n  "},"@display/indent":function(t,e){return'<div class="csl-indent">'+e+"</div>\n  "},"@showid/true":function(t,e,i){if(t.tmp.just_looking||t.tmp.suppress_decorations)return e;if(i)return'<span class="'+t.opt.nodenames[i]+'" cslid="'+i+'">'+e+"</span>";if(this.params&&"string"==typeof e){var s="";if(e){var r=e.match(CSL.VARIABLE_WRAPPER_PREPUNCT_REX);s=r[1],e=r[2]}var n="";return e&&CSL.SWAPPING_PUNCTUATION.indexOf(e.slice(-1))>-1&&(n=e.slice(-1),e=e.slice(0,-1)),t.sys.variableWrapper(this.params,s,e,n)}return e},"@URL/true":function(t,e){return'<a href="'+e+'">'+e+"</a>"},"@DOI/true":function(t,e){var i=e;return e.match(/^https?:\/\//)||(i="https://doi.org/"+e),'<a href="'+i+'">'+e+"</a>"}},CSL.Output.Formats.prototype.text={text_escape:function(t){return t||(t=""),t},bibstart:"",bibend:"","@font-style/italic":!1,"@font-style/oblique":!1,"@font-style/normal":!1,"@font-variant/small-caps":!1,"@passthrough/true":CSL.Output.Formatters.passthrough,"@font-variant/normal":!1,"@font-weight/bold":!1,"@font-weight/normal":!1,"@font-weight/light":!1,"@text-decoration/none":!1,"@text-decoration/underline":!1,"@vertical-align/baseline":!1,"@vertical-align/sup":!1,"@vertical-align/sub":!1,"@strip-periods/true":CSL.Output.Formatters.passthrough,"@strip-periods/false":CSL.Output.Formatters.passthrough,"@quotes/true":function(t,e){return"undefined"==typeof e?t.getTerm("open-quote"):t.getTerm("open-quote")+e+t.getTerm("close-quote")},"@quotes/inner":function(t,e){return"undefined"==typeof e?"’":t.getTerm("open-inner-quote")+e+t.getTerm("close-inner-quote")},"@quotes/false":!1,"@cite/entry":function(t,e){return t.sys.wrapCitationEntry(e,this.item_id,this.locator_txt,this.suffix_txt)},"@bibliography/entry":function(t,e){return e+"\n"},"@display/block":function(t,e){return"\n"+e},"@display/left-margin":function(t,e){return e},"@display/right-inline":function(t,e){return e},"@display/indent":function(t,e){return"\n    "+e},"@showid/true":function(t,e){return e},"@URL/true":function(t,e){return e},"@DOI/true":function(t,e){return e}},CSL.Output.Formats.prototype.rtf={text_escape:function(t){return t||(t=""),t.replace(/([\\{}])/g,"\\$1").replace(CSL.SUPERSCRIPTS_REGEXP,function(t){return"\\super "+CSL.SUPERSCRIPTS[t]+"\\nosupersub{}"}).replace(/[\u007F-\uFFFF]/g,function(t){return"\\uc0\\u"+t.charCodeAt(0).toString()+"{}"}).split("	").join("\\tab{}")},"@passthrough/true":CSL.Output.Formatters.passthrough,"@font-style/italic":"{\\i{}%%STRING%%}","@font-style/normal":"{\\i0{}%%STRING%%}","@font-style/oblique":"{\\i{}%%STRING%%}","@font-variant/small-caps":"{\\scaps %%STRING%%}","@font-variant/normal":"{\\scaps0{}%%STRING%%}","@font-weight/bold":"{\\b{}%%STRING%%}","@font-weight/normal":"{\\b0{}%%STRING%%}","@font-weight/light":!1,"@text-decoration/none":!1,"@text-decoration/underline":"{\\ul{}%%STRING%%}","@vertical-align/baseline":!1,"@vertical-align/sup":"\\super %%STRING%%\\nosupersub{}","@vertical-align/sub":"\\sub %%STRING%%\\nosupersub{}","@strip-periods/true":CSL.Output.Formatters.passthrough,"@strip-periods/false":CSL.Output.Formatters.passthrough,"@quotes/true":function(t,e){return"undefined"==typeof e?CSL.Output.Formats.rtf.text_escape(t.getTerm("open-quote")):CSL.Output.Formats.rtf.text_escape(t.getTerm("open-quote"))+e+CSL.Output.Formats.rtf.text_escape(t.getTerm("close-quote"))},"@quotes/inner":function(t,e){return"undefined"==typeof e?CSL.Output.Formats.rtf.text_escape("’"):CSL.Output.Formats.rtf.text_escape(t.getTerm("open-inner-quote"))+e+CSL.Output.Formats.rtf.text_escape(t.getTerm("close-inner-quote"))},"@quotes/false":!1,bibstart:"{\\rtf ",bibend:"}","@display/block":"\\line{}%%STRING%%\\line\r\n","@cite/entry":function(t,e){return t.sys.wrapCitationEntry(e,this.item_id,this.locator_txt,this.suffix_txt)},"@bibliography/entry":function(t,e){return e},"@display/left-margin":function(t,e){return e+"\\tab "},"@display/right-inline":function(t,e){return e+"\r\n"},"@display/indent":function(t,e){return"\n\\tab "+e+"\\line\r\n"},"@showid/true":function(t,e){if(t.tmp.just_looking||t.tmp.suppress_decorations)return e;var i="";if(e){var s=e.match(CSL.VARIABLE_WRAPPER_PREPUNCT_REX);i=s[1],e=s[2]}var r="";return e&&CSL.SWAPPING_PUNCTUATION.indexOf(e.slice(-1))>-1&&(r=e.slice(-1),e=e.slice(0,-1)),t.sys.variableWrapper(this.params,i,e,r)},"@URL/true":function(t,e){return e},"@DOI/true":function(t,e){return e}},CSL.Output.Formats=new CSL.Output.Formats,e.exports=CSL,CSL.Registry=function(t){this.debug=!1,this.state=t,this.registry={},this.reflist=[],this.refhash={},this.namereg=new CSL.Registry.NameReg(t),this.citationreg=new CSL.Registry.CitationReg(t),this.authorstrings={},this.mylist=[],this.myhash={},this.deletes=[],this.inserts=[],this.uncited={},this.refreshes={},this.akeys={},this.oldseq={},this.return_data={},this.ambigcites={},this.ambigresets={},this.sorter=new CSL.Registry.Comparifier(t,"bibliography_sort"),this.getSortedIds=function(){for(var t=[],e=0,i=this.reflist.length;i>e;e+=1)t.push(""+this.reflist[e].id);return t},this.getSortedRegistryItems=function(){for(var t=[],e=0,i=this.reflist.length;i>e;e+=1)t.push(this.reflist[e]);return t}},CSL.Registry.prototype.init=function(t,e){var i,s;if(this.oldseq={},e){this.uncited={};for(var i=0,s=t.length;s>i;i+=1)this.myhash[t[i]]||this.mylist.push(""+t[i]),this.uncited[t[i]]=!0,this.myhash[t[i]]=!0}else{for(var r in this.uncited)t.push(r);var n={};for(i=t.length-1;i>-1;i+=-1)n[t[i]]?t=t.slice(0,i).concat(t.slice(i+1)):n[t[i]]=!0;this.mylist=[];for(var i=0,s=t.length;s>i;i+=1)this.mylist.push(""+t[i]);this.myhash=n}this.refreshes={},this.touched={},this.ambigsTouched={},this.ambigresets={}},CSL.Registry.prototype.dopurge=function(t){for(var e=this.mylist.length-1;e>-1;e+=-1)this.citationreg.citationsByItemId&&(this.citationreg.citationsByItemId[this.mylist[e]]||t[this.mylist[e]]||(delete this.myhash[this.mylist[e]],this.mylist=this.mylist.slice(0,e).concat(this.mylist.slice(e+1))));this.dodeletes(this.myhash)},CSL.Registry.prototype.dodeletes=function(t){var e,i,s,r,n,a,o,l,u;"string"==typeof t&&(t={},t[t]=!0);for(var i in this.registry)if(!t[i]){if(this.uncited[i])continue;e=this.namereg.delitems(i);for(o in e)this.refreshes[o]=!0;for(s=this.registry[i].ambig,l=this.ambigcites[s].indexOf(i),l>-1&&(a=this.ambigcites[s].slice(),this.ambigcites[s]=a.slice(0,l).concat(a.slice(l+1,a.length)),this.ambigresets[s]=this.ambigcites[s].length),n=this.ambigcites[s].length,r=0;n>r;r+=1)u=""+this.ambigcites[s][r],this.refreshes[u]=!0;if(this.registry[i].siblings)if(1==this.registry[i].siblings.length){var p=this.registry[i].siblings[0];this.registry[p].master=!0,this.registry[p].siblings.pop(),this.registry[p].parallel=!1}else if(this.registry[i].siblings.length>1){var h=[i];if(this.registry[i].master){var c=this.registry[i].siblings[0],f=this.registry[c];f.master=!0,f.parallel=!1,h.push(c);for(var m=0,d=this.registry[i].siblings.length;d>m;m+=1)this.registry[this.registry[i].siblings[m]].parallel=c}for(var g=[],m=this.registry[i].siblings.length-1;m>-1;m+=-1){var b=this.registry[i].siblings.pop();-1===h.indexOf(b)&&g.push(b)}for(var m=g.length-1;m>-1;m+=-1)this.registry[i].siblings.push(g[m])}delete this.registry[i],delete this.refhash[i],this.return_data.bibchange=!0}},CSL.Registry.prototype.doinserts=function(t){var e,i,s,r,n,a,o;"string"==typeof t&&(t=[t]);for(var a=0,o=t.length;o>a;a+=1)e=t[a],this.registry[e]||(i=this.state.retrieveItem(e),s=CSL.getAmbiguousCite.call(this.state,i),this.ambigsTouched[s]=!0,i.legislation_id||(this.akeys[s]=!0),r={id:""+e,seq:0,offset:0,sortkeys:!1,ambig:!1,rendered:!1,disambig:!1,ref:i},this.registry[e]=r,this.citationreg.citationsByItemId&&this.citationreg.citationsByItemId[e]&&(this.registry[e]["first-reference-note-number"]=this.citationreg.citationsByItemId[e][0].properties.noteIndex),n=CSL.getAmbigConfig.call(this.state),this.registerAmbigToken(s,e,n),this.touched[e]=!0,this.return_data.bibchange=!0)},CSL.Registry.prototype.rebuildlist=function(){var t,e,i;for(this.reflist=[],this.state.opt.citation_number_sort_direction===CSL.DESCENDING&&this.state.opt.citation_number_sort_used,t=this.mylist.length,e=0;t>e;e+=1)i=this.mylist[e],this.reflist.push(this.registry[i]),this.oldseq[i]=this.registry[i].seq,this.registry[i].seq=e+1;this.state.opt.citation_number_sort_direction===CSL.DESCENDING&&this.state.opt.citation_number_sort_used},CSL.Registry.prototype.dorefreshes=function(){var t,e,i,s,r;for(var t in this.refreshes)if(e=this.registry[t]){e.sortkeys=void 0,i=this.state.retrieveItem(t);var s=e.ambig;"undefined"==typeof s&&(this.state.tmp.disambig_settings=!1,s=CSL.getAmbiguousCite.call(this.state,i),r=CSL.getAmbigConfig.call(this.state),this.registerAmbigToken(s,t,r));for(var n in this.ambigresets)if(1===this.ambigresets[n]){var a=this.ambigcites[s][0],i=this.state.retrieveItem(a);this.registry[a].disambig=new CSL.AmbigConfig,this.state.tmp.disambig_settings=!1;var s=CSL.getAmbiguousCite.call(this.state,i),r=CSL.getAmbigConfig.call(this.state);this.registerAmbigToken(s,a,r)}this.state.tmp.taintedItemIDs[t]=!0,this.ambigsTouched[s]=!0,i.legislation_id||(this.akeys[s]=!0),this.touched[t]=!0}},CSL.Registry.prototype.setdisambigs=function(){var t;this.leftovers=[];for(t in this.ambigsTouched)this.state.disambiguate.run(t);this.ambigsTouched={},this.akeys={}},CSL.Registry.prototype.renumber=function(){var t,e,i;for(this.state.opt.citation_number_sort_direction===CSL.DESCENDING&&this.state.opt.citation_number_sort_used,t=this.reflist.length,e=0;t>e;e+=1)i=this.reflist[e],i.seq=e+1,this.state.opt.update_mode===CSL.NUMERIC&&i.seq!=this.oldseq[i.id]&&(this.state.tmp.taintedItemIDs[i.id]=!0),this.state.opt.bib_mode===CSL.NUMERIC&&i.seq!=this.oldseq[i.id]&&(this.return_data.bibchange=!0);this.state.opt.citation_number_sort_direction===CSL.DESCENDING&&this.state.opt.citation_number_sort_used&&this.reflist.reverse()},CSL.Registry.prototype.setsortkeys=function(){for(var t,e=0,i=this.mylist.length;i>e;e+=1){var t=this.mylist[e];(this.touched[t]||this.state.tmp.taintedItemIDs[t]||!this.registry[t].sortkeys)&&(this.registry[t].sortkeys=CSL.getSortKeys.call(this.state,this.state.retrieveItem(t),"bibliography_sort"))}},CSL.Registry.prototype.sorttokens=function(){this.reflist.sort(this.sorter.compareKeys)},CSL.Registry.Comparifier=function(t,e){var i,s,r,n,a=CSL.getSortCompare(t.opt["default-locale-sort"]);i=t[e].opt.sort_directions,this.compareKeys=function(t,e){for(s=t.sortkeys?t.sortkeys.length:0,r=0;s>r;r+=1){var n=0;if(n=t.sortkeys[r]===e.sortkeys[r]?0:"undefined"==typeof t.sortkeys[r]?i[r][1]:"undefined"==typeof e.sortkeys[r]?i[r][0]:a(t.sortkeys[r],e.sortkeys[r]),n>0)return i[r][1];if(0>n)return i[r][0]}return t.seq>e.seq?1:t.seq<e.seq?-1:0},n=this.compareKeys,this.compareCompositeKeys=function(t,e){return n(t[1],e[1])}},CSL.Registry.prototype.compareRegistryTokens=function(t,e){return t.seq>e.seq?1:t.seq<e.seq?-1:0},CSL.Registry.prototype.registerAmbigToken=function(t,e,i){if(this.registry[e]&&this.registry[e].disambig&&this.registry[e].disambig.names)for(var s=0,r=i.names.length;r>s;s+=1){var n=i.names[s],a=this.registry[e].disambig.names[s];if(n!==a)this.state.tmp.taintedItemIDs[e]=!0;else if(i.givens[s])for(var o=0,l=i.givens[s].length;l>o;o+=1){var u=i.givens[s][o],p=this.registry[e].disambig.givens[s][o];u!==p&&(this.state.tmp.taintedItemIDs[e]=!0)}}this.ambigcites[t]||(this.ambigcites[t]=[]),-1===this.ambigcites[t].indexOf(""+e)&&this.ambigcites[t].push(""+e),this.registry[e].ambig=t;this.registry[e].disambig=CSL.cloneAmbigConfig(i)},CSL.getSortKeys=function(t,e){var i,s,r,n,a,o;for(i=this.tmp.area,s=this.tmp.root,r=this.tmp.extension,n=CSL.Util.Sort.strip_prepositions,this.tmp.area=e,this.tmp.root=e.indexOf("_")>-1?e.slice(0,-5):e,this.tmp.extension="_sort",this.tmp.disambig_override=!0,this.tmp.disambig_request=!1,this.parallel.use_parallels=this.parallel.use_parallels===!0||null===this.parallel.use_parallels?null:!1,this.tmp.suppress_decorations=!0,CSL.getCite.call(this,t),this.tmp.suppress_decorations=!1,this.parallel.use_parallels=null===this.parallel.use_parallels?!0:!1,this.tmp.disambig_override=!1,a=this[e].keys.length,o=0;a>o;o+=1)this[e].keys[o]=n(this[e].keys[o]);return this.tmp.area=i,this.tmp.root=s,this.tmp.extension=r,this[e].keys},e.exports=CSL,CSL.Registry.NameReg=function(t){var e,i,s,r,n,a,o,l,u,p,h,c;this.state=t,this.namereg={},this.nameind={},this.nameindpkeys={},this.itemkeyreg={},o=function(t){return t||(t=""),t.replace(/\./g," ").replace(/\s+/g," ").replace(/\s+$/,"")},l=function(t,r,n){e=o(n.family),s=o(n.given);var a=s.match(/[,\!]* ([^,]+)$/);a&&a[1]===a[1].toLowerCase()&&(s=s.replace(/[,\!]* [^,]+$/,"")),i=CSL.Util.Names.initializeWith(t,s,"%s"),"by-cite"===t.citation.opt["givenname-disambiguation-rule"]&&(e=""+r+e)},u=function(s,a,o,u,p,h){var c;if("bibliography"===t.tmp.area.slice(0,12)&&!p)return"string"==typeof h?1:2;var f=t.nameOutput.getName(a,"locale-translit",!0);a=f.name,l(this.state,""+s,a),c=2,r=t.opt["disambiguate-add-givenname"],n=t.citation.opt["givenname-disambiguation-rule"];var m=n;return"by-cite"===n&&(n="all-names"),"short"===p?c=0:"string"==typeof h&&(c=1),"undefined"==typeof this.namereg[e]||"undefined"==typeof this.namereg[e].ikey[i]?c:"by-cite"===m&&u>=c?u:r?"string"==typeof n&&"primary-name"===n.slice(0,12)&&o>0?c:(n&&"all-names"!==n&&"primary-name"!==n?("all-names-with-initials"===n||"primary-name-with-initials"===n)&&(c=this.namereg[e].count>1?1:0):(this.namereg[e].count>1&&(c=1),(this.namereg[e].ikey&&this.namereg[e].ikey[i].count>1||this.namereg[e].count>1&&"string"!=typeof h)&&(c=2)),t.registry.registry[s]?c:"short"==p?0:"string"==typeof h?1:void 0):c},p=function(r){var n,o,l,u,p;("string"==typeof r||"number"==typeof r)&&(r=[""+r]);var h={};
+
+for(o=r.length,n=0;o>n;n+=1)if(u=""+r[n],this.nameind[u]){for(p in this.nameind[u])if(this.nameind[u].hasOwnProperty(p)){var f=p.split("::");if(e=f[0],i=f[1],s=f[2],"undefined"==typeof this.namereg[e])continue;if(a=this.namereg[e].items,s&&this.namereg[e].ikey[i]&&this.namereg[e].ikey[i].skey[s]&&(c=this.namereg[e].ikey[i].skey[s].items,l=c.indexOf(""+u),l>-1&&(this.namereg[e].ikey[i].skey[s].items=c.slice(0,l).concat(c.slice([l+1]))),0===this.namereg[e].ikey[i].skey[s].items.length&&(delete this.namereg[e].ikey[i].skey[s],this.namereg[e].ikey[i].count+=-1,this.namereg[e].ikey[i].count<2)))for(var m=0,d=this.namereg[e].ikey[i].items.length;d>m;m+=1)t.tmp.taintedItemIDs[this.namereg[e].ikey[i].items[m]]=!0;if(i&&this.namereg[e].ikey[i]&&(l=this.namereg[e].ikey[i].items.indexOf(""+u),l>-1&&(a=this.namereg[e].ikey[i].items.slice(),this.namereg[e].ikey[i].items=a.slice(0,l).concat(a.slice([l+1]))),0===this.namereg[e].ikey[i].items.length&&(delete this.namereg[e].ikey[i],this.namereg[e].count+=-1,this.namereg[e].count<2)))for(var m=0,d=this.namereg[e].items.length;d>m;m+=1)t.tmp.taintedItemIDs[this.namereg[e].items[m]]=!0;e&&(l=this.namereg[e].items.indexOf(""+u),l>-1&&(a=this.namereg[e].items.slice(),this.namereg[e].items=a.slice(0,l).concat(a.slice([l+1],a.length))),this.namereg[e].items.length<2&&delete this.namereg[e]),delete this.nameind[u][p]}delete this.nameind[u],delete this.nameindpkeys[u]}return h},h=function(r,n,a){var o,u,p=t.nameOutput.getName(n,"locale-translit",!0);if(n=p.name,!t.citation.opt["givenname-disambiguation-rule"]||"primary-"!==t.citation.opt["givenname-disambiguation-rule"].slice(0,8)||0===a){if(l(this.state,""+r,n),e&&("undefined"==typeof this.namereg[e]?(this.namereg[e]={},this.namereg[e].count=0,this.namereg[e].ikey={},this.namereg[e].items=[r]):-1===this.namereg[e].items.indexOf(r)&&this.namereg[e].items.push(r)),e&&i)if("undefined"==typeof this.namereg[e].ikey[i]){if(this.namereg[e].ikey[i]={},this.namereg[e].ikey[i].count=0,this.namereg[e].ikey[i].skey={},this.namereg[e].ikey[i].items=[r],this.namereg[e].count+=1,2===this.namereg[e].count)for(var o=0,u=this.namereg[e].items.length;u>o;o+=1)t.tmp.taintedItemIDs[this.namereg[e].items[o]]=!0}else-1===this.namereg[e].ikey[i].items.indexOf(r)&&this.namereg[e].ikey[i].items.push(r);if(e&&i&&s)if("undefined"==typeof this.namereg[e].ikey[i].skey[s]){if(this.namereg[e].ikey[i].skey[s]={},this.namereg[e].ikey[i].skey[s].items=[r],this.namereg[e].ikey[i].count+=1,2===this.namereg[e].ikey[i].count)for(var o=0,u=this.namereg[e].ikey[i].items.length;u>o;o+=1)t.tmp.taintedItemIDs[this.namereg[e].ikey[i].items[o]]=!0}else-1===this.namereg[e].ikey[i].skey[s].items.indexOf(r)&&this.namereg[e].ikey[i].skey[s].items.push(r);"undefined"==typeof this.nameind[r]&&(this.nameind[r]={},this.nameindpkeys[r]={}),e&&(this.nameind[r][e+"::"+i+"::"+s]=!0,this.nameindpkeys[r][e]=this.namereg[e])}},this.addname=h,this.delitems=p,this.evalname=u},e.exports=CSL,CSL.Registry.CitationReg=function(){this.citationById={},this.citationByIndex=[]},e.exports=CSL,CSL.Disambiguation=function(t){this.state=t,this.sys=this.state.sys,this.registry=t.registry.registry,this.ambigcites=t.registry.ambigcites,this.configModes(),this.debug=!1},CSL.Disambiguation.prototype.run=function(t){this.modes.length&&(this.akey=t,this.initVars(t)&&this.runDisambig())},CSL.Disambiguation.prototype.runDisambig=function(){var t;for(this.initGivens=!0;this.lists.length;){for(this.gnameset=0,this.gname=0,this.clashes=[1,0];this.lists[0][1].length;){this.listpos=0,this.base||(this.base=this.lists[0][0]);t=this.incrementDisambig(),this.scanItems(this.lists[0]),this.evalScan(t)}this.lists=this.lists.slice(1)}},CSL.Disambiguation.prototype.scanItems=function(t){var e,i,s;this.Item=t[1][0],this.ItemCite=CSL.getAmbiguousCite.call(this.state,this.Item,this.base,!0),this.scanlist=t[1],this.partners=[],this.partners.push(this.Item),this.nonpartners=[];for(var r=0,e=1,i=t[1].length;i>e;e+=1){s=t[1][e];var n=CSL.getAmbiguousCite.call(this.state,s,this.base,!0);this.ItemCite===n?(r+=1,this.partners.push(s)):this.nonpartners.push(s)}this.clashes[0]=this.clashes[1],this.clashes[1]=r},CSL.Disambiguation.prototype.evalScan=function(t){this[this.modes[this.modeindex]](t),t&&(this.modeindex<this.modes.length-1?this.modeindex+=1:this.lists[this.listpos+1]=[this.base,[]])},CSL.Disambiguation.prototype.disNames=function(t){var e,i;if(0===this.clashes[1]&&1===this.nonpartners.length)this.captureStepToBase(),this.state.registry.registerAmbigToken(this.akey,""+this.nonpartners[0].id,this.betterbase),this.state.registry.registerAmbigToken(this.akey,""+this.partners[0].id,this.betterbase),this.lists[this.listpos]=[this.betterbase,[]];else if(0===this.clashes[1])this.captureStepToBase(),this.state.registry.registerAmbigToken(this.akey,""+this.partners[0].id,this.betterbase),this.lists[this.listpos]=[this.betterbase,this.nonpartners],this.nonpartners.length&&(this.initGivens=!0);else if(1===this.nonpartners.length)this.captureStepToBase(),this.state.registry.registerAmbigToken(this.akey,""+this.nonpartners[0].id,this.betterbase),this.lists[this.listpos]=[this.betterbase,this.partners];else if(this.clashes[1]<this.clashes[0])this.captureStepToBase(),this.lists[this.listpos]=[this.betterbase,this.partners],this.lists.push([this.betterbase,this.nonpartners]);else if(t&&(this.lists[this.listpos]=[this.betterbase,this.nonpartners],this.lists.push([this.betterbase,this.partners]),this.modeindex===this.modes.length-1)){for(var e=0,i=this.partners.length;i>e;e+=1)this.state.registry.registerAmbigToken(this.akey,""+this.partners[e].id,this.betterbase);this.lists[this.listpos]=[this.betterbase,[]]}},CSL.Disambiguation.prototype.disExtraText=function(){var t=!1;if(0===this.clashes[1]&&this.nonpartners.length<2&&(t=!0),t||this.base.disambiguate&&this.state.tmp.disambiguate_count===this.state.tmp.disambiguate_maxMax){if(t||this.state.tmp.disambiguate_count===this.state.tmp.disambiguate_maxMax)if(t||this.modeindex===this.modes.length-1){for(var e=this.lists[this.listpos][0],i=0,s=this.lists[this.listpos][1].length;s>i;i+=1)this.state.tmp.taintedItemIDs[this.lists[this.listpos][1][i].id]=!0,this.state.registry.registerAmbigToken(this.akey,""+this.lists[this.listpos][1][i].id,e);this.lists[this.listpos]=[this.betterbase,[]]}else{this.modeindex=this.modes.length-1;var e=this.lists[this.listpos][0];e.disambiguate=!0;for(var i=0,s=this.lists[this.listpos][1].length;s>i;i+=1)this.state.tmp.taintedItemIDs[this.lists[this.listpos][1][i].id]=!0,this.state.registry.registerAmbigToken(this.akey,""+this.lists[this.listpos][1][i].id,e)}}else if(this.modeindex=0,this.base.disambiguate=this.state.tmp.disambiguate_count,this.betterbase.disambiguate=this.state.tmp.disambiguate_count,this.base.disambiguate)this.disNames();else{this.initGivens=!0,this.base.disambiguate=1;for(var i=0,s=this.lists[this.listpos][1].length;s>i;i+=1)this.state.tmp.taintedItemIDs[this.lists[this.listpos][1][i].id]=!0}},CSL.Disambiguation.prototype.disYears=function(){var t,e,i,s;i=[];var r=this.lists[this.listpos][0];if(this.clashes[1])for(var n=0,a=this.state.registry.mylist.length;a>n;n+=1)for(var o=this.state.registry.mylist[n],l=0,u=this.lists[this.listpos][1].length;u>l;l+=1){var s=this.lists[this.listpos][1][l];if(s.id==o){i.push(this.registry[s.id]);break}}i.sort(this.state.registry.sorter.compareKeys);for(var t=0,e=i.length;e>t;t+=1){r.year_suffix=""+t;var p=this.state.registry.registry[i[t].id].disambig;this.state.registry.registerAmbigToken(this.akey,""+i[t].id,r),CSL.ambigConfigDiff(p,r)&&(this.state.tmp.taintedItemIDs[i[t].id]=!0)}this.lists[this.listpos]=[this.betterbase,[]]},CSL.Disambiguation.prototype.incrementDisambig=function(){if(this.initGivens)return this.initGivens=!1,!1;var t=!1,e=!0;if("disNames"===this.modes[this.modeindex]){e=!1,"number"!=typeof this.givensMax&&(e=!0);var i=!1;if("number"!=typeof this.namesMax&&(i=!0),"number"==typeof this.givensMax&&(this.base.givens.length&&this.base.givens[this.gnameset][this.gname]<this.givensMax?this.base.givens[this.gnameset][this.gname]+=1:e=!0),"number"==typeof this.namesMax&&e&&(this.state.opt["disambiguate-add-names"]?(i=!1,this.gname<this.namesMax?(this.base.names[this.gnameset]+=1,this.gname+=1):i=!0):i=!0),"number"==typeof this.namesetsMax&&i)if(this.gnameset<this.namesetsMax)this.gnameset+=1,this.base.names[this.gnameset]=1,this.gname=0;else;"number"==typeof this.namesetsMax&&-1!==this.namesetsMax&&this.gnameset!==this.namesetsMax||this.state.opt["disambiguate-add-names"]&&"number"==typeof this.namesMax&&this.gname!==this.namesMax||"number"==typeof this.givensMax&&"undefined"!=typeof this.base.givens[this.gnameset]&&"undefined"!=typeof this.base.givens[this.gnameset][this.gname]&&this.base.givens[this.gnameset][this.gname]!==this.givensMax||(t=!0)}else"disExtraText"===this.modes[this.modeindex]&&(this.base.disambiguate+=1,this.betterbase.disambiguate+=1);return t},CSL.Disambiguation.prototype.initVars=function(t){var e,i,s,r,n;if(this.lists=[],this.base=!1,this.betterbase=!1,this.akey=t,this.maxNamesByItemId={},r=[],s=this.ambigcites[t],!s||!s.length)return!1;var a=this.state.retrieveItem(""+s[0]);if(this.getCiteData(a),this.base=CSL.getAmbigConfig.call(this.state),s&&s.length>1){r.push([this.maxNamesByItemId[a.id],a]);for(var e=1,i=s.length;i>e;e+=1)a=this.state.retrieveItem(""+s[e]),this.getCiteData(a,this.base),r.push([this.maxNamesByItemId[a.id],a]);r.sort(function(t,e){return t[0]>e[0]?1:t[0]<e[0]?-1:t[1].id>e[1].id?1:t[1].id<e[1].id?-1:0}),n=[];for(var e=0,i=r.length;i>e;e+=1)n.push(r[e][1]);this.lists.push([this.base,n]),this.Item=this.lists[0][1][0]}else this.Item=this.state.retrieveItem(""+s[0]);if(this.modeindex=0,this.state.citation.opt["disambiguate-add-names"],0)for(var o=this.base.names[0],e=1,i=this.base.names.length;i>e;e+=1)o=Math.max(o,this.base.names.names[e]);else this.namesMax=this.maxNamesByItemId[this.Item.id][0];return this.padBase(this.base),this.padBase(this.betterbase),this.base.year_suffix=!1,this.base.disambiguate=!1,this.betterbase.year_suffix=!1,this.betterbase.disambiguate=!1,"by-cite"===this.state.citation.opt["givenname-disambiguation-rule"]&&this.state.opt["disambiguate-add-givenname"]&&(this.givensMax=2),!0},CSL.Disambiguation.prototype.padBase=function(t){for(var e=0,i=t.names.length;i>e;e+=1){t.givens[e]||(t.givens[e]=[]);for(var s=0,r=t.names[e];r>s;s+=1)t.givens[e][s]||(t.givens[e][s]=0)}},CSL.Disambiguation.prototype.configModes=function(){var t,e;this.modes=[],t=this.state.opt["disambiguate-add-givenname"],e=this.state.citation.opt["givenname-disambiguation-rule"],(this.state.opt["disambiguate-add-names"]||t&&"by-cite"===e)&&this.modes.push("disNames"),this.state.opt.has_disambiguate&&this.modes.push("disExtraText"),this.state.opt["disambiguate-add-year-suffix"]&&this.modes.push("disYears")},CSL.Disambiguation.prototype.getCiteData=function(t,e){if(!this.maxNamesByItemId[t.id]){CSL.getAmbiguousCite.call(this.state,t,e),e=CSL.getAmbigConfig.call(this.state),this.maxNamesByItemId[t.id]=CSL.getMaxVals.call(this.state),this.state.registry.registry[t.id].disambig.givens=this.state.tmp.disambig_settings.givens.slice();for(var i=0,s=this.state.registry.registry[t.id].disambig.givens.length;s>i;i+=1)this.state.registry.registry[t.id].disambig.givens[i]=this.state.tmp.disambig_settings.givens[i].slice();this.namesetsMax=this.state.registry.registry[t.id].disambig.names.length-1,this.base||(this.base=e,this.betterbase=CSL.cloneAmbigConfig(e)),e.names.length<this.base.names.length&&(this.base=e);for(var i=0,s=e.names.length;s>i;i+=1)e.names[i]>this.base.names[i]&&(this.base.givens[i]=e.givens[i].slice(),this.base.names[i]=e.names[i],this.betterbase.names=this.base.names.slice(),this.betterbase.givens=this.base.givens.slice(),this.padBase(this.base),this.padBase(this.betterbase));this.betterbase.givens=this.base.givens.slice();for(var r=0,n=this.base.givens.length;n>r;r+=1)this.betterbase.givens[r]=this.base.givens[r].slice()}},CSL.Disambiguation.prototype.captureStepToBase=function(){"by-cite"===this.state.citation.opt["givenname-disambiguation-rule"]&&this.base.givens&&this.base.givens.length&&"undefined"!=typeof this.base.givens[this.gnameset][this.gname]&&(this.betterbase.givens[this.gnameset][this.gname]=this.base.givens[this.gnameset][this.gname]),this.betterbase.names[this.gnameset]=this.base.names[this.gnameset]},e.exports=CSL,CSL.Engine.prototype.getJurisdictionList=function(t){for(var e=[],i=t.split(":"),s=i.length;s>0;s--)e.push(i.slice(0,s).join(":"));return-1===e.indexOf("us")&&e.push("us"),e},CSL.Engine.prototype.retrieveAllStyleModules=function(t){var e={},i=this.locale[this.opt.lang].opts["jurisdiction-preference"];i=i?i:[],i=[""].concat(i);for(var s=i.length-1;s>-1;s--)for(var r=i[s],n=0,a=t.length;a>n;n++){var o=t[n];if(!this.opt.jurisdictions_seen[o]){var l=this.sys.retrieveStyleModule(o,r);(!l&&!r||l)&&(this.opt.jurisdictions_seen[o]=!0),l&&(e[o]=l)}}return e},e.exports=CSL,CSL.ParticleList=function(){var t=[[[0,1],null]],e=[[[0,3],null]],i=[[null,[0,1]]],s=[[null,[0,2]]],r=[[null,[0,3]]],n=[[null,[0,1]],[[0,1],null]],a=[[null,[0,2]],[[0,2],null]],o=[[[0,1],null],[null,[0,1]]],l=[[[0,2],null],[null,[0,2]]],u=[[[0,3],null],[null,[0,3]]],p=[[null,[0,2]],[[0,1],[1,2]]],h=[["'s",i],["'s-",i],["'t",i],["a",i],["aan 't",s],["aan de",s],["aan den",s],["aan der",s],["aan het",s],["aan t",s],["aan",i],["ad-",n],["adh-",n],["af",n],["al",n],["al-",n],["am de",s],["am",i],["an-",n],["ar-",n],["as-",n],["ash-",n],["at-",n],["ath-",n],["auf dem",l],["auf den",l],["auf der",l],["auf ter",s],["auf",o],["aus 'm",l],["aus dem",l],["aus den",l],["aus der",l],["aus m",l],["aus",o],["aus'm",l],["az-",n],["aš-",n],["aḍ-",n],["aḏ-",n],["aṣ-",n],["aṭ-",n],["aṯ-",n],["aẓ-",n],["ben",i],["bij 't",s],["bij de",s],["bij den",s],["bij het",s],["bij t",s],["bij",i],["bin",i],["boven d",s],["boven d'",s],["d",i],["d'",n],["da",n],["dal",i],["dal'",i],["dall'",i],["dalla",i],["das",n],["de die le",r],["de die",s],["de l",s],["de l'",s],["de la",p],["de las",p],["de le",s],["de li",a],["de van der",r],["de",n],["de'",n],["deca",i],["degli",n],["dei",n],["del",n],["dela",t],["dell'",n],["della",n],["delle",n],["dello",n],["den",n],["der",n],["des",n],["di",n],["die le",s],["do",i],["don",i],["dos",n],["du",n],["ed-",n],["edh-",n],["el",n],["el-",n],["en-",n],["er-",n],["es-",n],["esh-",n],["et-",n],["eth-",n],["ez-",n],["eš-",n],["eḍ-",n],["eḏ-",n],["eṣ-",n],["eṭ-",n],["eṯ-",n],["eẓ-",n],["het",i],["i",i],["il",t],["im",i],["in 't",s],["in de",s],["in den",s],["in der",a],["in het",s],["in t",s],["in",i],["l",i],["l'",i],["la",i],["las",i],["le",i],["les",n],["lo",n],["los",i],["lou",i],["of",i],["onder 't",s],["onder de",s],["onder den",s],["onder het",s],["onder t",s],["onder",i],["op 't",s],["op de",a],["op den",s],["op der",s],["op gen",s],["op het",s],["op t",s],["op ten",s],["op",i],["over 't",s],["over de",s],["over den",s],["over het",s],["over t",s],["over",i],["s",i],["s'",i],["sen",t],["t",i],["te",i],["ten",i],["ter",i],["tho",i],["thoe",i],["thor",i],["to",i],["toe",i],["tot",i],["uijt 't",s],["uijt de",s],["uijt den",s],["uijt te de",r],["uijt ten",s],["uijt",i],["uit 't",s],["uit de",s],["uit den",s],["uit het",s],["uit t",s],["uit te de",r],["uit ten",s],["uit",i],["unter",i],["v",i],["v.",i],["v.d.",i],["van 't",s],["van de l",r],["van de l'",r],["van de",s],["van de",s],["van den",s],["van der",s],["van gen",s],["van het",s],["van la",s],["van t",s],["van ter",s],["van van de",r],["van",n],["vander",i],["vd",i],["ver",i],["vom und zum",e],["vom",n],["von 't",s],["von dem",l],["von den",l],["von der",l],["von t",s],["von und zu",u],["von zu",l],["von",o],["voor 't",s],["voor de",s],["voor den",s],["voor in 't",r],["voor in t",r],["voor",i],["vor der",l],["vor",o],["z",t],["ze",t],["zu",o],["zum",n],["zur",n]];return h}(),CSL.parseParticles=function(){function t(t,e,i){var s=t;t=i?t.toLowerCase():t;var r,n=[];e?(t=t.split("").reverse().join(""),r=CSL.PARTICLE_GIVEN_REGEXP):r=CSL.PARTICLE_FAMILY_REGEXP;for(var a=t.match(r);a;){var o=e?a[1].split("").reverse().join(""):a[1],l=a?o:!1,l=l?o.replace(/^[-\'\u02bb\u2019\s]*(.).*$/,"$1"):!1,u=l?l.toUpperCase()!==l:!1;if(!u)break;e?(n.push(s.slice(-1*o.length)),s=s.slice(0,-1*o.length)):(n.push(s.slice(0,o.length)),s=s.slice(o.length)),t=a[2],a=t.match(r)}if(e){t=t.split("").reverse().join(""),n.reverse();for(var p=1,h=n.length;h>p;p++)" "==n[p].slice(0,1)&&(n[p-1]+=" ");for(var p=0,h=n.length;h>p;p++)" "==n[p].slice(0,1)&&(n[p]=n[p].slice(1));t=s.slice(0,t.length)}else t=s.slice(-1*t.length);return[u,t,n]}function e(t){var e=t.slice(-1);return t=t.trim()," "===e&&["'","’"].indexOf(t.slice(-1))>-1&&(t+=" "),t}function i(t){if(!t.suffix&&t.given){var e=t.given.match(/(\s*,!*\s*)/);if(e){var i=t.given.indexOf(e[1]),s=t.given.slice(i+e[1].length),r=t.given.slice(i,i+e[1].length).replace(/\s*/g,"");"et al"!==s.replace(/\./g,"")||t["dropping-particle"]?(2===r.length&&(t["comma-suffix"]=!0),t.suffix=s):(t["dropping-particle"]=s,t["comma-dropping-particle"]=","),t.given=t.given.slice(0,i)}}}return function(s){var r=t(s.family),n=(r[0],r[1]),a=r[2];s.family=n;var o=e(a.join(""));o&&(s["non-dropping-particle"]=o),i(s);var r=t(s.given,!0),l=(r[0],r[1]),u=r[2];s.given=l;var p=u.join("").trim();p&&(s["dropping-particle"]=p)}}(),e.exports=CSL},{}]},{},[])("citeproc")});
+
+// ======================== /citeproc =========================
+
+
+ObjC.import('stdlib')
+ObjC.import('Foundation')
+var fm = $.NSFileManager.defaultManager
+
+
+Array.prototype.contains = function(val) {
+    for (var i; i < this.length; i++) {
+        if (this[i] === val)
+            return true
+    }
+    return false
+}
+
+var usage = `cite [options] <style.csl> <csl.json>
+
+Generate an HTML CSL citation for item defined in <csl.json> using
+the stylesheet specified by <style.csl>.
+
+Usage:
+    cite [-b] [-v] [-l <lang>] [-L <dir>] <style.csl> <csl.json>
+    cite (-h|--help)
+
+Options:
+        -b, --bibliography               Generate bibliography-style citation
+        -l <lang>, --locale <lang>       Locale for citation
+        -L <dir>, --locale-dir <dir>     Directory locale files are in
+        -v, --verbose                    Show status messages
+        -h, --help                       Show this message and exit
+
+`
+
+// Show CLI help and exit.
+function showHelp(errMsg) {
+    var status = 0
+    if (errMsg) {
+        console.log(`error: ${errMsg}`)
+        status = 1
+    }
+    console.log(usage)
+    $.exit(status)
+}
+
+// Parse command-line flags.
+function parseArgs(argv) {
+    argv.forEach(function(s) {
+        if (s == '-h' || s == '--help')
+            showHelp()
+    })
+    if (argv.length == 0)
+        showHelp()
+
+    var args = [],
+        opts = {
+            locale: null,
+            localeDir: './locales',
+            style: null,
+            csl: null,
+            bibliography: false,
+            verbose: false
+        }
+
+    // Extract flags and collect arguments
+    for (var i=0; i < argv.length; i++) {
+        var s = argv[i]
+
+        if (s.startsWith('-')) {
+
+            if (s == '--locale' || s == '-l') {
+                opts.locale = argv[i+1]
+                i++
+            }
+
+            else if (s == '--locale-dir' || s == '-L') {
+                opts.localeDir = argv[i+1]
+                i++
+            }
+
+            else if (s == '--bibliography' || s == '-b')
+                opts.bibliography = true
+
+            else if (s == '--verbose' || s == '-v')
+                opts.verbose = true
+
+            else
+                showHelp('unknown option: ' + s)
+
+        } else {
+            args.push(s)
+        }
+    }
+
+    // Arguments
+    if (args.length > 2)
+        showHelp('script takes 2 arguments')
+
+    if (args.length > 0)
+        opts.style = args[0]
+
+    if (args.length > 1)
+        opts.csl = args[1]
+
+    return opts
+}
+
+// Read file at `path` and return its contents as a string.
+function readFile(path) {
+    var contents = $.NSString.alloc.initWithDataEncoding(fm.contentsAtPath(path), $.NSUTF8StringEncoding)
+    return ObjC.unwrap(contents)
+}
+
+
+function stripOuterDiv(html) {
+    var match = new RegExp('^<div.*?>(.+)</div>$').exec(html)
+    if (match != null)
+        return match[1]
+
+    return html
+}
+
+
+var Citer = function(opts) {
+    this.opts = opts
+    this.item = JSON.parse(readFile(opts.csl))
+    this.style = readFile(opts.style)
+    this.id = this.item.id
+
+    var locale = 'en',
+        force = false
 
-optparse = OptionParser.new do |opts|
-  opts.banner = usage
+    if (opts.locale) {
+        locale = opts.locale
+        force = true
+    }
+
+    this.citer = new CSL.Engine(this, this.style, locale, force)
+}
 
-  opts.on('-l', '--locale LANG', 'Set a locale (default: en-US)') do |locale|
-    options[:locale] = locale
-  end
 
-  opts.on('-b', '--bibliography', 'Generate bibliography format citation') do |v|
-    options[:bibliography] = v
-  end
+Citer.prototype.retrieveItem = function(id) {
+    return this.item
+}
 
-  opts.on('-v', '--verbose', 'Output more information') do |v|
-    options[:verbose] = v
-  end
+Citer.prototype.retrieveLocale = function(lang) {
+    if (this.opts.verbose) {
+        console.log(`locale=${lang}`)
+        console.log(`localeDir=${this.opts.localeDir}`)
+    }
 
-  opts.on_tail('-h', '--help', 'Show this message and exit') do
-    puts opts
-    exit
-  end
-end
+    return readFile(`${this.opts.localeDir}/locales-${lang}.xml`)
+}
 
-optparse.parse!
+Citer.prototype.cite = function() {
+    var data = {html: '', rtf: ''}
+    this.citer.updateItems([this.id])
 
-stylepath = ARGV[0]
+    if (this.opts.bibliography) {
 
-if !stylepath then
-  $stderr.puts optparse.banner
-  exit 1
-end
+        // -----------------------------------------------------
+        // HTML
+        var html = this.citer.makeBibliography()[1].join('\n').trim()
+        data.html = stripOuterDiv(html)
 
-$stderr.puts "reading CSL-JSON from STDIN ..." if options[:verbose]
+        // -----------------------------------------------------
+        // RTF
+        this.citer.setOutputFormat('rtf')
+        data.rtf = this.citer.makeBibliography()[1].join('\n')
 
-csldata = JSON.parse($stdin.read)
-id = csldata[0]['id']
+    } else {
+        data.html = this.citer.makeCitationCluster([this.id])
+        this.citer.setOutputFormat('rtf')
+        data.rtf = this.citer.makeCitationCluster([this.id])
+    }
 
-CSL::Locale.root = "#{__dir__}/locales"
+    return data
+}
 
-style = CSL::Style.load stylepath
-locale = CSL::Locale.load options[:locale]
 
+function run(argv) {
 
-if options[:verbose] then
-  $stderr.puts "CSL definition: #{stylepath}"
-  $stderr.puts "locale: #{options[:locale]}"
-  $stderr.puts "style: #{style.title}"
-end
+    var opts = parseArgs(argv)
 
-cp = CiteProc::Processor.new style: style, format: 'html', locale: locale
-cp.import csldata
+    if (opts.verbose) {
+        console.log(`bibliography=${opts.bibliography}`)
+        console.log(`csl=${opts.csl}`)
+        console.log(`style=${opts.style}`)
+    }
 
-if options[:bibliography] then
-  puts cp.render :bibliography, id: id
-else
-  puts cp.render :citation, id: id
-end
+    return JSON.stringify(new Citer(opts).cite())
+}
diff --git a/src/lib/cite/cite.py b/src/lib/cite/cite.py
index 1a86146..499b352 100644
--- a/src/lib/cite/cite.py
+++ b/src/lib/cite/cite.py
@@ -15,8 +15,10 @@
 import logging
 import os
 import subprocess
+from tempfile import NamedTemporaryFile
+
+from .locales import LOCALE_DIR
 
-from .html2rtf import html2rtf
 
 log = logging.getLogger(__name__)
 
@@ -30,29 +32,34 @@ class CitationError(Exception):
 
 def generate(csldata, cslfile, bibliography=False, locale=None):
     """Generate an HTML & RTF citation for ``csldata`` using ``cslfile``."""
-    js = json.dumps(csldata)
+    with NamedTemporaryFile(suffix='.json') as fp:
+        json.dump(csldata, fp)
+        fp.flush()
+
+        cmd = [PROG, '--verbose', '--locale-dir', LOCALE_DIR]
+        if bibliography:
+            cmd.append('--bibliography')
+        if locale:
+            cmd += ['--locale', locale]
 
-    cmd = [PROG, '--verbose']
-    if bibliography:
-        cmd.append('--bibliography')
-    if locale:
-        cmd += ['--locale', locale]
+        cmd += [cslfile, fp.name]
 
-    cmd.append(cslfile)
+        log.debug('[cite] cmd=%r', cmd)
 
-    log.debug('[cite] cmd=%r', cmd)
+        p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+                             stderr=subprocess.PIPE)
 
-    p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-                         stderr=subprocess.PIPE)
+        stdout, stderr = p.communicate()
+        if p.returncode:
+            raise CitationError('cite exited with %d: %s', p.returncode,
+                                stderr)
 
-    stdout, stderr = p.communicate(js)
-    if p.returncode:
-        raise CitationError('cite exited with %d: %s', p.returncode, stderr)
+    data = json.loads(stdout)
+    html = data['html']
 
-    html = stdout.decode('utf-8')
     log.debug('[cite] html=%r', html)
 
-    rtf = html2rtf(html)
+    rtf = '{\\rtf1\\ansi\\deff0 ' + data['rtf'] + '}'
     log.debug('[cite] rtf=%r', rtf)
 
     return dict(html=html, text=html, rtf=rtf)
diff --git a/src/lib/cite/gems/.gitkeep b/src/lib/cite/gems/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/src/lib/zothero/models.py b/src/lib/zothero/models.py
index 659da50..1223907 100644
--- a/src/lib/zothero/models.py
+++ b/src/lib/zothero/models.py
@@ -143,7 +143,7 @@ def csljson(self):
         Returns:
             str: JSON array containing CSL data for one `Entry`.
         """
-        return json.dumps([self.csl], indent=2, sort_keys=True)
+        return json.dumps(self.csl, indent=2, sort_keys=True)
 
     def __str__(self):
         """Title, year and author(s) of `Entry`.
diff --git a/src/lib/zothero/styles.py b/src/lib/zothero/styles.py
index 7bd0688..084ad2c 100644
--- a/src/lib/zothero/styles.py
+++ b/src/lib/zothero/styles.py
@@ -220,7 +220,7 @@ def cite(self, entry, style, bibliography=False, locale=None):
         log.debug('[styles] csl=%r', entry.csl)
         # log.debug('[styles] json=%s', entry.csljson)
 
-        return cite.generate([entry.csl], style.path, bibliography, locale)
+        return cite.generate(entry.csl, style.path, bibliography, locale)
 
     def update(self):
         """Load CSL style definitions.