pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] sijie closed pull request #2385: Fix some spelling typos
Date Fri, 17 Aug 2018 15:49:19 GMT
sijie closed pull request #2385: Fix some spelling typos
URL: https://github.com/apache/incubator-pulsar/pull/2385
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
index 714389fe09..1c369924a3 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
@@ -658,7 +658,7 @@ public void checkNamespaceBundleSplit() {
                             .canSplitBundle(namespaceBundleFactory.getBundle(namespaceName, bundleRange))) {
                         continue;
                     }
-                    log.info("Load-manager splitting budnle {} and unloading {}", bundleName, unloadSplitBundles);
+                    log.info("Load-manager splitting bundle {} and unloading {}", bundleName, unloadSplitBundles);
                     pulsar.getAdminClient().namespaces().splitNamespaceBundle(namespaceName, bundleRange,
                             unloadSplitBundles);
                     // Make sure the same bundle is not selected again.
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java
index 4c54018fb1..883bf5553e 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java
@@ -449,7 +449,7 @@ void flowPermits(int additionalNumberOfMessages) {
         }
 
         if (log.isDebugEnabled()) {
-            log.debug("[{}-{}] Added more flow control message permits {} (old was: {}), blocked = ", topicName,
+            log.debug("[{}-{}] Added more flow control message permits {} (old was: {}), blocked = {} ", topicName,
                     subscription, additionalNumberOfMessages, oldPermits, blockedConsumerOnUnackedMsgs);
         }
 
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/namespace/NamespaceServiceTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/namespace/NamespaceServiceTest.java
index 2c51e16fb6..03995485e1 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/namespace/NamespaceServiceTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/namespace/NamespaceServiceTest.java
@@ -115,7 +115,7 @@ public void testSplitAndOwnBundles() throws Exception {
             result.get();
         } catch (Exception e) {
             // make sure: no failure
-            fail("split bundle faild", e);
+            fail("split bundle failed", e);
         }
         NamespaceBundleFactory bundleFactory = this.pulsar.getNamespaceService().getNamespaceBundleFactory();
         NamespaceBundles updatedNsBundles = bundleFactory.getBundles(nsname);
@@ -194,7 +194,7 @@ public void testSplitMapWithRefreshedStatMap() throws Exception {
             result.get();
         } catch (Exception e) {
             // make sure: no failure
-            fail("split bundle faild", e);
+            fail("split bundle failed", e);
         }
 
         // old bundle should be removed from status-map
@@ -385,7 +385,7 @@ public void testCreateNamespaceWithDefaultNumberOfBundles() throws Exception {
             result.get();
         } catch (Exception e) {
             // make sure: no failure
-            fail("split bundle faild", e);
+            fail("split bundle failed", e);
         }
         NamespaceBundleFactory bundleFactory = this.pulsar.getNamespaceService().getNamespaceBundleFactory();
         NamespaceBundles updatedNsBundles = bundleFactory.getBundles(nsname);
@@ -448,7 +448,7 @@ public void testRemoveOwnershipAndSplitBundle() throws Exception {
         try {
             result1.get();
         } catch (Exception e) {
-            fail("split bundle faild", e);
+            fail("split bundle failed", e);
         }
 
         NamespaceBundles updatedNsBundles = namespaceService.getNamespaceBundleFactory().getBundles(nsname);
@@ -459,7 +459,7 @@ public void testRemoveOwnershipAndSplitBundle() throws Exception {
             try {
                 ownershipCache.removeOwnership(bundle).get();
             } catch (Exception e) {
-                fail("faild to remove ownership", e);
+                fail("failed to remove ownership", e);
             }
         });
 
@@ -468,7 +468,7 @@ public void testRemoveOwnershipAndSplitBundle() throws Exception {
             result2.get();
         } catch (Exception e) {
             // make sure: NPE does not occur
-            fail("split bundle faild", e);
+            fail("split bundle failed", e);
         }
     }
 
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SubscriptionMessageDispatchThrottlingTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SubscriptionMessageDispatchThrottlingTest.java
index 04494d1523..b4b60afb0e 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SubscriptionMessageDispatchThrottlingTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SubscriptionMessageDispatchThrottlingTest.java
@@ -111,7 +111,7 @@ public void testMessageRateLimitingNotReceiveAllMessages(SubscriptionType subscr
             producer.send(new byte[80]);
         }
 
-        // consumer should not have received all publihsed message due to message-rate throttling
+        // consumer should not have received all published message due to message-rate throttling
         Assert.assertTrue(totalReceived.get() < messageRate * 2);
 
         consumer.close();
