initial commit

This commit is contained in:
2026-07-01 22:38:29 -06:00
commit 9302ad8dce
1662 changed files with 140758 additions and 0 deletions

45
.gitignore vendored Normal file
View File

@@ -0,0 +1,45 @@
/target
/classes
/checkouts
profiles.clj
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port
/.prepl-port
.hgignore
.hg/
node_modules/
build/
# shadow-cljs compilation outputs and cache
.shadow-cljs/
public/js/compiled/
target/
# Node dependencies
node_modules/
# Editor and IDE configurations
.calva/
.cpcache/
.lsp/
.idea/
*.iml
.vscode/
# Environment and sensitive data
.env
.env.*.local
# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vscode
.lsp/*
.clj-kondo/*
.calva/*

24
CHANGELOG.md Normal file
View File

@@ -0,0 +1,24 @@
# Change Log
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
## [Unreleased]
### Changed
- Add a new arity to `make-widget-async` to provide a different widget shape.
## [0.1.1] - 2026-06-18
### Changed
- Documentation on how to make the widgets.
### Removed
- `make-widget-sync` - we're all async, all the time.
### Fixed
- Fixed widget maker to keep working when daylight savings switches over.
## 0.1.0 - 2026-06-18
### Added
- Files from the new template.
- Widget maker public API - `make-widget-sync`.
[Unreleased]: https://sourcehost.site/your-name/il/compare/0.1.1...HEAD
[0.1.1]: https://sourcehost.site/your-name/il/compare/0.1.0...0.1.1

280
LICENSE Normal file
View File

@@ -0,0 +1,280 @@
Eclipse Public License - v 2.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial content
Distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from
and are Distributed by that particular Contributor. A Contribution
"originates" from a Contributor if it was added to the Program by
such Contributor itself or anyone acting on such Contributor's behalf.
Contributions do not include changes or additions to the Program that
are not Modified Works.
"Contributor" means any person or entity that Distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which
are necessarily infringed by the use or sale of its Contribution alone
or when combined with the Program.
"Program" means the Contributions Distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement
or any Secondary License (as applicable), including Contributors.
"Derivative Works" shall mean any work, whether in Source Code or other
form, that is based on (or derived from) the Program and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship.
"Modified Works" shall mean any work in Source Code or other form that
results from an addition to, deletion from, or modification of the
contents of the Program, including, for purposes of clarity any new file
in Source Code form that contains any contents of the Program. Modified
Works shall not include works that contain only declarations,
interfaces, types, classes, structures, or files of the Program solely
in each case in order to link to, bind by name, or subclass the Program
or Modified Works thereof.
"Distribute" means the acts of a) distributing or b) making available
in any manner that enables the transfer of a copy.
"Source Code" means the form of a Program preferred for making
modifications, including but not limited to software source code,
documentation source, and configuration files.
"Secondary License" means either the GNU General Public License,
Version 2.0, or any later versions of that license, including any
exceptions or additional permissions as identified by the initial
Contributor.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free copyright
license to reproduce, prepare Derivative Works of, publicly display,
publicly perform, Distribute and sublicense the Contribution of such
Contributor, if any, and such Derivative Works.
b) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free patent
license under Licensed Patents to make, use, sell, offer to sell,
import and otherwise transfer the Contribution of such Contributor,
if any, in Source Code or other form. This patent license shall
apply to the combination of the Contribution and the Program if, at
the time the Contribution is added by the Contributor, such addition
of the Contribution causes such combination to be covered by the
Licensed Patents. The patent license shall not apply to any other
combinations which include the Contribution. No hardware per se is
licensed hereunder.
c) Recipient understands that although each Contributor grants the
licenses to its Contributions set forth herein, no assurances are
provided by any Contributor that the Program does not infringe the
patent or other intellectual property rights of any other entity.
Each Contributor disclaims any liability to Recipient for claims
brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the
rights and licenses granted hereunder, each Recipient hereby
assumes sole responsibility to secure any other intellectual
property rights needed, if any. For example, if a third party
patent license is required to allow Recipient to Distribute the
Program, it is Recipient's responsibility to acquire that license
before distributing the Program.
d) Each Contributor represents that to its knowledge it has
sufficient copyright rights in its Contribution, if any, to grant
the copyright license set forth in this Agreement.
e) Notwithstanding the terms of any Secondary License, no
Contributor makes additional grants to any Recipient (other than
those set forth in this Agreement) as a result of such Recipient's
receipt of the Program under the terms of a Secondary License
(if permitted under the terms of Section 3).
3. REQUIREMENTS
3.1 If a Contributor Distributes the Program in any form, then:
a) the Program must also be made available as Source Code, in
accordance with section 3.2, and the Contributor must accompany
the Program with a statement that the Source Code for the Program
is available under this Agreement, and informs Recipients how to
obtain it in a reasonable manner on or through a medium customarily
used for software exchange; and
b) the Contributor may Distribute the Program under a license
different than this Agreement, provided that such license:
i) effectively disclaims on behalf of all other Contributors all
warranties and conditions, express and implied, including
warranties or conditions of title and non-infringement, and
implied warranties or conditions of merchantability and fitness
for a particular purpose;
ii) effectively excludes on behalf of all other Contributors all
liability for damages, including direct, indirect, special,
incidental and consequential damages, such as lost profits;
iii) does not attempt to limit or alter the recipients' rights
in the Source Code under section 3.2; and
iv) requires any subsequent distribution of the Program by any
party to be under a license that satisfies the requirements
of this section 3.
3.2 When the Program is Distributed as Source Code:
a) it must be made available under this Agreement, or if the
Program (i) is combined with other material in a separate file or
files made available under a Secondary License, and (ii) the initial
Contributor attached to the Source Code the notice described in
Exhibit A of this Agreement, then the Program may be made available
under the terms of such Secondary Licenses, and
b) a copy of this Agreement must be included with each copy of
the Program.
3.3 Contributors may not remove or alter any copyright, patent,
trademark, attribution notices, disclaimers of warranty, or limitations
of liability ("notices") contained within the Program from any copy of
the Program which they Distribute, provided that Contributors may add
their own appropriate notices.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities
with respect to end users, business partners and the like. While this
license is intended to facilitate the commercial use of the Program,
the Contributor who includes the Program in a commercial product
offering should do so in a manner which does not create potential
liability for other Contributors. Therefore, if a Contributor includes
the Program in a commercial product offering, such Contributor
("Commercial Contributor") hereby agrees to defend and indemnify every
other Contributor ("Indemnified Contributor") against any losses,
damages and costs (collectively "Losses") arising from claims, lawsuits
and other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such
Commercial Contributor in connection with its distribution of the Program
in a commercial product offering. The obligations in this section do not
apply to any claims or Losses relating to any actual or alleged
intellectual property infringement. In order to qualify, an Indemnified
Contributor must: a) promptly notify the Commercial Contributor in
writing of such claim, and b) allow the Commercial Contributor to control,
and cooperate with the Commercial Contributor in, the defense and any
related settlement negotiations. The Indemnified Contributor may
participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial
product offering, Product X. That Contributor is then a Commercial
Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance
claims and warranties are such Commercial Contributor's responsibility
alone. Under this section, the Commercial Contributor would have to
defend claims against the other Contributors related to those performance
claims and warranties, and if a court requires any other Contributor to
pay any damages as a result, the Commercial Contributor must pay
those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. Each Recipient is solely responsible for determining the
appropriateness of using and distributing the Program and assumes all
risks associated with its exercise of rights under this Agreement,
including but not limited to the risks and costs of program errors,
compliance with applicable laws, damage to or loss of data, programs
or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this Agreement, and without further
action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that the
Program itself (excluding combinations of the Program with other software
or hardware) infringes such Recipient's patent(s), then such Recipient's
rights granted under Section 2(b) shall terminate as of the date such
litigation is filed.
All Recipient's rights under this Agreement shall terminate if it
fails to comply with any of the material terms or conditions of this
Agreement and does not cure such failure in a reasonable period of
time after becoming aware of such noncompliance. If all Recipient's
rights under this Agreement terminate, Recipient agrees to cease use
and distribution of the Program as soon as reasonably practicable.
However, Recipient's obligations under this Agreement and any licenses
granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement,
but in order to avoid inconsistency the Agreement is copyrighted and
may only be modified in the following manner. The Agreement Steward
reserves the right to publish new versions (including revisions) of
this Agreement from time to time. No one other than the Agreement
Steward has the right to modify this Agreement. The Eclipse Foundation
is the initial Agreement Steward. The Eclipse Foundation may assign the
responsibility to serve as the Agreement Steward to a suitable separate
entity. Each new version of the Agreement will be given a distinguishing
version number. The Program (including Contributions) may always be
Distributed subject to the version of the Agreement under which it was
received. In addition, after a new version of the Agreement is published,
Contributor may elect to Distribute the Program (including its
Contributions) under the new version.
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
receives no rights or licenses to the intellectual property of any
Contributor under this Agreement, whether expressly, by implication,
estoppel or otherwise. All rights in the Program not expressly granted
under this Agreement are reserved. Nothing in this Agreement is intended
to be enforceable by any entity that is not a Contributor or Recipient.
No third-party beneficiary rights are created under this Agreement.
Exhibit A - Form of Secondary Licenses Notice
"This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set forth
in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public
License as published by the Free Software Foundation, either version 2
of the License, or (at your option) any later version, with the GNU
Classpath Exception which is available at
https://www.gnu.org/software/classpath/license.html."
Simply including a copy of this Agreement, including this Exhibit A
is not sufficient to license the Source Code under Secondary Licenses.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to
look for such a notice.
You may add additional accurate notices of copyright ownership.

22
README.md Normal file
View File

@@ -0,0 +1,22 @@
# il
A Clojure library designed to ... well, that part is up to you.
## Usage
FIXME
## License
Copyright © 2026 FIXME
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License, v. 2.0 are satisfied: GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or (at your
option) any later version, with the GNU Classpath Exception which is available
at https://www.gnu.org/software/classpath/license.html.

8
dev.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
npx shadow-cljs watch app &
lein run
trap 'kill 0' EXIT

3
doc/intro.md Normal file
View File

@@ -0,0 +1,3 @@
# Introduction to il
TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)

1679
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

12
package.json Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "il",
"version": "0.1.0",
"private": true,
"dependencies": {
"pixi": "^0.3.1",
"pixi.js": "^8.5.0"
},
"devDependencies": {
"shadow-cljs": "^2.28.21"
}
}

17
project.clj Normal file
View File

@@ -0,0 +1,17 @@
(defproject il "0.1.0-SNAPSHOT"
:description "Iron Legacy, a browser based sci-fi MMORPG"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.11.1"]
[org.ring-clojure/ring-websocket-async "0.2.0"]
[org.clojure/data.json "2.5.2"]
[compojure "1.7.2"]
[hiccup "2.0.0"]
[org.slf4j/slf4j-simple "2.0.16"]
[org.clojure/data.json "2.5.2"]
[ring/ring-core "1.15.4"]
[ring/ring-jetty-adapter "1.15.4"]
[org.clojure/core.async "1.9.865"]]
:main il.core
:repl-options {:init-ns il.core})

2238
resources/public/js/app.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,462 @@
goog.provide('cljs.core.async.impl.buffers');
cljs.core.async.impl.buffers.acopy = (function cljs$core$async$impl$buffers$acopy(src,src_start,dest,dest_start,len){
var cnt = (0);
while(true){
if((cnt < len)){
(dest[(dest_start + cnt)] = (src[(src_start + cnt)]));
var G__11921 = (cnt + (1));
cnt = G__11921;
continue;
} else {
return null;
}
break;
}
});
/**
* @constructor
*/
cljs.core.async.impl.buffers.RingBuffer = (function (head,tail,length,arr){
this.head = head;
this.tail = tail;
this.length = length;
this.arr = arr;
});
(cljs.core.async.impl.buffers.RingBuffer.prototype.pop = (function (){
var self__ = this;
var _ = this;
if((self__.length === (0))){
return null;
} else {
var x = (self__.arr[self__.tail]);
(self__.arr[self__.tail] = null);
(self__.tail = ((self__.tail + (1)) % self__.arr.length));
(self__.length = (self__.length - (1)));
return x;
}
}));
(cljs.core.async.impl.buffers.RingBuffer.prototype.unshift = (function (x){
var self__ = this;
var _ = this;
(self__.arr[self__.head] = x);
(self__.head = ((self__.head + (1)) % self__.arr.length));
(self__.length = (self__.length + (1)));
return null;
}));
(cljs.core.async.impl.buffers.RingBuffer.prototype.unbounded_unshift = (function (x){
var self__ = this;
var this$ = this;
if(((self__.length + (1)) === self__.arr.length)){
this$.resize();
} else {
}
return this$.unshift(x);
}));
(cljs.core.async.impl.buffers.RingBuffer.prototype.resize = (function (){
var self__ = this;
var _ = this;
var new_arr_size = (self__.arr.length * (2));
var new_arr = (new Array(new_arr_size));
if((self__.tail < self__.head)){
cljs.core.async.impl.buffers.acopy(self__.arr,self__.tail,new_arr,(0),self__.length);
(self__.tail = (0));
(self__.head = self__.length);
return (self__.arr = new_arr);
} else {
if((self__.tail > self__.head)){
cljs.core.async.impl.buffers.acopy(self__.arr,self__.tail,new_arr,(0),(self__.arr.length - self__.tail));
cljs.core.async.impl.buffers.acopy(self__.arr,(0),new_arr,(self__.arr.length - self__.tail),self__.head);
(self__.tail = (0));
(self__.head = self__.length);
return (self__.arr = new_arr);
} else {
if((self__.tail === self__.head)){
(self__.tail = (0));
(self__.head = (0));
return (self__.arr = new_arr);
} else {
return null;
}
}
}
}));
(cljs.core.async.impl.buffers.RingBuffer.prototype.cleanup = (function (keep_QMARK_){
var self__ = this;
var this$ = this;
var n__5593__auto__ = self__.length;
var x = (0);
while(true){
if((x < n__5593__auto__)){
var v_11970 = this$.pop();
if((keep_QMARK_.cljs$core$IFn$_invoke$arity$1 ? keep_QMARK_.cljs$core$IFn$_invoke$arity$1(v_11970) : keep_QMARK_.call(null,v_11970))){
this$.unshift(v_11970);
} else {
}
var G__11972 = (x + (1));
x = G__11972;
continue;
} else {
return null;
}
break;
}
}));
(cljs.core.async.impl.buffers.RingBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"head","head",869147608,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"tail","tail",494507963,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"length","length",-2065447907,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"arr","arr",2115492975,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
}));
(cljs.core.async.impl.buffers.RingBuffer.cljs$lang$type = true);
(cljs.core.async.impl.buffers.RingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/RingBuffer");
(cljs.core.async.impl.buffers.RingBuffer.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.buffers/RingBuffer");
}));
/**
* Positional factory function for cljs.core.async.impl.buffers/RingBuffer.
*/
cljs.core.async.impl.buffers.__GT_RingBuffer = (function cljs$core$async$impl$buffers$__GT_RingBuffer(head,tail,length,arr){
return (new cljs.core.async.impl.buffers.RingBuffer(head,tail,length,arr));
});
cljs.core.async.impl.buffers.ring_buffer = (function cljs$core$async$impl$buffers$ring_buffer(n){
if((n > (0))){
} else {
throw (new Error(["Assert failed: ","Can't create a ring buffer of size 0","\n","(> n 0)"].join('')));
}
return (new cljs.core.async.impl.buffers.RingBuffer((0),(0),(0),(new Array(n))));
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.FixedBuffer = (function (buf,n){
this.buf = buf;
this.n = n;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return (self__.buf.length >= self__.n);
}));
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.pop();
}));
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
self__.buf.unbounded_unshift(itm);
return this$__$1;
}));
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return null;
}));
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.length;
}));
(cljs.core.async.impl.buffers.FixedBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.Symbol(null,"n","n",-2092305744,null)], null);
}));
(cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$type = true);
(cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/FixedBuffer");
(cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.buffers/FixedBuffer");
}));
/**
* Positional factory function for cljs.core.async.impl.buffers/FixedBuffer.
*/
cljs.core.async.impl.buffers.__GT_FixedBuffer = (function cljs$core$async$impl$buffers$__GT_FixedBuffer(buf,n){
return (new cljs.core.async.impl.buffers.FixedBuffer(buf,n));
});
cljs.core.async.impl.buffers.fixed_buffer = (function cljs$core$async$impl$buffers$fixed_buffer(n){
return (new cljs.core.async.impl.buffers.FixedBuffer(cljs.core.async.impl.buffers.ring_buffer(n),n));
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.DroppingBuffer = (function (buf,n){
this.buf = buf;
this.n = n;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return false;
}));
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.pop();
}));
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
if((self__.buf.length === self__.n)){
} else {
self__.buf.unshift(itm);
}
return this$__$1;
}));
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return null;
}));
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.length;
}));
(cljs.core.async.impl.buffers.DroppingBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.Symbol(null,"n","n",-2092305744,null)], null);
}));
(cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$type = true);
(cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/DroppingBuffer");
(cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.buffers/DroppingBuffer");
}));
/**
* Positional factory function for cljs.core.async.impl.buffers/DroppingBuffer.
*/
cljs.core.async.impl.buffers.__GT_DroppingBuffer = (function cljs$core$async$impl$buffers$__GT_DroppingBuffer(buf,n){
return (new cljs.core.async.impl.buffers.DroppingBuffer(buf,n));
});
cljs.core.async.impl.buffers.dropping_buffer = (function cljs$core$async$impl$buffers$dropping_buffer(n){
return (new cljs.core.async.impl.buffers.DroppingBuffer(cljs.core.async.impl.buffers.ring_buffer(n),n));
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.SlidingBuffer = (function (buf,n){
this.buf = buf;
this.n = n;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return false;
}));
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.pop();
}));
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
if((self__.buf.length === self__.n)){
this$__$1.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null);
} else {
}
self__.buf.unshift(itm);
return this$__$1;
}));
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return null;
}));
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.length;
}));
(cljs.core.async.impl.buffers.SlidingBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.Symbol(null,"n","n",-2092305744,null)], null);
}));
(cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$type = true);
(cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/SlidingBuffer");
(cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.buffers/SlidingBuffer");
}));
/**
* Positional factory function for cljs.core.async.impl.buffers/SlidingBuffer.
*/
cljs.core.async.impl.buffers.__GT_SlidingBuffer = (function cljs$core$async$impl$buffers$__GT_SlidingBuffer(buf,n){
return (new cljs.core.async.impl.buffers.SlidingBuffer(buf,n));
});
cljs.core.async.impl.buffers.sliding_buffer = (function cljs$core$async$impl$buffers$sliding_buffer(n){
return (new cljs.core.async.impl.buffers.SlidingBuffer(cljs.core.async.impl.buffers.ring_buffer(n),n));
});
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.impl !== 'undefined') && (typeof cljs.core.async.impl.buffers !== 'undefined') && (typeof cljs.core.async.impl.buffers.NO_VAL !== 'undefined')){
} else {
cljs.core.async.impl.buffers.NO_VAL = (new Object());
}
cljs.core.async.impl.buffers.undelivered_QMARK_ = (function cljs$core$async$impl$buffers$undelivered_QMARK_(val){
return (cljs.core.async.impl.buffers.NO_VAL === val);
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.PromiseBuffer = (function (val){
this.val = val;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return false;
}));
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.val;
}));
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
if(cljs.core.async.impl.buffers.undelivered_QMARK_(self__.val)){
(self__.val = itm);
} else {
}
return this$__$1;
}));
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
if(cljs.core.async.impl.buffers.undelivered_QMARK_(self__.val)){
return (self__.val = null);
} else {
return null;
}
}));
(cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
if(cljs.core.async.impl.buffers.undelivered_QMARK_(self__.val)){
return (0);
} else {
return (1);
}
}));
(cljs.core.async.impl.buffers.PromiseBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
}));
(cljs.core.async.impl.buffers.PromiseBuffer.cljs$lang$type = true);
(cljs.core.async.impl.buffers.PromiseBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/PromiseBuffer");
(cljs.core.async.impl.buffers.PromiseBuffer.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.buffers/PromiseBuffer");
}));
/**
* Positional factory function for cljs.core.async.impl.buffers/PromiseBuffer.
*/
cljs.core.async.impl.buffers.__GT_PromiseBuffer = (function cljs$core$async$impl$buffers$__GT_PromiseBuffer(val){
return (new cljs.core.async.impl.buffers.PromiseBuffer(val));
});
cljs.core.async.impl.buffers.promise_buffer = (function cljs$core$async$impl$buffers$promise_buffer(){
return (new cljs.core.async.impl.buffers.PromiseBuffer(cljs.core.async.impl.buffers.NO_VAL));
});
//# sourceMappingURL=cljs.core.async.impl.buffers.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,682 @@
goog.provide('cljs.core.async.impl.channels');
/**
* @constructor
* @implements {cljs.core.IMeta}
* @implements {cljs.core.IDeref}
* @implements {cljs.core.IWithMeta}
*/
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786 = (function (val,meta14787){
this.val = val;
this.meta14787 = meta14787;
this.cljs$lang$protocol_mask$partition0$ = 425984;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_14788,meta14787__$1){
var self__ = this;
var _14788__$1 = this;
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786(self__.val,meta14787__$1));
}));
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_14788){
var self__ = this;
var _14788__$1 = this;
return self__.meta14787;
}));
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786.prototype.cljs$core$IDeref$_deref$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.val;
}));
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.Symbol(null,"meta14787","meta14787",854640505,null)], null);
}));
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786.cljs$lang$type = true);
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786.cljs$lang$ctorStr = "cljs.core.async.impl.channels/t_cljs$core$async$impl$channels14786");
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.channels/t_cljs$core$async$impl$channels14786");
}));
/**
* Positional factory function for cljs.core.async.impl.channels/t_cljs$core$async$impl$channels14786.
*/
cljs.core.async.impl.channels.__GT_t_cljs$core$async$impl$channels14786 = (function cljs$core$async$impl$channels$__GT_t_cljs$core$async$impl$channels14786(val,meta14787){
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786(val,meta14787));
});
cljs.core.async.impl.channels.box = (function cljs$core$async$impl$channels$box(val){
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels14786(val,cljs.core.PersistentArrayMap.EMPTY));
});
/**
* @constructor
*/
cljs.core.async.impl.channels.PutBox = (function (handler,val){
this.handler = handler;
this.val = val;
});
(cljs.core.async.impl.channels.PutBox.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"handler","handler",1444934915,null),new cljs.core.Symbol(null,"val","val",1769233139,null)], null);
}));
(cljs.core.async.impl.channels.PutBox.cljs$lang$type = true);
(cljs.core.async.impl.channels.PutBox.cljs$lang$ctorStr = "cljs.core.async.impl.channels/PutBox");
(cljs.core.async.impl.channels.PutBox.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.channels/PutBox");
}));
/**
* Positional factory function for cljs.core.async.impl.channels/PutBox.
*/
cljs.core.async.impl.channels.__GT_PutBox = (function cljs$core$async$impl$channels$__GT_PutBox(handler,val){
return (new cljs.core.async.impl.channels.PutBox(handler,val));
});
cljs.core.async.impl.channels.put_active_QMARK_ = (function cljs$core$async$impl$channels$put_active_QMARK_(box){
return cljs.core.async.impl.protocols.active_QMARK_(box.handler);
});
cljs.core.async.impl.channels.MAX_DIRTY = (64);
/**
* @interface
*/
cljs.core.async.impl.channels.MMC = function(){};
var cljs$core$async$impl$channels$MMC$abort$dyn_15089 = (function (this$){
var x__5350__auto__ = (((this$ == null))?null:this$);
var m__5351__auto__ = (cljs.core.async.impl.channels.abort[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__5351__auto__.call(null,this$));
} else {
var m__5349__auto__ = (cljs.core.async.impl.channels.abort["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__5349__auto__.call(null,this$));
} else {
throw cljs.core.missing_protocol("MMC.abort",this$);
}
}
});
cljs.core.async.impl.channels.abort = (function cljs$core$async$impl$channels$abort(this$){
if((((!((this$ == null)))) && ((!((this$.cljs$core$async$impl$channels$MMC$abort$arity$1 == null)))))){
return this$.cljs$core$async$impl$channels$MMC$abort$arity$1(this$);
} else {
return cljs$core$async$impl$channels$MMC$abort$dyn_15089(this$);
}
});
/**
* @constructor
* @implements {cljs.core.async.impl.channels.MMC}
* @implements {cljs.core.async.impl.protocols.Channel}
* @implements {cljs.core.async.impl.protocols.WritePort}
* @implements {cljs.core.async.impl.protocols.ReadPort}
*/
cljs.core.async.impl.channels.ManyToManyChannel = (function (takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_){
this.takes = takes;
this.dirty_takes = dirty_takes;
this.puts = puts;
this.dirty_puts = dirty_puts;
this.buf = buf;
this.closed = closed;
this.add_BANG_ = add_BANG_;
});
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$channels$MMC$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$channels$MMC$abort$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
while(true){
var putter_15092 = self__.puts.pop();
if((putter_15092 == null)){
} else {
var put_handler_15093 = putter_15092.handler;
var val_15094 = putter_15092.val;
if(put_handler_15093.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
var put_cb_15095 = put_handler_15093.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
cljs.core.async.impl.dispatch.run(((function (put_cb_15095,put_handler_15093,val_15094,putter_15092,this$__$1){
return (function (){
return (put_cb_15095.cljs$core$IFn$_invoke$arity$1 ? put_cb_15095.cljs$core$IFn$_invoke$arity$1(true) : put_cb_15095.call(null,true));
});})(put_cb_15095,put_handler_15093,val_15094,putter_15092,this$__$1))
);
} else {
continue;
}
}
break;
}
self__.puts.cleanup(cljs.core.constantly(false));
return this$__$1.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(null);
}));
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (this$,val,handler){
var self__ = this;
var this$__$1 = this;
if((!((val == null)))){
} else {
throw (new Error(["Assert failed: ","Can't put nil on a channel","\n","(not (nil? val))"].join('')));
}
var closed__$1 = self__.closed;
if((!(handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)))){
return cljs.core.async.impl.channels.box((!(closed__$1)));
} else {
if(closed__$1){
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
return cljs.core.async.impl.channels.box(false);
} else {
if(cljs.core.truth_((function (){var and__5000__auto__ = self__.buf;
if(cljs.core.truth_(and__5000__auto__)){
return cljs.core.not(self__.buf.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(null));
} else {
return and__5000__auto__;
}
})())){
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
var done_QMARK_ = cljs.core.reduced_QMARK_((self__.add_BANG_.cljs$core$IFn$_invoke$arity$2 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$2(self__.buf,val) : self__.add_BANG_.call(null,self__.buf,val)));
var take_cbs = (function (){var takers = cljs.core.PersistentVector.EMPTY;
while(true){
if((((self__.takes.length > (0))) && ((cljs.core.count(self__.buf) > (0))))){
var taker = self__.takes.pop();
if(taker.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
var ret = taker.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
var val__$1 = self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null);
var G__15101 = cljs.core.conj.cljs$core$IFn$_invoke$arity$2(takers,((function (takers,ret,val__$1,taker,done_QMARK_,closed__$1,this$__$1){
return (function (){
return (ret.cljs$core$IFn$_invoke$arity$1 ? ret.cljs$core$IFn$_invoke$arity$1(val__$1) : ret.call(null,val__$1));
});})(takers,ret,val__$1,taker,done_QMARK_,closed__$1,this$__$1))
);
takers = G__15101;
continue;
} else {
var G__15102 = takers;
takers = G__15102;
continue;
}
} else {
return takers;
}
break;
}
})();
if(done_QMARK_){
this$__$1.cljs$core$async$impl$channels$MMC$abort$arity$1(null);
} else {
}
if(cljs.core.seq(take_cbs)){
var seq__14837_15104 = cljs.core.seq(take_cbs);
var chunk__14838_15105 = null;
var count__14839_15106 = (0);
var i__14840_15107 = (0);
while(true){
if((i__14840_15107 < count__14839_15106)){
var f_15109 = chunk__14838_15105.cljs$core$IIndexed$_nth$arity$2(null,i__14840_15107);
cljs.core.async.impl.dispatch.run(f_15109);
var G__15110 = seq__14837_15104;
var G__15111 = chunk__14838_15105;
var G__15112 = count__14839_15106;
var G__15113 = (i__14840_15107 + (1));
seq__14837_15104 = G__15110;
chunk__14838_15105 = G__15111;
count__14839_15106 = G__15112;
i__14840_15107 = G__15113;
continue;
} else {
var temp__5804__auto___15114 = cljs.core.seq(seq__14837_15104);
if(temp__5804__auto___15114){
var seq__14837_15115__$1 = temp__5804__auto___15114;
if(cljs.core.chunked_seq_QMARK_(seq__14837_15115__$1)){
var c__5525__auto___15116 = cljs.core.chunk_first(seq__14837_15115__$1);
var G__15117 = cljs.core.chunk_rest(seq__14837_15115__$1);
var G__15118 = c__5525__auto___15116;
var G__15119 = cljs.core.count(c__5525__auto___15116);
var G__15120 = (0);
seq__14837_15104 = G__15117;
chunk__14838_15105 = G__15118;
count__14839_15106 = G__15119;
i__14840_15107 = G__15120;
continue;
} else {
var f_15121 = cljs.core.first(seq__14837_15115__$1);
cljs.core.async.impl.dispatch.run(f_15121);
var G__15122 = cljs.core.next(seq__14837_15115__$1);
var G__15123 = null;
var G__15124 = (0);
var G__15125 = (0);
seq__14837_15104 = G__15122;
chunk__14838_15105 = G__15123;
count__14839_15106 = G__15124;
i__14840_15107 = G__15125;
continue;
}
} else {
}
}
break;
}
} else {
}
return cljs.core.async.impl.channels.box(true);
} else {
var taker = (function (){while(true){
var taker = self__.takes.pop();
if(cljs.core.truth_(taker)){
if(cljs.core.truth_(taker.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null))){
return taker;
} else {
continue;
}
} else {
return null;
}
break;
}
})();
if(cljs.core.truth_(taker)){
var take_cb = taker.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
cljs.core.async.impl.dispatch.run((function (){
return (take_cb.cljs$core$IFn$_invoke$arity$1 ? take_cb.cljs$core$IFn$_invoke$arity$1(val) : take_cb.call(null,val));
}));
return cljs.core.async.impl.channels.box(true);
} else {
if((self__.dirty_puts > (64))){
(self__.dirty_puts = (0));
self__.puts.cleanup(cljs.core.async.impl.channels.put_active_QMARK_);
} else {
(self__.dirty_puts = (self__.dirty_puts + (1)));
}
if(cljs.core.truth_(handler.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1(null))){
if((self__.puts.length < (1024))){
} else {
throw (new Error(["Assert failed: ",["No more than ",cljs.core.str.cljs$core$IFn$_invoke$arity$1((1024))," pending puts are allowed on a single channel."," Consider using a windowed buffer."].join(''),"\n","(< (.-length puts) impl/MAX-QUEUE-SIZE)"].join('')));
}
self__.puts.unbounded_unshift((new cljs.core.async.impl.channels.PutBox(handler,val)));
} else {
}
return null;
}
}
}
}
}));
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (this$,handler){
var self__ = this;
var this$__$1 = this;
if((!(handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)))){
return null;
} else {
if((((!((self__.buf == null)))) && ((cljs.core.count(self__.buf) > (0))))){
var temp__5802__auto__ = handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
if(cljs.core.truth_(temp__5802__auto__)){
var take_cb = temp__5802__auto__;
var val = self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null);
var vec__14910 = ((((cljs.core.not(self__.buf.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(null))) && ((self__.puts.length > (0)))))?(function (){var cbs = cljs.core.PersistentVector.EMPTY;
while(true){
var putter = self__.puts.pop();
var put_handler = putter.handler;
var val__$1 = putter.val;
var cb = (function (){var and__5000__auto__ = put_handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null);
if(and__5000__auto__){
return put_handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
} else {
return and__5000__auto__;
}
})();
var cbs__$1 = (cljs.core.truth_(cb)?cljs.core.conj.cljs$core$IFn$_invoke$arity$2(cbs,cb):cbs);
var done_QMARK_ = (cljs.core.truth_(cb)?cljs.core.reduced_QMARK_((self__.add_BANG_.cljs$core$IFn$_invoke$arity$2 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$2(self__.buf,val__$1) : self__.add_BANG_.call(null,self__.buf,val__$1))):null);
if(((cljs.core.not(done_QMARK_)) && (((cljs.core.not(self__.buf.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(null))) && ((self__.puts.length > (0))))))){
var G__15139 = cbs__$1;
cbs = G__15139;
continue;
} else {
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [done_QMARK_,cbs__$1], null);
}
break;
}
})():null);
var done_QMARK_ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14910,(0),null);
var cbs = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14910,(1),null);
if(cljs.core.truth_(done_QMARK_)){
this$__$1.cljs$core$async$impl$channels$MMC$abort$arity$1(null);
} else {
}
var seq__14966_15145 = cljs.core.seq(cbs);
var chunk__14967_15146 = null;
var count__14968_15147 = (0);
var i__14969_15148 = (0);
while(true){
if((i__14969_15148 < count__14968_15147)){
var cb_15153 = chunk__14967_15146.cljs$core$IIndexed$_nth$arity$2(null,i__14969_15148);
cljs.core.async.impl.dispatch.run(((function (seq__14966_15145,chunk__14967_15146,count__14968_15147,i__14969_15148,cb_15153,val,vec__14910,done_QMARK_,cbs,take_cb,temp__5802__auto__,this$__$1){
return (function (){
return (cb_15153.cljs$core$IFn$_invoke$arity$1 ? cb_15153.cljs$core$IFn$_invoke$arity$1(true) : cb_15153.call(null,true));
});})(seq__14966_15145,chunk__14967_15146,count__14968_15147,i__14969_15148,cb_15153,val,vec__14910,done_QMARK_,cbs,take_cb,temp__5802__auto__,this$__$1))
);
var G__15160 = seq__14966_15145;
var G__15161 = chunk__14967_15146;
var G__15162 = count__14968_15147;
var G__15163 = (i__14969_15148 + (1));
seq__14966_15145 = G__15160;
chunk__14967_15146 = G__15161;
count__14968_15147 = G__15162;
i__14969_15148 = G__15163;
continue;
} else {
var temp__5804__auto___15164 = cljs.core.seq(seq__14966_15145);
if(temp__5804__auto___15164){
var seq__14966_15165__$1 = temp__5804__auto___15164;
if(cljs.core.chunked_seq_QMARK_(seq__14966_15165__$1)){
var c__5525__auto___15166 = cljs.core.chunk_first(seq__14966_15165__$1);
var G__15167 = cljs.core.chunk_rest(seq__14966_15165__$1);
var G__15168 = c__5525__auto___15166;
var G__15169 = cljs.core.count(c__5525__auto___15166);
var G__15170 = (0);
seq__14966_15145 = G__15167;
chunk__14967_15146 = G__15168;
count__14968_15147 = G__15169;
i__14969_15148 = G__15170;
continue;
} else {
var cb_15171 = cljs.core.first(seq__14966_15165__$1);
cljs.core.async.impl.dispatch.run(((function (seq__14966_15145,chunk__14967_15146,count__14968_15147,i__14969_15148,cb_15171,seq__14966_15165__$1,temp__5804__auto___15164,val,vec__14910,done_QMARK_,cbs,take_cb,temp__5802__auto__,this$__$1){
return (function (){
return (cb_15171.cljs$core$IFn$_invoke$arity$1 ? cb_15171.cljs$core$IFn$_invoke$arity$1(true) : cb_15171.call(null,true));
});})(seq__14966_15145,chunk__14967_15146,count__14968_15147,i__14969_15148,cb_15171,seq__14966_15165__$1,temp__5804__auto___15164,val,vec__14910,done_QMARK_,cbs,take_cb,temp__5802__auto__,this$__$1))
);
var G__15172 = cljs.core.next(seq__14966_15165__$1);
var G__15173 = null;
var G__15174 = (0);
var G__15175 = (0);
seq__14966_15145 = G__15172;
chunk__14967_15146 = G__15173;
count__14968_15147 = G__15174;
i__14969_15148 = G__15175;
continue;
}
} else {
}
}
break;
}
return cljs.core.async.impl.channels.box(val);
} else {
return null;
}
} else {
var putter = (function (){while(true){
var putter = self__.puts.pop();
if(cljs.core.truth_(putter)){
if(cljs.core.async.impl.protocols.active_QMARK_(putter.handler)){
return putter;
} else {
continue;
}
} else {
return null;
}
break;
}
})();
if(cljs.core.truth_(putter)){
var put_cb = cljs.core.async.impl.protocols.commit(putter.handler);
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
cljs.core.async.impl.dispatch.run((function (){
return (put_cb.cljs$core$IFn$_invoke$arity$1 ? put_cb.cljs$core$IFn$_invoke$arity$1(true) : put_cb.call(null,true));
}));
return cljs.core.async.impl.channels.box(putter.val);
} else {
if(cljs.core.truth_(self__.closed)){
if(cljs.core.truth_(self__.buf)){
(self__.add_BANG_.cljs$core$IFn$_invoke$arity$1 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$1(self__.buf) : self__.add_BANG_.call(null,self__.buf));
} else {
}
if(cljs.core.truth_((function (){var and__5000__auto__ = handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null);
if(cljs.core.truth_(and__5000__auto__)){
return handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
} else {
return and__5000__auto__;
}
})())){
var has_val = (function (){var and__5000__auto__ = self__.buf;
if(cljs.core.truth_(and__5000__auto__)){
return (cljs.core.count(self__.buf) > (0));
} else {
return and__5000__auto__;
}
})();
var val = (cljs.core.truth_(has_val)?self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null):null);
return cljs.core.async.impl.channels.box(val);
} else {
return null;
}
} else {
if((self__.dirty_takes > (64))){
(self__.dirty_takes = (0));
self__.takes.cleanup(cljs.core.async.impl.protocols.active_QMARK_);
} else {
(self__.dirty_takes = (self__.dirty_takes + (1)));
}
if(cljs.core.truth_(handler.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1(null))){
if((self__.takes.length < (1024))){
} else {
throw (new Error(["Assert failed: ",["No more than ",cljs.core.str.cljs$core$IFn$_invoke$arity$1((1024))," pending takes are allowed on a single channel."].join(''),"\n","(< (.-length takes) impl/MAX-QUEUE-SIZE)"].join('')));
}
self__.takes.unbounded_unshift(handler);
} else {
}
return null;
}
}
}
}
}));
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.closed;
}));
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
if(self__.closed){
return null;
} else {
(self__.closed = true);
if(cljs.core.truth_((function (){var and__5000__auto__ = self__.buf;
if(cljs.core.truth_(and__5000__auto__)){
return (self__.puts.length === (0));
} else {
return and__5000__auto__;
}
})())){
(self__.add_BANG_.cljs$core$IFn$_invoke$arity$1 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$1(self__.buf) : self__.add_BANG_.call(null,self__.buf));
} else {
}
while(true){
var taker_15182 = self__.takes.pop();
if((taker_15182 == null)){
} else {
if(taker_15182.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
var take_cb_15183 = taker_15182.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
var val_15184 = (cljs.core.truth_((function (){var and__5000__auto__ = self__.buf;
if(cljs.core.truth_(and__5000__auto__)){
return (cljs.core.count(self__.buf) > (0));
} else {
return and__5000__auto__;
}
})())?self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null):null);
cljs.core.async.impl.dispatch.run(((function (take_cb_15183,val_15184,taker_15182,this$__$1){
return (function (){
return (take_cb_15183.cljs$core$IFn$_invoke$arity$1 ? take_cb_15183.cljs$core$IFn$_invoke$arity$1(val_15184) : take_cb_15183.call(null,val_15184));
});})(take_cb_15183,val_15184,taker_15182,this$__$1))
);
} else {
}
continue;
}
break;
}
if(cljs.core.truth_(self__.buf)){
self__.buf.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1(null);
} else {
}
return null;
}
}));
(cljs.core.async.impl.channels.ManyToManyChannel.getBasis = (function (){
return new cljs.core.PersistentVector(null, 7, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"takes","takes",298247964,null),cljs.core.with_meta(new cljs.core.Symbol(null,"dirty-takes","dirty-takes",575642138,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),new cljs.core.Symbol(null,"puts","puts",-1883877054,null),cljs.core.with_meta(new cljs.core.Symbol(null,"dirty-puts","dirty-puts",57041148,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"tag","tag",-1290361223),new cljs.core.Symbol(null,"not-native","not-native",-236392494,null)], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"closed","closed",720856168,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),new cljs.core.Symbol(null,"add!","add!",2046056845,null)], null);
}));
(cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$type = true);
(cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$ctorStr = "cljs.core.async.impl.channels/ManyToManyChannel");
(cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.channels/ManyToManyChannel");
}));
/**
* Positional factory function for cljs.core.async.impl.channels/ManyToManyChannel.
*/
cljs.core.async.impl.channels.__GT_ManyToManyChannel = (function cljs$core$async$impl$channels$__GT_ManyToManyChannel(takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_){
return (new cljs.core.async.impl.channels.ManyToManyChannel(takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_));
});
cljs.core.async.impl.channels.ex_handler = (function cljs$core$async$impl$channels$ex_handler(ex){
console.log(ex);
return null;
});
cljs.core.async.impl.channels.handle = (function cljs$core$async$impl$channels$handle(buf,exh,t){
var else$ = (function (){var fexpr__15045 = (function (){var or__5002__auto__ = exh;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return cljs.core.async.impl.channels.ex_handler;
}
})();
return (fexpr__15045.cljs$core$IFn$_invoke$arity$1 ? fexpr__15045.cljs$core$IFn$_invoke$arity$1(t) : fexpr__15045.call(null,t));
})();
if((else$ == null)){
return buf;
} else {
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2(buf,else$);
}
});
cljs.core.async.impl.channels.chan = (function cljs$core$async$impl$channels$chan(var_args){
var G__15056 = arguments.length;
switch (G__15056) {
case 1:
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1 = (function (buf){
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2(buf,null);
}));
(cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2 = (function (buf,xform){
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3(buf,xform,null);
}));
(cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3 = (function (buf,xform,exh){
return (new cljs.core.async.impl.channels.ManyToManyChannel(cljs.core.async.impl.buffers.ring_buffer((32)),(0),cljs.core.async.impl.buffers.ring_buffer((32)),(0),buf,false,(function (){var add_BANG_ = (cljs.core.truth_(xform)?(xform.cljs$core$IFn$_invoke$arity$1 ? xform.cljs$core$IFn$_invoke$arity$1(cljs.core.async.impl.protocols.add_BANG_) : xform.call(null,cljs.core.async.impl.protocols.add_BANG_)):cljs.core.async.impl.protocols.add_BANG_);
return (function() {
var G__15199 = null;
var G__15199__1 = (function (buf__$1){
try{return (add_BANG_.cljs$core$IFn$_invoke$arity$1 ? add_BANG_.cljs$core$IFn$_invoke$arity$1(buf__$1) : add_BANG_.call(null,buf__$1));
}catch (e15080){var t = e15080;
return cljs.core.async.impl.channels.handle(buf__$1,exh,t);
}});
var G__15199__2 = (function (buf__$1,val){
try{return (add_BANG_.cljs$core$IFn$_invoke$arity$2 ? add_BANG_.cljs$core$IFn$_invoke$arity$2(buf__$1,val) : add_BANG_.call(null,buf__$1,val));
}catch (e15084){var t = e15084;
return cljs.core.async.impl.channels.handle(buf__$1,exh,t);
}});
G__15199 = function(buf__$1,val){
switch(arguments.length){
case 1:
return G__15199__1.call(this,buf__$1);
case 2:
return G__15199__2.call(this,buf__$1,val);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__15199.cljs$core$IFn$_invoke$arity$1 = G__15199__1;
G__15199.cljs$core$IFn$_invoke$arity$2 = G__15199__2;
return G__15199;
})()
})()));
}));
(cljs.core.async.impl.channels.chan.cljs$lang$maxFixedArity = 3);
//# sourceMappingURL=cljs.core.async.impl.channels.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,54 @@
goog.provide('cljs.core.async.impl.dispatch');
cljs.core.async.impl.dispatch.tasks = cljs.core.async.impl.buffers.ring_buffer((32));
cljs.core.async.impl.dispatch.running_QMARK_ = false;
cljs.core.async.impl.dispatch.queued_QMARK_ = false;
cljs.core.async.impl.dispatch.TASK_BATCH_SIZE = (1024);
cljs.core.async.impl.dispatch.process_messages = (function cljs$core$async$impl$dispatch$process_messages(){
(cljs.core.async.impl.dispatch.running_QMARK_ = true);
(cljs.core.async.impl.dispatch.queued_QMARK_ = false);
var count_14732 = (0);
while(true){
var m_14733 = cljs.core.async.impl.dispatch.tasks.pop();
if((m_14733 == null)){
} else {
(m_14733.cljs$core$IFn$_invoke$arity$0 ? m_14733.cljs$core$IFn$_invoke$arity$0() : m_14733.call(null));
if((count_14732 < cljs.core.async.impl.dispatch.TASK_BATCH_SIZE)){
var G__14736 = (count_14732 + (1));
count_14732 = G__14736;
continue;
} else {
}
}
break;
}
(cljs.core.async.impl.dispatch.running_QMARK_ = false);
if((cljs.core.async.impl.dispatch.tasks.length > (0))){
return (cljs.core.async.impl.dispatch.queue_dispatcher.cljs$core$IFn$_invoke$arity$0 ? cljs.core.async.impl.dispatch.queue_dispatcher.cljs$core$IFn$_invoke$arity$0() : cljs.core.async.impl.dispatch.queue_dispatcher.call(null));
} else {
return null;
}
});
cljs.core.async.impl.dispatch.queue_dispatcher = (function cljs$core$async$impl$dispatch$queue_dispatcher(){
if(((cljs.core.async.impl.dispatch.queued_QMARK_) && (cljs.core.async.impl.dispatch.running_QMARK_))){
return null;
} else {
(cljs.core.async.impl.dispatch.queued_QMARK_ = true);
return goog.async.nextTick(cljs.core.async.impl.dispatch.process_messages);
}
});
cljs.core.async.impl.dispatch.run = (function cljs$core$async$impl$dispatch$run(f){
cljs.core.async.impl.dispatch.tasks.unbounded_unshift(f);
return cljs.core.async.impl.dispatch.queue_dispatcher();
});
cljs.core.async.impl.dispatch.queue_delay = (function cljs$core$async$impl$dispatch$queue_delay(f,delay){
return setTimeout(f,delay);
});
//# sourceMappingURL=cljs.core.async.impl.dispatch.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["cljs/core/async/impl/dispatch.cljs"],"mappings":";AAYA,AAAKA,sCAAM,yCAAA,zCAACC;AACZ,+CAAA,/CAAKC;AACL,8CAAA,9CAAKC;AAEL,gDAAA,hDAAKC;AAEL,AAAA,AAEA,iDAAA,jDAAMC;AAAN,AACE,gDAAA,/CAAMH;;AACN,+CAAA,9CAAMC;;AACN,kBAAA,dAAOG;;AAAP,AACE,IAAMC,UAAE,AAAMP;AAAd,AACE,GAAU,YAAA,XAAMO;AAAhB;AAAA,AACE,CAACA,wCAAAA,0CAAAA;;AACD,GAAM,CAAGD,cAAMF;AAAf,AACE,eAAO,eAAA,dAAKE;;;;AADd;;;;;AAEN,gDAAA,/CAAMJ;;AACN,GAAM,8CAAA,7CAAG,AAAUF;AAAnB,AACE,QAACQ,+EAAAA,iFAAAA;;AADH;;;AAGF,iDAAA,jDAAMA;AAAN,AACE,GAAU,EAAKL,iDAAQD;AAAvB;;AAAA,AACE,+CAAA,9CAAMC;;AACN,OAACM,oBAAoBJ;;;AAEzB,oCAAA,pCAAMK,gFAAKC;AAAX,AACE,AAAoBX,sDAAMW;;AAC1B,OAACH;;AAEH,4CAAA,5CAAMI,gGAAaD,EAAEE;AAArB,AACE,OAACC,WAAcH,EAAEE","names":["cljs.core.async.impl.dispatch/tasks","cljs.core.async.impl.buffers/ring-buffer","cljs.core.async.impl.dispatch/running?","cljs.core.async.impl.dispatch/queued?","cljs.core.async.impl.dispatch/TASK_BATCH_SIZE","cljs.core.async.impl.dispatch/process-messages","count","m","cljs.core.async.impl.dispatch/queue-dispatcher","js/goog.async.nextTick","cljs.core.async.impl.dispatch/run","f","cljs.core.async.impl.dispatch/queue-delay","delay","js/setTimeout"],"sourcesContent":[";; Copyright (c) Rich Hickey and contributors. All rights reserved.\n;; The use and distribution terms for this software are covered by the\n;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)\n;; which can be found in the file epl-v10.html at the root of this distribution.\n;; By using this software in any fashion, you are agreeing to be bound by\n;; the terms of this license.\n;; You must not remove this notice, or any other, from this software.\n\n(ns cljs.core.async.impl.dispatch\n (:require [cljs.core.async.impl.buffers :as buffers]\n [goog.async.nextTick]))\n\n(def tasks (buffers/ring-buffer 32))\n(def running? false)\n(def queued? false)\n\n(def TASK_BATCH_SIZE 1024)\n\n(declare queue-dispatcher)\n\n(defn process-messages []\n (set! running? true)\n (set! queued? false)\n (loop [count 0]\n (let [m (.pop tasks)]\n (when-not (nil? m)\n (m)\n (when (< count TASK_BATCH_SIZE)\n (recur (inc count))))))\n (set! running? false)\n (when (> (.-length tasks) 0)\n (queue-dispatcher)))\n\n(defn queue-dispatcher []\n (when-not (and queued? running?)\n (set! queued? true)\n (goog.async.nextTick process-messages)))\n\n(defn run [f]\n (.unbounded-unshift tasks f)\n (queue-dispatcher))\n\n(defn queue-delay [f delay]\n (js/setTimeout f delay))\n\n"],"x_google_ignoreList":[0]}

View File

@@ -0,0 +1,165 @@
goog.provide('cljs.core.async.impl.ioc_helpers');
cljs.core.async.impl.ioc_helpers.FN_IDX = (0);
cljs.core.async.impl.ioc_helpers.STATE_IDX = (1);
cljs.core.async.impl.ioc_helpers.VALUE_IDX = (2);
cljs.core.async.impl.ioc_helpers.BINDINGS_IDX = (3);
cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES = (4);
cljs.core.async.impl.ioc_helpers.CURRENT_EXCEPTION = (5);
cljs.core.async.impl.ioc_helpers.USER_START_IDX = (6);
cljs.core.async.impl.ioc_helpers.aset_object = (function cljs$core$async$impl$ioc_helpers$aset_object(arr,idx,o){
return (arr[idx][o]);
});
cljs.core.async.impl.ioc_helpers.aget_object = (function cljs$core$async$impl$ioc_helpers$aget_object(arr,idx){
return (arr[idx]);
});
/**
* Returns true if the machine is in a finished state
*/
cljs.core.async.impl.ioc_helpers.finished_QMARK_ = (function cljs$core$async$impl$ioc_helpers$finished_QMARK_(state_array){
return cljs.core.keyword_identical_QMARK_((state_array[(1)]),new cljs.core.Keyword(null,"finished","finished",-1018867731));
});
/**
* @constructor
* @implements {cljs.core.async.impl.protocols.Handler}
* @implements {cljs.core.IMeta}
* @implements {cljs.core.IWithMeta}
*/
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520 = (function (f,meta14521){
this.f = f;
this.meta14521 = meta14521;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_14522,meta14521__$1){
var self__ = this;
var _14522__$1 = this;
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520(self__.f,meta14521__$1));
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_14522){
var self__ = this;
var _14522__$1 = this;
return self__.meta14521;
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return true;
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return true;
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.f;
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"meta14521","meta14521",-532686661,null)], null);
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.cljs$lang$type = true);
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.cljs$lang$ctorStr = "cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers14520");
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers14520");
}));
/**
* Positional factory function for cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers14520.
*/
cljs.core.async.impl.ioc_helpers.__GT_t_cljs$core$async$impl$ioc_helpers14520 = (function cljs$core$async$impl$ioc_helpers$__GT_t_cljs$core$async$impl$ioc_helpers14520(f,meta14521){
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520(f,meta14521));
});
cljs.core.async.impl.ioc_helpers.fn_handler = (function cljs$core$async$impl$ioc_helpers$fn_handler(f){
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers14520(f,cljs.core.PersistentArrayMap.EMPTY));
});
cljs.core.async.impl.ioc_helpers.run_state_machine = (function cljs$core$async$impl$ioc_helpers$run_state_machine(state){
var fexpr__14539 = cljs.core.async.impl.ioc_helpers.aget_object(state,(0));
return (fexpr__14539.cljs$core$IFn$_invoke$arity$1 ? fexpr__14539.cljs$core$IFn$_invoke$arity$1(state) : fexpr__14539.call(null,state));
});
cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped = (function cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped(state){
try{return cljs.core.async.impl.ioc_helpers.run_state_machine(state);
}catch (e14550){if((e14550 instanceof Object)){
var ex = e14550;
cljs.core.async.impl.ioc_helpers.aget_object(state,(6)).cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(null);
throw ex;
} else {
throw e14550;
}
}});
cljs.core.async.impl.ioc_helpers.take_BANG_ = (function cljs$core$async$impl$ioc_helpers$take_BANG_(state,blk,c){
var temp__5802__auto__ = c.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2(null,cljs.core.async.impl.ioc_helpers.fn_handler((function (x){
var statearr_14562_14607 = state;
(statearr_14562_14607[(2)] = x);
(statearr_14562_14607[(1)] = blk);
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state);
})));
if(cljs.core.truth_(temp__5802__auto__)){
var cb = temp__5802__auto__;
var statearr_14567_14611 = state;
(statearr_14567_14611[(2)] = cljs.core.deref(cb));
(statearr_14567_14611[(1)] = blk);
return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
});
cljs.core.async.impl.ioc_helpers.put_BANG_ = (function cljs$core$async$impl$ioc_helpers$put_BANG_(state,blk,c,val){
var temp__5802__auto__ = c.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(null,val,cljs.core.async.impl.ioc_helpers.fn_handler((function (ret_val){
var statearr_14578_14614 = state;
(statearr_14578_14614[(2)] = ret_val);
(statearr_14578_14614[(1)] = blk);
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state);
})));
if(cljs.core.truth_(temp__5802__auto__)){
var cb = temp__5802__auto__;
var statearr_14580_14617 = state;
(statearr_14580_14617[(2)] = cljs.core.deref(cb));
(statearr_14580_14617[(1)] = blk);
return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
});
cljs.core.async.impl.ioc_helpers.return_chan = (function cljs$core$async$impl$ioc_helpers$return_chan(state,value){
var c = (state[(6)]);
if((value == null)){
} else {
c.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(null,value,cljs.core.async.impl.ioc_helpers.fn_handler((function (_){
return null;
})));
}
c.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(null);
return c;
});
//# sourceMappingURL=cljs.core.async.impl.ioc_helpers.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,342 @@
goog.provide('cljs.core.async.impl.protocols');
cljs.core.async.impl.protocols.MAX_QUEUE_SIZE = (1024);
/**
* @interface
*/
cljs.core.async.impl.protocols.ReadPort = function(){};
var cljs$core$async$impl$protocols$ReadPort$take_BANG_$dyn_11727 = (function (port,fn1_handler){
var x__5350__auto__ = (((port == null))?null:port);
var m__5351__auto__ = (cljs.core.async.impl.protocols.take_BANG_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(port,fn1_handler) : m__5351__auto__.call(null,port,fn1_handler));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.take_BANG_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(port,fn1_handler) : m__5349__auto__.call(null,port,fn1_handler));
} else {
throw cljs.core.missing_protocol("ReadPort.take!",port);
}
}
});
/**
* derefable val if taken, nil if take was enqueued
*/
cljs.core.async.impl.protocols.take_BANG_ = (function cljs$core$async$impl$protocols$take_BANG_(port,fn1_handler){
if((((!((port == null)))) && ((!((port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 == null)))))){
return port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2(port,fn1_handler);
} else {
return cljs$core$async$impl$protocols$ReadPort$take_BANG_$dyn_11727(port,fn1_handler);
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.WritePort = function(){};
var cljs$core$async$impl$protocols$WritePort$put_BANG_$dyn_11737 = (function (port,val,fn1_handler){
var x__5350__auto__ = (((port == null))?null:port);
var m__5351__auto__ = (cljs.core.async.impl.protocols.put_BANG_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$3(port,val,fn1_handler) : m__5351__auto__.call(null,port,val,fn1_handler));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.put_BANG_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$3(port,val,fn1_handler) : m__5349__auto__.call(null,port,val,fn1_handler));
} else {
throw cljs.core.missing_protocol("WritePort.put!",port);
}
}
});
/**
* derefable boolean (false if already closed) if handled, nil if put was enqueued.
* Must throw on nil val.
*/
cljs.core.async.impl.protocols.put_BANG_ = (function cljs$core$async$impl$protocols$put_BANG_(port,val,fn1_handler){
if((((!((port == null)))) && ((!((port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 == null)))))){
return port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(port,val,fn1_handler);
} else {
return cljs$core$async$impl$protocols$WritePort$put_BANG_$dyn_11737(port,val,fn1_handler);
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.Channel = function(){};
var cljs$core$async$impl$protocols$Channel$close_BANG_$dyn_11739 = (function (chan){
var x__5350__auto__ = (((chan == null))?null:chan);
var m__5351__auto__ = (cljs.core.async.impl.protocols.close_BANG_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5351__auto__.call(null,chan));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.close_BANG_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5349__auto__.call(null,chan));
} else {
throw cljs.core.missing_protocol("Channel.close!",chan);
}
}
});
cljs.core.async.impl.protocols.close_BANG_ = (function cljs$core$async$impl$protocols$close_BANG_(chan){
if((((!((chan == null)))) && ((!((chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 == null)))))){
return chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(chan);
} else {
return cljs$core$async$impl$protocols$Channel$close_BANG_$dyn_11739(chan);
}
});
var cljs$core$async$impl$protocols$Channel$closed_QMARK_$dyn_11741 = (function (chan){
var x__5350__auto__ = (((chan == null))?null:chan);
var m__5351__auto__ = (cljs.core.async.impl.protocols.closed_QMARK_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5351__auto__.call(null,chan));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.closed_QMARK_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5349__auto__.call(null,chan));
} else {
throw cljs.core.missing_protocol("Channel.closed?",chan);
}
}
});
cljs.core.async.impl.protocols.closed_QMARK_ = (function cljs$core$async$impl$protocols$closed_QMARK_(chan){
if((((!((chan == null)))) && ((!((chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 == null)))))){
return chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1(chan);
} else {
return cljs$core$async$impl$protocols$Channel$closed_QMARK_$dyn_11741(chan);
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.Handler = function(){};
var cljs$core$async$impl$protocols$Handler$active_QMARK_$dyn_11742 = (function (h){
var x__5350__auto__ = (((h == null))?null:h);
var m__5351__auto__ = (cljs.core.async.impl.protocols.active_QMARK_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5351__auto__.call(null,h));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.active_QMARK_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5349__auto__.call(null,h));
} else {
throw cljs.core.missing_protocol("Handler.active?",h);
}
}
});
/**
* returns true if has callback. Must work w/o lock
*/
cljs.core.async.impl.protocols.active_QMARK_ = (function cljs$core$async$impl$protocols$active_QMARK_(h){
if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 == null)))))){
return h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(h);
} else {
return cljs$core$async$impl$protocols$Handler$active_QMARK_$dyn_11742(h);
}
});
var cljs$core$async$impl$protocols$Handler$blockable_QMARK_$dyn_11748 = (function (h){
var x__5350__auto__ = (((h == null))?null:h);
var m__5351__auto__ = (cljs.core.async.impl.protocols.blockable_QMARK_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5351__auto__.call(null,h));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.blockable_QMARK_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5349__auto__.call(null,h));
} else {
throw cljs.core.missing_protocol("Handler.blockable?",h);
}
}
});
/**
* returns true if this handler may be blocked, otherwise it must not block
*/
cljs.core.async.impl.protocols.blockable_QMARK_ = (function cljs$core$async$impl$protocols$blockable_QMARK_(h){
if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 == null)))))){
return h.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1(h);
} else {
return cljs$core$async$impl$protocols$Handler$blockable_QMARK_$dyn_11748(h);
}
});
var cljs$core$async$impl$protocols$Handler$commit$dyn_11752 = (function (h){
var x__5350__auto__ = (((h == null))?null:h);
var m__5351__auto__ = (cljs.core.async.impl.protocols.commit[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5351__auto__.call(null,h));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.commit["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5349__auto__.call(null,h));
} else {
throw cljs.core.missing_protocol("Handler.commit",h);
}
}
});
/**
* commit to fulfilling its end of the transfer, returns cb. Must be called within lock
*/
cljs.core.async.impl.protocols.commit = (function cljs$core$async$impl$protocols$commit(h){
if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$commit$arity$1 == null)))))){
return h.cljs$core$async$impl$protocols$Handler$commit$arity$1(h);
} else {
return cljs$core$async$impl$protocols$Handler$commit$dyn_11752(h);
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.Buffer = function(){};
var cljs$core$async$impl$protocols$Buffer$full_QMARK_$dyn_11758 = (function (b){
var x__5350__auto__ = (((b == null))?null:b);
var m__5351__auto__ = (cljs.core.async.impl.protocols.full_QMARK_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5351__auto__.call(null,b));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.full_QMARK_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5349__auto__.call(null,b));
} else {
throw cljs.core.missing_protocol("Buffer.full?",b);
}
}
});
/**
* returns true if buffer cannot accept put
*/
cljs.core.async.impl.protocols.full_QMARK_ = (function cljs$core$async$impl$protocols$full_QMARK_(b){
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 == null)))))){
return b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(b);
} else {
return cljs$core$async$impl$protocols$Buffer$full_QMARK_$dyn_11758(b);
}
});
var cljs$core$async$impl$protocols$Buffer$remove_BANG_$dyn_11762 = (function (b){
var x__5350__auto__ = (((b == null))?null:b);
var m__5351__auto__ = (cljs.core.async.impl.protocols.remove_BANG_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5351__auto__.call(null,b));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.remove_BANG_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5349__auto__.call(null,b));
} else {
throw cljs.core.missing_protocol("Buffer.remove!",b);
}
}
});
/**
* remove and return next item from buffer, called under chan mutex
*/
cljs.core.async.impl.protocols.remove_BANG_ = (function cljs$core$async$impl$protocols$remove_BANG_(b){
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 == null)))))){
return b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(b);
} else {
return cljs$core$async$impl$protocols$Buffer$remove_BANG_$dyn_11762(b);
}
});
var cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$dyn_11767 = (function (b,itm){
var x__5350__auto__ = (((b == null))?null:b);
var m__5351__auto__ = (cljs.core.async.impl.protocols.add_BANG__STAR_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(b,itm) : m__5351__auto__.call(null,b,itm));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.add_BANG__STAR_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(b,itm) : m__5349__auto__.call(null,b,itm));
} else {
throw cljs.core.missing_protocol("Buffer.add!*",b);
}
}
});
/**
* if room, add item to the buffer, returns b, called under chan mutex
*/
cljs.core.async.impl.protocols.add_BANG__STAR_ = (function cljs$core$async$impl$protocols$add_BANG__STAR_(b,itm){
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 == null)))))){
return b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2(b,itm);
} else {
return cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$dyn_11767(b,itm);
}
});
var cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$dyn_11776 = (function (b){
var x__5350__auto__ = (((b == null))?null:b);
var m__5351__auto__ = (cljs.core.async.impl.protocols.close_buf_BANG_[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5351__auto__.call(null,b));
} else {
var m__5349__auto__ = (cljs.core.async.impl.protocols.close_buf_BANG_["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5349__auto__.call(null,b));
} else {
throw cljs.core.missing_protocol("Buffer.close-buf!",b);
}
}
});
/**
* called on chan closed under chan mutex, return ignored
*/
cljs.core.async.impl.protocols.close_buf_BANG_ = (function cljs$core$async$impl$protocols$close_buf_BANG_(b){
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 == null)))))){
return b.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1(b);
} else {
return cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$dyn_11776(b);
}
});
cljs.core.async.impl.protocols.add_BANG_ = (function cljs$core$async$impl$protocols$add_BANG_(var_args){
var G__11719 = arguments.length;
switch (G__11719) {
case 1:
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (b){
return b;
}));
(cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (b,itm){
if((!((itm == null)))){
} else {
throw (new Error("Assert failed: (not (nil? itm))"));
}
return cljs.core.async.impl.protocols.add_BANG__STAR_(b,itm);
}));
(cljs.core.async.impl.protocols.add_BANG_.cljs$lang$maxFixedArity = 2);
/**
* @interface
*/
cljs.core.async.impl.protocols.UnblockingBuffer = function(){};
//# sourceMappingURL=cljs.core.async.impl.protocols.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,481 @@
goog.provide('cljs.core.async.impl.timers');
cljs.core.async.impl.timers.MAX_LEVEL = (15);
cljs.core.async.impl.timers.P = ((1) / (2));
cljs.core.async.impl.timers.random_level = (function cljs$core$async$impl$timers$random_level(var_args){
var G__15127 = arguments.length;
switch (G__15127) {
case 0:
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0 = (function (){
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1((0));
}));
(cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1 = (function (level){
while(true){
if((((Math.random() < cljs.core.async.impl.timers.P)) && ((level < cljs.core.async.impl.timers.MAX_LEVEL)))){
var G__15412 = (level + (1));
level = G__15412;
continue;
} else {
return level;
}
break;
}
}));
(cljs.core.async.impl.timers.random_level.cljs$lang$maxFixedArity = 1);
/**
* @constructor
* @implements {cljs.core.ISeqable}
* @implements {cljs.core.IPrintWithWriter}
*/
cljs.core.async.impl.timers.SkipListNode = (function (key,val,forward){
this.key = key;
this.val = val;
this.forward = forward;
this.cljs$lang$protocol_mask$partition0$ = 2155872256;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.timers.SkipListNode.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (coll){
var self__ = this;
var coll__$1 = this;
return (new cljs.core.List(null,self__.key,(new cljs.core.List(null,self__.val,null,(1),null)),(2),null));
}));
(cljs.core.async.impl.timers.SkipListNode.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (coll,writer,opts){
var self__ = this;
var coll__$1 = this;
return cljs.core.pr_sequential_writer(writer,cljs.core.pr_writer,"["," ","]",opts,coll__$1);
}));
(cljs.core.async.impl.timers.SkipListNode.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"key","key",124488940,null),cljs.core.with_meta(new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),new cljs.core.Symbol(null,"forward","forward",1083186224,null)], null);
}));
(cljs.core.async.impl.timers.SkipListNode.cljs$lang$type = true);
(cljs.core.async.impl.timers.SkipListNode.cljs$lang$ctorStr = "cljs.core.async.impl.timers/SkipListNode");
(cljs.core.async.impl.timers.SkipListNode.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.timers/SkipListNode");
}));
/**
* Positional factory function for cljs.core.async.impl.timers/SkipListNode.
*/
cljs.core.async.impl.timers.__GT_SkipListNode = (function cljs$core$async$impl$timers$__GT_SkipListNode(key,val,forward){
return (new cljs.core.async.impl.timers.SkipListNode(key,val,forward));
});
cljs.core.async.impl.timers.skip_list_node = (function cljs$core$async$impl$timers$skip_list_node(var_args){
var G__15211 = arguments.length;
switch (G__15211) {
case 1:
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 3:
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1 = (function (level){
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3(null,null,level);
}));
(cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3 = (function (k,v,level){
var arr = (new Array((level + (1))));
var i_15461 = (0);
while(true){
if((i_15461 < arr.length)){
(arr[i_15461] = null);
var G__15463 = (i_15461 + (1));
i_15461 = G__15463;
continue;
} else {
}
break;
}
return (new cljs.core.async.impl.timers.SkipListNode(k,v,arr));
}));
(cljs.core.async.impl.timers.skip_list_node.cljs$lang$maxFixedArity = 3);
cljs.core.async.impl.timers.least_greater_node = (function cljs$core$async$impl$timers$least_greater_node(var_args){
var G__15221 = arguments.length;
switch (G__15221) {
case 3:
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
case 4:
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$3 = (function (x,k,level){
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4(x,k,level,null);
}));
(cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4 = (function (x,k,level,update){
while(true){
if((!((level < (0))))){
var x__$1 = (function (){var x__$1 = x;
while(true){
var temp__5802__auto__ = (((level < x__$1.forward.length))?(x__$1.forward[level]):null);
if(cljs.core.truth_(temp__5802__auto__)){
var x_SINGLEQUOTE_ = temp__5802__auto__;
if((x_SINGLEQUOTE_.key < k)){
var G__15471 = x_SINGLEQUOTE_;
x__$1 = G__15471;
continue;
} else {
return x__$1;
}
} else {
return x__$1;
}
break;
}
})();
if((update == null)){
} else {
(update[level] = x__$1);
}
var G__15474 = x__$1;
var G__15475 = k;
var G__15477 = (level - (1));
var G__15478 = update;
x = G__15474;
k = G__15475;
level = G__15477;
update = G__15478;
continue;
} else {
return x;
}
break;
}
}));
(cljs.core.async.impl.timers.least_greater_node.cljs$lang$maxFixedArity = 4);
/**
* @constructor
* @implements {cljs.core.ISeqable}
* @implements {cljs.core.IPrintWithWriter}
*/
cljs.core.async.impl.timers.SkipList = (function (header,level){
this.header = header;
this.level = level;
this.cljs$lang$protocol_mask$partition0$ = 2155872256;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.timers.SkipList.prototype.put = (function (k,v){
var self__ = this;
var coll = this;
var update = (new Array(cljs.core.async.impl.timers.MAX_LEVEL));
var x = cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4(self__.header,k,self__.level,update);
var x__$1 = (x.forward[(0)]);
if((((!((x__$1 == null)))) && ((x__$1.key === k)))){
return (x__$1.val = v);
} else {
var new_level = cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0();
if((new_level > self__.level)){
var i_15489 = (self__.level + (1));
while(true){
if((i_15489 <= (new_level + (1)))){
(update[i_15489] = self__.header);
var G__15490 = (i_15489 + (1));
i_15489 = G__15490;
continue;
} else {
}
break;
}
(self__.level = new_level);
} else {
}
var x__$2 = cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3(k,v,(new Array(new_level)));
var i = (0);
while(true){
if((i <= self__.level)){
var links_15510 = (update[i]).forward;
if((i < x__$2.forward.length)){
(x__$2.forward[i] = (links_15510[i]));
} else {
x__$2.forward.push((((i < links_15510.length))?(links_15510[i]):null));
}
if((i < links_15510.length)){
(links_15510[i] = x__$2);
} else {
links_15510.push(x__$2);
}
var G__15518 = (i + (1));
i = G__15518;
continue;
} else {
return null;
}
break;
}
}
}));
(cljs.core.async.impl.timers.SkipList.prototype.remove = (function (k){
var self__ = this;
var coll = this;
var update = (new Array(cljs.core.async.impl.timers.MAX_LEVEL));
var x = cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4(self__.header,k,self__.level,update);
var x__$1 = (((x.forward.length === (0)))?null:(x.forward[(0)]));
if((((!((x__$1 == null)))) && ((x__$1.key === k)))){
var i_15530 = (0);
while(true){
if((i_15530 <= self__.level)){
var links_15535 = (update[i_15530]).forward;
if((x__$1 === (((i_15530 < links_15535.length))?(links_15535[i_15530]):null))){
(links_15535[i_15530] = (x__$1.forward[i_15530]));
var G__15537 = (i_15530 + (1));
i_15530 = G__15537;
continue;
} else {
var G__15539 = (i_15530 + (1));
i_15530 = G__15539;
continue;
}
} else {
}
break;
}
while(true){
if(((((((0) < self__.level)) && ((self__.level < self__.header.forward.length)))) && (((self__.header.forward[self__.level]) == null)))){
(self__.level = (self__.level - (1)));
continue;
} else {
return null;
}
break;
}
} else {
return null;
}
}));
(cljs.core.async.impl.timers.SkipList.prototype.ceilingEntry = (function (k){
var self__ = this;
var coll = this;
var x = self__.header;
var level__$1 = self__.level;
while(true){
if((!((level__$1 < (0))))){
var nx = (function (){var x__$1 = x;
while(true){
var x_SINGLEQUOTE_ = (((level__$1 < x__$1.forward.length))?(x__$1.forward[level__$1]):null);
if((!((x_SINGLEQUOTE_ == null)))){
if((x_SINGLEQUOTE_.key > k)){
return x__$1;
} else {
var G__15548 = x_SINGLEQUOTE_;
x__$1 = G__15548;
continue;
}
} else {
if((level__$1 === (0))){
return x__$1;
} else {
return null;
}
}
break;
}
})();
if(cljs.core.truth_(nx)){
var G__15549 = nx;
var G__15550 = (level__$1 - (1));
x = G__15549;
level__$1 = G__15550;
continue;
} else {
var G__15551 = x;
var G__15552 = (level__$1 - (1));
x = G__15551;
level__$1 = G__15552;
continue;
}
} else {
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(x.key,k)){
return x;
} else {
return (x.forward[(0)]);
}
}
break;
}
}));
(cljs.core.async.impl.timers.SkipList.prototype.floorEntry = (function (k){
var self__ = this;
var coll = this;
var x = self__.header;
var level__$1 = self__.level;
while(true){
if((!((level__$1 < (0))))){
var nx = (function (){var x__$1 = x;
while(true){
var x_SINGLEQUOTE_ = (((level__$1 < x__$1.forward.length))?(x__$1.forward[level__$1]):null);
if((!((x_SINGLEQUOTE_ == null)))){
if((x_SINGLEQUOTE_.key > k)){
return x__$1;
} else {
var G__15561 = x_SINGLEQUOTE_;
x__$1 = G__15561;
continue;
}
} else {
if((level__$1 === (0))){
return x__$1;
} else {
return null;
}
}
break;
}
})();
if(cljs.core.truth_(nx)){
var G__15562 = nx;
var G__15563 = (level__$1 - (1));
x = G__15562;
level__$1 = G__15563;
continue;
} else {
var G__15564 = x;
var G__15565 = (level__$1 - (1));
x = G__15564;
level__$1 = G__15565;
continue;
}
} else {
if((x === self__.header)){
return null;
} else {
return x;
}
}
break;
}
}));
(cljs.core.async.impl.timers.SkipList.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (coll){
var self__ = this;
var coll__$1 = this;
var iter = (function cljs$core$async$impl$timers$iter(node){
return (new cljs.core.LazySeq(null,(function (){
if((node == null)){
return null;
} else {
return cljs.core.cons(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [node.key,node.val], null),cljs$core$async$impl$timers$iter((node.forward[(0)])));
}
}),null,null));
});
return iter((self__.header.forward[(0)]));
}));
(cljs.core.async.impl.timers.SkipList.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (coll,writer,opts){
var self__ = this;
var coll__$1 = this;
var pr_pair = (function (keyval){
return cljs.core.pr_sequential_writer(writer,cljs.core.pr_writer,""," ","",opts,keyval);
});
return cljs.core.pr_sequential_writer(writer,pr_pair,"{",", ","}",opts,coll__$1);
}));
(cljs.core.async.impl.timers.SkipList.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"header","header",1759972661,null),cljs.core.with_meta(new cljs.core.Symbol(null,"level","level",-1363938217,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
}));
(cljs.core.async.impl.timers.SkipList.cljs$lang$type = true);
(cljs.core.async.impl.timers.SkipList.cljs$lang$ctorStr = "cljs.core.async.impl.timers/SkipList");
(cljs.core.async.impl.timers.SkipList.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
return cljs.core._write(writer__5288__auto__,"cljs.core.async.impl.timers/SkipList");
}));
/**
* Positional factory function for cljs.core.async.impl.timers/SkipList.
*/
cljs.core.async.impl.timers.__GT_SkipList = (function cljs$core$async$impl$timers$__GT_SkipList(header,level){
return (new cljs.core.async.impl.timers.SkipList(header,level));
});
cljs.core.async.impl.timers.skip_list = (function cljs$core$async$impl$timers$skip_list(){
return (new cljs.core.async.impl.timers.SkipList(cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1((0)),(0)));
});
cljs.core.async.impl.timers.timeouts_map = cljs.core.async.impl.timers.skip_list();
cljs.core.async.impl.timers.TIMEOUT_RESOLUTION_MS = (10);
/**
* returns a channel that will close after msecs
*/
cljs.core.async.impl.timers.timeout = (function cljs$core$async$impl$timers$timeout(msecs){
var timeout = ((new Date()).valueOf() + msecs);
var me = cljs.core.async.impl.timers.timeouts_map.ceilingEntry(timeout);
var or__5002__auto__ = (cljs.core.truth_((function (){var and__5000__auto__ = me;
if(cljs.core.truth_(and__5000__auto__)){
return (me.key < (timeout + cljs.core.async.impl.timers.TIMEOUT_RESOLUTION_MS));
} else {
return and__5000__auto__;
}
})())?me.val:null);
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
var timeout_channel = cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1(null);
cljs.core.async.impl.timers.timeouts_map.put(timeout,timeout_channel);
cljs.core.async.impl.dispatch.queue_delay((function (){
cljs.core.async.impl.timers.timeouts_map.remove(timeout);
return cljs.core.async.impl.protocols.close_BANG_(timeout_channel);
}),msecs);
return timeout_channel;
}
});
//# sourceMappingURL=cljs.core.async.impl.timers.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,629 @@
goog.provide('cljs.repl');
cljs.repl.print_doc = (function cljs$repl$print_doc(p__18167){
var map__18168 = p__18167;
var map__18168__$1 = cljs.core.__destructure_map(map__18168);
var m = map__18168__$1;
var n = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18168__$1,new cljs.core.Keyword(null,"ns","ns",441598760));
var nm = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18168__$1,new cljs.core.Keyword(null,"name","name",1843675177));
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["-------------------------"], 0));
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([(function (){var or__5002__auto__ = new cljs.core.Keyword(null,"spec","spec",347520401).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return [(function (){var temp__5804__auto__ = new cljs.core.Keyword(null,"ns","ns",441598760).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_(temp__5804__auto__)){
var ns = temp__5804__auto__;
return [cljs.core.str.cljs$core$IFn$_invoke$arity$1(ns),"/"].join('');
} else {
return null;
}
})(),cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(m))].join('');
}
})()], 0));
if(cljs.core.truth_(new cljs.core.Keyword(null,"protocol","protocol",652470118).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Protocol"], 0));
} else {
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"forms","forms",2045992350).cljs$core$IFn$_invoke$arity$1(m))){
var seq__18179_18682 = cljs.core.seq(new cljs.core.Keyword(null,"forms","forms",2045992350).cljs$core$IFn$_invoke$arity$1(m));
var chunk__18180_18683 = null;
var count__18181_18684 = (0);
var i__18182_18685 = (0);
while(true){
if((i__18182_18685 < count__18181_18684)){
var f_18689 = chunk__18180_18683.cljs$core$IIndexed$_nth$arity$2(null,i__18182_18685);
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",f_18689], 0));
var G__18690 = seq__18179_18682;
var G__18691 = chunk__18180_18683;
var G__18692 = count__18181_18684;
var G__18693 = (i__18182_18685 + (1));
seq__18179_18682 = G__18690;
chunk__18180_18683 = G__18691;
count__18181_18684 = G__18692;
i__18182_18685 = G__18693;
continue;
} else {
var temp__5804__auto___18694 = cljs.core.seq(seq__18179_18682);
if(temp__5804__auto___18694){
var seq__18179_18695__$1 = temp__5804__auto___18694;
if(cljs.core.chunked_seq_QMARK_(seq__18179_18695__$1)){
var c__5525__auto___18696 = cljs.core.chunk_first(seq__18179_18695__$1);
var G__18697 = cljs.core.chunk_rest(seq__18179_18695__$1);
var G__18698 = c__5525__auto___18696;
var G__18699 = cljs.core.count(c__5525__auto___18696);
var G__18700 = (0);
seq__18179_18682 = G__18697;
chunk__18180_18683 = G__18698;
count__18181_18684 = G__18699;
i__18182_18685 = G__18700;
continue;
} else {
var f_18702 = cljs.core.first(seq__18179_18695__$1);
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",f_18702], 0));
var G__18703 = cljs.core.next(seq__18179_18695__$1);
var G__18704 = null;
var G__18705 = (0);
var G__18706 = (0);
seq__18179_18682 = G__18703;
chunk__18180_18683 = G__18704;
count__18181_18684 = G__18705;
i__18182_18685 = G__18706;
continue;
}
} else {
}
}
break;
}
} else {
if(cljs.core.truth_(new cljs.core.Keyword(null,"arglists","arglists",1661989754).cljs$core$IFn$_invoke$arity$1(m))){
var arglists_18707 = new cljs.core.Keyword(null,"arglists","arglists",1661989754).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_((function (){var or__5002__auto__ = new cljs.core.Keyword(null,"macro","macro",-867863404).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return new cljs.core.Keyword(null,"repl-special-function","repl-special-function",1262603725).cljs$core$IFn$_invoke$arity$1(m);
}
})())){
cljs.core.prn.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([arglists_18707], 0));
} else {
cljs.core.prn.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(new cljs.core.Symbol(null,"quote","quote",1377916282,null),cljs.core.first(arglists_18707)))?cljs.core.second(arglists_18707):arglists_18707)], 0));
}
} else {
}
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"special-form","special-form",-1326536374).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Special Form"], 0));
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",new cljs.core.Keyword(null,"doc","doc",1913296891).cljs$core$IFn$_invoke$arity$1(m)], 0));
if(cljs.core.contains_QMARK_(m,new cljs.core.Keyword(null,"url","url",276297046))){
if(cljs.core.truth_(new cljs.core.Keyword(null,"url","url",276297046).cljs$core$IFn$_invoke$arity$1(m))){
return cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([["\n Please see http://clojure.org/",cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"url","url",276297046).cljs$core$IFn$_invoke$arity$1(m))].join('')], 0));
} else {
return null;
}
} else {
return cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([["\n Please see http://clojure.org/special_forms#",cljs.core.str.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(m))].join('')], 0));
}
} else {
if(cljs.core.truth_(new cljs.core.Keyword(null,"macro","macro",-867863404).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Macro"], 0));
} else {
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"spec","spec",347520401).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Spec"], 0));
} else {
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"repl-special-function","repl-special-function",1262603725).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["REPL Special Function"], 0));
} else {
}
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",new cljs.core.Keyword(null,"doc","doc",1913296891).cljs$core$IFn$_invoke$arity$1(m)], 0));
if(cljs.core.truth_(new cljs.core.Keyword(null,"protocol","protocol",652470118).cljs$core$IFn$_invoke$arity$1(m))){
var seq__18222_18711 = cljs.core.seq(new cljs.core.Keyword(null,"methods","methods",453930866).cljs$core$IFn$_invoke$arity$1(m));
var chunk__18224_18712 = null;
var count__18226_18713 = (0);
var i__18227_18714 = (0);
while(true){
if((i__18227_18714 < count__18226_18713)){
var vec__18247_18715 = chunk__18224_18712.cljs$core$IIndexed$_nth$arity$2(null,i__18227_18714);
var name_18716 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18247_18715,(0),null);
var map__18250_18717 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18247_18715,(1),null);
var map__18250_18718__$1 = cljs.core.__destructure_map(map__18250_18717);
var doc_18719 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18250_18718__$1,new cljs.core.Keyword(null,"doc","doc",1913296891));
var arglists_18720 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18250_18718__$1,new cljs.core.Keyword(null,"arglists","arglists",1661989754));
cljs.core.println();
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",name_18716], 0));
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",arglists_18720], 0));
if(cljs.core.truth_(doc_18719)){
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",doc_18719], 0));
} else {
}
var G__18722 = seq__18222_18711;
var G__18723 = chunk__18224_18712;
var G__18724 = count__18226_18713;
var G__18725 = (i__18227_18714 + (1));
seq__18222_18711 = G__18722;
chunk__18224_18712 = G__18723;
count__18226_18713 = G__18724;
i__18227_18714 = G__18725;
continue;
} else {
var temp__5804__auto___18726 = cljs.core.seq(seq__18222_18711);
if(temp__5804__auto___18726){
var seq__18222_18727__$1 = temp__5804__auto___18726;
if(cljs.core.chunked_seq_QMARK_(seq__18222_18727__$1)){
var c__5525__auto___18728 = cljs.core.chunk_first(seq__18222_18727__$1);
var G__18729 = cljs.core.chunk_rest(seq__18222_18727__$1);
var G__18730 = c__5525__auto___18728;
var G__18731 = cljs.core.count(c__5525__auto___18728);
var G__18732 = (0);
seq__18222_18711 = G__18729;
chunk__18224_18712 = G__18730;
count__18226_18713 = G__18731;
i__18227_18714 = G__18732;
continue;
} else {
var vec__18276_18733 = cljs.core.first(seq__18222_18727__$1);
var name_18734 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18276_18733,(0),null);
var map__18279_18735 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18276_18733,(1),null);
var map__18279_18736__$1 = cljs.core.__destructure_map(map__18279_18735);
var doc_18737 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18279_18736__$1,new cljs.core.Keyword(null,"doc","doc",1913296891));
var arglists_18738 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18279_18736__$1,new cljs.core.Keyword(null,"arglists","arglists",1661989754));
cljs.core.println();
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",name_18734], 0));
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",arglists_18738], 0));
if(cljs.core.truth_(doc_18737)){
cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([" ",doc_18737], 0));
} else {
}
var G__18739 = cljs.core.next(seq__18222_18727__$1);
var G__18740 = null;
var G__18741 = (0);
var G__18742 = (0);
seq__18222_18711 = G__18739;
chunk__18224_18712 = G__18740;
count__18226_18713 = G__18741;
i__18227_18714 = G__18742;
continue;
}
} else {
}
}
break;
}
} else {
}
if(cljs.core.truth_(n)){
var temp__5804__auto__ = cljs.spec.alpha.get_spec(cljs.core.symbol.cljs$core$IFn$_invoke$arity$2(cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.ns_name(n)),cljs.core.name(nm)));
if(cljs.core.truth_(temp__5804__auto__)){
var fnspec = temp__5804__auto__;
cljs.core.print.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Spec"], 0));
var seq__18308 = cljs.core.seq(new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"args","args",1315556576),new cljs.core.Keyword(null,"ret","ret",-468222814),new cljs.core.Keyword(null,"fn","fn",-1175266204)], null));
var chunk__18309 = null;
var count__18310 = (0);
var i__18311 = (0);
while(true){
if((i__18311 < count__18310)){
var role = chunk__18309.cljs$core$IIndexed$_nth$arity$2(null,i__18311);
var temp__5804__auto___18746__$1 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(fnspec,role);
if(cljs.core.truth_(temp__5804__auto___18746__$1)){
var spec_18747 = temp__5804__auto___18746__$1;
cljs.core.print.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([["\n ",cljs.core.name(role),":"].join(''),cljs.spec.alpha.describe(spec_18747)], 0));
} else {
}
var G__18748 = seq__18308;
var G__18749 = chunk__18309;
var G__18750 = count__18310;
var G__18751 = (i__18311 + (1));
seq__18308 = G__18748;
chunk__18309 = G__18749;
count__18310 = G__18750;
i__18311 = G__18751;
continue;
} else {
var temp__5804__auto____$1 = cljs.core.seq(seq__18308);
if(temp__5804__auto____$1){
var seq__18308__$1 = temp__5804__auto____$1;
if(cljs.core.chunked_seq_QMARK_(seq__18308__$1)){
var c__5525__auto__ = cljs.core.chunk_first(seq__18308__$1);
var G__18752 = cljs.core.chunk_rest(seq__18308__$1);
var G__18753 = c__5525__auto__;
var G__18754 = cljs.core.count(c__5525__auto__);
var G__18755 = (0);
seq__18308 = G__18752;
chunk__18309 = G__18753;
count__18310 = G__18754;
i__18311 = G__18755;
continue;
} else {
var role = cljs.core.first(seq__18308__$1);
var temp__5804__auto___18756__$2 = cljs.core.get.cljs$core$IFn$_invoke$arity$2(fnspec,role);
if(cljs.core.truth_(temp__5804__auto___18756__$2)){
var spec_18757 = temp__5804__auto___18756__$2;
cljs.core.print.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([["\n ",cljs.core.name(role),":"].join(''),cljs.spec.alpha.describe(spec_18757)], 0));
} else {
}
var G__18758 = cljs.core.next(seq__18308__$1);
var G__18759 = null;
var G__18760 = (0);
var G__18761 = (0);
seq__18308 = G__18758;
chunk__18309 = G__18759;
count__18310 = G__18760;
i__18311 = G__18761;
continue;
}
} else {
return null;
}
}
break;
}
} else {
return null;
}
} else {
return null;
}
}
});
/**
* Constructs a data representation for a Error with keys:
* :cause - root cause message
* :phase - error phase
* :via - cause chain, with cause keys:
* :type - exception class symbol
* :message - exception message
* :data - ex-data
* :at - top stack element
* :trace - root cause stack elements
*/
cljs.repl.Error__GT_map = (function cljs$repl$Error__GT_map(o){
return cljs.core.Throwable__GT_map(o);
});
/**
* Returns an analysis of the phase, error, cause, and location of an error that occurred
* based on Throwable data, as returned by Throwable->map. All attributes other than phase
* are optional:
* :clojure.error/phase - keyword phase indicator, one of:
* :read-source :compile-syntax-check :compilation :macro-syntax-check :macroexpansion
* :execution :read-eval-result :print-eval-result
* :clojure.error/source - file name (no path)
* :clojure.error/line - integer line number
* :clojure.error/column - integer column number
* :clojure.error/symbol - symbol being expanded/compiled/invoked
* :clojure.error/class - cause exception class symbol
* :clojure.error/cause - cause exception message
* :clojure.error/spec - explain-data for spec error
*/
cljs.repl.ex_triage = (function cljs$repl$ex_triage(datafied_throwable){
var map__18425 = datafied_throwable;
var map__18425__$1 = cljs.core.__destructure_map(map__18425);
var via = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18425__$1,new cljs.core.Keyword(null,"via","via",-1904457336));
var trace = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18425__$1,new cljs.core.Keyword(null,"trace","trace",-1082747415));
var phase = cljs.core.get.cljs$core$IFn$_invoke$arity$3(map__18425__$1,new cljs.core.Keyword(null,"phase","phase",575722892),new cljs.core.Keyword(null,"execution","execution",253283524));
var map__18427 = cljs.core.last(via);
var map__18427__$1 = cljs.core.__destructure_map(map__18427);
var type = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18427__$1,new cljs.core.Keyword(null,"type","type",1174270348));
var message = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18427__$1,new cljs.core.Keyword(null,"message","message",-406056002));
var data = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18427__$1,new cljs.core.Keyword(null,"data","data",-232669377));
var map__18428 = data;
var map__18428__$1 = cljs.core.__destructure_map(map__18428);
var problems = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18428__$1,new cljs.core.Keyword("cljs.spec.alpha","problems","cljs.spec.alpha/problems",447400814));
var fn = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18428__$1,new cljs.core.Keyword("cljs.spec.alpha","fn","cljs.spec.alpha/fn",408600443));
var caller = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18428__$1,new cljs.core.Keyword("cljs.spec.test.alpha","caller","cljs.spec.test.alpha/caller",-398302390));
var map__18429 = new cljs.core.Keyword(null,"data","data",-232669377).cljs$core$IFn$_invoke$arity$1(cljs.core.first(via));
var map__18429__$1 = cljs.core.__destructure_map(map__18429);
var top_data = map__18429__$1;
var source = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18429__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397));
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3((function (){var G__18433 = phase;
var G__18433__$1 = (((G__18433 instanceof cljs.core.Keyword))?G__18433.fqn:null);
switch (G__18433__$1) {
case "read-source":
var map__18450 = data;
var map__18450__$1 = cljs.core.__destructure_map(map__18450);
var line = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18450__$1,new cljs.core.Keyword("clojure.error","line","clojure.error/line",-1816287471));
var column = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18450__$1,new cljs.core.Keyword("clojure.error","column","clojure.error/column",304721553));
var G__18470 = cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([new cljs.core.Keyword(null,"data","data",-232669377).cljs$core$IFn$_invoke$arity$1(cljs.core.second(via)),top_data], 0));
var G__18470__$1 = (cljs.core.truth_(source)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18470,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397),source):G__18470);
var G__18470__$2 = (cljs.core.truth_((function (){var fexpr__18473 = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, ["NO_SOURCE_PATH",null,"NO_SOURCE_FILE",null], null), null);
return (fexpr__18473.cljs$core$IFn$_invoke$arity$1 ? fexpr__18473.cljs$core$IFn$_invoke$arity$1(source) : fexpr__18473.call(null,source));
})())?cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(G__18470__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397)):G__18470__$1);
if(cljs.core.truth_(message)){
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18470__$2,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742),message);
} else {
return G__18470__$2;
}
break;
case "compile-syntax-check":
case "compilation":
case "macro-syntax-check":
case "macroexpansion":
var G__18474 = top_data;
var G__18474__$1 = (cljs.core.truth_(source)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18474,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397),source):G__18474);
var G__18474__$2 = (cljs.core.truth_((function (){var fexpr__18484 = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, ["NO_SOURCE_PATH",null,"NO_SOURCE_FILE",null], null), null);
return (fexpr__18484.cljs$core$IFn$_invoke$arity$1 ? fexpr__18484.cljs$core$IFn$_invoke$arity$1(source) : fexpr__18484.call(null,source));
})())?cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(G__18474__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397)):G__18474__$1);
var G__18474__$3 = (cljs.core.truth_(type)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18474__$2,new cljs.core.Keyword("clojure.error","class","clojure.error/class",278435890),type):G__18474__$2);
var G__18474__$4 = (cljs.core.truth_(message)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18474__$3,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742),message):G__18474__$3);
if(cljs.core.truth_(problems)){
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18474__$4,new cljs.core.Keyword("clojure.error","spec","clojure.error/spec",2055032595),data);
} else {
return G__18474__$4;
}
break;
case "read-eval-result":
case "print-eval-result":
var vec__18496 = cljs.core.first(trace);
var source__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18496,(0),null);
var method = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18496,(1),null);
var file = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18496,(2),null);
var line = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18496,(3),null);
var G__18501 = top_data;
var G__18501__$1 = (cljs.core.truth_(line)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18501,new cljs.core.Keyword("clojure.error","line","clojure.error/line",-1816287471),line):G__18501);
var G__18501__$2 = (cljs.core.truth_(file)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18501__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397),file):G__18501__$1);
var G__18501__$3 = (cljs.core.truth_((function (){var and__5000__auto__ = source__$1;
if(cljs.core.truth_(and__5000__auto__)){
return method;
} else {
return and__5000__auto__;
}
})())?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18501__$2,new cljs.core.Keyword("clojure.error","symbol","clojure.error/symbol",1544821994),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[source__$1,method],null))):G__18501__$2);
var G__18501__$4 = (cljs.core.truth_(type)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18501__$3,new cljs.core.Keyword("clojure.error","class","clojure.error/class",278435890),type):G__18501__$3);
if(cljs.core.truth_(message)){
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18501__$4,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742),message);
} else {
return G__18501__$4;
}
break;
case "execution":
var vec__18508 = cljs.core.first(trace);
var source__$1 = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18508,(0),null);
var method = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18508,(1),null);
var file = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18508,(2),null);
var line = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__18508,(3),null);
var file__$1 = cljs.core.first(cljs.core.remove.cljs$core$IFn$_invoke$arity$2((function (p1__18421_SHARP_){
var or__5002__auto__ = (p1__18421_SHARP_ == null);
if(or__5002__auto__){
return or__5002__auto__;
} else {
var fexpr__18513 = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, ["NO_SOURCE_PATH",null,"NO_SOURCE_FILE",null], null), null);
return (fexpr__18513.cljs$core$IFn$_invoke$arity$1 ? fexpr__18513.cljs$core$IFn$_invoke$arity$1(p1__18421_SHARP_) : fexpr__18513.call(null,p1__18421_SHARP_));
}
}),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"file","file",-1269645878).cljs$core$IFn$_invoke$arity$1(caller),file], null)));
var err_line = (function (){var or__5002__auto__ = new cljs.core.Keyword(null,"line","line",212345235).cljs$core$IFn$_invoke$arity$1(caller);
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return line;
}
})();
var G__18519 = new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword("clojure.error","class","clojure.error/class",278435890),type], null);
var G__18519__$1 = (cljs.core.truth_(err_line)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18519,new cljs.core.Keyword("clojure.error","line","clojure.error/line",-1816287471),err_line):G__18519);
var G__18519__$2 = (cljs.core.truth_(message)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18519__$1,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742),message):G__18519__$1);
var G__18519__$3 = (cljs.core.truth_((function (){var or__5002__auto__ = fn;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
var and__5000__auto__ = source__$1;
if(cljs.core.truth_(and__5000__auto__)){
return method;
} else {
return and__5000__auto__;
}
}
})())?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18519__$2,new cljs.core.Keyword("clojure.error","symbol","clojure.error/symbol",1544821994),(function (){var or__5002__auto__ = fn;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[source__$1,method],null));
}
})()):G__18519__$2);
var G__18519__$4 = (cljs.core.truth_(file__$1)?cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18519__$3,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397),file__$1):G__18519__$3);
if(cljs.core.truth_(problems)){
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(G__18519__$4,new cljs.core.Keyword("clojure.error","spec","clojure.error/spec",2055032595),data);
} else {
return G__18519__$4;
}
break;
default:
throw (new Error(["No matching clause: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__18433__$1)].join('')));
}
})(),new cljs.core.Keyword("clojure.error","phase","clojure.error/phase",275140358),phase);
});
/**
* Returns a string from exception data, as produced by ex-triage.
* The first line summarizes the exception phase and location.
* The subsequent lines describe the cause.
*/
cljs.repl.ex_str = (function cljs$repl$ex_str(p__18543){
var map__18544 = p__18543;
var map__18544__$1 = cljs.core.__destructure_map(map__18544);
var triage_data = map__18544__$1;
var phase = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18544__$1,new cljs.core.Keyword("clojure.error","phase","clojure.error/phase",275140358));
var source = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18544__$1,new cljs.core.Keyword("clojure.error","source","clojure.error/source",-2011936397));
var line = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18544__$1,new cljs.core.Keyword("clojure.error","line","clojure.error/line",-1816287471));
var column = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18544__$1,new cljs.core.Keyword("clojure.error","column","clojure.error/column",304721553));
var symbol = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18544__$1,new cljs.core.Keyword("clojure.error","symbol","clojure.error/symbol",1544821994));
var class$ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18544__$1,new cljs.core.Keyword("clojure.error","class","clojure.error/class",278435890));
var cause = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18544__$1,new cljs.core.Keyword("clojure.error","cause","clojure.error/cause",-1879175742));
var spec = cljs.core.get.cljs$core$IFn$_invoke$arity$2(map__18544__$1,new cljs.core.Keyword("clojure.error","spec","clojure.error/spec",2055032595));
var loc = [cljs.core.str.cljs$core$IFn$_invoke$arity$1((function (){var or__5002__auto__ = source;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return "<cljs repl>";
}
})()),":",cljs.core.str.cljs$core$IFn$_invoke$arity$1((function (){var or__5002__auto__ = line;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return (1);
}
})()),(cljs.core.truth_(column)?[":",cljs.core.str.cljs$core$IFn$_invoke$arity$1(column)].join(''):"")].join('');
var class_name = cljs.core.name((function (){var or__5002__auto__ = class$;
if(cljs.core.truth_(or__5002__auto__)){
return or__5002__auto__;
} else {
return "";
}
})());
var simple_class = class_name;
var cause_type = ((cljs.core.contains_QMARK_(new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, ["RuntimeException",null,"Exception",null], null), null),simple_class))?"":[" (",simple_class,")"].join(''));
var format = goog.string.format;
var G__18592 = phase;
var G__18592__$1 = (((G__18592 instanceof cljs.core.Keyword))?G__18592.fqn:null);
switch (G__18592__$1) {
case "read-source":
return (format.cljs$core$IFn$_invoke$arity$3 ? format.cljs$core$IFn$_invoke$arity$3("Syntax error reading source at (%s).\n%s\n",loc,cause) : format.call(null,"Syntax error reading source at (%s).\n%s\n",loc,cause));
break;
case "macro-syntax-check":
var G__18605 = "Syntax error macroexpanding %sat (%s).\n%s";
var G__18606 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
var G__18607 = loc;
var G__18608 = (cljs.core.truth_(spec)?(function (){var sb__5647__auto__ = (new goog.string.StringBuffer());
var _STAR_print_newline_STAR__orig_val__18609_18788 = cljs.core._STAR_print_newline_STAR_;
var _STAR_print_fn_STAR__orig_val__18610_18789 = cljs.core._STAR_print_fn_STAR_;
var _STAR_print_newline_STAR__temp_val__18611_18790 = true;
var _STAR_print_fn_STAR__temp_val__18612_18791 = (function (x__5648__auto__){
return sb__5647__auto__.append(x__5648__auto__);
});
(cljs.core._STAR_print_newline_STAR_ = _STAR_print_newline_STAR__temp_val__18611_18790);
(cljs.core._STAR_print_fn_STAR_ = _STAR_print_fn_STAR__temp_val__18612_18791);
try{cljs.spec.alpha.explain_out(cljs.core.update.cljs$core$IFn$_invoke$arity$3(spec,new cljs.core.Keyword("cljs.spec.alpha","problems","cljs.spec.alpha/problems",447400814),(function (probs){
return cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p1__18539_SHARP_){
return cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(p1__18539_SHARP_,new cljs.core.Keyword(null,"in","in",-1531184865));
}),probs);
}))
);
}finally {(cljs.core._STAR_print_fn_STAR_ = _STAR_print_fn_STAR__orig_val__18610_18789);
(cljs.core._STAR_print_newline_STAR_ = _STAR_print_newline_STAR__orig_val__18609_18788);
}
return cljs.core.str.cljs$core$IFn$_invoke$arity$1(sb__5647__auto__);
})():(format.cljs$core$IFn$_invoke$arity$2 ? format.cljs$core$IFn$_invoke$arity$2("%s\n",cause) : format.call(null,"%s\n",cause)));
return (format.cljs$core$IFn$_invoke$arity$4 ? format.cljs$core$IFn$_invoke$arity$4(G__18605,G__18606,G__18607,G__18608) : format.call(null,G__18605,G__18606,G__18607,G__18608));
break;
case "macroexpansion":
var G__18623 = "Unexpected error%s macroexpanding %sat (%s).\n%s\n";
var G__18624 = cause_type;
var G__18625 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
var G__18626 = loc;
var G__18627 = cause;
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5(G__18623,G__18624,G__18625,G__18626,G__18627) : format.call(null,G__18623,G__18624,G__18625,G__18626,G__18627));
break;
case "compile-syntax-check":
var G__18629 = "Syntax error%s compiling %sat (%s).\n%s\n";
var G__18630 = cause_type;
var G__18631 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
var G__18632 = loc;
var G__18633 = cause;
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5(G__18629,G__18630,G__18631,G__18632,G__18633) : format.call(null,G__18629,G__18630,G__18631,G__18632,G__18633));
break;
case "compilation":
var G__18636 = "Unexpected error%s compiling %sat (%s).\n%s\n";
var G__18637 = cause_type;
var G__18638 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
var G__18639 = loc;
var G__18640 = cause;
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5(G__18636,G__18637,G__18638,G__18639,G__18640) : format.call(null,G__18636,G__18637,G__18638,G__18639,G__18640));
break;
case "read-eval-result":
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5("Error reading eval result%s at %s (%s).\n%s\n",cause_type,symbol,loc,cause) : format.call(null,"Error reading eval result%s at %s (%s).\n%s\n",cause_type,symbol,loc,cause));
break;
case "print-eval-result":
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5("Error printing return value%s at %s (%s).\n%s\n",cause_type,symbol,loc,cause) : format.call(null,"Error printing return value%s at %s (%s).\n%s\n",cause_type,symbol,loc,cause));
break;
case "execution":
if(cljs.core.truth_(spec)){
var G__18643 = "Execution error - invalid arguments to %s at (%s).\n%s";
var G__18644 = symbol;
var G__18645 = loc;
var G__18646 = (function (){var sb__5647__auto__ = (new goog.string.StringBuffer());
var _STAR_print_newline_STAR__orig_val__18648_18801 = cljs.core._STAR_print_newline_STAR_;
var _STAR_print_fn_STAR__orig_val__18649_18802 = cljs.core._STAR_print_fn_STAR_;
var _STAR_print_newline_STAR__temp_val__18650_18803 = true;
var _STAR_print_fn_STAR__temp_val__18651_18804 = (function (x__5648__auto__){
return sb__5647__auto__.append(x__5648__auto__);
});
(cljs.core._STAR_print_newline_STAR_ = _STAR_print_newline_STAR__temp_val__18650_18803);
(cljs.core._STAR_print_fn_STAR_ = _STAR_print_fn_STAR__temp_val__18651_18804);
try{cljs.spec.alpha.explain_out(cljs.core.update.cljs$core$IFn$_invoke$arity$3(spec,new cljs.core.Keyword("cljs.spec.alpha","problems","cljs.spec.alpha/problems",447400814),(function (probs){
return cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p1__18541_SHARP_){
return cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(p1__18541_SHARP_,new cljs.core.Keyword(null,"in","in",-1531184865));
}),probs);
}))
);
}finally {(cljs.core._STAR_print_fn_STAR_ = _STAR_print_fn_STAR__orig_val__18649_18802);
(cljs.core._STAR_print_newline_STAR_ = _STAR_print_newline_STAR__orig_val__18648_18801);
}
return cljs.core.str.cljs$core$IFn$_invoke$arity$1(sb__5647__auto__);
})();
return (format.cljs$core$IFn$_invoke$arity$4 ? format.cljs$core$IFn$_invoke$arity$4(G__18643,G__18644,G__18645,G__18646) : format.call(null,G__18643,G__18644,G__18645,G__18646));
} else {
var G__18660 = "Execution error%s at %s(%s).\n%s\n";
var G__18661 = cause_type;
var G__18662 = (cljs.core.truth_(symbol)?[cljs.core.str.cljs$core$IFn$_invoke$arity$1(symbol)," "].join(''):"");
var G__18663 = loc;
var G__18664 = cause;
return (format.cljs$core$IFn$_invoke$arity$5 ? format.cljs$core$IFn$_invoke$arity$5(G__18660,G__18661,G__18662,G__18663,G__18664) : format.call(null,G__18660,G__18661,G__18662,G__18663,G__18664));
}
break;
default:
throw (new Error(["No matching clause: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__18592__$1)].join('')));
}
});
cljs.repl.error__GT_str = (function cljs$repl$error__GT_str(error){
return cljs.repl.ex_str(cljs.repl.ex_triage(cljs.repl.Error__GT_map(error)));
});
//# sourceMappingURL=cljs.repl.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
goog.provide('cljs.user');
//# sourceMappingURL=cljs.user.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["cljs/user.cljs"],"mappings":"","names":[],"sourcesContent":["[(ns cljs.user (:require [cljs.repl :refer (doc find-doc source apropos pst dir)]))]"],"x_google_ignoreList":[0]}

View File

@@ -0,0 +1,94 @@
goog.provide('clojure.core.protocols');
/**
* @interface
*/
clojure.core.protocols.Datafiable = function(){};
var clojure$core$protocols$Datafiable$datafy$dyn_14753 = (function (o){
var x__5350__auto__ = (((o == null))?null:o);
var m__5351__auto__ = (clojure.core.protocols.datafy[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(o) : m__5351__auto__.call(null,o));
} else {
var m__5349__auto__ = (clojure.core.protocols.datafy["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(o) : m__5349__auto__.call(null,o));
} else {
throw cljs.core.missing_protocol("Datafiable.datafy",o);
}
}
});
/**
* return a representation of o as data (default identity)
*/
clojure.core.protocols.datafy = (function clojure$core$protocols$datafy(o){
var temp__5802__auto__ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.meta(o),cljs.core.with_meta(new cljs.core.Symbol("clojure.core.protocols","datafy","clojure.core.protocols/datafy",707534751,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword("cljs.analyzer","no-resolve","cljs.analyzer/no-resolve",-1872351017),true], null)));
if(temp__5802__auto__){
var meta_impl__5352__auto__ = temp__5802__auto__;
return (meta_impl__5352__auto__.cljs$core$IFn$_invoke$arity$1 ? meta_impl__5352__auto__.cljs$core$IFn$_invoke$arity$1(o) : meta_impl__5352__auto__.call(null,o));
} else {
if((((!((o == null)))) && ((!((o.clojure$core$protocols$Datafiable$datafy$arity$1 == null)))))){
return o.clojure$core$protocols$Datafiable$datafy$arity$1(o);
} else {
return clojure$core$protocols$Datafiable$datafy$dyn_14753(o);
}
}
});
(clojure.core.protocols.Datafiable["null"] = true);
(clojure.core.protocols.datafy["null"] = (function (_){
return null;
}));
(clojure.core.protocols.Datafiable["_"] = true);
(clojure.core.protocols.datafy["_"] = (function (o){
return o;
}));
/**
* @interface
*/
clojure.core.protocols.Navigable = function(){};
var clojure$core$protocols$Navigable$nav$dyn_14808 = (function (coll,k,v){
var x__5350__auto__ = (((coll == null))?null:coll);
var m__5351__auto__ = (clojure.core.protocols.nav[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$3(coll,k,v) : m__5351__auto__.call(null,coll,k,v));
} else {
var m__5349__auto__ = (clojure.core.protocols.nav["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$3(coll,k,v) : m__5349__auto__.call(null,coll,k,v));
} else {
throw cljs.core.missing_protocol("Navigable.nav",coll);
}
}
});
/**
* return (possibly transformed) v in the context of coll and k (a key/index or nil),
* defaults to returning v.
*/
clojure.core.protocols.nav = (function clojure$core$protocols$nav(coll,k,v){
var temp__5802__auto__ = cljs.core.get.cljs$core$IFn$_invoke$arity$2(cljs.core.meta(coll),cljs.core.with_meta(new cljs.core.Symbol("clojure.core.protocols","nav","clojure.core.protocols/nav",298936762,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword("cljs.analyzer","no-resolve","cljs.analyzer/no-resolve",-1872351017),true], null)));
if(temp__5802__auto__){
var meta_impl__5352__auto__ = temp__5802__auto__;
return (meta_impl__5352__auto__.cljs$core$IFn$_invoke$arity$3 ? meta_impl__5352__auto__.cljs$core$IFn$_invoke$arity$3(coll,k,v) : meta_impl__5352__auto__.call(null,coll,k,v));
} else {
if((((!((coll == null)))) && ((!((coll.clojure$core$protocols$Navigable$nav$arity$3 == null)))))){
return coll.clojure$core$protocols$Navigable$nav$arity$3(coll,k,v);
} else {
return clojure$core$protocols$Navigable$nav$dyn_14808(coll,k,v);
}
}
});
(clojure.core.protocols.Navigable["_"] = true);
(clojure.core.protocols.nav["_"] = (function (_,___$1,x){
return x;
}));
//# sourceMappingURL=clojure.core.protocols.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["clojure/core/protocols.cljs"],"mappings":";AAUA,AAAA;AAAA;;;oCAAA,pCAAaW;;AAAb,IAAAX,qDAAA,WAEWY;AAFX,AAAA,IAAAX,kBAAA,EAAA,MAAA,OAAA,ZAEWW,iBAAAA;IAFXV,kBAAA,CAAAC,8BAAA,AAAAC,YAAAH;AAAA,AAAA,GAAA,GAAA,CAAAC,mBAAA;AAAA,QAAAA,gDAAAA,mDAAAA,LAEWU,+BAAAA;;AAFX,IAAAP,kBAAA,CAAAF,8BAAA;AAAA,AAAA,GAAA,GAAA,CAAAE,mBAAA;AAAA,QAAAA,gDAAAA,mDAAAA,LAEWO,+BAAAA;;AAFX,MAAA,AAAAN,2BAAA,oBAEWM;;;;AAFX,AAAA;;;gCAAA,hCAEGT,wEAAQS;AAFX,AAAA,IAAAL,qBAAA,AAAAC,4CAAA,AAAAC,kBAAA,AAAA,HAEWG;AAFX,AAAA,GAAAL;AAAA,IAAAG,0BAAAH;AAAA,AAAA,QAAAG,wDAAAA,2DAAAA,LAEWE,uCAAAA;;AAFX,GAAA,EAAA,GAAA,MAAA,aAAA,GAAA,CAAA,sDAAA,5EAEWA,sBAAAA;AAFX,OAEWA,mDAAAA;;AAFX,OAAAZ,mDAEWY;;;;;AAFX,AAIA,AAAA,AAAA,CAAAD,kCAAA,UAAA;;AAAA,CAAAR,8BAAA,UAEE,WAASU;AAAT,AAAA;;;AAFF,AAAA,CAAAF,kCAAA,OAAA;;AAAA,CAAAR,8BAAA,OAKE,WAASS;AAAT,AAAYA;;AAEd,AAAA;AAAA;;;mCAAA,nCAAaI;;AAAb,IAAAF,iDAAA,WAEQG,KAAKC,EAAEC;AAFf,AAAA,IAAAlB,kBAAA,EAAA,SAAA,OAAA,fAEQgB,oBAAAA;IAFRf,kBAAA,CAAAa,2BAAA,AAAAX,YAAAH;AAAA,AAAA,GAAA,GAAA,CAAAC,mBAAA;AAAA,QAAAA,gDAAAA,0DAAAA,ZAEQe,sCAAAA,jCAAKC,sCAAAA,pCAAEC,sCAAAA;;AAFf,IAAAd,kBAAA,CAAAU,2BAAA;AAAA,AAAA,GAAA,GAAA,CAAAV,mBAAA;AAAA,QAAAA,gDAAAA,0DAAAA,ZAEQY,sCAAAA,jCAAKC,sCAAAA,pCAAEC,sCAAAA;;AAFf,MAAA,AAAAb,2BAAA,gBAEQW;;;;AAFR,AAAA;;;;6BAAA,7BAEGF,kEAAKE,KAAKC,EAAEC;AAFf,AAAA,IAAAZ,qBAAA,AAAAC,4CAAA,AAAAC,qBAAA,AAAA,NAEQQ;AAFR,AAAA,GAAAV;AAAA,IAAAG,0BAAAH;AAAA,AAAA,QAAAG,wDAAAA,kEAAAA,ZAEQO,8CAAAA,zCAAKC,8CAAAA,5CAAEC,8CAAAA;;AAFf,GAAA,EAAA,GAAA,SAAA,aAAA,GAAA,CAAA,qDAAA,9EAEQF,yBAAAA;AAFR,OAEQA,kDAAAA,KAAKC,EAAEC;;AAFf,OAAAL,+CAEQG,KAAKC,EAAEC;;;;;AAFf,AAKA,AAAA,AAAA,CAAAH,iCAAA,OAAA;;AAAA,CAAAD,2BAAA,OAEE,WAAMF,EAAEA,MAAEO;AAAV,AAAaA","names":["clojure$core$protocols$Datafiable$datafy$dyn","x__5350__auto__","m__5351__auto__","clojure.core.protocols/datafy","goog/typeOf","m__5349__auto__","cljs.core/missing-protocol","temp__5802__auto__","cljs.core.get","cljs.core/meta","meta-impl__5352__auto__","clojure.core.protocols/Datafiable","o","_","clojure$core$protocols$Navigable$nav$dyn","clojure.core.protocols/nav","clojure.core.protocols/Navigable","coll","k","v","x"],"sourcesContent":["; Copyright (c) Rich Hickey. All rights reserved.\n; The use and distribution terms for this software are covered by the\n; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)\n; which can be found in the file epl-v10.html at the root of this distribution.\n; By using this software in any fashion, you are agreeing to be bound by\n; the terms of this license.\n; You must not remove this notice, or any other, from this software.\n\n(ns clojure.core.protocols)\n\n(defprotocol Datafiable\n :extend-via-metadata true\n (datafy [o] \"return a representation of o as data (default identity)\"))\n\n(extend-protocol Datafiable\n nil\n (datafy [_] nil)\n\n default\n (datafy [o] o))\n\n(defprotocol Navigable\n :extend-via-metadata true\n (nav [coll k v] \"return (possibly transformed) v in the context of coll and k (a key/index or nil),\ndefaults to returning v.\"))\n\n(extend-protocol Navigable\n default\n (nav [_ _ x] x))\n"],"x_google_ignoreList":[0]}

View File

@@ -0,0 +1,292 @@
goog.provide('clojure.data');
/**
* Internal helper for diff.
*/
clojure.data.atom_diff = (function clojure$data$atom_diff(a,b){
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(a,b)){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null,a], null);
} else {
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,b,null], null);
}
});
/**
* Convert an associative-by-numeric-index collection into
* an equivalent vector, with nil for any missing keys
*/
clojure.data.vectorize = (function clojure$data$vectorize(m){
if(cljs.core.seq(m)){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (result,p__14716){
var vec__14718 = p__14716;
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14718,(0),null);
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14718,(1),null);
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(result,k,v);
}),cljs.core.vec(cljs.core.repeat.cljs$core$IFn$_invoke$arity$2(cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.max,cljs.core.keys(m)),null)),m);
} else {
return null;
}
});
/**
* Diff associative things a and b, comparing only the key k.
*/
clojure.data.diff_associative_key = (function clojure$data$diff_associative_key(a,b,k){
var va = cljs.core.get.cljs$core$IFn$_invoke$arity$2(a,k);
var vb = cljs.core.get.cljs$core$IFn$_invoke$arity$2(b,k);
var vec__14727 = clojure.data.diff(va,vb);
var a_STAR_ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14727,(0),null);
var b_STAR_ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14727,(1),null);
var ab = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14727,(2),null);
var in_a = cljs.core.contains_QMARK_(a,k);
var in_b = cljs.core.contains_QMARK_(b,k);
var same = ((in_a) && (((in_b) && ((((!((ab == null)))) || ((((va == null)) && ((vb == null)))))))));
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [((((in_a) && ((((!((a_STAR_ == null)))) || ((!(same)))))))?cljs.core.PersistentArrayMap.createAsIfByAssoc([k,a_STAR_]):null),((((in_b) && ((((!((b_STAR_ == null)))) || ((!(same)))))))?cljs.core.PersistentArrayMap.createAsIfByAssoc([k,b_STAR_]):null),((same)?cljs.core.PersistentArrayMap.createAsIfByAssoc([k,ab]):null)], null);
});
/**
* Diff associative things a and b, comparing only keys in ks (if supplied).
*/
clojure.data.diff_associative = (function clojure$data$diff_associative(var_args){
var G__14793 = arguments.length;
switch (G__14793) {
case 2:
return clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$2 = (function (a,b){
return clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3(a,b,clojure.set.union.cljs$core$IFn$_invoke$arity$2(cljs.core.keys(a),cljs.core.keys(b)));
}));
(clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3 = (function (a,b,ks){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (diff1,diff2){
return cljs.core.doall.cljs$core$IFn$_invoke$arity$1(cljs.core.map.cljs$core$IFn$_invoke$arity$3(cljs.core.merge,diff1,diff2));
}),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null,null], null),cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.partial.cljs$core$IFn$_invoke$arity$3(clojure.data.diff_associative_key,a,b),ks));
}));
(clojure.data.diff_associative.cljs$lang$maxFixedArity = 3);
clojure.data.diff_sequential = (function clojure$data$diff_sequential(a,b){
return cljs.core.vec(cljs.core.map.cljs$core$IFn$_invoke$arity$2(clojure.data.vectorize,clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3(((cljs.core.vector_QMARK_(a))?a:cljs.core.vec(a)),((cljs.core.vector_QMARK_(b))?b:cljs.core.vec(b)),cljs.core.range.cljs$core$IFn$_invoke$arity$1((function (){var x__5087__auto__ = cljs.core.count(a);
var y__5088__auto__ = cljs.core.count(b);
return ((x__5087__auto__ > y__5088__auto__) ? x__5087__auto__ : y__5088__auto__);
})()))));
});
clojure.data.diff_set = (function clojure$data$diff_set(a,b){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.not_empty(clojure.set.difference.cljs$core$IFn$_invoke$arity$2(a,b)),cljs.core.not_empty(clojure.set.difference.cljs$core$IFn$_invoke$arity$2(b,a)),cljs.core.not_empty(clojure.set.intersection.cljs$core$IFn$_invoke$arity$2(a,b))], null);
});
/**
* Implementation detail. Subject to change.
* @interface
*/
clojure.data.EqualityPartition = function(){};
var clojure$data$EqualityPartition$equality_partition$dyn_14851 = (function (x){
var x__5350__auto__ = (((x == null))?null:x);
var m__5351__auto__ = (clojure.data.equality_partition[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$1(x) : m__5351__auto__.call(null,x));
} else {
var m__5349__auto__ = (clojure.data.equality_partition["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$1(x) : m__5349__auto__.call(null,x));
} else {
throw cljs.core.missing_protocol("EqualityPartition.equality-partition",x);
}
}
});
/**
* Implementation detail. Subject to change.
*/
clojure.data.equality_partition = (function clojure$data$equality_partition(x){
if((((!((x == null)))) && ((!((x.clojure$data$EqualityPartition$equality_partition$arity$1 == null)))))){
return x.clojure$data$EqualityPartition$equality_partition$arity$1(x);
} else {
return clojure$data$EqualityPartition$equality_partition$dyn_14851(x);
}
});
/**
* Implementation detail. Subject to change.
* @interface
*/
clojure.data.Diff = function(){};
var clojure$data$Diff$diff_similar$dyn_14853 = (function (a,b){
var x__5350__auto__ = (((a == null))?null:a);
var m__5351__auto__ = (clojure.data.diff_similar[goog.typeOf(x__5350__auto__)]);
if((!((m__5351__auto__ == null)))){
return (m__5351__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5351__auto__.cljs$core$IFn$_invoke$arity$2(a,b) : m__5351__auto__.call(null,a,b));
} else {
var m__5349__auto__ = (clojure.data.diff_similar["_"]);
if((!((m__5349__auto__ == null)))){
return (m__5349__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5349__auto__.cljs$core$IFn$_invoke$arity$2(a,b) : m__5349__auto__.call(null,a,b));
} else {
throw cljs.core.missing_protocol("Diff.diff-similar",a);
}
}
});
/**
* Implementation detail. Subject to change.
*/
clojure.data.diff_similar = (function clojure$data$diff_similar(a,b){
if((((!((a == null)))) && ((!((a.clojure$data$Diff$diff_similar$arity$2 == null)))))){
return a.clojure$data$Diff$diff_similar$arity$2(a,b);
} else {
return clojure$data$Diff$diff_similar$dyn_14853(a,b);
}
});
(clojure.data.EqualityPartition["null"] = true);
(clojure.data.equality_partition["null"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["string"] = true);
(clojure.data.equality_partition["string"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["number"] = true);
(clojure.data.equality_partition["number"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["array"] = true);
(clojure.data.equality_partition["array"] = (function (x){
return new cljs.core.Keyword(null,"sequential","sequential",-1082983960);
}));
(clojure.data.EqualityPartition["function"] = true);
(clojure.data.equality_partition["function"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["boolean"] = true);
(clojure.data.equality_partition["boolean"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["_"] = true);
(clojure.data.equality_partition["_"] = (function (x){
if((((!((x == null))))?(((((x.cljs$lang$protocol_mask$partition0$ & (1024))) || ((cljs.core.PROTOCOL_SENTINEL === x.cljs$core$IMap$))))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_(cljs.core.IMap,x):false)):cljs.core.native_satisfies_QMARK_(cljs.core.IMap,x))){
return new cljs.core.Keyword(null,"map","map",1371690461);
} else {
if((((!((x == null))))?(((((x.cljs$lang$protocol_mask$partition0$ & (4096))) || ((cljs.core.PROTOCOL_SENTINEL === x.cljs$core$ISet$))))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_(cljs.core.ISet,x):false)):cljs.core.native_satisfies_QMARK_(cljs.core.ISet,x))){
return new cljs.core.Keyword(null,"set","set",304602554);
} else {
if((((!((x == null))))?(((((x.cljs$lang$protocol_mask$partition0$ & (16777216))) || ((cljs.core.PROTOCOL_SENTINEL === x.cljs$core$ISequential$))))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_(cljs.core.ISequential,x):false)):cljs.core.native_satisfies_QMARK_(cljs.core.ISequential,x))){
return new cljs.core.Keyword(null,"sequential","sequential",-1082983960);
} else {
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}
}
}
}));
(clojure.data.Diff["null"] = true);
(clojure.data.diff_similar["null"] = (function (a,b){
return clojure.data.atom_diff(a,b);
}));
(clojure.data.Diff["string"] = true);
(clojure.data.diff_similar["string"] = (function (a,b){
return clojure.data.atom_diff(a,b);
}));
(clojure.data.Diff["number"] = true);
(clojure.data.diff_similar["number"] = (function (a,b){
return clojure.data.atom_diff(a,b);
}));
(clojure.data.Diff["array"] = true);
(clojure.data.diff_similar["array"] = (function (a,b){
return clojure.data.diff_sequential(a,b);
}));
(clojure.data.Diff["function"] = true);
(clojure.data.diff_similar["function"] = (function (a,b){
return clojure.data.atom_diff(a,b);
}));
(clojure.data.Diff["boolean"] = true);
(clojure.data.diff_similar["boolean"] = (function (a,b){
return clojure.data.atom_diff(a,b);
}));
(clojure.data.Diff["_"] = true);
(clojure.data.diff_similar["_"] = (function (a,b){
var fexpr__14817 = (function (){var G__14818 = clojure.data.equality_partition(a);
var G__14818__$1 = (((G__14818 instanceof cljs.core.Keyword))?G__14818.fqn:null);
switch (G__14818__$1) {
case "atom":
return clojure.data.atom_diff;
break;
case "set":
return clojure.data.diff_set;
break;
case "sequential":
return clojure.data.diff_sequential;
break;
case "map":
return clojure.data.diff_associative;
break;
default:
throw (new Error(["No matching clause: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(G__14818__$1)].join('')));
}
})();
return (fexpr__14817.cljs$core$IFn$_invoke$arity$2 ? fexpr__14817.cljs$core$IFn$_invoke$arity$2(a,b) : fexpr__14817.call(null,a,b));
}));
/**
* Recursively compares a and b, returning a tuple of
* [things-only-in-a things-only-in-b things-in-both].
* Comparison rules:
*
* * For equal a and b, return [nil nil a].
* * Maps are subdiffed where keys match and values differ.
* * Sets are never subdiffed.
* * All sequential things are treated as associative collections
* by their indexes, with results returned as vectors.
* * Everything else (including strings!) is treated as
* an atom and compared for equality.
*/
clojure.data.diff = (function clojure$data$diff(a,b){
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(a,b)){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null,a], null);
} else {
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(clojure.data.equality_partition(a),clojure.data.equality_partition(b))){
return clojure.data.diff_similar(a,b);
} else {
return clojure.data.atom_diff(a,b);
}
}
});
//# sourceMappingURL=clojure.data.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,83 @@
goog.provide('clojure.datafy');
/**
* Attempts to return x as data.
* datafy will return the value of clojure.protocols/datafy. If
* the value has been transformed and the result supports
* metadata, :clojure.datafy/obj will be set on the metadata to the
* original value of x.
*/
clojure.datafy.datafy = (function clojure$datafy$datafy(x){
var v = clojure.core.protocols.datafy(x);
if((v === x)){
return v;
} else {
if((((!((v == null))))?(((((v.cljs$lang$protocol_mask$partition0$ & (262144))) || ((cljs.core.PROTOCOL_SENTINEL === v.cljs$core$IWithMeta$))))?true:false):false)){
return cljs.core.vary_meta.cljs$core$IFn$_invoke$arity$4(v,cljs.core.assoc,new cljs.core.Keyword("clojure.datafy","obj","clojure.datafy/obj",-330079421),x);
} else {
return v;
}
}
});
/**
* Returns (possibly transformed) v in the context of coll and k (a
* key/index or nil). Callers should attempt to provide the key/index
* context k for Indexed/Associative/ILookup colls if possible, but not
* to fabricate one e.g. for sequences (pass nil). nav will return the
* value of clojure.core.protocols/nav.
*/
clojure.datafy.nav = (function clojure$datafy$nav(coll,k,v){
return clojure.core.protocols.nav(coll,k,v);
});
clojure.datafy.datify_ref = (function clojure$datafy$datify_ref(r){
return cljs.core.with_meta(new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.deref(r)], null),cljs.core.meta(r));
});
(Error.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
(Error.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (x){
var x__$1 = this;
return cljs.core.Throwable__GT_map(x__$1);
}));
(cljs.core.ExceptionInfo.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.ExceptionInfo.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (x){
var x__$1 = this;
return cljs.core.Throwable__GT_map(x__$1);
}));
(cljs.core.Var.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.Var.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
var r__$1 = this;
return clojure.datafy.datify_ref(r__$1);
}));
(cljs.core.Reduced.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.Reduced.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
var r__$1 = this;
return clojure.datafy.datify_ref(r__$1);
}));
(cljs.core.Atom.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.Atom.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
var r__$1 = this;
return clojure.datafy.datify_ref(r__$1);
}));
(cljs.core.Volatile.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.Volatile.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
var r__$1 = this;
return clojure.datafy.datify_ref(r__$1);
}));
(cljs.core.Delay.prototype.clojure$core$protocols$Datafiable$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.Delay.prototype.clojure$core$protocols$Datafiable$datafy$arity$1 = (function (r){
var r__$1 = this;
return clojure.datafy.datify_ref(r__$1);
}));
//# sourceMappingURL=clojure.datafy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["clojure/datafy.cljs"],"mappings":";AAaA;;;;;;;wBAAA,xBAAMA,wDAMHC;AANH,AAOE,IAAMC,IAAE,AAACC,8BAASF;AAAlB,AACE,GAAI,CAAYC,MAAED;AAChBC;;AACA,GAAI,EAAA,GAAA,MAAA,SAAA,EAAA,EAAA,CAAA,wCAAA,eAAA,CAAAE,gCAAA,2BAAA,KAAA,OAAA,lJAAuBF,mBAAAA,wFAAAA;AACzB,2EAAA,pEAACG,kDAAUH,EAAEI,8FAAYL;;AAIzBC;;;;AAER;;;;;;;qBAAA,rBAAMK,kDAMHC,KAAKC,EAAEP;AANV,AAOE,OAACQ,2BAAMF,KAAKC,EAAEP;;AAEhB,4BAAA,5BAAOS,gEAAYC;AAAnB,AACE,2BAAA,pBAACC,uGAAW,AAACC,gBAAMF,WAAI,AAACG,eAAKH;;AAE/B,AAAA,AAAA,CAAA,AAAA,qDAAAR,rDACEY;;AADF,CAAA,AAAA,AACEA,mEACA,WAASf;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACgB,4BAAehB;;;AAF9B,AAAA,CAAA,AAAA,uEAAAG,vEAIEc;;AAJF,CAAA,AAAA,AAIEA,qFACA,WAASjB;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACgB,4BAAehB;;;AAL9B,AAAA,CAAA,AAAA,6DAAAG,7DAOEe;;AAPF,CAAA,AAAA,AAOEA,2EACA,WAASP;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC;;;AAR1B,AAAA,CAAA,AAAA,iEAAAR,jEAUEgB;;AAVF,CAAA,AAAA,AAUEA,+EACA,WAASR;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC;;;AAX1B,AAAA,CAAA,AAAA,8DAAAR,9DAaEiB;;AAbF,CAAA,AAAA,AAaEA,4EACA,WAAST;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC;;;AAd1B,AAAA,CAAA,AAAA,kEAAAR,lEAgBEkB;;AAhBF,CAAA,AAAA,AAgBEA,gFACA,WAASV;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC;;;AAjB1B,AAAA,CAAA,AAAA,+DAAAR,/DAmBEmB;;AAnBF,CAAA,AAAA,AAmBEA,6EACA,WAASX;AAAT,AAAA,YAAA,RAASA;AAAT,AAAY,OAACD,0BAAWC","names":["clojure.datafy/datafy","x","v","clojure.core.protocols/datafy","cljs.core/PROTOCOL_SENTINEL","cljs.core.vary_meta","cljs.core/assoc","clojure.datafy/nav","coll","k","clojure.core.protocols/nav","clojure.datafy/datify-ref","r","cljs.core/with-meta","cljs.core/deref","cljs.core/meta","js/Error","cljs.core/Throwable->map","cljs.core/ExceptionInfo","cljs.core/Var","cljs.core/Reduced","cljs.core/Atom","cljs.core/Volatile","cljs.core/Delay"],"sourcesContent":["; Copyright (c) Rich Hickey. All rights reserved.\n; The use and distribution terms for this software are covered by the\n; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)\n; which can be found in the file epl-v10.html at the root of this distribution.\n; By using this software in any fashion, you are agreeing to be bound by\n; the terms of this license.\n; You must not remove this notice, or any other, from this software.\n\n(ns\n ^{:doc \"Functions to turn objects into data. Alpha, subject to change\"}\n clojure.datafy\n (:require [clojure.core.protocols :as p]))\n\n(defn datafy\n \"Attempts to return x as data.\n datafy will return the value of clojure.protocols/datafy. If\n the value has been transformed and the result supports\n metadata, :clojure.datafy/obj will be set on the metadata to the\n original value of x.\"\n [x]\n (let [v (p/datafy x)]\n (if (identical? v x)\n v\n (if (implements? IWithMeta v)\n (vary-meta v assoc ::obj x\n ;; Circling back to this at a later date per @dnolen\n ;; ::class (-> x .-constructor .-name symbol)\n )\n v))))\n\n(defn nav\n \"Returns (possibly transformed) v in the context of coll and k (a\n key/index or nil). Callers should attempt to provide the key/index\n context k for Indexed/Associative/ILookup colls if possible, but not\n to fabricate one e.g. for sequences (pass nil). nav will return the\n value of clojure.core.protocols/nav.\"\n [coll k v]\n (p/nav coll k v))\n\n(defn- datify-ref [r]\n (with-meta [(deref r)] (meta r)))\n\n(extend-protocol p/Datafiable\n js/Error\n (datafy [x] (Throwable->map x))\n\n ExceptionInfo\n (datafy [x] (Throwable->map x))\n\n Var\n (datafy [r] (datify-ref r))\n\n Reduced\n (datafy [r] (datify-ref r))\n\n Atom\n (datafy [r] (datify-ref r))\n\n Volatile\n (datafy [r] (datify-ref r))\n\n Delay\n (datafy [r] (datify-ref r)))\n"],"x_google_ignoreList":[0]}

View File

@@ -0,0 +1,380 @@
goog.provide('clojure.set');
clojure.set.bubble_max_key = (function clojure$set$bubble_max_key(k,coll){
var max = cljs.core.apply.cljs$core$IFn$_invoke$arity$3(cljs.core.max_key,k,coll);
return cljs.core.cons(max,cljs.core.remove.cljs$core$IFn$_invoke$arity$2((function (p1__11651_SHARP_){
return (max === p1__11651_SHARP_);
}),coll));
});
/**
* Return a set that is the union of the input sets
*/
clojure.set.union = (function clojure$set$union(var_args){
var G__11660 = arguments.length;
switch (G__11660) {
case 0:
return clojure.set.union.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return clojure.set.union.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.set.union.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
var args_arr__5751__auto__ = [];
var len__5726__auto___11753 = arguments.length;
var i__5727__auto___11755 = (0);
while(true){
if((i__5727__auto___11755 < len__5726__auto___11753)){
args_arr__5751__auto__.push((arguments[i__5727__auto___11755]));
var G__11756 = (i__5727__auto___11755 + (1));
i__5727__auto___11755 = G__11756;
continue;
} else {
}
break;
}
var argseq__5752__auto__ = ((((2) < args_arr__5751__auto__.length))?(new cljs.core.IndexedSeq(args_arr__5751__auto__.slice((2)),(0),null)):null);
return clojure.set.union.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5752__auto__);
}
});
(clojure.set.union.cljs$core$IFn$_invoke$arity$0 = (function (){
return cljs.core.PersistentHashSet.EMPTY;
}));
(clojure.set.union.cljs$core$IFn$_invoke$arity$1 = (function (s1){
return s1;
}));
(clojure.set.union.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
if((cljs.core.count(s1) < cljs.core.count(s2))){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.conj,s2,s1);
} else {
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.conj,s1,s2);
}
}));
(clojure.set.union.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
var bubbled_sets = clojure.set.bubble_max_key(cljs.core.count,cljs.core.conj.cljs$core$IFn$_invoke$arity$variadic(sets,s2,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([s1], 0)));
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.into,cljs.core.first(bubbled_sets),cljs.core.rest(bubbled_sets));
}));
/** @this {Function} */
(clojure.set.union.cljs$lang$applyTo = (function (seq11657){
var G__11658 = cljs.core.first(seq11657);
var seq11657__$1 = cljs.core.next(seq11657);
var G__11659 = cljs.core.first(seq11657__$1);
var seq11657__$2 = cljs.core.next(seq11657__$1);
var self__5711__auto__ = this;
return self__5711__auto__.cljs$core$IFn$_invoke$arity$variadic(G__11658,G__11659,seq11657__$2);
}));
(clojure.set.union.cljs$lang$maxFixedArity = (2));
/**
* Return a set that is the intersection of the input sets
*/
clojure.set.intersection = (function clojure$set$intersection(var_args){
var G__11680 = arguments.length;
switch (G__11680) {
case 1:
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
var args_arr__5751__auto__ = [];
var len__5726__auto___11771 = arguments.length;
var i__5727__auto___11772 = (0);
while(true){
if((i__5727__auto___11772 < len__5726__auto___11771)){
args_arr__5751__auto__.push((arguments[i__5727__auto___11772]));
var G__11774 = (i__5727__auto___11772 + (1));
i__5727__auto___11772 = G__11774;
continue;
} else {
}
break;
}
var argseq__5752__auto__ = ((((2) < args_arr__5751__auto__.length))?(new cljs.core.IndexedSeq(args_arr__5751__auto__.slice((2)),(0),null)):null);
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5752__auto__);
}
});
(clojure.set.intersection.cljs$core$IFn$_invoke$arity$1 = (function (s1){
return s1;
}));
(clojure.set.intersection.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
while(true){
if((cljs.core.count(s2) < cljs.core.count(s1))){
var G__11778 = s2;
var G__11779 = s1;
s1 = G__11778;
s2 = G__11779;
continue;
} else {
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(((function (s1,s2){
return (function (result,item){
if(cljs.core.contains_QMARK_(s2,item)){
return result;
} else {
return cljs.core.disj.cljs$core$IFn$_invoke$arity$2(result,item);
}
});})(s1,s2))
,s1,s1);
}
break;
}
}));
(clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
var bubbled_sets = clojure.set.bubble_max_key((function (p1__11673_SHARP_){
return (- cljs.core.count(p1__11673_SHARP_));
}),cljs.core.conj.cljs$core$IFn$_invoke$arity$variadic(sets,s2,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([s1], 0)));
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(clojure.set.intersection,cljs.core.first(bubbled_sets),cljs.core.rest(bubbled_sets));
}));
/** @this {Function} */
(clojure.set.intersection.cljs$lang$applyTo = (function (seq11677){
var G__11678 = cljs.core.first(seq11677);
var seq11677__$1 = cljs.core.next(seq11677);
var G__11679 = cljs.core.first(seq11677__$1);
var seq11677__$2 = cljs.core.next(seq11677__$1);
var self__5711__auto__ = this;
return self__5711__auto__.cljs$core$IFn$_invoke$arity$variadic(G__11678,G__11679,seq11677__$2);
}));
(clojure.set.intersection.cljs$lang$maxFixedArity = (2));
/**
* Return a set that is the first set without elements of the remaining sets
*/
clojure.set.difference = (function clojure$set$difference(var_args){
var G__11693 = arguments.length;
switch (G__11693) {
case 1:
return clojure.set.difference.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.set.difference.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
var args_arr__5751__auto__ = [];
var len__5726__auto___11796 = arguments.length;
var i__5727__auto___11797 = (0);
while(true){
if((i__5727__auto___11797 < len__5726__auto___11796)){
args_arr__5751__auto__.push((arguments[i__5727__auto___11797]));
var G__11798 = (i__5727__auto___11797 + (1));
i__5727__auto___11797 = G__11798;
continue;
} else {
}
break;
}
var argseq__5752__auto__ = ((((2) < args_arr__5751__auto__.length))?(new cljs.core.IndexedSeq(args_arr__5751__auto__.slice((2)),(0),null)):null);
return clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__5752__auto__);
}
});
(clojure.set.difference.cljs$core$IFn$_invoke$arity$1 = (function (s1){
return s1;
}));
(clojure.set.difference.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
if((cljs.core.count(s1) < cljs.core.count(s2))){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (result,item){
if(cljs.core.contains_QMARK_(s2,item)){
return cljs.core.disj.cljs$core$IFn$_invoke$arity$2(result,item);
} else {
return result;
}
}),s1,s1);
} else {
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.disj,s1,s2);
}
}));
(clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(clojure.set.difference,s1,cljs.core.conj.cljs$core$IFn$_invoke$arity$2(sets,s2));
}));
/** @this {Function} */
(clojure.set.difference.cljs$lang$applyTo = (function (seq11690){
var G__11691 = cljs.core.first(seq11690);
var seq11690__$1 = cljs.core.next(seq11690);
var G__11692 = cljs.core.first(seq11690__$1);
var seq11690__$2 = cljs.core.next(seq11690__$1);
var self__5711__auto__ = this;
return self__5711__auto__.cljs$core$IFn$_invoke$arity$variadic(G__11691,G__11692,seq11690__$2);
}));
(clojure.set.difference.cljs$lang$maxFixedArity = (2));
/**
* Returns a set of the elements for which pred is true
*/
clojure.set.select = (function clojure$set$select(pred,xset){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (s,k){
if(cljs.core.truth_((pred.cljs$core$IFn$_invoke$arity$1 ? pred.cljs$core$IFn$_invoke$arity$1(k) : pred.call(null,k)))){
return s;
} else {
return cljs.core.disj.cljs$core$IFn$_invoke$arity$2(s,k);
}
}),xset,xset);
});
/**
* Returns a rel of the elements of xrel with only the keys in ks
*/
clojure.set.project = (function clojure$set$project(xrel,ks){
return cljs.core.set(cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p1__11702_SHARP_){
return cljs.core.select_keys(p1__11702_SHARP_,ks);
}),xrel));
});
/**
* Returns the map with the keys in kmap renamed to the vals in kmap
*/
clojure.set.rename_keys = (function clojure$set$rename_keys(map,kmap){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (m,p__11707){
var vec__11708 = p__11707;
var old = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11708,(0),null);
var new$ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11708,(1),null);
if(cljs.core.contains_QMARK_(map,old)){
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(m,new$,cljs.core.get.cljs$core$IFn$_invoke$arity$2(map,old));
} else {
return m;
}
}),cljs.core.apply.cljs$core$IFn$_invoke$arity$3(cljs.core.dissoc,map,cljs.core.keys(kmap)),kmap);
});
/**
* Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap
*/
clojure.set.rename = (function clojure$set$rename(xrel,kmap){
return cljs.core.set(cljs.core.map.cljs$core$IFn$_invoke$arity$2((function (p1__11711_SHARP_){
return clojure.set.rename_keys(p1__11711_SHARP_,kmap);
}),xrel));
});
/**
* Returns a map of the distinct values of ks in the xrel mapped to a
* set of the maps in xrel with the corresponding values of ks.
*/
clojure.set.index = (function clojure$set$index(xrel,ks){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (m,x){
var ik = cljs.core.select_keys(x,ks);
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(m,ik,cljs.core.conj.cljs$core$IFn$_invoke$arity$2(cljs.core.get.cljs$core$IFn$_invoke$arity$3(m,ik,cljs.core.PersistentHashSet.EMPTY),x));
}),cljs.core.PersistentArrayMap.EMPTY,xrel);
});
/**
* Returns the map with the vals mapped to the keys.
*/
clojure.set.map_invert = (function clojure$set$map_invert(m){
return cljs.core.persistent_BANG_(cljs.core.reduce_kv((function (m__$1,k,v){
return cljs.core.assoc_BANG_.cljs$core$IFn$_invoke$arity$3(m__$1,v,k);
}),cljs.core.transient$(cljs.core.PersistentArrayMap.EMPTY),m));
});
/**
* When passed 2 rels, returns the rel corresponding to the natural
* join. When passed an additional keymap, joins on the corresponding
* keys.
*/
clojure.set.join = (function clojure$set$join(var_args){
var G__11720 = arguments.length;
switch (G__11720) {
case 2:
return clojure.set.join.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.set.join.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(clojure.set.join.cljs$core$IFn$_invoke$arity$2 = (function (xrel,yrel){
if(((cljs.core.seq(xrel)) && (cljs.core.seq(yrel)))){
var ks = clojure.set.intersection.cljs$core$IFn$_invoke$arity$2(cljs.core.set(cljs.core.keys(cljs.core.first(xrel))),cljs.core.set(cljs.core.keys(cljs.core.first(yrel))));
var vec__11722 = (((cljs.core.count(xrel) <= cljs.core.count(yrel)))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel], null));
var r = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11722,(0),null);
var s = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11722,(1),null);
var idx = clojure.set.index(r,ks);
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (ret,x){
var found = (function (){var G__11725 = cljs.core.select_keys(x,ks);
return (idx.cljs$core$IFn$_invoke$arity$1 ? idx.cljs$core$IFn$_invoke$arity$1(G__11725) : idx.call(null,G__11725));
})();
if(cljs.core.truth_(found)){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__11713_SHARP_,p2__11714_SHARP_){
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__11713_SHARP_,cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([p2__11714_SHARP_,x], 0)));
}),ret,found);
} else {
return ret;
}
}),cljs.core.PersistentHashSet.EMPTY,s);
} else {
return cljs.core.PersistentHashSet.EMPTY;
}
}));
(clojure.set.join.cljs$core$IFn$_invoke$arity$3 = (function (xrel,yrel,km){
var vec__11728 = (((cljs.core.count(xrel) <= cljs.core.count(yrel)))?new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel,clojure.set.map_invert(km)], null):new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel,km], null));
var r = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11728,(0),null);
var s = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11728,(1),null);
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11728,(2),null);
var idx = clojure.set.index(r,cljs.core.vals(k));
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (ret,x){
var found = (function (){var G__11733 = clojure.set.rename_keys(cljs.core.select_keys(x,cljs.core.keys(k)),k);
return (idx.cljs$core$IFn$_invoke$arity$1 ? idx.cljs$core$IFn$_invoke$arity$1(G__11733) : idx.call(null,G__11733));
})();
if(cljs.core.truth_(found)){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__11715_SHARP_,p2__11716_SHARP_){
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__11715_SHARP_,cljs.core.merge.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([p2__11716_SHARP_,x], 0)));
}),ret,found);
} else {
return ret;
}
}),cljs.core.PersistentHashSet.EMPTY,s);
}));
(clojure.set.join.cljs$lang$maxFixedArity = 3);
/**
* Is set1 a subset of set2?
*/
clojure.set.subset_QMARK_ = (function clojure$set$subset_QMARK_(set1,set2){
return (((cljs.core.count(set1) <= cljs.core.count(set2))) && (cljs.core.every_QMARK_((function (p1__11734_SHARP_){
return cljs.core.contains_QMARK_(set2,p1__11734_SHARP_);
}),set1)));
});
/**
* Is set1 a superset of set2?
*/
clojure.set.superset_QMARK_ = (function clojure$set$superset_QMARK_(set1,set2){
return (((cljs.core.count(set1) >= cljs.core.count(set2))) && (cljs.core.every_QMARK_((function (p1__11740_SHARP_){
return cljs.core.contains_QMARK_(set1,p1__11740_SHARP_);
}),set2)));
});
//# sourceMappingURL=clojure.set.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,476 @@
goog.provide('clojure.string');
clojure.string.seq_reverse = (function clojure$string$seq_reverse(coll){
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core.conj,cljs.core.List.EMPTY,coll);
});
clojure.string.re_surrogate_pair = (new RegExp("([\\uD800-\\uDBFF])([\\uDC00-\\uDFFF])","g"));
/**
* Returns s with its characters reversed.
*/
clojure.string.reverse = (function clojure$string$reverse(s){
return s.replace(clojure.string.re_surrogate_pair,"$2$1").split("").reverse().join("");
});
clojure.string.replace_all = (function clojure$string$replace_all(s,re,replacement){
var r = (new RegExp(re.source,(function (){var G__11661 = "g";
var G__11661__$1 = (cljs.core.truth_(re.ignoreCase)?[G__11661,"i"].join(''):G__11661);
var G__11661__$2 = (cljs.core.truth_(re.multiline)?[G__11661__$1,"m"].join(''):G__11661__$1);
if(cljs.core.truth_(re.unicode)){
return [G__11661__$2,"u"].join('');
} else {
return G__11661__$2;
}
})()));
return s.replace(r,replacement);
});
clojure.string.replace_with = (function clojure$string$replace_with(f){
return (function() {
var G__11785__delegate = function (args){
var matches = cljs.core.drop_last.cljs$core$IFn$_invoke$arity$2((2),args);
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(cljs.core.count(matches),(1))){
var G__11671 = cljs.core.first(matches);
return (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(G__11671) : f.call(null,G__11671));
} else {
var G__11672 = cljs.core.vec(matches);
return (f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(G__11672) : f.call(null,G__11672));
}
};
var G__11785 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__11786__i = 0, G__11786__a = new Array(arguments.length - 0);
while (G__11786__i < G__11786__a.length) {G__11786__a[G__11786__i] = arguments[G__11786__i + 0]; ++G__11786__i;}
args = new cljs.core.IndexedSeq(G__11786__a,0,null);
}
return G__11785__delegate.call(this,args);};
G__11785.cljs$lang$maxFixedArity = 0;
G__11785.cljs$lang$applyTo = (function (arglist__11787){
var args = cljs.core.seq(arglist__11787);
return G__11785__delegate(args);
});
G__11785.cljs$core$IFn$_invoke$arity$variadic = G__11785__delegate;
return G__11785;
})()
;
});
/**
* Replaces all instance of match with replacement in s.
*
* match/replacement can be:
*
* string / string
* pattern / (string or function of match).
*
* See also replace-first.
*
* The replacement is literal (i.e. none of its characters are treated
* specially) for all cases above except pattern / string.
*
* For pattern / string, $1, $2, etc. in the replacement string are
* substituted with the string that matched the corresponding
* parenthesized group in the pattern.
*
* Example:
* (clojure.string/replace "Almost Pig Latin" #"\b(\w)(\w+)\b" "$2$1ay")
* -> "lmostAay igPay atinLay"
*/
clojure.string.replace = (function clojure$string$replace(s,match,replacement){
if(typeof match === 'string'){
return s.replace((new RegExp(goog.string.regExpEscape(match),"g")),replacement);
} else {
if((match instanceof RegExp)){
if(typeof replacement === 'string'){
return clojure.string.replace_all(s,match,replacement);
} else {
return clojure.string.replace_all(s,match,clojure.string.replace_with(replacement));
}
} else {
throw ["Invalid match arg: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(match)].join('');
}
}
});
/**
* Replaces the first instance of match with replacement in s.
*
* match/replacement can be:
*
* string / string
* pattern / (string or function of match).
*
* See also replace.
*
* The replacement is literal (i.e. none of its characters are treated
* specially) for all cases above except pattern / string.
*
* For pattern / string, $1, $2, etc. in the replacement string are
* substituted with the string that matched the corresponding
* parenthesized group in the pattern.
*
* Example:
* (clojure.string/replace-first "swap first two words"
* #"(\w+)(\s+)(\w+)" "$3$2$1")
* -> "first swap two words"
*/
clojure.string.replace_first = (function clojure$string$replace_first(s,match,replacement){
return s.replace(match,replacement);
});
/**
* Returns a string of all elements in coll, as returned by (seq coll),
* separated by an optional separator.
*/
clojure.string.join = (function clojure$string$join(var_args){
var G__11675 = arguments.length;
switch (G__11675) {
case 1:
return clojure.string.join.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.string.join.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(clojure.string.join.cljs$core$IFn$_invoke$arity$1 = (function (coll){
var sb = (new goog.string.StringBuffer());
var coll__$1 = cljs.core.seq(coll);
while(true){
if((!((coll__$1 == null)))){
var G__11800 = sb.append(cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.first(coll__$1)));
var G__11801 = cljs.core.next(coll__$1);
sb = G__11800;
coll__$1 = G__11801;
continue;
} else {
return sb.toString();
}
break;
}
}));
(clojure.string.join.cljs$core$IFn$_invoke$arity$2 = (function (separator,coll){
var sb = (new goog.string.StringBuffer());
var coll__$1 = cljs.core.seq(coll);
while(true){
if((!((coll__$1 == null)))){
sb.append(cljs.core.str.cljs$core$IFn$_invoke$arity$1(cljs.core.first(coll__$1)));
var coll__$2 = cljs.core.next(coll__$1);
if((coll__$2 == null)){
} else {
sb.append(separator);
}
var G__11803 = sb;
var G__11804 = coll__$2;
sb = G__11803;
coll__$1 = G__11804;
continue;
} else {
return sb.toString();
}
break;
}
}));
(clojure.string.join.cljs$lang$maxFixedArity = 2);
/**
* Converts string to all upper-case.
*/
clojure.string.upper_case = (function clojure$string$upper_case(s){
return s.toUpperCase();
});
/**
* Converts string to all lower-case.
*/
clojure.string.lower_case = (function clojure$string$lower_case(s){
return s.toLowerCase();
});
/**
* Converts first character of the string to upper-case, all other
* characters to lower-case.
*/
clojure.string.capitalize = (function clojure$string$capitalize(s){
return goog.string.capitalize(s);
});
clojure.string.pop_last_while_empty = (function clojure$string$pop_last_while_empty(v){
var v__$1 = v;
while(true){
if(("" === cljs.core.peek(v__$1))){
var G__11808 = cljs.core.pop(v__$1);
v__$1 = G__11808;
continue;
} else {
return v__$1;
}
break;
}
});
clojure.string.discard_trailing_if_needed = (function clojure$string$discard_trailing_if_needed(limit,v){
if(((((0) === limit)) && (((1) < cljs.core.count(v))))){
return clojure.string.pop_last_while_empty(v);
} else {
return v;
}
});
clojure.string.split_with_empty_regex = (function clojure$string$split_with_empty_regex(s,limit){
if((((limit <= (0))) || ((limit >= ((2) + cljs.core.count(s)))))){
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(cljs.core.vec(cljs.core.cons("",cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.str,cljs.core.seq(s)))),"");
} else {
var pred__11697 = cljs.core._EQ__EQ_;
var expr__11698 = limit;
if(cljs.core.truth_((pred__11697.cljs$core$IFn$_invoke$arity$2 ? pred__11697.cljs$core$IFn$_invoke$arity$2((1),expr__11698) : pred__11697.call(null,(1),expr__11698)))){
return (new cljs.core.PersistentVector(null,1,(5),cljs.core.PersistentVector.EMPTY_NODE,[s],null));
} else {
if(cljs.core.truth_((pred__11697.cljs$core$IFn$_invoke$arity$2 ? pred__11697.cljs$core$IFn$_invoke$arity$2((2),expr__11698) : pred__11697.call(null,(2),expr__11698)))){
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,["",s],null));
} else {
var c = (limit - (2));
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(cljs.core.vec(cljs.core.cons("",cljs.core.subvec.cljs$core$IFn$_invoke$arity$3(cljs.core.vec(cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.str,cljs.core.seq(s))),(0),c))),cljs.core.subs.cljs$core$IFn$_invoke$arity$2(s,c));
}
}
}
});
/**
* Splits string on a regular expression. Optional argument limit is
* the maximum number of parts. Not lazy. Returns vector of the parts.
* Trailing empty strings are not returned - pass limit of -1 to return all.
*/
clojure.string.split = (function clojure$string$split(var_args){
var G__11701 = arguments.length;
switch (G__11701) {
case 2:
return clojure.string.split.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.string.split.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(clojure.string.split.cljs$core$IFn$_invoke$arity$2 = (function (s,re){
return clojure.string.split.cljs$core$IFn$_invoke$arity$3(s,re,(0));
}));
(clojure.string.split.cljs$core$IFn$_invoke$arity$3 = (function (s,re,limit){
return clojure.string.discard_trailing_if_needed(limit,((("/(?:)/" === cljs.core.str.cljs$core$IFn$_invoke$arity$1(re)))?clojure.string.split_with_empty_regex(s,limit):(((limit < (1)))?cljs.core.vec(cljs.core.str.cljs$core$IFn$_invoke$arity$1(s).split(re)):(function (){var s__$1 = s;
var limit__$1 = limit;
var parts = cljs.core.PersistentVector.EMPTY;
while(true){
if(((1) === limit__$1)){
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(parts,s__$1);
} else {
var m = cljs.core.re_find(re,s__$1);
if((!((m == null)))){
var index = s__$1.indexOf(m);
var G__11824 = s__$1.substring((index + cljs.core.count(m)));
var G__11825 = (limit__$1 - (1));
var G__11826 = cljs.core.conj.cljs$core$IFn$_invoke$arity$2(parts,s__$1.substring((0),index));
s__$1 = G__11824;
limit__$1 = G__11825;
parts = G__11826;
continue;
} else {
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(parts,s__$1);
}
}
break;
}
})())));
}));
(clojure.string.split.cljs$lang$maxFixedArity = 3);
/**
* Splits s on \n or \r\n. Trailing empty lines are not returned.
*/
clojure.string.split_lines = (function clojure$string$split_lines(s){
return clojure.string.split.cljs$core$IFn$_invoke$arity$2(s,/\n|\r\n/);
});
/**
* Removes whitespace from both ends of string.
*/
clojure.string.trim = (function clojure$string$trim(s){
return goog.string.trim(s);
});
/**
* Removes whitespace from the left side of string.
*/
clojure.string.triml = (function clojure$string$triml(s){
return goog.string.trimLeft(s);
});
/**
* Removes whitespace from the right side of string.
*/
clojure.string.trimr = (function clojure$string$trimr(s){
return goog.string.trimRight(s);
});
/**
* Removes all trailing newline \n or return \r characters from
* string. Similar to Perl's chomp.
*/
clojure.string.trim_newline = (function clojure$string$trim_newline(s){
var index = s.length;
while(true){
if((index === (0))){
return "";
} else {
var ch = cljs.core.get.cljs$core$IFn$_invoke$arity$2(s,(index - (1)));
if(((("\n" === ch)) || (("\r" === ch)))){
var G__11831 = (index - (1));
index = G__11831;
continue;
} else {
return s.substring((0),index);
}
}
break;
}
});
/**
* True if s is nil, empty, or contains only whitespace.
*/
clojure.string.blank_QMARK_ = (function clojure$string$blank_QMARK_(s){
return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(s));
});
/**
* Return a new string, using cmap to escape each character ch
* from s as follows:
*
* If (cmap ch) is nil, append ch to the new string.
* If (cmap ch) is non-nil, append (str (cmap ch)) instead.
*/
clojure.string.escape = (function clojure$string$escape(s,cmap){
var buffer = (new goog.string.StringBuffer());
var length = s.length;
var index = (0);
while(true){
if((length === index)){
return buffer.toString();
} else {
var ch = s.charAt(index);
var replacement = (cmap.cljs$core$IFn$_invoke$arity$1 ? cmap.cljs$core$IFn$_invoke$arity$1(ch) : cmap.call(null,ch));
if((!((replacement == null)))){
buffer.append(cljs.core.str.cljs$core$IFn$_invoke$arity$1(replacement));
} else {
buffer.append(ch);
}
var G__11841 = (index + (1));
index = G__11841;
continue;
}
break;
}
});
/**
* Return index of value (string or char) in s, optionally searching
* forward from from-index or nil if not found.
*/
clojure.string.index_of = (function clojure$string$index_of(var_args){
var G__11732 = arguments.length;
switch (G__11732) {
case 2:
return clojure.string.index_of.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.string.index_of.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(clojure.string.index_of.cljs$core$IFn$_invoke$arity$2 = (function (s,value){
var result = s.indexOf(value);
if((result < (0))){
return null;
} else {
return result;
}
}));
(clojure.string.index_of.cljs$core$IFn$_invoke$arity$3 = (function (s,value,from_index){
var result = s.indexOf(value,from_index);
if((result < (0))){
return null;
} else {
return result;
}
}));
(clojure.string.index_of.cljs$lang$maxFixedArity = 3);
/**
* Return last index of value (string or char) in s, optionally
* searching backward from from-index or nil if not found.
*/
clojure.string.last_index_of = (function clojure$string$last_index_of(var_args){
var G__11736 = arguments.length;
switch (G__11736) {
case 2:
return clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$2 = (function (s,value){
var result = s.lastIndexOf(value);
if((result < (0))){
return null;
} else {
return result;
}
}));
(clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$3 = (function (s,value,from_index){
var result = s.lastIndexOf(value,from_index);
if((result < (0))){
return null;
} else {
return result;
}
}));
(clojure.string.last_index_of.cljs$lang$maxFixedArity = 3);
/**
* True if s starts with substr.
*/
clojure.string.starts_with_QMARK_ = (function clojure$string$starts_with_QMARK_(s,substr){
return goog.string.startsWith(s,substr);
});
/**
* True if s ends with substr.
*/
clojure.string.ends_with_QMARK_ = (function clojure$string$ends_with_QMARK_(s,substr){
return goog.string.endsWith(s,substr);
});
/**
* True if s includes substr.
*/
clojure.string.includes_QMARK_ = (function clojure$string$includes_QMARK_(s,substr){
return goog.string.contains(s,substr);
});
//# sourceMappingURL=clojure.string.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,130 @@
goog.provide('clojure.walk');
/**
* Traverses form, an arbitrary data structure. inner and outer are
* functions. Applies inner to each element of form, building up a
* data structure of the same type, then applies outer to the result.
* Recognizes all Clojure data structures. Consumes seqs as with doall.
*/
clojure.walk.walk = (function clojure$walk$walk(inner,outer,form){
if(cljs.core.list_QMARK_(form)){
var G__14709 = cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.list,cljs.core.map.cljs$core$IFn$_invoke$arity$2(inner,form));
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__14709) : outer.call(null,G__14709));
} else {
if(cljs.core.map_entry_QMARK_(form)){
var G__14711 = (new cljs.core.MapEntry((function (){var G__14712 = cljs.core.key(form);
return (inner.cljs$core$IFn$_invoke$arity$1 ? inner.cljs$core$IFn$_invoke$arity$1(G__14712) : inner.call(null,G__14712));
})(),(function (){var G__14713 = cljs.core.val(form);
return (inner.cljs$core$IFn$_invoke$arity$1 ? inner.cljs$core$IFn$_invoke$arity$1(G__14713) : inner.call(null,G__14713));
})(),null));
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__14711) : outer.call(null,G__14711));
} else {
if(cljs.core.seq_QMARK_(form)){
var G__14714 = cljs.core.doall.cljs$core$IFn$_invoke$arity$1(cljs.core.map.cljs$core$IFn$_invoke$arity$2(inner,form));
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__14714) : outer.call(null,G__14714));
} else {
if(cljs.core.record_QMARK_(form)){
var G__14721 = cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (r,x){
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(r,(inner.cljs$core$IFn$_invoke$arity$1 ? inner.cljs$core$IFn$_invoke$arity$1(x) : inner.call(null,x)));
}),form,form);
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__14721) : outer.call(null,G__14721));
} else {
if(cljs.core.coll_QMARK_(form)){
var G__14726 = cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.empty(form),cljs.core.map.cljs$core$IFn$_invoke$arity$2(inner,form));
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(G__14726) : outer.call(null,G__14726));
} else {
return (outer.cljs$core$IFn$_invoke$arity$1 ? outer.cljs$core$IFn$_invoke$arity$1(form) : outer.call(null,form));
}
}
}
}
}
});
/**
* Performs a depth-first, post-order traversal of form. Calls f on
* each sub-form, uses f's return value in place of the original.
* Recognizes all Clojure data structures. Consumes seqs as with doall.
*/
clojure.walk.postwalk = (function clojure$walk$postwalk(f,form){
return clojure.walk.walk(cljs.core.partial.cljs$core$IFn$_invoke$arity$2(clojure.walk.postwalk,f),f,form);
});
/**
* Like postwalk, but does pre-order traversal.
*/
clojure.walk.prewalk = (function clojure$walk$prewalk(f,form){
return clojure.walk.walk(cljs.core.partial.cljs$core$IFn$_invoke$arity$2(clojure.walk.prewalk,f),cljs.core.identity,(f.cljs$core$IFn$_invoke$arity$1 ? f.cljs$core$IFn$_invoke$arity$1(form) : f.call(null,form)));
});
/**
* Recursively transforms all map keys from strings to keywords.
*/
clojure.walk.keywordize_keys = (function clojure$walk$keywordize_keys(m){
var f = (function (p__14737){
var vec__14742 = p__14737;
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14742,(0),null);
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14742,(1),null);
if(typeof k === 'string'){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.keyword.cljs$core$IFn$_invoke$arity$1(k),v], null);
} else {
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null);
}
});
return clojure.walk.postwalk((function (x){
if(cljs.core.map_QMARK_(x)){
return cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.cljs$core$IFn$_invoke$arity$2(f,x));
} else {
return x;
}
}),m);
});
/**
* Recursively transforms all map keys from keywords to strings.
*/
clojure.walk.stringify_keys = (function clojure$walk$stringify_keys(m){
var f = (function (p__14748){
var vec__14749 = p__14748;
var k = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14749,(0),null);
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__14749,(1),null);
if((k instanceof cljs.core.Keyword)){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.name(k),v], null);
} else {
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null);
}
});
return clojure.walk.postwalk((function (x){
if(cljs.core.map_QMARK_(x)){
return cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.cljs$core$IFn$_invoke$arity$2(f,x));
} else {
return x;
}
}),m);
});
/**
* Recursively transforms form by replacing keys in smap with their
* values. Like clojure/replace but works on any data structure. Does
* replacement at the root of the tree first.
*/
clojure.walk.prewalk_replace = (function clojure$walk$prewalk_replace(smap,form){
return clojure.walk.prewalk((function (x){
if(cljs.core.contains_QMARK_(smap,x)){
return (smap.cljs$core$IFn$_invoke$arity$1 ? smap.cljs$core$IFn$_invoke$arity$1(x) : smap.call(null,x));
} else {
return x;
}
}),form);
});
/**
* Recursively transforms form by replacing keys in smap with their
* values. Like clojure/replace but works on any data structure. Does
* replacement at the leaves of the tree first.
*/
clojure.walk.postwalk_replace = (function clojure$walk$postwalk_replace(smap,form){
return clojure.walk.postwalk((function (x){
if(cljs.core.contains_QMARK_(smap,x)){
return (smap.cljs$core$IFn$_invoke$arity$1 ? smap.cljs$core$IFn$_invoke$arity$1(x) : smap.call(null,x));
} else {
return x;
}
}),form);
});
//# sourceMappingURL=clojure.walk.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,112 @@
goog.provide("com.cognitect.transit.caching");
goog.require("com.cognitect.transit.delimiters");
goog.scope(function() {
var caching = com.cognitect.transit.caching;
var d = com.cognitect.transit.delimiters;
caching.MIN_SIZE_CACHEABLE = 3;
caching.BASE_CHAR_IDX = 48;
caching.CACHE_CODE_DIGITS = 44;
caching.MAX_CACHE_ENTRIES = caching.CACHE_CODE_DIGITS * caching.CACHE_CODE_DIGITS;
caching.MAX_CACHE_SIZE = 4096;
caching.isCacheable = function(string, asMapKey) {
if (string.length > caching.MIN_SIZE_CACHEABLE) {
if (asMapKey) {
return true;
} else {
var c0 = string.charAt(0);
var c1 = string.charAt(1);
if (c0 === d.ESC) {
return c1 === ":" || c1 === "$" || c1 === "#";
} else {
return false;
}
}
} else {
return false;
}
};
caching.idxToCode = function(idx) {
var hi = Math.floor(idx / caching.CACHE_CODE_DIGITS);
var lo = idx % caching.CACHE_CODE_DIGITS;
var loc = String.fromCharCode(lo + caching.BASE_CHAR_IDX);
if (hi === 0) {
return d.SUB + loc;
} else {
return d.SUB + String.fromCharCode(hi + caching.BASE_CHAR_IDX) + loc;
}
};
caching.WriteCache = function() {
this.idx = 0;
this.gen = 0;
this.cacheSize = 0;
this.cache = {};
};
caching.WriteCache.prototype.write = function(string, asMapKey) {
if (caching.isCacheable(string, asMapKey)) {
if (this.cacheSize === caching.MAX_CACHE_SIZE) {
this.clear();
this.gen = 0;
this.cache = {};
} else if (this.idx === caching.MAX_CACHE_ENTRIES) {
this.clear();
}
var entry = this.cache[string];
if (entry == null) {
this.cache[string] = [caching.idxToCode(this.idx), this.gen];
this.idx++;
return string;
} else if (entry[1] != this.gen) {
entry[1] = this.gen;
entry[0] = caching.idxToCode(this.idx);
this.idx++;
return string;
} else {
return entry[0];
}
} else {
return string;
}
};
caching.WriteCache.prototype.clear = function Transit$WriteCache() {
this.idx = 0;
this.gen++;
};
caching.writeCache = function() {
return new caching.WriteCache();
};
caching.isCacheCode = function(string) {
return string.charAt(0) === d.SUB && string.charAt(1) !== " ";
};
caching.codeToIdx = function(code) {
if (code.length === 2) {
return code.charCodeAt(1) - caching.BASE_CHAR_IDX;
} else {
var hi = (code.charCodeAt(1) - caching.BASE_CHAR_IDX) * caching.CACHE_CODE_DIGITS;
var lo = code.charCodeAt(2) - caching.BASE_CHAR_IDX;
return hi + lo;
}
};
caching.ReadCache = function Transit$ReadCache() {
this.idx = 0;
this.cache = [];
};
caching.ReadCache.prototype.write = function(obj, asMapKey) {
if (this.idx == caching.MAX_CACHE_ENTRIES) {
this.idx = 0;
}
this.cache[this.idx] = obj;
this.idx++;
return obj;
};
caching.ReadCache.prototype.read = function(string, asMapKey) {
return this.cache[caching.codeToIdx(string)];
};
caching.ReadCache.prototype.clear = function() {
this.idx = 0;
};
caching.readCache = function() {
return new caching.ReadCache();
};
});
//# sourceMappingURL=com.cognitect.transit.caching.js.map

View File

@@ -0,0 +1,9 @@
{
"version":3,
"file":"com.cognitect.transit.caching.js",
"lineCount":111,
"mappings":"AAcAA,IAAKC,CAAAA,OAAL,CAAa,+BAAb,CAAA;AACAD,IAAKE,CAAAA,OAAL,CAAa,kCAAb,CAAA;AAEAF,IAAKG,CAAAA,KAAL,CAAW,QAAQ,EAAG;AAAA,MAElBC,UAAUC,GAAIC,CAAAA,SAAUC,CAAAA,OAAQH,CAAAA,OAFd;AAEtB,MACII,IAAUH,GAAIC,CAAAA,SAAUC,CAAAA,OAAQE,CAAAA,UADpC;AAOAL,SAAQM,CAAAA,kBAAR,GAA6B,CAA7B;AAMAN,SAAQO,CAAAA,aAAR,GAAwB,EAAxB;AAMAP,SAAQQ,CAAAA,iBAAR,GAA4B,EAA5B;AAMAR,SAAQS,CAAAA,iBAAR,GAA4BT,OAAQQ,CAAAA,iBAApC,GAAsDR,OAAQQ,CAAAA,iBAA9D;AAMAR,SAAQU,CAAAA,cAAR,GAAyB,IAAzB;AAEAV,SAAQW,CAAAA,WAAR,GAAsBC,QAAQ,CAACC,MAAD,EAASC,QAAT,CAAmB;AAC7C,QAAGD,MAAOE,CAAAA,MAAV,GAAmBf,OAAQM,CAAAA,kBAA3B;AACI,UAAGQ,QAAH;AACI,eAAO,IAAP;AADJ,YAEO;AAAA,YACCE,KAAKH,MAAOI,CAAAA,MAAP,CAAc,CAAd,CADN;AACH,YACIC,KAAKL,MAAOI,CAAAA,MAAP,CAAc,CAAd,CADT;AAEA,YAAGD,EAAH,KAAUZ,CAAEe,CAAAA,GAAZ;AACI,iBAAOD,EAAP,KAAc,GAAd,IAAqBA,EAArB,KAA4B,GAA5B,IAAmCA,EAAnC,KAA0C,GAA1C;AADJ;AAGI,iBAAO,KAAP;AAHJ;AAHG;AAHX;AAaI,aAAO,KAAP;AAbJ;AAD6C,GAAjD;AAqBAlB,SAAQoB,CAAAA,SAAR,GAAoBC,QAAQ,CAACC,GAAD,CAAM;AAAA,QAC1BC,KAAMC,IAAKC,CAAAA,KAAL,CAAWH,GAAX,GAAiBtB,OAAQQ,CAAAA,iBAAzB,CADoB;AAAA,QAE1BkB,KAAMJ,GAANI,GAAY1B,OAAQQ,CAAAA,iBAFM;AAC9B,QAEImB,MAAMC,MAAOC,CAAAA,YAAP,CAAoBH,EAApB,GAAyB1B,OAAQO,CAAAA,aAAjC,CAFV;AAGA,QAAGgB,EAAH,KAAU,CAAV;AACI,aAAOnB,CAAE0B,CAAAA,GAAT,GAAeH,GAAf;AADJ;AAGI,aAAOvB,CAAE0B,CAAAA,GAAT,GAAeF,MAAOC,CAAAA,YAAP,CAAoBN,EAApB,GAAyBvB,OAAQO,CAAAA,aAAjC,CAAf,GAAiEoB,GAAjE;AAHJ;AAJ8B,GAAlC;AAcA3B,SAAQ+B,CAAAA,UAAR,GAAqBC,QAAQ,EAAG;AAC5B,QAAKV,CAAAA,GAAL,GAAW,CAAX;AACA,QAAKW,CAAAA,GAAL,GAAW,CAAX;AACA,QAAKC,CAAAA,SAAL,GAAiB,CAAjB;AACA,QAAKC,CAAAA,KAAL,GAAa,EAAb;AAJ4B,GAAhC;AAOAnC,SAAQ+B,CAAAA,UAAWK,CAAAA,SAAUC,CAAAA,KAA7B,GAAqCC,QAAQ,CAACzB,MAAD,EAASC,QAAT,CAAmB;AAC5D,QAAGd,OAAQW,CAAAA,WAAR,CAAoBE,MAApB,EAA4BC,QAA5B,CAAH,CAA0C;AACtC,UAAG,IAAKoB,CAAAA,SAAR,KAAsBlC,OAAQU,CAAAA,cAA9B,CAA8C;AAC1C,YAAK6B,CAAAA,KAAL,EAAA;AACA,YAAKN,CAAAA,GAAL,GAAW,CAAX;AACA,YAAKE,CAAAA,KAAL,GAAa,EAAb;AAH0C,OAA9C,KAIO,KAAG,IAAKb,CAAAA,GAAR,KAAgBtB,OAAQS,CAAAA,iBAAxB;AACH,YAAK8B,CAAAA,KAAL,EAAA;AADG;AAGP,UAAIC,QAAQ,IAAKL,CAAAA,KAAL,CAAWtB,MAAX,CAAZ;AACA,UAAG2B,KAAH,IAAY,IAAZ,CAAkB;AACd,YAAKL,CAAAA,KAAL,CAAWtB,MAAX,CAAA,GAAqB,CAACb,OAAQoB,CAAAA,SAAR,CAAkB,IAAKE,CAAAA,GAAvB,CAAD,EAA8B,IAAKW,CAAAA,GAAnC,CAArB;AACA,YAAKX,CAAAA,GAAL,EAAA;AACA,eAAOT,MAAP;AAHc,OAAlB,KAIO,KAAG2B,KAAA,CAAM,CAAN,CAAH,IAAe,IAAKP,CAAAA,GAApB,CAAyB;AAC5BO,aAAA,CAAM,CAAN,CAAA,GAAW,IAAKP,CAAAA,GAAhB;AACAO,aAAA,CAAM,CAAN,CAAA,GAAWxC,OAAQoB,CAAAA,SAAR,CAAkB,IAAKE,CAAAA,GAAvB,CAAX;AACA,YAAKA,CAAAA,GAAL,EAAA;AACA,eAAOT,MAAP;AAJ4B,OAAzB;AAMH,eAAO2B,KAAA,CAAM,CAAN,CAAP;AANG;AAb+B,KAA1C;AAsBI,aAAO3B,MAAP;AAtBJ;AAD4D,GAAhE;AA2BAb,SAAQ+B,CAAAA,UAAWK,CAAAA,SAAUG,CAAAA,KAA7B,GAAqCE,QAASC,mBAAkB,EAAG;AAC/D,QAAKpB,CAAAA,GAAL,GAAW,CAAX;AACA,QAAKW,CAAAA,GAAL,EAAA;AAF+D,GAAnE;AAKAjC,SAAQ2C,CAAAA,UAAR,GAAqBC,QAAQ,EAAG;AAC5B,WAAO,IAAI5C,OAAQ+B,CAAAA,UAAZ,EAAP;AAD4B,GAAhC;AAOA/B,SAAQ6C,CAAAA,WAAR,GAAsBC,QAAQ,CAACjC,MAAD,CAAS;AACnC,WAAQA,MAAOI,CAAAA,MAAP,CAAc,CAAd,CAAR,KAA6Bb,CAAE0B,CAAAA,GAA/B,IAAwCjB,MAAOI,CAAAA,MAAP,CAAc,CAAd,CAAxC,KAA6D,GAA7D;AADmC,GAAvC;AAIAjB,SAAQ+C,CAAAA,SAAR,GAAoBC,QAAQ,CAACC,IAAD,CAAO;AAC/B,QAAGA,IAAKlC,CAAAA,MAAR,KAAmB,CAAnB;AACI,aAAOkC,IAAKC,CAAAA,UAAL,CAAgB,CAAhB,CAAP,GAA4BlD,OAAQO,CAAAA,aAApC;AADJ,UAEO;AAAA,UACCgB,MAAM0B,IAAKC,CAAAA,UAAL,CAAgB,CAAhB,CAAN3B,GAA2BvB,OAAQO,CAAAA,aAAnCgB,IAAoDvB,OAAQQ,CAAAA,iBAD7D;AACH,UACIkB,KAAMuB,IAAKC,CAAAA,UAAL,CAAgB,CAAhB,CAANxB,GAA2B1B,OAAQO,CAAAA,aADvC;AAEA,aAAOgB,EAAP,GAAYG,EAAZ;AAHG;AAHwB,GAAnC;AAaA1B,SAAQmD,CAAAA,SAAR,GAAoBC,QAASC,kBAAiB,EAAG;AAC7C,QAAK/B,CAAAA,GAAL,GAAW,CAAX;AACA,QAAKa,CAAAA,KAAL,GAAa,EAAb;AAF6C,GAAjD;AAKAnC,SAAQmD,CAAAA,SAAUf,CAAAA,SAAUC,CAAAA,KAA5B,GAAoCiB,QAAQ,CAACC,GAAD,EAAMzC,QAAN,CAAgB;AACxD,QAAG,IAAKQ,CAAAA,GAAR,IAAetB,OAAQS,CAAAA,iBAAvB;AACI,UAAKa,CAAAA,GAAL,GAAW,CAAX;AADJ;AAGA,QAAKa,CAAAA,KAAL,CAAW,IAAKb,CAAAA,GAAhB,CAAA,GAAuBiC,GAAvB;AACA,QAAKjC,CAAAA,GAAL,EAAA;AACA,WAAOiC,GAAP;AANwD,GAA5D;AASAvD,SAAQmD,CAAAA,SAAUf,CAAAA,SAAUoB,CAAAA,IAA5B,GAAmCC,QAAQ,CAAC5C,MAAD,EAASC,QAAT,CAAmB;AAC1D,WAAO,IAAKqB,CAAAA,KAAL,CAAWnC,OAAQ+C,CAAAA,SAAR,CAAkBlC,MAAlB,CAAX,CAAP;AAD0D,GAA9D;AAIAb,SAAQmD,CAAAA,SAAUf,CAAAA,SAAUG,CAAAA,KAA5B,GAAoCmB,QAAQ,EAAG;AAC3C,QAAKpC,CAAAA,GAAL,GAAW,CAAX;AAD2C,GAA/C;AAIAtB,SAAQ2D,CAAAA,SAAR,GAAoBC,QAAQ,EAAG;AAC3B,WAAO,IAAI5D,OAAQmD,CAAAA,SAAZ,EAAP;AAD2B,GAA/B;AA3JsB,CAAtB,CAAA;;",
"sources":["com/cognitect/transit/caching.js"],
"sourcesContent":["// Copyright 2014 Cognitect. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ngoog.provide(\"com.cognitect.transit.caching\");\ngoog.require(\"com.cognitect.transit.delimiters\");\n\ngoog.scope(function() {\n\nvar caching = com.cognitect.transit.caching,\n d = com.cognitect.transit.delimiters;\n\n/**\n * @const\n * @type {number}\n */\ncaching.MIN_SIZE_CACHEABLE = 3;\n\n/**\n * @const\n * @type {number}\n */\ncaching.BASE_CHAR_IDX = 48;\n\n/**\n * @const\n * @type {number}\n */\ncaching.CACHE_CODE_DIGITS = 44;\n\n/**\n * @const\n * @type {number}\n */\ncaching.MAX_CACHE_ENTRIES = caching.CACHE_CODE_DIGITS*caching.CACHE_CODE_DIGITS;\n\n/**\n * @const\n * @type {number}\n */\ncaching.MAX_CACHE_SIZE = 4096;\n\ncaching.isCacheable = function(string, asMapKey) {\n if(string.length > caching.MIN_SIZE_CACHEABLE) {\n if(asMapKey) {\n return true;\n } else {\n var c0 = string.charAt(0),\n c1 = string.charAt(1);\n if(c0 === d.ESC) {\n return c1 === \":\" || c1 === \"$\" || c1 === \"#\";\n } else {\n return false;\n }\n }\n } else {\n return false;\n }\n};\n\n// =============================================================================\n// WriteCache\n\ncaching.idxToCode = function(idx) {\n var hi = Math.floor(idx / caching.CACHE_CODE_DIGITS),\n lo = idx % caching.CACHE_CODE_DIGITS,\n loc = String.fromCharCode(lo + caching.BASE_CHAR_IDX)\n if(hi === 0) {\n return d.SUB + loc;\n } else {\n return d.SUB + String.fromCharCode(hi + caching.BASE_CHAR_IDX) + loc;\n }\n};\n\n/**\n * @constructor\n */\ncaching.WriteCache = function() {\n this.idx = 0;\n this.gen = 0;\n this.cacheSize = 0;\n this.cache = {};\n};\n\ncaching.WriteCache.prototype.write = function(string, asMapKey) {\n if(caching.isCacheable(string, asMapKey)) {\n if(this.cacheSize === caching.MAX_CACHE_SIZE) {\n this.clear();\n this.gen = 0;\n this.cache = {};\n } else if(this.idx === caching.MAX_CACHE_ENTRIES) {\n this.clear();\n }\n var entry = this.cache[string];\n if(entry == null) {\n this.cache[string] = [caching.idxToCode(this.idx), this.gen];\n this.idx++;\n return string;\n } else if(entry[1] != this.gen) {\n entry[1] = this.gen;\n entry[0] = caching.idxToCode(this.idx);\n this.idx++;\n return string;\n } else {\n return entry[0];\n }\n } else {\n return string;\n }\n};\n\ncaching.WriteCache.prototype.clear = function Transit$WriteCache() {\n this.idx = 0;\n this.gen++;\n};\n\ncaching.writeCache = function() {\n return new caching.WriteCache();\n};\n\n// =============================================================================\n// ReadCache\n\ncaching.isCacheCode = function(string) {\n return (string.charAt(0) === d.SUB) && (string.charAt(1) !== \" \");\n};\n\ncaching.codeToIdx = function(code) {\n if(code.length === 2) {\n return code.charCodeAt(1) - caching.BASE_CHAR_IDX; \n } else {\n var hi = (code.charCodeAt(1) - caching.BASE_CHAR_IDX) * caching.CACHE_CODE_DIGITS,\n lo = (code.charCodeAt(2) - caching.BASE_CHAR_IDX);\n return hi + lo; \n }\n};\n\n/**\n * @constructor\n */\ncaching.ReadCache = function Transit$ReadCache() {\n this.idx = 0;\n this.cache = [];\n};\n\ncaching.ReadCache.prototype.write = function(obj, asMapKey) {\n if(this.idx == caching.MAX_CACHE_ENTRIES) {\n this.idx = 0;\n }\n this.cache[this.idx] = obj;\n this.idx++;\n return obj;\n};\n\ncaching.ReadCache.prototype.read = function(string, asMapKey) {\n return this.cache[caching.codeToIdx(string)];\n};\n\ncaching.ReadCache.prototype.clear = function() {\n this.idx = 0;\n};\n\ncaching.readCache = function() {\n return new caching.ReadCache();\n};\n\n}); \n"],
"names":["goog","provide","require","scope","caching","com","cognitect","transit","d","delimiters","MIN_SIZE_CACHEABLE","BASE_CHAR_IDX","CACHE_CODE_DIGITS","MAX_CACHE_ENTRIES","MAX_CACHE_SIZE","isCacheable","caching.isCacheable","string","asMapKey","length","c0","charAt","c1","ESC","idxToCode","caching.idxToCode","idx","hi","Math","floor","lo","loc","String","fromCharCode","SUB","WriteCache","caching.WriteCache","gen","cacheSize","cache","prototype","write","caching.WriteCache.prototype.write","clear","entry","caching.WriteCache.prototype.clear","Transit$WriteCache","writeCache","caching.writeCache","isCacheCode","caching.isCacheCode","codeToIdx","caching.codeToIdx","code","charCodeAt","ReadCache","caching.ReadCache","Transit$ReadCache","caching.ReadCache.prototype.write","obj","read","caching.ReadCache.prototype.read","caching.ReadCache.prototype.clear","readCache","caching.readCache"]
}

View File

@@ -0,0 +1,11 @@
goog.provide("com.cognitect.transit.delimiters");
goog.scope(function() {
var delimiters = com.cognitect.transit.delimiters;
delimiters.ESC = "~";
delimiters.TAG = "#";
delimiters.SUB = "^";
delimiters.RES = "`";
delimiters.ESC_TAG = "~#";
});
//# sourceMappingURL=com.cognitect.transit.delimiters.js.map

View File

@@ -0,0 +1,9 @@
{
"version":3,
"file":"com.cognitect.transit.delimiters.js",
"lineCount":10,
"mappings":"AAcAA,IAAKC,CAAAA,OAAL,CAAa,kCAAb,CAAA;AAEAD,IAAKE,CAAAA,KAAL,CAAW,QAAQ,EAAG;AAEtB,MAAIC,aAAaC,GAAIC,CAAAA,SAAUC,CAAAA,OAAQH,CAAAA,UAAvC;AAMAA,YAAWI,CAAAA,GAAX,GAAqB,GAArB;AAMAJ,YAAWK,CAAAA,GAAX,GAAqB,GAArB;AAMAL,YAAWM,CAAAA,GAAX,GAAqB,GAArB;AAMAN,YAAWO,CAAAA,GAAX,GAAqB,GAArB;AAMAP,YAAWQ,CAAAA,OAAX,GAAqB,IAArB;AAhCsB,CAAtB,CAAA;;",
"sources":["com/cognitect/transit/delimiters.js"],
"sourcesContent":["// Copyright 2014 Cognitect. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ngoog.provide(\"com.cognitect.transit.delimiters\");\n\ngoog.scope(function() {\n\nvar delimiters = com.cognitect.transit.delimiters;\n \n/**\n * @const\n * @type {string}\n */\ndelimiters.ESC = \"~\";\n\n/**\n * @const\n * @type {string}\n */\ndelimiters.TAG = \"#\";\n\n/**\n * @const\n * @type {string}\n */\ndelimiters.SUB = \"^\";\n\n/**\n * @const\n * @type {string}\n */\ndelimiters.RES = \"`\";\n\n/**\n * @const\n * @type {string}\n */\ndelimiters.ESC_TAG = \"~#\";\n\n});\n"],
"names":["goog","provide","scope","delimiters","com","cognitect","transit","ESC","TAG","SUB","RES","ESC_TAG"]
}

View File

@@ -0,0 +1,168 @@
goog.provide("com.cognitect.transit.eq");
goog.require("com.cognitect.transit.util");
goog.scope(function() {
var eq = com.cognitect.transit.eq;
var util = com.cognitect.transit.util;
eq.hashCodeProperty = "transit$hashCode$";
eq.hashCodeCounter = 1;
eq.equals = function(x, y) {
if (x == null) {
return y == null;
} else if (x === y) {
return true;
} else if (typeof x === "object") {
if (util.isArray(x)) {
if (util.isArray(y)) {
if (x.length === y.length) {
var i = 0;
for (; i < x.length; i++) {
if (!eq.equals(x[i], y[i])) {
return false;
}
}
return true;
} else {
return false;
}
} else {
return false;
}
} else if (x.com$cognitect$transit$equals) {
return x.com$cognitect$transit$equals(y);
} else if (y != null && typeof y === "object") {
if (y.com$cognitect$transit$equals) {
return y.com$cognitect$transit$equals(x);
} else {
var xklen = 0;
var yklen = util.objectKeys(y).length;
var p;
for (p in x) {
if (!x.hasOwnProperty(p)) {
continue;
}
xklen++;
if (!y.hasOwnProperty(p)) {
return false;
} else {
if (!eq.equals(x[p], y[p])) {
return false;
}
}
}
return xklen === yklen;
}
} else {
return false;
}
} else {
return false;
}
};
eq.hashCombine = function(seed, hash) {
return seed ^ hash + 2654435769 + (seed << 6) + (seed >> 2);
};
eq.stringCodeCache = {};
eq.stringCodeCacheSize = 0;
eq.STR_CACHE_MAX = 256;
eq.hashString = function(str) {
var cached = eq.stringCodeCache[str];
if (cached != null) {
return cached;
}
var code = 0;
var i = 0;
for (; i < str.length; ++i) {
code = 31 * code + str.charCodeAt(i);
code = code % 4294967296;
}
eq.stringCodeCacheSize++;
if (eq.stringCodeCacheSize >= eq.STR_CACHE_MAX) {
eq.stringCodeCache = {};
eq.stringCodeCacheSize = 1;
}
eq.stringCodeCache[str] = code;
return code;
};
eq.hashMapLike = function(m) {
var code = 0;
if (m.forEach != null) {
m.forEach(function(val, key, m) {
code = (code + (eq.hashCode(key) ^ eq.hashCode(val))) % 4503599627370496;
});
} else {
var keys = util.objectKeys(m);
var i = 0;
for (; i < keys.length; i++) {
var key = keys[i];
var val = m[key];
code = (code + (eq.hashCode(key) ^ eq.hashCode(val))) % 4503599627370496;
}
}
return code;
};
eq.hashArrayLike = function(arr) {
var code = 0;
if (util.isArray(arr)) {
var i = 0;
for (; i < arr.length; i++) {
code = eq.hashCombine(code, eq.hashCode(arr[i]));
}
} else if (arr.forEach) {
arr.forEach(function(x, i) {
code = eq.hashCombine(code, eq.hashCode(x));
});
}
return code;
};
eq.hashCode = function(x) {
if (x == null) {
return 0;
} else {
switch(typeof x) {
case "number":
return x;
break;
case "boolean":
return x === true ? 1 : 0;
break;
case "string":
return eq.hashString(x);
break;
case "function":
var code = x[eq.hashCodeProperty];
if (code) {
return code;
} else {
code = eq.hashCodeCounter;
if (typeof Object.defineProperty != "undefined") {
Object.defineProperty(x, eq.hashCodeProperty, {value:code, enumerable:false});
} else {
x[eq.hashCodeProperty] = code;
}
eq.hashCodeCounter++;
return code;
}
break;
default:
if (x instanceof Date) {
return x.valueOf();
} else if (util.isArray(x)) {
return eq.hashArrayLike(x);
}
if (x.com$cognitect$transit$hashCode) {
return x.com$cognitect$transit$hashCode();
} else {
return eq.hashMapLike(x);
}
break;
}
}
};
eq.extendToEQ = function(obj, opts) {
obj.com$cognitect$transit$hashCode = opts["hashCode"];
obj.com$cognitect$transit$equals = opts["equals"];
return obj;
};
});
//# sourceMappingURL=com.cognitect.transit.eq.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,330 @@
goog.provide("com.cognitect.transit.handlers");
goog.require("com.cognitect.transit.util");
goog.require("com.cognitect.transit.types");
goog.require("goog.math.Long");
goog.scope(function() {
var handlers = com.cognitect.transit.handlers;
var util = com.cognitect.transit.util;
var types = com.cognitect.transit.types;
var Long = goog.math.Long;
handlers.ctorGuid = 0;
handlers.ctorGuidProperty = "transit$guid$" + util.randomUUID();
handlers.typeTag = function(ctor) {
if (ctor == null) {
return "null";
} else if (ctor === String) {
return "string";
} else if (ctor === Boolean) {
return "boolean";
} else if (ctor === Number) {
return "number";
} else if (ctor === Array) {
return "array";
} else if (ctor === Object) {
return "map";
} else {
var tag = ctor[handlers.ctorGuidProperty];
if (tag == null) {
if (typeof Object.defineProperty != "undefined") {
tag = ++handlers.ctorGuid;
Object.defineProperty(ctor, handlers.ctorGuidProperty, {value:tag, enumerable:false});
} else {
ctor[handlers.ctorGuidProperty] = tag = ++handlers.ctorGuid;
}
}
return tag;
}
};
handlers.constructor = function(x) {
if (x == null) {
return null;
} else {
return x.constructor;
}
};
handlers.padZeros = function(n, m) {
var s = n.toString();
var i = s.length;
for (; i < m; i++) {
s = "0" + s;
}
return s;
};
handlers.stringableKeys = function(m) {
var stringable = false;
var ks = util.objectKeys(m);
var i = 0;
for (; i < ks.length; i++) {
}
return true;
};
handlers.NilHandler = function Transit$NilHandler() {
};
handlers.NilHandler.prototype.tag = function(v) {
return "_";
};
handlers.NilHandler.prototype.rep = function(v) {
return null;
};
handlers.NilHandler.prototype.stringRep = function(v) {
return "null";
};
handlers.StringHandler = function Transit$StringHandler() {
};
handlers.StringHandler.prototype.tag = function(v) {
return "s";
};
handlers.StringHandler.prototype.rep = function(v) {
return v;
};
handlers.StringHandler.prototype.stringRep = function(v) {
return v;
};
handlers.NumberHandler = function Transit$NumberHandler() {
};
handlers.NumberHandler.prototype.tag = function(v) {
return "i";
};
handlers.NumberHandler.prototype.rep = function(v) {
return v;
};
handlers.NumberHandler.prototype.stringRep = function(v) {
return v.toString();
};
handlers.IntegerHandler = function Transit$IntegerHandler() {
};
handlers.IntegerHandler.prototype.tag = function(v) {
return "i";
};
handlers.IntegerHandler.prototype.rep = function(v) {
return v.toString();
};
handlers.IntegerHandler.prototype.stringRep = function(v) {
return v.toString();
};
handlers.BooleanHandler = function Transit$BooleanHandler() {
};
handlers.BooleanHandler.prototype.tag = function(v) {
return "?";
};
handlers.BooleanHandler.prototype.rep = function(v) {
return v;
};
handlers.BooleanHandler.prototype.stringRep = function(v) {
return v.toString();
};
handlers.ArrayHandler = function Transit$ArrayHandler() {
};
handlers.ArrayHandler.prototype.tag = function(v) {
return "array";
};
handlers.ArrayHandler.prototype.rep = function(v) {
return v;
};
handlers.ArrayHandler.prototype.stringRep = function(v) {
return null;
};
handlers.MapHandler = function Transit$MapHandler() {
};
handlers.MapHandler.prototype.tag = function(v) {
return "map";
};
handlers.MapHandler.prototype.rep = function(v) {
return v;
};
handlers.MapHandler.prototype.stringRep = function(v) {
return null;
};
handlers.VerboseDateHandler = function Transit$VerboseDateHandler() {
};
handlers.VerboseDateHandler.prototype.tag = function(v) {
return "t";
};
handlers.VerboseDateHandler.prototype.rep = function(v) {
return v.getUTCFullYear() + "-" + handlers.padZeros(v.getUTCMonth() + 1, 2) + "-" + handlers.padZeros(v.getUTCDate(), 2) + "T" + handlers.padZeros(v.getUTCHours(), 2) + ":" + handlers.padZeros(v.getUTCMinutes(), 2) + ":" + handlers.padZeros(v.getUTCSeconds(), 2) + "." + handlers.padZeros(v.getUTCMilliseconds(), 3) + "Z";
};
handlers.VerboseDateHandler.prototype.stringRep = function(v, h) {
return h.rep(v);
};
handlers.DateHandler = function Transit$DateHandler() {
};
handlers.DateHandler.prototype.tag = function(v) {
return "m";
};
handlers.DateHandler.prototype.rep = function(v) {
return v.valueOf();
};
handlers.DateHandler.prototype.stringRep = function(v) {
return v.valueOf().toString();
};
handlers.DateHandler.prototype.getVerboseHandler = function(v) {
return new handlers.VerboseDateHandler();
};
handlers.UUIDHandler = function Transit$UUIDHandler() {
};
handlers.UUIDHandler.prototype.tag = function(v) {
return "u";
};
handlers.UUIDHandler.prototype.rep = function(v) {
return v.toString();
};
handlers.UUIDHandler.prototype.stringRep = function(v) {
return v.toString();
};
handlers.KeywordHandler = function Transit$KeywordHandler() {
};
handlers.KeywordHandler.prototype.tag = function(v) {
return ":";
};
handlers.KeywordHandler.prototype.rep = function(v) {
return v._name;
};
handlers.KeywordHandler.prototype.stringRep = function(v, h) {
return h.rep(v);
};
handlers.SymbolHandler = function Transit$SymbolHandler() {
};
handlers.SymbolHandler.prototype.tag = function(v) {
return "$";
};
handlers.SymbolHandler.prototype.rep = function(v) {
return v._name;
};
handlers.SymbolHandler.prototype.stringRep = function(v, h) {
return h.rep(v);
};
handlers.TaggedHandler = function Transit$TaggedHandler() {
};
handlers.TaggedHandler.prototype.tag = function(v) {
return v.tag;
};
handlers.TaggedHandler.prototype.rep = function(v) {
return v.rep;
};
handlers.TaggedHandler.prototype.stringRep = function(v, h) {
return null;
};
handlers.TransitSetHandler = function Transit$TransitSetHandler() {
};
handlers.TransitSetHandler.prototype.tag = function(v) {
return "set";
};
handlers.TransitSetHandler.prototype.rep = function(v) {
var arr = [];
v.forEach(function(key, set) {
arr.push(key);
});
return types.taggedValue("array", arr);
};
handlers.TransitSetHandler.prototype.stringRep = function(v, h) {
return null;
};
handlers.TransitArrayMapHandler = function Transit$ArrayMapHandler() {
};
handlers.TransitArrayMapHandler.prototype.tag = function(v) {
return "map";
};
handlers.TransitArrayMapHandler.prototype.rep = function(v) {
return v;
};
handlers.TransitArrayMapHandler.prototype.stringRep = function(v, h) {
return null;
};
handlers.TransitMapHandler = function Transit$MapHandler() {
};
handlers.TransitMapHandler.prototype.tag = function(v) {
return "map";
};
handlers.TransitMapHandler.prototype.rep = function(v) {
return v;
};
handlers.TransitMapHandler.prototype.stringRep = function(v, h) {
return null;
};
handlers.BufferHandler = function Transit$BufferHandler() {
};
handlers.BufferHandler.prototype.tag = function(v) {
return "b";
};
handlers.BufferHandler.prototype.rep = function(v) {
return v.toString("base64");
};
handlers.BufferHandler.prototype.stringRep = function(v, h) {
return null;
};
handlers.Uint8ArrayHandler = function Transit$Uint8ArrayHandler() {
};
handlers.Uint8ArrayHandler.prototype.tag = function(v) {
return "b";
};
handlers.Uint8ArrayHandler.prototype.rep = function(v) {
return util.Uint8ToBase64(v);
};
handlers.Uint8ArrayHandler.prototype.stringRep = function(v, h) {
return null;
};
handlers.defaultHandlers = function(hs) {
hs.set(null, new handlers.NilHandler());
hs.set(String, new handlers.StringHandler());
hs.set(Number, new handlers.NumberHandler());
hs.set(Long, new handlers.IntegerHandler());
hs.set(Boolean, new handlers.BooleanHandler());
hs.set(Array, new handlers.ArrayHandler());
hs.set(Object, new handlers.MapHandler());
hs.set(Date, new handlers.DateHandler());
hs.set(types.UUID, new handlers.UUIDHandler());
hs.set(types.Keyword, new handlers.KeywordHandler());
hs.set(types.Symbol, new handlers.SymbolHandler());
hs.set(types.TaggedValue, new handlers.TaggedHandler());
hs.set(types.TransitSet, new handlers.TransitSetHandler());
hs.set(types.TransitArrayMap, new handlers.TransitArrayMapHandler());
hs.set(types.TransitMap, new handlers.TransitMapHandler());
if (typeof goog.global.Buffer != "undefined") {
hs.set(goog.global.Buffer, new handlers.BufferHandler());
}
if (typeof Uint8Array != "undefined") {
hs.set(Uint8Array, new handlers.Uint8ArrayHandler());
}
return hs;
};
handlers.Handlers = function Transit$Handlers() {
this.handlers = {};
handlers.defaultHandlers(this);
};
handlers.Handlers.prototype.get = function(ctor) {
var h = null;
if (typeof ctor === "string") {
h = this.handlers[ctor];
} else {
h = this.handlers[handlers.typeTag(ctor)];
}
if (h != null) {
return h;
} else {
return this.handlers["default"];
}
};
handlers.Handlers.prototype["get"] = handlers.Handlers.prototype.get;
handlers.validTag = function(tag) {
switch(tag) {
case "null":
case "string":
case "boolean":
case "number":
case "array":
case "map":
return false;
break;
}
return true;
};
handlers.Handlers.prototype.set = function(ctor, handler) {
if (typeof ctor === "string" && handlers.validTag(ctor)) {
this.handlers[ctor] = handler;
} else {
this.handlers[handlers.typeTag(ctor)] = handler;
}
};
});
//# sourceMappingURL=com.cognitect.transit.handlers.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,281 @@
goog.provide("com.cognitect.transit.impl.decoder");
goog.require("com.cognitect.transit.util");
goog.require("com.cognitect.transit.delimiters");
goog.require("com.cognitect.transit.caching");
goog.require("com.cognitect.transit.types");
goog.scope(function() {
var decoder = com.cognitect.transit.impl.decoder;
var util = com.cognitect.transit.util;
var d = com.cognitect.transit.delimiters;
var caching = com.cognitect.transit.caching;
var types = com.cognitect.transit.types;
decoder.Tag = function Transit$Tag(s) {
this.str = s;
};
decoder.tag = function(s) {
return new decoder.Tag(s);
};
decoder.isTag = function(x) {
return x && x instanceof decoder.Tag;
};
decoder.isGroundHandler = function(handler) {
switch(handler) {
case "_":
case "s":
case "?":
case "i":
case "d":
case "b":
case "'":
case "array":
case "map":
return true;
}
return false;
};
decoder.Decoder = function Transit$Decoder(options) {
this.options = options || {};
this.handlers = {};
var h;
for (h in this.defaults.handlers) {
this.handlers[h] = this.defaults.handlers[h];
}
for (h in this.options["handlers"]) {
if (decoder.isGroundHandler(h)) {
throw new Error('Cannot override handler for ground type "' + h + '"');
}
this.handlers[h] = this.options["handlers"][h];
}
this.preferStrings = this.options["preferStrings"] != null ? this.options["preferStrings"] : this.defaults.preferStrings;
this.preferBuffers = this.options["preferBuffers"] != null ? this.options["preferBuffers"] : this.defaults.preferBuffers;
this.defaultHandler = this.options["defaultHandler"] || this.defaults.defaultHandler;
this.mapBuilder = this.options["mapBuilder"];
this.arrayBuilder = this.options["arrayBuilder"];
};
decoder.Decoder.prototype.defaults = {handlers:{"_":function(v, d) {
return types.nullValue();
}, "?":function(v, d) {
return types.boolValue(v);
}, "b":function(v, d) {
return types.binary(v, d);
}, "i":function(v, d) {
return types.intValue(v);
}, "n":function(v, d) {
return types.bigInteger(v);
}, "d":function(v, d) {
return types.floatValue(v);
}, "f":function(v, d) {
return types.bigDecimalValue(v);
}, "c":function(v, d) {
return types.charValue(v);
}, ":":function(v, d) {
return types.keyword(v);
}, "$":function(v, d) {
return types.symbol(v);
}, "r":function(v, d) {
return types.uri(v);
}, "z":function(v, d) {
return types.specialDouble(v);
}, "'":function(v, d) {
return v;
}, "m":function(v, d) {
return types.date(v);
}, "t":function(v, d) {
return types.verboseDate(v);
}, "u":function(v, d) {
return types.uuid(v);
}, "set":function(v, d) {
return types.set(v);
}, "list":function(v, d) {
return types.list(v);
}, "link":function(v, d) {
return types.link(v);
}, "cmap":function(v, d) {
return types.map(v, false);
}}, defaultHandler:function(c, val) {
return types.taggedValue(c, val);
}, preferStrings:true, preferBuffers:true};
decoder.Decoder.prototype.decode = function(node, cache, asMapKey, tagValue) {
if (node == null) {
return null;
}
var t = typeof node;
switch(t) {
case "string":
return this.decodeString(node, cache, asMapKey, tagValue);
break;
case "object":
if (util.isArray(node)) {
if (node[0] === "^ ") {
return this.decodeArrayHash(node, cache, asMapKey, tagValue);
} else {
return this.decodeArray(node, cache, asMapKey, tagValue);
}
} else {
return this.decodeHash(node, cache, asMapKey, tagValue);
}
break;
}
return node;
};
decoder.Decoder.prototype["decode"] = decoder.Decoder.prototype.decode;
decoder.Decoder.prototype.decodeString = function(string, cache, asMapKey, tagValue) {
if (caching.isCacheable(string, asMapKey)) {
var val = this.parseString(string, cache, false);
if (cache) {
cache.write(val, asMapKey);
}
return val;
} else if (caching.isCacheCode(string)) {
return cache.read(string, asMapKey);
} else {
return this.parseString(string, cache, asMapKey);
}
};
decoder.Decoder.prototype.decodeHash = function(hash, cache, asMapKey, tagValue) {
var ks = util.objectKeys(hash);
var key = ks[0];
var tag = ks.length == 1 ? this.decode(key, cache, false, false) : null;
if (decoder.isTag(tag)) {
var val = hash[key];
var handler = this.handlers[tag.str];
if (handler != null) {
return handler(this.decode(val, cache, false, true), this);
} else {
return types.taggedValue(tag.str, this.decode(val, cache, false, false));
}
} else if (this.mapBuilder) {
if (ks.length < types.SMALL_ARRAY_MAP_THRESHOLD * 2 && this.mapBuilder.fromArray) {
var nodep = [];
var i = 0;
for (; i < ks.length; i++) {
var strKey = ks[i];
nodep.push(this.decode(strKey, cache, true, false));
nodep.push(this.decode(hash[strKey], cache, false, false));
}
return this.mapBuilder.fromArray(nodep, hash);
} else {
var ret = this.mapBuilder.init(hash);
i = 0;
for (; i < ks.length; i++) {
strKey = ks[i];
ret = this.mapBuilder.add(ret, this.decode(strKey, cache, true, false), this.decode(hash[strKey], cache, false, false), hash);
}
return this.mapBuilder.finalize(ret, hash);
}
} else {
nodep = [];
i = 0;
for (; i < ks.length; i++) {
strKey = ks[i];
nodep.push(this.decode(strKey, cache, true, false));
nodep.push(this.decode(hash[strKey], cache, false, false));
}
return types.map(nodep, false);
}
};
decoder.Decoder.prototype.decodeArrayHash = function(node, cache, asMapKey, tagValue) {
if (this.mapBuilder) {
if (node.length < types.SMALL_ARRAY_MAP_THRESHOLD * 2 + 1 && this.mapBuilder.fromArray) {
var nodep = [];
var i = 1;
for (; i < node.length; i = i + 2) {
nodep.push(this.decode(node[i], cache, true, false));
nodep.push(this.decode(node[i + 1], cache, false, false));
}
return this.mapBuilder.fromArray(nodep, node);
} else {
var ret = this.mapBuilder.init(node);
i = 1;
for (; i < node.length; i = i + 2) {
ret = this.mapBuilder.add(ret, this.decode(node[i], cache, true, false), this.decode(node[i + 1], cache, false, false), node);
}
return this.mapBuilder.finalize(ret, node);
}
} else {
nodep = [];
i = 1;
for (; i < node.length; i = i + 2) {
nodep.push(this.decode(node[i], cache, true, false));
nodep.push(this.decode(node[i + 1], cache, false, false));
}
return types.map(nodep, false);
}
};
decoder.Decoder.prototype.decodeArray = function(node, cache, asMapKey, tagValue) {
if (tagValue) {
var ret = [];
var i = 0;
for (; i < node.length; i++) {
ret.push(this.decode(node[i], cache, asMapKey, false));
}
return ret;
} else {
var cacheIdx = cache && cache.idx;
if (node.length === 2 && typeof node[0] === "string") {
var tag = this.decode(node[0], cache, false, false);
if (decoder.isTag(tag)) {
var val = node[1];
var handler = this.handlers[tag.str];
if (handler != null) {
ret = handler(this.decode(val, cache, asMapKey, true), this);
return ret;
} else {
return types.taggedValue(tag.str, this.decode(val, cache, asMapKey, false));
}
}
}
if (cache && cacheIdx != cache.idx) {
cache.idx = cacheIdx;
}
if (this.arrayBuilder) {
if (node.length <= 32 && this.arrayBuilder.fromArray) {
var arr = [];
i = 0;
for (; i < node.length; i++) {
arr.push(this.decode(node[i], cache, asMapKey, false));
}
return this.arrayBuilder.fromArray(arr, node);
} else {
ret = this.arrayBuilder.init(node);
i = 0;
for (; i < node.length; i++) {
ret = this.arrayBuilder.add(ret, this.decode(node[i], cache, asMapKey, false), node);
}
return this.arrayBuilder.finalize(ret, node);
}
} else {
ret = [];
i = 0;
for (; i < node.length; i++) {
ret.push(this.decode(node[i], cache, asMapKey, false));
}
return ret;
}
}
};
decoder.Decoder.prototype.parseString = function(string, cache, asMapKey) {
if (string.charAt(0) === d.ESC) {
var c = string.charAt(1);
if (c === d.ESC || c === d.SUB || c === d.RES) {
return string.substring(1);
} else if (c === d.TAG) {
return decoder.tag(string.substring(2));
} else {
var handler = this.handlers[c];
if (handler == null) {
return this.defaultHandler(c, string.substring(2));
} else {
return handler(string.substring(2), this);
}
}
} else {
return string;
}
};
decoder.decoder = function(options) {
return new decoder.Decoder(options);
};
});
//# sourceMappingURL=com.cognitect.transit.impl.decoder.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
goog.provide("com.cognitect.transit.impl.reader");
goog.require("com.cognitect.transit.impl.decoder");
goog.require("com.cognitect.transit.caching");
goog.scope(function() {
var reader = com.cognitect.transit.impl.reader;
var decoder = com.cognitect.transit.impl.decoder;
var caching = com.cognitect.transit.caching;
reader.JSONUnmarshaller = function Transit$JSONUnmarshaller(opts) {
this.decoder = new decoder.Decoder(opts);
};
reader.JSONUnmarshaller.prototype.unmarshal = function(str, cache) {
return this.decoder.decode(JSON.parse(str), cache);
};
reader.Reader = function Transit$Reader(unmarshaller, options) {
this.unmarshaller = unmarshaller;
this.options = options || {};
this.cache = this.options["cache"] ? this.options["cache"] : new caching.ReadCache();
};
reader.Reader.prototype.read = function(str) {
var ret = this.unmarshaller.unmarshal(str, this.cache);
this.cache.clear();
return ret;
};
reader.Reader.prototype["read"] = reader.Reader.prototype.read;
});
//# sourceMappingURL=com.cognitect.transit.impl.reader.js.map

View File

@@ -0,0 +1,9 @@
{
"version":3,
"file":"com.cognitect.transit.impl.reader.js",
"lineCount":26,
"mappings":"AAcAA,IAAKC,CAAAA,OAAL,CAAa,mCAAb,CAAA;AACAD,IAAKE,CAAAA,OAAL,CAAa,oCAAb,CAAA;AACAF,IAAKE,CAAAA,OAAL,CAAa,+BAAb,CAAA;AAEAF,IAAKG,CAAAA,KAAL,CAAW,QAAS,EAAG;AAAA,MAEfC,SAAUC,GAAIC,CAAAA,SAAUC,CAAAA,OAAQC,CAAAA,IAAKJ,CAAAA,MAFtB;AAAA,MAGfK,UAAUJ,GAAIC,CAAAA,SAAUC,CAAAA,OAAQC,CAAAA,IAAKC,CAAAA,OAHtB;AAEnB,MAEIC,UAAUL,GAAIC,CAAAA,SAAUC,CAAAA,OAAQG,CAAAA,OAFpC;AAQAN,QAAOO,CAAAA,gBAAP,GAA0BC,QAASC,yBAAwB,CAACC,IAAD,CAAO;AAC9D,QAAKL,CAAAA,OAAL,GAAe,IAAIA,OAAQM,CAAAA,OAAZ,CAAoBD,IAApB,CAAf;AAD8D,GAAlE;AASAV,QAAOO,CAAAA,gBAAiBK,CAAAA,SAAUC,CAAAA,SAAlC,GAA8CC,QAAS,CAACC,GAAD,EAAMC,KAAN,CAAa;AAChE,WAAO,IAAKX,CAAAA,OAAQY,CAAAA,MAAb,CAAoBC,IAAKC,CAAAA,KAAL,CAAWJ,GAAX,CAApB,EAAqCC,KAArC,CAAP;AADgE,GAApE;AAUAhB,QAAOoB,CAAAA,MAAP,GAAgBC,QAASC,eAAc,CAACC,YAAD,EAAeC,OAAf,CAAwB;AAC3D,QAAKD,CAAAA,YAAL,GAAoBA,YAApB;AACA,QAAKC,CAAAA,OAAL,GAAeA,OAAf,IAA0B,EAA1B;AACA,QAAKR,CAAAA,KAAL,GAAa,IAAKQ,CAAAA,OAAL,CAAa,OAAb,CAAA,GAAwB,IAAKA,CAAAA,OAAL,CAAa,OAAb,CAAxB,GAAgD,IAAIlB,OAAQmB,CAAAA,SAAZ,EAA7D;AAH2D,GAA/D;AAUAzB,QAAOoB,CAAAA,MAAOR,CAAAA,SAAUc,CAAAA,IAAxB,GAA+BC,QAAS,CAACZ,GAAD,CAAM;AAC1C,QAAIa,MAAM,IAAKL,CAAAA,YAAaV,CAAAA,SAAlB,CAA4BE,GAA5B,EAAiC,IAAKC,CAAAA,KAAtC,CAAV;AACA,QAAKA,CAAAA,KAAMa,CAAAA,KAAX,EAAA;AACA,WAAOD,GAAP;AAH0C,GAA9C;AAKA5B,QAAOoB,CAAAA,MAAOR,CAAAA,SAAd,CAAwB,MAAxB,CAAA,GAAkCZ,MAAOoB,CAAAA,MAAOR,CAAAA,SAAUc,CAAAA,IAA1D;AA5CmB,CAAvB,CAAA;;",
"sources":["com/cognitect/transit/impl/reader.js"],
"sourcesContent":["// Copyright 2014 Cognitect. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ngoog.provide(\"com.cognitect.transit.impl.reader\");\ngoog.require(\"com.cognitect.transit.impl.decoder\");\ngoog.require(\"com.cognitect.transit.caching\");\n\ngoog.scope(function () {\n\n var reader = com.cognitect.transit.impl.reader,\n decoder = com.cognitect.transit.impl.decoder,\n caching = com.cognitect.transit.caching;\n\n /**\n * A JSON unmarshaller\n * @constructor\n */\n reader.JSONUnmarshaller = function Transit$JSONUnmarshaller(opts) {\n this.decoder = new decoder.Decoder(opts);\n };\n\n /**\n * @param {string} str a JSON string\n * @param {caching.ReadCache} cache a read cache\n * @returns {*}\n */\n reader.JSONUnmarshaller.prototype.unmarshal = function (str, cache) {\n return this.decoder.decode(JSON.parse(str), cache);\n };\n\n /**\n * A transit reader\n * @constructor\n * @param {reader.JSONUnmarshaller} unmarshaller\n * @param {Object=} options\n */\n reader.Reader = function Transit$Reader(unmarshaller, options) {\n this.unmarshaller = unmarshaller;\n this.options = options || {};\n this.cache = this.options[\"cache\"] ? this.options[\"cache\"] : new caching.ReadCache();\n };\n\n /**\n * @param {string} str a string to be read\n * @returns {*}\n */\n reader.Reader.prototype.read = function (str) {\n var ret = this.unmarshaller.unmarshal(str, this.cache)\n this.cache.clear();\n return ret;\n };\n reader.Reader.prototype[\"read\"] = reader.Reader.prototype.read;\n\n});\n"],
"names":["goog","provide","require","scope","reader","com","cognitect","transit","impl","decoder","caching","JSONUnmarshaller","reader.JSONUnmarshaller","Transit$JSONUnmarshaller","opts","Decoder","prototype","unmarshal","reader.JSONUnmarshaller.prototype.unmarshal","str","cache","decode","JSON","parse","Reader","reader.Reader","Transit$Reader","unmarshaller","options","ReadCache","read","reader.Reader.prototype.read","ret","clear"]
}

View File

@@ -0,0 +1,440 @@
goog.provide("com.cognitect.transit.impl.writer");
goog.require("com.cognitect.transit.util");
goog.require("com.cognitect.transit.caching");
goog.require("com.cognitect.transit.handlers");
goog.require("com.cognitect.transit.types");
goog.require("com.cognitect.transit.delimiters");
goog.require("goog.math.Long");
goog.scope(function() {
var writer = com.cognitect.transit.impl.writer;
var util = com.cognitect.transit.util;
var caching = com.cognitect.transit.caching;
var handlers = com.cognitect.transit.handlers;
var types = com.cognitect.transit.types;
var d = com.cognitect.transit.delimiters;
var Long = goog.math.Long;
writer.escape = function(string) {
if (string.length > 0) {
var c = string.charAt(0);
if (c === d.ESC || c === d.SUB || c === d.RES) {
return d.ESC + string;
} else {
return string;
}
} else {
return string;
}
};
writer.JSONMarshaller = function Transit$JSONMarshaller(opts) {
this.opts = opts || {};
this.preferStrings = this.opts["preferStrings"] != null ? this.opts["preferStrings"] : true;
this.objectBuilder = this.opts["objectBuilder"] || null;
this.transform = this.opts["transform"] || null;
this.handlers = new handlers.Handlers();
var optsHandlers = this.opts["handlers"];
if (optsHandlers) {
if (util.isArray(optsHandlers) || !optsHandlers.forEach) {
throw new Error('transit writer "handlers" option must be a map');
}
var self = this;
optsHandlers.forEach(function(v, k) {
if (k !== undefined) {
self.handlers.set(k, v);
} else {
throw new Error("Cannot create handler for JavaScript undefined");
}
});
}
this.handlerForForeign = this.opts["handlerForForeign"];
this.unpack = this.opts["unpack"] || function(x) {
if (types.isArrayMap(x) && x.backingMap === null) {
return x._entries;
} else {
return false;
}
};
this.verbose = this.opts && this.opts["verbose"] || false;
};
writer.JSONMarshaller.prototype.handler = function(obj) {
var h = this.handlers.get(handlers.constructor(obj));
if (h != null) {
return h;
} else {
var tag = obj && obj["transitTag"];
if (tag) {
return this.handlers.get(tag);
} else {
return null;
}
}
};
writer.JSONMarshaller.prototype.registerHandler = function(ctor, handler) {
this.handlers.set(ctor, handler);
};
writer.JSONMarshaller.prototype.emitNil = function(asMapKey, cache) {
if (asMapKey) {
return this.emitString(d.ESC, "_", "", asMapKey, cache);
} else {
return null;
}
};
writer.JSONMarshaller.prototype.emitString = function(prefix, tag, s, asMapKey, cache) {
var string = prefix + tag + s;
if (cache) {
return cache.write(string, asMapKey);
} else {
return string;
}
};
writer.JSONMarshaller.prototype.emitBoolean = function(b, asMapKey, cache) {
if (asMapKey) {
var s = b.toString();
return this.emitString(d.ESC, "?", s[0], asMapKey, cache);
} else {
return b;
}
};
writer.JSONMarshaller.prototype.emitInteger = function(i, asMapKey, cache) {
if (i === Infinity) {
return this.emitString(d.ESC, "z", "INF", asMapKey, cache);
} else if (i === -Infinity) {
return this.emitString(d.ESC, "z", "-INF", asMapKey, cache);
} else if (isNaN(i)) {
return this.emitString(d.ESC, "z", "NaN", asMapKey, cache);
} else if (asMapKey || typeof i === "string" || i instanceof Long) {
return this.emitString(d.ESC, "i", i.toString(), asMapKey, cache);
} else {
return i;
}
};
writer.JSONMarshaller.prototype.emitDouble = function(d, asMapKey, cache) {
if (asMapKey) {
return this.emitString(d.ESC, "d", d, asMapKey, cache);
} else {
return d;
}
};
writer.JSONMarshaller.prototype.emitBinary = function(b, asMapKey, cache) {
return this.emitString(d.ESC, "b", b, asMapKey, cache);
};
writer.JSONMarshaller.prototype.emitQuoted = function(em, obj, cache) {
if (em.verbose) {
var ret = {};
var k = this.emitString(d.ESC_TAG, "'", "", true, cache);
ret[k] = writer.marshal(this, obj, false, cache);
return ret;
} else {
return [this.emitString(d.ESC_TAG, "'", "", true, cache), writer.marshal(this, obj, false, cache)];
}
};
writer.emitObjects = function(em, iterable, cache) {
var ret = [];
if (util.isArray(iterable)) {
var i = 0;
for (; i < iterable.length; i++) {
ret.push(writer.marshal(em, iterable[i], false, cache));
}
} else {
iterable.forEach(function(v, i) {
ret.push(writer.marshal(em, v, false, cache));
});
}
return ret;
};
writer.emitArray = function(em, iterable, skip, cache) {
return writer.emitObjects(em, iterable, cache);
};
writer.isStringableKey = function(em, k) {
if (typeof k !== "string") {
var h = em.handler(k);
return h && h.tag(k).length === 1;
} else {
return true;
}
};
writer.stringableKeys = function(em, obj) {
var arr = em.unpack(obj);
var stringableKeys = true;
if (arr) {
var i = 0;
for (; i < arr.length; i = i + 2) {
stringableKeys = writer.isStringableKey(em, arr[i]);
if (!stringableKeys) {
break;
}
}
return stringableKeys;
} else if (obj.keys) {
var iter = obj.keys();
var step = null;
if (iter.next) {
step = iter.next();
for (; !step.done;) {
stringableKeys = writer.isStringableKey(em, step.value);
if (!stringableKeys) {
break;
}
step = iter.next();
}
return stringableKeys;
}
}
if (obj.forEach) {
obj.forEach(function(v, k) {
stringableKeys = stringableKeys && writer.isStringableKey(em, k);
});
return stringableKeys;
} else {
throw new Error("Cannot walk keys of object type " + handlers.constructor(obj).name);
}
};
writer.isForeignObject = function(x) {
if (x.constructor["transit$isObject"]) {
return true;
}
var ret = x.constructor.toString();
ret = ret.substr("function ".length);
ret = ret.substr(0, ret.indexOf("("));
var isObject = ret == "Object";
if (typeof Object.defineProperty != "undefined") {
Object.defineProperty(x.constructor, "transit$isObject", {value:isObject, enumerable:false});
} else {
x.constructor["transit$isObject"] = isObject;
}
return isObject;
};
writer.emitMap = function(em, obj, skip, cache) {
var arr = null;
var rep = null;
var tag = null;
var ks = null;
var i = 0;
if (obj.constructor === Object || obj.forEach != null || em.handlerForForeign && writer.isForeignObject(obj)) {
if (em.verbose) {
if (obj.forEach != null) {
if (writer.stringableKeys(em, obj)) {
var ret = {};
obj.forEach(function(v, k) {
ret[writer.marshal(em, k, true, false)] = writer.marshal(em, v, false, cache);
});
return ret;
} else {
arr = em.unpack(obj);
rep = [];
tag = em.emitString(d.ESC_TAG, "cmap", "", true, cache);
if (arr) {
for (; i < arr.length; i = i + 2) {
rep.push(writer.marshal(em, arr[i], false, false));
rep.push(writer.marshal(em, arr[i + 1], false, cache));
}
} else {
obj.forEach(function(v, k) {
rep.push(writer.marshal(em, k, false, false));
rep.push(writer.marshal(em, v, false, cache));
});
}
ret = {};
ret[tag] = rep;
return ret;
}
} else {
ks = util.objectKeys(obj);
ret = {};
for (; i < ks.length; i++) {
ret[writer.marshal(em, ks[i], true, false)] = writer.marshal(em, obj[ks[i]], false, cache);
}
return ret;
}
} else {
if (obj.forEach != null) {
if (writer.stringableKeys(em, obj)) {
arr = em.unpack(obj);
ret = ["^ "];
if (arr) {
for (; i < arr.length; i = i + 2) {
ret.push(writer.marshal(em, arr[i], true, cache));
ret.push(writer.marshal(em, arr[i + 1], false, cache));
}
} else {
obj.forEach(function(v, k) {
ret.push(writer.marshal(em, k, true, cache));
ret.push(writer.marshal(em, v, false, cache));
});
}
return ret;
} else {
arr = em.unpack(obj);
rep = [];
tag = em.emitString(d.ESC_TAG, "cmap", "", true, cache);
if (arr) {
for (; i < arr.length; i = i + 2) {
rep.push(writer.marshal(em, arr[i], false, cache));
rep.push(writer.marshal(em, arr[i + 1], false, cache));
}
} else {
obj.forEach(function(v, k) {
rep.push(writer.marshal(em, k, false, cache));
rep.push(writer.marshal(em, v, false, cache));
});
}
return [tag, rep];
}
} else {
ret = ["^ "];
ks = util.objectKeys(obj);
for (; i < ks.length; i++) {
ret.push(writer.marshal(em, ks[i], true, cache));
ret.push(writer.marshal(em, obj[ks[i]], false, cache));
}
return ret;
}
}
} else if (em.objectBuilder != null) {
return em.objectBuilder(obj, function(k) {
return writer.marshal(em, k, true, cache);
}, function(v) {
return writer.marshal(em, v, false, cache);
});
} else {
var name = handlers.constructor(obj).name;
var err = new Error("Cannot write " + name);
err.data = {obj:obj, type:name};
throw err;
}
};
writer.emitTaggedMap = function(em, tag, rep, skip, cache) {
if (em.verbose) {
var ret = {};
ret[em.emitString(d.ESC_TAG, tag, "", true, cache)] = writer.marshal(em, rep, false, cache);
return ret;
} else {
return [em.emitString(d.ESC_TAG, tag, "", true, cache), writer.marshal(em, rep, false, cache)];
}
};
writer.emitEncoded = function(em, h, tag, rep, obj, asMapKey, cache) {
if (tag.length === 1) {
if (typeof rep === "string") {
return em.emitString(d.ESC, tag, rep, asMapKey, cache);
} else if (asMapKey || em.preferStrings) {
var vh = em.verbose && h.getVerboseHandler();
if (vh) {
tag = vh.tag(obj);
rep = vh.stringRep(obj, vh);
} else {
rep = h.stringRep(obj, h);
}
if (rep !== null) {
return em.emitString(d.ESC, tag, rep, asMapKey, cache);
} else {
var err = new Error('Tag "' + tag + '" cannot be encoded as string');
err.data = {tag:tag, rep:rep, obj:obj};
throw err;
}
} else {
return writer.emitTaggedMap(em, tag, rep, asMapKey, cache);
}
} else {
return writer.emitTaggedMap(em, tag, rep, asMapKey, cache);
}
};
writer.marshal = function(em, obj, asMapKey, cache) {
if (em.transform !== null) {
obj = em.transform(obj);
}
var h = em.handler(obj) || (em.handlerForForeign ? em.handlerForForeign(obj, em.handlers) : null);
var tag = h ? h.tag(obj) : null;
var rep = h ? h.rep(obj) : null;
if (h != null && tag != null) {
switch(tag) {
case "_":
return em.emitNil(asMapKey, cache);
break;
case "s":
return em.emitString("", "", writer.escape(rep), asMapKey, cache);
break;
case "?":
return em.emitBoolean(rep, asMapKey, cache);
break;
case "i":
return em.emitInteger(rep, asMapKey, cache);
break;
case "d":
return em.emitDouble(rep, asMapKey, cache);
break;
case "b":
return em.emitBinary(rep, asMapKey, cache);
break;
case "'":
return em.emitQuoted(em, rep, cache);
break;
case "array":
return writer.emitArray(em, rep, asMapKey, cache);
break;
case "map":
return writer.emitMap(em, rep, asMapKey, cache);
break;
default:
return writer.emitEncoded(em, h, tag, rep, obj, asMapKey, cache);
break;
}
} else {
var name = handlers.constructor(obj).name;
var err = new Error("Cannot write " + name);
err.data = {obj:obj, type:name};
throw err;
}
};
writer.maybeQuoted = function(em, obj) {
var h = em.handler(obj) || (em.handlerForForeign ? em.handlerForForeign(obj, em.handlers) : null);
if (h != null) {
if (h.tag(obj).length === 1) {
return types.quoted(obj);
} else {
return obj;
}
} else {
var name = handlers.constructor(obj).name;
var err = new Error("Cannot write " + name);
err.data = {obj:obj, type:name};
throw err;
}
};
writer.marshalTop = function(em, obj, asMapKey, cache) {
return JSON.stringify(writer.marshal(em, writer.maybeQuoted(em, obj), asMapKey, cache));
};
writer.Writer = function Transit$Writer(marshaller, options) {
this._marshaller = marshaller;
this.options = options || {};
if (this.options["cache"] === false) {
this.cache = null;
} else {
this.cache = this.options["cache"] ? this.options["cache"] : new caching.WriteCache();
}
};
writer.Writer.prototype.marshaller = function() {
return this._marshaller;
};
writer.Writer.prototype["marshaller"] = writer.Writer.prototype.marshaller;
writer.Writer.prototype.write = function(obj, opts) {
var ret = null;
var ropts = opts || {};
var asMapKey = ropts["asMapKey"] || false;
var cache = this._marshaller.verbose ? false : this.cache;
if (ropts["marshalTop"] === false) {
ret = writer.marshal(this._marshaller, obj, asMapKey, cache);
} else {
ret = writer.marshalTop(this._marshaller, obj, asMapKey, cache);
}
if (this.cache != null) {
this.cache.clear();
}
return ret;
};
writer.Writer.prototype["write"] = writer.Writer.prototype.write;
writer.Writer.prototype.register = function(type, handler) {
this._marshaller.registerHandler(type, handler);
};
writer.Writer.prototype["register"] = writer.Writer.prototype.register;
});
//# sourceMappingURL=com.cognitect.transit.impl.writer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,183 @@
goog.provide("com.cognitect.transit");
goog.require("com.cognitect.transit.util");
goog.require("com.cognitect.transit.impl.reader");
goog.require("com.cognitect.transit.impl.writer");
goog.require("com.cognitect.transit.types");
goog.require("com.cognitect.transit.eq");
goog.require("com.cognitect.transit.impl.decoder");
goog.require("com.cognitect.transit.caching");
var TRANSIT_DEV = true;
var TRANSIT_NODE_TARGET = false;
var TRANSIT_BROWSER_TARGET = false;
var TRANSIT_BROWSER_AMD_TARGET = false;
goog.scope(function() {
var transit = com.cognitect.transit;
var util = com.cognitect.transit.util;
var reader = com.cognitect.transit.impl.reader;
var writer = com.cognitect.transit.impl.writer;
var decoder = com.cognitect.transit.impl.decoder;
var types = com.cognitect.transit.types;
var eq = com.cognitect.transit.eq;
var caching = com.cognitect.transit.caching;
transit.MapLike;
transit.SetLike;
transit.reader = function(type, opts) {
if (type === "json" || type === "json-verbose" || type == null) {
type = "json";
var unmarshaller = new reader.JSONUnmarshaller(opts);
return new reader.Reader(unmarshaller, opts);
} else {
throw new Error("Cannot create reader of type " + type);
}
};
transit.writer = function(type, opts) {
if (type === "json" || type === "json-verbose" || type == null) {
if (type === "json-verbose") {
if (opts == null) {
opts = {};
}
opts["verbose"] = true;
}
var marshaller = new writer.JSONMarshaller(opts);
return new writer.Writer(marshaller, opts);
} else {
var err = new Error('Type must be "json"');
err.data = {type:type};
throw err;
}
};
transit.makeWriteHandler = function(obj) {
var Handler = function() {
};
Handler.prototype.tag = obj["tag"];
Handler.prototype.rep = obj["rep"];
Handler.prototype.stringRep = obj["stringRep"];
Handler.prototype.getVerboseHandler = obj["getVerboseHandler"];
return new Handler();
};
transit.makeBuilder = function(obj) {
var Builder = function() {
};
Builder.prototype.init = obj["init"];
Builder.prototype.add = obj["add"];
Builder.prototype.finalize = obj["finalize"];
Builder.prototype.fromArray = obj["fromArray"];
return new Builder();
};
transit.date = types.date;
transit.integer = types.intValue;
transit.isInteger = types.isInteger;
transit.uuid = types.uuid;
transit.isUUID = types.isUUID;
transit.bigInt = types.bigInteger;
transit.isBigInt = types.isBigInteger;
transit.bigDec = types.bigDecimalValue;
transit.isBigDec = types.isBigDecimal;
transit.keyword = types.keyword;
transit.isKeyword = types.isKeyword;
transit.symbol = types.symbol;
transit.isSymbol = types.isSymbol;
transit.binary = types.binary;
transit.isBinary = types.isBinary;
transit.uri = types.uri;
transit.isURI = types.isURI;
transit.map = types.map;
transit.isMap = types.isMap;
transit.set = types.set;
transit.isSet = types.isSet;
transit.list = types.list;
transit.isList = types.isList;
transit.quoted = types.quoted;
transit.isQuoted = types.isQuoted;
transit.tagged = types.taggedValue;
transit.isTaggedValue = types.isTaggedValue;
transit.link = types.link;
transit.isLink = types.isLink;
transit.hash = eq.hashCode;
transit.hashMapLike = eq.hashMapLike;
transit.hashArrayLike = eq.hashArrayLike;
transit.equals = eq.equals;
transit.extendToEQ = eq.extendToEQ;
transit.mapToObject = function(m) {
var ret = {};
m.forEach(function(v, k) {
if (typeof k !== "string") {
throw Error("Cannot convert map with non-string keys");
} else {
ret[k] = v;
}
});
return ret;
};
transit.objectToMap = function(obj) {
var ret = transit.map();
var p;
for (p in obj) {
if (obj.hasOwnProperty(p)) {
ret.set(p, obj[p]);
}
}
return ret;
};
transit.decoder = decoder.decoder;
transit.readCache = caching.readCache;
transit.writeCache = caching.writeCache;
transit.UUIDfromString = types.UUIDfromString;
transit.randomUUID = util.randomUUID;
transit.stringableKeys = writer.stringableKeys;
if (TRANSIT_BROWSER_TARGET) {
goog.exportSymbol("transit.reader", transit.reader);
goog.exportSymbol("transit.writer", transit.writer);
goog.exportSymbol("transit.makeBuilder", transit.makeBuilder);
goog.exportSymbol("transit.makeWriteHandler", transit.makeWriteHandler);
goog.exportSymbol("transit.date", types.date);
goog.exportSymbol("transit.integer", types.intValue);
goog.exportSymbol("transit.isInteger", types.isInteger);
goog.exportSymbol("transit.uuid", types.uuid);
goog.exportSymbol("transit.isUUID", types.isUUID);
goog.exportSymbol("transit.bigInt", types.bigInteger);
goog.exportSymbol("transit.isBigInt", types.isBigInteger);
goog.exportSymbol("transit.bigDec", types.bigDecimalValue);
goog.exportSymbol("transit.isBigDec", types.isBigDecimal);
goog.exportSymbol("transit.keyword", types.keyword);
goog.exportSymbol("transit.isKeyword", types.isKeyword);
goog.exportSymbol("transit.symbol", types.symbol);
goog.exportSymbol("transit.isSymbol", types.isSymbol);
goog.exportSymbol("transit.binary", types.binary);
goog.exportSymbol("transit.isBinary", types.isBinary);
goog.exportSymbol("transit.uri", types.uri);
goog.exportSymbol("transit.isURI", types.isURI);
goog.exportSymbol("transit.map", types.map);
goog.exportSymbol("transit.isMap", types.isMap);
goog.exportSymbol("transit.set", types.set);
goog.exportSymbol("transit.isSet", types.isSet);
goog.exportSymbol("transit.list", types.list);
goog.exportSymbol("transit.isList", types.isList);
goog.exportSymbol("transit.quoted", types.quoted);
goog.exportSymbol("transit.isQuoted", types.isQuoted);
goog.exportSymbol("transit.tagged", types.taggedValue);
goog.exportSymbol("transit.isTaggedValue", types.isTaggedValue);
goog.exportSymbol("transit.link", types.link);
goog.exportSymbol("transit.isLink", types.isLink);
goog.exportSymbol("transit.hash", eq.hashCode);
goog.exportSymbol("transit.hashMapLike", eq.hashMapLike);
goog.exportSymbol("transit.hashArrayLike", eq.hashArrayLike);
goog.exportSymbol("transit.equals", eq.equals);
goog.exportSymbol("transit.extendToEQ", eq.extendToEQ);
goog.exportSymbol("transit.mapToObject", transit.mapToObject);
goog.exportSymbol("transit.objectToMap", transit.objectToMap);
goog.exportSymbol("transit.decoder", decoder.decoder);
goog.exportSymbol("transit.UUIDfromString", types.UUIDfromString);
goog.exportSymbol("transit.randomUUID", util.randomUUID);
goog.exportSymbol("transit.stringableKeys", writer.stringableKeys);
goog.exportSymbol("transit.readCache", caching.readCache);
goog.exportSymbol("transit.writeCache", caching.writeCache);
}
if (TRANSIT_NODE_TARGET) {
module.exports = {reader:transit.reader, writer:transit.writer, makeBuilder:transit.makeBuilder, makeWriteHandler:transit.makeWriteHandler, date:types.date, integer:types.intValue, isInteger:types.isInteger, uuid:types.uuid, isUUID:types.isUUID, bigInt:types.bigInteger, isBigInt:types.isBigInteger, bigDec:types.bigDecimalValue, isBigDec:types.isBigDecimal, keyword:types.keyword, isKeyword:types.isKeyword, symbol:types.symbol, isSymbol:types.isSymbol, binary:types.binary, isBinary:types.isBinary,
uri:types.uri, isURI:types.isURI, map:types.map, isMap:types.isMap, set:types.set, isSet:types.isSet, list:types.list, isList:types.isList, quoted:types.quoted, isQuoted:types.isQuoted, tagged:types.taggedValue, isTaggedValue:types.isTaggedValue, link:types.link, isLink:types.isLink, hash:eq.hashCode, hashArrayLike:eq.hashArrayLike, hashMapLike:eq.hashMapLike, equals:eq.equals, extendToEQ:eq.extendToEQ, mapToObject:transit.mapToObject, objectToMap:transit.objectToMap, decoder:decoder.decoder,
UUIDfromString:types.UUIDfromString, randomUUID:util.randomUUID, stringableKeys:writer.stringableKeys, readCache:caching.readCache, writeCache:caching.writeCache};
}
});
//# sourceMappingURL=com.cognitect.transit.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,102 @@
goog.provide("com.cognitect.transit.util");
goog.require("goog.object");
goog.scope(function() {
var util = com.cognitect.transit.util;
var gobject = goog.object;
if (typeof Object.keys != "undefined") {
util.objectKeys = function(obj) {
return Object.keys(obj);
};
} else {
util.objectKeys = function(obj) {
return gobject.getKeys(obj);
};
}
if (typeof Array.isArray != "undefined") {
util.isArray = function(obj) {
return Array.isArray(obj);
};
} else {
util.isArray = function(obj) {
return goog.typeOf(obj) === "array";
};
}
util.chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d";
util.randInt = function(ub) {
return Math.round(Math.random() * ub);
};
util.randHex = function() {
return util.randInt(15).toString(16);
};
util.randomUUID = function() {
var rhex = (8 | 3 & util.randInt(14)).toString(16);
var ret = util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + "-" + util.randHex() + util.randHex() + util.randHex() + util.randHex() + "-" + "4" + util.randHex() + util.randHex() + util.randHex() + "-" + rhex + util.randHex() + util.randHex() + util.randHex() + "-" + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() + util.randHex() +
util.randHex() + util.randHex() + util.randHex();
return ret;
};
util.btoa = function(input) {
if (typeof btoa != "undefined") {
return btoa(input);
} else {
var str = String(input);
var block;
var charCode;
var idx = 0;
var map = util.chars;
var output = "";
for (; str.charAt(idx | 0) || (map = "\x3d", idx % 1); output = output + map.charAt(63 & block >> 8 - idx % 1 * 8)) {
charCode = str.charCodeAt(idx = idx + 3 / 4);
if (charCode > 255) {
throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
}
block = block << 8 | charCode;
}
return output;
}
};
util.atob = function(input) {
if (typeof atob != "undefined") {
return atob(input);
} else {
var str = String(input).replace(/=+$/, "");
if (str.length % 4 == 1) {
throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");
}
var bc = 0;
var bs;
var buffer;
var idx = 0;
var output = "";
for (; buffer = str.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output = output + String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
buffer = util.chars.indexOf(buffer);
}
return output;
}
};
util.Uint8ToBase64 = function(u8Arr) {
var CHUNK_SIZE = 32768;
var index = 0;
var length = u8Arr.length;
var result = "";
var slice = null;
for (; index < length;) {
slice = u8Arr.subarray(index, Math.min(index + CHUNK_SIZE, length));
result = result + String.fromCharCode.apply(null, slice);
index = index + CHUNK_SIZE;
}
return util.btoa(result);
};
util.Base64ToUint8 = function(base64) {
var binary_string = util.atob(base64);
var len = binary_string.length;
var bytes = new Uint8Array(len);
var i = 0;
for (; i < len; i++) {
var ascii = binary_string.charCodeAt(i);
bytes[i] = ascii;
}
return bytes;
};
});
//# sourceMappingURL=com.cognitect.transit.util.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,47 @@
goog.provide('frontend.il.app');
var module$node_modules$pixi_DOT_js$lib$index=shadow.js.require("module$node_modules$pixi_DOT_js$lib$index", {});
frontend.il.app.websocket = (function (){var G__21556 = (new WebSocket(["ws://",cljs.core.str.cljs$core$IFn$_invoke$arity$1(location.host),"/ws"].join('')));
G__21556.addEventListener("open",(function (){
return cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Websocket opened."], 0));
}));
G__21556.addEventListener("message",(function (p1__21555_SHARP_){
return cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Received message:",p1__21555_SHARP_.data], 0));
}));
G__21556.addEventListener("close",(function (){
return cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2(["Websocket closed."], 0));
}));
return G__21556;
})();
frontend.il.app.ticker = (function frontend$il$app$ticker(game,ticker_object){
var bunny = (game.cljs$core$IFn$_invoke$arity$1 ? game.cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"bunny","bunny",1935768060)) : game.call(null,new cljs.core.Keyword(null,"bunny","bunny",1935768060)));
return (bunny.rotation = (bunny.rotation + 0.01));
});
frontend.il.app.init = (function frontend$il$app$init(){
var app = (new module$node_modules$pixi_DOT_js$lib$index.Application());
var width = window.screen.width;
var height = window.screen.height;
return app.init(({"width": width, "height": height, "backgroundColor": (1087931)})).then((function (_){
goog.dom.appendChild(goog.dom.getElement("app"),app.canvas);
var texture = module$node_modules$pixi_DOT_js$lib$index.Assets.load("https://www.sprite-ai.art/sprite-img/99fa1574-fc52-41a6-ab76-1bd75b5dc4b3/16x16-pixel-art-sprite-cookie-shaped-like-a-32x32-pixel-art-90b4.png");
return texture.then((function (loaded_texture){
var bunny = (new module$node_modules$pixi_DOT_js$lib$index.Sprite(loaded_texture));
(bunny.anchor.x = 0.5);
(bunny.anchor.y = 0.5);
(bunny.x = (width / (2)));
(bunny.y = (height / (2)));
app.stage.addChild(bunny);
return app.ticker.add(cljs.core.partial.cljs$core$IFn$_invoke$arity$2(frontend.il.app.ticker,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"bunny","bunny",1935768060),bunny], null)));
}));
}));
});
//# sourceMappingURL=frontend.il.app.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["frontend/il/app.cljs"],"mappings":";;AAIA,AAAKA,4BAAU,iBAAAC,WAAM,KAAAE,UAAe,CAAA,mEAAA,fAAaC;AAAlC,AAAA,AAAAH,0BAAA,OAAA;AAAA,AAC6B,gHAAA,zGAACI;;;AAD9B,AAAAJ,0BAAA,UAAA,WAAAC;AAAA,AAEgC,gHAAA,zGAACG,6HAA4B,AAAAH;;;AAF7D,AAAAD,0BAAA,QAAA;AAAA,AAG8B,gHAAA,zGAACI;;;AAH/BJ;;AAKf,yBAAA,zBAAMK,0DAAQC,KAAKC;AAAnB,AACE,IAAMC,QAAM,yEAAA,yEAAA,jJAACF,qCAAAA,6FAAAA;AAAb,AACE,QAAM,AAAYE,iBAAO,kBAAA,jBAAG,AAAYA;;AAE5C,uBAAA,vBAAMC;AAAN,AACE,IAAMC,MAAI,KAAAC;IACJC,QAAM,AAASC;IACfC,SAAO,AAAUD;AAFvB,AAGE,OAAA,SAAA,uDAAA,hEAAIH,oBACkBE,iBAAcE,6CAC1B,WAAKC;AAAL,AACE,AAACC,qBAAgB,oBAAA,pBAACC,2BAAsB,AAAUP;;AAClD,IAAMQ,UAAQ,AAAA,sDAAA,tDAAIC;AAAlB,AACE,OAAID,aACM,WAAKE;AAAL,AACE,IAAMZ,QAAM,KAAAa,iDAAcD;AAA1B,AACE,kBAAA,jBAAM,AAAA,AAAIZ;;AACV,kBAAA,jBAAM,AAAA,AAAIA;;AACV,CAAM,AAAIA,UAAU,SAAA,RAAGI;;AACvB,CAAM,AAAIJ,UAAU,UAAA,TAAGM;;AACvB,AAAA,AAAIJ,mBAAqBF;;AACzB,OAAA,AAAIE,eAAiB,uEAAA,2CAAA,lHAACY,gDAAQjB,yHAAeG","names":["frontend.il.app/websocket","G__21556","p1__21555#","js/WebSocket","js/location.host","cljs.core.println","frontend.il.app/ticker","game","ticker-object","bunny","frontend.il.app/init","app","js/module$node_modules$pixi_DOT_js$lib$index.Application","width","js/window.screen","height","_","goog.dom/appendChild","goog.dom/getElement","texture","js/module$node_modules$pixi_DOT_js$lib$index","loaded-texture","js/module$node_modules$pixi_DOT_js$lib$index.Sprite","cljs.core.partial"],"sourcesContent":["(ns frontend.il.app\n (:require [\"pixi.js\" :as pixi]\n [goog.dom :as dom]))\n\n(def websocket (doto (js/WebSocket. (str \"ws://\" js/location.host \"/ws\"))\n (.addEventListener \"open\" #(println \"Websocket opened.\"))\n (.addEventListener \"message\" #(println \"Received message:\" (.-data %)))\n (.addEventListener \"close\" #(println \"Websocket closed.\"))))\n\n(defn ticker [game ticker-object]\n (let [bunny (game :bunny)]\n (set! (.-rotation bunny) (+ (.-rotation bunny) 0.01))))\n\n(defn init []\n (let [app (pixi/Application.)\n width (.-width js/window.screen)\n height (.-height js/window.screen)]\n (.. app\n (init #js {:width width :height height :backgroundColor 0x1099bb})\n (then (fn [_]\n (dom/appendChild (dom/getElement \"app\") (.-canvas app))\n (let [texture (.. pixi -Assets (load \"https://www.sprite-ai.art/sprite-img/99fa1574-fc52-41a6-ab76-1bd75b5dc4b3/16x16-pixel-art-sprite-cookie-shaped-like-a-32x32-pixel-art-90b4.png\"))]\n (.. texture\n (then (fn [loaded-texture]\n (let [bunny (pixi/Sprite. loaded-texture)]\n (set! (.. bunny -anchor -x) 0.5)\n (set! (.. bunny -anchor -y) 0.5)\n (set! (.. bunny -x) (/ width 2))\n (set! (.. bunny -y) (/ height 2))\n (.. app -stage (addChild bunny))\n (.. app -ticker (add (partial ticker {:bunny bunny})))))))))))))\n"]}

View File

@@ -0,0 +1,657 @@
goog.loadModule(function(exports) {
function peek(array) {
return array[array.length - 1];
}
function forEachRight(arr, f, opt_obj) {
const l = arr.length;
const arr2 = typeof arr === "string" ? arr.split("") : arr;
for (let i = l - 1; i >= 0; --i) {
if (i in arr2) {
f.call(opt_obj, arr2[i], i, arr);
}
}
}
function count(arr, f, opt_obj) {
let count = 0;
forEach(arr, function(element, index, arr) {
if (f.call(opt_obj, element, index, arr)) {
++count;
}
}, opt_obj);
return count;
}
function find(arr, f, opt_obj) {
const i = findIndex(arr, f, opt_obj);
return i < 0 ? null : typeof arr === "string" ? arr.charAt(i) : arr[i];
}
function findIndex(arr, f, opt_obj) {
const l = arr.length;
const arr2 = typeof arr === "string" ? arr.split("") : arr;
for (let i = 0; i < l; i++) {
if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
return i;
}
}
return -1;
}
function findRight(arr, f, opt_obj) {
const i = findIndexRight(arr, f, opt_obj);
return i < 0 ? null : typeof arr === "string" ? arr.charAt(i) : arr[i];
}
function findIndexRight(arr, f, opt_obj) {
const l = arr.length;
const arr2 = typeof arr === "string" ? arr.split("") : arr;
for (let i = l - 1; i >= 0; i--) {
if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
return i;
}
}
return -1;
}
function contains(arr, obj) {
return indexOf(arr, obj) >= 0;
}
function isEmpty(arr) {
return arr.length == 0;
}
function clear(arr) {
if (!Array.isArray(arr)) {
for (let i = arr.length - 1; i >= 0; i--) {
delete arr[i];
}
}
arr.length = 0;
}
function insert(arr, obj) {
if (!contains(arr, obj)) {
arr.push(obj);
}
}
function insertAt(arr, obj, opt_i) {
splice(arr, opt_i, 0, obj);
}
function insertArrayAt(arr, elementsToAdd, opt_i) {
goog.partial(splice, arr, opt_i, 0).apply(null, elementsToAdd);
}
function insertBefore(arr, obj, opt_obj2) {
let i;
if (arguments.length == 2 || (i = indexOf(arr, opt_obj2)) < 0) {
arr.push(obj);
} else {
insertAt(arr, obj, i);
}
}
function remove(arr, obj) {
const i = indexOf(arr, obj);
let rv;
if (rv = i >= 0) {
removeAt(arr, i);
}
return rv;
}
function removeLast(arr, obj) {
const i = lastIndexOf(arr, obj);
if (i >= 0) {
removeAt(arr, i);
return true;
}
return false;
}
function removeAt(arr, i) {
asserts.assert(arr.length != null);
return Array.prototype.splice.call(arr, i, 1).length == 1;
}
function removeIf(arr, f, opt_obj) {
const i = findIndex(arr, f, opt_obj);
if (i >= 0) {
removeAt(arr, i);
return true;
}
return false;
}
function removeAllIf(arr, f, opt_obj) {
let removedCount = 0;
forEachRight(arr, function(val, index) {
if (f.call(opt_obj, val, index, arr)) {
if (removeAt(arr, index)) {
removedCount++;
}
}
});
return removedCount;
}
function concat(var_args) {
return Array.prototype.concat.apply([], arguments);
}
function join(var_args) {
return Array.prototype.concat.apply([], arguments);
}
function toArray(object) {
const length = object.length;
if (length > 0) {
const rv = new Array(length);
for (let i = 0; i < length; i++) {
rv[i] = object[i];
}
return rv;
}
return [];
}
function extend(arr1, var_args) {
for (let i = 1; i < arguments.length; i++) {
const arr2 = arguments[i];
if (goog.isArrayLike(arr2)) {
const len1 = arr1.length || 0;
const len2 = arr2.length || 0;
arr1.length = len1 + len2;
for (let j = 0; j < len2; j++) {
arr1[len1 + j] = arr2[j];
}
} else {
arr1.push(arr2);
}
}
}
function splice(arr, index, howMany, var_args) {
asserts.assert(arr.length != null);
return Array.prototype.splice.apply(arr, slice(arguments, 1));
}
function slice(arr, start, opt_end) {
asserts.assert(arr.length != null);
if (arguments.length <= 2) {
return Array.prototype.slice.call(arr, start);
} else {
return Array.prototype.slice.call(arr, start, opt_end);
}
}
function removeDuplicates(arr, opt_rv, opt_hashFn) {
const returnArray = opt_rv || arr;
const defaultHashFn = function(item) {
return goog.isObject(item) ? "o" + goog.getUid(item) : (typeof item).charAt(0) + item;
};
const hashFn = opt_hashFn || defaultHashFn;
let cursorInsert = 0;
let cursorRead = 0;
const seen = {};
for (; cursorRead < arr.length;) {
const current = arr[cursorRead++];
const key = hashFn(current);
if (!Object.prototype.hasOwnProperty.call(seen, key)) {
seen[key] = true;
returnArray[cursorInsert++] = current;
}
}
returnArray.length = cursorInsert;
}
function binarySearch(arr, target, opt_compareFn) {
return binarySearch_(arr, opt_compareFn || defaultCompare, false, target);
}
function binarySelect(arr, evaluator, opt_obj) {
return binarySearch_(arr, evaluator, true, undefined, opt_obj);
}
function binarySearch_(arr, compareFn, isEvaluator, opt_target, opt_selfObj) {
let left = 0;
let right = arr.length;
let found;
for (; left < right;) {
const middle = left + (right - left >>> 1);
let compareResult;
if (isEvaluator) {
compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr);
} else {
compareResult = compareFn(opt_target, arr[middle]);
}
if (compareResult > 0) {
left = middle + 1;
} else {
right = middle;
found = !compareResult;
}
}
return found ? left : -left - 1;
}
function sort(arr, opt_compareFn) {
arr.sort(opt_compareFn || defaultCompare);
}
function stableSort(arr, opt_compareFn) {
function stableCompareFn(obj1, obj2) {
return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index;
}
const compArr = new Array(arr.length);
for (let i = 0; i < arr.length; i++) {
compArr[i] = {index:i, value:arr[i]};
}
const valueCompareFn = opt_compareFn || defaultCompare;
sort(compArr, stableCompareFn);
for (let i = 0; i < arr.length; i++) {
arr[i] = compArr[i].value;
}
}
function sortByKey(arr, keyFn, opt_compareFn) {
const keyCompareFn = opt_compareFn || defaultCompare;
sort(arr, function(a, b) {
return keyCompareFn(keyFn(a), keyFn(b));
});
}
function sortObjectsByKey(arr, key, opt_compareFn) {
sortByKey(arr, function(obj) {
return obj[key];
}, opt_compareFn);
}
function isSorted(arr, opt_compareFn, opt_strict) {
const compare = opt_compareFn || defaultCompare;
for (let i = 1; i < arr.length; i++) {
const compareResult = compare(arr[i - 1], arr[i]);
if (compareResult > 0 || compareResult == 0 && opt_strict) {
return false;
}
}
return true;
}
function equals(arr1, arr2, opt_equalsFn) {
if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) || arr1.length != arr2.length) {
return false;
}
const l = arr1.length;
const equalsFn = opt_equalsFn || defaultCompareEquality;
for (let i = 0; i < l; i++) {
if (!equalsFn(arr1[i], arr2[i])) {
return false;
}
}
return true;
}
function compare3(arr1, arr2, opt_compareFn) {
const compare = opt_compareFn || defaultCompare;
const l = Math.min(arr1.length, arr2.length);
for (let i = 0; i < l; i++) {
const result = compare(arr1[i], arr2[i]);
if (result != 0) {
return result;
}
}
return defaultCompare(arr1.length, arr2.length);
}
function defaultCompare(a, b) {
return a > b ? 1 : a < b ? -1 : 0;
}
function inverseDefaultCompare(a, b) {
return -defaultCompare(a, b);
}
function defaultCompareEquality(a, b) {
return a === b;
}
function binaryInsert(array, value, opt_compareFn) {
const index = binarySearch(array, value, opt_compareFn);
if (index < 0) {
insertAt(array, value, -(index + 1));
return true;
}
return false;
}
function binaryRemove(array, value, opt_compareFn) {
const index = binarySearch(array, value, opt_compareFn);
return index >= 0 ? removeAt(array, index) : false;
}
function bucket(array, sorter, opt_obj) {
const buckets = {};
for (let i = 0; i < array.length; i++) {
const value = array[i];
const key = sorter.call(opt_obj, value, i, array);
if (key !== undefined) {
const bucket = buckets[key] || (buckets[key] = []);
bucket.push(value);
}
}
return buckets;
}
function bucketToMap(array, sorter) {
const buckets = new Map();
for (let i = 0; i < array.length; i++) {
const value = array[i];
const key = sorter(value, i, array);
if (key !== undefined) {
let bucket = buckets.get(key);
if (!bucket) {
bucket = [];
buckets.set(key, bucket);
}
bucket.push(value);
}
}
return buckets;
}
function toObject(arr, keyFunc, opt_obj) {
const ret = {};
forEach(arr, function(element, index) {
ret[keyFunc.call(opt_obj, element, index, arr)] = element;
});
return ret;
}
function toMap(arr, keyFunc) {
const map = new Map();
for (let i = 0; i < arr.length; i++) {
const element = arr[i];
map.set(keyFunc(element, i, arr), element);
}
return map;
}
function range(startOrEnd, opt_end, opt_step) {
const array = [];
let start = 0;
let end = startOrEnd;
const step = opt_step || 1;
if (opt_end !== undefined) {
start = startOrEnd;
end = opt_end;
}
if (step * (end - start) < 0) {
return [];
}
if (step > 0) {
for (let i = start; i < end; i = i + step) {
array.push(i);
}
} else {
for (let i = start; i > end; i = i + step) {
array.push(i);
}
}
return array;
}
function repeat(value, n) {
const array = [];
for (let i = 0; i < n; i++) {
array[i] = value;
}
return array;
}
function flatten(var_args) {
const CHUNK_SIZE = 8192;
const result = [];
for (let i = 0; i < arguments.length; i++) {
const element = arguments[i];
if (Array.isArray(element)) {
for (let c = 0; c < element.length; c = c + CHUNK_SIZE) {
const chunk = slice(element, c, c + CHUNK_SIZE);
const recurseResult = flatten.apply(null, chunk);
for (let r = 0; r < recurseResult.length; r++) {
result.push(recurseResult[r]);
}
}
} else {
result.push(element);
}
}
return result;
}
function rotate(array, n) {
asserts.assert(array.length != null);
if (array.length) {
n = n % array.length;
if (n > 0) {
Array.prototype.unshift.apply(array, array.splice(-n, n));
} else if (n < 0) {
Array.prototype.push.apply(array, array.splice(0, -n));
}
}
return array;
}
function moveItem(arr, fromIndex, toIndex) {
asserts.assert(fromIndex >= 0 && fromIndex < arr.length);
asserts.assert(toIndex >= 0 && toIndex < arr.length);
const removedItems = Array.prototype.splice.call(arr, fromIndex, 1);
Array.prototype.splice.call(arr, toIndex, 0, removedItems[0]);
}
function zip(var_args) {
if (!arguments.length) {
return [];
}
const result = [];
let minLen = arguments[0].length;
for (let i = 1; i < arguments.length; i++) {
if (arguments[i].length < minLen) {
minLen = arguments[i].length;
}
}
for (let i = 0; i < minLen; i++) {
const value = [];
for (let j = 0; j < arguments.length; j++) {
value.push(arguments[j][i]);
}
result.push(value);
}
return result;
}
function shuffle(arr, opt_randFn) {
const randFn = opt_randFn || Math.random;
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(randFn() * (i + 1));
const tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
}
function copyByIndex(arr, index_arr) {
const result = [];
forEach(index_arr, function(index) {
result.push(arr[index]);
});
return result;
}
function concatMap(arr, f, opt_obj) {
return concat.apply([], map(arr, f, opt_obj));
}
"use strict";
goog.module("goog.array");
goog.module.declareLegacyNamespace();
const asserts = goog.require("goog.asserts");
goog.NATIVE_ARRAY_PROTOTYPES = goog.define("goog.NATIVE_ARRAY_PROTOTYPES", goog.TRUSTED_SITE);
const ASSUME_NATIVE_FUNCTIONS = goog.define("goog.array.ASSUME_NATIVE_FUNCTIONS", goog.FEATURESET_YEAR > 2012);
exports.ASSUME_NATIVE_FUNCTIONS = ASSUME_NATIVE_FUNCTIONS;
exports.peek = peek;
exports.last = peek;
const indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.indexOf) ? function(arr, obj, opt_fromIndex) {
asserts.assert(arr.length != null);
return Array.prototype.indexOf.call(arr, obj, opt_fromIndex);
} : function(arr, obj, opt_fromIndex) {
const fromIndex = opt_fromIndex == null ? 0 : opt_fromIndex < 0 ? Math.max(0, arr.length + opt_fromIndex) : opt_fromIndex;
if (typeof arr === "string") {
if (typeof obj !== "string" || obj.length != 1) {
return -1;
}
return arr.indexOf(obj, fromIndex);
}
for (let i = fromIndex; i < arr.length; i++) {
if (i in arr && arr[i] === obj) {
return i;
}
}
return -1;
};
exports.indexOf = indexOf;
const lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.lastIndexOf) ? function(arr, obj, opt_fromIndex) {
asserts.assert(arr.length != null);
const fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
return Array.prototype.lastIndexOf.call(arr, obj, fromIndex);
} : function(arr, obj, opt_fromIndex) {
let fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
if (fromIndex < 0) {
fromIndex = Math.max(0, arr.length + fromIndex);
}
if (typeof arr === "string") {
if (typeof obj !== "string" || obj.length != 1) {
return -1;
}
return arr.lastIndexOf(obj, fromIndex);
}
for (let i = fromIndex; i >= 0; i--) {
if (i in arr && arr[i] === obj) {
return i;
}
}
return -1;
};
exports.lastIndexOf = lastIndexOf;
const forEach = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.forEach) ? function(arr, f, opt_obj) {
asserts.assert(arr.length != null);
Array.prototype.forEach.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
const l = arr.length;
const arr2 = typeof arr === "string" ? arr.split("") : arr;
for (let i = 0; i < l; i++) {
if (i in arr2) {
f.call(opt_obj, arr2[i], i, arr);
}
}
};
exports.forEach = forEach;
exports.forEachRight = forEachRight;
const filter = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.filter) ? function(arr, f, opt_obj) {
asserts.assert(arr.length != null);
return Array.prototype.filter.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
const l = arr.length;
const res = [];
let resLength = 0;
const arr2 = typeof arr === "string" ? arr.split("") : arr;
for (let i = 0; i < l; i++) {
if (i in arr2) {
const val = arr2[i];
if (f.call(opt_obj, val, i, arr)) {
res[resLength++] = val;
}
}
}
return res;
};
exports.filter = filter;
const map = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.map) ? function(arr, f, opt_obj) {
asserts.assert(arr.length != null);
return Array.prototype.map.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
const l = arr.length;
const res = new Array(l);
const arr2 = typeof arr === "string" ? arr.split("") : arr;
for (let i = 0; i < l; i++) {
if (i in arr2) {
res[i] = f.call(opt_obj, arr2[i], i, arr);
}
}
return res;
};
exports.map = map;
const reduce = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduce) ? function(arr, f, val, opt_obj) {
asserts.assert(arr.length != null);
if (opt_obj) {
f = goog.bind(f, opt_obj);
}
return Array.prototype.reduce.call(arr, f, val);
} : function(arr, f, val, opt_obj) {
let rval = val;
forEach(arr, function(val, index) {
rval = f.call(opt_obj, rval, val, index, arr);
});
return rval;
};
exports.reduce = reduce;
const reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduceRight) ? function(arr, f, val, opt_obj) {
asserts.assert(arr.length != null);
asserts.assert(f != null);
if (opt_obj) {
f = goog.bind(f, opt_obj);
}
return Array.prototype.reduceRight.call(arr, f, val);
} : function(arr, f, val, opt_obj) {
let rval = val;
forEachRight(arr, function(val, index) {
rval = f.call(opt_obj, rval, val, index, arr);
});
return rval;
};
exports.reduceRight = reduceRight;
const some = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.some) ? function(arr, f, opt_obj) {
asserts.assert(arr.length != null);
return Array.prototype.some.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
const l = arr.length;
const arr2 = typeof arr === "string" ? arr.split("") : arr;
for (let i = 0; i < l; i++) {
if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
return true;
}
}
return false;
};
exports.some = some;
const every = goog.NATIVE_ARRAY_PROTOTYPES && (ASSUME_NATIVE_FUNCTIONS || Array.prototype.every) ? function(arr, f, opt_obj) {
asserts.assert(arr.length != null);
return Array.prototype.every.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
const l = arr.length;
const arr2 = typeof arr === "string" ? arr.split("") : arr;
for (let i = 0; i < l; i++) {
if (i in arr2 && !f.call(opt_obj, arr2[i], i, arr)) {
return false;
}
}
return true;
};
exports.every = every;
exports.count = count;
exports.find = find;
exports.findIndex = findIndex;
exports.findRight = findRight;
exports.findIndexRight = findIndexRight;
exports.contains = contains;
exports.isEmpty = isEmpty;
exports.clear = clear;
exports.insert = insert;
exports.insertAt = insertAt;
exports.insertArrayAt = insertArrayAt;
exports.insertBefore = insertBefore;
exports.remove = remove;
exports.removeLast = removeLast;
exports.removeAt = removeAt;
exports.removeIf = removeIf;
exports.removeAllIf = removeAllIf;
exports.concat = concat;
exports.join = join;
exports.toArray = toArray;
const clone = toArray;
exports.clone = clone;
exports.extend = extend;
exports.splice = splice;
exports.slice = slice;
exports.removeDuplicates = removeDuplicates;
exports.binarySearch = binarySearch;
exports.binarySelect = binarySelect;
exports.sort = sort;
exports.stableSort = stableSort;
exports.sortByKey = sortByKey;
exports.sortObjectsByKey = sortObjectsByKey;
exports.isSorted = isSorted;
exports.equals = equals;
exports.compare3 = compare3;
exports.defaultCompare = defaultCompare;
exports.inverseDefaultCompare = inverseDefaultCompare;
exports.defaultCompareEquality = defaultCompareEquality;
exports.binaryInsert = binaryInsert;
exports.binaryRemove = binaryRemove;
exports.bucket = bucket;
exports.bucketToMap = bucketToMap;
exports.toObject = toObject;
exports.toMap = toMap;
exports.range = range;
exports.repeat = repeat;
exports.flatten = flatten;
exports.rotate = rotate;
exports.moveItem = moveItem;
exports.zip = zip;
exports.shuffle = shuffle;
exports.copyByIndex = copyByIndex;
exports.concatMap = concatMap;
return exports;
});
//# sourceMappingURL=goog.array.array.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,130 @@
goog.loadModule(function(exports) {
function AssertionError(messagePattern, messageArgs) {
DebugError.call(this, subs(messagePattern, messageArgs));
this.messagePattern = messagePattern;
}
function subs(pattern, subs) {
const splitParts = pattern.split("%s");
let returnString = "";
const subLast = splitParts.length - 1;
for (let i = 0; i < subLast; i++) {
const sub = i < subs.length ? subs[i] : "%s";
returnString = returnString + (splitParts[i] + sub);
}
return returnString + splitParts[subLast];
}
function doAssertFailure(defaultMessage, defaultArgs, givenMessage, givenArgs) {
let message = "Assertion failed";
let args;
if (givenMessage) {
message = message + (": " + givenMessage);
args = givenArgs;
} else if (defaultMessage) {
message = message + (": " + defaultMessage);
args = defaultArgs;
}
const e = new AssertionError("" + message, args || []);
errorHandler_(e);
}
function getType(value) {
if (value instanceof Function) {
return value.displayName || value.name || "unknown type name";
} else if (value instanceof Object) {
return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
} else {
return value === null ? "null" : typeof value;
}
}
"use strict";
goog.module("goog.asserts");
goog.module.declareLegacyNamespace();
const DebugError = goog.require("goog.debug.Error");
const NodeType = goog.require("goog.dom.NodeType");
exports.ENABLE_ASSERTS = goog.define("goog.asserts.ENABLE_ASSERTS", goog.DEBUG);
goog.inherits(AssertionError, DebugError);
exports.AssertionError = AssertionError;
AssertionError.prototype.name = "AssertionError";
exports.DEFAULT_ERROR_HANDLER = function(e) {
throw e;
};
let errorHandler_ = exports.DEFAULT_ERROR_HANDLER;
exports.setErrorHandler = function(errorHandler) {
if (exports.ENABLE_ASSERTS) {
errorHandler_ = errorHandler;
}
};
exports.assert = function(condition, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && !condition) {
doAssertFailure("", null, opt_message, Array.prototype.slice.call(arguments, 2));
}
return condition;
};
exports.assertExists = function(value, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && value == null) {
doAssertFailure("Expected to exist: %s.", [value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return value;
};
exports.fail = function(opt_message, var_args) {
if (exports.ENABLE_ASSERTS) {
errorHandler_(new AssertionError("Failure" + (opt_message ? ": " + opt_message : ""), Array.prototype.slice.call(arguments, 1)));
}
};
exports.assertNumber = function(value, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && typeof value !== "number") {
doAssertFailure("Expected number but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return value;
};
exports.assertString = function(value, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && typeof value !== "string") {
doAssertFailure("Expected string but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return value;
};
exports.assertFunction = function(value, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && typeof value !== "function") {
doAssertFailure("Expected function but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return value;
};
exports.assertObject = function(value, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && !goog.isObject(value)) {
doAssertFailure("Expected object but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return value;
};
exports.assertArray = function(value, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && !Array.isArray(value)) {
doAssertFailure("Expected array but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return value;
};
exports.assertBoolean = function(value, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && typeof value !== "boolean") {
doAssertFailure("Expected boolean but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return value;
};
exports.assertElement = function(value, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && (!goog.isObject(value) || value.nodeType != NodeType.ELEMENT)) {
doAssertFailure("Expected Element but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return value;
};
exports.assertInstanceof = function(value, type, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && !(value instanceof type)) {
doAssertFailure("Expected instanceof %s but got %s.", [getType(type), getType(value)], opt_message, Array.prototype.slice.call(arguments, 3));
}
return value;
};
exports.assertFinite = function(value, opt_message, var_args) {
if (exports.ENABLE_ASSERTS && (typeof value != "number" || !isFinite(value))) {
doAssertFailure("Expected %s to be a finite number but it is not.", [value], opt_message, Array.prototype.slice.call(arguments, 2));
}
return value;
};
return exports;
});
//# sourceMappingURL=goog.asserts.asserts.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,86 @@
goog.loadModule(function(exports) {
"use strict";
goog.module("goog.asserts.dom");
goog.module.declareLegacyNamespace();
const TagName = goog.require("goog.dom.TagName");
const asserts = goog.require("goog.asserts");
const element = goog.require("goog.dom.element");
const assertIsElement = value => {
if (asserts.ENABLE_ASSERTS && !element.isElement(value)) {
asserts.fail(`Argument is not an Element; got: ${debugStringForType(value)}`);
}
return value;
};
const assertIsHtmlElement = value => {
if (asserts.ENABLE_ASSERTS && !element.isHtmlElement(value)) {
asserts.fail(`Argument is not an HTML Element; got: ${debugStringForType(value)}`);
}
return value;
};
const assertIsHtmlElementOfType = (value, tagName) => {
if (asserts.ENABLE_ASSERTS && !element.isHtmlElementOfType(value, tagName)) {
asserts.fail(`Argument is not an HTML Element with tag name ` + `${tagName.toString()}; got: ${debugStringForType(value)}`);
}
return value;
};
const assertIsHtmlAnchorElement = value => {
return assertIsHtmlElementOfType(value, TagName.A);
};
const assertIsHtmlButtonElement = value => {
return assertIsHtmlElementOfType(value, TagName.BUTTON);
};
const assertIsHtmlLinkElement = value => {
return assertIsHtmlElementOfType(value, TagName.LINK);
};
const assertIsHtmlImageElement = value => {
return assertIsHtmlElementOfType(value, TagName.IMG);
};
const assertIsHtmlAudioElement = value => {
return assertIsHtmlElementOfType(value, TagName.AUDIO);
};
const assertIsHtmlVideoElement = value => {
return assertIsHtmlElementOfType(value, TagName.VIDEO);
};
const assertIsHtmlInputElement = value => {
return assertIsHtmlElementOfType(value, TagName.INPUT);
};
const assertIsHtmlTextAreaElement = value => {
return assertIsHtmlElementOfType(value, TagName.TEXTAREA);
};
const assertIsHtmlCanvasElement = value => {
return assertIsHtmlElementOfType(value, TagName.CANVAS);
};
const assertIsHtmlEmbedElement = value => {
return assertIsHtmlElementOfType(value, TagName.EMBED);
};
const assertIsHtmlFormElement = value => {
return assertIsHtmlElementOfType(value, TagName.FORM);
};
const assertIsHtmlFrameElement = value => {
return assertIsHtmlElementOfType(value, TagName.FRAME);
};
const assertIsHtmlIFrameElement = value => {
return assertIsHtmlElementOfType(value, TagName.IFRAME);
};
const assertIsHtmlObjectElement = value => {
return assertIsHtmlElementOfType(value, TagName.OBJECT);
};
const assertIsHtmlScriptElement = value => {
return assertIsHtmlElementOfType(value, TagName.SCRIPT);
};
const debugStringForType = value => {
if (goog.isObject(value)) {
try {
return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
} catch (e) {
return "\x3cobject could not be stringified\x3e";
}
} else {
return value === undefined ? "undefined" : value === null ? "null" : typeof value;
}
};
exports = {assertIsElement, assertIsHtmlElement, assertIsHtmlElementOfType, assertIsHtmlAnchorElement, assertIsHtmlButtonElement, assertIsHtmlLinkElement, assertIsHtmlImageElement, assertIsHtmlAudioElement, assertIsHtmlVideoElement, assertIsHtmlInputElement, assertIsHtmlTextAreaElement, assertIsHtmlCanvasElement, assertIsHtmlEmbedElement, assertIsHtmlFormElement, assertIsHtmlFrameElement, assertIsHtmlIFrameElement, assertIsHtmlObjectElement, assertIsHtmlScriptElement};
return exports;
});
//# sourceMappingURL=goog.asserts.dom.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,86 @@
goog.provide("goog.async.nextTick");
goog.require("goog.debug.entryPointRegistry");
goog.require("goog.dom");
goog.require("goog.dom.TagName");
goog.require("goog.functions");
goog.require("goog.labs.userAgent.browser");
goog.require("goog.labs.userAgent.engine");
goog.async.nextTick = function(callback, opt_context, opt_useSetImmediate) {
var cb = callback;
if (opt_context) {
cb = goog.bind(callback, opt_context);
}
cb = goog.async.nextTick.wrapCallback_(cb);
if (typeof goog.global.setImmediate === "function" && (opt_useSetImmediate || goog.async.nextTick.useSetImmediate_())) {
goog.global.setImmediate(cb);
return;
}
if (!goog.async.nextTick.nextTickImpl) {
goog.async.nextTick.nextTickImpl = goog.async.nextTick.getNextTickImpl_();
}
goog.async.nextTick.nextTickImpl(cb);
};
goog.async.nextTick.useSetImmediate_ = function() {
if (!goog.global.Window || !goog.global.Window.prototype) {
return true;
}
if (goog.labs.userAgent.browser.isEdge() || goog.global.Window.prototype.setImmediate != goog.global.setImmediate) {
return true;
}
return false;
};
goog.async.nextTick.nextTickImpl;
goog.async.nextTick.getNextTickImpl_ = function() {
var Channel = goog.global["MessageChannel"];
if (typeof Channel === "undefined" && typeof window !== "undefined" && window.postMessage && window.addEventListener && !goog.labs.userAgent.engine.isPresto()) {
Channel = function() {
var iframe = goog.dom.createElement(goog.dom.TagName.IFRAME);
iframe.style.display = "none";
document.documentElement.appendChild(iframe);
var win = iframe.contentWindow;
var doc = win.document;
doc.open();
doc.close();
var message = "callImmediate" + Math.random();
var origin = win.location.protocol == "file:" ? "*" : win.location.protocol + "//" + win.location.host;
var onmessage = goog.bind(function(e) {
if (origin != "*" && e.origin != origin || e.data != message) {
return;
}
this["port1"].onmessage();
}, this);
win.addEventListener("message", onmessage, false);
this["port1"] = {};
this["port2"] = {postMessage:function() {
win.postMessage(message, origin);
}};
};
}
if (typeof Channel !== "undefined" && !goog.labs.userAgent.browser.isIE()) {
var channel = new Channel();
var head = {};
var tail = head;
channel["port1"].onmessage = function() {
if (head.next !== undefined) {
head = head.next;
var cb = head.cb;
head.cb = null;
cb();
}
};
return function(cb) {
tail.next = {cb:cb};
tail = tail.next;
channel["port2"].postMessage(0);
};
}
return function(cb) {
goog.global.setTimeout(cb, 0);
};
};
goog.async.nextTick.wrapCallback_ = goog.functions.identity;
goog.debug.entryPointRegistry.register(function(transformer) {
goog.async.nextTick.wrapCallback_ = transformer;
});
//# sourceMappingURL=goog.async.nexttick.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,88 @@
goog.loadModule(function(exports) {
function getIterator(iterable) {
return iterable[goog.global.Symbol.iterator]();
}
function forEach(iterator, f) {
let result;
for (; !(result = iterator.next()).done;) {
f(result.value);
}
}
"use strict";
goog.module("goog.collections.iters");
goog.module.declareLegacyNamespace();
exports.getIterator = getIterator;
exports.forEach = forEach;
class MapIterator {
constructor(childIter, mapFn) {
this.childIterator_ = getIterator(childIter);
this.mapFn_ = mapFn;
}
[Symbol.iterator]() {
return this;
}
next() {
const childResult = this.childIterator_.next();
return {value:childResult.done ? undefined : this.mapFn_.call(undefined, childResult.value), done:childResult.done};
}
}
exports.map = function(iterable, f) {
return new MapIterator(iterable, f);
};
class FilterIterator {
constructor(childIter, filterFn) {
this.childIter_ = getIterator(childIter);
this.filterFn_ = filterFn;
}
[Symbol.iterator]() {
return this;
}
next() {
for (; true;) {
const childResult = this.childIter_.next();
if (childResult.done) {
return {done:true, value:undefined};
}
const passesFilter = this.filterFn_.call(undefined, childResult.value);
if (passesFilter) {
return childResult;
}
}
}
}
exports.filter = function(iterable, f) {
return new FilterIterator(iterable, f);
};
class ConcatIterator {
constructor(iterators) {
this.iterators_ = iterators;
this.iterIndex_ = 0;
}
[Symbol.iterator]() {
return this;
}
next() {
for (; this.iterIndex_ < this.iterators_.length;) {
const result = this.iterators_[this.iterIndex_].next();
if (!result.done) {
return result;
}
this.iterIndex_++;
}
return {done:true};
}
}
exports.concat = function(...iterables) {
return new ConcatIterator(iterables.map(getIterator));
};
exports.toArray = function(iterator) {
const arr = [];
forEach(iterator, e => {
return arr.push(e);
});
return arr;
};
return exports;
});
//# sourceMappingURL=goog.collections.iters.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,80 @@
goog.loadModule(function(exports) {
function setAll(map, entries) {
if (!entries) {
return;
}
for (const [k, v] of entries) {
map.set(k, v);
}
}
function hasValue(map, val, valueEqualityFn = defaultEqualityFn) {
for (const v of map.values()) {
if (valueEqualityFn(v, val)) {
return true;
}
}
return false;
}
function equals(map, otherMap, valueEqualityFn = defaultEqualityFn) {
if (map === otherMap) {
return true;
}
if (map.size !== otherMap.size) {
return false;
}
for (const key of map.keys()) {
if (!otherMap.has(key)) {
return false;
}
if (!valueEqualityFn(map.get(key), otherMap.get(key))) {
return false;
}
}
return true;
}
function transpose(map) {
const transposed = new Map();
for (const key of map.keys()) {
const val = map.get(key);
transposed.set(val, key);
}
return transposed;
}
function toObject(map) {
const obj = {};
for (const key of map.keys()) {
obj[key] = map.get(key);
}
return obj;
}
"use strict";
goog.module("goog.collections.maps");
goog.module.declareLegacyNamespace();
class MapLike {
constructor() {
this.size;
}
set(key, val) {
}
get(key) {
}
keys() {
}
values() {
}
has(key) {
}
}
exports.MapLike = MapLike;
exports.setAll = setAll;
exports.hasValue = hasValue;
const defaultEqualityFn = (a, b) => {
return a === b;
};
exports.equals = equals;
exports.transpose = transpose;
exports.toObject = toObject;
return exports;
});
//# sourceMappingURL=goog.collections.maps.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,367 @@
goog.provide("goog.debug");
goog.require("goog.array");
goog.require("goog.debug.errorcontext");
goog.debug.LOGGING_ENABLED = goog.define("goog.debug.LOGGING_ENABLED", goog.DEBUG);
goog.debug.FORCE_SLOPPY_STACKS = goog.define("goog.debug.FORCE_SLOPPY_STACKS", false);
goog.debug.CHECK_FOR_THROWN_EVENT = goog.define("goog.debug.CHECK_FOR_THROWN_EVENT", false);
goog.debug.catchErrors = function(logFunc, opt_cancel, opt_target) {
var target = opt_target || goog.global;
var oldErrorHandler = target.onerror;
var retVal = !!opt_cancel;
target.onerror = function(message, url, line, opt_col, opt_error) {
if (oldErrorHandler) {
oldErrorHandler(message, url, line, opt_col, opt_error);
}
logFunc({message:message, fileName:url, line:line, lineNumber:line, col:opt_col, error:opt_error});
return retVal;
};
};
goog.debug.expose = function(obj, opt_showFn) {
if (typeof obj == "undefined") {
return "undefined";
}
if (obj == null) {
return "NULL";
}
var str = [];
var x;
for (x in obj) {
if (!opt_showFn && typeof obj[x] === "function") {
continue;
}
var s = x + " \x3d ";
try {
s = s + obj[x];
} catch (e) {
s = s + ("*** " + e + " ***");
}
str.push(s);
}
return str.join("\n");
};
goog.debug.deepExpose = function(obj, opt_showFn) {
var str = [];
var uidsToCleanup = [];
var ancestorUids = {};
var helper = function(obj, space) {
var nestspace = space + " ";
var indentMultiline = function(str) {
return str.replace(/\n/g, "\n" + space);
};
try {
if (obj === undefined) {
str.push("undefined");
} else if (obj === null) {
str.push("NULL");
} else if (typeof obj === "string") {
str.push('"' + indentMultiline(obj) + '"');
} else if (typeof obj === "function") {
str.push(indentMultiline(String(obj)));
} else if (goog.isObject(obj)) {
if (!goog.hasUid(obj)) {
uidsToCleanup.push(obj);
}
var uid = goog.getUid(obj);
if (ancestorUids[uid]) {
str.push("*** reference loop detected (id\x3d" + uid + ") ***");
} else {
ancestorUids[uid] = true;
str.push("{");
var x;
for (x in obj) {
if (!opt_showFn && typeof obj[x] === "function") {
continue;
}
str.push("\n");
str.push(nestspace);
str.push(x + " \x3d ");
helper(obj[x], nestspace);
}
str.push("\n" + space + "}");
delete ancestorUids[uid];
}
} else {
str.push(obj);
}
} catch (e) {
str.push("*** " + e + " ***");
}
};
helper(obj, "");
var i = 0;
for (; i < uidsToCleanup.length; i++) {
goog.removeUid(uidsToCleanup[i]);
}
return str.join("");
};
goog.debug.exposeArray = function(arr) {
var str = [];
var i = 0;
for (; i < arr.length; i++) {
if (Array.isArray(arr[i])) {
str.push(goog.debug.exposeArray(arr[i]));
} else {
str.push(arr[i]);
}
}
return "[ " + str.join(", ") + " ]";
};
goog.debug.normalizeErrorObject = function(err) {
var href = goog.getObjectByName("window.location.href");
if (err == null) {
err = 'Unknown Error of type "null/undefined"';
}
if (typeof err === "string") {
return {"message":err, "name":"Unknown error", "lineNumber":"Not available", "fileName":href, "stack":"Not available"};
}
var lineNumber;
var fileName;
var threwError = false;
try {
lineNumber = err.lineNumber || err.line || "Not available";
} catch (e) {
lineNumber = "Not available";
threwError = true;
}
try {
fileName = err.fileName || err.filename || err.sourceURL || goog.global["$googDebugFname"] || href;
} catch (e) {
fileName = "Not available";
threwError = true;
}
var stack = goog.debug.serializeErrorStack_(err);
if (threwError || !err.lineNumber || !err.fileName || !err.stack || !err.message || !err.name) {
var message = err.message;
if (message == null) {
if (err.constructor && err.constructor instanceof Function) {
var ctorName = err.constructor.name ? err.constructor.name : goog.debug.getFunctionName(err.constructor);
message = 'Unknown Error of type "' + ctorName + '"';
if (goog.debug.CHECK_FOR_THROWN_EVENT && ctorName == "Event") {
try {
message = message + ' with Event.type "' + (err.type || "") + '"';
} catch (e) {
}
}
} else {
message = "Unknown Error of unknown type";
}
if (typeof err.toString === "function" && Object.prototype.toString !== err.toString) {
message = message + (": " + err.toString());
}
}
return {"message":message, "name":err.name || "UnknownError", "lineNumber":lineNumber, "fileName":fileName, "stack":stack || "Not available"};
}
err.stack = stack;
return {"message":err.message, "name":err.name, "lineNumber":err.lineNumber, "fileName":err.fileName, "stack":err.stack};
};
goog.debug.serializeErrorStack_ = function(e, seen) {
if (!seen) {
seen = {};
}
seen[goog.debug.serializeErrorAsKey_(e)] = true;
var stack = e["stack"] || "";
var cause = e.cause;
if (cause && !seen[goog.debug.serializeErrorAsKey_(cause)]) {
stack = stack + "\nCaused by: ";
if (!cause.stack || cause.stack.indexOf(cause.toString()) != 0) {
stack = stack + (typeof cause === "string" ? cause : cause.message + "\n");
}
stack = stack + goog.debug.serializeErrorStack_(cause, seen);
}
return stack;
};
goog.debug.serializeErrorAsKey_ = function(e) {
var keyPrefix = "";
if (typeof e.toString === "function") {
keyPrefix = "" + e;
}
return keyPrefix + e["stack"];
};
goog.debug.enhanceError = function(err, opt_message) {
var error;
if (!(err instanceof Error)) {
error = Error(err);
if (Error.captureStackTrace) {
Error.captureStackTrace(error, goog.debug.enhanceError);
}
} else {
error = err;
}
if (!error.stack) {
error.stack = goog.debug.getStacktrace(goog.debug.enhanceError);
}
if (opt_message) {
var x = 0;
for (; error["message" + x];) {
++x;
}
error["message" + x] = String(opt_message);
}
return error;
};
goog.debug.enhanceErrorWithContext = function(err, opt_context) {
var error = goog.debug.enhanceError(err);
if (opt_context) {
var key;
for (key in opt_context) {
goog.debug.errorcontext.addErrorContext(error, key, opt_context[key]);
}
}
return error;
};
goog.debug.getStacktraceSimple = function(opt_depth) {
if (!goog.debug.FORCE_SLOPPY_STACKS) {
var stack = goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple);
if (stack) {
return stack;
}
}
var sb = [];
var fn = arguments.callee.caller;
var depth = 0;
for (; fn && (!opt_depth || depth < opt_depth);) {
sb.push(goog.debug.getFunctionName(fn));
sb.push("()\n");
try {
fn = fn.caller;
} catch (e) {
sb.push("[exception trying to get caller]\n");
break;
}
depth++;
if (depth >= goog.debug.MAX_STACK_DEPTH) {
sb.push("[...long stack...]");
break;
}
}
if (opt_depth && depth >= opt_depth) {
sb.push("[...reached max depth limit...]");
} else {
sb.push("[end]");
}
return sb.join("");
};
goog.debug.MAX_STACK_DEPTH = 50;
goog.debug.getNativeStackTrace_ = function(fn) {
var tempErr = new Error();
if (Error.captureStackTrace) {
Error.captureStackTrace(tempErr, fn);
return String(tempErr.stack);
} else {
try {
throw tempErr;
} catch (e) {
tempErr = e;
}
var stack = tempErr.stack;
if (stack) {
return String(stack);
}
}
return null;
};
goog.debug.getStacktrace = function(fn) {
var stack;
if (!goog.debug.FORCE_SLOPPY_STACKS) {
var contextFn = fn || goog.debug.getStacktrace;
stack = goog.debug.getNativeStackTrace_(contextFn);
}
if (!stack) {
stack = goog.debug.getStacktraceHelper_(fn || arguments.callee.caller, []);
}
return stack;
};
goog.debug.getStacktraceHelper_ = function(fn, visited) {
var sb = [];
if (goog.array.contains(visited, fn)) {
sb.push("[...circular reference...]");
} else if (fn && visited.length < goog.debug.MAX_STACK_DEPTH) {
sb.push(goog.debug.getFunctionName(fn) + "(");
var args = fn.arguments;
var i = 0;
for (; args && i < args.length; i++) {
if (i > 0) {
sb.push(", ");
}
var argDesc;
var arg = args[i];
switch(typeof arg) {
case "object":
argDesc = arg ? "object" : "null";
break;
case "string":
argDesc = arg;
break;
case "number":
argDesc = String(arg);
break;
case "boolean":
argDesc = arg ? "true" : "false";
break;
case "function":
argDesc = goog.debug.getFunctionName(arg);
argDesc = argDesc ? argDesc : "[fn]";
break;
case "undefined":
default:
argDesc = typeof arg;
break;
}
if (argDesc.length > 40) {
argDesc = argDesc.slice(0, 40) + "...";
}
sb.push(argDesc);
}
visited.push(fn);
sb.push(")\n");
try {
sb.push(goog.debug.getStacktraceHelper_(fn.caller, visited));
} catch (e) {
sb.push("[exception trying to get caller]\n");
}
} else if (fn) {
sb.push("[...long stack...]");
} else {
sb.push("[end]");
}
return sb.join("");
};
goog.debug.getFunctionName = function(fn) {
if (goog.debug.fnNameCache_[fn]) {
return goog.debug.fnNameCache_[fn];
}
var functionSource = String(fn);
if (!goog.debug.fnNameCache_[functionSource]) {
var matches = /function\s+([^\(]+)/m.exec(functionSource);
if (matches) {
var method = matches[1];
goog.debug.fnNameCache_[functionSource] = method;
} else {
goog.debug.fnNameCache_[functionSource] = "[Anonymous]";
}
}
return goog.debug.fnNameCache_[functionSource];
};
goog.debug.makeWhitespaceVisible = function(string) {
return string.replace(/ /g, "[_]").replace(/\f/g, "[f]").replace(/\n/g, "[n]\n").replace(/\r/g, "[r]").replace(/\t/g, "[t]");
};
goog.debug.runtimeType = function(value) {
if (value instanceof Function) {
return value.displayName || value.name || "unknown type name";
} else if (value instanceof Object) {
return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
} else {
return value === null ? "null" : typeof value;
}
};
goog.debug.fnNameCache_ = {};
goog.debug.freezeInternal_ = goog.DEBUG && Object.freeze || function(arg) {
return arg;
};
goog.debug.freeze = function(arg) {
return {valueOf:function() {
return goog.debug.freezeInternal_(arg);
}}.valueOf();
};
//# sourceMappingURL=goog.debug.debug.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,42 @@
goog.provide("goog.debug.EntryPointMonitor");
goog.provide("goog.debug.entryPointRegistry");
goog.require("goog.asserts");
goog.debug.entryPointRegistry.EntryPointMonitor = function() {
};
goog.debug.entryPointRegistry.EntryPointMonitor.prototype.wrap;
goog.debug.entryPointRegistry.EntryPointMonitor.prototype.unwrap;
goog.debug.EntryPointMonitor = goog.debug.entryPointRegistry.EntryPointMonitor;
goog.debug.entryPointRegistry.refList_ = [];
goog.debug.entryPointRegistry.monitors_ = [];
goog.debug.entryPointRegistry.monitorsMayExist_ = false;
goog.debug.entryPointRegistry.register = function(callback) {
goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length] = callback;
if (goog.debug.entryPointRegistry.monitorsMayExist_) {
var monitors = goog.debug.entryPointRegistry.monitors_;
var i = 0;
for (; i < monitors.length; i++) {
callback(goog.bind(monitors[i].wrap, monitors[i]));
}
}
};
goog.debug.entryPointRegistry.monitorAll = function(monitor) {
goog.debug.entryPointRegistry.monitorsMayExist_ = true;
var transformer = goog.bind(monitor.wrap, monitor);
var i = 0;
for (; i < goog.debug.entryPointRegistry.refList_.length; i++) {
goog.debug.entryPointRegistry.refList_[i](transformer);
}
goog.debug.entryPointRegistry.monitors_.push(monitor);
};
goog.debug.entryPointRegistry.unmonitorAllIfPossible = function(monitor) {
var monitors = goog.debug.entryPointRegistry.monitors_;
goog.asserts.assert(monitor == monitors[monitors.length - 1], "Only the most recent monitor can be unwrapped.");
var transformer = goog.bind(monitor.unwrap, monitor);
var i = 0;
for (; i < goog.debug.entryPointRegistry.refList_.length; i++) {
goog.debug.entryPointRegistry.refList_[i](transformer);
}
monitors.length--;
};
//# sourceMappingURL=goog.debug.entrypointregistry.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,28 @@
goog.loadModule(function(exports) {
function DebugError(msg = undefined, cause = undefined) {
if (Error.captureStackTrace) {
Error.captureStackTrace(this, DebugError);
} else {
const stack = (new Error()).stack;
if (stack) {
this.stack = stack;
}
}
if (msg) {
this.message = String(msg);
}
if (cause !== undefined) {
this.cause = cause;
}
this.reportErrorToServer = true;
}
"use strict";
goog.module("goog.debug.Error");
goog.module.declareLegacyNamespace();
goog.inherits(DebugError, Error);
DebugError.prototype.name = "CustomError";
exports = DebugError;
return exports;
});
//# sourceMappingURL=goog.debug.error.js.map

View File

@@ -0,0 +1,9 @@
{
"version":3,
"file":"goog.debug.error.js",
"lineCount":27,
"mappings":"AAAA,IAAA,CAAA,UAAA,CAAA,QAAA,CAAA,OAAA,CAAA;AAiCAA,UAASA,WAAU,CAACC,GAAA,GAAMC,SAAP,EAAkBC,KAAA,GAAQD,SAA1B,CAAqC;AAEtD,QAAIE,KAAMC,CAAAA,iBAAV;AACED,WAAMC,CAAAA,iBAAN,CAAwB,IAAxB,EAA8BL,UAA9B,CAAA;AADF,UAEO;AACL,YAAMM,QAAoBA,CAAZ,IAAIF,KAAJ,EAAYE,EAAAA,KAA1B;AACA,UAAIA,KAAJ;AAEE,YAAKA,CAAAA,KAAL,GAAaA,KAAb;AAFF;AAFK;AAQP,QAAIL,GAAJ;AAEE,UAAKM,CAAAA,OAAL,GAAeC,MAAA,CAAOP,GAAP,CAAf;AAFF;AAKA,QAAIE,KAAJ,KAAcD,SAAd;AAEE,UAAKC,CAAAA,KAAL,GAAaA,KAAb;AAFF;AAYA,QAAKM,CAAAA,mBAAL,GAA2B,IAA3B;AA7BsD;AAjCxD,cAAA;AAcAC,MAAKC,CAAAA,MAAL,CAAY,kBAAZ,CAAA;AACAD,MAAKC,CAAAA,MAAOC,CAAAA,sBAAZ,EAAA;AAiDAF,MAAKG,CAAAA,QAAL,CAAcb,UAAd,EAA0BI,KAA1B,CAAA;AAIAJ,YAAWc,CAAAA,SAAUC,CAAAA,IAArB,GAA4B,aAA5B;AAGAC,SAAA,GAAUhB,UAAV;AAvEA,SAAA,OAAA;AAAA,CAAA,CAAA;;",
"sources":["goog/debug/error.js"],
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Provides a base class for custom Error objects such that the\n * stack is correctly maintained.\n *\n * You should never need to throw DebugError(msg) directly, Error(msg) is\n * sufficient.\n */\n\ngoog.module('goog.debug.Error');\ngoog.module.declareLegacyNamespace();\n\n\n\n/**\n * Base class for custom error objects.\n * @param {*=} msg The message associated with the error.\n * @param {{\n * message: (?|undefined),\n * name: (?|undefined),\n * lineNumber: (?|undefined),\n * fileName: (?|undefined),\n * stack: (?|undefined),\n * cause: (?|undefined),\n * }=} cause The original error object to chain with.\n * @constructor\n * @extends {Error}\n */\nfunction DebugError(msg = undefined, cause = undefined) {\n // Attempt to ensure there is a stack trace.\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, DebugError);\n } else {\n const stack = new Error().stack;\n if (stack) {\n /** @override @type {string} */\n this.stack = stack;\n }\n }\n\n if (msg) {\n /** @override @type {string} */\n this.message = String(msg);\n }\n\n if (cause !== undefined) {\n /** @type {?} */\n this.cause = cause;\n }\n\n /**\n * Whether to report this error to the server. Setting this to false will\n * cause the error reporter to not report the error back to the server,\n * which can be useful if the client knows that the error has already been\n * logged on the server.\n * @type {boolean}\n */\n this.reportErrorToServer = true;\n}\ngoog.inherits(DebugError, Error);\n\n\n/** @override @type {string} */\nDebugError.prototype.name = 'CustomError';\n\n\nexports = DebugError;\n"],
"names":["DebugError","msg","undefined","cause","Error","captureStackTrace","stack","message","String","reportErrorToServer","goog","module","declareLegacyNamespace","inherits","prototype","name","exports"]
}

View File

@@ -0,0 +1,13 @@
goog.provide("goog.debug.errorcontext");
goog.debug.errorcontext.addErrorContext = function(err, contextKey, contextValue) {
if (!err[goog.debug.errorcontext.CONTEXT_KEY_]) {
err[goog.debug.errorcontext.CONTEXT_KEY_] = {};
}
err[goog.debug.errorcontext.CONTEXT_KEY_][contextKey] = contextValue;
};
goog.debug.errorcontext.getErrorContext = function(err) {
return err[goog.debug.errorcontext.CONTEXT_KEY_] || {};
};
goog.debug.errorcontext.CONTEXT_KEY_ = "__closure__error__context__984382";
//# sourceMappingURL=goog.debug.errorcontext.js.map

View File

@@ -0,0 +1,9 @@
{
"version":3,
"file":"goog.debug.errorcontext.js",
"lineCount":12,
"mappings":"AAUAA,IAAKC,CAAAA,OAAL,CAAa,yBAAb,CAAA;AASAD,IAAKE,CAAAA,KAAMC,CAAAA,YAAaC,CAAAA,eAAxB,GAA0CC,QAAQ,CAC9CC,GAD8C,EACzCC,UADyC,EAC7BC,YAD6B,CACf;AAEjC,MAAI,CAACF,GAAA,CAAIN,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAA5B,CAAL;AACEH,OAAA,CAAIN,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAA5B,CAAA,GAA4C,EAA5C;AADF;AAGAH,KAAA,CAAIN,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAA5B,CAAA,CAA0CF,UAA1C,CAAA,GAAwDC,YAAxD;AALiC,CADnC;AAcAR,IAAKE,CAAAA,KAAMC,CAAAA,YAAaO,CAAAA,eAAxB,GAA0CC,QAAQ,CAACL,GAAD,CAAM;AAEtD,SAAOA,GAAA,CAAIN,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAA5B,CAAP,IAAoD,EAApD;AAFsD,CAAxD;AASAT,IAAKE,CAAAA,KAAMC,CAAAA,YAAaM,CAAAA,YAAxB,GAAuC,mCAAvC;;",
"sources":["goog/debug/errorcontext.js"],
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Provides methods dealing with context on error objects.\n */\n\ngoog.provide('goog.debug.errorcontext');\n\n\n/**\n * Adds key-value context to the error.\n * @param {!Error} err The error to add context to.\n * @param {string} contextKey Key for the context to be added.\n * @param {string} contextValue Value for the context to be added.\n */\ngoog.debug.errorcontext.addErrorContext = function(\n err, contextKey, contextValue) {\n 'use strict';\n if (!err[goog.debug.errorcontext.CONTEXT_KEY_]) {\n err[goog.debug.errorcontext.CONTEXT_KEY_] = {};\n }\n err[goog.debug.errorcontext.CONTEXT_KEY_][contextKey] = contextValue;\n};\n\n\n/**\n * @param {!Error} err The error to get context from.\n * @return {!Object<string, string>} The context of the provided error.\n */\ngoog.debug.errorcontext.getErrorContext = function(err) {\n 'use strict';\n return err[goog.debug.errorcontext.CONTEXT_KEY_] || {};\n};\n\n\n// TODO(user): convert this to a Symbol once goog.debug.ErrorReporter is\n// able to use ES6.\n/** @private @const {string} */\ngoog.debug.errorcontext.CONTEXT_KEY_ = '__closure__error__context__984382';\n"],
"names":["goog","provide","debug","errorcontext","addErrorContext","goog.debug.errorcontext.addErrorContext","err","contextKey","contextValue","CONTEXT_KEY_","getErrorContext","goog.debug.errorcontext.getErrorContext"]
}

View File

@@ -0,0 +1,38 @@
goog.provide("goog.dom.asserts");
goog.require("goog.asserts");
goog.dom.asserts.assertIsLocation = function(o) {
if (goog.asserts.ENABLE_ASSERTS) {
var win = goog.dom.asserts.getWindow_(o);
if (win) {
if (!o || !(o instanceof win.Location) && o instanceof win.Element) {
goog.asserts.fail("Argument is not a Location (or a non-Element mock); got: %s", goog.dom.asserts.debugStringForType_(o));
}
}
}
return o;
};
goog.dom.asserts.debugStringForType_ = function(value) {
if (goog.isObject(value)) {
try {
return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
} catch (e) {
return "\x3cobject could not be stringified\x3e";
}
} else {
return value === undefined ? "undefined" : value === null ? "null" : typeof value;
}
};
goog.dom.asserts.getWindow_ = function(o) {
try {
var doc = o && o.ownerDocument;
var win = doc && (doc.defaultView || doc.parentWindow);
win = win || goog.global;
if (win.Element && win.Location) {
return win;
}
} catch (ex) {
}
return null;
};
//# sourceMappingURL=goog.dom.asserts.js.map

View File

@@ -0,0 +1,9 @@
{
"version":3,
"file":"goog.dom.asserts.js",
"lineCount":37,
"mappings":"AAMAA,IAAKC,CAAAA,OAAL,CAAa,kBAAb,CAAA;AAEAD,IAAKE,CAAAA,OAAL,CAAa,cAAb,CAAA;AA8CAF,IAAKG,CAAAA,GAAIC,CAAAA,OAAQC,CAAAA,gBAAjB,GAAoCC,QAAQ,CAACC,CAAD,CAAI;AAE9C,MAAIP,IAAKI,CAAAA,OAAQI,CAAAA,cAAjB,CAAiC;AAC/B,QAAIC,MAAMT,IAAKG,CAAAA,GAAIC,CAAAA,OAAQM,CAAAA,UAAjB,CAA4BH,CAA5B,CAAV;AACA,QAAIE,GAAJ;AACE,UAAI,CAACF,CAAL,IAAW,EAAEA,CAAF,YAAeE,GAAIE,CAAAA,QAAnB,CAAX,IAA2CJ,CAA3C,YAAwDE,GAAIG,CAAAA,OAA5D;AACEZ,YAAKI,CAAAA,OAAQS,CAAAA,IAAb,CACI,6DADJ,EAEIb,IAAKG,CAAAA,GAAIC,CAAAA,OAAQU,CAAAA,mBAAjB,CAAqCP,CAArC,CAFJ,CAAA;AADF;AADF;AAF+B;AAUjC,SAAiCA,CAAjC;AAZ8C,CAAhD;AAuBAP,IAAKG,CAAAA,GAAIC,CAAAA,OAAQU,CAAAA,mBAAjB,GAAuCC,QAAQ,CAACC,KAAD,CAAQ;AAErD,MAAIhB,IAAKiB,CAAAA,QAAL,CAAcD,KAAd,CAAJ;AACE,OAAI;AACF,aAAwCA,KAAME,CAAAA,WAAYC,CAAAA,WAA1D,IACIH,KAAME,CAAAA,WAAYE,CAAAA,IADtB,IAC8BC,MAAOC,CAAAA,SAAUC,CAAAA,QAASC,CAAAA,IAA1B,CAA+BR,KAA/B,CAD9B;AADE,KAGF,QAAOS,CAAP,CAAU;AACV,aAAO,yCAAP;AADU;AAJd;AAQE,WAAOT,KAAA,KAAUU,SAAV,GAAsB,WAAtB,GACsBV,KAAA,KAAU,IAAV,GAAiB,MAAjB,GAA0B,MAAOA,MAD9D;AARF;AAFqD,CAAvD;AAsBAhB,IAAKG,CAAAA,GAAIC,CAAAA,OAAQM,CAAAA,UAAjB,GAA8BiB,QAAQ,CAACpB,CAAD,CAAI;AAExC,KAAI;AACF,QAAIqB,MAAMrB,CAANqB,IAAWrB,CAAEsB,CAAAA,aAAjB;AAGA,QAAIpB,MACAmB,GADAnB,KAC+BmB,GAAIE,CAAAA,WAAL,IAAoBF,GAAIG,CAAAA,YADtDtB,CAAJ;AAEAA,OAAA,GAAMA,GAAN,IAAqCT,IAAKgC,CAAAA,MAA1C;AAGA,QAAIvB,GAAIG,CAAAA,OAAR,IAAmBH,GAAIE,CAAAA,QAAvB;AACE,aAAOF,GAAP;AADF;AATE,GAYF,QAAOwB,EAAP,CAAW;;AAEb,SAAO,IAAP;AAhBwC,CAA1C;;",
"sources":["goog/dom/asserts.js"],
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\ngoog.provide('goog.dom.asserts');\n\ngoog.require('goog.asserts');\n\n/**\n * @fileoverview Custom assertions to ensure that an element has the appropriate\n * type.\n *\n * Using a goog.dom.safe wrapper on an object on the incorrect type (via an\n * incorrect static type cast) can result in security bugs: For instance,\n * g.d.s.setAnchorHref ensures that the URL assigned to the .href attribute\n * satisfies the SafeUrl contract, i.e., is safe to dereference as a hyperlink.\n * However, the value assigned to a HTMLLinkElement's .href property requires\n * the stronger TrustedResourceUrl contract, since it can refer to a stylesheet.\n * Thus, using g.d.s.setAnchorHref on an (incorrectly statically typed) object\n * of type HTMLLinkElement can result in a security vulnerability.\n * Assertions of the correct run-time type help prevent such incorrect use.\n *\n * In some cases, code using the DOM API is tested using mock objects (e.g., a\n * plain object such as {'href': url} instead of an actual Location object).\n * To allow such mocking, the assertions permit objects of types that are not\n * relevant DOM API objects at all (for instance, not Element or Location).\n *\n * Note that instanceof checks don't work straightforwardly in older versions of\n * IE, or across frames (see,\n * http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object,\n * http://stackoverflow.com/questions/26248599/instanceof-htmlelement-in-iframe-is-not-element-or-object).\n *\n * Hence, these assertions may pass vacuously in such scenarios. The resulting\n * risk of security bugs is limited by the following factors:\n * - A bug can only arise in scenarios involving incorrect static typing (the\n * wrapper methods are statically typed to demand objects of the appropriate,\n * precise type).\n * - Typically, code is tested and exercised in multiple browsers.\n */\n\n/**\n * Asserts that a given object is a Location.\n *\n * To permit this assertion to pass in the context of tests where DOM APIs might\n * be mocked, also accepts any other type except for subtypes of {!Element}.\n * This is to ensure that, for instance, HTMLLinkElement is not being used in\n * place of a Location, since this could result in security bugs due to stronger\n * contracts required for assignments to the href property of the latter.\n *\n * @param {?Object} o The object whose type to assert.\n * @return {!Location}\n */\ngoog.dom.asserts.assertIsLocation = function(o) {\n 'use strict';\n if (goog.asserts.ENABLE_ASSERTS) {\n var win = goog.dom.asserts.getWindow_(o);\n if (win) {\n if (!o || (!(o instanceof win.Location) && o instanceof win.Element)) {\n goog.asserts.fail(\n 'Argument is not a Location (or a non-Element mock); got: %s',\n goog.dom.asserts.debugStringForType_(o));\n }\n }\n }\n return /** @type {!Location} */ (o);\n};\n\n\n/**\n * Returns a string representation of a value's type.\n *\n * @param {*} value An object, or primitive.\n * @return {string} The best display name for the value.\n * @private\n */\ngoog.dom.asserts.debugStringForType_ = function(value) {\n 'use strict';\n if (goog.isObject(value)) {\n try {\n return /** @type {string|undefined} */ (value.constructor.displayName) ||\n value.constructor.name || Object.prototype.toString.call(value);\n } catch (e) {\n return '<object could not be stringified>';\n }\n } else {\n return value === undefined ? 'undefined' :\n value === null ? 'null' : typeof value;\n }\n};\n\n/**\n * Gets window of element.\n * @param {?Object} o\n * @return {?Window}\n * @private\n * @suppress {strictMissingProperties} ownerDocument not defined on Object\n */\ngoog.dom.asserts.getWindow_ = function(o) {\n 'use strict';\n try {\n var doc = o && o.ownerDocument;\n // This can throw \u201cBlocked a frame with origin \"chrome-extension://...\" from\n // accessing a cross-origin frame\u201d in Chrome extension.\n var win =\n doc && /** @type {?Window} */ (doc.defaultView || doc.parentWindow);\n win = win || /** @type {!Window} */ (goog.global);\n // This can throw \u201cPermission denied to access property \"Element\" on\n // cross-origin object\u201d.\n if (win.Element && win.Location) {\n return win;\n }\n } catch (ex) {\n }\n return null;\n};\n"],
"names":["goog","provide","require","dom","asserts","assertIsLocation","goog.dom.asserts.assertIsLocation","o","ENABLE_ASSERTS","win","getWindow_","Location","Element","fail","debugStringForType_","goog.dom.asserts.debugStringForType_","value","isObject","constructor","displayName","name","Object","prototype","toString","call","e","undefined","goog.dom.asserts.getWindow_","doc","ownerDocument","defaultView","parentWindow","global","ex"]
}

View File

@@ -0,0 +1,19 @@
goog.provide("goog.dom.BrowserFeature");
goog.require("goog.userAgent");
goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS = goog.define("goog.dom.ASSUME_NO_OFFSCREEN_CANVAS", false);
goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS = goog.define("goog.dom.ASSUME_OFFSCREEN_CANVAS", false);
goog.dom.BrowserFeature.detectOffscreenCanvas_ = function(contextName) {
try {
return Boolean((new self.OffscreenCanvas(0, 0)).getContext(contextName));
} catch (ex) {
}
return false;
};
goog.dom.BrowserFeature.OFFSCREEN_CANVAS_2D = !goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS && (goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS || goog.dom.BrowserFeature.detectOffscreenCanvas_("2d"));
goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES = true;
goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE = true;
goog.dom.BrowserFeature.CAN_USE_INNER_TEXT = false;
goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY = goog.userAgent.IE || goog.userAgent.WEBKIT;
goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT = goog.userAgent.IE;
//# sourceMappingURL=goog.dom.browserfeature.js.map

View File

@@ -0,0 +1,9 @@
{
"version":3,
"file":"goog.dom.browserfeature.js",
"lineCount":18,
"mappings":"AAWAA,IAAKC,CAAAA,OAAL,CAAa,yBAAb,CAAA;AAEAD,IAAKE,CAAAA,OAAL,CAAa,gBAAb,CAAA;AAOAF,IAAKG,CAAAA,GAAIC,CAAAA,cAAeC,CAAAA,0BAAxB,GACIL,IAAKM,CAAAA,MAAL,CAAY,qCAAZ,EAAmD,KAAnD,CADJ;AAQAN,IAAKG,CAAAA,GAAIC,CAAAA,cAAeG,CAAAA,uBAAxB,GACIP,IAAKM,CAAAA,MAAL,CAAY,kCAAZ,EAAgD,KAAhD,CADJ;AASAN,IAAKG,CAAAA,GAAIC,CAAAA,cAAeI,CAAAA,sBAAxB,GAAiDC,QAAQ,CAACC,WAAD,CAAc;AAIrE,KAAI;AACF,WAAOC,OAAA,CAAuCC,CAA/B,IAAIC,IAAKC,CAAAA,eAAT,CAAyB,CAAzB,EAA4B,CAA5B,CAA+BF,EAAAA,UAA/B,CAA0CF,WAA1C,CAAR,CAAP;AADE,GAEF,QAAOK,EAAP,CAAW;;AAEb,SAAO,KAAP;AARqE,CAAvE;AAeAf,IAAKG,CAAAA,GAAIC,CAAAA,cAAeY,CAAAA,mBAAxB,GACI,CAAChB,IAAKG,CAAAA,GAAIC,CAAAA,cAAeC,CAAAA,0BAD7B,KAEKL,IAAKG,CAAAA,GAAIC,CAAAA,cAAeG,CAAAA,uBAF7B,IAGKP,IAAKG,CAAAA,GAAIC,CAAAA,cAAeI,CAAAA,sBAAxB,CAA+C,IAA/C,CAHL;AAUAR,IAAKG,CAAAA,GAAIC,CAAAA,cAAea,CAAAA,+BAAxB,GAA0D,IAA1D;AAQAjB,IAAKG,CAAAA,GAAIC,CAAAA,cAAec,CAAAA,0BAAxB,GAAqD,IAArD;AAOAlB,IAAKG,CAAAA,GAAIC,CAAAA,cAAee,CAAAA,kBAAxB,GAA6C,KAA7C;AAOAnB,IAAKG,CAAAA,GAAIC,CAAAA,cAAegB,CAAAA,+BAAxB,GACIpB,IAAKqB,CAAAA,SAAUC,CAAAA,EADnB,IACyBtB,IAAKqB,CAAAA,SAAUE,CAAAA,MADxC;AASAvB,IAAKG,CAAAA,GAAIC,CAAAA,cAAeoB,CAAAA,+BAAxB,GAA0DxB,IAAKqB,CAAAA,SAAUC,CAAAA,EAAzE;;",
"sources":["goog/dom/browserfeature.js"],
"sourcesContent":["/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Browser capability checks for the dom package.\n */\n\n\ngoog.provide('goog.dom.BrowserFeature');\n\ngoog.require('goog.userAgent');\n\n\n/**\n * @define {boolean} Whether we know at compile time that the browser doesn't\n * support OffscreenCanvas.\n */\ngoog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS =\n goog.define('goog.dom.ASSUME_NO_OFFSCREEN_CANVAS', false);\n\n/**\n * @define {boolean} Whether we know at compile time that the browser supports\n * all OffscreenCanvas contexts.\n */\n// TODO(user): Eventually this should default to \"FEATURESET_YEAR >= 202X\".\ngoog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS =\n goog.define('goog.dom.ASSUME_OFFSCREEN_CANVAS', false);\n\n/**\n * Detects if a particular OffscreenCanvas context is supported.\n * @param {string} contextName name of the context to test.\n * @return {boolean} Whether the browser supports this OffscreenCanvas context.\n * @private\n */\ngoog.dom.BrowserFeature.detectOffscreenCanvas_ = function(contextName) {\n 'use strict';\n // This code only gets removed because we forced @nosideeffects on\n // the functions. See: b/138802376\n try {\n return Boolean(new self.OffscreenCanvas(0, 0).getContext(contextName));\n } catch (ex) {\n }\n return false;\n};\n\n/**\n * Whether the browser supports OffscreenCanvas 2D context.\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.OFFSCREEN_CANVAS_2D =\n !goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS &&\n (goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS ||\n goog.dom.BrowserFeature.detectOffscreenCanvas_('2d'));\n\n/**\n * Whether attributes 'name' and 'type' can be added to an element after it's\n * created. False in Internet Explorer prior to version 9.\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES = true;\n\n/**\n * Whether we can use element.children to access an element's Element\n * children. Available since Gecko 1.9.1, IE 9. (IE<9 also includes comment\n * nodes in the collection.)\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE = true;\n\n/**\n * Opera, Safari 3, and Internet Explorer 9 all support innerText but they\n * include text nodes in script and style tags. Not document-mode-dependent.\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.CAN_USE_INNER_TEXT = false;\n\n/**\n * MSIE, Opera, and Safari>=4 support element.parentElement to access an\n * element's parent if it is an Element.\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY =\n goog.userAgent.IE || goog.userAgent.WEBKIT;\n\n/**\n * Whether NoScope elements need a scoped element written before them in\n * innerHTML.\n * MSDN: http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx#1\n * @const {boolean}\n */\ngoog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT = goog.userAgent.IE;\n"],
"names":["goog","provide","require","dom","BrowserFeature","ASSUME_NO_OFFSCREEN_CANVAS","define","ASSUME_OFFSCREEN_CANVAS","detectOffscreenCanvas_","goog.dom.BrowserFeature.detectOffscreenCanvas_","contextName","Boolean","getContext","self","OffscreenCanvas","ex","OFFSCREEN_CANVAS_2D","CAN_ADD_NAME_OR_TYPE_ATTRIBUTES","CAN_USE_CHILDREN_ATTRIBUTE","CAN_USE_INNER_TEXT","CAN_USE_PARENT_ELEMENT_PROPERTY","userAgent","IE","WEBKIT","INNER_HTML_NEEDS_SCOPED_ELEMENT"]
}

View File

@@ -0,0 +1,109 @@
goog.provide("goog.dom.classlist");
goog.require("goog.array");
goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST = goog.define("goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST", false);
goog.dom.classlist.getClassName_ = function(element) {
return typeof element.className == "string" ? element.className : element.getAttribute && element.getAttribute("class") || "";
};
goog.dom.classlist.get = function(element) {
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
return element.classList;
}
return goog.dom.classlist.getClassName_(element).match(/\S+/g) || [];
};
goog.dom.classlist.set = function(element, className) {
if (typeof element.className == "string") {
element.className = className;
return;
} else if (element.setAttribute) {
element.setAttribute("class", className);
}
};
goog.dom.classlist.contains = function(element, className) {
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
return element.classList.contains(className);
}
return goog.array.contains(goog.dom.classlist.get(element), className);
};
goog.dom.classlist.add = function(element, className) {
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
element.classList.add(className);
return;
}
if (!goog.dom.classlist.contains(element, className)) {
var oldClassName = goog.dom.classlist.getClassName_(element);
goog.dom.classlist.set(element, oldClassName + (oldClassName.length > 0 ? " " + className : className));
}
};
goog.dom.classlist.addAll = function(element, classesToAdd) {
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
Array.prototype.forEach.call(classesToAdd, function(className) {
goog.dom.classlist.add(element, className);
});
return;
}
var classMap = {};
Array.prototype.forEach.call(goog.dom.classlist.get(element), function(className) {
classMap[className] = true;
});
Array.prototype.forEach.call(classesToAdd, function(className) {
classMap[className] = true;
});
var newClassName = "";
var className;
for (className in classMap) {
newClassName = newClassName + (newClassName.length > 0 ? " " + className : className);
}
goog.dom.classlist.set(element, newClassName);
};
goog.dom.classlist.remove = function(element, className) {
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
element.classList.remove(className);
return;
}
if (goog.dom.classlist.contains(element, className)) {
goog.dom.classlist.set(element, Array.prototype.filter.call(goog.dom.classlist.get(element), function(c) {
return c != className;
}).join(" "));
}
};
goog.dom.classlist.removeAll = function(element, classesToRemove) {
if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
Array.prototype.forEach.call(classesToRemove, function(className) {
goog.dom.classlist.remove(element, className);
});
return;
}
goog.dom.classlist.set(element, Array.prototype.filter.call(goog.dom.classlist.get(element), function(className) {
return !goog.array.contains(classesToRemove, className);
}).join(" "));
};
goog.dom.classlist.enable = function(element, className, enabled) {
if (enabled) {
goog.dom.classlist.add(element, className);
} else {
goog.dom.classlist.remove(element, className);
}
};
goog.dom.classlist.enableAll = function(element, classesToEnable, enabled) {
var f = enabled ? goog.dom.classlist.addAll : goog.dom.classlist.removeAll;
f(element, classesToEnable);
};
goog.dom.classlist.swap = function(element, fromClass, toClass) {
if (goog.dom.classlist.contains(element, fromClass)) {
goog.dom.classlist.remove(element, fromClass);
goog.dom.classlist.add(element, toClass);
return true;
}
return false;
};
goog.dom.classlist.toggle = function(element, className) {
var add = !goog.dom.classlist.contains(element, className);
goog.dom.classlist.enable(element, className, add);
return add;
};
goog.dom.classlist.addRemove = function(element, classToRemove, classToAdd) {
goog.dom.classlist.remove(element, classToRemove);
goog.dom.classlist.add(element, classToAdd);
};
//# sourceMappingURL=goog.dom.classlist.js.map

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More