open-agreements 0.7.5 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +300 -255
- package/README.es.md +301 -254
- package/README.md +389 -95
- package/README.pt-br.md +301 -254
- package/README.template.md +333 -0
- package/README.zh.md +300 -253
- package/SECURITY.md +34 -0
- package/content/recipes/nvca-stock-purchase-agreement/README.md +39 -0
- package/content/recipes/nvca-voting-agreement/README.md +43 -0
- package/content/templates/bonterms-mutual-nda/README.md +2 -2
- package/content/templates/bonterms-mutual-nda/metadata.yaml +5 -11
- package/content/templates/bonterms-professional-services-agreement/README.md +2 -2
- package/content/templates/bonterms-professional-services-agreement/metadata.yaml +2 -2
- package/content/templates/closing-checklist/template.docx +0 -0
- package/content/templates/closing-checklist/template.md +30 -0
- package/content/templates/common-paper-ai-addendum/template.docx +0 -0
- package/content/templates/common-paper-ai-addendum-in-app/template.docx +0 -0
- package/content/templates/common-paper-csa-with-ai/template.docx +0 -0
- package/content/templates/common-paper-independent-contractor-agreement/template.docx +0 -0
- package/content/templates/common-paper-mutual-nda/README.md +28 -0
- package/content/templates/common-paper-one-way-nda/metadata.yaml +1 -1
- package/content/templates/common-paper-term-sheet/template.docx +0 -0
- package/content/templates/openagreements-board-consent-safe/.template.generated.json +74 -0
- package/content/templates/openagreements-board-consent-safe/README.md +61 -0
- package/content/templates/openagreements-board-consent-safe/metadata.yaml +53 -0
- package/content/templates/openagreements-board-consent-safe/reference-source.docx +0 -0
- package/content/templates/openagreements-board-consent-safe/template.docx +0 -0
- package/content/templates/openagreements-board-consent-safe/template.md +66 -0
- package/content/templates/openagreements-due-diligence-request-list/README.md +68 -0
- package/content/templates/openagreements-due-diligence-request-list/metadata.yaml +300 -0
- package/content/templates/openagreements-due-diligence-request-list/template.docx +0 -0
- package/content/templates/openagreements-due-diligence-request-list/template.md +318 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/.template.generated.json +230 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/metadata.yaml +1 -1
- package/content/templates/openagreements-employee-ip-inventions-assignment/template.docx +0 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/template.md +96 -35
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/README.md +1 -1
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/metadata.yaml +2 -2
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.docx +0 -0
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.json +75 -0
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.md +8 -4
- package/content/templates/openagreements-employment-offer-letter/.template.generated.json +224 -0
- package/content/templates/openagreements-employment-offer-letter/README.md +65 -1
- package/content/templates/openagreements-employment-offer-letter/metadata.yaml +1 -1
- package/content/templates/openagreements-employment-offer-letter/template.docx +0 -0
- package/content/templates/openagreements-employment-offer-letter/template.md +70 -30
- package/content/templates/openagreements-restrictive-covenant-florida/.template.generated.json +456 -0
- package/content/templates/openagreements-restrictive-covenant-florida/README.md +141 -0
- package/content/templates/openagreements-restrictive-covenant-florida/metadata.yaml +419 -0
- package/content/templates/openagreements-restrictive-covenant-florida/template.docx +0 -0
- package/content/templates/openagreements-restrictive-covenant-florida/template.md +233 -0
- package/content/templates/openagreements-restrictive-covenant-wyoming/.template.generated.json +399 -0
- package/content/templates/openagreements-restrictive-covenant-wyoming/metadata.yaml +69 -12
- package/content/templates/openagreements-restrictive-covenant-wyoming/template.docx +0 -0
- package/content/templates/openagreements-restrictive-covenant-wyoming/template.md +110 -59
- package/content/templates/openagreements-stockholder-consent-safe/.template.generated.json +74 -0
- package/content/templates/openagreements-stockholder-consent-safe/README.md +62 -0
- package/content/templates/openagreements-stockholder-consent-safe/metadata.yaml +53 -0
- package/content/templates/openagreements-stockholder-consent-safe/reference-source.docx +0 -0
- package/content/templates/openagreements-stockholder-consent-safe/template.docx +0 -0
- package/content/templates/openagreements-stockholder-consent-safe/template.md +62 -0
- package/content/templates/working-group-list/template.docx +0 -0
- package/content/templates/working-group-list/template.md +18 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/fill.d.ts +1 -1
- package/dist/commands/fill.d.ts.map +1 -1
- package/dist/commands/fill.js +4 -1
- package/dist/commands/fill.js.map +1 -1
- package/dist/commands/list.js +10 -0
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/recipe.js.map +1 -1
- package/dist/core/employment/jurisdiction-rules.js +2 -2
- package/dist/core/employment/jurisdiction-rules.js.map +1 -1
- package/dist/core/employment/memo.d.ts +1 -1
- package/dist/core/employment/memo.d.ts.map +1 -1
- package/dist/core/employment/memo.js +14 -6
- package/dist/core/employment/memo.js.map +1 -1
- package/dist/core/engine.d.ts.map +1 -1
- package/dist/core/engine.js +28 -0
- package/dist/core/engine.js.map +1 -1
- package/dist/core/fill-pipeline.d.ts +30 -5
- package/dist/core/fill-pipeline.d.ts.map +1 -1
- package/dist/core/fill-pipeline.js +173 -9
- package/dist/core/fill-pipeline.js.map +1 -1
- package/dist/core/humanize-docx.d.ts +21 -0
- package/dist/core/humanize-docx.d.ts.map +1 -0
- package/dist/core/humanize-docx.js +492 -0
- package/dist/core/humanize-docx.js.map +1 -0
- package/dist/core/metadata.d.ts +118 -65
- package/dist/core/metadata.d.ts.map +1 -1
- package/dist/core/metadata.js +268 -13
- package/dist/core/metadata.js.map +1 -1
- package/dist/core/recipe/bracket-normalizer.d.ts +1 -1
- package/dist/core/recipe/bracket-normalizer.d.ts.map +1 -1
- package/dist/core/recipe/bracket-normalizer.js +3 -0
- package/dist/core/recipe/bracket-normalizer.js.map +1 -1
- package/dist/core/recipe/computed.d.ts +1 -1
- package/dist/core/recipe/computed.d.ts.map +1 -1
- package/dist/core/recipe/index.d.ts.map +1 -1
- package/dist/core/recipe/index.js +22 -4
- package/dist/core/recipe/index.js.map +1 -1
- package/dist/core/recipe/types.d.ts +1 -1
- package/dist/core/recipe/types.d.ts.map +1 -1
- package/dist/core/template-listing.d.ts +6 -8
- package/dist/core/template-listing.d.ts.map +1 -1
- package/dist/core/template-listing.js +24 -0
- package/dist/core/template-listing.js.map +1 -1
- package/dist/core/unified-pipeline.d.ts +2 -0
- package/dist/core/unified-pipeline.d.ts.map +1 -1
- package/dist/core/unified-pipeline.js +19 -1
- package/dist/core/unified-pipeline.js.map +1 -1
- package/dist/core/validation/template.d.ts +32 -0
- package/dist/core/validation/template.d.ts.map +1 -1
- package/dist/core/validation/template.js +163 -3
- package/dist/core/validation/template.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +26 -12
- package/skills/canonical-markdown-authoring/CONNECTORS.md +67 -0
- package/skills/canonical-markdown-authoring/SKILL.md +565 -0
- package/skills/client-email/SKILL.md +2 -0
- package/skills/cloud-service-agreement/CONNECTORS.md +2 -2
- package/skills/cloud-service-agreement/SKILL.md +38 -1
- package/skills/cloud-service-agreement/template-filling-execution.md +2 -2
- package/skills/data-privacy-agreement/CONNECTORS.md +2 -2
- package/skills/data-privacy-agreement/SKILL.md +2 -0
- package/skills/delaware-franchise-tax/SKILL.md +2 -0
- package/skills/edit-docx-agreement/SKILL.md +2 -0
- package/skills/employment-contract/CONNECTORS.md +2 -2
- package/skills/employment-contract/SKILL.md +2 -0
- package/skills/iso-27001-evidence-collection/SKILL.md +2 -0
- package/skills/iso-27001-internal-audit/SKILL.md +2 -0
- package/skills/nda/CONNECTORS.md +2 -2
- package/skills/nda/SKILL.md +45 -1
- package/skills/nda/template-filling-execution.md +12 -6
- package/skills/non-compete-contract-explainer/SKILL.md +107 -0
- package/skills/non-compete-contract-explainer/content/wyoming.md +286 -0
- package/skills/non-compete-contract-explainer/manifest.json +18 -0
- package/skills/open-agreements/CONNECTORS.md +2 -2
- package/skills/open-agreements/SKILL.md +165 -67
- package/skills/open-agreements/template-filling-execution.md +2 -2
- package/skills/recipe-quality-audit/SKILL.md +2 -0
- package/skills/safe/CONNECTORS.md +2 -2
- package/skills/safe/SKILL.md +38 -1
- package/skills/safe/template-filling-execution.md +2 -2
- package/skills/services-agreement/CONNECTORS.md +2 -2
- package/skills/services-agreement/SKILL.md +40 -1
- package/skills/services-agreement/template-filling-execution.md +81 -0
- package/skills/shared/template-filling-execution.md +2 -2
- package/skills/soc2-readiness/SKILL.md +2 -0
- package/skills/unit-test-philosophy/SKILL.md +3 -0
- package/skills/venture-financing/CONNECTORS.md +2 -2
- package/skills/venture-financing/SKILL.md +2 -0
- package/content/templates/openagreements-restrictive-covenant-wyoming/practice-note.md +0 -103
- package/node_modules/@xmldom/xmldom/CHANGELOG.md +0 -939
- package/node_modules/@xmldom/xmldom/LICENSE +0 -8
- package/node_modules/@xmldom/xmldom/SECURITY.md +0 -50
- package/node_modules/@xmldom/xmldom/index.d.ts +0 -1664
- package/node_modules/@xmldom/xmldom/lib/.eslintrc.yml +0 -3
- package/node_modules/@xmldom/xmldom/lib/conventions.js +0 -429
- package/node_modules/@xmldom/xmldom/lib/dom-parser.js +0 -586
- package/node_modules/@xmldom/xmldom/lib/dom.js +0 -3192
- package/node_modules/@xmldom/xmldom/lib/entities.js +0 -2171
- package/node_modules/@xmldom/xmldom/lib/errors.js +0 -202
- package/node_modules/@xmldom/xmldom/lib/grammar.js +0 -533
- package/node_modules/@xmldom/xmldom/lib/index.js +0 -41
- package/node_modules/@xmldom/xmldom/lib/sax.js +0 -929
- package/node_modules/@xmldom/xmldom/package.json +0 -74
- package/node_modules/@xmldom/xmldom/readme.md +0 -364
- package/node_modules/core-util-is/LICENSE +0 -19
- package/node_modules/core-util-is/README.md +0 -3
- package/node_modules/core-util-is/lib/util.js +0 -107
- package/node_modules/core-util-is/package.json +0 -38
- package/node_modules/immediate/LICENSE.txt +0 -20
- package/node_modules/immediate/README.md +0 -93
- package/node_modules/immediate/dist/immediate.js +0 -75
- package/node_modules/immediate/dist/immediate.min.js +0 -1
- package/node_modules/immediate/lib/browser.js +0 -69
- package/node_modules/immediate/lib/index.js +0 -73
- package/node_modules/immediate/package.json +0 -42
- package/node_modules/inherits/LICENSE +0 -16
- package/node_modules/inherits/README.md +0 -42
- package/node_modules/inherits/inherits.js +0 -9
- package/node_modules/inherits/inherits_browser.js +0 -27
- package/node_modules/inherits/package.json +0 -29
- package/node_modules/isarray/.npmignore +0 -1
- package/node_modules/isarray/.travis.yml +0 -4
- package/node_modules/isarray/Makefile +0 -6
- package/node_modules/isarray/README.md +0 -60
- package/node_modules/isarray/component.json +0 -19
- package/node_modules/isarray/index.js +0 -5
- package/node_modules/isarray/package.json +0 -45
- package/node_modules/isarray/test.js +0 -20
- package/node_modules/jszip/.codeclimate.yml +0 -16
- package/node_modules/jszip/.editorconfig +0 -8
- package/node_modules/jszip/.eslintrc.js +0 -43
- package/node_modules/jszip/.github/workflows/pr.yaml +0 -58
- package/node_modules/jszip/.jekyll-metadata +0 -0
- package/node_modules/jszip/.travis.yml +0 -17
- package/node_modules/jszip/CHANGES.md +0 -204
- package/node_modules/jszip/LICENSE.markdown +0 -651
- package/node_modules/jszip/README.markdown +0 -33
- package/node_modules/jszip/deps.js +0 -37
- package/node_modules/jszip/dist/jszip.js +0 -11577
- package/node_modules/jszip/dist/jszip.min.js +0 -13
- package/node_modules/jszip/graph.svg +0 -601
- package/node_modules/jszip/index.d.ts +0 -330
- package/node_modules/jszip/lib/base64.js +0 -106
- package/node_modules/jszip/lib/compressedObject.js +0 -74
- package/node_modules/jszip/lib/compressions.js +0 -14
- package/node_modules/jszip/lib/crc32.js +0 -77
- package/node_modules/jszip/lib/defaults.js +0 -11
- package/node_modules/jszip/lib/external.js +0 -18
- package/node_modules/jszip/lib/flate.js +0 -85
- package/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -539
- package/node_modules/jszip/lib/generate/index.js +0 -57
- package/node_modules/jszip/lib/index.js +0 -55
- package/node_modules/jszip/lib/license_header.js +0 -11
- package/node_modules/jszip/lib/load.js +0 -88
- package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
- package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
- package/node_modules/jszip/lib/nodejsUtils.js +0 -57
- package/node_modules/jszip/lib/object.js +0 -384
- package/node_modules/jszip/lib/readable-stream-browser.js +0 -10
- package/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
- package/node_modules/jszip/lib/reader/DataReader.js +0 -116
- package/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
- package/node_modules/jszip/lib/reader/StringReader.js +0 -38
- package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
- package/node_modules/jszip/lib/reader/readerFor.js +0 -28
- package/node_modules/jszip/lib/signature.js +0 -7
- package/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
- package/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
- package/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
- package/node_modules/jszip/lib/stream/DataWorker.js +0 -116
- package/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
- package/node_modules/jszip/lib/stream/StreamHelper.js +0 -214
- package/node_modules/jszip/lib/support.js +0 -38
- package/node_modules/jszip/lib/utf8.js +0 -275
- package/node_modules/jszip/lib/utils.js +0 -501
- package/node_modules/jszip/lib/zipEntries.js +0 -261
- package/node_modules/jszip/lib/zipEntry.js +0 -293
- package/node_modules/jszip/lib/zipObject.js +0 -133
- package/node_modules/jszip/package.json +0 -67
- package/node_modules/jszip/sponsors.md +0 -21
- package/node_modules/jszip/tsconfig.json +0 -101
- package/node_modules/jszip/vendor/FileSaver.js +0 -247
- package/node_modules/lie/README.md +0 -62
- package/node_modules/lie/dist/lie.js +0 -350
- package/node_modules/lie/dist/lie.min.js +0 -1
- package/node_modules/lie/dist/lie.polyfill.js +0 -358
- package/node_modules/lie/dist/lie.polyfill.min.js +0 -1
- package/node_modules/lie/lib/browser.js +0 -273
- package/node_modules/lie/lib/index.js +0 -298
- package/node_modules/lie/license.md +0 -7
- package/node_modules/lie/lie.d.ts +0 -244
- package/node_modules/lie/package.json +0 -69
- package/node_modules/lie/polyfill.js +0 -4
- package/node_modules/pako/LICENSE +0 -21
- package/node_modules/pako/README.md +0 -191
- package/node_modules/pako/dist/pako.js +0 -6818
- package/node_modules/pako/dist/pako.min.js +0 -1
- package/node_modules/pako/dist/pako_deflate.js +0 -3997
- package/node_modules/pako/dist/pako_deflate.min.js +0 -1
- package/node_modules/pako/dist/pako_inflate.js +0 -3300
- package/node_modules/pako/dist/pako_inflate.min.js +0 -1
- package/node_modules/pako/index.js +0 -14
- package/node_modules/pako/lib/deflate.js +0 -400
- package/node_modules/pako/lib/inflate.js +0 -423
- package/node_modules/pako/lib/utils/common.js +0 -105
- package/node_modules/pako/lib/utils/strings.js +0 -187
- package/node_modules/pako/lib/zlib/README +0 -59
- package/node_modules/pako/lib/zlib/adler32.js +0 -51
- package/node_modules/pako/lib/zlib/constants.js +0 -68
- package/node_modules/pako/lib/zlib/crc32.js +0 -59
- package/node_modules/pako/lib/zlib/deflate.js +0 -1874
- package/node_modules/pako/lib/zlib/gzheader.js +0 -58
- package/node_modules/pako/lib/zlib/inffast.js +0 -345
- package/node_modules/pako/lib/zlib/inflate.js +0 -1556
- package/node_modules/pako/lib/zlib/inftrees.js +0 -343
- package/node_modules/pako/lib/zlib/messages.js +0 -32
- package/node_modules/pako/lib/zlib/trees.js +0 -1222
- package/node_modules/pako/lib/zlib/zstream.js +0 -47
- package/node_modules/pako/package.json +0 -44
- package/node_modules/process-nextick-args/index.js +0 -45
- package/node_modules/process-nextick-args/license.md +0 -19
- package/node_modules/process-nextick-args/package.json +0 -25
- package/node_modules/process-nextick-args/readme.md +0 -18
- package/node_modules/readable-stream/.travis.yml +0 -34
- package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/node_modules/readable-stream/LICENSE +0 -47
- package/node_modules/readable-stream/README.md +0 -58
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- package/node_modules/readable-stream/duplex-browser.js +0 -1
- package/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
- package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
- package/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
- package/node_modules/readable-stream/lib/_stream_transform.js +0 -214
- package/node_modules/readable-stream/lib/_stream_writable.js +0 -685
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -78
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -84
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/node_modules/readable-stream/package.json +0 -52
- package/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/readable-stream/readable-browser.js +0 -7
- package/node_modules/readable-stream/readable.js +0 -19
- package/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/readable-stream/writable-browser.js +0 -1
- package/node_modules/readable-stream/writable.js +0 -8
- package/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/safe-buffer/index.js +0 -62
- package/node_modules/safe-buffer/package.json +0 -37
- package/node_modules/setimmediate/LICENSE.txt +0 -20
- package/node_modules/setimmediate/package.json +0 -30
- package/node_modules/setimmediate/setImmediate.js +0 -186
- package/node_modules/string_decoder/.travis.yml +0 -50
- package/node_modules/string_decoder/LICENSE +0 -48
- package/node_modules/string_decoder/README.md +0 -47
- package/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/node_modules/string_decoder/package.json +0 -31
- package/node_modules/util-deprecate/History.md +0 -16
- package/node_modules/util-deprecate/LICENSE +0 -24
- package/node_modules/util-deprecate/README.md +0 -53
- package/node_modules/util-deprecate/browser.js +0 -67
- package/node_modules/util-deprecate/node.js +0 -6
- package/node_modules/util-deprecate/package.json +0 -27
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.base64 = true;
|
|
4
|
-
exports.array = true;
|
|
5
|
-
exports.string = true;
|
|
6
|
-
exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined";
|
|
7
|
-
exports.nodebuffer = typeof Buffer !== "undefined";
|
|
8
|
-
// contains true if JSZip can read/generate Uint8Array, false otherwise.
|
|
9
|
-
exports.uint8array = typeof Uint8Array !== "undefined";
|
|
10
|
-
|
|
11
|
-
if (typeof ArrayBuffer === "undefined") {
|
|
12
|
-
exports.blob = false;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
var buffer = new ArrayBuffer(0);
|
|
16
|
-
try {
|
|
17
|
-
exports.blob = new Blob([buffer], {
|
|
18
|
-
type: "application/zip"
|
|
19
|
-
}).size === 0;
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
try {
|
|
23
|
-
var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder;
|
|
24
|
-
var builder = new Builder();
|
|
25
|
-
builder.append(buffer);
|
|
26
|
-
exports.blob = builder.getBlob("application/zip").size === 0;
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
exports.blob = false;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
exports.nodestream = !!require("readable-stream").Readable;
|
|
36
|
-
} catch(e) {
|
|
37
|
-
exports.nodestream = false;
|
|
38
|
-
}
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var utils = require("./utils");
|
|
4
|
-
var support = require("./support");
|
|
5
|
-
var nodejsUtils = require("./nodejsUtils");
|
|
6
|
-
var GenericWorker = require("./stream/GenericWorker");
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The following functions come from pako, from pako/lib/utils/strings
|
|
10
|
-
* released under the MIT license, see pako https://github.com/nodeca/pako/
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
// Table with utf8 lengths (calculated by first byte of sequence)
|
|
14
|
-
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
|
|
15
|
-
// because max possible codepoint is 0x10ffff
|
|
16
|
-
var _utf8len = new Array(256);
|
|
17
|
-
for (var i=0; i<256; i++) {
|
|
18
|
-
_utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);
|
|
19
|
-
}
|
|
20
|
-
_utf8len[254]=_utf8len[254]=1; // Invalid sequence start
|
|
21
|
-
|
|
22
|
-
// convert string to array (typed, when possible)
|
|
23
|
-
var string2buf = function (str) {
|
|
24
|
-
var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
|
|
25
|
-
|
|
26
|
-
// count binary size
|
|
27
|
-
for (m_pos = 0; m_pos < str_len; m_pos++) {
|
|
28
|
-
c = str.charCodeAt(m_pos);
|
|
29
|
-
if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {
|
|
30
|
-
c2 = str.charCodeAt(m_pos+1);
|
|
31
|
-
if ((c2 & 0xfc00) === 0xdc00) {
|
|
32
|
-
c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
|
|
33
|
-
m_pos++;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// allocate buffer
|
|
40
|
-
if (support.uint8array) {
|
|
41
|
-
buf = new Uint8Array(buf_len);
|
|
42
|
-
} else {
|
|
43
|
-
buf = new Array(buf_len);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// convert
|
|
47
|
-
for (i=0, m_pos = 0; i < buf_len; m_pos++) {
|
|
48
|
-
c = str.charCodeAt(m_pos);
|
|
49
|
-
if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) {
|
|
50
|
-
c2 = str.charCodeAt(m_pos+1);
|
|
51
|
-
if ((c2 & 0xfc00) === 0xdc00) {
|
|
52
|
-
c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
|
|
53
|
-
m_pos++;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (c < 0x80) {
|
|
57
|
-
/* one byte */
|
|
58
|
-
buf[i++] = c;
|
|
59
|
-
} else if (c < 0x800) {
|
|
60
|
-
/* two bytes */
|
|
61
|
-
buf[i++] = 0xC0 | (c >>> 6);
|
|
62
|
-
buf[i++] = 0x80 | (c & 0x3f);
|
|
63
|
-
} else if (c < 0x10000) {
|
|
64
|
-
/* three bytes */
|
|
65
|
-
buf[i++] = 0xE0 | (c >>> 12);
|
|
66
|
-
buf[i++] = 0x80 | (c >>> 6 & 0x3f);
|
|
67
|
-
buf[i++] = 0x80 | (c & 0x3f);
|
|
68
|
-
} else {
|
|
69
|
-
/* four bytes */
|
|
70
|
-
buf[i++] = 0xf0 | (c >>> 18);
|
|
71
|
-
buf[i++] = 0x80 | (c >>> 12 & 0x3f);
|
|
72
|
-
buf[i++] = 0x80 | (c >>> 6 & 0x3f);
|
|
73
|
-
buf[i++] = 0x80 | (c & 0x3f);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return buf;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// Calculate max possible position in utf8 buffer,
|
|
81
|
-
// that will not break sequence. If that's not possible
|
|
82
|
-
// - (very small limits) return max size as is.
|
|
83
|
-
//
|
|
84
|
-
// buf[] - utf8 bytes array
|
|
85
|
-
// max - length limit (mandatory);
|
|
86
|
-
var utf8border = function(buf, max) {
|
|
87
|
-
var pos;
|
|
88
|
-
|
|
89
|
-
max = max || buf.length;
|
|
90
|
-
if (max > buf.length) { max = buf.length; }
|
|
91
|
-
|
|
92
|
-
// go back from last position, until start of sequence found
|
|
93
|
-
pos = max-1;
|
|
94
|
-
while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }
|
|
95
|
-
|
|
96
|
-
// Fuckup - very small and broken sequence,
|
|
97
|
-
// return max, because we should return something anyway.
|
|
98
|
-
if (pos < 0) { return max; }
|
|
99
|
-
|
|
100
|
-
// If we came to start of buffer - that means vuffer is too small,
|
|
101
|
-
// return max too.
|
|
102
|
-
if (pos === 0) { return max; }
|
|
103
|
-
|
|
104
|
-
return (pos + _utf8len[buf[pos]] > max) ? pos : max;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// convert array to string
|
|
108
|
-
var buf2string = function (buf) {
|
|
109
|
-
var i, out, c, c_len;
|
|
110
|
-
var len = buf.length;
|
|
111
|
-
|
|
112
|
-
// Reserve max possible length (2 words per char)
|
|
113
|
-
// NB: by unknown reasons, Array is significantly faster for
|
|
114
|
-
// String.fromCharCode.apply than Uint16Array.
|
|
115
|
-
var utf16buf = new Array(len*2);
|
|
116
|
-
|
|
117
|
-
for (out=0, i=0; i<len;) {
|
|
118
|
-
c = buf[i++];
|
|
119
|
-
// quick process ascii
|
|
120
|
-
if (c < 0x80) { utf16buf[out++] = c; continue; }
|
|
121
|
-
|
|
122
|
-
c_len = _utf8len[c];
|
|
123
|
-
// skip 5 & 6 byte codes
|
|
124
|
-
if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; }
|
|
125
|
-
|
|
126
|
-
// apply mask on first byte
|
|
127
|
-
c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
|
|
128
|
-
// join the rest
|
|
129
|
-
while (c_len > 1 && i < len) {
|
|
130
|
-
c = (c << 6) | (buf[i++] & 0x3f);
|
|
131
|
-
c_len--;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// terminated by end of string?
|
|
135
|
-
if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }
|
|
136
|
-
|
|
137
|
-
if (c < 0x10000) {
|
|
138
|
-
utf16buf[out++] = c;
|
|
139
|
-
} else {
|
|
140
|
-
c -= 0x10000;
|
|
141
|
-
utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);
|
|
142
|
-
utf16buf[out++] = 0xdc00 | (c & 0x3ff);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// shrinkBuf(utf16buf, out)
|
|
147
|
-
if (utf16buf.length !== out) {
|
|
148
|
-
if(utf16buf.subarray) {
|
|
149
|
-
utf16buf = utf16buf.subarray(0, out);
|
|
150
|
-
} else {
|
|
151
|
-
utf16buf.length = out;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// return String.fromCharCode.apply(null, utf16buf);
|
|
156
|
-
return utils.applyFromCharCode(utf16buf);
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
// That's all for the pako functions.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Transform a javascript string into an array (typed if possible) of bytes,
|
|
165
|
-
* UTF-8 encoded.
|
|
166
|
-
* @param {String} str the string to encode
|
|
167
|
-
* @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.
|
|
168
|
-
*/
|
|
169
|
-
exports.utf8encode = function utf8encode(str) {
|
|
170
|
-
if (support.nodebuffer) {
|
|
171
|
-
return nodejsUtils.newBufferFrom(str, "utf-8");
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return string2buf(str);
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Transform a bytes array (or a representation) representing an UTF-8 encoded
|
|
180
|
-
* string into a javascript string.
|
|
181
|
-
* @param {Array|Uint8Array|Buffer} buf the data de decode
|
|
182
|
-
* @return {String} the decoded string.
|
|
183
|
-
*/
|
|
184
|
-
exports.utf8decode = function utf8decode(buf) {
|
|
185
|
-
if (support.nodebuffer) {
|
|
186
|
-
return utils.transformTo("nodebuffer", buf).toString("utf-8");
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf);
|
|
190
|
-
|
|
191
|
-
return buf2string(buf);
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* A worker to decode utf8 encoded binary chunks into string chunks.
|
|
196
|
-
* @constructor
|
|
197
|
-
*/
|
|
198
|
-
function Utf8DecodeWorker() {
|
|
199
|
-
GenericWorker.call(this, "utf-8 decode");
|
|
200
|
-
// the last bytes if a chunk didn't end with a complete codepoint.
|
|
201
|
-
this.leftOver = null;
|
|
202
|
-
}
|
|
203
|
-
utils.inherits(Utf8DecodeWorker, GenericWorker);
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* @see GenericWorker.processChunk
|
|
207
|
-
*/
|
|
208
|
-
Utf8DecodeWorker.prototype.processChunk = function (chunk) {
|
|
209
|
-
|
|
210
|
-
var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data);
|
|
211
|
-
|
|
212
|
-
// 1st step, re-use what's left of the previous chunk
|
|
213
|
-
if (this.leftOver && this.leftOver.length) {
|
|
214
|
-
if(support.uint8array) {
|
|
215
|
-
var previousData = data;
|
|
216
|
-
data = new Uint8Array(previousData.length + this.leftOver.length);
|
|
217
|
-
data.set(this.leftOver, 0);
|
|
218
|
-
data.set(previousData, this.leftOver.length);
|
|
219
|
-
} else {
|
|
220
|
-
data = this.leftOver.concat(data);
|
|
221
|
-
}
|
|
222
|
-
this.leftOver = null;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
var nextBoundary = utf8border(data);
|
|
226
|
-
var usableData = data;
|
|
227
|
-
if (nextBoundary !== data.length) {
|
|
228
|
-
if (support.uint8array) {
|
|
229
|
-
usableData = data.subarray(0, nextBoundary);
|
|
230
|
-
this.leftOver = data.subarray(nextBoundary, data.length);
|
|
231
|
-
} else {
|
|
232
|
-
usableData = data.slice(0, nextBoundary);
|
|
233
|
-
this.leftOver = data.slice(nextBoundary, data.length);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
this.push({
|
|
238
|
-
data : exports.utf8decode(usableData),
|
|
239
|
-
meta : chunk.meta
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* @see GenericWorker.flush
|
|
245
|
-
*/
|
|
246
|
-
Utf8DecodeWorker.prototype.flush = function () {
|
|
247
|
-
if(this.leftOver && this.leftOver.length) {
|
|
248
|
-
this.push({
|
|
249
|
-
data : exports.utf8decode(this.leftOver),
|
|
250
|
-
meta : {}
|
|
251
|
-
});
|
|
252
|
-
this.leftOver = null;
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
exports.Utf8DecodeWorker = Utf8DecodeWorker;
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* A worker to endcode string chunks into utf8 encoded binary chunks.
|
|
259
|
-
* @constructor
|
|
260
|
-
*/
|
|
261
|
-
function Utf8EncodeWorker() {
|
|
262
|
-
GenericWorker.call(this, "utf-8 encode");
|
|
263
|
-
}
|
|
264
|
-
utils.inherits(Utf8EncodeWorker, GenericWorker);
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* @see GenericWorker.processChunk
|
|
268
|
-
*/
|
|
269
|
-
Utf8EncodeWorker.prototype.processChunk = function (chunk) {
|
|
270
|
-
this.push({
|
|
271
|
-
data : exports.utf8encode(chunk.data),
|
|
272
|
-
meta : chunk.meta
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
exports.Utf8EncodeWorker = Utf8EncodeWorker;
|