diff --git a/pulsar-client-cpp/perf/PerfProducer.cc b/pulsar-client-cpp/perf/PerfProducer.cc
index 859d4bd3e1..596afd5ccb 100644
--- a/pulsar-client-cpp/perf/PerfProducer.cc
+++ b/pulsar-client-cpp/perf/PerfProducer.cc
@@ -145,7 +145,7 @@ void runProducer(const Arguments& args, std::string topicName, int threadIndex,
     try {
         while (true) {
             if (args.rate != -1) {
-                limiter->aquire();
+                limiter->acquire();
             }
             pulsar::Message msg = builder.create().setAllocatedContent(payload.get(), args.msgSize).build();
 
diff --git a/pulsar-client-cpp/perf/RateLimiter.h b/pulsar-client-cpp/perf/RateLimiter.h
index 90aeb0f53f..5fa8f81865 100644
--- a/pulsar-client-cpp/perf/RateLimiter.h
+++ b/pulsar-client-cpp/perf/RateLimiter.h
@@ -29,9 +29,9 @@ class RateLimiter {
  public:
     RateLimiter(double rate);
 
-    void aquire();
+    void acquire();
 
-    void aquire(int permits);
+    void acquire(int permits);
 
  private:
     RateLimiter(const RateLimiter&);
@@ -54,11 +54,11 @@ RateLimiter::RateLimiter(double rate)
     assert(rate < 1e6 && "Exceeded maximum rate");
 }
 
-void RateLimiter::aquire() {
-    aquire(1);
+void RateLimiter::acquire() {
+    acquire(1);
 }
 
-void RateLimiter::aquire(int permits) {
+void RateLimiter::acquire(int permits) {
     Clock::time_point now = Clock::now();
 
     Lock lock(mutex_);
diff --git a/pulsar-client-go/pulsar/client.go b/pulsar-client-go/pulsar/client.go
index 8d0b6e6718..777b7cd8cb 100644
--- a/pulsar-client-go/pulsar/client.go
+++ b/pulsar-client-go/pulsar/client.go
@@ -49,7 +49,7 @@ type ClientOptions struct {
 
 	// Set the operation timeout (default: 30 seconds)
 	// Producer-create, subscribe and unsubscribe operations will be retried until this interval, after which the
-	// operation will be maked as failed
+	// operation will be marked as failed
 	OperationTimeoutSeconds time.Duration
 
 	// Set the number of threads to be used for message listeners (default: 1 thread)
diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
index 341b24995f..8a86aacc3c 100644
--- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
+++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
@@ -93,7 +93,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Get the configuration policies of a namspace")
+    @Parameters(commandDescription = "Get the configuration policies of a namespace")
     private class GetPolicies extends CliCommand {
         @Parameter(description = "tenant/namespace\n", required = true)
         private java.util.List<String> params;
@@ -162,7 +162,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Grant permissions on a namspace")
+    @Parameters(commandDescription = "Grant permissions on a namespace")
     private class GrantPermissions extends CliCommand {
         @Parameter(description = "tenant/namespace", required = true)
         private java.util.List<String> params;
@@ -180,7 +180,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Revoke permissions on a namspace")
+    @Parameters(commandDescription = "Revoke permissions on a namespace")
     private class RevokePermissions extends CliCommand {
         @Parameter(description = "tenant/namespace", required = true)
         private java.util.List<String> params;
@@ -195,7 +195,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Get the permissions on a namspace")
+    @Parameters(commandDescription = "Get the permissions on a namespace")
     private class Permissions extends CliCommand {
         @Parameter(description = "tenant/namespace\n", required = true)
         private java.util.List<String> params;
@@ -207,7 +207,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Set replication clusters for a namspace")
+    @Parameters(commandDescription = "Set replication clusters for a namespace")
     private class SetReplicationClusters extends CliCommand {
         @Parameter(description = "tenant/namespace", required = true)
         private java.util.List<String> params;
@@ -224,7 +224,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Get replication clusters for a namspace")
+    @Parameters(commandDescription = "Get replication clusters for a namespace")
     private class GetReplicationClusters extends CliCommand {
         @Parameter(description = "tenant/namespace\n", required = true)
         private java.util.List<String> params;
@@ -236,7 +236,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Set Message TTL for a namspace")
+    @Parameters(commandDescription = "Set Message TTL for a namespace")
     private class SetMessageTTL extends CliCommand {
         @Parameter(description = "tenant/namespace", required = true)
         private java.util.List<String> params;
@@ -251,7 +251,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Set Anti-affinity group name for a namspace")
+    @Parameters(commandDescription = "Set Anti-affinity group name for a namespace")
     private class SetAntiAffinityGroup extends CliCommand {
         @Parameter(description = "tenant/namespace", required = true)
         private java.util.List<String> params;
@@ -266,7 +266,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Get Anti-affinity group name for a namspace")
+    @Parameters(commandDescription = "Get Anti-affinity group name for a namespace")
     private class GetAntiAffinityGroup extends CliCommand {
         @Parameter(description = "tenant/namespace\n", required = true)
         private java.util.List<String> params;
@@ -297,7 +297,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Remove Anti-affinity group name for a namspace")
+    @Parameters(commandDescription = "Remove Anti-affinity group name for a namespace")
     private class DeleteAntiAffinityGroup extends CliCommand {
         @Parameter(description = "tenant/namespace\n", required = true)
         private java.util.List<String> params;
@@ -374,7 +374,7 @@ void run() throws PulsarAdminException {
         }
     }
 
-    @Parameters(commandDescription = "Get message TTL for a namspace")
+    @Parameters(commandDescription = "Get message TTL for a namespace")
     private class GetMessageTTL extends CliCommand {
         @Parameter(description = "tenant/namespace\n", required = true)
         private java.util.List<String> params;
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java b/pulsar-client/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java
index 14f595fa79..8aff26fc87 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java
@@ -173,7 +173,7 @@ ClientBuilder authentication(String authPluginClassName, Map<String, String> aut
      * Set the operation timeout <i>(default: 30 seconds)</i>
      * <p>
      * Producer-create, subscribe and unsubscribe operations will be retried until this interval, after which the
-     * operation will be maked as failed
+     * operation will be marked as failed
      *
      * @param operationTimeout
      *            operation timeout
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/api/ClientConfiguration.java b/pulsar-client/src/main/java/org/apache/pulsar/client/api/ClientConfiguration.java
index 5860cd35e0..a2213b3bd1 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/api/ClientConfiguration.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/api/ClientConfiguration.java
@@ -140,7 +140,7 @@ public long getOperationTimeoutMs() {
      * Set the operation timeout <i>(default: 30 seconds)</i>
      * <p>
      * Producer-create, subscribe and unsubscribe operations will be retried until this interval, after which the
-     * operation will be maked as failed
+     * operation will be marked as failed
      *
      * @param operationTimeout
      *            operation timeout
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
index 887a890984..02443ccf13 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
@@ -710,7 +710,7 @@ SocketAddress serverAddrees() {
      */
     private void checkServerError(ServerError error, String errMsg) {
         if (ServerError.ServiceNotReady.equals(error)) {
-            log.error("{} Close connection becaues received internal-server error {}", ctx.channel(), errMsg);
+            log.error("{} Close connection because received internal-server error {}", ctx.channel(), errMsg);
             ctx.close();
         } else if (ServerError.TooManyRequests.equals(error)) {
             long rejectedRequests = NUMBER_OF_REJECTED_REQUESTS_UPDATER.getAndIncrement(this);
@@ -719,7 +719,7 @@ private void checkServerError(ServerError error, String errMsg) {
                 eventLoopGroup.schedule(() -> NUMBER_OF_REJECTED_REQUESTS_UPDATER.set(ClientCnx.this, 0),
                         rejectedRequestResetTimeSec, TimeUnit.SECONDS);
             } else if (rejectedRequests >= maxNumberOfRejectedRequestPerConnection) {
-                log.error("{} Close connection becaues received {} rejected request in {} seconds ", ctx.channel(),
+                log.error("{} Close connection because received {} rejected request in {} seconds ", ctx.channel(),
                         NUMBER_OF_REJECTED_REQUESTS_UPDATER.get(ClientCnx.this), rejectedRequestResetTimeSec);
                 ctx.close();
             }
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
index 1c69c754a8..3e947249b0 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
@@ -307,7 +307,7 @@ public UnAckedMessageTracker getUnAckedMessageTracker() {
 
         Message<T> message;
         try {
-            // is cnx is null or if the connection breaks the connectionOpened function will send the flow again
+            // if cnx is null or if the connection breaks the connectionOpened function will send the flow again
             waitingOnReceiveForZeroQueueSize = true;
             synchronized (this) {
                 if (isConnected()) {
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
index 12a49c0f0f..c3428e2644 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
@@ -713,7 +713,7 @@ protected synchronized void recoverChecksumError(ClientCnx cnx, long sequenceId)
                     semaphore.release(op.numMessagesInBatch);
                     try {
                         op.callback.sendComplete(
-                                new PulsarClientException.ChecksumException("Checksum failded on corrupt message"));
+                                new PulsarClientException.ChecksumException("Checksum failed on corrupt message"));
                     } catch (Throwable t) {
                         log.warn("[{}] [{}] Got exception while completing the callback for msg {}:", topic,
                                 producerName, sequenceId, t);
diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/util/RateLimiter.java b/pulsar-common/src/main/java/org/apache/pulsar/common/util/RateLimiter.java
index 518453e8bd..177d240abb 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/util/RateLimiter.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/util/RateLimiter.java
@@ -28,7 +28,7 @@
 import com.google.common.base.MoreObjects;
 
 /**
- * 
+ *
  * A Rate Limiter that distributes permits at a configurable rate. Each {@link #acquire()} blocks if necessary until a
  * permit is available, and then takes it. Each {@link #tryAcquire()} tries to acquire permits from available permits,
  * it returns true if it succeed else returns false. Rate limiter release configured permits at every configured rate
@@ -43,14 +43,14 @@
  * <li><b>Per second rate-limiting:</b> Per second rate-limiting not satisfied by Guava-RateLimiter
  * <p>
  * <b>Guava RateLimiter:</b> For X permits: it releases X/1000 permits every msec. therefore, for permits=2/sec => it
- * release 1st permit on first 500msec and 2nd permit on next 500ms. therfore, if 2 request comes with in 500msec
+ * release 1st permit on first 500msec and 2nd permit on next 500ms. therefore, if 2 request comes with in 500msec
  * duration then 2nd request fails to acquire permit though we have configured 2 permits/second.
  * <p>
  * <b>RateLimiter:</b> it releases X permits every second. so, in above usecase: if 2 requests comes at the same time
  * then both will acquire the permit.
  * <li><b>Faster: </b>RateLimiter is light-weight and faster than Guava-RateLimiter</li>
  * </ul>
- * 
+ *
  *
  */
 public class RateLimiter implements AutoCloseable{
@@ -109,7 +109,7 @@ public synchronized boolean isClosed() {
 
     /**
      * Acquires the given number of permits from this {@code RateLimiter}, blocking until the request be granted.
-     * 
+     *
      * This method is equivalent to {@code acquire(1)}.
      *
      * @param permits
@@ -188,8 +188,8 @@ public synchronized boolean tryAcquire(long acquirePermit) {
 
     /**
      * Return available permits for this {@link RateLimiter}
-     * 
-     * @return returns 0 if permis is not available
+     *
+     * @return returns 0 if permits is not available
      */
     public synchronized long getAvailablePermits() {
         return Math.max(0, this.permits - this.acquiredPermits);
@@ -197,7 +197,7 @@ public synchronized long getAvailablePermits() {
 
     /**
      * Resets new rate by configuring new value for permits per configured rate-period
-     * 
+     *
      * @param permits
      */
     public synchronized void setRate(long permits) {
@@ -206,7 +206,7 @@ public synchronized void setRate(long permits) {
 
     /**
      * Resets new rate with new permits and rate-time.
-     * 
+     *
      * @param permits
      * @param rateTime
      * @param timeUnit
@@ -220,10 +220,10 @@ public synchronized void setRate(long permits, long rateTime, TimeUnit timeUnit)
         this.timeUnit = timeUnit;
         this.renewTask = createTask();
     }
-    
+
     /**
      * Returns configured permit rate per pre-configured rate-period.
-     * 
+     *
      * @return rate
      */
     public synchronized long getRate() {
@@ -258,4 +258,4 @@ public String toString() {
                 .add("acquiredPermits", acquiredPermits).toString();
     }
 
-}
\ No newline at end of file
+}
diff --git a/site2/website/static/js/pjax-api.min.js b/site2/website/static/js/pjax-api.min.js
index f17a5ca50d..999616adb9 100644
--- a/site2/website/static/js/pjax-api.min.js
+++ b/site2/website/static/js/pjax-api.min.js
@@ -1,4 +1,4 @@
 /*! pjax-api v3.23.0 https://github.com/falsandtru/pjax-api | (c) 2012, falsandtru | (Apache-2.0 AND MPL-2.0) License */
-require=function(){return function e(t,n,r){function i(o,c){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!c&&u)return u(o,!0);if(s)return s(o,!0);var a=new Error("Cannot find module '"+o+"'");throw a.code="MODULE_NOT_FOUND",a}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){return i(t[o][1][e]||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}}()({1:[function(e,t,n){},{}],2:[function(e,t,n){arguments[4][1][0].apply(n,arguments)},{dup:1}],3:[function(e,t,n){arguments[4][1][0].apply(n,arguments)},{dup:1}],4:[function(e,t,n){var r,i,s=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:c}catch(e){i=c}}();var a,l=[],d=!1,h=-1;function f(){d&&a&&(d=!1,a.length?l=a.concat(l):h=-1,l.length&&p())}function p(){if(!d){var e=u(f);d=!0;for(var t=l.length;t;){for(a=l,l=[];++h<t;)a&&a[h].run();h=-1,t=l.length}a=null,d=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===c||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function v(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new m(e,t)),1!==l.length||d||u(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=v,s.addListener=v,s.once=v,s.off=v,s.removeListener=v,s.removeAllListeners=v,s.emit=v,s.prependListener=v,s.prependOnceListener=v,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./type");function i(e){return function(t,...n){if(void 0===t||null===t)throw new TypeError(`Spica: assign: Cannot walk on ${t}.`);for(const r of n)if(void 0!==r&&null!==r)for(const n of Object.keys(Object(r))){const i=Object.getOwnPropertyDescriptor(Object(r),n);void 0!==i&&i.enumerable&&e(n,Object(t),Object(r))}return Object(t)}}n.assign=i((e,t,n)=>t[e]=n[e]),n.clone=i((e,t,i)=>{switch(r.type(i[e])){case"Array":return t[e]=n.clone([],i[e]);case"Object":return t[e]=i[e]instanceof Object?n.clone({},i[e]):i[e];default:return t[e]=i[e]}}),n.extend=i((e,t,i)=>{switch(r.type(i[e])){case"Array":return t[e]=n.extend([],i[e]);case"Object":switch(r.type(t[e])){case"Object":return t[e]=i[e]instanceof Object?n.extend(t[e],i[e]):i[e];default:return t[e]=i[e]instanceof Object?n.extend({},i[e]):i[e]}default:return t[e]=i[e]}})},{"./type":84}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./assign"),i=e("./equal");n.Cache=class{constructor(e,t=(()=>void 0),n={}){if(this.size=e,this.callback=t,this.opts={ignore:{delete:!1,clear:!1}},e>0==0)throw new Error("Spica: Cache: Cache size must be greater than 0.");Object.freeze(r.extend(this.opts,n));const{stats:i,entries:s}=n.data||{stats:[[],[]],entries:[]},o=i[1].slice(0,e),c=i[0].slice(0,e-o.length);if(this.stats={LRU:c,LFU:o},this.store=new Map(s),[...i[1],...i[0]].slice(o.length+c.length).forEach(e=>void this.store.delete(e)),this.store.size!==o.length+c.length)throw new Error("Spica: Cache: Size of stats and entries is not matched.");if(![...o,...c].every(e=>this.store.has(e)))throw new Error("Spica: Cache: Keys of stats and entries is not matched.")}put(e,t,n=!0){if(!n&&this.store.has(e))return this.store.set(e,t),!0;if(this.access(e))return this.store.set(e,t),!0;const{LRU:r,LFU:i}=this.stats;if(r.length+i.length===this.size&&r.length<i.length){const e=i.pop(),t=this.store.get(e);this.store.delete(e),this.callback(e,t)}if(r.unshift(e),this.store.set(e,t),r.length+i.length>this.size){const e=r.pop(),t=this.store.get(e);this.store.delete(e),this.callback(e,t)}return!1}set(e,t,n){return this.put(e,t,n),t}get(e,t=!0){return t?(this.access(e),this.store.get(e)):this.store.get(e)}has(e){return this.store.has(e)}delete(e){if(!this.store.has(e))return!1;const{LRU:t,LFU:n}=this.stats;for(const r of[n,t]){const t=i.findIndex(e,r);if(-1===t)continue;const n=this.store.get(e);return this.store.delete(r.splice(t,1)[0]),!!this.opts.ignore.delete||(this.callback(e,n),!0)}return!1}clear(){const e=this.store;this.store=new Map,this.stats={LRU:[],LFU:[]},this.opts.ignore.clear||[...e].forEach(([e,t])=>void this.callback(e,t))}[Symbol.iterator](){return this.store[Symbol.iterator]()}export(){return{stats:[this.stats.LRU.slice(),this.stats.LFU.slice()],entries:[...this]}}inspect(){const{LRU:e,LFU:t}=this.stats;return[e.slice(),t.slice()]}access(e){return this.accessLFU(e)||this.accessLRU(e)}accessLRU(e){if(!this.store.has(e))return!1;const{LRU:t}=this.stats,n=i.findIndex(e,t);if(-1===n)return!1;const{LFU:r}=this.stats;return r.unshift(...t.splice(n,1)),!0}accessLFU(e){if(!this.store.has(e))return!1;const{LFU:t}=this.stats,n=i.findIndex(e,t);return-1!==n&&(t.unshift(...t.splice(n,1)),!0)}}},{"./assign":5,"./equal":14}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./promise"),i=e("./future"),s=e("./exception"),o=e("./monad/maybe"),c=e("./monad/either");n.Cancellation=class extends r.AtomicPromise{constructor(e=[]){var t;super(e=>t=e),this.alive=!0,this.canceled_=!1,this.state=new i.AtomicFuture,this.listeners=new Set,this.register=(e=>{return this.canceled_?(t(this.reason),()=>void 0):this.alive?(this.listeners.add(t),()=>this.alive?void this.listeners.delete(t):void 0):()=>void 0;function t(t){try{e(t)}catch(t){s.causeAsyncException(t)}}}),this.cancel=(e=>{this.alive&&(this.alive=!1,this.canceled_=!0,this.reason=e,this.state.bind(this.reason),Object.freeze(this.listeners),Object.freeze(this),this.listeners.forEach(t=>void t(e)))}),this.close=(e=>{this.alive&&(this.alive=!1,this.state.bind(r.AtomicPromise.reject(e)),Object.freeze(this.listeners),Object.freeze(this))}),this.promise=(e=>this.canceled_?r.AtomicPromise.reject(this.reason):r.AtomicPromise.resolve(e)),this.maybe=(e=>this.canceled_?o.Nothing:o.Just(e)),this.either=(e=>this.canceled_?c.Left(this.reason):c.Right(e)),t(this.state),[...e].forEach(e=>void e.register(this.cancel))}static get[Symbol.species](){return r.AtomicPromise}get canceled(){return this.canceled_}}},{"./exception":15,"./future":17,"./monad/either":22,"./monad/maybe":26,"./promise":78}],8:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./exception");let i=[],s=new WeakSet;n.tick=function(e,t=!1){if(t){if(s.has(e))return;s.add(e)}i.push(e),1===i.length&&o.then(c)};const o=Promise.resolve();function c(){const e=function(){const e=i;return i=[],s=new WeakSet,e}();for(;;){try{for(;e.length>0;)e.shift()()}catch(e){r.causeAsyncException(e);continue}return}}},{"./exception":15}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./promise");var i=e("./clock.tick");n.tick=i.tick,n.clock=Promise.resolve(),n.wait=function(e){return new r.AtomicPromise(t=>void setTimeout(t,e))}},{"./clock.tick":8,"./promise":78}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.compose=function(e,...t){return t.reduce((e,t)=>(Object.getOwnPropertyNames(t.prototype).filter(t=>!(t in e.prototype)).forEach(n=>e.prototype[n]=t.prototype[n]),Object.getOwnPropertyNames(t).filter(t=>!(t in e)).forEach(n=>e[n]=t[n]),e),e)}},{}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.concat=function(e,t){for(let n=0,r=e.length,i=t.length;n<i;++n)e[r+n]=t[n];return e}},{}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.curry=((e,t)=>0===e.length?()=>e.call(t):function e(t,n,r){return t.length<=n.length?t.apply(r,n.slice(0,t.length)):(...i)=>e(t,n.concat(i),r)}(e,[],t))},{}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./monad/either"))},{"./monad/either":22}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.findIndex=function(e,t){const n=e!=e;for(let r=0;r<t.length;++r){const i=t[r];if(n?i!=i:i===e)return r}return-1}},{}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.causeAsyncException=function(e){new Promise((t,n)=>void n(e))}},{}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./curry");n.flip=function(e){return r.curry((t,n)=>e.length>1?e(n,t):e(n)(t))}},{"./curry":12}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./promise");n.Future=class extends Promise{constructor(){let e,t=!0;super(n=>e=(e=>{if(!t)throw new Error("Spica: Future: Cannot rebind a value.");return t=!1,n(e),this})),this.bind=e}static get[Symbol.species](){return Promise}};n.AtomicFuture=class extends r.AtomicPromise{constructor(){let e,t=!0;super(n=>e=(e=>{if(!t)throw new Error("Spica: AtomicFuture: Cannot rebind a value.");return t=!1,n(e),this})),this.bind=e}static get[Symbol.species](){return r.AtomicPromise}}},{"./promise":78}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./concat");class i{constructor(){this.NIL}push(e){return new s(e,this)}extend(e){return this.push(e())}array(){return[]}}n.HNil=i;class s{constructor(e,t){this.head=e,this.tail=t,this.CONS}push(e){return new s(e,this)}walk(e){return e(this.head),this.tail}modify(e){return this.tail.push(e(this.head))}extend(e){return this.push(e(this.head))}compact(e){return this.tail.modify(t=>e(this.head,t))}reverse(){return this.array().reduce((e,t)=>e.push(t),new i)}tuple(){return this.array()}array(){return r.concat([this.head],this.tail.array())}}},{"./concat":11}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./monad/maybe"))},{"./monad/maybe":26}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./functor"),i=e("../curry");class s extends r.Functor{}n.Applicative=s,function(e){e.ap=function e(t,n){return n?t.bind(e=>n.fmap(t=>0===e.length?e(t):i.curry(e)(t))):n=>e(t,n)}}(s=n.Applicative||(n.Applicative={}))},{"../curry":12,"./functor":23}],21:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./monad");class i extends r.Monad{constructor(e){super(e),this.EITHER}fmap(e){return this.bind(t=>new o(e(t)))}ap(e){return i.ap(this,e)}bind(e){return new i(()=>{const t=this.evaluate();if(t instanceof s)return t;if(t instanceof o)return e(t.extract());if(t instanceof i)return t.bind(e);throw new TypeError(`Spica: Either: Invalid monad value.\n\t${t}`)})}join(){return this.bind(e=>e)}extract(e,t){return t?this.fmap(t).extract(e):this.evaluate().extract(e)}}n.Either=i,function(e){function t(e){return new o(e)}e.pure=t,e.Return=t,e.sequence=function(t){return t.reduce((e,t)=>e.bind(e=>t.fmap(t=>e.concat([t]))),e.Return([]))}}(i=n.Either||(n.Either={}));class s extends i{constructor(e){super(c),this.a=e,this.LEFT}bind(e){return this}extract(e){if(!e)throw this.a;return e(this.a)}}n.Left=s;class o extends i{constructor(e){super(c),this.b=e,this.RIGHT}bind(e){return new i(()=>e(this.extract()))}extract(e,t){return t?t(this.b):this.b}}function c(){throw new Error("Spica: Either: Invalid thunk call.")}n.Right=o},{"./monad":27}],22:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./either.impl");!function(e){e.fmap=r.Either.fmap,e.pure=r.Either.pure,e.ap=r.Either.ap,e.Return=r.Either.Return,e.bind=r.Either.bind,e.sequence=r.Either.sequence}(n.Either||(n.Either={})),n.Left=function(e){return new r.Left(e)},n.Right=function(e){return new r.Right(e)}},{"./either.impl":21}],23:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./lazy");class i extends r.Lazy{}n.Functor=i,function(e){e.fmap=function(e,t){return t?e.fmap(t):t=>e.fmap(t)}}(i=n.Functor||(n.Functor={}))},{"./lazy":24}],24:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.Lazy=class{constructor(e){this.thunk=e}evaluate(){return this.memory_=this.memory_||this.thunk()}}},{}],25:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./monadplus");class i extends r.MonadPlus{constructor(e){super(e),this.MAYBE}fmap(e){return this.bind(t=>new s(e(t)))}ap(e){return i.ap(this,e)}bind(e){return new i(()=>{const t=this.evaluate();if(t instanceof s)return e(t.extract());if(t instanceof o)return t;if(t instanceof i)return t.bind(e);throw new TypeError(`Spica: Maybe: Invalid monad value.\n\t${t}`)})}guard(e){return e?this:i.mzero}join(){return this.bind(e=>e)}extract(e,t){return t?this.fmap(t).extract(e):this.evaluate().extract(e)}}n.Maybe=i,function(e){function t(e){return new s(e)}e.pure=t,e.Return=t,e.sequence=function(t){return t.reduce((e,t)=>e.bind(e=>t.fmap(t=>e.concat([t]))),e.Return([]))}}(i=n.Maybe||(n.Maybe={}));class s extends i{constructor(e){super(c),this.a=e,this.JUST}bind(e){return new i(()=>e(this.extract()))}extract(e,t){return t?t(this.a):this.a}}n.Just=s;class o extends i{constructor(){super(c),this.NOTHING}bind(e){return this}extract(e){if(!e)throw void 0;return e()}}function c(){throw new Error("Spica: Maybe: Invalid thunk call.")}n.Nothing=o,function(e){e.mzero=new o,e.mplus=function(t,n){return new e(()=>t.fmap(()=>t).extract(()=>n))}}(i=n.Maybe||(n.Maybe={}))},{"./monadplus":28}],26:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./maybe.impl");!function(e){e.fmap=r.Maybe.fmap,e.pure=r.Maybe.pure,e.ap=r.Maybe.ap,e.Return=r.Maybe.Return,e.bind=r.Maybe.bind,e.sequence=r.Maybe.sequence,e.mzero=r.Maybe.mzero,e.mplus=r.Maybe.mplus}(n.Maybe||(n.Maybe={})),n.Just=function(e){return new r.Just(e)},n.Nothing=r.Maybe.mzero},{"./maybe.impl":25}],27:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./applicative");class i extends r.Applicative{}n.Monad=i,function(e){e.bind=function e(t,n){return n?t.bind(n):n=>e(t,n)}}(i=n.Monad||(n.Monad={}))},{"./applicative":20}],28:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./monad");class i extends r.Monad{}n.MonadPlus=i,i=n.MonadPlus||(n.MonadPlus={})},{"./monad":27}],29:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./sequence/core");n.Sequence=r.Sequence;const i=e("./sequence/member/static/resume"),s=e("./sequence/member/static/from"),o=e("./sequence/member/static/cycle"),c=e("./sequence/member/static/random"),u=e("./sequence/member/static/concat"),a=e("./sequence/member/static/zip"),l=e("./sequence/member/static/difference"),d=e("./sequence/member/static/union"),h=e("./sequence/member/static/intersect"),f=e("./sequence/member/static/pure"),p=e("./sequence/member/static/return"),m=e("./sequence/member/static/sequence"),v=e("./sequence/member/static/mempty"),b=e("./sequence/member/static/mconcat"),y=e("./sequence/member/static/mappend"),w=e("./sequence/member/static/mzero"),q=e("./sequence/member/static/mplus"),S=e("./sequence/member/instance/extract"),g=e("./sequence/member/instance/iterate"),_=e("./sequence/member/instance/memoize"),x=e("./sequence/member/instance/reduce"),E=e("./sequence/member/instance/take"),T=e("./sequence/member/instance/drop"),j=e("./sequence/member/instance/takeWhile"),P=e("./sequence/member/instance/dropWhile"),O=e("./sequence/member/instance/takeUntil"),M=e("./sequence/member/instance/dropUntil"),k=e("./sequence/member/instance/sort"),R=e("./sequence/member/instance/unique"),L=e("./sequence/member/instance/fmap"),A=e("./sequence/member/instance/ap"),I=e("./sequence/member/instance/bind"),U=e("./sequence/member/instance/join"),z=e("./sequence/member/instance/mapM"),C=e("./sequence/member/instance/filterM"),F=e("./sequence/member/instance/map"),N=e("./sequence/member/instance/filter"),$=e("./sequence/member/instance/scanl"),D=e("./sequence/member/instance/foldr"),H=e("./sequence/member/instance/group"),W=e("./sequence/member/instance/inits"),V=e("./sequence/member/instance/tails"),G=e("./sequence/member/instance/segs"),B=e("./sequence/member/instance/subsequences"),J=e("./sequence/member/instance/permutations");e("../compose").compose(r.Sequence,i.default,s.default,o.default,c.default,u.default,a.default,l.default,d.default,h.default,f.default,p.default,m.default,v.default,b.default,y.default,w.default,q.default,S.default,g.default,_.default,x.default,E.default,T.default,j.default,P.default,O.default,M.default,k.default,R.default,L.default,A.default,I.default,U.default,z.default,C.default,F.default,N.default,$.default,D.default,H.default,W.default,V.default,G.default,B.default,J.default)},{"../compose":10,"./sequence/core":30,"./sequence/member/instance/ap":31,"./sequence/member/instance/bind":32,"./sequence/member/instance/drop":33,"./sequence/member/instance/dropUntil":34,"./sequence/member/instance/dropWhile":35,"./sequence/member/instance/extract":36,"./sequence/member/instance/filter":37,"./sequence/member/instance/filterM":38,"./sequence/member/instance/fmap":39,"./sequence/member/instance/foldr":40,"./sequence/member/instance/group":41,"./sequence/member/instance/inits":42,"./sequence/member/instance/iterate":43,"./sequence/member/instance/join":44,"./sequence/member/instance/map":45,"./sequence/member/instance/mapM":46,"./sequence/member/instance/memoize":47,"./sequence/member/instance/permutations":48,"./sequence/member/instance/reduce":49,"./sequence/member/instance/scanl":50,"./sequence/member/instance/segs":51,"./sequence/member/instance/sort":52,"./sequence/member/instance/subsequences":53,"./sequence/member/instance/tails":54,"./sequence/member/instance/take":55,"./sequence/member/instance/takeUntil":56,"./sequence/member/instance/takeWhile":57,"./sequence/member/instance/unique":58,"./sequence/member/static/concat":59,"./sequence/member/static/cycle":60,"./sequence/member/static/difference":61,"./sequence/member/static/from":62,"./sequence/member/static/intersect":63,"./sequence/member/static/mappend":64,"./sequence/member/static/mconcat":65,"./sequence/member/static/mempty":66,"./sequence/member/static/mplus":67,"./sequence/member/static/mzero":68,"./sequence/member/static/pure":69,"./sequence/member/static/random":70,"./sequence/member/static/resume":71,"./sequence/member/static/return":72,"./sequence/member/static/sequence":73,"./sequence/member/static/union":74,"./sequence/member/static/zip":75}],30:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../monadplus");class i extends r.MonadPlus{constructor(e){super(s),this.cons=e}[Symbol.iterator](){let e=()=>this.iterate();return{next(){const t=e();return e=i.Thunk.iterator(t),{done:!i.isIterable(t),value:i.Thunk.value(t)}}}}}function s(){throw new Error("Spica: Sequence: Invalid thunk call.")}n.Sequence=i,i=n.Sequence||(n.Sequence={}),function(e){let t,n,r,i;!function(t){t.cons=function(t,n){switch(arguments.length){case 0:return[];case 1:return[t];case 2:return[t,n];default:throw e.Exception.invalidConsError(arguments)}}}(t=e.Data||(e.Data={})),function(e){e.value=function(e){return e[0]},e.iterator=function(e){return e[1]},e.index=function(e){return e[2]}}(n=e.Thunk||(e.Thunk={})),function(t){t.done=(()=>[void 0,t.done,-1]),t.when=function t(r,i,s){return e.isIterable(r)?s(r,()=>t(n.iterator(r)(),i,s)):i(r)}}(r=e.Iterator||(e.Iterator={})),e.isIterable=function(e){return n.iterator(e)!==r.done},function(e){e.invalidConsError=function(e){return console.error(e,e.length,e[0],e[1]),new TypeError("Spica: Sequence: Invalid parameters of cons.")},e.invalidDataError=function(e){return console.error(e),new TypeError("Spica: Sequence: Invalid data.")},e.invalidThunkError=function(e){return console.error(e),new TypeError("Spica: Sequence: Invalid thunk.")}}(i=e.Exception||(e.Exception={}))}(i=n.Sequence||(n.Sequence={}))},{"../monadplus":28}],31:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{ap(e){return r.Sequence.ap(this,e)}}},{"../../core":30}],32:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{bind(e){return r.Sequence.concat(this.fmap(e))}}},{"../../core":30}],33:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{drop(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),(t,i)=>r.Sequence.Thunk.index(t)<e?i():n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],34:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{dropUntil(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),(t,i)=>e(r.Sequence.Thunk.value(t))?i():n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],35:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{dropWhile(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),(t,i)=>e(r.Sequence.Thunk.value(t))?i():n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],36:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{extract(){const e=[];let t=()=>this.iterate();for(;;){const n=t();if(!r.Sequence.isIterable(n))return e;i.concat(e,[r.Sequence.Thunk.value(n)]),t=r.Sequence.Thunk.iterator(n)}}}},{"../../../../concat":11,"../../core":30}],37:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{filter(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),(t,i)=>e(r.Sequence.Thunk.value(t),r.Sequence.Thunk.index(t))?n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t)):i()))}}},{"../../core":30}],38:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{filterM(e){return r.Sequence.from([0]).bind(()=>{const t=this.extract();switch(t.length){case 0:return r.Sequence.from([[]]);default:{const n=t.shift();return e(n).bind(s=>s?0===t.length?r.Sequence.from([[n]]):r.Sequence.from(t).filterM(e).fmap(e=>i.concat([n],e)):0===t.length?r.Sequence.from([[]]):r.Sequence.from(t).filterM(e))}}})}}},{"../../../../concat":11,"../../core":30}],39:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{fmap(e){return new r.Sequence((t=(()=>this.iterate()))=>r.Sequence.Iterator.when(t(),()=>r.Sequence.Data.cons(),t=>r.Sequence.Data.cons(e(r.Sequence.Thunk.value(t)),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],40:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{foldr(e,t){return new r.Sequence((n=(()=>this.reduce().iterate()))=>r.Sequence.Iterator.when(n(),()=>r.Sequence.Data.cons(t),n=>r.Sequence.Data.cons(e(r.Sequence.Thunk.value(n),r.Sequence.resume(r.Sequence.Thunk.iterator(n)).foldr(e,t))))).bind(e=>e)}}},{"../../core":30}],41:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{group(e){return new r.Sequence(([t,n]=[()=>this.iterate(),[]],s)=>r.Sequence.Iterator.when(t(),()=>0===n.length?s():s(n),(t,o)=>0===n.length||e(n[0],r.Sequence.Thunk.value(t))?(i.concat(n,[r.Sequence.Thunk.value(t)]),o()):s(n,[r.Sequence.Thunk.iterator(t),i.concat([],[r.Sequence.Thunk.value(t)])])))}}},{"../../../../concat":11,"../../core":30}],42:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{inits(){return r.Sequence.mappend(r.Sequence.from([[]]),this.scanl((e,t)=>e.concat([t]),[]).dropWhile(e=>0===e.length))}}},{"../../core":30}],43:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{iterate(){return this.iterate_()}iterate_(e,t=0){const n=this.cons(e,r.Sequence.Data.cons);switch(n.length){case 0:return[void 0,r.Sequence.Iterator.done,-1];case 1:return[n[0],()=>r.Sequence.Iterator.done(),t];case 2:return[n[0],()=>this.iterate_(n[1],t+1),t];default:throw r.Sequence.Exception.invalidDataError(n)}}}},{"../../core":30}],44:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{join(){return r.Sequence.concat(this)}}},{"../../core":30}],45:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{map(e){return new r.Sequence((t=(()=>this.iterate()))=>r.Sequence.Iterator.when(t(),()=>r.Sequence.Data.cons(),t=>r.Sequence.Data.cons(e(r.Sequence.Thunk.value(t),r.Sequence.Thunk.index(t)),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],46:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{mapM(e){return r.Sequence.from([0]).bind(()=>{const t=this.extract();switch(t.length){case 0:return r.Sequence.mempty;default:{const n=t.shift();return e(n).bind(n=>0===t.length?r.Sequence.from([[n]]):r.Sequence.from(t).mapM(e).fmap(e=>i.concat([n],e)))}}})}}},{"../../../../concat":11,"../../core":30}],47:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=new WeakMap;n.default=class extends r.Sequence{memoize(){return new r.Sequence(([e,t]=[0,i.get(this)||i.set(this,new Map).get(this)],n)=>r.Sequence.Iterator.when(t.get(e)||t.set(e,e>0&&t.has(e-1)?r.Sequence.Thunk.iterator(t.get(e-1))():this.iterate()).get(e),()=>n(),i=>n(r.Sequence.Thunk.value(i),[e+1,t])))}}},{"../../core":30}],48:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{permutations(){return r.Sequence.from([0]).bind(()=>{const e=this.extract();return 0===e.length?r.Sequence.mempty:r.Sequence.from([e])}).bind(e=>r.Sequence.mappend(r.Sequence.from([e]),function e(t,n){return r.Sequence.Iterator.when(t.iterate(),()=>r.Sequence.mempty,t=>new r.Sequence((s,o)=>r.Sequence.Iterator.when(t,()=>o(),t=>{const s=r.Sequence.Thunk.value(t),c=r.Sequence.resume(r.Sequence.Thunk.iterator(t)).memoize();return o(n.permutations().foldr((e,t)=>(i=r.Sequence.from(e),t=t,function e(t,n,i){return r.Sequence.Iterator.when(n.iterate(),()=>[c,i],n=>{const o=r.Sequence.Thunk.value(n),[c,u]=e(e=>t(r.Sequence.mappend(r.Sequence.from([o]),e)),r.Sequence.resume(r.Sequence.Thunk.iterator(n)),i);return[r.Sequence.mappend(r.Sequence.from([o]),c),r.Sequence.mappend(r.Sequence.from([t(r.Sequence.mappend(r.Sequence.from([s]),r.Sequence.mappend(r.Sequence.from([o]),c))).extract()]),u)]})}(e=>e,i,t)[1]),e(c,r.Sequence.mappend(r.Sequence.from([s]),n))))})).bind(e=>e));var i,s}(r.Sequence.from(e),r.Sequence.mempty)))}}},{"../../core":30}],49:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{reduce(){return new r.Sequence(([e,t]=[0,new Map],n)=>r.Sequence.Iterator.when(t.get(e)||t.set(e,e>0&&t.has(e-1)?r.Sequence.Thunk.iterator(t.get(e-1))():this.iterate()).get(e),()=>n(),i=>n(r.Sequence.Thunk.value(i),[e+1,t])))}}},{"../../core":30}],50:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{scanl(e,t){return new r.Sequence(([n,i,s]=[t,()=>this.iterate(),0])=>r.Sequence.Iterator.when(i(),()=>0===s?r.Sequence.Data.cons(t):r.Sequence.Data.cons(),t=>r.Sequence.Data.cons(n=e(n,r.Sequence.Thunk.value(t)),[n,r.Sequence.Thunk.iterator(t),r.Sequence.Thunk.index(t)+1])))}}},{"../../core":30}],51:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{segs(){return r.Sequence.mappend(this.foldr((e,t)=>t.take(1).bind(n=>r.Sequence.mappend(r.Sequence.from([r.Sequence.mappend(r.Sequence.from([[e]]),r.Sequence.from(n).map(t=>i.concat([e],t)))]),t)),r.Sequence.from([r.Sequence.from([])])).bind(e=>e),r.Sequence.from([[]]))}}},{"../../../../concat":11,"../../core":30}],52:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{sort(e){return r.Sequence.from(this.extract().sort(e))}}},{"../../core":30}],53:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{subsequences(){return r.Sequence.mappend(r.Sequence.from([[]]),r.Sequence.from([0]).bind(()=>(function e(t){return r.Sequence.Iterator.when(t.iterate(),()=>r.Sequence.mempty,t=>r.Sequence.mappend(r.Sequence.from([[r.Sequence.Thunk.value(t)]]),new r.Sequence((n,s)=>r.Sequence.Iterator.when(t,()=>s(),t=>s(e(r.Sequence.resume(r.Sequence.Thunk.iterator(t))).foldr((e,n)=>r.Sequence.mappend(r.Sequence.mappend(r.Sequence.from([e]),r.Sequence.from([i.concat([r.Sequence.Thunk.value(t)],e)])),n),r.Sequence.mempty)))).bind(e=>e)))})(this)))}}},{"../../../../concat":11,"../../core":30}],54:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{tails(){return r.Sequence.mappend(r.Sequence.from(this.extract().map((e,t,n)=>n.slice(t))),r.Sequence.from([[]]))}}},{"../../core":30}],55:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{take(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(e>0?t():r.Sequence.Iterator.done(),()=>n(),t=>r.Sequence.Thunk.index(t)+1<e?n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t)):n(r.Sequence.Thunk.value(t))))}}},{"../../core":30}],56:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{takeUntil(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),t=>e(r.Sequence.Thunk.value(t))?n(r.Sequence.Thunk.value(t)):n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],57:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{takeWhile(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),t=>e(r.Sequence.Thunk.value(t))?n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t)):n()))}}},{"../../core":30}],58:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{unique(){const e=new Set;return this.filter(t=>!e.has(t)&&!!e.add(t))}}},{"../../core":30}],59:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static concat(e){return new r.Sequence(([t,n]=[()=>e.iterate(),r.Sequence.Iterator.done],i)=>r.Sequence.Iterator.when(t(),()=>i(),(e,t)=>(n=n===r.Sequence.Iterator.done?()=>r.Sequence.Thunk.value(e).iterate():n,r.Sequence.Iterator.when(n(),()=>(n=r.Sequence.Iterator.done,t()),t=>i(r.Sequence.Thunk.value(t),[()=>e,r.Sequence.Thunk.iterator(t)])))))}}},{"../../core":30}],60:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static cycle(e){return new r.Sequence(function t([n,r]=[e[Symbol.iterator](),0],i){const s=n.next();return s.done?t([e[Symbol.iterator](),r+1],i):i(s.value,[n,r+1])}).reduce()}}},{"../../core":30}],61:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static difference(e,t,n){return new r.Sequence(([i,s]=[()=>e.iterate(),()=>t.iterate()],o)=>r.Sequence.Iterator.when(i(),()=>r.Sequence.Iterator.when(s(),()=>o(),e=>o(r.Sequence.Thunk.value(e),[r.Sequence.Iterator.done,r.Sequence.Thunk.iterator(e)])),(e,t)=>r.Sequence.Iterator.when(s(),()=>o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),r.Sequence.Iterator.done]),i=>{const c=n(r.Sequence.Thunk.value(e),r.Sequence.Thunk.value(i));return c<0?o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),()=>i]):c>0?o(r.Sequence.Thunk.value(i),[()=>e,r.Sequence.Thunk.iterator(i)]):(s=(()=>r.Sequence.Thunk.iterator(i)()),t())})))}}},{"../../core":30}],62:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static from(e){return new r.Sequence(([t,n]=[e[Symbol.iterator](),0],r)=>{const i=t.next();return i.done?r():r(i.value,[t,n+1])}).reduce()}}},{"../../core":30}],63:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static intersect(e,t,n){return new r.Sequence(([i,s]=[()=>e.iterate(),()=>t.iterate()],o)=>r.Sequence.Iterator.when(i(),()=>o(),(e,t)=>r.Sequence.Iterator.when(s(),()=>o(),(i,c)=>{const u=n(r.Sequence.Thunk.value(e),r.Sequence.Thunk.value(i));return u<0?(s=(()=>i),t()):u>0?c():o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),r.Sequence.Thunk.iterator(i)])})))}}},{"../../core":30}],64:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static mappend(e,t){return r.Sequence.mconcat([e,t])}}},{"../../core":30}],65:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static mconcat(e){return[...e].reduce((e,t)=>(e=e,t=t,new r.Sequence(([n,i]=[()=>e.iterate(),()=>t.iterate()],s)=>r.Sequence.Iterator.when(n(),()=>r.Sequence.Iterator.when(i(),()=>s(),e=>s(r.Sequence.Thunk.value(e),[r.Sequence.Iterator.done,r.Sequence.Thunk.iterator(e)])),e=>s(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),i])))),r.Sequence.mempty);var t,n}}},{"../../core":30}],66:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");class i extends r.Sequence{}i.mempty=new r.Sequence((e,t)=>t()),n.default=i},{"../../core":30}],67:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");class i extends r.Sequence{}i.mplus=r.Sequence.mappend,n.default=i},{"../../core":30}],68:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");class i extends r.Sequence{}i.mzero=r.Sequence.mempty,n.default=i},{"../../core":30}],69:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static pure(e){return new r.Sequence((t,n)=>n(e))}}},{"../../core":30}],70:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static random(e=(()=>Math.random())){return"function"==typeof e?r.Sequence.from(new r.Sequence((t,n)=>n(e(),t))):this.random().map(t=>e[t*e.length|0])}}},{"../../core":30}],71:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static resume(e){return new r.Sequence((t=e,n)=>r.Sequence.Iterator.when(t(),()=>n(),e=>n(r.Sequence.Thunk.value(e),r.Sequence.Thunk.iterator(e))))}}},{"../../core":30}],72:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static Return(e){return new r.Sequence((t,n)=>n(e))}}},{"../../core":30}],73:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static sequence(e){return e.reduce((e,t)=>e.fmap(e=>r.Sequence.mappend(e,t)),r.Sequence.Return(r.Sequence.from([])))}}},{"../../core":30}],74:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static union(e,t,n){return new r.Sequence(([i,s]=[()=>e.iterate(),()=>t.iterate()],o)=>r.Sequence.Iterator.when(i(),()=>r.Sequence.Iterator.when(s(),()=>o(),e=>o(r.Sequence.Thunk.value(e),[r.Sequence.Iterator.done,r.Sequence.Thunk.iterator(e)])),e=>r.Sequence.Iterator.when(s(),()=>o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),r.Sequence.Iterator.done]),t=>{const i=n(r.Sequence.Thunk.value(e),r.Sequence.Thunk.value(t));return i<0?o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),()=>t]):i>0?o(r.Sequence.Thunk.value(t),[()=>e,r.Sequence.Thunk.iterator(t)]):o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),r.Sequence.Thunk.iterator(t)])})))}}},{"../../core":30}],75:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static zip(e,t){return new r.Sequence(([n,i]=[()=>e.iterate(),()=>t.iterate()],s)=>r.Sequence.Iterator.when(n(),()=>s(),e=>r.Sequence.Iterator.when(i(),()=>s(),t=>s([r.Sequence.Thunk.value(e),r.Sequence.Thunk.value(t)],[r.Sequence.Thunk.iterator(e),r.Sequence.Thunk.iterator(t)]))))}}},{"../../core":30}],76:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.noop=function(){}},{}],77:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./assign"),i=e("./concat"),s=e("./equal"),o=e("./exception");var c;!function(e){e.monitor="monitor",e.subscriber="subscriber"}(c=n.RegisterItemType||(n.RegisterItemType={}));function u(e,t,n,r){return e.some(e=>e.type===t&&e.namespace.length===n.length&&e.namespace.every((e,t)=>e===n[t])&&e.listener===r)}n.Observation=class{constructor(e={}){this.settings={limit:10},this.relaySources=new WeakSet,this.node_={parent:void 0,children:new Map,childrenNames:[],items:[]},Object.freeze(r.extend(this.settings,e))}monitor(e,t,{once:n=!1}={}){if("function"!=typeof t)throw new Error(`Spica: Observation: Invalid listener: ${t}`);const r=()=>this.off(e,t,c.monitor),{items:i}=this.seekNode_(e);if(u(i,c.monitor,e,t))return r;if(i.length===this.settings.limit)throw new Error("Spica: Observation: Exceeded max listener limit.");return i.push({type:c.monitor,namespace:e,listener:t,options:{once:n}}),r}on(e,t,{once:n=!1}={}){if("function"!=typeof t)throw new Error(`Spica: Observation: Invalid listener: ${t}`);const r=()=>this.off(e,t),{items:i}=this.seekNode_(e);if(u(i,c.subscriber,e,t))return r;if(i.length===this.settings.limit)throw new Error("Spica: Observation: Exceeded max listener limit.");return i.push({type:c.subscriber,namespace:e,listener:t,options:{once:n}}),r}once(e,t){return this.on(e,t,{once:!0})}off(e,t,n=c.subscriber){switch(typeof t){case"function":return void this.seekNode_(e).items.some(({type:e,listener:r},i,s)=>{if(r!==t)return!1;if(e!==n)return!1;switch(i){case 0:return!void s.shift();case s.length-1:return!void s.pop();default:return!void s.splice(i,1)}});case"undefined":{const t=this.seekNode_(e);return t.childrenNames.slice().forEach(n=>{this.off(e.concat([n]));const r=t.children.get(n);r&&(r.items.length+r.childrenNames.length>0||(t.children.delete(n),t.childrenNames.splice(s.findIndex(n,t.childrenNames),1)))}),void(t.items=t.items.filter(({type:e})=>e===c.monitor))}default:throw new Error("Spica: Observation: Unreachable.")}}emit(e,t,n){this.drain_(e,t,n)}reflect(e,t){let n=[];return this.emit(e,t,(e,t)=>n=t),n}relay(e){if(this.relaySources.has(e))return()=>void 0;this.relaySources.add(e);const t=e.monitor([],(e,t)=>void this.emit(t,e));return()=>(this.relaySources.delete(e),t())}drain_(e,t,n){const r=[];if(this.refsBelow_(this.seekNode_(e)).reduce((i,{type:s,listener:u,options:{once:a}})=>{if(s===c.subscriber){a&&this.off(e,u);try{const i=u(t,e);n&&(r[r.length]=i)}catch(e){o.causeAsyncException(e)}}},void 0),this.refsAbove_(this.seekNode_(e)).reduce((n,{type:r,listener:i,options:{once:s}})=>{if(r===c.monitor){s&&this.off(e,i,c.monitor);try{i(t,e)}catch(e){o.causeAsyncException(e)}}},void 0),n)try{n(t,r)}catch(e){o.causeAsyncException(e)}}refs(e){return this.refsBelow_(this.seekNode_(e))}refsAbove_({parent:e,items:t}){for(t=i.concat([],t);e;)t=i.concat(t,e.items),e=e.parent;return t}refsBelow_({childrenNames:e,children:t,items:n}){n=i.concat([],n);for(let r=0;r<e.length;++r){const o=e[r],c=this.refsBelow_(t.get(o));n=i.concat(n,c),0===c.length&&(t.delete(o),e.splice(s.findIndex(o,e),1),--r)}return n}seekNode_(e){let t=this.node_;for(const n of e){const{children:e}=t;e.has(n)||(t.childrenNames.push(n),e.set(n,{parent:t,children:new Map,childrenNames:[],items:[]})),t=e.get(n)}return t}}},{"./assign":5,"./concat":11,"./equal":14,"./exception":15}],78:[function(e,t,n){"use strict";var r;Object.defineProperty(n,"__esModule",{value:!0});const i=e("./noop"),s=Symbol(),o=Symbol(),c=Symbol();class u{constructor(e){this[Symbol.toStringTag]="Promise",this[r]=[];try{e(e=>{this[s]=this[s]||new a("resolved",e),this[c]()},e=>{this[s]=this[s]||new a("rejected",e),this[c]()})}catch(e){this[s]=new a("rejected",e),this[c]()}}static get[Symbol.species](){return u}static all(e){return e.reduce((e,t)=>e.then(e=>u.resolve(t).then(t=>e.concat([t]))),u.resolve([]))}static race(e){return new u(t=>void e.forEach(e=>void u.resolve(e).then(t,t)))}static resolve(e){return new u((t,n)=>l(e)?void e.then(t,n):void t(e))}static reject(e){return new u((t,n)=>void n(e))}[c](){const e=this[s];if(e)for(;this[o].length>0;){const[t,n]=this[o].shift();switch(e.state){case"resolved":l(e.value)?e.value.then(t,n):t(e.value);continue;case"rejected":n(e.value);continue}}}then(e,t){return e=e||u.resolve,t=t||u.reject,new u((n,r)=>{this[o].push([t=>{try{n(e(t))}catch(e){r(e)}},e=>void new u(n=>void n(t(e))).then(n,r)]),this[c]()})}catch(e){return this.then(void 0,e)}finally(e){return e=e||i.noop,this.then(t=>void e()||t,t=>void e()||u.reject(t))}}r=o,n.AtomicPromise=u;class a{constructor(e,t){this.state=e,this.value=t}}function l(e){return!!e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}},{"./noop":76}],79:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./monad/sequence"))},{"./monad/sequence":29}],80:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r="0".repeat(15);let i=0;n.sqid=function(e){if(arguments.length>0){if("number"!=typeof e)throw new TypeError(`Spica: sqid: A parameter value must be a number: ${e}`);if(e>=0==0)throw new TypeError(`Spica: sqid: A parameter value must be a positive number: ${e}`);if(e%1!=0)throw new TypeError(`Spica: sqid: A parameter value must be an integer: ${e}`)}return void 0===e?(r+ ++i).slice(-15):(r+e).slice(-15)}},{}],81:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./promise"),i=e("./observation"),s=e("./assign"),o=e("./clock"),c=e("./sqid"),u=e("./noop"),a=e("./exception");class l{constructor(e={}){if(this.id=c.sqid(),this.settings={name:"",size:1/0,timeout:1/0,destructor:e=>void 0,scheduler:o.tick,resource:10},this.events_={init:new i.Observation,loss:new i.Observation,exit:new i.Observation},this.events=this.events_,this.workers=new Map,this.alive=!0,this.available_=!0,this.scheduler=(()=>void(0,this.settings.scheduler)(this.deliver)),this.messages=[],this.deliver=(()=>{const e=Date.now();for(let t=0,n=this.messages.length;this.available&&t<n;++t){if(this.settings.resource-(Date.now()-e)<=0)return void this.schedule();const[r,i,s,o]=this.messages[t],c="string"==typeof r?[r]:[...r],u=c.reduce((e,t)=>e||(this.workers.has(t)?this.workers.get(t).call([i,o]):void 0),void 0);if(!(void 0===u&&Date.now()<o))if(0===t?this.messages.shift():this.messages.splice(t,1),--t,--n,void 0===u){this.events_.loss.emit([c[0]],[c[0],i]);try{s(void 0,new Error("Spica: Supervisor: A process has failed."))}catch(e){a.causeAsyncException(e)}}else u.then(e=>void s(e),()=>void s(void 0,new Error("Spica: Supervisor: A process has failed.")))}}),Object.freeze(s.extend(this.settings,e)),this.name=this.settings.name,this.constructor===l)throw new Error(`Spica: Supervisor: <${this.id}/${this.name}>: Cannot instantiate abstract classes.`);this.constructor.instances.add(this)}static get instances(){return this.hasOwnProperty("instances_")?this.instances_:this.instances_=new Set}static get count(){return this.instances.size}static get procs(){return[...this.instances].reduce((e,t)=>e+t.workers.size,0)}destructor(e){for(this.available_=!1,this.workers.forEach(t=>void t.terminate(e)),Object.freeze(this.workers);this.messages.length>0;){const[e,t]=this.messages.shift(),n="string"==typeof e?[e]:[...e];this.events_.loss.emit([n[0]],[n[0],t])}Object.freeze(this.messages),this.alive=!1,this.constructor.instances.delete(this),Object.freeze(this),this.settings.destructor(e)}get available(){return this.available_}throwErrorIfNotAvailable(){if(!this.available)throw new Error(`Spica: Supervisor: <${this.id}/${this.name}>: A supervisor is already terminated.`)}register(e,t,n,r){if(this.throwErrorIfNotAvailable(),arguments.length>3)return this.kill(e,r),this.register(e,t,n);if(this.workers.has(e))throw new Error(`Spica: Supervisor: <${this.id}/${this.name}/${e}>: Cannot register a process multiply with the same name.`);return this.schedule(),t="function"==typeof t?{init:e=>e,main:t,exit:e=>void 0}:t,this.workers.set(e,new h(this,e,t,n,n===l.initiated,this.events_,()=>void this.workers.delete(e))).get(e).terminate}call(e,t,n=this.settings.timeout,r=this.settings.timeout){return this.call_(void 0===e?new d(this.workers):e,t,n,r)}call_(e,t,n,i){if(this.throwErrorIfNotAvailable(),"number"==typeof n)return new r.AtomicPromise((n,r)=>void this.call_(e,t,(e,t)=>t?r(t):n(e),i));for(this.messages.push([e,t,n,Date.now()+i]);this.messages.length>this.settings.size;){const[e,t,n]=this.messages.shift(),r="string"==typeof e?[e]:[...e];this.events_.loss.emit([r[0]],[r[0],t]);try{n(void 0,new Error(`Spica: Supervisor: <${this.id}/${this.name}>: A message overflowed.`))}catch(e){a.causeAsyncException(e)}}this.schedule(),i<=0||i!==1/0&&setTimeout(()=>void this.schedule(),i+3)}cast(e,t,n=this.settings.timeout){const r=this.cast_(void 0===e?new d(this.workers):e,t,n);return void 0!==r&&(r.catch(u.noop),!0)}cast_(e,t,n){this.throwErrorIfNotAvailable();const r="string"==typeof e?[e]:[...e],i=r.reduce((e,r)=>e||(this.workers.has(r)?this.workers.get(r).call([t,Date.now()+n]):void 0),void 0);return void 0===i&&this.events_.loss.emit([r[0]],[r[0],t]),i}refs(e){return this.throwErrorIfNotAvailable(),void 0===e?[...this.workers.values()].map(t):this.workers.has(e)?[t(this.workers.get(e))]:[];function t(e){return[e.name,e.process,e.state,e.terminate]}}kill(e,t){return!!this.available&&(!!this.workers.has(e)&&this.workers.get(e).terminate(t))}terminate(e){return!!this.available&&(this.destructor(e),!0)}schedule(){0!==this.messages.length&&o.tick(this.scheduler,!0)}}l.initiated=Symbol(),n.Supervisor=l;class d{constructor(e){this.workers=e}[Symbol.iterator](){return 0===this.workers.size?[""][Symbol.iterator]():this.workers.keys()}}class h{constructor(e,t,n,r,i,s,o){this.sv=e,this.name=t,this.process=n,this.state=r,this.events=s,this.destructor_=o,this.alive=!0,this.available=!0,this.initiated=!1,this.terminate=(e=>!!this.alive&&(this.destructor(e),!0)),i&&this.init()}destructor(e){this.alive=!1,this.available=!1,Object.freeze(this);try{this.destructor_()}catch(e){a.causeAsyncException(e)}this.initiated&&this.exit(e)}init(){this.initiated=!0,this.events.init.emit([this.name],[this.name,this.process,this.state]),this.state=this.process.init(this.state)}exit(e){try{this.process.exit(e,this.state),this.events.exit.emit([this.name],[this.name,this.process,this.state,e])}catch(t){this.events.exit.emit([this.name],[this.name,this.process,this.state,e]),this.sv.terminate(t)}}call([e,t]){const n=Date.now();if(this.available&&!(n>t))return new r.AtomicPromise((i,s)=>{isFinite(t)&&setTimeout(()=>void s(new Error),t-n),this.available=!1,this.initiated||this.init(),r.AtomicPromise.resolve(this.process.main(e,this.state,this.terminate)).then(i,s)}).then(e=>{const[t,n]=Array.isArray(e)?e:[e.reply,e.state];return this.alive?(this.sv.schedule(),this.state=n,this.available=!0,t):t}).catch(e=>{throw this.sv.schedule(),this.terminate(e),e})}}},{"./assign":5,"./clock":9,"./exception":15,"./noop":76,"./observation":77,"./promise":78,"./sqid":80}],82:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.throttle=function(e,t){let n=0,r=[];return i=>{r.push(i),n>0||(n=setTimeout(()=>{n=0,t(r[r.length-1],function(){const e=r;return r=[],e}())},e))}},n.debounce=function(e,t){let n=0,r=[];return i=>{r.push(i),n>0||(n=setTimeout(()=>{n=0,setTimeout(()=>{n>0||t(r[r.length-1],function(){const e=r;return r=[],e}())},e)},e))}}},{}],83:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.tuple=function(e){return e}},{}],84:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.type=function(e){const t=Object.prototype.toString.call(e).split(" ").pop().slice(0,-1);return"object"!=typeof e&&e instanceof Object==0||null===e?t.toLowerCase():t}},{}],85:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.uncurry=(e=>t=>e(...t.slice(0,e.length)))},{}],86:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split(""));n.uuid=function(){let e="";for(const t of r)if("x"===t||"y"===t){const n=16*Math.random()|0;e+=("x"==t?n:3&n|8).toString(16)}else e+=t;return e.toLowerCase()}},{}],87:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("./src/dom/builder");n.default=r.TypedHTML,n.TypedHTML=r.TypedHTML,n.TypedSVG=r.TypedSVG,n.API=r.API;var i=e("./src/util/dom");n.html=i.html,n.svg=i.svg,n.text=i.text,n.frag=i.frag,n.observe=i.observe,function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./src/util/listener"))},{"./src/dom/builder":88,"./src/util/dom":91,"./src/util/listener":92}],88:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./manager"),i=e("../util/dom");function s(e){return new Proxy({},function(e){return{get:(t,n)=>t[n]||n in t||"string"!=typeof n?t[n]:t[n]=function(e,t){return function n(s,o,c){return"function"==typeof s?n(void 0,void 0,s):"function"==typeof o?n(s,void 0,o):void 0!==s&&function(e){return"object"!=typeof e||Object.values(e).slice(-1).every(e=>"object"==typeof e)}(s)?n(void 0,s,c):new r.El(function(n,r,s){const o=n(t,e,r,s);if(e!==o.tagName.toLowerCase())throw new Error(`TypedDOM: Tag name must be "${e}", but got "${o.tagName.toLowerCase()}".`);return i.define(o,r),o}(c||((e,t)=>e(t)),s||{},o),o)}}(n,e)}}(e))}n.API=s,n.TypedHTML=s(i.html),n.TypedSVG=s(i.svg)},{"../util/dom":91,"./manager":90}],89:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/uuid"),i=e("spica/sqid"),s=r.uuid().split("-").pop();n.uid=function(){return`id-${s}-${String(+i.sqid()).padStart(6,"0")}`}},{"spica/sqid":80,"spica/uuid":86}],90:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./identity");var i;!function(e){e.Void="void",e.Text="text",e.Collection="collection",e.Record="record"}(i||(i={}));const s=new WeakSet;function o({element:e}){if(null!==e.parentElement&&s.has(e.parentElement))throw new Error("TypedDOM: Cannot add an element used in another typed dom.")}n.El=class{constructor(e,t){switch(this.element_=e,this.children_=t,this.type=void 0===this.children_?i.Void:"string"==typeof this.children_?i.Text:Array.isArray(this.children_)?i.Collection:i.Record,this.tag,o(this),s.add(e),this.type){case i.Void:return;case i.Text:return c(),this.children_=e.appendChild(document.createTextNode("")),void(this.children=t);case i.Collection:return c(),this.children_=[],void(this.children=t);case i.Record:return c(),this.children_=(n=e,r=Object.assign({},t),Object.defineProperties(r,Object.entries(r).reduce((e,[t,r])=>(o(r),n.appendChild(r.element),e[t]={configurable:!0,enumerable:!0,get:()=>r,set:e=>{const t=r;e!==t&&(e.element_.parentElement===n||o(e),r=e,n.replaceChild(e.element,t.element))}},e),{}))),void(this.children=t)}var n,r;function c(){for(;e.childNodes.length>0;)e.removeChild(e.firstChild)}}get id(){return this.id_=this.id_||this.element_.id.trim()||r.uid()}get query(){return this.id===this.element_.id.trim()?`#${this.id}`:`.${this.id}`}scope(e){const t=/^(\s*)\$scope(?!\w)/gm;e.forEach(e=>e.element instanceof HTMLStyleElement&&void function(e,n){if(-1===e.innerHTML.search(t))return;e.innerHTML=e.innerHTML.replace(t,(e,t)=>`${t}${n}`);const r=n.slice(1);switch(n[0]){case".":if(!(e.getAttribute("class")||"").split(" ").includes(r))break;e.setAttribute("class",`${e.getAttribute("class")} ${r}`.trim())}0!==e.children.length&&[...e.querySelectorAll("*")].forEach(e=>void e.remove())}(e.element,this.query))}get element(){return this.element_}get children(){switch(this.type){case i.Text:return this.children_.data;default:return this.children_}}set children(e){switch(this.type){case i.Void:return;case i.Text:return e=document.createTextNode(e),this.element_.replaceChild(e,this.children_),void(this.children_=e);case i.Collection:return this.children_.reduce((e,t)=>{const n=e.indexOf(t);return n>-1?e:(e.splice(n,1),t.element.remove(),e)},[...e]),this.children_=[],e.forEach((e,t)=>{e.element_.parentElement===this.element_||o(e),this.children_[t]=e,this.element_.appendChild(e.element)}),Object.freeze(this.children_),void this.scope(Object.values(this.children_));case i.Record:return Object.keys(this.children_).forEach(t=>this.children_[t]=e[t]),void this.scope(Object.values(this.children_))}}}},{"./identity":89}],91:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.observe=function(e,t,n={childList:!0}){return(r,...i)=>{const s=new MutationObserver(t),o=e(r);return s.observe(o,n),c(o,...i),o}};const r=new Map;function i(e){return document.createTextNode(e)}var s;function o(e,t,n={},i=[]){const s=`${e}:${t}`,o=r.has(s)?r.get(s).cloneNode(!0):r.set(s,function(e,t){switch(e){case 0:return document.createElement(t);case 1:return document.createElementNS("http://www.w3.org/2000/svg",t);default:throw new Error(`TypedDOM: Unknown namespace: ${e}`)}}(e,t)).get(s).cloneNode(!0);return c(o,n,i),o}function c(e,t={},n=[]){return t[Symbol.iterator]?c(e,{},t):"string"==typeof n?c(e,t,[i(n)]):(Object.entries(t).forEach(([t,n])=>"string"==typeof n?void e.setAttribute(t,n):void e.addEventListener(t.slice(2),n,{passive:["wheel","mousewheel","touchstart","touchmove"].includes(t.slice(2))})),void[...n].forEach(t=>void e.appendChild(t)))}n.html=function(e,t={},n=[]){return o(0,e,t,n)},n.svg=function(e,t={},n=[]){return o(1,e,t,n)},n.frag=function(e=[]){e="string"==typeof e?[i(e)]:e;const t=document.createDocumentFragment();return[...e].forEach(e=>void t.appendChild(e)),t},n.text=i,function(e){e[e.HTML=0]="HTML",e[e.SVG=1]="SVG"}(s||(s={})),n.define=c},{}],92:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./noop");function i(e,t,n,r=!1,i={}){return"string"==typeof n?o(e,t,n,r,Object.assign({},"boolean"==typeof i?{capture:i}:i,{once:!0})):s(e,t,n,Object.assign({},"boolean"==typeof r?{capture:r}:r,{once:!0}))}function s(e,t,i,s=!1){e.addEventListener(t,u,a(s));let o=()=>(o=r.noop,void e.removeEventListener(t,u,a(s)));return()=>void o();function u(e){"object"==typeof s&&(s.passive&&(e.preventDefault=r.noop),s.once&&o()),n.currentTargets.set(e,e.currentTarget),i(e)}function a(e){return c?e:"boolean"==typeof e?e:!!e.capture}}function o(e,t,n,r,o={}){return s(e instanceof Document?e.documentElement:e,n,s=>{const c=s.target.closest(t);c&&[...e.querySelectorAll(t)].filter(e=>e===c).forEach(e=>void i(e,n,e=>{r(e)},o))},Object.assign({},o,{capture:!0}))}n.currentTargets=new WeakMap,n.listen=function(e,t,n,r=!1,i={}){return"string"==typeof n?o(e,t,n,r,i):s(e,t,n,r)},n.once=i,n.bind=s,n.delegate=o;let c=!1;try{document.createElement("div").addEventListener("test",function(){},{get capture(){return c=!0}})}catch(e){}},{"./noop":93}],93:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.noop=function(){}},{}],94:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("./layer/interface/service/gui");n.default=r.GUI;var i=e("./layer/interface/service/gui");n.Pjax=i.GUI;var s=e("./lib/router");n.router=s.router},{"./layer/interface/service/gui":126,"./lib/router":137}],95:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../domain/router/api");var i=e("../domain/event/router");n.RouterEvent=i.RouterEvent,n.RouterEventType=i.RouterEventType,n.RouterEventSource=i.RouterEventSource;var s=e("../domain/data/config");n.Config=s.Config,n.scope=s.scope,n.route=function(e,t,n,i){return r.route(new r.RouterEntity(e,t,new r.RouterEntityState(n.process,n.scripts)),i)}},{"../domain/data/config":99,"../domain/event/router":102,"../domain/router/api":103}],96:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("../domain/store/path");n.loadTitle=r.loadTitle,n.savePosition=r.savePosition},{"../domain/store/path":119}],97:[function(e,t,n){"use strict";var r;function i(e){return e.trim().replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g,e=>2===e.length?e:"").replace(/%(?![0-9A-F]{2})|[^%\[\]]+/gi,encodeURI).replace(/\?[^#]+/,e=>"?"+e.slice(1).replace(/%[0-9A-F]{2}|[^=&]/gi,e=>e.length<3?encodeURIComponent(e):e)).replace(/%[0-9A-F]{2}/gi,e=>e.toUpperCase()).replace(/#.+/,e.slice(e.indexOf("#")))}Object.defineProperty(n,"__esModule",{value:!0}),r||(r={}),n.standardizeUrl=function(e){return i(function(e){return s.href=e||location.href,s.href.replace(/^([^:/?#]+:\/\/[^/?#]*?):(?:80)?(?=$|[/?#])/,"$1").replace(/^([^:/?#]+:\/\/[^/?#]*)\/?/,"$1/").replace(/%[0-9A-F]{2}/gi,e=>e.toUpperCase()).replace(/#.+/,e.slice(e.indexOf("#")))}(e))},n._encode=i;const s=document.createElement("a")},{}],98:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/assign");function i(){window.history.replaceState(r.extend(window.history.state||{},{title:document.title}),document.title)}function s(){window.history.replaceState(r.extend(window.history.state||{},{position:{top:window.pageYOffset,left:window.pageXOffset}}),document.title)}i(),s(),n.loadTitle=function(){return window.history.state.title||document.title},n.saveTitle=i,n.loadPosition=function(){return window.history.state.position||{top:window.pageYOffset,left:window.pageXOffset}},n.savePosition=s},{"spica/assign":5}],99:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/assign");var s=e("./config/scope");n.scope=s.scope;n.Config=class{constructor(e){this.areas=["body"],this.link="a",this.form="form:not([method])",this.replace="",this.fetch={headers:new Headers,timeout:3e3,wait:0},this.update={head:"base, meta, link",css:!0,script:!0,ignore:"",ignores:{extension:'[href^="chrome-extension://"]',security:'[src*=".scr.kaspersky-labs.com/"]'},reload:"",logger:""},this.sequence=new o,this.progressbar="display:none;position:absolute;bottom:0;left:0;width:0;height:2px;background:rgb(40, 105, 255);",this.scope={},Object.defineProperties(this.update,{ignore:{enumerable:!1,set(e){this.ignores._=e},get(){return Object.keys(this.ignores).map(e=>this.ignores[e]).filter(e=>e.trim().length>0).join(",")}}}),i.extend(this,e),Object.freeze(this),this.fetch.headers.set("X-Pjax","1")}filter(e){return e.matches(":not([target])")}redirect(e){return e}rewrite(e,t){}fallback(e,t){if(e instanceof HTMLAnchorElement)window.location.assign(e.href);else if(e instanceof HTMLFormElement)window.location.assign(e.action);else{if(!(e instanceof Window))throw t;window.location.reload(!0)}}};class o{fetch(){return r(this,void 0,void 0,function*(){return"fetch"})}unload(){return r(this,void 0,void 0,function*(){return"unload"})}content(){return r(this,void 0,void 0,function*(){return"content"})}ready(){return r(this,void 0,void 0,function*(){return"ready"})}load(){return r(this,void 0,void 0,function*(){})}}},{"./config/scope":100,"spica/assign":5}],100:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../../lib/router"),i=e("../../../domain/data/config"),s=e("spica/sequence"),o=e("spica/maybe"),c=e("spica/assign");n.scope=function(e,t){const n=Object.assign({"/":{}},e.scope);return s.Sequence.from(Object.keys(n).sort().reverse()).dropWhile(e=>!r.compare(e,t.orig)&&!r.compare(e,t.dest)).take(1).filter(e=>!!r.compare(e,t.orig)&&r.compare(e,t.dest)).map(e=>n[e]).map(t=>t?o.Just(new i.Config(c.extend({},e,t))):o.Nothing).extract().reduce((e,t)=>t,o.Nothing)}},{"../../../../lib/router":137,"../../../domain/data/config":99,"spica/assign":5,"spica/maybe":19,"spica/sequence":79}],101:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../lib/error");n.DomainError=class extends r.PjaxError{constructor(e){super(`Domain: ${e}`)}}},{"../../../lib/error":135}],102:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../lib/url"),i=e("../../data/model/domain/url"),s=e("../../../lib/dom"),o=e("typed-dom");var c,u;n.RouterEvent=class{constructor(e){this.original=e,this.type=this.original.type.toLowerCase(),this.source=o.currentTargets.get(this.original),this.request=new a(this.source),this.location=new l(this.request.url),Object.freeze(this)}},function(e){e.Anchor=HTMLAnchorElement,e.Form=HTMLFormElement,e.Window=window.Window}(c=n.RouterEventSource||(n.RouterEventSource={})),function(e){e.click="click",e.submit="submit",e.popstate="popstate"}(n.RouterEventType||(n.RouterEventType={})),function(e){e.GET="GET",e.POST="POST"}(u=n.RouterEventMethod||(n.RouterEventMethod={}));class a{constructor(e){this.source=e,this.method=(()=>{if(this.source instanceof c.Anchor)return u.GET;if(this.source instanceof c.Form)return this.source.method.toUpperCase()===u.POST?u.POST:u.GET;if(this.source instanceof c.Window)return u.GET;throw new TypeError})(),this.url=(()=>{if(this.source instanceof c.Anchor)return i.standardizeUrl(this.source.href);if(this.source instanceof c.Form)return this.source.method.toUpperCase()===u.GET?i.standardizeUrl(this.source.action.split(/[?#]/)[0]+`?${s.serialize(this.source)}`):i.standardizeUrl(this.source.action.split(/[?#]/)[0]);if(this.source instanceof c.Window)return i.standardizeUrl(window.location.href);throw new TypeError})(),this.body=(()=>this.source instanceof c.Form&&this.method===u.POST?new FormData(this.source):null)(),Object.freeze(this)}}n.RouterEventRequest=a;class l{constructor(e){this.target=e,this.orig=new r.URL(i.standardizeUrl(window.location.href)),this.dest=new r.URL(this.target),Object.freeze(this)}}n.RouterEventLocation=l},{"../../../lib/dom":134,"../../../lib/url":138,"../../data/model/domain/url":97,"typed-dom":87}],103:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/either"),s=e("./module/fetch"),o=e("./module/update"),c=e("./module/update/content"),u=e("../store/path"),a=e("../data/error");var l=e("./model/eav/entity");n.RouterEntity=l.RouterEntity,n.RouterEntityState=l.RouterEntityState,n.route=function(e,t){return r(this,void 0,void 0,function*(){return i.Right(void 0).bind(e.state.process.either).bind(()=>(n=t.document,l=e.config.areas,c.separate({src:n,dst:n},l).extract(()=>!1,()=>!0)?i.Right(void 0):i.Left(new a.DomainError("Failed to match areas.")))).fmap(()=>s.fetch(e.event.request,e.config,e.state.process)).fmap(n=>r(this,void 0,void 0,function*(){return(yield n).fmap(([n,r])=>o.update(e,n,r,{document:t.document,position:u.loadPosition})).extract(i.Left)})).extract(i.Left);var n,l})}},{"../data/error":101,"../store/path":119,"./model/eav/entity":104,"./module/fetch":106,"./module/update":108,"./module/update/content":110,"spica/either":13}],104:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.RouterEntity=class{constructor(e,t,n){this.config=e,this.event=t,this.state=n,Object.freeze(this)}};n.RouterEntityState=class{constructor(e,t){this.process=e,this.scripts=t,Object.freeze(this)}}},{}],105:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../../../../lib/html");n.FetchResponse=class{constructor(e,t){this.url=e,this.xhr=t,this.header=(e=>this.xhr.getResponseHeader(e)),this.document=this.xhr.response,r.fix(this.document),Object.freeze(this)}}},{"../../../../../../lib/html":136}],106:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/either"),s=e("spica/tuple"),o=e("../module/fetch/xhr"),c=e("../../data/error"),u=e("../../../../lib/url");n.fetch=function({method:e,url:t,body:n},{redirect:a,fetch:{headers:l,timeout:d,wait:h},sequence:f},p){return r(this,void 0,void 0,function*(){const r=o.xhr(e,t,l,n,d,a,p);window.dispatchEvent(new Event("pjax:fetch"));const[m,v]=yield Promise.all([r,f.fetch(void 0,{path:new u.URL(t).path,method:e,headers:l,body:n}),new Promise(e=>void setTimeout(e,h))]);return m.bind(p.either).bind(e=>new u.URL(e.url).origin===new u.URL(t).origin?i.Right(s.tuple([e,v])):i.Left(new c.DomainError(`Request is redirected to the different domain url ${new u.URL(e.url).href}`)))})}},{"../../../../lib/url":138,"../../data/error":101,"../module/fetch/xhr":107,"spica/either":13,"spica/tuple":83}],107:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/promise"),i=e("spica/sequence"),s=e("spica/either"),o=e("../../model/eav/value/fetch"),c=e("../../../../data/model/domain/url"),u=e("../../../data/error"),a=e("../../../../../lib/url");function l(e,t){return i.Sequence.intersect(i.Sequence.from(n(e||"").sort()),i.Sequence.from(n(t).sort()),(e,t)=>e.localeCompare(t)).take(1).extract().length>0;function n(e){return e.split(";").map(e=>e.trim()).filter(e=>e.length>0)}}n.xhr=function(e,t,n,i,d,h,f){const p=c.standardizeUrl(h(new a.URL(t).path)),m=new XMLHttpRequest;return new r.AtomicPromise(r=>(m.open(e,new a.URL(p).path,!0),[...n.entries()].forEach(([e,t])=>void m.setRequestHeader(e,t)),m.responseType="document",m.timeout=d,m.send(i),m.addEventListener("abort",()=>void r(s.Left(new u.DomainError("Failed to request a page by abort.")))),m.addEventListener("error",()=>void r(s.Left(new u.DomainError("Failed to request a page by error.")))),m.addEventListener("timeout",()=>void r(s.Left(new u.DomainError("Failed to request a page by timeout.")))),m.addEventListener("load",()=>void function(e){return s.Right(e).bind(e=>/2..|304/.test(`${e.status}`)?s.Right(e):s.Left(new u.DomainError("Faild to validate the status of response."))).bind(e=>l(e.getResponseHeader("Content-Type"),"text/html")?s.Right(e):s.Left(new u.DomainError("Faild to validate the content type of response.")))}(m).fmap(e=>new o.FetchResponse(e.responseURL&&t===p?c.standardizeUrl(e.responseURL):t,e)).extract(e=>void r(s.Left(e)),e=>void r(s.Right(e)))),void f.register(()=>void m.abort())))},n.match_=l},{"../../../../../lib/url":138,"../../../../data/model/domain/url":97,"../../../data/error":101,"../../model/eav/value/fetch":105,"spica/either":13,"spica/promise":78,"spica/sequence":79}],108:[function(e,t,n){(function(t){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/either"),s=e("spica/hlist"),o=e("spica/tuple"),c=e("../../event/router"),u=e("../module/update/blur"),a=e("../module/update/url"),l=e("../module/update/title"),d=e("../module/update/head"),h=e("../module/update/content"),f=e("../module/update/css"),p=e("../module/update/script"),m=e("../module/update/focus"),v=e("../module/update/scroll"),b=e("../../store/path"),y=e("../../data/error");n.update=function({event:e,config:t,state:n},w,q,S){return r(this,void 0,void 0,function*(){const{process:g}=n,_={src:w.document,dst:S.document};return(new s.HNil).push(g.either(q)).modify(e=>e.bind(()=>h.separate(_,t.areas).extract(()=>i.Left(new y.DomainError("Failed to separate the areas.")),()=>e)).fmap(e=>r(this,void 0,void 0,function*(){return window.dispatchEvent(new Event("pjax:unload")),g.either(yield t.sequence.unload(e,w))})).fmap(e=>r(this,void 0,void 0,function*(){return(yield e).bind(e=>h.separate(_,t.areas).fmap(([t])=>[e,t]).extract(()=>i.Left(new y.DomainError("Failed to separate the areas.")),g.either))})).fmap(e=>r(this,void 0,void 0,function*(){return(yield e).bind(([e,n])=>(t.rewrite(_.src,n),h.separate(_,t.areas).fmap(([,t])=>[e,t]).extract(()=>i.Left(new y.DomainError("Failed to separate the areas.")),g.either)))}))).modify(y=>y.fmap(y=>r(this,void 0,void 0,function*(){return(yield y).bind(g.either).fmap(([y,q])=>(new s.HNil).extend(()=>r(this,void 0,void 0,function*(){return u.blur(_.dst),a.url(new c.RouterEventLocation(w.url),_.src.title,e.type,e.source,t.replace),l.title(_),b.saveTitle(),d.head(_,t.update.head,t.update.ignore),g.either(h.content(_,q)).fmap(([e,t])=>[e,Promise.all(t)])})).extend(s=>r(this,void 0,void 0,function*(){return(yield s).fmap(([i])=>r(this,void 0,void 0,function*(){t.update.css&&f.css(_,t.update.ignore),S.document.dispatchEvent(new Event("pjax:content"));const r=yield t.sequence.content(y,i),s=t.update.script?yield p.script(_,n.scripts,t.update,10*Math.max(t.fetch.timeout,1e3),g):yield g.either(o.tuple([[],Promise.resolve(g.either([]))]));return m.focus(e.type,_.dst),v.scroll(e.type,_.dst,{hash:e.location.dest.fragment,position:S.position}),b.savePosition(),S.document.dispatchEvent(new Event("pjax:ready")),o.tuple([s.fmap(([e,t])=>[e,t.then(e=>e.extract())]),yield t.sequence.ready(r)])})).fmap(e=>e.then(([e,t])=>e.fmap(e=>[e,t]))).extract(e=>r(this,void 0,void 0,function*(){return i.Left(e)}))})).reverse().tuple())}))).modify(e=>e.fmap(e=>r(this,void 0,void 0,function*(){return(yield e).bind(g.either).fmap(([e,n])=>r(this,void 0,void 0,function*(){return g.either(yield Promise.all([e,n])).bind(([e,n])=>e.bind(([,e])=>n.fmap(([[,n],r])=>void Promise.all([e,n]).then(g.either).then(e=>e.fmap(([e])=>(window.dispatchEvent(new Event("pjax:load")),void t.sequence.load(r,e))).extract(()=>void 0))))).extract(()=>void 0),n})).fmap(e=>r(this,void 0,void 0,function*(){return(yield e).fmap(([e])=>e)})).extract(i.Left)}))).head.extract(i.Left)})}}).call(this,e("_process"))},{"../../data/error":101,"../../event/router":102,"../../store/path":119,"../module/update/blur":109,"../module/update/content":110,"../module/update/css":111,"../module/update/focus":112,"../module/update/head":113,"../module/update/script":114,"../module/update/scroll":115,"../module/update/title":117,"../module/update/url":118,_process:4,"spica/either":13,"spica/hlist":18,"spica/tuple":83}],109:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.blur=function(e){e===window.document&&e.activeElement!==e.body&&(e.activeElement.blur(),e.body.focus())}},{}],110:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/promise"),i=e("spica/maybe"),s=e("spica/concat"),o=e("spica/tuple"),c=e("typed-dom"),u=e("../../../../../lib/dom"),a=e("./script");function l(e){return(e.match(/(?:[^,\(\[]+|\(.*?\)|\[.*?\])+/g)||[]).map(e=>e.trim())}function d(e){return r.AtomicPromise.race([new r.AtomicPromise(t=>void c.once(e,"load",t)),new r.AtomicPromise(t=>void c.once(e,"abort",t)),new r.AtomicPromise(t=>void c.once(e,"error",t))])}n.content=function(e,t,n={replace:(e,t)=>void t.parentNode.replaceChild(e,t)}){return[t.map(e=>e.dst).reduce(s.concat,[]),t.map(function(t){return t.src.map((n,r)=>({src:e.dst.importNode(t.src[r].cloneNode(!0),!0),dst:t.dst[r]})).map(e=>(!function(e){const t=u.find(e.src,"script").map(a.escape).reduce((e,t)=>()=>(e(),void t()),()=>void 0);n.replace(e.src,e.dst),t()}(e),u.find(e.src,"img, iframe, frame").map(d))).reduce(s.concat,[])}).reduce(s.concat,[])]},n.separate=function(e,t){return t.reduce((t,n)=>i.Maybe.mplus(t,function(e,t){return l(t).map(t=>({src:u.find(e.src,t),dst:u.find(e.dst,t)})).reduce((e,t)=>e.bind(e=>(function(e){return i.Just(e).guard(function(e){return e.src.length>0&&e.src.length===e.dst.length}(e))})(t).fmap(t=>s.concat(e,[t]))),i.Just([]))}(e,n).fmap(e=>o.tuple([n,e]))),i.Nothing)},n._split=l,n._wait=d},{"../../../../../lib/dom":134,"./script":114,"spica/concat":11,"spica/maybe":19,"spica/promise":78,"spica/tuple":83,"typed-dom":87}],111:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../../../lib/dom"),i=e("./sync");n.css=function(e,t){const n='link[rel~="stylesheet"], style';return void["head","body"].map(t=>[e.src.querySelector(t),e.dst.querySelector(t)]).forEach(([e,t])=>void i.sync(i.pair(s(e),s(t),(e,t)=>e.outerHTML===t.outerHTML),t));function s(e){return r.find(e,n).filter(e=>!e.matches(t.trim()||"_"))}}},{"../../../../../lib/dom":134,"./sync":116}],112:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../event/router"),i=e("../../../../../lib/dom");n.focus=function(e,t){switch(e){case r.RouterEventType.click:case r.RouterEventType.submit:return void i.find(t,"[autofocus]").slice(-1).filter(e=>e.closest("html")===window.document.documentElement&&e!==t.activeElement).forEach(e=>void e.focus());case r.RouterEventType.popstate:return;default:throw new TypeError(e)}}},{"../../../../../lib/dom":134,"../../../event/router":102}],113:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./sync"),i=e("../../../../../lib/dom");n.head=function(e,t,n){return n+=t.includes("link")?', link[rel~="stylesheet"]':"",void r.sync(r.pair(s(e.src.head),s(e.dst.head),(e,t)=>e.outerHTML===t.outerHTML),e.dst.head);function s(e){return i.find(e,t).filter(e=>!e.matches(n.trim()||"_"))}}},{"../../../../../lib/dom":134,"./sync":116}],114:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/promise"),s=e("spica/either"),o=e("spica/tuple"),c=e("spica/concat"),u=e("../../../../../lib/dom"),a=e("../../../../../lib/error"),l=e("../../../../../lib/url"),d=e("../../../../data/model/domain/url"),h=e("typed-dom");function f(e,t){return r(this,void 0,void 0,function*(){if(!e.hasAttribute("src"))return s.Right([e,e.text]);if("module"===e.type.toLowerCase())return s.Right([e,""]);const n=new XMLHttpRequest;return n.open("GET",e.src,!0),n.timeout=t,n.send(),new i.AtomicPromise(t=>["load","abort","error","timeout"].forEach(r=>{switch(r){case"load":return void n.addEventListener(r,()=>void t(s.Right([e,n.response])));default:return void n.addEventListener(r,()=>"error"===r&&e.matches("[src][async]")?void t(v(e).then(()=>s.Right([e,""]),()=>s.Left(new Error(`${e.src}: ${n.statusText}`)))):void t(s.Left(new Error(`${e.src}: ${n.statusText}`))))}}))})}function p(t,n,r,o,c,u){const h=!!(t=t.ownerDocument===document?t:document.importNode(t.cloneNode(!0),!0)).parentElement&&t.parentElement.matches(r.trim()||"_"),f=document.querySelector(h?t.parentElement.id?`#${t.parentElement.id}`:t.parentElement.tagName:"_")||document.body,p=m(t);f.appendChild(t),p(),!h&&t.remove();const b=i.AtomicPromise.resolve(c).then(u.promise).then(function(){if(t.matches('[type="module"][src]'))return i.AtomicPromise.resolve(Promise.resolve().then(()=>e(t.src))).catch(e=>e.message.startsWith("Failed to load ")&&t.matches("[src][async]")?v(t).catch(()=>i.AtomicPromise.reject(e)):i.AtomicPromise.reject(e)).then(()=>(t.dispatchEvent(new Event("load")),s.Right(t)),e=>(t.dispatchEvent(new Event("error")),s.Left(new a.FatalError(e instanceof Error?e.message:e+""))));try{if(new l.URL(d.standardizeUrl(window.location.href)).path!=new l.URL(d.standardizeUrl(window.location.href)).path)throw new a.FatalError("Expired.");if(o.has(new l.URL(d.standardizeUrl(window.location.href)).href))throw new a.FatalError("Expired.");return(0,eval)(n),t.hasAttribute("src")&&t.dispatchEvent(new Event("load")),i.AtomicPromise.resolve(s.Right(t))}catch(e){return t.hasAttribute("src")&&t.dispatchEvent(new Event("error")),i.AtomicPromise.resolve(s.Left(new a.FatalError(e instanceof Error?e.message:e+"")))}});return t.matches("[src][async]")?s.Right(b):s.Left(b)}function m(e){const t=e.hasAttribute("src")?e.getAttribute("src"):null,n=e.text;return e.removeAttribute("src"),e.text="",()=>(e.text=" ",e.text=n,"string"==typeof t?void e.setAttribute("src",t):void 0)}function v(e){return new l.URL(d.standardizeUrl(e.src)).origin===new l.URL(d.standardizeUrl(window.location.href)).origin?i.AtomicPromise.reject(new Error):(e=h.html("script",Object.values(e.attributes).reduce((e,{name:t,value:n})=>(e[t]=n,e),{}),[...e.childNodes]),new i.AtomicPromise((t,n)=>(e.addEventListener("load",()=>void t()),e.addEventListener("error",n),document.body.appendChild(e),void e.remove())))}n.script=function(e,t,n,a,h,m={fetch:f,evaluate:p}){const v=u.find(e.src,"script").filter(e=>!e.type||/(?:application|text)\/(?:java|ecma)script|module/i.test(e.type)).filter(e=>!e.matches(n.ignore.trim()||"_")).filter(e=>!e.hasAttribute("src")||!t.has(new l.URL(d.standardizeUrl(e.src)).href)||e.matches(n.reload.trim()||"_")),{ss:b,as:y}=v.reduce((e,t)=>{switch(!0){case t.matches("[src][async], [src][defer]"):e.as.push(t);break;default:e.ss.push(t)}return e},{ss:[],as:[]});return i.AtomicPromise.all([i.AtomicPromise.all(w(b)).then(q),i.AtomicPromise.all(w(y)).then(q)]).then(([e,t])=>r(this,void 0,void 0,function*(){return e.fmap(e=>r(this,void 0,void 0,function*(){return(yield e).fmap(([e,n])=>o.tuple([e,n.then(e=>r(this,void 0,void 0,function*(){return t.fmap(t=>r(this,void 0,void 0,function*(){return(yield t).fmap(([t,n])=>i.AtomicPromise.all([e,s.Right(t),n]).then(e=>e.reduce((e,t)=>e.bind(e=>t.fmap(t=>c.concat(e,t)))))).extract(s.Left)})).extract(s.Left)}))]))})).extract(s.Left)}));function w(e){return e.map(e=>m.fetch(e,a))}function q(e){return e.reduce((e,t)=>t.bind(()=>e),e.reduce((e,r)=>e.bind(h.either).bind(([e,u])=>r.fmap(([r,s])=>m.evaluate(r,s,n.logger,t,i.AtomicPromise.all(e),h)).bind(t=>t.extract(t=>s.Right(o.tuple([c.concat(e,[t]),u])),t=>s.Right(o.tuple([e,c.concat(u,[t])]))))),s.Right([[],[]]))).fmap(([e,t])=>i.AtomicPromise.all(e).then(s.Either.sequence).then(e=>e.fmap(e=>o.tuple([e,Promise.all(t).then(s.Either.sequence)]))))}},n._fetch=f,n._evaluate=p,n.escape=m},{"../../../../../lib/dom":134,"../../../../../lib/error":135,"../../../../../lib/url":138,"../../../../data/model/domain/url":97,"spica/concat":11,"spica/either":13,"spica/promise":78,"spica/tuple":83,"typed-dom":87}],115:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../event/router");function i(e,t,n={scrollToElement:e=>void e.scrollIntoView()}){const r=t.slice(1);if(0===r.length)return!1;const i=e.getElementById(r)||e.getElementsByName(r)[0];return!!i&&(n.scrollToElement(i),!0)}n.scroll=function(e,t,n,s={scrollToElement:e=>void e.scrollIntoView(),scrollToPosition:({top:e,left:t})=>void window.scrollTo(t,e),hash:i}){switch(e){case r.RouterEventType.click:if(s.hash(t,n.hash,s))return;return void s.scrollToPosition({top:0,left:0});case r.RouterEventType.submit:return void s.scrollToPosition({top:0,left:0});case r.RouterEventType.popstate:return void s.scrollToPosition(n.position());default:throw new TypeError(e)}},n._hash=i},{"../../../event/router":102}],116:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/either"),i=e("spica/concat"),s=e("spica/tuple");n.sync=function(e,t,n={before:function(e,t,n){t.map(t=>e.ownerDocument.importNode(t.cloneNode(!0),!0)).forEach(t=>void e.insertBefore(t,n))},remove:function(e){e.remove()}}){return void e.forEach(([e,r])=>(n.before((r=r,r?r.parentElement:t),e.slice(-1).some(e=>!!r&&e.outerHTML===r.outerHTML)?e.slice(0,-1):e,r),r&&0===e.length?void n.remove(r):void 0));var r},n.pair=function(e,t,n){const o=function(e,t,n){return e.reduce((e,s)=>0===t.length?e.set(null,i.concat(e.get(null)||[],[s])):t.reduce((e,t)=>e.bind(e=>!e.has(t)&&n(s,t)?(e.set(t,i.concat(e.get(null)||[],[s])),e.delete(null),r.Left(e)):r.Right(e)),r.Right(e)).fmap(e=>e.set(null,i.concat(e.get(null)||[],[s]))).extract(e=>e),new Map)}(e,t,n);return t.filter(e=>!o.has(e)).forEach(e=>void o.set(e,[])),[...o].map(([e,t])=>s.tuple([t,e]))}},{"spica/concat":11,"spica/either":13,"spica/tuple":83}],117:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.title=function(e){e.dst.title=e.src.title}},{}],118:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../event/router");function i(e,t){if(t.dest.href===t.orig.href)return!1;switch(e){case r.RouterEventType.click:case r.RouterEventType.submit:return!0;case r.RouterEventType.popstate:return!1;default:throw new TypeError(e)}}function s(e,t,n){switch(e){case r.RouterEventType.click:case r.RouterEventType.submit:return t.matches(n.trim()||"_");case r.RouterEventType.popstate:return!1;default:throw new TypeError(e)}}e("typed-dom").bind(document,"pjax:ready",()=>void window.history.replaceState(window.history.state,window.document.title)),n.url=function(e,t,n,r,o){switch(!0){case s(n,r,o):return void window.history.replaceState({},t,e.dest.href);case i(n,e):return void window.history.pushState({},t,e.dest.href);default:return}},n._isRegisterable=i,n._isReplaceable=s},{"../../../event/router":102,"typed-dom":87}],119:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("../../data/store/state"))},{"../../data/store/state":98}],120:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../lib/error");n.InterfaceError=class extends r.PjaxError{constructor(e){super(`Interface: ${e}`)}}},{"../../../lib/error":135}],121:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy"),i=e("spica/promise"),s=e("typed-dom");n.ClickView=class{constructor(e,t,n){this.sv=new class extends r.Supervisor{},this.close=(()=>void this.sv.terminate()),this.sv.register("",()=>new i.AtomicPromise(()=>void this.sv.events.exit.monitor([],s.delegate(e,t,"click",e=>{e.currentTarget instanceof HTMLAnchorElement&&"string"==typeof e.currentTarget.href&&n(e)}))),void 0),this.sv.cast("",void 0)}}},{"spica/promise":78,"spica/supervisor.legacy":81,"typed-dom":87}],122:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy"),i=e("spica/promise"),s=e("typed-dom"),o=e("../../../data/model/domain/url"),c=e("../../service/state/url");n.NavigationView=class{constructor(e,t){this.sv=new class extends r.Supervisor{},this.close=(()=>void this.sv.terminate()),this.sv.register("",()=>new i.AtomicPromise(()=>void this.sv.events.exit.monitor([],s.bind(e,"popstate",n=>{o.standardizeUrl(e.location.href)!==c.docurl.href&&t(n)}))),void 0),this.sv.cast("",void 0)}}},{"../../../data/model/domain/url":97,"../../service/state/url":133,"spica/promise":78,"spica/supervisor.legacy":81,"typed-dom":87}],123:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy"),i=e("spica/promise"),s=e("typed-dom"),o=e("spica/throttle");n.ScrollView=class{constructor(e,t){this.sv=new class extends r.Supervisor{},this.close=(()=>void this.sv.terminate()),this.sv.register("",()=>new i.AtomicPromise(()=>void this.sv.events.exit.monitor([],s.bind(e,"scroll",o.debounce(100,e=>{t(e)}),{passive:!0}))),void 0),this.sv.cast("",void 0)}}},{"spica/promise":78,"spica/supervisor.legacy":81,"spica/throttle":82,"typed-dom":87}],124:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy"),i=e("spica/promise"),s=e("typed-dom");n.SubmitView=class{constructor(e,t,n){this.sv=new class extends r.Supervisor{},this.close=(()=>void this.sv.terminate()),this.sv.register("",()=>new i.AtomicPromise(()=>void this.sv.events.exit.monitor([],s.delegate(e,t,"submit",e=>{e.currentTarget instanceof HTMLFormElement&&n(e)}))),void 0),this.sv.cast("",void 0)}}},{"spica/promise":78,"spica/supervisor.legacy":81,"typed-dom":87}],125:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./router"),i=e("./state/process"),s=e("../../../lib/html"),o=e("spica/assign"),c=e("typed-dom");function u(e,t){const n=document.createElement("a");n.href=e,s.parse("").extract().body.appendChild(n),c.once(n,"click",t),n.click()}n.API=class{static assign(e,t,n={document:window.document,router:r.route}){u(e,e=>void n.router(new r.Config(t),new r.RouterEvent(e),i.process,n))}static replace(e,t,n={document:window.document,router:r.route}){u(e,e=>void n.router(new r.Config(o.extend({},t,{replace:"*"})),new r.RouterEvent(e),i.process,n))}}},{"../../../lib/html":136,"./router":128,"./state/process":130,"spica/assign":5,"typed-dom":87}],126:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./api"),i=e("spica/supervisor.legacy"),s=e("spica/cancellation"),o=e("spica/promise"),c=e("../../../lib/url"),u=e("../../data/model/domain/url"),a=e("../module/view/click"),l=e("../module/view/submit"),d=e("../module/view/navigation"),h=e("../module/view/scroll"),f=e("./router"),p=e("./state/url");e("./state/scroll-restoration");const m=e("./state/process"),v=e("../../application/store"),b=new class extends i.Supervisor{};n.GUI=class extends r.API{constructor(e,t={document:window.document,router:f.route}){super(),this.option=e,this.io=t;const n=new f.Config(this.option);b.register("",{init:e=>e,main:(e,r)=>new o.AtomicPromise(()=>{r.register(new a.ClickView(this.io.document,n.link,e=>void t.router(n,new f.RouterEvent(e),m.process,t)).close),r.register(new l.SubmitView(this.io.document,n.form,e=>void t.router(n,new f.RouterEvent(e),m.process,t)).close),r.register(new d.NavigationView(window,e=>void t.router(n,new f.RouterEvent(e),m.process,t)).close),r.register(new h.ScrollView(window,()=>{r.canceled||new c.URL(u.standardizeUrl(window.location.href)).href===p.docurl.href&&v.savePosition()}).close)}),exit:(e,t)=>void t.cancel()},new s.Cancellation,new Error("Kill")),b.cast("",void 0)}assign(e){r.API.assign(e,this.option,this.io)}replace(e){r.API.replace(e,this.option,this.io)}}},{"../../../lib/url":138,"../../application/store":96,"../../data/model/domain/url":97,"../module/view/click":121,"../module/view/navigation":122,"../module/view/scroll":123,"../module/view/submit":124,"./api":125,"./router":128,"./state/process":130,"./state/scroll-restoration":132,"./state/url":133,"spica/cancellation":7,"spica/promise":78,"spica/supervisor.legacy":81}],127:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=document.createElement("div");window.addEventListener("pjax:fetch",()=>void document.documentElement.appendChild(r)),window.addEventListener("pjax:fetch",()=>r.style.width="5%"),window.addEventListener("pjax:unload",()=>r.style.width="80%"),document.addEventListener("pjax:ready",()=>r.style.width="90%"),window.addEventListener("pjax:load",()=>r.style.width="100%"),window.addEventListener("pjax:load",()=>void r.remove()),n.progressbar=function(e){r.setAttribute("style",e)}},{}],128:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/cancellation"),s=e("typed-dom"),o=e("../../application/router");n.Config=o.Config,n.RouterEvent=o.RouterEvent,n.RouterEventSource=o.RouterEventSource;const c=e("./state/url"),u=e("../service/state/env"),a=e("./progressbar"),l=e("../data/error"),d=e("../../../lib/url"),h=e("../../data/model/domain/url"),f=e("../../application/store"),p=e("spica/maybe");function m(e,t,n){switch(n.type){case o.RouterEventType.click:return r(e)&&!function(e){const t=new d.URL(c.docurl.href);return t.origin===e.origin&&t.path===e.path&&""!==e.fragment}(e)&&!i(e)&&!n.source.hasAttribute("download")&&!function(e){return e.which>1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey}(n.original)&&t.filter(n.source);case o.RouterEventType.submit:return r(e);case o.RouterEventType.popstate:return r(e)&&!i(e);default:return!1}function r(e){return new d.URL(c.docurl.href).origin===e.origin}function i(e){const t=new d.URL(c.docurl.href);return t.origin===e.origin&&t.path===e.path&&t.fragment!==e.fragment}}s.bind(window,"pjax:unload",()=>window.history.scrollRestoration="auto",!0),n.route=function(e,t,n,v){switch(t.type){case o.RouterEventType.click:case o.RouterEventType.submit:f.savePosition();break;case o.RouterEventType.popstate:v.document.title=f.loadTitle()}p.Just(0).guard(m(new d.URL(t.request.url),e,t)).bind(()=>o.scope(e,(({orig:e,dest:t})=>({orig:e.pathname,dest:t.pathname}))(t.location))).fmap(e=>r(this,void 0,void 0,function*(){t.original.preventDefault(),n.cast("",new l.InterfaceError("Aborted."));const f=new i.Cancellation,p=n.register("",e=>(p(),f.cancel(e),new Promise(()=>void 0)),void 0),[m]=yield u.env;return window.history.scrollRestoration="manual",a.progressbar(e.progressbar),o.route(e,t,{process:f,scripts:m},v).then(e=>e.fmap(([e,t])=>r(this,void 0,void 0,function*(){return p(),c.docurl.sync(),e.filter(e=>e.hasAttribute("src")).forEach(e=>void m.add(new d.URL(h.standardizeUrl(e.src)).href)),void(yield t).filter(e=>e.hasAttribute("src")).forEach(e=>void m.add(new d.URL(h.standardizeUrl(e.src)).href))})).extract()).catch(n=>(p(),c.docurl.sync(),window.history.scrollRestoration="auto",!f.canceled||n instanceof Error&&"FatalError"===n.name?void e.fallback(s.currentTargets.get(t.original),n):void 0))})).extract(()=>r(this,void 0,void 0,function*(){switch(c.docurl.sync(),t.type){case o.RouterEventType.click:case o.RouterEventType.submit:return;case o.RouterEventType.popstate:return void e.fallback(t.source,new Error("Disabled."))}}))},n._validate=m},{"../../../lib/url":138,"../../application/router":95,"../../application/store":96,"../../data/model/domain/url":97,"../data/error":120,"../service/state/env":129,"./progressbar":127,"./state/url":133,"spica/cancellation":7,"spica/maybe":19,"typed-dom":87}],129:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./script");n.env=Promise.all([r.scripts,new Promise(setTimeout)])},{"./script":131}],130:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy");n.process=new class extends r.Supervisor{}},{"spica/supervisor.legacy":81}],131:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../data/model/domain/url"),i=e("../../../../lib/url"),s=e("../../../../lib/dom"),o=e("typed-dom");n.scripts=new Set,o.bind(window,"pjax:unload",()=>void s.find(document,"script[src]").forEach(e=>void n.scripts.add(new i.URL(r.standardizeUrl(e.src)).href)))},{"../../../../lib/dom":134,"../../../../lib/url":138,"../../../data/model/domain/url":97,"typed-dom":87}],132:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),e("typed-dom").bind(window,"unload",()=>window.history.scrollRestoration="auto",!1)},{"typed-dom":87}],133:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../data/model/domain/url"),i=e("typed-dom");let s=r.standardizeUrl(location.href);i.bind(window,"hashchange",()=>void n.docurl.sync()),n.docurl=new class{constructor(){this.sync=(()=>{s=r.standardizeUrl(location.href)})}get href(){return s}}},{"../../../data/model/domain/url":97,"typed-dom":87}],134:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.find=function(e,t){return[...e.querySelectorAll(t||"_")]},n.serialize=function(e){return Array.from(e.elements).filter(e=>{if(e.disabled)return!1;switch(e.nodeName.toLowerCase()){case"input":switch(e.type.toLowerCase()){case"checkbox":case"radio":return e.checked;case"submit":case"button":case"image":case"reset":case"file":return!1;default:return!0}case"select":case"textarea":return!0;default:return!1}}).filter(e=>"string"==typeof e.name&&"string"==typeof e.value).map(e=>[encodeURIComponent(t(e.name)),encodeURIComponent(t(e.value))].join("=")).join("&");function t(e){return e.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g,e=>2===e.length?e:"")}}},{}],135:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});class r extends Error{constructor(e){super(`Pjax: ${e}`)}}n.PjaxError=r;n.FatalError=class extends r{constructor(e){super(`Pjax: Fatal: ${e}`),this.name="FatalError"}}},{}],136:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/maybe"),i=e("spica/either"),s=e("spica/tuple"),o=e("./dom");function c(e){u(e).forEach(([e,t])=>e.textContent=t.textContent)}function u(e){return o.find(e,"noscript").filter(e=>e.children.length>0).map(e=>{const t=e.cloneNode(!0);return t.textContent=e.innerHTML,s.tuple([e,t])})}n.parse=[function(e){const t=(new DOMParser).parseFromString(e,"text/html");return c(t),t},function(e){const t=window.document.implementation.createHTMLDocument("");return t.open(),t.write(e),t.close(),c(t),t}].reduce((e,t)=>e.bind(()=>!function(e){try{const t='\n<html lang="en" class="html">\n  <head>\n    <link href="/">\n    <title>&amp;</title>\n    <noscript><style>/**/</style></noscript>\n  </head>\n  <body>\n    <noscript>noscript</noscript>\n    <a href="/"></a>\n    <script>document.head.remove();<\/script>\n    <img src="abc">\n  </body>\n</html>\n',n=e(t);switch(!1){case n.URL&&n.URL.startsWith(`${window.location.protocol}//${window.location.host}`):case"&"===n.title:case!!n.querySelector('html.html[lang="en"]'):case!!n.querySelector("head > link").href:case!!n.querySelector("body > a").href:case!n.querySelector("head > noscript > *"):case"document.head.remove();"===n.querySelector("script").innerHTML:case n.querySelector("img").src.endsWith("abc"):case"<style>/**/</style>"===n.querySelector("head > noscript").textContent:case"noscript"===n.querySelector("body > noscript").textContent:throw void 0}return!0}catch(e){return!1}}(t)?e:i.Left(t)),i.Right(()=>r.Nothing)).extract(e=>t=>r.Just(e(t))),n.fix=c,n._fixNoscript=u},{"./dom":134,"spica/either":13,"spica/maybe":19,"spica/tuple":83}],137:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../layer/data/model/domain/url"),i=e("./url"),s=e("spica/sequence"),o=e("spica/uncurry"),c=e("spica/flip"),u=e("spica/cache");function a(e,t){const n=/\/|[^/]+\/?/g,r=/\/$/;return s.Sequence.zip(s.Sequence.from(l(e)),s.Sequence.cycle([t])).map(([e,t])=>[e.match(n)||[],e.match(r)?t.match(n)||[]:t.replace(r,"").match(n)||[]]).filter(([e,t])=>e.length<=t.length&&0===s.Sequence.zip(s.Sequence.from(e),s.Sequence.from(t)).dropWhile(o.uncurry(h)).take(1).extract().length).take(1).extract().length>0}function l(e){if(e.match(/\*\*|[\[\]]/))throw new Error(`Invalid pattern: ${e}`);return""===e?[e]:s.Sequence.from(e.match(/{[^{}]*}|.[^{]*/g)).map(e=>e.match(/^{[^{}]*}$/)?e.slice(1,-1).split(","):[e]).mapM(s.Sequence.from).map(e=>e.join("")).bind(t=>t===e?s.Sequence.from([t]):s.Sequence.from(l(t))).unique().extract()}n.router=function(e){return t=>{const{path:n,pathname:o}=new i.URL(r.standardizeUrl(t));return s.Sequence.from(Object.keys(e).filter(([e])=>"/"===e).sort().reverse()).filter(c.flip(a)(o)).map(t=>e[t]).take(1).extract().pop().call(e,n)}},n.compare=a,n._expand=l;const d=new u.Cache(100);function h(e,t){if("."===t[0]&&[..."?*"].includes(e[0]))return!1;const n=`${e}:${t}`;return d.has(n)?d.get(n):d.set(n,function e(t,n){const[r="",...i]=[...t];const[c="",...u]=[...n];switch(r){case"":return""===c;case"?":return""!==c&&"/"!==c&&e(i.join(""),u.join(""));case"*":return"/"===c?e(i.join(""),n):s.Sequence.zip(s.Sequence.cycle([i.join("")]),s.Sequence.from(n).tails().map(e=>e.join(""))).filter(o.uncurry(e)).take(1).extract().length>0;default:return c===r&&e(i.join(""),u.join(""))}}(function e(t){const n=t.replace(/\*(\?+)\*?/g,"$1*");return n===t?n:e(n)}(e),t))}n._match=h},{"../layer/data/model/domain/url":97,"./url":138,"spica/cache":6,"spica/flip":16,"spica/sequence":79,"spica/uncurry":85}],138:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=Symbol();n.URL=class{constructor(e){this.parser=document.createElement("a"),this[r],this.parser.href=e||location.href,Object.freeze(this)}get href(){return this.parser.href}get origin(){return`${this.protocol}//${this.host}`}get domain(){return`${this.protocol}//${this.hostname}`}get scheme(){return this.parser.protocol.slice(0,-1)}get protocol(){return this.parser.protocol}get userinfo(){return this.parser.href.match(/[^:/?#]+:\/\/([^/?#]*)@|$/).pop()||""}get host(){return this.parser.host}get hostname(){return this.parser.hostname}get port(){return this.parser.port}get path(){return`${this.pathname}${this.query}`}get pathname(){return this.parser.pathname}get query(){return this.parser.search}get fragment(){return this.parser.href.replace(/^[^#]+/,"")}}},{}],"pjax-api":[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./src/export"));var r=e("./src/export");n.default=r.default},{"./src/export":94}]},{},[1,2,3,"pjax-api"]),function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof module&&module.exports&&(module.exports=t())}("undefined"!=typeof self&&self,function(){return require("pjax-api")});
+require=function(){return function e(t,n,r){function i(o,c){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!c&&u)return u(o,!0);if(s)return s(o,!0);var a=new Error("Cannot find module '"+o+"'");throw a.code="MODULE_NOT_FOUND",a}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){return i(t[o][1][e]||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}}()({1:[function(e,t,n){},{}],2:[function(e,t,n){arguments[4][1][0].apply(n,arguments)},{dup:1}],3:[function(e,t,n){arguments[4][1][0].apply(n,arguments)},{dup:1}],4:[function(e,t,n){var r,i,s=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:c}catch(e){i=c}}();var a,l=[],d=!1,h=-1;function f(){d&&a&&(d=!1,a.length?l=a.concat(l):h=-1,l.length&&p())}function p(){if(!d){var e=u(f);d=!0;for(var t=l.length;t;){for(a=l,l=[];++h<t;)a&&a[h].run();h=-1,t=l.length}a=null,d=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===c||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function v(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new m(e,t)),1!==l.length||d||u(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=v,s.addListener=v,s.once=v,s.off=v,s.removeListener=v,s.removeAllListeners=v,s.emit=v,s.prependListener=v,s.prependOnceListener=v,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./type");function i(e){return function(t,...n){if(void 0===t||null===t)throw new TypeError(`Spica: assign: Cannot walk on ${t}.`);for(const r of n)if(void 0!==r&&null!==r)for(const n of Object.keys(Object(r))){const i=Object.getOwnPropertyDescriptor(Object(r),n);void 0!==i&&i.enumerable&&e(n,Object(t),Object(r))}return Object(t)}}n.assign=i((e,t,n)=>t[e]=n[e]),n.clone=i((e,t,i)=>{switch(r.type(i[e])){case"Array":return t[e]=n.clone([],i[e]);case"Object":return t[e]=i[e]instanceof Object?n.clone({},i[e]):i[e];default:return t[e]=i[e]}}),n.extend=i((e,t,i)=>{switch(r.type(i[e])){case"Array":return t[e]=n.extend([],i[e]);case"Object":switch(r.type(t[e])){case"Object":return t[e]=i[e]instanceof Object?n.extend(t[e],i[e]):i[e];default:return t[e]=i[e]instanceof Object?n.extend({},i[e]):i[e]}default:return t[e]=i[e]}})},{"./type":84}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./assign"),i=e("./equal");n.Cache=class{constructor(e,t=(()=>void 0),n={}){if(this.size=e,this.callback=t,this.opts={ignore:{delete:!1,clear:!1}},e>0==0)throw new Error("Spica: Cache: Cache size must be greater than 0.");Object.freeze(r.extend(this.opts,n));const{stats:i,entries:s}=n.data||{stats:[[],[]],entries:[]},o=i[1].slice(0,e),c=i[0].slice(0,e-o.length);if(this.stats={LRU:c,LFU:o},this.store=new Map(s),[...i[1],...i[0]].slice(o.length+c.length).forEach(e=>void this.store.delete(e)),this.store.size!==o.length+c.length)throw new Error("Spica: Cache: Size of stats and entries is not matched.");if(![...o,...c].every(e=>this.store.has(e)))throw new Error("Spica: Cache: Keys of stats and entries is not matched.")}put(e,t,n=!0){if(!n&&this.store.has(e))return this.store.set(e,t),!0;if(this.access(e))return this.store.set(e,t),!0;const{LRU:r,LFU:i}=this.stats;if(r.length+i.length===this.size&&r.length<i.length){const e=i.pop(),t=this.store.get(e);this.store.delete(e),this.callback(e,t)}if(r.unshift(e),this.store.set(e,t),r.length+i.length>this.size){const e=r.pop(),t=this.store.get(e);this.store.delete(e),this.callback(e,t)}return!1}set(e,t,n){return this.put(e,t,n),t}get(e,t=!0){return t?(this.access(e),this.store.get(e)):this.store.get(e)}has(e){return this.store.has(e)}delete(e){if(!this.store.has(e))return!1;const{LRU:t,LFU:n}=this.stats;for(const r of[n,t]){const t=i.findIndex(e,r);if(-1===t)continue;const n=this.store.get(e);return this.store.delete(r.splice(t,1)[0]),!!this.opts.ignore.delete||(this.callback(e,n),!0)}return!1}clear(){const e=this.store;this.store=new Map,this.stats={LRU:[],LFU:[]},this.opts.ignore.clear||[...e].forEach(([e,t])=>void this.callback(e,t))}[Symbol.iterator](){return this.store[Symbol.iterator]()}export(){return{stats:[this.stats.LRU.slice(),this.stats.LFU.slice()],entries:[...this]}}inspect(){const{LRU:e,LFU:t}=this.stats;return[e.slice(),t.slice()]}access(e){return this.accessLFU(e)||this.accessLRU(e)}accessLRU(e){if(!this.store.has(e))return!1;const{LRU:t}=this.stats,n=i.findIndex(e,t);if(-1===n)return!1;const{LFU:r}=this.stats;return r.unshift(...t.splice(n,1)),!0}accessLFU(e){if(!this.store.has(e))return!1;const{LFU:t}=this.stats,n=i.findIndex(e,t);return-1!==n&&(t.unshift(...t.splice(n,1)),!0)}}},{"./assign":5,"./equal":14}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./promise"),i=e("./future"),s=e("./exception"),o=e("./monad/maybe"),c=e("./monad/either");n.Cancellation=class extends r.AtomicPromise{constructor(e=[]){var t;super(e=>t=e),this.alive=!0,this.canceled_=!1,this.state=new i.AtomicFuture,this.listeners=new Set,this.register=(e=>{return this.canceled_?(t(this.reason),()=>void 0):this.alive?(this.listeners.add(t),()=>this.alive?void this.listeners.delete(t):void 0):()=>void 0;function t(t){try{e(t)}catch(t){s.causeAsyncException(t)}}}),this.cancel=(e=>{this.alive&&(this.alive=!1,this.canceled_=!0,this.reason=e,this.state.bind(this.reason),Object.freeze(this.listeners),Object.freeze(this),this.listeners.forEach(t=>void t(e)))}),this.close=(e=>{this.alive&&(this.alive=!1,this.state.bind(r.AtomicPromise.reject(e)),Object.freeze(this.listeners),Object.freeze(this))}),this.promise=(e=>this.canceled_?r.AtomicPromise.reject(this.reason):r.AtomicPromise.resolve(e)),this.maybe=(e=>this.canceled_?o.Nothing:o.Just(e)),this.either=(e=>this.canceled_?c.Left(this.reason):c.Right(e)),t(this.state),[...e].forEach(e=>void e.register(this.cancel))}static get[Symbol.species](){return r.AtomicPromise}get canceled(){return this.canceled_}}},{"./exception":15,"./future":17,"./monad/either":22,"./monad/maybe":26,"./promise":78}],8:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./exception");let i=[],s=new WeakSet;n.tick=function(e,t=!1){if(t){if(s.has(e))return;s.add(e)}i.push(e),1===i.length&&o.then(c)};const o=Promise.resolve();function c(){const e=function(){const e=i;return i=[],s=new WeakSet,e}();for(;;){try{for(;e.length>0;)e.shift()()}catch(e){r.causeAsyncException(e);continue}return}}},{"./exception":15}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./promise");var i=e("./clock.tick");n.tick=i.tick,n.clock=Promise.resolve(),n.wait=function(e){return new r.AtomicPromise(t=>void setTimeout(t,e))}},{"./clock.tick":8,"./promise":78}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.compose=function(e,...t){return t.reduce((e,t)=>(Object.getOwnPropertyNames(t.prototype).filter(t=>!(t in e.prototype)).forEach(n=>e.prototype[n]=t.prototype[n]),Object.getOwnPropertyNames(t).filter(t=>!(t in e)).forEach(n=>e[n]=t[n]),e),e)}},{}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.concat=function(e,t){for(let n=0,r=e.length,i=t.length;n<i;++n)e[r+n]=t[n];return e}},{}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.curry=((e,t)=>0===e.length?()=>e.call(t):function e(t,n,r){return t.length<=n.length?t.apply(r,n.slice(0,t.length)):(...i)=>e(t,n.concat(i),r)}(e,[],t))},{}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./monad/either"))},{"./monad/either":22}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.findIndex=function(e,t){const n=e!=e;for(let r=0;r<t.length;++r){const i=t[r];if(n?i!=i:i===e)return r}return-1}},{}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.causeAsyncException=function(e){new Promise((t,n)=>void n(e))}},{}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./curry");n.flip=function(e){return r.curry((t,n)=>e.length>1?e(n,t):e(n)(t))}},{"./curry":12}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./promise");n.Future=class extends Promise{constructor(){let e,t=!0;super(n=>e=(e=>{if(!t)throw new Error("Spica: Future: Cannot rebind a value.");return t=!1,n(e),this})),this.bind=e}static get[Symbol.species](){return Promise}};n.AtomicFuture=class extends r.AtomicPromise{constructor(){let e,t=!0;super(n=>e=(e=>{if(!t)throw new Error("Spica: AtomicFuture: Cannot rebind a value.");return t=!1,n(e),this})),this.bind=e}static get[Symbol.species](){return r.AtomicPromise}}},{"./promise":78}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./concat");class i{constructor(){this.NIL}push(e){return new s(e,this)}extend(e){return this.push(e())}array(){return[]}}n.HNil=i;class s{constructor(e,t){this.head=e,this.tail=t,this.CONS}push(e){return new s(e,this)}walk(e){return e(this.head),this.tail}modify(e){return this.tail.push(e(this.head))}extend(e){return this.push(e(this.head))}compact(e){return this.tail.modify(t=>e(this.head,t))}reverse(){return this.array().reduce((e,t)=>e.push(t),new i)}tuple(){return this.array()}array(){return r.concat([this.head],this.tail.array())}}},{"./concat":11}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./monad/maybe"))},{"./monad/maybe":26}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./functor"),i=e("../curry");class s extends r.Functor{}n.Applicative=s,function(e){e.ap=function e(t,n){return n?t.bind(e=>n.fmap(t=>0===e.length?e(t):i.curry(e)(t))):n=>e(t,n)}}(s=n.Applicative||(n.Applicative={}))},{"../curry":12,"./functor":23}],21:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./monad");class i extends r.Monad{constructor(e){super(e),this.EITHER}fmap(e){return this.bind(t=>new o(e(t)))}ap(e){return i.ap(this,e)}bind(e){return new i(()=>{const t=this.evaluate();if(t instanceof s)return t;if(t instanceof o)return e(t.extract());if(t instanceof i)return t.bind(e);throw new TypeError(`Spica: Either: Invalid monad value.\n\t${t}`)})}join(){return this.bind(e=>e)}extract(e,t){return t?this.fmap(t).extract(e):this.evaluate().extract(e)}}n.Either=i,function(e){function t(e){return new o(e)}e.pure=t,e.Return=t,e.sequence=function(t){return t.reduce((e,t)=>e.bind(e=>t.fmap(t=>e.concat([t]))),e.Return([]))}}(i=n.Either||(n.Either={}));class s extends i{constructor(e){super(c),this.a=e,this.LEFT}bind(e){return this}extract(e){if(!e)throw this.a;return e(this.a)}}n.Left=s;class o extends i{constructor(e){super(c),this.b=e,this.RIGHT}bind(e){return new i(()=>e(this.extract()))}extract(e,t){return t?t(this.b):this.b}}function c(){throw new Error("Spica: Either: Invalid thunk call.")}n.Right=o},{"./monad":27}],22:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./either.impl");!function(e){e.fmap=r.Either.fmap,e.pure=r.Either.pure,e.ap=r.Either.ap,e.Return=r.Either.Return,e.bind=r.Either.bind,e.sequence=r.Either.sequence}(n.Either||(n.Either={})),n.Left=function(e){return new r.Left(e)},n.Right=function(e){return new r.Right(e)}},{"./either.impl":21}],23:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./lazy");class i extends r.Lazy{}n.Functor=i,function(e){e.fmap=function(e,t){return t?e.fmap(t):t=>e.fmap(t)}}(i=n.Functor||(n.Functor={}))},{"./lazy":24}],24:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.Lazy=class{constructor(e){this.thunk=e}evaluate(){return this.memory_=this.memory_||this.thunk()}}},{}],25:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./monadplus");class i extends r.MonadPlus{constructor(e){super(e),this.MAYBE}fmap(e){return this.bind(t=>new s(e(t)))}ap(e){return i.ap(this,e)}bind(e){return new i(()=>{const t=this.evaluate();if(t instanceof s)return e(t.extract());if(t instanceof o)return t;if(t instanceof i)return t.bind(e);throw new TypeError(`Spica: Maybe: Invalid monad value.\n\t${t}`)})}guard(e){return e?this:i.mzero}join(){return this.bind(e=>e)}extract(e,t){return t?this.fmap(t).extract(e):this.evaluate().extract(e)}}n.Maybe=i,function(e){function t(e){return new s(e)}e.pure=t,e.Return=t,e.sequence=function(t){return t.reduce((e,t)=>e.bind(e=>t.fmap(t=>e.concat([t]))),e.Return([]))}}(i=n.Maybe||(n.Maybe={}));class s extends i{constructor(e){super(c),this.a=e,this.JUST}bind(e){return new i(()=>e(this.extract()))}extract(e,t){return t?t(this.a):this.a}}n.Just=s;class o extends i{constructor(){super(c),this.NOTHING}bind(e){return this}extract(e){if(!e)throw void 0;return e()}}function c(){throw new Error("Spica: Maybe: Invalid thunk call.")}n.Nothing=o,function(e){e.mzero=new o,e.mplus=function(t,n){return new e(()=>t.fmap(()=>t).extract(()=>n))}}(i=n.Maybe||(n.Maybe={}))},{"./monadplus":28}],26:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./maybe.impl");!function(e){e.fmap=r.Maybe.fmap,e.pure=r.Maybe.pure,e.ap=r.Maybe.ap,e.Return=r.Maybe.Return,e.bind=r.Maybe.bind,e.sequence=r.Maybe.sequence,e.mzero=r.Maybe.mzero,e.mplus=r.Maybe.mplus}(n.Maybe||(n.Maybe={})),n.Just=function(e){return new r.Just(e)},n.Nothing=r.Maybe.mzero},{"./maybe.impl":25}],27:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./applicative");class i extends r.Applicative{}n.Monad=i,function(e){e.bind=function e(t,n){return n?t.bind(n):n=>e(t,n)}}(i=n.Monad||(n.Monad={}))},{"./applicative":20}],28:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./monad");class i extends r.Monad{}n.MonadPlus=i,i=n.MonadPlus||(n.MonadPlus={})},{"./monad":27}],29:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./sequence/core");n.Sequence=r.Sequence;const i=e("./sequence/member/static/resume"),s=e("./sequence/member/static/from"),o=e("./sequence/member/static/cycle"),c=e("./sequence/member/static/random"),u=e("./sequence/member/static/concat"),a=e("./sequence/member/static/zip"),l=e("./sequence/member/static/difference"),d=e("./sequence/member/static/union"),h=e("./sequence/member/static/intersect"),f=e("./sequence/member/static/pure"),p=e("./sequence/member/static/return"),m=e("./sequence/member/static/sequence"),v=e("./sequence/member/static/mempty"),b=e("./sequence/member/static/mconcat"),y=e("./sequence/member/static/mappend"),w=e("./sequence/member/static/mzero"),q=e("./sequence/member/static/mplus"),S=e("./sequence/member/instance/extract"),g=e("./sequence/member/instance/iterate"),_=e("./sequence/member/instance/memoize"),x=e("./sequence/member/instance/reduce"),E=e("./sequence/member/instance/take"),T=e("./sequence/member/instance/drop"),j=e("./sequence/member/instance/takeWhile"),P=e("./sequence/member/instance/dropWhile"),O=e("./sequence/member/instance/takeUntil"),M=e("./sequence/member/instance/dropUntil"),k=e("./sequence/member/instance/sort"),R=e("./sequence/member/instance/unique"),L=e("./sequence/member/instance/fmap"),A=e("./sequence/member/instance/ap"),I=e("./sequence/member/instance/bind"),U=e("./sequence/member/instance/join"),z=e("./sequence/member/instance/mapM"),C=e("./sequence/member/instance/filterM"),F=e("./sequence/member/instance/map"),N=e("./sequence/member/instance/filter"),$=e("./sequence/member/instance/scanl"),D=e("./sequence/member/instance/foldr"),H=e("./sequence/member/instance/group"),W=e("./sequence/member/instance/inits"),V=e("./sequence/member/instance/tails"),G=e("./sequence/member/instance/segs"),B=e("./sequence/member/instance/subsequences"),J=e("./sequence/member/instance/permutations");e("../compose").compose(r.Sequence,i.default,s.default,o.default,c.default,u.default,a.default,l.default,d.default,h.default,f.default,p.default,m.default,v.default,b.default,y.default,w.default,q.default,S.default,g.default,_.default,x.default,E.default,T.default,j.default,P.default,O.default,M.default,k.default,R.default,L.default,A.default,I.default,U.default,z.default,C.default,F.default,N.default,$.default,D.default,H.default,W.default,V.default,G.default,B.default,J.default)},{"../compose":10,"./sequence/core":30,"./sequence/member/instance/ap":31,"./sequence/member/instance/bind":32,"./sequence/member/instance/drop":33,"./sequence/member/instance/dropUntil":34,"./sequence/member/instance/dropWhile":35,"./sequence/member/instance/extract":36,"./sequence/member/instance/filter":37,"./sequence/member/instance/filterM":38,"./sequence/member/instance/fmap":39,"./sequence/member/instance/foldr":40,"./sequence/member/instance/group":41,"./sequence/member/instance/inits":42,"./sequence/member/instance/iterate":43,"./sequence/member/instance/join":44,"./sequence/member/instance/map":45,"./sequence/member/instance/mapM":46,"./sequence/member/instance/memoize":47,"./sequence/member/instance/permutations":48,"./sequence/member/instance/reduce":49,"./sequence/member/instance/scanl":50,"./sequence/member/instance/segs":51,"./sequence/member/instance/sort":52,"./sequence/member/instance/subsequences":53,"./sequence/member/instance/tails":54,"./sequence/member/instance/take":55,"./sequence/member/instance/takeUntil":56,"./sequence/member/instance/takeWhile":57,"./sequence/member/instance/unique":58,"./sequence/member/static/concat":59,"./sequence/member/static/cycle":60,"./sequence/member/static/difference":61,"./sequence/member/static/from":62,"./sequence/member/static/intersect":63,"./sequence/member/static/mappend":64,"./sequence/member/static/mconcat":65,"./sequence/member/static/mempty":66,"./sequence/member/static/mplus":67,"./sequence/member/static/mzero":68,"./sequence/member/static/pure":69,"./sequence/member/static/random":70,"./sequence/member/static/resume":71,"./sequence/member/static/return":72,"./sequence/member/static/sequence":73,"./sequence/member/static/union":74,"./sequence/member/static/zip":75}],30:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../monadplus");class i extends r.MonadPlus{constructor(e){super(s),this.cons=e}[Symbol.iterator](){let e=()=>this.iterate();return{next(){const t=e();return e=i.Thunk.iterator(t),{done:!i.isIterable(t),value:i.Thunk.value(t)}}}}}function s(){throw new Error("Spica: Sequence: Invalid thunk call.")}n.Sequence=i,i=n.Sequence||(n.Sequence={}),function(e){let t,n,r,i;!function(t){t.cons=function(t,n){switch(arguments.length){case 0:return[];case 1:return[t];case 2:return[t,n];default:throw e.Exception.invalidConsError(arguments)}}}(t=e.Data||(e.Data={})),function(e){e.value=function(e){return e[0]},e.iterator=function(e){return e[1]},e.index=function(e){return e[2]}}(n=e.Thunk||(e.Thunk={})),function(t){t.done=(()=>[void 0,t.done,-1]),t.when=function t(r,i,s){return e.isIterable(r)?s(r,()=>t(n.iterator(r)(),i,s)):i(r)}}(r=e.Iterator||(e.Iterator={})),e.isIterable=function(e){return n.iterator(e)!==r.done},function(e){e.invalidConsError=function(e){return console.error(e,e.length,e[0],e[1]),new TypeError("Spica: Sequence: Invalid parameters of cons.")},e.invalidDataError=function(e){return console.error(e),new TypeError("Spica: Sequence: Invalid data.")},e.invalidThunkError=function(e){return console.error(e),new TypeError("Spica: Sequence: Invalid thunk.")}}(i=e.Exception||(e.Exception={}))}(i=n.Sequence||(n.Sequence={}))},{"../monadplus":28}],31:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{ap(e){return r.Sequence.ap(this,e)}}},{"../../core":30}],32:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{bind(e){return r.Sequence.concat(this.fmap(e))}}},{"../../core":30}],33:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{drop(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),(t,i)=>r.Sequence.Thunk.index(t)<e?i():n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],34:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{dropUntil(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),(t,i)=>e(r.Sequence.Thunk.value(t))?i():n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],35:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{dropWhile(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),(t,i)=>e(r.Sequence.Thunk.value(t))?i():n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],36:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{extract(){const e=[];let t=()=>this.iterate();for(;;){const n=t();if(!r.Sequence.isIterable(n))return e;i.concat(e,[r.Sequence.Thunk.value(n)]),t=r.Sequence.Thunk.iterator(n)}}}},{"../../../../concat":11,"../../core":30}],37:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{filter(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),(t,i)=>e(r.Sequence.Thunk.value(t),r.Sequence.Thunk.index(t))?n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t)):i()))}}},{"../../core":30}],38:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{filterM(e){return r.Sequence.from([0]).bind(()=>{const t=this.extract();switch(t.length){case 0:return r.Sequence.from([[]]);default:{const n=t.shift();return e(n).bind(s=>s?0===t.length?r.Sequence.from([[n]]):r.Sequence.from(t).filterM(e).fmap(e=>i.concat([n],e)):0===t.length?r.Sequence.from([[]]):r.Sequence.from(t).filterM(e))}}})}}},{"../../../../concat":11,"../../core":30}],39:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{fmap(e){return new r.Sequence((t=(()=>this.iterate()))=>r.Sequence.Iterator.when(t(),()=>r.Sequence.Data.cons(),t=>r.Sequence.Data.cons(e(r.Sequence.Thunk.value(t)),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],40:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{foldr(e,t){return new r.Sequence((n=(()=>this.reduce().iterate()))=>r.Sequence.Iterator.when(n(),()=>r.Sequence.Data.cons(t),n=>r.Sequence.Data.cons(e(r.Sequence.Thunk.value(n),r.Sequence.resume(r.Sequence.Thunk.iterator(n)).foldr(e,t))))).bind(e=>e)}}},{"../../core":30}],41:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{group(e){return new r.Sequence(([t,n]=[()=>this.iterate(),[]],s)=>r.Sequence.Iterator.when(t(),()=>0===n.length?s():s(n),(t,o)=>0===n.length||e(n[0],r.Sequence.Thunk.value(t))?(i.concat(n,[r.Sequence.Thunk.value(t)]),o()):s(n,[r.Sequence.Thunk.iterator(t),i.concat([],[r.Sequence.Thunk.value(t)])])))}}},{"../../../../concat":11,"../../core":30}],42:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{inits(){return r.Sequence.mappend(r.Sequence.from([[]]),this.scanl((e,t)=>e.concat([t]),[]).dropWhile(e=>0===e.length))}}},{"../../core":30}],43:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{iterate(){return this.iterate_()}iterate_(e,t=0){const n=this.cons(e,r.Sequence.Data.cons);switch(n.length){case 0:return[void 0,r.Sequence.Iterator.done,-1];case 1:return[n[0],()=>r.Sequence.Iterator.done(),t];case 2:return[n[0],()=>this.iterate_(n[1],t+1),t];default:throw r.Sequence.Exception.invalidDataError(n)}}}},{"../../core":30}],44:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{join(){return r.Sequence.concat(this)}}},{"../../core":30}],45:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{map(e){return new r.Sequence((t=(()=>this.iterate()))=>r.Sequence.Iterator.when(t(),()=>r.Sequence.Data.cons(),t=>r.Sequence.Data.cons(e(r.Sequence.Thunk.value(t),r.Sequence.Thunk.index(t)),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],46:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{mapM(e){return r.Sequence.from([0]).bind(()=>{const t=this.extract();switch(t.length){case 0:return r.Sequence.mempty;default:{const n=t.shift();return e(n).bind(n=>0===t.length?r.Sequence.from([[n]]):r.Sequence.from(t).mapM(e).fmap(e=>i.concat([n],e)))}}})}}},{"../../../../concat":11,"../../core":30}],47:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=new WeakMap;n.default=class extends r.Sequence{memoize(){return new r.Sequence(([e,t]=[0,i.get(this)||i.set(this,new Map).get(this)],n)=>r.Sequence.Iterator.when(t.get(e)||t.set(e,e>0&&t.has(e-1)?r.Sequence.Thunk.iterator(t.get(e-1))():this.iterate()).get(e),()=>n(),i=>n(r.Sequence.Thunk.value(i),[e+1,t])))}}},{"../../core":30}],48:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{permutations(){return r.Sequence.from([0]).bind(()=>{const e=this.extract();return 0===e.length?r.Sequence.mempty:r.Sequence.from([e])}).bind(e=>r.Sequence.mappend(r.Sequence.from([e]),function e(t,n){return r.Sequence.Iterator.when(t.iterate(),()=>r.Sequence.mempty,t=>new r.Sequence((s,o)=>r.Sequence.Iterator.when(t,()=>o(),t=>{const s=r.Sequence.Thunk.value(t),c=r.Sequence.resume(r.Sequence.Thunk.iterator(t)).memoize();return o(n.permutations().foldr((e,t)=>(i=r.Sequence.from(e),t=t,function e(t,n,i){return r.Sequence.Iterator.when(n.iterate(),()=>[c,i],n=>{const o=r.Sequence.Thunk.value(n),[c,u]=e(e=>t(r.Sequence.mappend(r.Sequence.from([o]),e)),r.Sequence.resume(r.Sequence.Thunk.iterator(n)),i);return[r.Sequence.mappend(r.Sequence.from([o]),c),r.Sequence.mappend(r.Sequence.from([t(r.Sequence.mappend(r.Sequence.from([s]),r.Sequence.mappend(r.Sequence.from([o]),c))).extract()]),u)]})}(e=>e,i,t)[1]),e(c,r.Sequence.mappend(r.Sequence.from([s]),n))))})).bind(e=>e));var i,s}(r.Sequence.from(e),r.Sequence.mempty)))}}},{"../../core":30}],49:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{reduce(){return new r.Sequence(([e,t]=[0,new Map],n)=>r.Sequence.Iterator.when(t.get(e)||t.set(e,e>0&&t.has(e-1)?r.Sequence.Thunk.iterator(t.get(e-1))():this.iterate()).get(e),()=>n(),i=>n(r.Sequence.Thunk.value(i),[e+1,t])))}}},{"../../core":30}],50:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{scanl(e,t){return new r.Sequence(([n,i,s]=[t,()=>this.iterate(),0])=>r.Sequence.Iterator.when(i(),()=>0===s?r.Sequence.Data.cons(t):r.Sequence.Data.cons(),t=>r.Sequence.Data.cons(n=e(n,r.Sequence.Thunk.value(t)),[n,r.Sequence.Thunk.iterator(t),r.Sequence.Thunk.index(t)+1])))}}},{"../../core":30}],51:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{segs(){return r.Sequence.mappend(this.foldr((e,t)=>t.take(1).bind(n=>r.Sequence.mappend(r.Sequence.from([r.Sequence.mappend(r.Sequence.from([[e]]),r.Sequence.from(n).map(t=>i.concat([e],t)))]),t)),r.Sequence.from([r.Sequence.from([])])).bind(e=>e),r.Sequence.from([[]]))}}},{"../../../../concat":11,"../../core":30}],52:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{sort(e){return r.Sequence.from(this.extract().sort(e))}}},{"../../core":30}],53:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core"),i=e("../../../../concat");n.default=class extends r.Sequence{subsequences(){return r.Sequence.mappend(r.Sequence.from([[]]),r.Sequence.from([0]).bind(()=>(function e(t){return r.Sequence.Iterator.when(t.iterate(),()=>r.Sequence.mempty,t=>r.Sequence.mappend(r.Sequence.from([[r.Sequence.Thunk.value(t)]]),new r.Sequence((n,s)=>r.Sequence.Iterator.when(t,()=>s(),t=>s(e(r.Sequence.resume(r.Sequence.Thunk.iterator(t))).foldr((e,n)=>r.Sequence.mappend(r.Sequence.mappend(r.Sequence.from([e]),r.Sequence.from([i.concat([r.Sequence.Thunk.value(t)],e)])),n),r.Sequence.mempty)))).bind(e=>e)))})(this)))}}},{"../../../../concat":11,"../../core":30}],54:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{tails(){return r.Sequence.mappend(r.Sequence.from(this.extract().map((e,t,n)=>n.slice(t))),r.Sequence.from([[]]))}}},{"../../core":30}],55:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{take(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(e>0?t():r.Sequence.Iterator.done(),()=>n(),t=>r.Sequence.Thunk.index(t)+1<e?n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t)):n(r.Sequence.Thunk.value(t))))}}},{"../../core":30}],56:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{takeUntil(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),t=>e(r.Sequence.Thunk.value(t))?n(r.Sequence.Thunk.value(t)):n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t))))}}},{"../../core":30}],57:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{takeWhile(e){return new r.Sequence((t=(()=>this.iterate()),n)=>r.Sequence.Iterator.when(t(),()=>n(),t=>e(r.Sequence.Thunk.value(t))?n(r.Sequence.Thunk.value(t),r.Sequence.Thunk.iterator(t)):n()))}}},{"../../core":30}],58:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{unique(){const e=new Set;return this.filter(t=>!e.has(t)&&!!e.add(t))}}},{"../../core":30}],59:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static concat(e){return new r.Sequence(([t,n]=[()=>e.iterate(),r.Sequence.Iterator.done],i)=>r.Sequence.Iterator.when(t(),()=>i(),(e,t)=>(n=n===r.Sequence.Iterator.done?()=>r.Sequence.Thunk.value(e).iterate():n,r.Sequence.Iterator.when(n(),()=>(n=r.Sequence.Iterator.done,t()),t=>i(r.Sequence.Thunk.value(t),[()=>e,r.Sequence.Thunk.iterator(t)])))))}}},{"../../core":30}],60:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static cycle(e){return new r.Sequence(function t([n,r]=[e[Symbol.iterator](),0],i){const s=n.next();return s.done?t([e[Symbol.iterator](),r+1],i):i(s.value,[n,r+1])}).reduce()}}},{"../../core":30}],61:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static difference(e,t,n){return new r.Sequence(([i,s]=[()=>e.iterate(),()=>t.iterate()],o)=>r.Sequence.Iterator.when(i(),()=>r.Sequence.Iterator.when(s(),()=>o(),e=>o(r.Sequence.Thunk.value(e),[r.Sequence.Iterator.done,r.Sequence.Thunk.iterator(e)])),(e,t)=>r.Sequence.Iterator.when(s(),()=>o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),r.Sequence.Iterator.done]),i=>{const c=n(r.Sequence.Thunk.value(e),r.Sequence.Thunk.value(i));return c<0?o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),()=>i]):c>0?o(r.Sequence.Thunk.value(i),[()=>e,r.Sequence.Thunk.iterator(i)]):(s=(()=>r.Sequence.Thunk.iterator(i)()),t())})))}}},{"../../core":30}],62:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static from(e){return new r.Sequence(([t,n]=[e[Symbol.iterator](),0],r)=>{const i=t.next();return i.done?r():r(i.value,[t,n+1])}).reduce()}}},{"../../core":30}],63:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static intersect(e,t,n){return new r.Sequence(([i,s]=[()=>e.iterate(),()=>t.iterate()],o)=>r.Sequence.Iterator.when(i(),()=>o(),(e,t)=>r.Sequence.Iterator.when(s(),()=>o(),(i,c)=>{const u=n(r.Sequence.Thunk.value(e),r.Sequence.Thunk.value(i));return u<0?(s=(()=>i),t()):u>0?c():o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),r.Sequence.Thunk.iterator(i)])})))}}},{"../../core":30}],64:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static mappend(e,t){return r.Sequence.mconcat([e,t])}}},{"../../core":30}],65:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static mconcat(e){return[...e].reduce((e,t)=>(e=e,t=t,new r.Sequence(([n,i]=[()=>e.iterate(),()=>t.iterate()],s)=>r.Sequence.Iterator.when(n(),()=>r.Sequence.Iterator.when(i(),()=>s(),e=>s(r.Sequence.Thunk.value(e),[r.Sequence.Iterator.done,r.Sequence.Thunk.iterator(e)])),e=>s(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),i])))),r.Sequence.mempty);var t,n}}},{"../../core":30}],66:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");class i extends r.Sequence{}i.mempty=new r.Sequence((e,t)=>t()),n.default=i},{"../../core":30}],67:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");class i extends r.Sequence{}i.mplus=r.Sequence.mappend,n.default=i},{"../../core":30}],68:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");class i extends r.Sequence{}i.mzero=r.Sequence.mempty,n.default=i},{"../../core":30}],69:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static pure(e){return new r.Sequence((t,n)=>n(e))}}},{"../../core":30}],70:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static random(e=(()=>Math.random())){return"function"==typeof e?r.Sequence.from(new r.Sequence((t,n)=>n(e(),t))):this.random().map(t=>e[t*e.length|0])}}},{"../../core":30}],71:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static resume(e){return new r.Sequence((t=e,n)=>r.Sequence.Iterator.when(t(),()=>n(),e=>n(r.Sequence.Thunk.value(e),r.Sequence.Thunk.iterator(e))))}}},{"../../core":30}],72:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static Return(e){return new r.Sequence((t,n)=>n(e))}}},{"../../core":30}],73:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static sequence(e){return e.reduce((e,t)=>e.fmap(e=>r.Sequence.mappend(e,t)),r.Sequence.Return(r.Sequence.from([])))}}},{"../../core":30}],74:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static union(e,t,n){return new r.Sequence(([i,s]=[()=>e.iterate(),()=>t.iterate()],o)=>r.Sequence.Iterator.when(i(),()=>r.Sequence.Iterator.when(s(),()=>o(),e=>o(r.Sequence.Thunk.value(e),[r.Sequence.Iterator.done,r.Sequence.Thunk.iterator(e)])),e=>r.Sequence.Iterator.when(s(),()=>o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),r.Sequence.Iterator.done]),t=>{const i=n(r.Sequence.Thunk.value(e),r.Sequence.Thunk.value(t));return i<0?o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),()=>t]):i>0?o(r.Sequence.Thunk.value(t),[()=>e,r.Sequence.Thunk.iterator(t)]):o(r.Sequence.Thunk.value(e),[r.Sequence.Thunk.iterator(e),r.Sequence.Thunk.iterator(t)])})))}}},{"../../core":30}],75:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../core");n.default=class extends r.Sequence{static zip(e,t){return new r.Sequence(([n,i]=[()=>e.iterate(),()=>t.iterate()],s)=>r.Sequence.Iterator.when(n(),()=>s(),e=>r.Sequence.Iterator.when(i(),()=>s(),t=>s([r.Sequence.Thunk.value(e),r.Sequence.Thunk.value(t)],[r.Sequence.Thunk.iterator(e),r.Sequence.Thunk.iterator(t)]))))}}},{"../../core":30}],76:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.noop=function(){}},{}],77:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./assign"),i=e("./concat"),s=e("./equal"),o=e("./exception");var c;!function(e){e.monitor="monitor",e.subscriber="subscriber"}(c=n.RegisterItemType||(n.RegisterItemType={}));function u(e,t,n,r){return e.some(e=>e.type===t&&e.namespace.length===n.length&&e.namespace.every((e,t)=>e===n[t])&&e.listener===r)}n.Observation=class{constructor(e={}){this.settings={limit:10},this.relaySources=new WeakSet,this.node_={parent:void 0,children:new Map,childrenNames:[],items:[]},Object.freeze(r.extend(this.settings,e))}monitor(e,t,{once:n=!1}={}){if("function"!=typeof t)throw new Error(`Spica: Observation: Invalid listener: ${t}`);const r=()=>this.off(e,t,c.monitor),{items:i}=this.seekNode_(e);if(u(i,c.monitor,e,t))return r;if(i.length===this.settings.limit)throw new Error("Spica: Observation: Exceeded max listener limit.");return i.push({type:c.monitor,namespace:e,listener:t,options:{once:n}}),r}on(e,t,{once:n=!1}={}){if("function"!=typeof t)throw new Error(`Spica: Observation: Invalid listener: ${t}`);const r=()=>this.off(e,t),{items:i}=this.seekNode_(e);if(u(i,c.subscriber,e,t))return r;if(i.length===this.settings.limit)throw new Error("Spica: Observation: Exceeded max listener limit.");return i.push({type:c.subscriber,namespace:e,listener:t,options:{once:n}}),r}once(e,t){return this.on(e,t,{once:!0})}off(e,t,n=c.subscriber){switch(typeof t){case"function":return void this.seekNode_(e).items.some(({type:e,listener:r},i,s)=>{if(r!==t)return!1;if(e!==n)return!1;switch(i){case 0:return!void s.shift();case s.length-1:return!void s.pop();default:return!void s.splice(i,1)}});case"undefined":{const t=this.seekNode_(e);return t.childrenNames.slice().forEach(n=>{this.off(e.concat([n]));const r=t.children.get(n);r&&(r.items.length+r.childrenNames.length>0||(t.children.delete(n),t.childrenNames.splice(s.findIndex(n,t.childrenNames),1)))}),void(t.items=t.items.filter(({type:e})=>e===c.monitor))}default:throw new Error("Spica: Observation: Unreachable.")}}emit(e,t,n){this.drain_(e,t,n)}reflect(e,t){let n=[];return this.emit(e,t,(e,t)=>n=t),n}relay(e){if(this.relaySources.has(e))return()=>void 0;this.relaySources.add(e);const t=e.monitor([],(e,t)=>void this.emit(t,e));return()=>(this.relaySources.delete(e),t())}drain_(e,t,n){const r=[];if(this.refsBelow_(this.seekNode_(e)).reduce((i,{type:s,listener:u,options:{once:a}})=>{if(s===c.subscriber){a&&this.off(e,u);try{const i=u(t,e);n&&(r[r.length]=i)}catch(e){o.causeAsyncException(e)}}},void 0),this.refsAbove_(this.seekNode_(e)).reduce((n,{type:r,listener:i,options:{once:s}})=>{if(r===c.monitor){s&&this.off(e,i,c.monitor);try{i(t,e)}catch(e){o.causeAsyncException(e)}}},void 0),n)try{n(t,r)}catch(e){o.causeAsyncException(e)}}refs(e){return this.refsBelow_(this.seekNode_(e))}refsAbove_({parent:e,items:t}){for(t=i.concat([],t);e;)t=i.concat(t,e.items),e=e.parent;return t}refsBelow_({childrenNames:e,children:t,items:n}){n=i.concat([],n);for(let r=0;r<e.length;++r){const o=e[r],c=this.refsBelow_(t.get(o));n=i.concat(n,c),0===c.length&&(t.delete(o),e.splice(s.findIndex(o,e),1),--r)}return n}seekNode_(e){let t=this.node_;for(const n of e){const{children:e}=t;e.has(n)||(t.childrenNames.push(n),e.set(n,{parent:t,children:new Map,childrenNames:[],items:[]})),t=e.get(n)}return t}}},{"./assign":5,"./concat":11,"./equal":14,"./exception":15}],78:[function(e,t,n){"use strict";var r;Object.defineProperty(n,"__esModule",{value:!0});const i=e("./noop"),s=Symbol(),o=Symbol(),c=Symbol();class u{constructor(e){this[Symbol.toStringTag]="Promise",this[r]=[];try{e(e=>{this[s]=this[s]||new a("resolved",e),this[c]()},e=>{this[s]=this[s]||new a("rejected",e),this[c]()})}catch(e){this[s]=new a("rejected",e),this[c]()}}static get[Symbol.species](){return u}static all(e){return e.reduce((e,t)=>e.then(e=>u.resolve(t).then(t=>e.concat([t]))),u.resolve([]))}static race(e){return new u(t=>void e.forEach(e=>void u.resolve(e).then(t,t)))}static resolve(e){return new u((t,n)=>l(e)?void e.then(t,n):void t(e))}static reject(e){return new u((t,n)=>void n(e))}[c](){const e=this[s];if(e)for(;this[o].length>0;){const[t,n]=this[o].shift();switch(e.state){case"resolved":l(e.value)?e.value.then(t,n):t(e.value);continue;case"rejected":n(e.value);continue}}}then(e,t){return e=e||u.resolve,t=t||u.reject,new u((n,r)=>{this[o].push([t=>{try{n(e(t))}catch(e){r(e)}},e=>void new u(n=>void n(t(e))).then(n,r)]),this[c]()})}catch(e){return this.then(void 0,e)}finally(e){return e=e||i.noop,this.then(t=>void e()||t,t=>void e()||u.reject(t))}}r=o,n.AtomicPromise=u;class a{constructor(e,t){this.state=e,this.value=t}}function l(e){return!!e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}},{"./noop":76}],79:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./monad/sequence"))},{"./monad/sequence":29}],80:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r="0".repeat(15);let i=0;n.sqid=function(e){if(arguments.length>0){if("number"!=typeof e)throw new TypeError(`Spica: sqid: A parameter value must be a number: ${e}`);if(e>=0==0)throw new TypeError(`Spica: sqid: A parameter value must be a positive number: ${e}`);if(e%1!=0)throw new TypeError(`Spica: sqid: A parameter value must be an integer: ${e}`)}return void 0===e?(r+ ++i).slice(-15):(r+e).slice(-15)}},{}],81:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./promise"),i=e("./observation"),s=e("./assign"),o=e("./clock"),c=e("./sqid"),u=e("./noop"),a=e("./exception");class l{constructor(e={}){if(this.id=c.sqid(),this.settings={name:"",size:1/0,timeout:1/0,destructor:e=>void 0,scheduler:o.tick,resource:10},this.events_={init:new i.Observation,loss:new i.Observation,exit:new i.Observation},this.events=this.events_,this.workers=new Map,this.alive=!0,this.available_=!0,this.scheduler=(()=>void(0,this.settings.scheduler)(this.deliver)),this.messages=[],this.deliver=(()=>{const e=Date.now();for(let t=0,n=this.messages.length;this.available&&t<n;++t){if(this.settings.resource-(Date.now()-e)<=0)return void this.schedule();const[r,i,s,o]=this.messages[t],c="string"==typeof r?[r]:[...r],u=c.reduce((e,t)=>e||(this.workers.has(t)?this.workers.get(t).call([i,o]):void 0),void 0);if(!(void 0===u&&Date.now()<o))if(0===t?this.messages.shift():this.messages.splice(t,1),--t,--n,void 0===u){this.events_.loss.emit([c[0]],[c[0],i]);try{s(void 0,new Error("Spica: Supervisor: A process has failed."))}catch(e){a.causeAsyncException(e)}}else u.then(e=>void s(e),()=>void s(void 0,new Error("Spica: Supervisor: A process has failed.")))}}),Object.freeze(s.extend(this.settings,e)),this.name=this.settings.name,this.constructor===l)throw new Error(`Spica: Supervisor: <${this.id}/${this.name}>: Cannot instantiate abstract classes.`);this.constructor.instances.add(this)}static get instances(){return this.hasOwnProperty("instances_")?this.instances_:this.instances_=new Set}static get count(){return this.instances.size}static get procs(){return[...this.instances].reduce((e,t)=>e+t.workers.size,0)}destructor(e){for(this.available_=!1,this.workers.forEach(t=>void t.terminate(e)),Object.freeze(this.workers);this.messages.length>0;){const[e,t]=this.messages.shift(),n="string"==typeof e?[e]:[...e];this.events_.loss.emit([n[0]],[n[0],t])}Object.freeze(this.messages),this.alive=!1,this.constructor.instances.delete(this),Object.freeze(this),this.settings.destructor(e)}get available(){return this.available_}throwErrorIfNotAvailable(){if(!this.available)throw new Error(`Spica: Supervisor: <${this.id}/${this.name}>: A supervisor is already terminated.`)}register(e,t,n,r){if(this.throwErrorIfNotAvailable(),arguments.length>3)return this.kill(e,r),this.register(e,t,n);if(this.workers.has(e))throw new Error(`Spica: Supervisor: <${this.id}/${this.name}/${e}>: Cannot register a process multiply with the same name.`);return this.schedule(),t="function"==typeof t?{init:e=>e,main:t,exit:e=>void 0}:t,this.workers.set(e,new h(this,e,t,n,n===l.initiated,this.events_,()=>void this.workers.delete(e))).get(e).terminate}call(e,t,n=this.settings.timeout,r=this.settings.timeout){return this.call_(void 0===e?new d(this.workers):e,t,n,r)}call_(e,t,n,i){if(this.throwErrorIfNotAvailable(),"number"==typeof n)return new r.AtomicPromise((n,r)=>void this.call_(e,t,(e,t)=>t?r(t):n(e),i));for(this.messages.push([e,t,n,Date.now()+i]);this.messages.length>this.settings.size;){const[e,t,n]=this.messages.shift(),r="string"==typeof e?[e]:[...e];this.events_.loss.emit([r[0]],[r[0],t]);try{n(void 0,new Error(`Spica: Supervisor: <${this.id}/${this.name}>: A message overflowed.`))}catch(e){a.causeAsyncException(e)}}this.schedule(),i<=0||i!==1/0&&setTimeout(()=>void this.schedule(),i+3)}cast(e,t,n=this.settings.timeout){const r=this.cast_(void 0===e?new d(this.workers):e,t,n);return void 0!==r&&(r.catch(u.noop),!0)}cast_(e,t,n){this.throwErrorIfNotAvailable();const r="string"==typeof e?[e]:[...e],i=r.reduce((e,r)=>e||(this.workers.has(r)?this.workers.get(r).call([t,Date.now()+n]):void 0),void 0);return void 0===i&&this.events_.loss.emit([r[0]],[r[0],t]),i}refs(e){return this.throwErrorIfNotAvailable(),void 0===e?[...this.workers.values()].map(t):this.workers.has(e)?[t(this.workers.get(e))]:[];function t(e){return[e.name,e.process,e.state,e.terminate]}}kill(e,t){return!!this.available&&(!!this.workers.has(e)&&this.workers.get(e).terminate(t))}terminate(e){return!!this.available&&(this.destructor(e),!0)}schedule(){0!==this.messages.length&&o.tick(this.scheduler,!0)}}l.initiated=Symbol(),n.Supervisor=l;class d{constructor(e){this.workers=e}[Symbol.iterator](){return 0===this.workers.size?[""][Symbol.iterator]():this.workers.keys()}}class h{constructor(e,t,n,r,i,s,o){this.sv=e,this.name=t,this.process=n,this.state=r,this.events=s,this.destructor_=o,this.alive=!0,this.available=!0,this.initiated=!1,this.terminate=(e=>!!this.alive&&(this.destructor(e),!0)),i&&this.init()}destructor(e){this.alive=!1,this.available=!1,Object.freeze(this);try{this.destructor_()}catch(e){a.causeAsyncException(e)}this.initiated&&this.exit(e)}init(){this.initiated=!0,this.events.init.emit([this.name],[this.name,this.process,this.state]),this.state=this.process.init(this.state)}exit(e){try{this.process.exit(e,this.state),this.events.exit.emit([this.name],[this.name,this.process,this.state,e])}catch(t){this.events.exit.emit([this.name],[this.name,this.process,this.state,e]),this.sv.terminate(t)}}call([e,t]){const n=Date.now();if(this.available&&!(n>t))return new r.AtomicPromise((i,s)=>{isFinite(t)&&setTimeout(()=>void s(new Error),t-n),this.available=!1,this.initiated||this.init(),r.AtomicPromise.resolve(this.process.main(e,this.state,this.terminate)).then(i,s)}).then(e=>{const[t,n]=Array.isArray(e)?e:[e.reply,e.state];return this.alive?(this.sv.schedule(),this.state=n,this.available=!0,t):t}).catch(e=>{throw this.sv.schedule(),this.terminate(e),e})}}},{"./assign":5,"./clock":9,"./exception":15,"./noop":76,"./observation":77,"./promise":78,"./sqid":80}],82:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.throttle=function(e,t){let n=0,r=[];return i=>{r.push(i),n>0||(n=setTimeout(()=>{n=0,t(r[r.length-1],function(){const e=r;return r=[],e}())},e))}},n.debounce=function(e,t){let n=0,r=[];return i=>{r.push(i),n>0||(n=setTimeout(()=>{n=0,setTimeout(()=>{n>0||t(r[r.length-1],function(){const e=r;return r=[],e}())},e)},e))}}},{}],83:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.tuple=function(e){return e}},{}],84:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.type=function(e){const t=Object.prototype.toString.call(e).split(" ").pop().slice(0,-1);return"object"!=typeof e&&e instanceof Object==0||null===e?t.toLowerCase():t}},{}],85:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.uncurry=(e=>t=>e(...t.slice(0,e.length)))},{}],86:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split(""));n.uuid=function(){let e="";for(const t of r)if("x"===t||"y"===t){const n=16*Math.random()|0;e+=("x"==t?n:3&n|8).toString(16)}else e+=t;return e.toLowerCase()}},{}],87:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("./src/dom/builder");n.default=r.TypedHTML,n.TypedHTML=r.TypedHTML,n.TypedSVG=r.TypedSVG,n.API=r.API;var i=e("./src/util/dom");n.html=i.html,n.svg=i.svg,n.text=i.text,n.frag=i.frag,n.observe=i.observe,function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./src/util/listener"))},{"./src/dom/builder":88,"./src/util/dom":91,"./src/util/listener":92}],88:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./manager"),i=e("../util/dom");function s(e){return new Proxy({},function(e){return{get:(t,n)=>t[n]||n in t||"string"!=typeof n?t[n]:t[n]=function(e,t){return function n(s,o,c){return"function"==typeof s?n(void 0,void 0,s):"function"==typeof o?n(s,void 0,o):void 0!==s&&function(e){return"object"!=typeof e||Object.values(e).slice(-1).every(e=>"object"==typeof e)}(s)?n(void 0,s,c):new r.El(function(n,r,s){const o=n(t,e,r,s);if(e!==o.tagName.toLowerCase())throw new Error(`TypedDOM: Tag name must be "${e}", but got "${o.tagName.toLowerCase()}".`);return i.define(o,r),o}(c||((e,t)=>e(t)),s||{},o),o)}}(n,e)}}(e))}n.API=s,n.TypedHTML=s(i.html),n.TypedSVG=s(i.svg)},{"../util/dom":91,"./manager":90}],89:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/uuid"),i=e("spica/sqid"),s=r.uuid().split("-").pop();n.uid=function(){return`id-${s}-${String(+i.sqid()).padStart(6,"0")}`}},{"spica/sqid":80,"spica/uuid":86}],90:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./identity");var i;!function(e){e.Void="void",e.Text="text",e.Collection="collection",e.Record="record"}(i||(i={}));const s=new WeakSet;function o({element:e}){if(null!==e.parentElement&&s.has(e.parentElement))throw new Error("TypedDOM: Cannot add an element used in another typed dom.")}n.El=class{constructor(e,t){switch(this.element_=e,this.children_=t,this.type=void 0===this.children_?i.Void:"string"==typeof this.children_?i.Text:Array.isArray(this.children_)?i.Collection:i.Record,this.tag,o(this),s.add(e),this.type){case i.Void:return;case i.Text:return c(),this.children_=e.appendChild(document.createTextNode("")),void(this.children=t);case i.Collection:return c(),this.children_=[],void(this.children=t);case i.Record:return c(),this.children_=(n=e,r=Object.assign({},t),Object.defineProperties(r,Object.entries(r).reduce((e,[t,r])=>(o(r),n.appendChild(r.element),e[t]={configurable:!0,enumerable:!0,get:()=>r,set:e=>{const t=r;e!==t&&(e.element_.parentElement===n||o(e),r=e,n.replaceChild(e.element,t.element))}},e),{}))),void(this.children=t)}var n,r;function c(){for(;e.childNodes.length>0;)e.removeChild(e.firstChild)}}get id(){return this.id_=this.id_||this.element_.id.trim()||r.uid()}get query(){return this.id===this.element_.id.trim()?`#${this.id}`:`.${this.id}`}scope(e){const t=/^(\s*)\$scope(?!\w)/gm;e.forEach(e=>e.element instanceof HTMLStyleElement&&void function(e,n){if(-1===e.innerHTML.search(t))return;e.innerHTML=e.innerHTML.replace(t,(e,t)=>`${t}${n}`);const r=n.slice(1);switch(n[0]){case".":if(!(e.getAttribute("class")||"").split(" ").includes(r))break;e.setAttribute("class",`${e.getAttribute("class")} ${r}`.trim())}0!==e.children.length&&[...e.querySelectorAll("*")].forEach(e=>void e.remove())}(e.element,this.query))}get element(){return this.element_}get children(){switch(this.type){case i.Text:return this.children_.data;default:return this.children_}}set children(e){switch(this.type){case i.Void:return;case i.Text:return e=document.createTextNode(e),this.element_.replaceChild(e,this.children_),void(this.children_=e);case i.Collection:return this.children_.reduce((e,t)=>{const n=e.indexOf(t);return n>-1?e:(e.splice(n,1),t.element.remove(),e)},[...e]),this.children_=[],e.forEach((e,t)=>{e.element_.parentElement===this.element_||o(e),this.children_[t]=e,this.element_.appendChild(e.element)}),Object.freeze(this.children_),void this.scope(Object.values(this.children_));case i.Record:return Object.keys(this.children_).forEach(t=>this.children_[t]=e[t]),void this.scope(Object.values(this.children_))}}}},{"./identity":89}],91:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.observe=function(e,t,n={childList:!0}){return(r,...i)=>{const s=new MutationObserver(t),o=e(r);return s.observe(o,n),c(o,...i),o}};const r=new Map;function i(e){return document.createTextNode(e)}var s;function o(e,t,n={},i=[]){const s=`${e}:${t}`,o=r.has(s)?r.get(s).cloneNode(!0):r.set(s,function(e,t){switch(e){case 0:return document.createElement(t);case 1:return document.createElementNS("http://www.w3.org/2000/svg",t);default:throw new Error(`TypedDOM: Unknown namespace: ${e}`)}}(e,t)).get(s).cloneNode(!0);return c(o,n,i),o}function c(e,t={},n=[]){return t[Symbol.iterator]?c(e,{},t):"string"==typeof n?c(e,t,[i(n)]):(Object.entries(t).forEach(([t,n])=>"string"==typeof n?void e.setAttribute(t,n):void e.addEventListener(t.slice(2),n,{passive:["wheel","mousewheel","touchstart","touchmove"].includes(t.slice(2))})),void[...n].forEach(t=>void e.appendChild(t)))}n.html=function(e,t={},n=[]){return o(0,e,t,n)},n.svg=function(e,t={},n=[]){return o(1,e,t,n)},n.frag=function(e=[]){e="string"==typeof e?[i(e)]:e;const t=document.createDocumentFragment();return[...e].forEach(e=>void t.appendChild(e)),t},n.text=i,function(e){e[e.HTML=0]="HTML",e[e.SVG=1]="SVG"}(s||(s={})),n.define=c},{}],92:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./noop");function i(e,t,n,r=!1,i={}){return"string"==typeof n?o(e,t,n,r,Object.assign({},"boolean"==typeof i?{capture:i}:i,{once:!0})):s(e,t,n,Object.assign({},"boolean"==typeof r?{capture:r}:r,{once:!0}))}function s(e,t,i,s=!1){e.addEventListener(t,u,a(s));let o=()=>(o=r.noop,void e.removeEventListener(t,u,a(s)));return()=>void o();function u(e){"object"==typeof s&&(s.passive&&(e.preventDefault=r.noop),s.once&&o()),n.currentTargets.set(e,e.currentTarget),i(e)}function a(e){return c?e:"boolean"==typeof e?e:!!e.capture}}function o(e,t,n,r,o={}){return s(e instanceof Document?e.documentElement:e,n,s=>{const c=s.target.closest(t);c&&[...e.querySelectorAll(t)].filter(e=>e===c).forEach(e=>void i(e,n,e=>{r(e)},o))},Object.assign({},o,{capture:!0}))}n.currentTargets=new WeakMap,n.listen=function(e,t,n,r=!1,i={}){return"string"==typeof n?o(e,t,n,r,i):s(e,t,n,r)},n.once=i,n.bind=s,n.delegate=o;let c=!1;try{document.createElement("div").addEventListener("test",function(){},{get capture(){return c=!0}})}catch(e){}},{"./noop":93}],93:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.noop=function(){}},{}],94:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("./layer/interface/service/gui");n.default=r.GUI;var i=e("./layer/interface/service/gui");n.Pjax=i.GUI;var s=e("./lib/router");n.router=s.router},{"./layer/interface/service/gui":126,"./lib/router":137}],95:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../domain/router/api");var i=e("../domain/event/router");n.RouterEvent=i.RouterEvent,n.RouterEventType=i.RouterEventType,n.RouterEventSource=i.RouterEventSource;var s=e("../domain/data/config");n.Config=s.Config,n.scope=s.scope,n.route=function(e,t,n,i){return r.route(new r.RouterEntity(e,t,new r.RouterEntityState(n.process,n.scripts)),i)}},{"../domain/data/config":99,"../domain/event/router":102,"../domain/router/api":103}],96:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("../domain/store/path");n.loadTitle=r.loadTitle,n.savePosition=r.savePosition},{"../domain/store/path":119}],97:[function(e,t,n){"use strict";var r;function i(e){return e.trim().replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g,e=>2===e.length?e:"").replace(/%(?![0-9A-F]{2})|[^%\[\]]+/gi,encodeURI).replace(/\?[^#]+/,e=>"?"+e.slice(1).replace(/%[0-9A-F]{2}|[^=&]/gi,e=>e.length<3?encodeURIComponent(e):e)).replace(/%[0-9A-F]{2}/gi,e=>e.toUpperCase()).replace(/#.+/,e.slice(e.indexOf("#")))}Object.defineProperty(n,"__esModule",{value:!0}),r||(r={}),n.standardizeUrl=function(e){return i(function(e){return s.href=e||location.href,s.href.replace(/^([^:/?#]+:\/\/[^/?#]*?):(?:80)?(?=$|[/?#])/,"$1").replace(/^([^:/?#]+:\/\/[^/?#]*)\/?/,"$1/").replace(/%[0-9A-F]{2}/gi,e=>e.toUpperCase()).replace(/#.+/,e.slice(e.indexOf("#")))}(e))},n._encode=i;const s=document.createElement("a")},{}],98:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/assign");function i(){window.history.replaceState(r.extend(window.history.state||{},{title:document.title}),document.title)}function s(){window.history.replaceState(r.extend(window.history.state||{},{position:{top:window.pageYOffset,left:window.pageXOffset}}),document.title)}i(),s(),n.loadTitle=function(){return window.history.state.title||document.title},n.saveTitle=i,n.loadPosition=function(){return window.history.state.position||{top:window.pageYOffset,left:window.pageXOffset}},n.savePosition=s},{"spica/assign":5}],99:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/assign");var s=e("./config/scope");n.scope=s.scope;n.Config=class{constructor(e){this.areas=["body"],this.link="a",this.form="form:not([method])",this.replace="",this.fetch={headers:new Headers,timeout:3e3,wait:0},this.update={head:"base, meta, link",css:!0,script:!0,ignore:"",ignores:{extension:'[href^="chrome-extension://"]',security:'[src*=".scr.kaspersky-labs.com/"]'},reload:"",logger:""},this.sequence=new o,this.progressbar="display:none;position:absolute;bottom:0;left:0;width:0;height:2px;background:rgb(40, 105, 255);",this.scope={},Object.defineProperties(this.update,{ignore:{enumerable:!1,set(e){this.ignores._=e},get(){return Object.keys(this.ignores).map(e=>this.ignores[e]).filter(e=>e.trim().length>0).join(",")}}}),i.extend(this,e),Object.freeze(this),this.fetch.headers.set("X-Pjax","1")}filter(e){return e.matches(":not([target])")}redirect(e){return e}rewrite(e,t){}fallback(e,t){if(e instanceof HTMLAnchorElement)window.location.assign(e.href);else if(e instanceof HTMLFormElement)window.location.assign(e.action);else{if(!(e instanceof Window))throw t;window.location.reload(!0)}}};class o{fetch(){return r(this,void 0,void 0,function*(){return"fetch"})}unload(){return r(this,void 0,void 0,function*(){return"unload"})}content(){return r(this,void 0,void 0,function*(){return"content"})}ready(){return r(this,void 0,void 0,function*(){return"ready"})}load(){return r(this,void 0,void 0,function*(){})}}},{"./config/scope":100,"spica/assign":5}],100:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../../lib/router"),i=e("../../../domain/data/config"),s=e("spica/sequence"),o=e("spica/maybe"),c=e("spica/assign");n.scope=function(e,t){const n=Object.assign({"/":{}},e.scope);return s.Sequence.from(Object.keys(n).sort().reverse()).dropWhile(e=>!r.compare(e,t.orig)&&!r.compare(e,t.dest)).take(1).filter(e=>!!r.compare(e,t.orig)&&r.compare(e,t.dest)).map(e=>n[e]).map(t=>t?o.Just(new i.Config(c.extend({},e,t))):o.Nothing).extract().reduce((e,t)=>t,o.Nothing)}},{"../../../../lib/router":137,"../../../domain/data/config":99,"spica/assign":5,"spica/maybe":19,"spica/sequence":79}],101:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../lib/error");n.DomainError=class extends r.PjaxError{constructor(e){super(`Domain: ${e}`)}}},{"../../../lib/error":135}],102:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../lib/url"),i=e("../../data/model/domain/url"),s=e("../../../lib/dom"),o=e("typed-dom");var c,u;n.RouterEvent=class{constructor(e){this.original=e,this.type=this.original.type.toLowerCase(),this.source=o.currentTargets.get(this.original),this.request=new a(this.source),this.location=new l(this.request.url),Object.freeze(this)}},function(e){e.Anchor=HTMLAnchorElement,e.Form=HTMLFormElement,e.Window=window.Window}(c=n.RouterEventSource||(n.RouterEventSource={})),function(e){e.click="click",e.submit="submit",e.popstate="popstate"}(n.RouterEventType||(n.RouterEventType={})),function(e){e.GET="GET",e.POST="POST"}(u=n.RouterEventMethod||(n.RouterEventMethod={}));class a{constructor(e){this.source=e,this.method=(()=>{if(this.source instanceof c.Anchor)return u.GET;if(this.source instanceof c.Form)return this.source.method.toUpperCase()===u.POST?u.POST:u.GET;if(this.source instanceof c.Window)return u.GET;throw new TypeError})(),this.url=(()=>{if(this.source instanceof c.Anchor)return i.standardizeUrl(this.source.href);if(this.source instanceof c.Form)return this.source.method.toUpperCase()===u.GET?i.standardizeUrl(this.source.action.split(/[?#]/)[0]+`?${s.serialize(this.source)}`):i.standardizeUrl(this.source.action.split(/[?#]/)[0]);if(this.source instanceof c.Window)return i.standardizeUrl(window.location.href);throw new TypeError})(),this.body=(()=>this.source instanceof c.Form&&this.method===u.POST?new FormData(this.source):null)(),Object.freeze(this)}}n.RouterEventRequest=a;class l{constructor(e){this.target=e,this.orig=new r.URL(i.standardizeUrl(window.location.href)),this.dest=new r.URL(this.target),Object.freeze(this)}}n.RouterEventLocation=l},{"../../../lib/dom":134,"../../../lib/url":138,"../../data/model/domain/url":97,"typed-dom":87}],103:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/either"),s=e("./module/fetch"),o=e("./module/update"),c=e("./module/update/content"),u=e("../store/path"),a=e("../data/error");var l=e("./model/eav/entity");n.RouterEntity=l.RouterEntity,n.RouterEntityState=l.RouterEntityState,n.route=function(e,t){return r(this,void 0,void 0,function*(){return i.Right(void 0).bind(e.state.process.either).bind(()=>(n=t.document,l=e.config.areas,c.separate({src:n,dst:n},l).extract(()=>!1,()=>!0)?i.Right(void 0):i.Left(new a.DomainError("Failed to match areas.")))).fmap(()=>s.fetch(e.event.request,e.config,e.state.process)).fmap(n=>r(this,void 0,void 0,function*(){return(yield n).fmap(([n,r])=>o.update(e,n,r,{document:t.document,position:u.loadPosition})).extract(i.Left)})).extract(i.Left);var n,l})}},{"../data/error":101,"../store/path":119,"./model/eav/entity":104,"./module/fetch":106,"./module/update":108,"./module/update/content":110,"spica/either":13}],104:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.RouterEntity=class{constructor(e,t,n){this.config=e,this.event=t,this.state=n,Object.freeze(this)}};n.RouterEntityState=class{constructor(e,t){this.process=e,this.scripts=t,Object.freeze(this)}}},{}],105:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../../../../lib/html");n.FetchResponse=class{constructor(e,t){this.url=e,this.xhr=t,this.header=(e=>this.xhr.getResponseHeader(e)),this.document=this.xhr.response,r.fix(this.document),Object.freeze(this)}}},{"../../../../../../lib/html":136}],106:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/either"),s=e("spica/tuple"),o=e("../module/fetch/xhr"),c=e("../../data/error"),u=e("../../../../lib/url");n.fetch=function({method:e,url:t,body:n},{redirect:a,fetch:{headers:l,timeout:d,wait:h},sequence:f},p){return r(this,void 0,void 0,function*(){const r=o.xhr(e,t,l,n,d,a,p);window.dispatchEvent(new Event("pjax:fetch"));const[m,v]=yield Promise.all([r,f.fetch(void 0,{path:new u.URL(t).path,method:e,headers:l,body:n}),new Promise(e=>void setTimeout(e,h))]);return m.bind(p.either).bind(e=>new u.URL(e.url).origin===new u.URL(t).origin?i.Right(s.tuple([e,v])):i.Left(new c.DomainError(`Request is redirected to the different domain url ${new u.URL(e.url).href}`)))})}},{"../../../../lib/url":138,"../../data/error":101,"../module/fetch/xhr":107,"spica/either":13,"spica/tuple":83}],107:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/promise"),i=e("spica/sequence"),s=e("spica/either"),o=e("../../model/eav/value/fetch"),c=e("../../../../data/model/domain/url"),u=e("../../../data/error"),a=e("../../../../../lib/url");function l(e,t){return i.Sequence.intersect(i.Sequence.from(n(e||"").sort()),i.Sequence.from(n(t).sort()),(e,t)=>e.localeCompare(t)).take(1).extract().length>0;function n(e){return e.split(";").map(e=>e.trim()).filter(e=>e.length>0)}}n.xhr=function(e,t,n,i,d,h,f){const p=c.standardizeUrl(h(new a.URL(t).path)),m=new XMLHttpRequest;return new r.AtomicPromise(r=>(m.open(e,new a.URL(p).path,!0),[...n.entries()].forEach(([e,t])=>void m.setRequestHeader(e,t)),m.responseType="document",m.timeout=d,m.send(i),m.addEventListener("abort",()=>void r(s.Left(new u.DomainError("Failed to request a page by abort.")))),m.addEventListener("error",()=>void r(s.Left(new u.DomainError("Failed to request a page by error.")))),m.addEventListener("timeout",()=>void r(s.Left(new u.DomainError("Failed to request a page by timeout.")))),m.addEventListener("load",()=>void function(e){return s.Right(e).bind(e=>/2..|304/.test(`${e.status}`)?s.Right(e):s.Left(new u.DomainError("Failed to validate the status of response."))).bind(e=>l(e.getResponseHeader("Content-Type"),"text/html")?s.Right(e):s.Left(new u.DomainError("Failed to validate the content type of response.")))}(m).fmap(e=>new o.FetchResponse(e.responseURL&&t===p?c.standardizeUrl(e.responseURL):t,e)).extract(e=>void r(s.Left(e)),e=>void r(s.Right(e)))),void f.register(()=>void m.abort())))},n.match_=l},{"../../../../../lib/url":138,"../../../../data/model/domain/url":97,"../../../data/error":101,"../../model/eav/value/fetch":105,"spica/either":13,"spica/promise":78,"spica/sequence":79}],108:[function(e,t,n){(function(t){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/either"),s=e("spica/hlist"),o=e("spica/tuple"),c=e("../../event/router"),u=e("../module/update/blur"),a=e("../module/update/url"),l=e("../module/update/title"),d=e("../module/update/head"),h=e("../module/update/content"),f=e("../module/update/css"),p=e("../module/update/script"),m=e("../module/update/focus"),v=e("../module/update/scroll"),b=e("../../store/path"),y=e("../../data/error");n.update=function({event:e,config:t,state:n},w,q,S){return r(this,void 0,void 0,function*(){const{process:g}=n,_={src:w.document,dst:S.document};return(new s.HNil).push(g.either(q)).modify(e=>e.bind(()=>h.separate(_,t.areas).extract(()=>i.Left(new y.DomainError("Failed to separate the areas.")),()=>e)).fmap(e=>r(this,void 0,void 0,function*(){return window.dispatchEvent(new Event("pjax:unload")),g.either(yield t.sequence.unload(e,w))})).fmap(e=>r(this,void 0,void 0,function*(){return(yield e).bind(e=>h.separate(_,t.areas).fmap(([t])=>[e,t]).extract(()=>i.Left(new y.DomainError("Failed to separate the areas.")),g.either))})).fmap(e=>r(this,void 0,void 0,function*(){return(yield e).bind(([e,n])=>(t.rewrite(_.src,n),h.separate(_,t.areas).fmap(([,t])=>[e,t]).extract(()=>i.Left(new y.DomainError("Failed to separate the areas.")),g.either)))}))).modify(y=>y.fmap(y=>r(this,void 0,void 0,function*(){return(yield y).bind(g.either).fmap(([y,q])=>(new s.HNil).extend(()=>r(this,void 0,void 0,function*(){return u.blur(_.dst),a.url(new c.RouterEventLocation(w.url),_.src.title,e.type,e.source,t.replace),l.title(_),b.saveTitle(),d.head(_,t.update.head,t.update.ignore),g.either(h.content(_,q)).fmap(([e,t])=>[e,Promise.all(t)])})).extend(s=>r(this,void 0,void 0,function*(){return(yield s).fmap(([i])=>r(this,void 0,void 0,function*(){t.update.css&&f.css(_,t.update.ignore),S.document.dispatchEvent(new Event("pjax:content"));const r=yield t.sequence.content(y,i),s=t.update.script?yield p.script(_,n.scripts,t.update,10*Math.max(t.fetch.timeout,1e3),g):yield g.either(o.tuple([[],Promise.resolve(g.either([]))]));return m.focus(e.type,_.dst),v.scroll(e.type,_.dst,{hash:e.location.dest.fragment,position:S.position}),b.savePosition(),S.document.dispatchEvent(new Event("pjax:ready")),o.tuple([s.fmap(([e,t])=>[e,t.then(e=>e.extract())]),yield t.sequence.ready(r)])})).fmap(e=>e.then(([e,t])=>e.fmap(e=>[e,t]))).extract(e=>r(this,void 0,void 0,function*(){return i.Left(e)}))})).reverse().tuple())}))).modify(e=>e.fmap(e=>r(this,void 0,void 0,function*(){return(yield e).bind(g.either).fmap(([e,n])=>r(this,void 0,void 0,function*(){return g.either(yield Promise.all([e,n])).bind(([e,n])=>e.bind(([,e])=>n.fmap(([[,n],r])=>void Promise.all([e,n]).then(g.either).then(e=>e.fmap(([e])=>(window.dispatchEvent(new Event("pjax:load")),void t.sequence.load(r,e))).extract(()=>void 0))))).extract(()=>void 0),n})).fmap(e=>r(this,void 0,void 0,function*(){return(yield e).fmap(([e])=>e)})).extract(i.Left)}))).head.extract(i.Left)})}}).call(this,e("_process"))},{"../../data/error":101,"../../event/router":102,"../../store/path":119,"../module/update/blur":109,"../module/update/content":110,"../module/update/css":111,"../module/update/focus":112,"../module/update/head":113,"../module/update/script":114,"../module/update/scroll":115,"../module/update/title":117,"../module/update/url":118,_process:4,"spica/either":13,"spica/hlist":18,"spica/tuple":83}],109:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.blur=function(e){e===window.document&&e.activeElement!==e.body&&(e.activeElement.blur(),e.body.focus())}},{}],110:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/promise"),i=e("spica/maybe"),s=e("spica/concat"),o=e("spica/tuple"),c=e("typed-dom"),u=e("../../../../../lib/dom"),a=e("./script");function l(e){return(e.match(/(?:[^,\(\[]+|\(.*?\)|\[.*?\])+/g)||[]).map(e=>e.trim())}function d(e){return r.AtomicPromise.race([new r.AtomicPromise(t=>void c.once(e,"load",t)),new r.AtomicPromise(t=>void c.once(e,"abort",t)),new r.AtomicPromise(t=>void c.once(e,"error",t))])}n.content=function(e,t,n={replace:(e,t)=>void t.parentNode.replaceChild(e,t)}){return[t.map(e=>e.dst).reduce(s.concat,[]),t.map(function(t){return t.src.map((n,r)=>({src:e.dst.importNode(t.src[r].cloneNode(!0),!0),dst:t.dst[r]})).map(e=>(!function(e){const t=u.find(e.src,"script").map(a.escape).reduce((e,t)=>()=>(e(),void t()),()=>void 0);n.replace(e.src,e.dst),t()}(e),u.find(e.src,"img, iframe, frame").map(d))).reduce(s.concat,[])}).reduce(s.concat,[])]},n.separate=function(e,t){return t.reduce((t,n)=>i.Maybe.mplus(t,function(e,t){return l(t).map(t=>({src:u.find(e.src,t),dst:u.find(e.dst,t)})).reduce((e,t)=>e.bind(e=>(function(e){return i.Just(e).guard(function(e){return e.src.length>0&&e.src.length===e.dst.length}(e))})(t).fmap(t=>s.concat(e,[t]))),i.Just([]))}(e,n).fmap(e=>o.tuple([n,e]))),i.Nothing)},n._split=l,n._wait=d},{"../../../../../lib/dom":134,"./script":114,"spica/concat":11,"spica/maybe":19,"spica/promise":78,"spica/tuple":83,"typed-dom":87}],111:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../../../lib/dom"),i=e("./sync");n.css=function(e,t){const n='link[rel~="stylesheet"], style';return void["head","body"].map(t=>[e.src.querySelector(t),e.dst.querySelector(t)]).forEach(([e,t])=>void i.sync(i.pair(s(e),s(t),(e,t)=>e.outerHTML===t.outerHTML),t));function s(e){return r.find(e,n).filter(e=>!e.matches(t.trim()||"_"))}}},{"../../../../../lib/dom":134,"./sync":116}],112:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../event/router"),i=e("../../../../../lib/dom");n.focus=function(e,t){switch(e){case r.RouterEventType.click:case r.RouterEventType.submit:return void i.find(t,"[autofocus]").slice(-1).filter(e=>e.closest("html")===window.document.documentElement&&e!==t.activeElement).forEach(e=>void e.focus());case r.RouterEventType.popstate:return;default:throw new TypeError(e)}}},{"../../../../../lib/dom":134,"../../../event/router":102}],113:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./sync"),i=e("../../../../../lib/dom");n.head=function(e,t,n){return n+=t.includes("link")?', link[rel~="stylesheet"]':"",void r.sync(r.pair(s(e.src.head),s(e.dst.head),(e,t)=>e.outerHTML===t.outerHTML),e.dst.head);function s(e){return i.find(e,t).filter(e=>!e.matches(n.trim()||"_"))}}},{"../../../../../lib/dom":134,"./sync":116}],114:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/promise"),s=e("spica/either"),o=e("spica/tuple"),c=e("spica/concat"),u=e("../../../../../lib/dom"),a=e("../../../../../lib/error"),l=e("../../../../../lib/url"),d=e("../../../../data/model/domain/url"),h=e("typed-dom");function f(e,t){return r(this,void 0,void 0,function*(){if(!e.hasAttribute("src"))return s.Right([e,e.text]);if("module"===e.type.toLowerCase())return s.Right([e,""]);const n=new XMLHttpRequest;return n.open("GET",e.src,!0),n.timeout=t,n.send(),new i.AtomicPromise(t=>["load","abort","error","timeout"].forEach(r=>{switch(r){case"load":return void n.addEventListener(r,()=>void t(s.Right([e,n.response])));default:return void n.addEventListener(r,()=>"error"===r&&e.matches("[src][async]")?void t(v(e).then(()=>s.Right([e,""]),()=>s.Left(new Error(`${e.src}: ${n.statusText}`)))):void t(s.Left(new Error(`${e.src}: ${n.statusText}`))))}}))})}function p(t,n,r,o,c,u){const h=!!(t=t.ownerDocument===document?t:document.importNode(t.cloneNode(!0),!0)).parentElement&&t.parentElement.matches(r.trim()||"_"),f=document.querySelector(h?t.parentElement.id?`#${t.parentElement.id}`:t.parentElement.tagName:"_")||document.body,p=m(t);f.appendChild(t),p(),!h&&t.remove();const b=i.AtomicPromise.resolve(c).then(u.promise).then(function(){if(t.matches('[type="module"][src]'))return i.AtomicPromise.resolve(Promise.resolve().then(()=>e(t.src))).catch(e=>e.message.startsWith("Failed to load ")&&t.matches("[src][async]")?v(t).catch(()=>i.AtomicPromise.reject(e)):i.AtomicPromise.reject(e)).then(()=>(t.dispatchEvent(new Event("load")),s.Right(t)),e=>(t.dispatchEvent(new Event("error")),s.Left(new a.FatalError(e instanceof Error?e.message:e+""))));try{if(new l.URL(d.standardizeUrl(window.location.href)).path!=new l.URL(d.standardizeUrl(window.location.href)).path)throw new a.FatalError("Expired.");if(o.has(new l.URL(d.standardizeUrl(window.location.href)).href))throw new a.FatalError("Expired.");return(0,eval)(n),t.hasAttribute("src")&&t.dispatchEvent(new Event("load")),i.AtomicPromise.resolve(s.Right(t))}catch(e){return t.hasAttribute("src")&&t.dispatchEvent(new Event("error")),i.AtomicPromise.resolve(s.Left(new a.FatalError(e instanceof Error?e.message:e+"")))}});return t.matches("[src][async]")?s.Right(b):s.Left(b)}function m(e){const t=e.hasAttribute("src")?e.getAttribute("src"):null,n=e.text;return e.removeAttribute("src"),e.text="",()=>(e.text=" ",e.text=n,"string"==typeof t?void e.setAttribute("src",t):void 0)}function v(e){return new l.URL(d.standardizeUrl(e.src)).origin===new l.URL(d.standardizeUrl(window.location.href)).origin?i.AtomicPromise.reject(new Error):(e=h.html("script",Object.values(e.attributes).reduce((e,{name:t,value:n})=>(e[t]=n,e),{}),[...e.childNodes]),new i.AtomicPromise((t,n)=>(e.addEventListener("load",()=>void t()),e.addEventListener("error",n),document.body.appendChild(e),void e.remove())))}n.script=function(e,t,n,a,h,m={fetch:f,evaluate:p}){const v=u.find(e.src,"script").filter(e=>!e.type||/(?:application|text)\/(?:java|ecma)script|module/i.test(e.type)).filter(e=>!e.matches(n.ignore.trim()||"_")).filter(e=>!e.hasAttribute("src")||!t.has(new l.URL(d.standardizeUrl(e.src)).href)||e.matches(n.reload.trim()||"_")),{ss:b,as:y}=v.reduce((e,t)=>{switch(!0){case t.matches("[src][async], [src][defer]"):e.as.push(t);break;default:e.ss.push(t)}return e},{ss:[],as:[]});return i.AtomicPromise.all([i.AtomicPromise.all(w(b)).then(q),i.AtomicPromise.all(w(y)).then(q)]).then(([e,t])=>r(this,void 0,void 0,function*(){return e.fmap(e=>r(this,void 0,void 0,function*(){return(yield e).fmap(([e,n])=>o.tuple([e,n.then(e=>r(this,void 0,void 0,function*(){return t.fmap(t=>r(this,void 0,void 0,function*(){return(yield t).fmap(([t,n])=>i.AtomicPromise.all([e,s.Right(t),n]).then(e=>e.reduce((e,t)=>e.bind(e=>t.fmap(t=>c.concat(e,t)))))).extract(s.Left)})).extract(s.Left)}))]))})).extract(s.Left)}));function w(e){return e.map(e=>m.fetch(e,a))}function q(e){return e.reduce((e,t)=>t.bind(()=>e),e.reduce((e,r)=>e.bind(h.either).bind(([e,u])=>r.fmap(([r,s])=>m.evaluate(r,s,n.logger,t,i.AtomicPromise.all(e),h)).bind(t=>t.extract(t=>s.Right(o.tuple([c.concat(e,[t]),u])),t=>s.Right(o.tuple([e,c.concat(u,[t])]))))),s.Right([[],[]]))).fmap(([e,t])=>i.AtomicPromise.all(e).then(s.Either.sequence).then(e=>e.fmap(e=>o.tuple([e,Promise.all(t).then(s.Either.sequence)]))))}},n._fetch=f,n._evaluate=p,n.escape=m},{"../../../../../lib/dom":134,"../../../../../lib/error":135,"../../../../../lib/url":138,"../../../../data/model/domain/url":97,"spica/concat":11,"spica/either":13,"spica/promise":78,"spica/tuple":83,"typed-dom":87}],115:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../event/router");function i(e,t,n={scrollToElement:e=>void e.scrollIntoView()}){const r=t.slice(1);if(0===r.length)return!1;const i=e.getElementById(r)||e.getElementsByName(r)[0];return!!i&&(n.scrollToElement(i),!0)}n.scroll=function(e,t,n,s={scrollToElement:e=>void e.scrollIntoView(),scrollToPosition:({top:e,left:t})=>void window.scrollTo(t,e),hash:i}){switch(e){case r.RouterEventType.click:if(s.hash(t,n.hash,s))return;return void s.scrollToPosition({top:0,left:0});case r.RouterEventType.submit:return void s.scrollToPosition({top:0,left:0});case r.RouterEventType.popstate:return void s.scrollToPosition(n.position());default:throw new TypeError(e)}},n._hash=i},{"../../../event/router":102}],116:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/either"),i=e("spica/concat"),s=e("spica/tuple");n.sync=function(e,t,n={before:function(e,t,n){t.map(t=>e.ownerDocument.importNode(t.cloneNode(!0),!0)).forEach(t=>void e.insertBefore(t,n))},remove:function(e){e.remove()}}){return void e.forEach(([e,r])=>(n.before((r=r,r?r.parentElement:t),e.slice(-1).some(e=>!!r&&e.outerHTML===r.outerHTML)?e.slice(0,-1):e,r),r&&0===e.length?void n.remove(r):void 0));var r},n.pair=function(e,t,n){const o=function(e,t,n){return e.reduce((e,s)=>0===t.length?e.set(null,i.concat(e.get(null)||[],[s])):t.reduce((e,t)=>e.bind(e=>!e.has(t)&&n(s,t)?(e.set(t,i.concat(e.get(null)||[],[s])),e.delete(null),r.Left(e)):r.Right(e)),r.Right(e)).fmap(e=>e.set(null,i.concat(e.get(null)||[],[s]))).extract(e=>e),new Map)}(e,t,n);return t.filter(e=>!o.has(e)).forEach(e=>void o.set(e,[])),[...o].map(([e,t])=>s.tuple([t,e]))}},{"spica/concat":11,"spica/either":13,"spica/tuple":83}],117:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.title=function(e){e.dst.title=e.src.title}},{}],118:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../event/router");function i(e,t){if(t.dest.href===t.orig.href)return!1;switch(e){case r.RouterEventType.click:case r.RouterEventType.submit:return!0;case r.RouterEventType.popstate:return!1;default:throw new TypeError(e)}}function s(e,t,n){switch(e){case r.RouterEventType.click:case r.RouterEventType.submit:return t.matches(n.trim()||"_");case r.RouterEventType.popstate:return!1;default:throw new TypeError(e)}}e("typed-dom").bind(document,"pjax:ready",()=>void window.history.replaceState(window.history.state,window.document.title)),n.url=function(e,t,n,r,o){switch(!0){case s(n,r,o):return void window.history.replaceState({},t,e.dest.href);case i(n,e):return void window.history.pushState({},t,e.dest.href);default:return}},n._isRegisterable=i,n._isReplaceable=s},{"../../../event/router":102,"typed-dom":87}],119:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("../../data/store/state"))},{"../../data/store/state":98}],120:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../lib/error");n.InterfaceError=class extends r.PjaxError{constructor(e){super(`Interface: ${e}`)}}},{"../../../lib/error":135}],121:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy"),i=e("spica/promise"),s=e("typed-dom");n.ClickView=class{constructor(e,t,n){this.sv=new class extends r.Supervisor{},this.close=(()=>void this.sv.terminate()),this.sv.register("",()=>new i.AtomicPromise(()=>void this.sv.events.exit.monitor([],s.delegate(e,t,"click",e=>{e.currentTarget instanceof HTMLAnchorElement&&"string"==typeof e.currentTarget.href&&n(e)}))),void 0),this.sv.cast("",void 0)}}},{"spica/promise":78,"spica/supervisor.legacy":81,"typed-dom":87}],122:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy"),i=e("spica/promise"),s=e("typed-dom"),o=e("../../../data/model/domain/url"),c=e("../../service/state/url");n.NavigationView=class{constructor(e,t){this.sv=new class extends r.Supervisor{},this.close=(()=>void this.sv.terminate()),this.sv.register("",()=>new i.AtomicPromise(()=>void this.sv.events.exit.monitor([],s.bind(e,"popstate",n=>{o.standardizeUrl(e.location.href)!==c.docurl.href&&t(n)}))),void 0),this.sv.cast("",void 0)}}},{"../../../data/model/domain/url":97,"../../service/state/url":133,"spica/promise":78,"spica/supervisor.legacy":81,"typed-dom":87}],123:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy"),i=e("spica/promise"),s=e("typed-dom"),o=e("spica/throttle");n.ScrollView=class{constructor(e,t){this.sv=new class extends r.Supervisor{},this.close=(()=>void this.sv.terminate()),this.sv.register("",()=>new i.AtomicPromise(()=>void this.sv.events.exit.monitor([],s.bind(e,"scroll",o.debounce(100,e=>{t(e)}),{passive:!0}))),void 0),this.sv.cast("",void 0)}}},{"spica/promise":78,"spica/supervisor.legacy":81,"spica/throttle":82,"typed-dom":87}],124:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy"),i=e("spica/promise"),s=e("typed-dom");n.SubmitView=class{constructor(e,t,n){this.sv=new class extends r.Supervisor{},this.close=(()=>void this.sv.terminate()),this.sv.register("",()=>new i.AtomicPromise(()=>void this.sv.events.exit.monitor([],s.delegate(e,t,"submit",e=>{e.currentTarget instanceof HTMLFormElement&&n(e)}))),void 0),this.sv.cast("",void 0)}}},{"spica/promise":78,"spica/supervisor.legacy":81,"typed-dom":87}],125:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./router"),i=e("./state/process"),s=e("../../../lib/html"),o=e("spica/assign"),c=e("typed-dom");function u(e,t){const n=document.createElement("a");n.href=e,s.parse("").extract().body.appendChild(n),c.once(n,"click",t),n.click()}n.API=class{static assign(e,t,n={document:window.document,router:r.route}){u(e,e=>void n.router(new r.Config(t),new r.RouterEvent(e),i.process,n))}static replace(e,t,n={document:window.document,router:r.route}){u(e,e=>void n.router(new r.Config(o.extend({},t,{replace:"*"})),new r.RouterEvent(e),i.process,n))}}},{"../../../lib/html":136,"./router":128,"./state/process":130,"spica/assign":5,"typed-dom":87}],126:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./api"),i=e("spica/supervisor.legacy"),s=e("spica/cancellation"),o=e("spica/promise"),c=e("../../../lib/url"),u=e("../../data/model/domain/url"),a=e("../module/view/click"),l=e("../module/view/submit"),d=e("../module/view/navigation"),h=e("../module/view/scroll"),f=e("./router"),p=e("./state/url");e("./state/scroll-restoration");const m=e("./state/process"),v=e("../../application/store"),b=new class extends i.Supervisor{};n.GUI=class extends r.API{constructor(e,t={document:window.document,router:f.route}){super(),this.option=e,this.io=t;const n=new f.Config(this.option);b.register("",{init:e=>e,main:(e,r)=>new o.AtomicPromise(()=>{r.register(new a.ClickView(this.io.document,n.link,e=>void t.router(n,new f.RouterEvent(e),m.process,t)).close),r.register(new l.SubmitView(this.io.document,n.form,e=>void t.router(n,new f.RouterEvent(e),m.process,t)).close),r.register(new d.NavigationView(window,e=>void t.router(n,new f.RouterEvent(e),m.process,t)).close),r.register(new h.ScrollView(window,()=>{r.canceled||new c.URL(u.standardizeUrl(window.location.href)).href===p.docurl.href&&v.savePosition()}).close)}),exit:(e,t)=>void t.cancel()},new s.Cancellation,new Error("Kill")),b.cast("",void 0)}assign(e){r.API.assign(e,this.option,this.io)}replace(e){r.API.replace(e,this.option,this.io)}}},{"../../../lib/url":138,"../../application/store":96,"../../data/model/domain/url":97,"../module/view/click":121,"../module/view/navigation":122,"../module/view/scroll":123,"../module/view/submit":124,"./api":125,"./router":128,"./state/process":130,"./state/scroll-restoration":132,"./state/url":133,"spica/cancellation":7,"spica/promise":78,"spica/supervisor.legacy":81}],127:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=document.createElement("div");window.addEventListener("pjax:fetch",()=>void document.documentElement.appendChild(r)),window.addEventListener("pjax:fetch",()=>r.style.width="5%"),window.addEventListener("pjax:unload",()=>r.style.width="80%"),document.addEventListener("pjax:ready",()=>r.style.width="90%"),window.addEventListener("pjax:load",()=>r.style.width="100%"),window.addEventListener("pjax:load",()=>void r.remove()),n.progressbar=function(e){r.setAttribute("style",e)}},{}],128:[function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function c(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0});const i=e("spica/cancellation"),s=e("typed-dom"),o=e("../../application/router");n.Config=o.Config,n.RouterEvent=o.RouterEvent,n.RouterEventSource=o.RouterEventSource;const c=e("./state/url"),u=e("../service/state/env"),a=e("./progressbar"),l=e("../data/error"),d=e("../../../lib/url"),h=e("../../data/model/domain/url"),f=e("../../application/store"),p=e("spica/maybe");function m(e,t,n){switch(n.type){case o.RouterEventType.click:return r(e)&&!function(e){const t=new d.URL(c.docurl.href);return t.origin===e.origin&&t.path===e.path&&""!==e.fragment}(e)&&!i(e)&&!n.source.hasAttribute("download")&&!function(e){return e.which>1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey}(n.original)&&t.filter(n.source);case o.RouterEventType.submit:return r(e);case o.RouterEventType.popstate:return r(e)&&!i(e);default:return!1}function r(e){return new d.URL(c.docurl.href).origin===e.origin}function i(e){const t=new d.URL(c.docurl.href);return t.origin===e.origin&&t.path===e.path&&t.fragment!==e.fragment}}s.bind(window,"pjax:unload",()=>window.history.scrollRestoration="auto",!0),n.route=function(e,t,n,v){switch(t.type){case o.RouterEventType.click:case o.RouterEventType.submit:f.savePosition();break;case o.RouterEventType.popstate:v.document.title=f.loadTitle()}p.Just(0).guard(m(new d.URL(t.request.url),e,t)).bind(()=>o.scope(e,(({orig:e,dest:t})=>({orig:e.pathname,dest:t.pathname}))(t.location))).fmap(e=>r(this,void 0,void 0,function*(){t.original.preventDefault(),n.cast("",new l.InterfaceError("Aborted."));const f=new i.Cancellation,p=n.register("",e=>(p(),f.cancel(e),new Promise(()=>void 0)),void 0),[m]=yield u.env;return window.history.scrollRestoration="manual",a.progressbar(e.progressbar),o.route(e,t,{process:f,scripts:m},v).then(e=>e.fmap(([e,t])=>r(this,void 0,void 0,function*(){return p(),c.docurl.sync(),e.filter(e=>e.hasAttribute("src")).forEach(e=>void m.add(new d.URL(h.standardizeUrl(e.src)).href)),void(yield t).filter(e=>e.hasAttribute("src")).forEach(e=>void m.add(new d.URL(h.standardizeUrl(e.src)).href))})).extract()).catch(n=>(p(),c.docurl.sync(),window.history.scrollRestoration="auto",!f.canceled||n instanceof Error&&"FatalError"===n.name?void e.fallback(s.currentTargets.get(t.original),n):void 0))})).extract(()=>r(this,void 0,void 0,function*(){switch(c.docurl.sync(),t.type){case o.RouterEventType.click:case o.RouterEventType.submit:return;case o.RouterEventType.popstate:return void e.fallback(t.source,new Error("Disabled."))}}))},n._validate=m},{"../../../lib/url":138,"../../application/router":95,"../../application/store":96,"../../data/model/domain/url":97,"../data/error":120,"../service/state/env":129,"./progressbar":127,"./state/url":133,"spica/cancellation":7,"spica/maybe":19,"typed-dom":87}],129:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("./script");n.env=Promise.all([r.scripts,new Promise(setTimeout)])},{"./script":131}],130:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/supervisor.legacy");n.process=new class extends r.Supervisor{}},{"spica/supervisor.legacy":81}],131:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../data/model/domain/url"),i=e("../../../../lib/url"),s=e("../../../../lib/dom"),o=e("typed-dom");n.scripts=new Set,o.bind(window,"pjax:unload",()=>void s.find(document,"script[src]").forEach(e=>void n.scripts.add(new i.URL(r.standardizeUrl(e.src)).href)))},{"../../../../lib/dom":134,"../../../../lib/url":138,"../../../data/model/domain/url":97,"typed-dom":87}],132:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),e("typed-dom").bind(window,"unload",()=>window.history.scrollRestoration="auto",!1)},{"typed-dom":87}],133:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../../../data/model/domain/url"),i=e("typed-dom");let s=r.standardizeUrl(location.href);i.bind(window,"hashchange",()=>void n.docurl.sync()),n.docurl=new class{constructor(){this.sync=(()=>{s=r.standardizeUrl(location.href)})}get href(){return s}}},{"../../../data/model/domain/url":97,"typed-dom":87}],134:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.find=function(e,t){return[...e.querySelectorAll(t||"_")]},n.serialize=function(e){return Array.from(e.elements).filter(e=>{if(e.disabled)return!1;switch(e.nodeName.toLowerCase()){case"input":switch(e.type.toLowerCase()){case"checkbox":case"radio":return e.checked;case"submit":case"button":case"image":case"reset":case"file":return!1;default:return!0}case"select":case"textarea":return!0;default:return!1}}).filter(e=>"string"==typeof e.name&&"string"==typeof e.value).map(e=>[encodeURIComponent(t(e.name)),encodeURIComponent(t(e.value))].join("=")).join("&");function t(e){return e.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g,e=>2===e.length?e:"")}}},{}],135:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});class r extends Error{constructor(e){super(`Pjax: ${e}`)}}n.PjaxError=r;n.FatalError=class extends r{constructor(e){super(`Pjax: Fatal: ${e}`),this.name="FatalError"}}},{}],136:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("spica/maybe"),i=e("spica/either"),s=e("spica/tuple"),o=e("./dom");function c(e){u(e).forEach(([e,t])=>e.textContent=t.textContent)}function u(e){return o.find(e,"noscript").filter(e=>e.children.length>0).map(e=>{const t=e.cloneNode(!0);return t.textContent=e.innerHTML,s.tuple([e,t])})}n.parse=[function(e){const t=(new DOMParser).parseFromString(e,"text/html");return c(t),t},function(e){const t=window.document.implementation.createHTMLDocument("");return t.open(),t.write(e),t.close(),c(t),t}].reduce((e,t)=>e.bind(()=>!function(e){try{const t='\n<html lang="en" class="html">\n  <head>\n    <link href="/">\n    <title>&amp;</title>\n    <noscript><style>/**/</style></noscript>\n  </head>\n  <body>\n    <noscript>noscript</noscript>\n    <a href="/"></a>\n    <script>document.head.remove();<\/script>\n    <img src="abc">\n  </body>\n</html>\n',n=e(t);switch(!1){case n.URL&&n.URL.startsWith(`${window.location.protocol}//${window.location.host}`):case"&"===n.title:case!!n.querySelector('html.html[lang="en"]'):case!!n.querySelector("head > link").href:case!!n.querySelector("body > a").href:case!n.querySelector("head > noscript > *"):case"document.head.remove();"===n.querySelector("script").innerHTML:case n.querySelector("img").src.endsWith("abc"):case"<style>/**/</style>"===n.querySelector("head > noscript").textContent:case"noscript"===n.querySelector("body > noscript").textContent:throw void 0}return!0}catch(e){return!1}}(t)?e:i.Left(t)),i.Right(()=>r.Nothing)).extract(e=>t=>r.Just(e(t))),n.fix=c,n._fixNoscript=u},{"./dom":134,"spica/either":13,"spica/maybe":19,"spica/tuple":83}],137:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e("../layer/data/model/domain/url"),i=e("./url"),s=e("spica/sequence"),o=e("spica/uncurry"),c=e("spica/flip"),u=e("spica/cache");function a(e,t){const n=/\/|[^/]+\/?/g,r=/\/$/;return s.Sequence.zip(s.Sequence.from(l(e)),s.Sequence.cycle([t])).map(([e,t])=>[e.match(n)||[],e.match(r)?t.match(n)||[]:t.replace(r,"").match(n)||[]]).filter(([e,t])=>e.length<=t.length&&0===s.Sequence.zip(s.Sequence.from(e),s.Sequence.from(t)).dropWhile(o.uncurry(h)).take(1).extract().length).take(1).extract().length>0}function l(e){if(e.match(/\*\*|[\[\]]/))throw new Error(`Invalid pattern: ${e}`);return""===e?[e]:s.Sequence.from(e.match(/{[^{}]*}|.[^{]*/g)).map(e=>e.match(/^{[^{}]*}$/)?e.slice(1,-1).split(","):[e]).mapM(s.Sequence.from).map(e=>e.join("")).bind(t=>t===e?s.Sequence.from([t]):s.Sequence.from(l(t))).unique().extract()}n.router=function(e){return t=>{const{path:n,pathname:o}=new i.URL(r.standardizeUrl(t));return s.Sequence.from(Object.keys(e).filter(([e])=>"/"===e).sort().reverse()).filter(c.flip(a)(o)).map(t=>e[t]).take(1).extract().pop().call(e,n)}},n.compare=a,n._expand=l;const d=new u.Cache(100);function h(e,t){if("."===t[0]&&[..."?*"].includes(e[0]))return!1;const n=`${e}:${t}`;return d.has(n)?d.get(n):d.set(n,function e(t,n){const[r="",...i]=[...t];const[c="",...u]=[...n];switch(r){case"":return""===c;case"?":return""!==c&&"/"!==c&&e(i.join(""),u.join(""));case"*":return"/"===c?e(i.join(""),n):s.Sequence.zip(s.Sequence.cycle([i.join("")]),s.Sequence.from(n).tails().map(e=>e.join(""))).filter(o.uncurry(e)).take(1).extract().length>0;default:return c===r&&e(i.join(""),u.join(""))}}(function e(t){const n=t.replace(/\*(\?+)\*?/g,"$1*");return n===t?n:e(n)}(e),t))}n._match=h},{"../layer/data/model/domain/url":97,"./url":138,"spica/cache":6,"spica/flip":16,"spica/sequence":79,"spica/uncurry":85}],138:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=Symbol();n.URL=class{constructor(e){this.parser=document.createElement("a"),this[r],this.parser.href=e||location.href,Object.freeze(this)}get href(){return this.parser.href}get origin(){return`${this.protocol}//${this.host}`}get domain(){return`${this.protocol}//${this.hostname}`}get scheme(){return this.parser.protocol.slice(0,-1)}get protocol(){return this.parser.protocol}get userinfo(){return this.parser.href.match(/[^:/?#]+:\/\/([^/?#]*)@|$/).pop()||""}get host(){return this.parser.host}get hostname(){return this.parser.hostname}get port(){return this.parser.port}get path(){return`${this.pathname}${this.query}`}get pathname(){return this.parser.pathname}get query(){return this.parser.search}get fragment(){return this.parser.href.replace(/^[^#]+/,"")}}},{}],"pjax-api":[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("./src/export"));var r=e("./src/export");n.default=r.default},{"./src/export":94}]},{},[1,2,3,"pjax-api"]),function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof module&&module.exports&&(module.exports=t())}("undefined"!=typeof self&&self,function(){return require("pjax-api")});
 
 window.Pjax = require('pjax-api').default;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message