Comparing version 0.3.6 to 0.3.7
@@ -17,3 +17,2 @@ import { Action } from "./action"; | ||
readonly data: DataMap; | ||
readonly useInlineActionObserver: boolean; | ||
initialize(): void; | ||
@@ -20,0 +19,0 @@ connect(): void; |
import { Action } from "./action"; | ||
import { Context } from "./context"; | ||
import { AttributeObserverDelegate } from "sentinella"; | ||
import { TokenListObserverDelegate } from "sentinella"; | ||
export interface InlineActionObserverDelegate { | ||
@@ -8,6 +8,6 @@ inlineActionConnected(action: Action): any; | ||
} | ||
export declare class InlineActionObserver implements AttributeObserverDelegate { | ||
export declare class InlineActionObserver implements TokenListObserverDelegate { | ||
context: Context; | ||
delegate: InlineActionObserverDelegate; | ||
private attributeObserver; | ||
private tokenListObserver; | ||
private connectedActions; | ||
@@ -20,10 +20,6 @@ constructor(context: Context, delegate: InlineActionObserverDelegate); | ||
stop(): void; | ||
elementMatchedAttribute(element: Element, attributeName: string): void; | ||
elementAttributeValueChanged(element: Element, attributeName: string): void; | ||
elementUnmatchedAttribute(element: Element, attributeName: string): void; | ||
private refreshActionForElement(element); | ||
private connectActionForElement(action, element); | ||
private disconnectActionForElement(element); | ||
private getActionForElement(element); | ||
elementMatchedTokenForAttribute(element: Element, token: string, attributeName: string): void; | ||
elementUnmatchedTokenForAttribute(element: Element, token: string, attributeName: string): void; | ||
private getConnectedActionForElementWithDescriptorString(element, descriptorString); | ||
private buildActionForElementWithDescriptorString(element, descriptorString); | ||
} |
/* | ||
Stimulus 0.3.6 | ||
Stimulus 0.3.7 | ||
Copyright © 2017 Basecamp, LLC | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Stimulus=e():t.Stimulus=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=18)}([function(t,e,n){"use strict";function r(t){return t.replace(/%/g,"%%")}n.d(e,"b",function(){return o}),n.d(e,"a",function(){return a}),n.d(e,"c",function(){return u});var o;!function(t){t[t.NONE=0]="NONE",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG"}(o||(o={}));var i="safari"in window,s=/(Trident|Edge)\//.test(navigator.userAgent),c=!s,a=function(){function t(t,e){void 0===t&&(t=o.WARN),void 0===e&&(e=window.console),this.level=t,this.console=e}return t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.level>=o.DEBUG&&this.console.log.apply(this.console,this.formatArgs(t))},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.level>=o.INFO&&this.console.log.apply(this.console,this.formatArgs(t))},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.level>=o.WARN&&this.console.warn.apply(this.console,this.formatArgs(t))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.level>=o.ERROR&&this.console.error.apply(this.console,this.formatArgs(t))},t.prototype.formatArgs=function(t){if(!c)return t;for(var e=[],n=[],r=0,o=[this.loggerTag].concat(t);r<o.length;r++){var s=o[r],a=typeof s;"string"==a||"number"==a||"boolean"==a?(e.push("%c%s "),n.push("font-family: sans-serif; font-size: small; color: #888",s)):s instanceof Node?(e.push("%o"),n.push(s)):s instanceof u?(e.push(s.formatString," "),n.push.apply(n,s.formatValues)):s instanceof Error?(e.push("\n\n%o\n\n"),n.push(s)):(e.push(i?"%O":"%O "),n.push(s))}return[e.join("")].concat(n)},Object.defineProperty(t.prototype,"loggerTag",{get:function(){return new u("Stimulus")},enumerable:!0,configurable:!0}),t}(),u=function(){function t(t,e,n){void 0===e&&(e="#fff"),void 0===n&&(n="#aaa"),this.name=t,this.foregroundColor=e,this.backgroundColor=n}return Object.defineProperty(t.prototype,"formatString",{get:function(){return"%c"+r(this.name)+"%c"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formatValues",{get:function(){return[this.formatValue,""]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formatValue",{get:function(){return"\n color: "+this.foregroundColor+";\n background-color: "+this.backgroundColor+";\n border: 1px solid rgba(0, 0, 0, 0.25);\n border-radius: 4px;\n padding: 1px 6px;\n font-weight: bold;\n font-family: sans-serif;\n font-size: x-small;\n "},enumerable:!0,configurable:!0}),t}()},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t,e,n,r){this.context=t,this.descriptor=e,this.eventTarget=n,this.delegatedTargetMatcher=r}return Object.defineProperty(t.prototype,"controller",{get:function(){return this.context.controller},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"eventName",{get:function(){return this.descriptor.eventName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"methodName",{get:function(){return this.descriptor.methodName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"preventsDefault",{get:function(){return this.descriptor.preventsDefault},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDirect",{get:function(){return null==this.delegatedTargetMatcher},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDelegated",{get:function(){return!this.isDirect},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"method",{get:function(){var t=this.controller[this.methodName];if("function"==typeof t)return t;throw new Error('Action references undefined method "'+this.methodName+'"')},enumerable:!0,configurable:!0}),t.prototype.hasSameDescriptorAs=function(t){return null!=t&&t.descriptor.isEqualTo(this.descriptor)},t.prototype.matchDelegatedTarget=function(t){var e=this.delegatedTargetMatcher;return!!e&&e(t)},t.prototype.invokeWithEventAndTarget=function(t,e){this.preventsDefault&&t.preventDefault(),this.debug("Invoking action",this,t);try{this.method.call(this.controller,t,e)}catch(e){this.error(e,"while invoking action",this,t)}},t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];(n=this.context).debug.apply(n,[this.descriptor.loggerTag].concat(t));var n},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];(n=this.context).error.apply(n,[this.descriptor.loggerTag].concat(t));var n},t}()},function(t,e,n){"use strict";function r(t){throw new Error(t)}var o=n(0);n.d(e,"a",function(){return i});var i=function(){function t(t,e,n,r,o){this.identifier=t,this.targetName=e,this.eventName=n,this.methodName=r,this.preventsDefault=o}return t.forOptions=function(e){return new t(e.identifier||r("Missing identifier in descriptor"),e.targetName||null,e.eventName||r("Missing event name in descriptor"),e.methodName||r("Missing method name in descriptor"),e.preventsDefault||!1)},t.forElementWithInlineDescriptorString=function(e,n){try{var r=this.parseOptionsFromInlineActionDescriptorString(n);return r.eventName=r.eventName||this.getDefaultEventNameForElement(e),t.forOptions(r)}catch(t){throw new Error('Bad descriptor "'+n+'": '+t.message)}},t.parseOptionsFromInlineActionDescriptorString=function(t){var e=t.trim(),n=e.match(/^(~)?((.+?)->)?(.+?)#(.+)$/)||r("Invalid descriptor syntax");return{identifier:n[4],eventName:n[3],methodName:n[5],preventsDefault:!n[1]}},t.getDefaultEventNameForElement=function(t){return this.defaultEventNames[t.tagName.toLowerCase()](t)},t.prototype.isEqualTo=function(t){return null!=t&&t.identifier==this.identifier&&t.targetName==this.targetName&&t.eventName==this.eventName&&t.methodName==this.methodName&&t.preventsDefault==this.preventsDefault},t.prototype.toString=function(){return(this.preventsDefault?"":"~")+this.eventName+"->"+this.identifier+"#"+this.methodName},Object.defineProperty(t.prototype,"loggerTag",{get:function(){return new o.c(this.toString(),"#000","#fc0")},enumerable:!0,configurable:!0}),t}();i.defaultEventNames={a:function(t){return"click"},button:function(t){return"click"},form:function(t){return"submit"},input:function(t){return"submit"==t.getAttribute("type")?"click":"change"},select:function(t){return"change"},textarea:function(t){return"change"}}},function(t,e,n){!function(e,n){t.exports=n()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=7)}([function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t,e){var n=this;this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver(function(t){return n.processMutations(t)})}return t.prototype.start=function(){this.started||(this.mutationObserver.observe(this.element,{attributes:!0,childList:!0,subtree:!0}),this.started=!0,this.refresh())},t.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},t.prototype.refresh=function(){if(this.started){for(var t=new Set(this.matchElementsInTree()),e=0,n=Array.from(this.elements);e<n.length;e++){var r=n[e];t.has(r)||this.removeElement(r)}for(var o=0,i=Array.from(t);o<i.length;o++){var r=i[o];this.addElement(r)}}},t.prototype.processMutations=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];this.processMutation(r)}},t.prototype.processMutation=function(t){"attributes"==t.type?this.processAttributeChange(t.target,t.attributeName):"childList"==t.type&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))},t.prototype.processAttributeChange=function(t,e){var n=t;this.elements.has(n)?this.matchElement(n)?this.delegate.elementAttributeChanged(n,e):this.removeElement(n):this.matchElement(n)&&this.addElement(n)},t.prototype.processRemovedNodes=function(t){for(var e=0,n=Array.from(t);e<n.length;e++){var r=n[e];this.processNode(r,this.removeElement)}},t.prototype.processAddedNodes=function(t){for(var e=0,n=Array.from(t);e<n.length;e++){var r=n[e];this.processNode(r,this.addElement)}},t.prototype.matchElement=function(t){return this.delegate.matchElement(t)},t.prototype.matchElementsInTree=function(t){return void 0===t&&(t=this.element),this.delegate.matchElementsInTree(t)},t.prototype.processNode=function(t,e){var n=this.elementFromNode(t);if(n)for(var r=0,o=this.matchElementsInTree(n);r<o.length;r++){var i=o[r];e.call(this,i)}},t.prototype.elementFromNode=function(t){if(t.nodeType==Node.ELEMENT_NODE)return t},t.prototype.addElement=function(t){this.elements.has(t)||(this.elements.add(t),this.delegate.elementMatched(t))},t.prototype.removeElement=function(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched(t))},t}()},function(t,e,n){"use strict";function r(t,e){return i.call(t,e)}e.a=r;var o=Element.prototype,i=o.matches||o.webkitMatchesSelector||o.msMatchesSelector},function(t,e,n){"use strict";function r(t,e,n){var r;n.has(t)?r=n.get(t):(r=new Set,n.set(t,r)),r.add(e)}function o(t,e,n){var r=n.get(t);r&&r.delete(e)}n.d(e,"a",function(){return i});var i=function(){function t(){this.valuesByKey=new Map,this.keysByValue=new Map}return t.prototype.add=function(t,e){r(t,e,this.valuesByKey),r(e,t,this.keysByValue)},t.prototype.delete=function(t,e){o(t,e,this.valuesByKey),o(e,t,this.keysByValue)},t.prototype.has=function(t,e){var n=this.valuesByKey.get(t);return!!n&&n.has(e)},t.prototype.getKeysForValue=function(t){var e=this.keysByValue.get(t);return e?Array.from(e):[]},t.prototype.getValuesForKey=function(t){var e=this.valuesByKey.get(t);return e?Array.from(e):[]},t.prototype.getValueCountForKey=function(t){var e=this.valuesByKey.get(t);return e?e.size:0},t}()},function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return o});var o=function(){function t(t,e,n){this.attributeName=e,this.delegate=n,this.elementObserver=new r.a(t,this)}return Object.defineProperty(t.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selector",{get:function(){return"["+this.attributeName+"]"},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.elementObserver.start()},t.prototype.stop=function(){this.elementObserver.stop()},t.prototype.matchElement=function(t){return t.hasAttribute(this.attributeName)},t.prototype.matchElementsInTree=function(t){var e=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(this.selector));return e.concat(n)},t.prototype.elementMatched=function(t){this.delegate.elementMatchedAttribute(t,this.attributeName)},t.prototype.elementUnmatched=function(t){this.delegate.elementUnmatchedAttribute(t,this.attributeName)},t.prototype.elementAttributeChanged=function(t,e){e==this.attributeName&&this.delegate.elementAttributeValueChanged(t,e)},t}()},function(t,e,n){"use strict";function r(t){for(var e=new Set,n=0,r=t;n<r.length;n++){var o=r[n],i=o.attribute;void 0!=i&&e.add(i)}return e}var o=n(1);n.d(e,"a",function(){return i});var i=function(){function t(t){try{this.source=t,this.tokens=c.readTokens(this.source),this.attributeSet=r(this.tokens)}catch(e){throw new Error("Error in selector '"+t+"': "+e.message)}}return t.get=function(e){var n,r=t.selectors;return e=e.toString().trim(),r.has(e)?n=r.get(e):(n=new t(e),r.set(e,n)),n},Object.defineProperty(t.prototype,"attributes",{get:function(){return Array.from(this.attributeSet)},enumerable:!0,configurable:!0}),t.prototype.matches=function(t){return n.i(o.a)(t,this.source)},t.prototype.toString=function(){return this.source},t}();i.selectors=new Map;var s;!function(t){t[t.TAG=0]="TAG",t[t.ID=1]="ID",t[t.CLASS=2]="CLASS",t[t.ATTR=3]="ATTR"}(s||(s={}));var c=function(){function t(t,e,n,r){this.type=t,this.value=e,this.data=n||"",this.negated=r}return t.readTokens=function(e){var n=t.readToken(e,s.TAG)||t.readToken(e,s.ID)||t.readToken(e,s.CLASS)||t.readToken(e,s.ATTR);if(n){var r=e.slice(n.length);return[n].concat(t.readTokens(r))}if(0==e.length)return[];throw new Error("Invalid or unsupported syntax near '"+e+"'")},t.readToken=function(e,n){var r=t.PATTERNS[n],o=":not("==e.slice(0,5),i=o?5:0,s=e.slice(i).match(r);if(s){var c=s[0],a=s[1];if(o){if(")"==e.charAt(c.length+i))return new t(n,":not("+c+")",a,!0);throw new Error("Expected close-parenthesis after ':not("+c+"'")}return new t(n,c,a,!1)}},Object.defineProperty(t.prototype,"attribute",{get:function(){switch(this.type){case s.ID:return"id";case s.CLASS:return"class";case s.ATTR:return this.data}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.value.length},enumerable:!0,configurable:!0}),t}();c.PATTERNS=function(){var t="(?:\\\\[0-9a-fA-F]{1,6}(?:\\r\\n|[ \\n\\r\\t\\f])?)|\\\\[^\\n\\r\\f0-9a-fA-F]",e="\\n|\\r\\n|\\r|\\f",n="-?(?:[_a-zA-Z]|(?:[^\\0-\\177])|(?:"+t+"))(?:[_a-zA-Z0-9-]|(?:[^\\0-\\177])|(?:"+t+"))*";return r={},r[s.TAG]=new RegExp("^("+n+")"),r[s.ID]=new RegExp("^#("+n+")"),r[s.CLASS]=new RegExp("^\\.("+n+")"),r[s.ATTR]=new RegExp("^\\[("+n+")(?:(=|~=|\\|=|\\^=|\\$=|\\*=)((?:"+n+')|(?:(?:"(?:[^\\n\\r\\f\\\\"]|\\\\(?:'+e+")|(?:"+t+"))*)|(?:'(?:[^\\n\\r\\f\\\\']|\\\\(?:"+e+")|(?:"+t+"))*))))?\\]"),r;var r}()},function(t,e,n){"use strict";var r=n(0),o=n(2),i=n(1);n.d(e,"a",function(){return s});var s=function(){function t(t,e){this.delegate=e,this.elementObserver=new r.a(t,this),this.selectorSet=new Set,this.elements=new o.a,this.attributes=new o.a}return Object.defineProperty(t.prototype,"started",{get:function(){return this.elementObserver.started},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.elementObserver.start()},t.prototype.stop=function(){this.elementObserver.stop()},t.prototype.refresh=function(){this.elementObserver.refresh()},Object.defineProperty(t.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selectors",{get:function(){return Array.from(this.selectorSet)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compositeSelector",{get:function(){var t=Array.from(this.selectorSet).join(", ");return 0==t.length?":not(*)":t},enumerable:!0,configurable:!0}),t.prototype.observeSelector=function(t){if(!this.selectorSet.has(t)){this.selectorSet.add(t);for(var e=0,n=t.attributes;e<n.length;e++){var r=n[e];this.attributes.add(t,r)}this.refresh()}},t.prototype.stopObservingSelector=function(t){if(this.selectorSet.has(t)){this.selectorSet.delete(t);for(var e=0,n=t.attributes;e<n.length;e++){var r=n[e];this.attributes.delete(t,r)}this.refresh()}},t.prototype.matchElement=function(t){return n.i(i.a)(t,this.compositeSelector)},t.prototype.matchElementsInTree=function(t){var e=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(this.compositeSelector));return e.concat(n)},t.prototype.elementMatched=function(t){for(var e=0,n=this.selectors;e<n.length;e++){var r=n[e];this.elements.has(r,t)||r.matches(t)&&this.recordMatch(r,t)}},t.prototype.elementUnmatched=function(t){for(var e=0,n=this.selectors;e<n.length;e++){var r=n[e];this.elements.has(r,t)&&this.recordUnmatch(r,t)}},t.prototype.elementAttributeChanged=function(t,e){for(var n=0,r=this.attributes.getKeysForValue(e);n<r.length;n++){var o=r[n],i=o.matches(t),s=this.elements.has(o,t);i&&!s?this.recordMatch(o,t):s&&!i&&this.recordUnmatch(o,t)}},t.prototype.recordMatch=function(t,e){this.elements.add(t,e),this.delegate.elementMatchedSelector(e,t)},t.prototype.recordUnmatch=function(t,e){this.elements.delete(t,e),this.delegate.elementUnmatchedSelector(e,t)},t}()},function(t,e,n){"use strict";var r=n(0),o=n(2);n.d(e,"a",function(){return i});var i=function(){function t(t,e,n){this.attributeName=e,this.delegate=n,this.elementObserver=new r.a(t,this),this.tokensByElement=new o.a}return Object.defineProperty(t.prototype,"started",{get:function(){return this.elementObserver.started},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.elementObserver.start()},t.prototype.stop=function(){this.elementObserver.stop()},t.prototype.refresh=function(){this.elementObserver.refresh()},Object.defineProperty(t.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selector",{get:function(){return"["+this.attributeName+"]"},enumerable:!0,configurable:!0}),t.prototype.getElementsMatchingToken=function(t){return this.tokensByElement.getKeysForValue(t)},t.prototype.matchElement=function(t){return t.hasAttribute(this.attributeName)},t.prototype.matchElementsInTree=function(t){var e=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(this.selector));return e.concat(n)},t.prototype.elementMatched=function(t){for(var e=Array.from(this.readTokenSetForElement(t)),n=0,r=e;n<r.length;n++){var o=r[n];this.addTokenForElement(o,t)}},t.prototype.elementUnmatched=function(t){for(var e=this.getTokensForElement(t),n=0,r=e;n<r.length;n++){var o=r[n];this.removeTokenForElement(o,t)}},t.prototype.elementAttributeChanged=function(t){for(var e=this.readTokenSetForElement(t),n=0,r=Array.from(e);n<r.length;n++){var o=r[n];this.addTokenForElement(o,t)}for(var i=0,s=this.getTokensForElement(t);i<s.length;i++){var o=s[i];e.has(o)||this.removeTokenForElement(o,t)}},t.prototype.addTokenForElement=function(t,e){this.tokensByElement.has(e,t)||(this.tokensByElement.add(e,t),this.delegate.elementMatchedTokenForAttribute(e,t,this.attributeName))},t.prototype.removeTokenForElement=function(t,e){this.tokensByElement.has(e,t)&&(this.tokensByElement.delete(e,t),this.delegate.elementUnmatchedTokenForAttribute(e,t,this.attributeName))},t.prototype.getTokensForElement=function(t){return this.tokensByElement.getValuesForKey(t)},t.prototype.readTokenSetForElement=function(t){for(var e=new Set,n=t.getAttribute(this.attributeName)||"",r=0,o=n.split(/\s+/);r<o.length;r++){var i=o[r];i.length&&e.add(i)}return e},t}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4);n.d(e,"Selector",function(){return r.a});var o=n(3);n.d(e,"AttributeObserver",function(){return o.a});var i=n(0);n.d(e,"ElementObserver",function(){return i.a});var s=n(5);n.d(e,"SelectorObserver",function(){return s.a});var c=n(6);n.d(e,"TokenListObserver",function(){return c.a})}])})},function(t,e,n){"use strict";var r=n(8),o=n(0),i=n(16);n.d(e,"a",function(){return s});var s=function(){function t(t){void 0===t&&(t={}),this.configuration=n.i(r.a)(t),this.logger=new o.a(this.configuration.logLevel),this.router=new i.a(this)}return t.start=function(e){var n=new t(e);return n.start(),n},t.prototype.start=function(){this.router.start()},t.prototype.stop=function(){this.router.stop()},t.prototype.register=function(t,e){this.router.register(t,e)},t.prototype.getControllerForElementAndIdentifier=function(t,e){var n=this.router.getContextForElementAndIdentifier(t,e);return n?n.controller:null},t}()},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t){this.context=t}return Object.defineProperty(t.prototype,"application",{get:function(){return this.context.application},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"targets",{get:function(){return this.context.targets},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.context.data},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useInlineActionObserver",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.initialize=function(){},t.prototype.connect=function(){},t.prototype.disconnect=function(){},t.prototype.addAction=function(t,e){this.context.addAction(t,e)},t.prototype.removeAction=function(t){this.context.removeAction(t)},t}()},function(t,e,n){"use strict";function r(t,e){return function(n,r,i){o(n,"initialize",function(){this.addAction(t+"->"+this.identifier+"#"+r,e)})}}function o(t,e,n){var r=t[e];t[e]=function(){n.apply(this,arguments),r.apply(this,arguments)}}e.a=r},function(t,e,n){"use strict";var r=n(15);n.d(e,"a",function(){return o});var o=function(){function t(){this.actionsByEventName=new r.a}return Object.defineProperty(t.prototype,"actions",{get:function(){return this.actionsByEventName.values},enumerable:!0,configurable:!0}),t.prototype.add=function(t){this.actionsByEventName.add(t.eventName,t)},t.prototype.delete=function(t){this.actionsByEventName.delete(t.eventName,t)},t.prototype.has=function(t){return this.actionsByEventName.hasValue(t)},t.prototype.getActionsForEventName=function(t){return this.actionsByEventName.get(t)},t}()},function(t,e,n){"use strict";function r(t){return Object.assign({},i,t)}var o=n(0);e.a=r;var i={logLevel:o.b.WARN,rootElement:document.documentElement,controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target"}},function(t,e,n){"use strict";function r(t,e,n){if("function"==typeof t.closest){var r="["+e+"~='"+n+"']";return t.closest(r)}for(var o=t;o;){var i=o.getAttribute(e);if(i&&i.split(" ").indexOf(n)!=-1)return o;o=o.parentElement}return null}function o(t){return!!t&&("undefined"!=typeof EventTarget?t instanceof EventTarget:"function"==typeof t.addEventListener)}var i=n(1),s=n(11),c=n(2),a=n(12),u=n(14),l=n(0),f=n(17);n.d(e,"a",function(){return h});var h=function(){function t(t,e){this.contextSet=t,this.element=e,this.targets=new f.a(this),this.data=new s.a(this),this.dispatcher=new a.a(this),this.inlineActionObserver=new u.a(this,this),this.controller=new t.controllerConstructor(this);try{this.debug("Initializing controller"),this.controller.initialize()}catch(t){this.error(t,"while initializing controller")}}return t.prototype.connect=function(){this.dispatcher.start(),this.controller.useInlineActionObserver&&this.inlineActionObserver.start();try{this.debug("Connecting controller"),this.controller.connect()}catch(t){this.error(t,"while connecting controller")}},t.prototype.disconnect=function(){try{this.debug("Disconnecting controller"),this.controller.disconnect()}catch(t){this.error(t,"while disconnecting controller")}this.inlineActionObserver.stop(),this.dispatcher.stop()},t.prototype.canControlElement=function(t){return r(t,this.controllerAttribute,this.identifier)==this.element},Object.defineProperty(t.prototype,"application",{get:function(){return this.contextSet.application},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.contextSet.identifier},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"configuration",{get:function(){return this.application.configuration},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controllerAttribute",{get:function(){return this.configuration.controllerAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"actionAttribute",{get:function(){return this.configuration.actionAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"targetAttribute",{get:function(){return this.configuration.targetAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this.element.parentElement},enumerable:!0,configurable:!0}),t.prototype.addAction=function(t,e){var n,r=this;if(t instanceof i.a)n=t;else if("string"==typeof t){var s=t,a=void 0,u=void 0;if(o(e))a=e;else if(a=this.element,e){var l=e.targetName;u=function(t){return r.targets.matchesElementWithTargetName(t,l)}}var f=c.a.forElementWithInlineDescriptorString(a,s);n=new i.a(this,f,a,u)}n&&(this.debug(n.descriptor.loggerTag,"Adding action",n),this.dispatcher.addAction(n))},t.prototype.removeAction=function(t){this.debug(t.descriptor.loggerTag,"Removing action",t),this.dispatcher.removeAction(t)},t.prototype.inlineActionConnected=function(t){this.addAction(t)},t.prototype.inlineActionDisconnected=function(t){this.removeAction(t)},t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(n=this.logger).debug.apply(n,[this.loggerTag].concat(t,[this.controller,this.element]));var n},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(n=this.logger).error.apply(n,[this.loggerTag].concat(t,[this.controller,this.element]));var n},Object.defineProperty(t.prototype,"logger",{get:function(){return this.application.logger},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loggerTag",{get:function(){return new l.c(this.identifier,"#fff","#38f")},enumerable:!0,configurable:!0}),t}()},function(t,e,n){"use strict";var r=n(9);n.d(e,"a",function(){return o});var o=function(){function t(t,e,n){this.router=t,this.identifier=e,this.controllerConstructor=n,this.contextsByElement=new WeakMap,this.connectedContexts=new Set}return Object.defineProperty(t.prototype,"application",{get:function(){return this.router.application},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contexts",{get:function(){return Array.from(this.connectedContexts)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.connectedContexts.size},enumerable:!0,configurable:!0}),t.prototype.connect=function(t){var e=this.fetchContextForElement(t);e&&!this.connectedContexts.has(e)&&(this.connectedContexts.add(e),e.connect())},t.prototype.disconnect=function(t){var e=this.fetchContextForElement(t);e&&this.connectedContexts.has(e)&&(this.connectedContexts.delete(e),e.disconnect())},t.prototype.getContextForElement=function(t){return this.contextsByElement.get(t)},t.prototype.fetchContextForElement=function(t){var e=this.contextsByElement.get(t);return e||(e=new r.a(this,t),this.contextsByElement.set(t,e)),e},t}()},function(t,e,n){"use strict";function r(t){return t.toString().replace(/([A-Z])/g,function(t,e){return"-"+e.toLowerCase()})}n.d(e,"a",function(){return o});var o=function(){function t(t){this.context=t}return Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!0,configurable:!0}),t.prototype.get=function(t){return t=this.getFormattedKey(t),this.element.getAttribute(t)},t.prototype.set=function(t,e){return t=this.getFormattedKey(t),this.element.setAttribute(t,e),this.get(t)},t.prototype.has=function(t){return t=this.getFormattedKey(t),this.element.hasAttribute(t)},t.prototype.delete=function(t){return!!this.has(t)&&(t=this.getFormattedKey(t),this.element.removeAttribute(t),!0)},t.prototype.getFormattedKey=function(t){return"data-"+this.identifier+"-"+r(t)},t}()},function(t,e,n){"use strict";function r(t){var e=t.target;return e instanceof Element?e:e instanceof Node?e.parentElement:null}var o=n(7),i=n(13);n.d(e,"a",function(){return s});var s=function(){function t(t){this.context=t,this.started=!1,this.directActions=new o.a,this.delegatedActions=new o.a,this.events=new i.a,this.handleDirectEvent=this.handleDirectEvent.bind(this),this.handleDelegatedEvent=this.handleDelegatedEvent.bind(this)}return t.prototype.start=function(){this.started||(this.started=!0,this.addEventListeners())},t.prototype.stop=function(){this.started&&(this.removeEventListeners(),this.started=!1)},t.prototype.addAction=function(t){var e=this.getActionSetForAction(t);e.has(t)||(this.addEventListenerForAction(t),e.add(t))},t.prototype.removeAction=function(t){var e=this.getActionSetForAction(t);e.has(t)&&(this.removeEventListenerForAction(t),e.delete(t))},t.prototype.getActionSetForAction=function(t){return t.isDirect?this.directActions:this.delegatedActions},t.prototype.addEventListeners=function(){this.addEventListenersForActionSet(this.directActions),this.addEventListenersForActionSet(this.delegatedActions)},t.prototype.removeEventListeners=function(){this.removeEventListenersForActionSet(this.delegatedActions),this.removeEventListenersForActionSet(this.directActions)},t.prototype.addEventListenersForActionSet=function(t){for(var e=0,n=t.actions;e<n.length;e++){var r=n[e];this.addEventListenerForAction(r)}},t.prototype.removeEventListenersForActionSet=function(t){for(var e=0,n=t.actions;e<n.length;e++){var r=n[e];this.removeEventListenerForAction(r)}},t.prototype.addEventListenerForAction=function(t){if(this.started){var e=this.getEventListenerForAction(t);this.events.add(t.eventName,t.eventTarget,e,!1)}},t.prototype.removeEventListenerForAction=function(t){if(this.started){var e=this.getEventListenerForAction(t);this.events.delete(t.eventName,t.eventTarget,e,!1)}},t.prototype.getEventListenerForAction=function(t){return t.isDirect?this.handleDirectEvent:this.handleDelegatedEvent},t.prototype.handleDirectEvent=function(t){if(this.canHandleEvent(t)){var e=this.findDirectActionInvocationsForEvent(t);this.performActionInvocations(e)}},t.prototype.handleDelegatedEvent=function(t){if(this.canHandleEvent(t)){var e=this.findDelegatedActionInvocationsForEvent(t);this.performActionInvocations(e)}},t.prototype.canHandleEvent=function(t){var e=r(t);return!e||this.context.canControlElement(e)},t.prototype.findDirectActionInvocationsForEvent=function(t){for(var e=this.directActions.getActionsForEventName(t.type),n=t.currentTarget,r=[],o=0,i=e;o<i.length;o++){var s=i[o];s.eventTarget==n&&r.push([s,t,n])}return r},t.prototype.findDelegatedActionInvocationsForEvent=function(t){for(var e=this.delegatedActions.getActionsForEventName(t.type),n=this.getPathForEvent(t),r=[],o=0,i=n;o<i.length;o++)for(var s=i[o],c=0,a=e;c<a.length;c++){var u=a[c];u.matchDelegatedTarget(s)&&r.push([u,t,s])}return r},t.prototype.performActionInvocations=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e],o=r[0],i=r[1],s=r[2];o.invokeWithEventAndTarget(i,s)}},t.prototype.getPathForEvent=function(t){for(var e=[],n=r(t);n&&n!=this.parentElement;)e.push(n),n=n.parentElement;return e},Object.defineProperty(t.prototype,"parentElement",{get:function(){return this.context.parentElement},enumerable:!0,configurable:!0}),t}()},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var r=function(){function t(t,e,n,r){this.name=t,this.target=e,this.listener=n,this.useCapture=r,this.references=0}return t.prototype.isEqualTo=function(t){return t&&t.name===this.name&&t.target==this.target&&t.listener==this.listener&&t.useCapture==this.useCapture},t.prototype.observe=function(){return 0==this.references&&this.target.addEventListener(this.name,this.listener,this.useCapture),this.references++,1==this.references},t.prototype.stopObserving=function(){return this.references>0&&(1==this.references&&this.target.removeEventListener(this.name,this.listener,this.useCapture),this.references--),0==this.references},t}(),o=function(){function t(){this.observers=new Set}return t.prototype.add=function(t,e,n,o){var i=new r(t,e,n,o);this.addObserver(i)},t.prototype.delete=function(t,e,n,o){var i=new r(t,e,n,o);this.deleteObserver(i)},t.prototype.addObserver=function(t){var e=this.findMatchingObserver(t);e.observe()&&this.observers.add(e)},t.prototype.deleteObserver=function(t){var e=this.findMatchingObserver(t);e.stopObserving()&&this.observers.delete(e)},t.prototype.findMatchingObserver=function(t){for(var e=0,n=Array.from(this.observers);e<n.length;e++){var r=n[e];if(r.isEqualTo(t))return r}return t},t}()},function(t,e,n){"use strict";var r=n(1),o=n(2),i=n(3);n.n(i);n.d(e,"a",function(){return s});var s=function(){function t(t,e){this.context=t,this.delegate=e,this.attributeObserver=new i.AttributeObserver(this.element,this.attributeName,this),this.connectedActions=new Map}return Object.defineProperty(t.prototype,"attributeName",{get:function(){return this.context.actionAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.attributeObserver.start()},t.prototype.stop=function(){this.attributeObserver.stop()},t.prototype.elementMatchedAttribute=function(t,e){this.context.canControlElement(t)&&this.refreshActionForElement(t)},t.prototype.elementAttributeValueChanged=function(t,e){this.context.canControlElement(t)&&this.refreshActionForElement(t)},t.prototype.elementUnmatchedAttribute=function(t,e){this.disconnectActionForElement(t)},t.prototype.refreshActionForElement=function(t){var e=t.getAttribute(this.attributeName);if(null==e||0==e.trim().length)this.disconnectActionForElement(t);else{var n=this.buildActionForElementWithDescriptorString(t,e);if(n){var r=this.getActionForElement(t);n.hasSameDescriptorAs(r)||(this.disconnectActionForElement(t),this.connectActionForElement(n,t))}else this.disconnectActionForElement(t)}},t.prototype.connectActionForElement=function(t,e){this.connectedActions.set(e,t),this.delegate.inlineActionConnected(t)},t.prototype.disconnectActionForElement=function(t){var e=this.getActionForElement(t);e&&(this.connectedActions.delete(t),this.delegate.inlineActionDisconnected(e))},t.prototype.getActionForElement=function(t){return this.connectedActions.get(t)||null},t.prototype.buildActionForElementWithDescriptorString=function(t,e){try{var n=o.a.forElementWithInlineDescriptorString(t,e);if(n.identifier==this.identifier)return new r.a(this.context,n,this.element,function(e){return e==t})}catch(e){this.context.error(e,"while parsing descriptor string for element",t)}},t}()},function(t,e,n){"use strict";function r(t,e,n){var r=t.get(e);return r||(r=new n,t.set(e,r)),r}function o(t,e){var n=t.get(e);null!=n&&0==n.size&&t.delete(e)}n.d(e,"a",function(){return i});var i=function(){function t(){this.map=new Map}return Object.defineProperty(t.prototype,"values",{get:function(){return Array.from(this.map.values()).reduce(function(t,e){return t.concat(Array.from(e))},[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return Array.from(this.map.values()).reduce(function(t,e){return t+e.size},0)},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){r(this.map,t,Set).add(e)},t.prototype.delete=function(t,e){r(this.map,t,Set).delete(e),o(this.map,t)},t.prototype.has=function(t,e){var n=this.map.get(t);return null!=n&&n.has(e)},t.prototype.hasKey=function(t){return this.map.has(t)},t.prototype.hasValue=function(t){return Array.from(this.map.values()).some(function(e){return e.has(t)})},t.prototype.get=function(t){var e=this.map.get(t);return e?Array.from(e):[]},t}();!function(){function t(){this.map=new Map}return Object.defineProperty(t.prototype,"values",{get:function(){return Array.from(this.map.values()).reduce(function(t,e){return t.concat(e.values)},[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return Array.from(this.map.values()).reduce(function(t,e){return t+e.size},0)},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e,n){r(this.map,t,i).add(e,n)},t.prototype.delete=function(t,e,n){r(this.map,t,i).delete(e,n),o(this.map,t)},t.prototype.has=function(t,e,n){var r=this.map.get(t);return null!=r&&r.has(e,n)},t.prototype.hasKey=function(t,e){if(1==arguments.length)return this.map.has(t);var n=this.map.get(t);return null!=n&&n.hasKey(e)},t.prototype.hasValue=function(t){return Array.from(this.map.values()).some(function(e){return e.hasValue(t)})},t.prototype.get=function(t,e){var n=this.map.get(t);return n?n.get(e):[]},t}()},function(t,e,n){"use strict";var r=n(10),o=n(3);n.n(o);n.d(e,"a",function(){return i});var i=function(){function t(t){this.application=t,this.tokenListObserver=new o.TokenListObserver(this.element,this.controllerAttribute,this),this.contextSets=new Map}return Object.defineProperty(t.prototype,"configuration",{get:function(){return this.application.configuration},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.configuration.rootElement},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controllerAttribute",{get:function(){return this.configuration.controllerAttribute},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.tokenListObserver.start()},t.prototype.stop=function(){this.tokenListObserver.stop()},t.prototype.register=function(t,e){if(this.contextSets.has(t))throw new Error("Router already has a controller registered with the identifier '"+t+"'");var n=new r.a(this,t,e);this.contextSets.set(t,n),this.connectContextSet(n)},t.prototype.elementMatchedTokenForAttribute=function(t,e,n){this.connectContextForIdentifierToElement(e,t)},t.prototype.elementUnmatchedTokenForAttribute=function(t,e,n){this.disconnectContextForIdentifierFromElement(e,t)},t.prototype.getContextForElementAndIdentifier=function(t,e){var n=this.contextSets.get(e);if(n)return n.getContextForElement(t)},t.prototype.connectContextSet=function(t){for(var e=this.tokenListObserver.getElementsMatchingToken(t.identifier),n=0,r=e;n<r.length;n++){var o=r[n];t.connect(o)}},t.prototype.connectContextForIdentifierToElement=function(t,e){var n=this.contextSets.get(t);n&&n.connect(e)},t.prototype.disconnectContextForIdentifierFromElement=function(t,e){var n=this.contextSets.get(t);n&&n.disconnect(e)},t}()},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t){this.context=t}return Object.defineProperty(t.prototype,"attributeName",{get:function(){return this.context.targetAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return null!=this.find(t)},t.prototype.find=function(t){var e=this.getSelectorForTargetName(t),n=this.element.querySelector(e);return n&&this.context.canControlElement(n)?n:null},t.prototype.findAll=function(t){var e=this,n=this.getSelectorForTargetName(t);return Array.from(this.element.querySelectorAll(n)).filter(function(t){return e.context.canControlElement(t)})},t.prototype.matchesElementWithTargetName=function(t,e){var n=t.getAttribute(this.attributeName);if(n){var r=n.split(" "),o=this.identifier+"."+e;return r.indexOf(o)>-1&&this.context.canControlElement(t)}return!1},t.prototype.getSelectorForTargetName=function(t){return"["+this.attributeName+"~='"+this.identifier+"."+t+"']"},t}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1);n.d(e,"Action",function(){return r.a});var o=n(4);n.d(e,"Application",function(){return o.a});var i=n(5);n.d(e,"Controller",function(){return i.a});var s=n(2);n.d(e,"Descriptor",function(){return s.a});var c=n(0);n.d(e,"Logger",function(){return c.a}),n.d(e,"LogLevel",function(){return c.b});var a=n(6);n.d(e,"on",function(){return a.a})}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Stimulus=e():t.Stimulus=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=18)}([function(t,e,n){"use strict";function r(t){return t.replace(/%/g,"%%")}n.d(e,"b",function(){return o}),n.d(e,"a",function(){return c}),n.d(e,"c",function(){return u});var o;!function(t){t[t.NONE=0]="NONE",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG"}(o||(o={}));var i="safari"in window,s=/(Trident|Edge)\//.test(navigator.userAgent),a=!s,c=function(){function t(t,e){void 0===t&&(t=o.WARN),void 0===e&&(e=window.console),this.level=t,this.console=e}return t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.level>=o.DEBUG&&this.console.log.apply(this.console,this.formatArgs(t))},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.level>=o.INFO&&this.console.log.apply(this.console,this.formatArgs(t))},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.level>=o.WARN&&this.console.warn.apply(this.console,this.formatArgs(t))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.level>=o.ERROR&&this.console.error.apply(this.console,this.formatArgs(t))},t.prototype.formatArgs=function(t){if(!a)return t;for(var e=[],n=[],r=0,o=[this.loggerTag].concat(t);r<o.length;r++){var s=o[r],c=typeof s;"string"==c||"number"==c||"boolean"==c?(e.push("%c%s "),n.push("font-family: sans-serif; font-size: small; color: #888",s)):s instanceof Node?(e.push("%o"),n.push(s)):s instanceof u?(e.push(s.formatString," "),n.push.apply(n,s.formatValues)):s instanceof Error?(e.push("\n\n%o\n\n"),n.push(s)):(e.push(i?"%O":"%O "),n.push(s))}return[e.join("")].concat(n)},Object.defineProperty(t.prototype,"loggerTag",{get:function(){return new u("Stimulus")},enumerable:!0,configurable:!0}),t}(),u=function(){function t(t,e,n){void 0===e&&(e="#fff"),void 0===n&&(n="#aaa"),this.name=t,this.foregroundColor=e,this.backgroundColor=n}return Object.defineProperty(t.prototype,"formatString",{get:function(){return"%c"+r(this.name)+"%c"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formatValues",{get:function(){return[this.formatValue,""]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formatValue",{get:function(){return"\n color: "+this.foregroundColor+";\n background-color: "+this.backgroundColor+";\n border: 1px solid rgba(0, 0, 0, 0.25);\n border-radius: 4px;\n padding: 1px 6px;\n font-weight: bold;\n font-family: sans-serif;\n font-size: x-small;\n "},enumerable:!0,configurable:!0}),t}()},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t,e,n,r){this.context=t,this.descriptor=e,this.eventTarget=n,this.delegatedTargetMatcher=r}return Object.defineProperty(t.prototype,"controller",{get:function(){return this.context.controller},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"eventName",{get:function(){return this.descriptor.eventName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"methodName",{get:function(){return this.descriptor.methodName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"preventsDefault",{get:function(){return this.descriptor.preventsDefault},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDirect",{get:function(){return null==this.delegatedTargetMatcher},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDelegated",{get:function(){return!this.isDirect},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"method",{get:function(){var t=this.controller[this.methodName];if("function"==typeof t)return t;throw new Error('Action references undefined method "'+this.methodName+'"')},enumerable:!0,configurable:!0}),t.prototype.hasSameDescriptorAs=function(t){return null!=t&&t.descriptor.isEqualTo(this.descriptor)},t.prototype.matchDelegatedTarget=function(t){var e=this.delegatedTargetMatcher;return!!e&&e(t)},t.prototype.invokeWithEventAndTarget=function(t,e){this.preventsDefault&&t.preventDefault(),this.debug("Invoking action",this,t);try{this.method.call(this.controller,t,e)}catch(e){this.error(e,"while invoking action",this,t)}},t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];(n=this.context).debug.apply(n,[this.descriptor.loggerTag].concat(t));var n},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];(n=this.context).error.apply(n,[this.descriptor.loggerTag].concat(t));var n},t}()},function(t,e,n){"use strict";function r(t){throw new Error(t)}var o=n(0);n.d(e,"a",function(){return i});var i=function(){function t(t,e,n,r,o){this.identifier=t,this.targetName=e,this.eventName=n,this.methodName=r,this.preventsDefault=o}return t.forOptions=function(e){return new t(e.identifier||r("Missing identifier in descriptor"),e.targetName||null,e.eventName||r("Missing event name in descriptor"),e.methodName||r("Missing method name in descriptor"),e.preventsDefault||!1)},t.forElementWithInlineDescriptorString=function(e,n){try{var r=this.parseOptionsFromInlineActionDescriptorString(n);return r.eventName=r.eventName||this.getDefaultEventNameForElement(e),t.forOptions(r)}catch(t){throw new Error('Bad descriptor "'+n+'": '+t.message)}},t.parseOptionsFromInlineActionDescriptorString=function(t){var e=t.trim(),n=e.match(/^(~)?((.+?)->)?(.+?)#(.+)$/)||r("Invalid descriptor syntax");return{identifier:n[4],eventName:n[3],methodName:n[5],preventsDefault:!n[1]}},t.getDefaultEventNameForElement=function(t){return this.defaultEventNames[t.tagName.toLowerCase()](t)},t.prototype.isEqualTo=function(t){return null!=t&&t.identifier==this.identifier&&t.targetName==this.targetName&&t.eventName==this.eventName&&t.methodName==this.methodName&&t.preventsDefault==this.preventsDefault},t.prototype.toString=function(){return(this.preventsDefault?"":"~")+this.eventName+"->"+this.identifier+"#"+this.methodName},Object.defineProperty(t.prototype,"loggerTag",{get:function(){return new o.c(this.toString(),"#000","#fc0")},enumerable:!0,configurable:!0}),t}();i.defaultEventNames={a:function(t){return"click"},button:function(t){return"click"},form:function(t){return"submit"},input:function(t){return"submit"==t.getAttribute("type")?"click":"change"},select:function(t){return"change"},textarea:function(t){return"change"}}},function(t,e,n){!function(e,n){t.exports=n()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=7)}([function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t,e){var n=this;this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver(function(t){return n.processMutations(t)})}return t.prototype.start=function(){this.started||(this.mutationObserver.observe(this.element,{attributes:!0,childList:!0,subtree:!0}),this.started=!0,this.refresh())},t.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},t.prototype.refresh=function(){if(this.started){for(var t=new Set(this.matchElementsInTree()),e=0,n=Array.from(this.elements);e<n.length;e++){var r=n[e];t.has(r)||this.removeElement(r)}for(var o=0,i=Array.from(t);o<i.length;o++){var r=i[o];this.addElement(r)}}},t.prototype.processMutations=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];this.processMutation(r)}},t.prototype.processMutation=function(t){"attributes"==t.type?this.processAttributeChange(t.target,t.attributeName):"childList"==t.type&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))},t.prototype.processAttributeChange=function(t,e){var n=t;this.elements.has(n)?this.matchElement(n)?this.delegate.elementAttributeChanged(n,e):this.removeElement(n):this.matchElement(n)&&this.addElement(n)},t.prototype.processRemovedNodes=function(t){for(var e=0,n=Array.from(t);e<n.length;e++){var r=n[e];this.processNode(r,this.removeElement)}},t.prototype.processAddedNodes=function(t){for(var e=0,n=Array.from(t);e<n.length;e++){var r=n[e];this.processNode(r,this.addElement)}},t.prototype.matchElement=function(t){return this.delegate.matchElement(t)},t.prototype.matchElementsInTree=function(t){return void 0===t&&(t=this.element),this.delegate.matchElementsInTree(t)},t.prototype.processNode=function(t,e){var n=this.elementFromNode(t);if(n)for(var r=0,o=this.matchElementsInTree(n);r<o.length;r++){var i=o[r];e.call(this,i)}},t.prototype.elementFromNode=function(t){if(t.nodeType==Node.ELEMENT_NODE)return t},t.prototype.addElement=function(t){this.elements.has(t)||(this.elements.add(t),this.delegate.elementMatched(t))},t.prototype.removeElement=function(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched(t))},t}()},function(t,e,n){"use strict";function r(t,e){return i.call(t,e)}e.a=r;var o=Element.prototype,i=o.matches||o.webkitMatchesSelector||o.msMatchesSelector},function(t,e,n){"use strict";function r(t,e,n){var r;n.has(t)?r=n.get(t):(r=new Set,n.set(t,r)),r.add(e)}function o(t,e,n){var r=n.get(t);r&&r.delete(e)}n.d(e,"a",function(){return i});var i=function(){function t(){this.valuesByKey=new Map,this.keysByValue=new Map}return t.prototype.add=function(t,e){r(t,e,this.valuesByKey),r(e,t,this.keysByValue)},t.prototype.delete=function(t,e){o(t,e,this.valuesByKey),o(e,t,this.keysByValue)},t.prototype.has=function(t,e){var n=this.valuesByKey.get(t);return!!n&&n.has(e)},t.prototype.getKeysForValue=function(t){var e=this.keysByValue.get(t);return e?Array.from(e):[]},t.prototype.getValuesForKey=function(t){var e=this.valuesByKey.get(t);return e?Array.from(e):[]},t.prototype.getValueCountForKey=function(t){var e=this.valuesByKey.get(t);return e?e.size:0},t}()},function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return o});var o=function(){function t(t,e,n){this.attributeName=e,this.delegate=n,this.elementObserver=new r.a(t,this)}return Object.defineProperty(t.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selector",{get:function(){return"["+this.attributeName+"]"},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.elementObserver.start()},t.prototype.stop=function(){this.elementObserver.stop()},t.prototype.matchElement=function(t){return t.hasAttribute(this.attributeName)},t.prototype.matchElementsInTree=function(t){var e=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(this.selector));return e.concat(n)},t.prototype.elementMatched=function(t){this.delegate.elementMatchedAttribute(t,this.attributeName)},t.prototype.elementUnmatched=function(t){this.delegate.elementUnmatchedAttribute(t,this.attributeName)},t.prototype.elementAttributeChanged=function(t,e){e==this.attributeName&&this.delegate.elementAttributeValueChanged(t,e)},t}()},function(t,e,n){"use strict";function r(t){for(var e=new Set,n=0,r=t;n<r.length;n++){var o=r[n],i=o.attribute;void 0!=i&&e.add(i)}return e}var o=n(1);n.d(e,"a",function(){return i});var i=function(){function t(t){try{this.source=t,this.tokens=a.readTokens(this.source),this.attributeSet=r(this.tokens)}catch(e){throw new Error("Error in selector '"+t+"': "+e.message)}}return t.get=function(e){var n,r=t.selectors;return e=e.toString().trim(),r.has(e)?n=r.get(e):(n=new t(e),r.set(e,n)),n},Object.defineProperty(t.prototype,"attributes",{get:function(){return Array.from(this.attributeSet)},enumerable:!0,configurable:!0}),t.prototype.matches=function(t){return n.i(o.a)(t,this.source)},t.prototype.toString=function(){return this.source},t}();i.selectors=new Map;var s;!function(t){t[t.TAG=0]="TAG",t[t.ID=1]="ID",t[t.CLASS=2]="CLASS",t[t.ATTR=3]="ATTR"}(s||(s={}));var a=function(){function t(t,e,n,r){this.type=t,this.value=e,this.data=n||"",this.negated=r}return t.readTokens=function(e){var n=t.readToken(e,s.TAG)||t.readToken(e,s.ID)||t.readToken(e,s.CLASS)||t.readToken(e,s.ATTR);if(n){var r=e.slice(n.length);return[n].concat(t.readTokens(r))}if(0==e.length)return[];throw new Error("Invalid or unsupported syntax near '"+e+"'")},t.readToken=function(e,n){var r=t.PATTERNS[n],o=":not("==e.slice(0,5),i=o?5:0,s=e.slice(i).match(r);if(s){var a=s[0],c=s[1];if(o){if(")"==e.charAt(a.length+i))return new t(n,":not("+a+")",c,!0);throw new Error("Expected close-parenthesis after ':not("+a+"'")}return new t(n,a,c,!1)}},Object.defineProperty(t.prototype,"attribute",{get:function(){switch(this.type){case s.ID:return"id";case s.CLASS:return"class";case s.ATTR:return this.data}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.value.length},enumerable:!0,configurable:!0}),t}();a.PATTERNS=function(){var t="(?:\\\\[0-9a-fA-F]{1,6}(?:\\r\\n|[ \\n\\r\\t\\f])?)|\\\\[^\\n\\r\\f0-9a-fA-F]",e="\\n|\\r\\n|\\r|\\f",n="-?(?:[_a-zA-Z]|(?:[^\\0-\\177])|(?:"+t+"))(?:[_a-zA-Z0-9-]|(?:[^\\0-\\177])|(?:"+t+"))*";return r={},r[s.TAG]=new RegExp("^("+n+")"),r[s.ID]=new RegExp("^#("+n+")"),r[s.CLASS]=new RegExp("^\\.("+n+")"),r[s.ATTR]=new RegExp("^\\[("+n+")(?:(=|~=|\\|=|\\^=|\\$=|\\*=)((?:"+n+')|(?:(?:"(?:[^\\n\\r\\f\\\\"]|\\\\(?:'+e+")|(?:"+t+"))*)|(?:'(?:[^\\n\\r\\f\\\\']|\\\\(?:"+e+")|(?:"+t+"))*))))?\\]"),r;var r}()},function(t,e,n){"use strict";var r=n(0),o=n(2),i=n(1);n.d(e,"a",function(){return s});var s=function(){function t(t,e){this.delegate=e,this.elementObserver=new r.a(t,this),this.selectorSet=new Set,this.elements=new o.a,this.attributes=new o.a}return Object.defineProperty(t.prototype,"started",{get:function(){return this.elementObserver.started},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.elementObserver.start()},t.prototype.stop=function(){this.elementObserver.stop()},t.prototype.refresh=function(){this.elementObserver.refresh()},Object.defineProperty(t.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selectors",{get:function(){return Array.from(this.selectorSet)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compositeSelector",{get:function(){var t=Array.from(this.selectorSet).join(", ");return 0==t.length?":not(*)":t},enumerable:!0,configurable:!0}),t.prototype.observeSelector=function(t){if(!this.selectorSet.has(t)){this.selectorSet.add(t);for(var e=0,n=t.attributes;e<n.length;e++){var r=n[e];this.attributes.add(t,r)}this.refresh()}},t.prototype.stopObservingSelector=function(t){if(this.selectorSet.has(t)){this.selectorSet.delete(t);for(var e=0,n=t.attributes;e<n.length;e++){var r=n[e];this.attributes.delete(t,r)}this.refresh()}},t.prototype.matchElement=function(t){return n.i(i.a)(t,this.compositeSelector)},t.prototype.matchElementsInTree=function(t){var e=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(this.compositeSelector));return e.concat(n)},t.prototype.elementMatched=function(t){for(var e=0,n=this.selectors;e<n.length;e++){var r=n[e];this.elements.has(r,t)||r.matches(t)&&this.recordMatch(r,t)}},t.prototype.elementUnmatched=function(t){for(var e=0,n=this.selectors;e<n.length;e++){var r=n[e];this.elements.has(r,t)&&this.recordUnmatch(r,t)}},t.prototype.elementAttributeChanged=function(t,e){for(var n=0,r=this.attributes.getKeysForValue(e);n<r.length;n++){var o=r[n],i=o.matches(t),s=this.elements.has(o,t);i&&!s?this.recordMatch(o,t):s&&!i&&this.recordUnmatch(o,t)}},t.prototype.recordMatch=function(t,e){this.elements.add(t,e),this.delegate.elementMatchedSelector(e,t)},t.prototype.recordUnmatch=function(t,e){this.elements.delete(t,e),this.delegate.elementUnmatchedSelector(e,t)},t}()},function(t,e,n){"use strict";var r=n(0),o=n(2);n.d(e,"a",function(){return i});var i=function(){function t(t,e,n){this.attributeName=e,this.delegate=n,this.elementObserver=new r.a(t,this),this.tokensByElement=new o.a}return Object.defineProperty(t.prototype,"started",{get:function(){return this.elementObserver.started},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.elementObserver.start()},t.prototype.stop=function(){this.elementObserver.stop()},t.prototype.refresh=function(){this.elementObserver.refresh()},Object.defineProperty(t.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selector",{get:function(){return"["+this.attributeName+"]"},enumerable:!0,configurable:!0}),t.prototype.getElementsMatchingToken=function(t){return this.tokensByElement.getKeysForValue(t)},t.prototype.matchElement=function(t){return t.hasAttribute(this.attributeName)},t.prototype.matchElementsInTree=function(t){var e=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(this.selector));return e.concat(n)},t.prototype.elementMatched=function(t){for(var e=Array.from(this.readTokenSetForElement(t)),n=0,r=e;n<r.length;n++){var o=r[n];this.addTokenForElement(o,t)}},t.prototype.elementUnmatched=function(t){for(var e=this.getTokensForElement(t),n=0,r=e;n<r.length;n++){var o=r[n];this.removeTokenForElement(o,t)}},t.prototype.elementAttributeChanged=function(t){for(var e=this.readTokenSetForElement(t),n=0,r=Array.from(e);n<r.length;n++){var o=r[n];this.addTokenForElement(o,t)}for(var i=0,s=this.getTokensForElement(t);i<s.length;i++){var o=s[i];e.has(o)||this.removeTokenForElement(o,t)}},t.prototype.addTokenForElement=function(t,e){this.tokensByElement.has(e,t)||(this.tokensByElement.add(e,t),this.delegate.elementMatchedTokenForAttribute(e,t,this.attributeName))},t.prototype.removeTokenForElement=function(t,e){this.tokensByElement.has(e,t)&&(this.tokensByElement.delete(e,t),this.delegate.elementUnmatchedTokenForAttribute(e,t,this.attributeName))},t.prototype.getTokensForElement=function(t){return this.tokensByElement.getValuesForKey(t)},t.prototype.readTokenSetForElement=function(t){for(var e=new Set,n=t.getAttribute(this.attributeName)||"",r=0,o=n.split(/\s+/);r<o.length;r++){var i=o[r];i.length&&e.add(i)}return e},t}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4);n.d(e,"Selector",function(){return r.a});var o=n(3);n.d(e,"AttributeObserver",function(){return o.a});var i=n(0);n.d(e,"ElementObserver",function(){return i.a});var s=n(5);n.d(e,"SelectorObserver",function(){return s.a});var a=n(6);n.d(e,"TokenListObserver",function(){return a.a})}])})},function(t,e,n){"use strict";function r(t,e,n){var r=t.get(e);return r||(r=new n,t.set(e,r)),r}function o(t,e){var n=t.get(e);null!=n&&0==n.size&&t.delete(e)}n.d(e,"a",function(){return i});var i=function(){function t(){this.map=new Map}return Object.defineProperty(t.prototype,"values",{get:function(){return Array.from(this.map.values()).reduce(function(t,e){return t.concat(Array.from(e))},[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return Array.from(this.map.values()).reduce(function(t,e){return t+e.size},0)},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){r(this.map,t,Set).add(e)},t.prototype.delete=function(t,e){r(this.map,t,Set).delete(e),o(this.map,t)},t.prototype.has=function(t,e){var n=this.map.get(t);return null!=n&&n.has(e)},t.prototype.hasKey=function(t){return this.map.has(t)},t.prototype.hasValue=function(t){return Array.from(this.map.values()).some(function(e){return e.has(t)})},t.prototype.get=function(t){var e=this.map.get(t);return e?Array.from(e):[]},t}();!function(){function t(){this.map=new Map}return Object.defineProperty(t.prototype,"values",{get:function(){return Array.from(this.map.values()).reduce(function(t,e){return t.concat(e.values)},[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return Array.from(this.map.values()).reduce(function(t,e){return t+e.size},0)},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e,n){r(this.map,t,i).add(e,n)},t.prototype.delete=function(t,e,n){r(this.map,t,i).delete(e,n),o(this.map,t)},t.prototype.has=function(t,e,n){var r=this.map.get(t);return null!=r&&r.has(e,n)},t.prototype.hasKey=function(t,e){if(1==arguments.length)return this.map.has(t);var n=this.map.get(t);return null!=n&&n.hasKey(e)},t.prototype.hasValue=function(t){return Array.from(this.map.values()).some(function(e){return e.hasValue(t)})},t.prototype.get=function(t,e){var n=this.map.get(t);return n?n.get(e):[]},t}()},function(t,e,n){"use strict";var r=n(9),o=n(0),i=n(16);n.d(e,"a",function(){return s});var s=function(){function t(t){void 0===t&&(t={}),this.configuration=n.i(r.a)(t),this.logger=new o.a(this.configuration.logLevel),this.router=new i.a(this)}return t.start=function(e){var n=new t(e);return n.start(),n},t.prototype.start=function(){this.router.start()},t.prototype.stop=function(){this.router.stop()},t.prototype.register=function(t,e){this.router.register(t,e)},t.prototype.getControllerForElementAndIdentifier=function(t,e){var n=this.router.getContextForElementAndIdentifier(t,e);return n?n.controller:null},t}()},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t){this.context=t}return Object.defineProperty(t.prototype,"application",{get:function(){return this.context.application},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"targets",{get:function(){return this.context.targets},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.context.data},enumerable:!0,configurable:!0}),t.prototype.initialize=function(){},t.prototype.connect=function(){},t.prototype.disconnect=function(){},t.prototype.addAction=function(t,e){this.context.addAction(t,e)},t.prototype.removeAction=function(t){this.context.removeAction(t)},t}()},function(t,e,n){"use strict";function r(t,e){return function(n,r,i){o(n,"initialize",function(){this.addAction(t+"->"+this.identifier+"#"+r,e)})}}function o(t,e,n){var r=t[e];t[e]=function(){n.apply(this,arguments),r.apply(this,arguments)}}e.a=r},function(t,e,n){"use strict";var r=n(4);n.d(e,"a",function(){return o});var o=function(){function t(){this.actionsByEventName=new r.a}return Object.defineProperty(t.prototype,"actions",{get:function(){return this.actionsByEventName.values},enumerable:!0,configurable:!0}),t.prototype.add=function(t){this.actionsByEventName.add(t.eventName,t)},t.prototype.delete=function(t){this.actionsByEventName.delete(t.eventName,t)},t.prototype.has=function(t){return this.actionsByEventName.hasValue(t)},t.prototype.getActionsForEventName=function(t){return this.actionsByEventName.get(t)},t}()},function(t,e,n){"use strict";function r(t){return Object.assign({},i,t)}var o=n(0);e.a=r;var i={logLevel:o.b.WARN,rootElement:document.documentElement,controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target"}},function(t,e,n){"use strict";function r(t,e,n){if("function"==typeof t.closest){var r="["+e+"~='"+n+"']";return t.closest(r)}for(var o=t;o;){var i=o.getAttribute(e);if(i&&i.split(" ").indexOf(n)!=-1)return o;o=o.parentElement}return null}function o(t){return!!t&&("undefined"!=typeof EventTarget?t instanceof EventTarget:"function"==typeof t.addEventListener)}var i=n(1),s=n(12),a=n(2),c=n(13),u=n(15),f=n(0),l=n(17);n.d(e,"a",function(){return h});var h=function(){function t(t,e){this.contextSet=t,this.element=e,this.targets=new l.a(this),this.data=new s.a(this),this.dispatcher=new c.a(this),this.inlineActionObserver=new u.a(this,this),this.controller=new t.controllerConstructor(this);try{this.debug("Initializing controller"),this.controller.initialize()}catch(t){this.error(t,"while initializing controller")}}return t.prototype.connect=function(){this.dispatcher.start(),this.inlineActionObserver.start();try{this.debug("Connecting controller"),this.controller.connect()}catch(t){this.error(t,"while connecting controller")}},t.prototype.disconnect=function(){try{this.debug("Disconnecting controller"),this.controller.disconnect()}catch(t){this.error(t,"while disconnecting controller")}this.inlineActionObserver.stop(),this.dispatcher.stop()},t.prototype.canControlElement=function(t){return r(t,this.controllerAttribute,this.identifier)==this.element},Object.defineProperty(t.prototype,"application",{get:function(){return this.contextSet.application},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.contextSet.identifier},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"configuration",{get:function(){return this.application.configuration},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controllerAttribute",{get:function(){return this.configuration.controllerAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"actionAttribute",{get:function(){return this.configuration.actionAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"targetAttribute",{get:function(){return this.configuration.targetAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this.element.parentElement},enumerable:!0,configurable:!0}),t.prototype.addAction=function(t,e){var n,r=this;if(t instanceof i.a)n=t;else if("string"==typeof t){var s=t,c=void 0,u=void 0;if(o(e))c=e;else if(c=this.element,e){var f=e.targetName;u=function(t){return r.targets.matchesElementWithTargetName(t,f)}}var l=a.a.forElementWithInlineDescriptorString(c,s);n=new i.a(this,l,c,u)}n&&(this.debug(n.descriptor.loggerTag,"Adding action",n),this.dispatcher.addAction(n))},t.prototype.removeAction=function(t){this.debug(t.descriptor.loggerTag,"Removing action",t),this.dispatcher.removeAction(t)},t.prototype.inlineActionConnected=function(t){this.addAction(t)},t.prototype.inlineActionDisconnected=function(t){this.removeAction(t)},t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(n=this.logger).debug.apply(n,[this.loggerTag].concat(t,[this.controller,this.element]));var n},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(n=this.logger).error.apply(n,[this.loggerTag].concat(t,[this.controller,this.element]));var n},Object.defineProperty(t.prototype,"logger",{get:function(){return this.application.logger},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loggerTag",{get:function(){return new f.c(this.identifier,"#fff","#38f")},enumerable:!0,configurable:!0}),t}()},function(t,e,n){"use strict";var r=n(10);n.d(e,"a",function(){return o});var o=function(){function t(t,e,n){this.router=t,this.identifier=e,this.controllerConstructor=n,this.contextsByElement=new WeakMap,this.connectedContexts=new Set}return Object.defineProperty(t.prototype,"application",{get:function(){return this.router.application},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contexts",{get:function(){return Array.from(this.connectedContexts)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.connectedContexts.size},enumerable:!0,configurable:!0}),t.prototype.connect=function(t){var e=this.fetchContextForElement(t);e&&!this.connectedContexts.has(e)&&(this.connectedContexts.add(e),e.connect())},t.prototype.disconnect=function(t){var e=this.fetchContextForElement(t);e&&this.connectedContexts.has(e)&&(this.connectedContexts.delete(e),e.disconnect())},t.prototype.getContextForElement=function(t){return this.contextsByElement.get(t)},t.prototype.fetchContextForElement=function(t){var e=this.contextsByElement.get(t);return e||(e=new r.a(this,t),this.contextsByElement.set(t,e)),e},t}()},function(t,e,n){"use strict";function r(t){return t.toString().replace(/([A-Z])/g,function(t,e){return"-"+e.toLowerCase()})}n.d(e,"a",function(){return o});var o=function(){function t(t){this.context=t}return Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!0,configurable:!0}),t.prototype.get=function(t){return t=this.getFormattedKey(t),this.element.getAttribute(t)},t.prototype.set=function(t,e){return t=this.getFormattedKey(t),this.element.setAttribute(t,e),this.get(t)},t.prototype.has=function(t){return t=this.getFormattedKey(t),this.element.hasAttribute(t)},t.prototype.delete=function(t){return!!this.has(t)&&(t=this.getFormattedKey(t),this.element.removeAttribute(t),!0)},t.prototype.getFormattedKey=function(t){return"data-"+this.identifier+"-"+r(t)},t}()},function(t,e,n){"use strict";function r(t){var e=t.target;return e instanceof Element?e:e instanceof Node?e.parentElement:null}var o=n(8),i=n(14);n.d(e,"a",function(){return s});var s=function(){function t(t){this.context=t,this.started=!1,this.directActions=new o.a,this.delegatedActions=new o.a,this.events=new i.a,this.handleDirectEvent=this.handleDirectEvent.bind(this),this.handleDelegatedEvent=this.handleDelegatedEvent.bind(this)}return t.prototype.start=function(){this.started||(this.started=!0,this.addEventListeners())},t.prototype.stop=function(){this.started&&(this.removeEventListeners(),this.started=!1)},t.prototype.addAction=function(t){var e=this.getActionSetForAction(t);e.has(t)||(this.addEventListenerForAction(t),e.add(t))},t.prototype.removeAction=function(t){var e=this.getActionSetForAction(t);e.has(t)&&(this.removeEventListenerForAction(t),e.delete(t))},t.prototype.getActionSetForAction=function(t){return t.isDirect?this.directActions:this.delegatedActions},t.prototype.addEventListeners=function(){this.addEventListenersForActionSet(this.directActions),this.addEventListenersForActionSet(this.delegatedActions)},t.prototype.removeEventListeners=function(){this.removeEventListenersForActionSet(this.delegatedActions),this.removeEventListenersForActionSet(this.directActions)},t.prototype.addEventListenersForActionSet=function(t){for(var e=0,n=t.actions;e<n.length;e++){var r=n[e];this.addEventListenerForAction(r)}},t.prototype.removeEventListenersForActionSet=function(t){for(var e=0,n=t.actions;e<n.length;e++){var r=n[e];this.removeEventListenerForAction(r)}},t.prototype.addEventListenerForAction=function(t){if(this.started){var e=this.getEventListenerForAction(t);this.events.add(t.eventName,t.eventTarget,e,!1)}},t.prototype.removeEventListenerForAction=function(t){if(this.started){var e=this.getEventListenerForAction(t);this.events.delete(t.eventName,t.eventTarget,e,!1)}},t.prototype.getEventListenerForAction=function(t){return t.isDirect?this.handleDirectEvent:this.handleDelegatedEvent},t.prototype.handleDirectEvent=function(t){if(this.canHandleEvent(t)){var e=this.findDirectActionInvocationsForEvent(t);this.performActionInvocations(e)}},t.prototype.handleDelegatedEvent=function(t){if(this.canHandleEvent(t)){var e=this.findDelegatedActionInvocationsForEvent(t);this.performActionInvocations(e)}},t.prototype.canHandleEvent=function(t){var e=r(t);return!e||this.context.canControlElement(e)},t.prototype.findDirectActionInvocationsForEvent=function(t){for(var e=this.directActions.getActionsForEventName(t.type),n=t.currentTarget,r=[],o=0,i=e;o<i.length;o++){var s=i[o];s.eventTarget==n&&r.push([s,t,n])}return r},t.prototype.findDelegatedActionInvocationsForEvent=function(t){for(var e=this.delegatedActions.getActionsForEventName(t.type),n=this.getPathForEvent(t),r=[],o=0,i=n;o<i.length;o++)for(var s=i[o],a=0,c=e;a<c.length;a++){var u=c[a];u.matchDelegatedTarget(s)&&r.push([u,t,s])}return r},t.prototype.performActionInvocations=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e],o=r[0],i=r[1],s=r[2];o.invokeWithEventAndTarget(i,s)}},t.prototype.getPathForEvent=function(t){for(var e=[],n=r(t);n&&n!=this.parentElement;)e.push(n),n=n.parentElement;return e},Object.defineProperty(t.prototype,"parentElement",{get:function(){return this.context.parentElement},enumerable:!0,configurable:!0}),t}()},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var r=function(){function t(t,e,n,r){this.name=t,this.target=e,this.listener=n,this.useCapture=r,this.references=0}return t.prototype.isEqualTo=function(t){return t&&t.name===this.name&&t.target==this.target&&t.listener==this.listener&&t.useCapture==this.useCapture},t.prototype.observe=function(){return 0==this.references&&this.target.addEventListener(this.name,this.listener,this.useCapture),this.references++,1==this.references},t.prototype.stopObserving=function(){return this.references>0&&(1==this.references&&this.target.removeEventListener(this.name,this.listener,this.useCapture),this.references--),0==this.references},t}(),o=function(){function t(){this.observers=new Set}return t.prototype.add=function(t,e,n,o){var i=new r(t,e,n,o);this.addObserver(i)},t.prototype.delete=function(t,e,n,o){var i=new r(t,e,n,o);this.deleteObserver(i)},t.prototype.addObserver=function(t){var e=this.findMatchingObserver(t);e.observe()&&this.observers.add(e)},t.prototype.deleteObserver=function(t){var e=this.findMatchingObserver(t);e.stopObserving()&&this.observers.delete(e)},t.prototype.findMatchingObserver=function(t){for(var e=0,n=Array.from(this.observers);e<n.length;e++){var r=n[e];if(r.isEqualTo(t))return r}return t},t}()},function(t,e,n){"use strict";var r=n(1),o=n(2),i=n(4),s=n(3);n.n(s);n.d(e,"a",function(){return a});var a=function(){function t(t,e){this.context=t,this.delegate=e,this.tokenListObserver=new s.TokenListObserver(this.element,this.attributeName,this),this.connectedActions=new i.a}return Object.defineProperty(t.prototype,"attributeName",{get:function(){return this.context.actionAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.tokenListObserver.start()},t.prototype.stop=function(){this.tokenListObserver.stop()},t.prototype.elementMatchedTokenForAttribute=function(t,e,n){if(this.context.canControlElement(t)){var r=this.buildActionForElementWithDescriptorString(t,e);r&&(this.connectedActions.add(t,r),this.delegate.inlineActionConnected(r))}},t.prototype.elementUnmatchedTokenForAttribute=function(t,e,n){var r=this.getConnectedActionForElementWithDescriptorString(t,e);r&&(this.connectedActions.delete(t,r),this.delegate.inlineActionDisconnected(r))},t.prototype.getConnectedActionForElementWithDescriptorString=function(t,e){var n=this.buildActionForElementWithDescriptorString(t,e);if(n)return this.connectedActions.get(t).find(function(t){return t.hasSameDescriptorAs(n)})},t.prototype.buildActionForElementWithDescriptorString=function(t,e){try{var n=o.a.forElementWithInlineDescriptorString(t,e);if(n.identifier==this.identifier)return new r.a(this.context,n,this.element,function(e){return e==t})}catch(e){this.context.error(e,"while parsing descriptor string for element",t)}},t}()},function(t,e,n){"use strict";var r=n(11),o=n(3);n.n(o);n.d(e,"a",function(){return i});var i=function(){function t(t){this.application=t,this.tokenListObserver=new o.TokenListObserver(this.element,this.controllerAttribute,this),this.contextSets=new Map}return Object.defineProperty(t.prototype,"configuration",{get:function(){return this.application.configuration},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.configuration.rootElement},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controllerAttribute",{get:function(){return this.configuration.controllerAttribute},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.tokenListObserver.start()},t.prototype.stop=function(){this.tokenListObserver.stop()},t.prototype.register=function(t,e){if(this.contextSets.has(t))throw new Error("Router already has a controller registered with the identifier '"+t+"'");var n=new r.a(this,t,e);this.contextSets.set(t,n),this.connectContextSet(n)},t.prototype.elementMatchedTokenForAttribute=function(t,e,n){this.connectContextForIdentifierToElement(e,t)},t.prototype.elementUnmatchedTokenForAttribute=function(t,e,n){this.disconnectContextForIdentifierFromElement(e,t)},t.prototype.getContextForElementAndIdentifier=function(t,e){var n=this.contextSets.get(e);if(n)return n.getContextForElement(t)},t.prototype.connectContextSet=function(t){for(var e=this.tokenListObserver.getElementsMatchingToken(t.identifier),n=0,r=e;n<r.length;n++){var o=r[n];t.connect(o)}},t.prototype.connectContextForIdentifierToElement=function(t,e){var n=this.contextSets.get(t);n&&n.connect(e)},t.prototype.disconnectContextForIdentifierFromElement=function(t,e){var n=this.contextSets.get(t);n&&n.disconnect(e)},t}()},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t){this.context=t}return Object.defineProperty(t.prototype,"attributeName",{get:function(){return this.context.targetAttribute},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return null!=this.find(t)},t.prototype.find=function(t){var e=this.getSelectorForTargetName(t),n=this.element.querySelector(e);return n&&this.context.canControlElement(n)?n:null},t.prototype.findAll=function(t){var e=this,n=this.getSelectorForTargetName(t);return Array.from(this.element.querySelectorAll(n)).filter(function(t){return e.context.canControlElement(t)})},t.prototype.matchesElementWithTargetName=function(t,e){var n=t.getAttribute(this.attributeName);if(n){var r=n.split(" "),o=this.identifier+"."+e;return r.indexOf(o)>-1&&this.context.canControlElement(t)}return!1},t.prototype.getSelectorForTargetName=function(t){return"["+this.attributeName+"~='"+this.identifier+"."+t+"']"},t}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1);n.d(e,"Action",function(){return r.a});var o=n(5);n.d(e,"Application",function(){return o.a});var i=n(6);n.d(e,"Controller",function(){return i.a});var s=n(2);n.d(e,"Descriptor",function(){return s.a});var a=n(0);n.d(e,"Logger",function(){return a.a}),n.d(e,"LogLevel",function(){return a.b});var c=n(7);n.d(e,"on",function(){return c.a})}])}); |
{ | ||
"name": "stimulus", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "👉✨", | ||
@@ -5,0 +5,0 @@ "author": "Basecamp, LLC", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54703
351