avo 3.0.0.pre19 → 3.0.1.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +25 -23
- data/Rakefile +0 -2
- data/app/assets/stylesheets/avo.base.css +0 -1
- data/app/components/avo/actions_component.rb +1 -1
- data/app/components/avo/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/field_wrapper_component.rb +7 -1
- data/app/components/avo/fields/boolean_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/common/badge_viewer_component.html.erb +24 -1
- data/app/components/avo/fields/common/badge_viewer_component.rb +0 -24
- data/app/components/avo/fields/common/boolean_check_component.html.erb +12 -1
- data/app/components/avo/fields/common/boolean_check_component.rb +1 -2
- data/app/components/avo/fields/common/gravatar_viewer_component.html.erb +1 -1
- data/app/components/avo/fields/common/gravatar_viewer_component.rb +2 -2
- data/app/components/avo/fields/common/heading_component.html.erb +8 -3
- data/app/components/avo/fields/common/heading_component.rb +3 -1
- data/app/components/avo/fields/common/key_value_component.html.erb +2 -2
- data/app/components/avo/fields/common/key_value_component.rb +2 -2
- data/app/components/avo/fields/common/progress_bar_component.rb +9 -3
- data/app/components/avo/fields/common/status_viewer_component.html.erb +0 -3
- data/app/components/avo/fields/edit_component.rb +1 -1
- data/app/components/avo/fields/external_image_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/file_field/index_component.html.erb +2 -2
- data/app/components/avo/fields/gravatar_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/heading_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/heading_field/show_component.html.erb +1 -1
- data/app/components/avo/fields/id_field/index_component.html.erb +1 -1
- data/app/components/avo/fields/index_component.rb +1 -1
- data/app/components/avo/fields/show_component.rb +1 -1
- data/app/components/avo/fields/text_field/index_component.html.erb +1 -1
- data/app/components/avo/index/field_wrapper_component.rb +1 -1
- data/app/components/avo/index/resource_controls_component.rb +1 -1
- data/app/components/avo/index/resource_table_component.rb +9 -3
- data/app/components/avo/resource_component.rb +4 -9
- data/app/components/avo/sidebar_profile_component.html.erb +4 -4
- data/app/components/avo/tab_group_component.html.erb +1 -1
- data/app/components/avo/tab_switcher_component.rb +2 -2
- data/app/components/avo/views/resource_edit_component.html.erb +20 -9
- data/app/components/avo/views/resource_edit_component.rb +5 -5
- data/app/components/avo/views/resource_index_component.rb +1 -1
- data/app/components/avo/views/resource_show_component.html.erb +1 -1
- data/app/components/avo/views/resource_show_component.rb +1 -1
- data/app/controllers/avo/actions_controller.rb +20 -9
- data/app/controllers/avo/application_controller.rb +5 -5
- data/app/controllers/avo/base_controller.rb +1 -39
- data/app/controllers/avo/search_controller.rb +2 -19
- data/app/controllers/concerns/avo/initializes_avo.rb +0 -1
- data/app/helpers/avo/resources_helper.rb +1 -1
- data/app/helpers/avo/url_helpers.rb +1 -1
- data/app/views/avo/base/edit.html.erb +1 -1
- data/app/views/avo/base/index.html.erb +1 -1
- data/app/views/avo/base/new.html.erb +1 -1
- data/app/views/avo/base/show.html.erb +1 -1
- data/app/views/layouts/avo/application.html.erb +2 -10
- data/bin/dev +0 -2
- data/config/master.key +1 -0
- data/config/routes.rb +3 -4
- data/db/factories.rb +1 -1
- data/lib/avo/base_action.rb +26 -21
- data/lib/avo/base_resource.rb +7 -13
- data/lib/avo/concerns/filters_session_handler.rb +3 -3
- data/lib/avo/concerns/has_items.rb +5 -1
- data/lib/avo/concerns/visible_in_different_views.rb +1 -7
- data/lib/avo/configuration.rb +4 -28
- data/lib/avo/current.rb +6 -1
- data/lib/avo/dsl/field_parser.rb +1 -1
- data/lib/avo/execution_context.rb +1 -4
- data/lib/avo/fields/badge_field.rb +1 -1
- data/lib/avo/fields/base_field.rb +44 -21
- data/lib/avo/fields/belongs_to_field.rb +1 -1
- data/lib/avo/fields/concerns/has_html_attributes.rb +0 -2
- data/lib/avo/fields/external_image_field.rb +2 -2
- data/lib/avo/fields/file_field.rb +2 -2
- data/lib/avo/fields/gravatar_field.rb +2 -2
- data/lib/avo/fields/has_base_field.rb +2 -2
- data/lib/avo/fields/heading_field.rb +13 -5
- data/lib/avo/fields/id_field.rb +2 -2
- data/lib/avo/fields/status_field.rb +1 -3
- data/lib/avo/fields/text_field.rb +2 -2
- data/lib/avo/filters/base_filter.rb +1 -1
- data/lib/avo/html/builder.rb +1 -1
- data/lib/avo/licensing/h_q.rb +1 -1
- data/lib/avo/licensing/license_manager.rb +1 -1
- data/lib/avo/resources/items/holder.rb +6 -0
- data/lib/avo/resources/items/item_group.rb +2 -2
- data/lib/avo/resources/items/row.rb +3 -3
- data/lib/avo/resources/items/sidebar.rb +1 -1
- data/lib/avo/resources/items/tab.rb +2 -2
- data/lib/avo/resources/items/tab_group.rb +1 -1
- data/lib/avo/resources/resource_manager.rb +1 -6
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +0 -9
- data/lib/generators/avo/controller_generator.rb +0 -3
- data/lib/generators/avo/eject_generator.rb +15 -180
- data/lib/generators/avo/field_generator.rb +2 -49
- data/lib/generators/avo/js/install_generator.rb +2 -2
- data/lib/generators/avo/resource_generator.rb +7 -10
- data/lib/generators/avo/tailwindcss/install_generator.rb +12 -58
- data/lib/generators/avo/templates/initializer/avo.tt +1 -6
- data/lib/generators/avo/templates/resource/controller.tt +1 -1
- data/lib/generators/avo/templates/tailwindcss/avo.tailwind.css +3 -5
- data/lib/tasks/avo_tasks.rake +5 -33
- data/public/avo-assets/avo.base.css +4146 -75
- data/{app/assets/builds/avo.base.css → public/avo-assets/avo.css} +3808 -547
- data/public/avo-assets/avo.js +513 -0
- data/public/avo-assets/avo.js.map +7 -0
- metadata +6 -14
- data/app/assets/builds/avo.base.js +0 -124556
- data/app/assets/builds/avo.base.js.map +0 -7
- data/app/assets/builds/avo.custom.js +0 -6
- data/app/assets/builds/avo.custom.js.map +0 -7
- data/app/assets/stylesheets/css/fields/tags.css +0 -32
- data/lib/avo/concerns/has_helpers.rb +0 -18
- data/lib/avo/concerns/visible_items.rb +0 -43
- data/lib/avo/fields/concerns/use_view_components.rb +0 -45
- data/lib/avo/view_inquirer.rb +0 -36
- data/lib/generators/avo/concerns/parent_controller.rb +0 -20
- data/lib/generators/avo/templates/tailwindcss/tailwind.config.js +0 -11
@@ -1,6 +0,0 @@
|
|
1
|
-
(()=>{var fe=Object.defineProperty;var ge=(s,e,t)=>e in s?fe(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var b=(s,e,t)=>(ge(s,typeof e!="symbol"?e+"":e,t),t);var v=(s,e,t)=>new Promise((r,n)=>{var i=c=>{try{a(t.next(c))}catch(l){n(l)}},o=c=>{try{a(t.throw(c))}catch(l){n(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,o);a((t=t.apply(s,e)).next())});var I=class{constructor(e,t,r){this.eventTarget=e,this.eventName=t,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=pe(e);for(let r of this.bindings){if(t.immediatePropagationStopped)break;r.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let r=e.index,n=t.index;return r<n?-1:r>n?1:0})}};function pe(s){if("immediatePropagationStopped"in s)return s;{let{stopImmediatePropagation:e}=s;return Object.assign(s,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var K=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:r,eventOptions:n}=e,i=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(r,n);i.delete(o),i.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:r,eventOptions:n}=e;return this.fetchEventListener(t,r,n)}fetchEventListener(e,t,r){let n=this.fetchEventListenerMapForEventTarget(e),i=this.cacheKey(t,r),o=n.get(i);return o||(o=this.createEventListener(e,t,r),n.set(i,o)),o}createEventListener(e,t,r){let n=new I(e,t,r);return this.started&&n.connect(),n}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let r=[e];return Object.keys(t).sort().forEach(n=>{r.push(`${t[n]?"":"!"}${n}`)}),r.join(":")}},me={stop({event:s,value:e}){return e&&s.stopPropagation(),!0},prevent({event:s,value:e}){return e&&s.preventDefault(),!0},self({event:s,value:e,element:t}){return e?t===s.target:!0}},ye=/^(?:(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function be(s){let t=s.trim().match(ye)||[],r=t[1],n=t[2];return n&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${n}`,n=""),{eventTarget:ve(t[3]),eventName:r,eventOptions:t[6]?Oe(t[6]):{},identifier:t[4],methodName:t[5],keyFilter:n}}function ve(s){if(s=="window")return window;if(s=="document")return document}function Oe(s){return s.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function Ae(s){if(s==window)return"window";if(s==document)return"document"}function M(s){return s.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function E(s){return M(s.replace(/--/g,"-").replace(/__/g,"_"))}function g(s){return s.charAt(0).toUpperCase()+s.slice(1)}function P(s){return s.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function Ee(s){return s.match(/[^\s]+/g)||[]}var R=class{constructor(e,t,r,n){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||we(e)||O("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||O("missing identifier"),this.methodName=r.methodName||O("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=n}static forToken(e,t){return new this(e.element,e.index,be(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}isFilterTarget(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+"),r=["meta","ctrl","alt","shift"],[n,i,o,a]=r.map(l=>t.includes(l));if(e.metaKey!==n||e.ctrlKey!==i||e.altKey!==o||e.shiftKey!==a)return!0;let c=t.filter(l=>!r.includes(l))[0];return c?(Object.prototype.hasOwnProperty.call(this.keyMappings,c)||O(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[c].toLowerCase()!==e.key.toLowerCase()):!1}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:r,value:n}of Array.from(this.element.attributes)){let i=r.match(t),o=i&&i[1];o&&(e[M(o)]=Me(n))}return e}get eventTargetName(){return Ae(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}},x={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:s=>s.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function we(s){let e=s.tagName.toLowerCase();if(e in x)return x[e](s)}function O(s){throw new Error(s)}function Me(s){try{return JSON.parse(s)}catch{return s}}var U=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){this.willBeInvokedByEvent(e)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:r}=this.context.application,n=!0;for(let[i,o]of Object.entries(this.eventOptions))if(i in r){let a=r[i];n=n&&a({name:i,value:o,event:e,element:t})}else continue;return n}invokeWithEvent(e){let{target:t,currentTarget:r}=e;try{let{params:n}=this.action,i=Object.assign(e,{params:n});this.method.call(this.controller,i),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(n){let{identifier:i,controller:o,element:a,index:c}=this,l={identifier:i,controller:o,element:a,index:c,event:e};this.context.handleError(n,`invoking action "${this.action}"`,l)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.isFilterTarget(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},T=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){let r=e;this.elements.has(r)?this.delegate.elementAttributeChanged&&this.matchElement(r)?this.delegate.elementAttributeChanged(r,t):this.removeElement(r):this.matchElement(r)&&this.addElement(r)}processRemovedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.processTree(r,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.elementIsActive(r)&&this.processTree(r,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},_=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new T(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function Te(s,e,t){z(s,e).add(t)}function Ce(s,e,t){z(s,e).delete(t),Fe(s,e)}function z(s,e){let t=s.get(e);return t||(t=new Set,s.set(e,t)),t}function Fe(s,e){let t=s.get(e);t!=null&&t.size==0&&s.delete(e)}var h=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t.concat(Array.from(r)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t+r.size,0)}add(e,t){Te(this.valuesByKey,e,t)}delete(e,t){Ce(this.valuesByKey,e,t)}has(e,t){let r=this.valuesByKey.get(e);return r!=null&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(r=>r.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,r])=>r.has(e)).map(([t,r])=>t)}};var W=class{constructor(e,t,r,n={}){this.selector=t,this.details=n,this.elementObserver=new T(e,this),this.delegate=r,this.matchesByElement=new h}get started(){return this.elementObserver.started}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let t=e.matches(this.selector);return this.delegate.selectorMatchElement?t&&this.delegate.selectorMatchElement(e,this.details):t}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(this.selector)).filter(n=>this.matchElement(n));return t.concat(r)}elementMatched(e){this.selectorMatched(e)}elementUnmatched(e){this.selectorUnmatched(e)}elementAttributeChanged(e,t){let r=this.matchElement(e),n=this.matchesByElement.has(this.selector,e);!r&&n&&this.selectorUnmatched(e)}selectorMatched(e){this.delegate.selectorMatched&&(this.delegate.selectorMatched(e,this.selector,this.details),this.matchesByElement.add(this.selector,e))}selectorUnmatched(e){this.delegate.selectorUnmatched(e,this.selector,this.details),this.matchesByElement.delete(this.selector,e)}},q=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let r=this.delegate.getStringMapKeyForAttribute(e);if(r!=null){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);let n=this.element.getAttribute(e);if(this.stringMap.get(e)!=n&&this.stringMapValueChanged(n,r,t),n==null){let i=this.stringMap.get(e);this.stringMap.delete(e),i&&this.stringMapKeyRemoved(r,e,i)}else this.stringMap.set(e,n)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},C=class{constructor(e,t,r){this.attributeObserver=new _(e,t,this),this.delegate=r,this.tokensByElement=new h}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),r=this.readTokensForElement(e),n=ke(t,r).findIndex(([i,o])=>!Se(i,o));return n==-1?[[],[]]:[t.slice(n),r.slice(n)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return Be(r,e,t)}};function Be(s,e,t){return s.trim().split(/\s+/).filter(r=>r.length).map((r,n)=>({element:e,attributeName:t,content:r,index:n}))}function ke(s,e){let t=Math.max(s.length,e.length);return Array.from({length:t},(r,n)=>[s[n],e[n]])}function Se(s,e){return s&&e&&s.index==e.index&&s.content==e.content}var F=class{constructor(e,t,r){this.tokenListObserver=new C(e,t,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,r))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},J=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new F(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new U(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=R.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},H=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new q(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){let n=this.valueDescriptorNameMap[t];e!==null&&(r===null&&(r=n.writer(n.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){let n=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,n.writer(this.receiver[e]),r):this.invokeChangedCallback(e,n.writer(n.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:r,writer:n}of this.valueDescriptors)r!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,n(r),void 0)}invokeChangedCallback(e,t,r){let n=`${e}Changed`,i=this.receiver[n];if(typeof i=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),c=r;r&&(c=o.reader(r)),i.call(this.receiver,a,c)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let r=this.valueDescriptorMap[t];e[r.name]=r}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],r=`has${g(t.name)}`;return this.receiver[r]}},Z=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new h}start(){this.tokenListObserver||(this.tokenListObserver=new C(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function p(s,e){let t=G(s);return Array.from(t.reduce((r,n)=>(De(n,e).forEach(i=>r.add(i)),r),new Set))}function $e(s,e){return G(s).reduce((r,n)=>(r.push(...Ne(n,e)),r),[])}function G(s){let e=[];for(;s;)e.push(s),s=Object.getPrototypeOf(s);return e.reverse()}function De(s,e){let t=s[e];return Array.isArray(t)?t:[]}function Ne(s,e){let t=s[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var Q=class{constructor(e,t){this.context=e,this.delegate=t,this.outletsByName=new h,this.outletElementsByName=new h,this.selectorObserverMap=new Map}start(){this.selectorObserverMap.size===0&&(this.outletDefinitions.forEach(e=>{let t=this.selector(e),r={outletName:e};t&&this.selectorObserverMap.set(e,new W(document.body,t,this,r))}),this.selectorObserverMap.forEach(e=>e.start())),this.dependentContexts.forEach(e=>e.refresh())}stop(){this.selectorObserverMap.size>0&&(this.disconnectAllOutlets(),this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}refresh(){this.selectorObserverMap.forEach(e=>e.refresh())}selectorMatched(e,t,{outletName:r}){let n=this.getOutlet(e,r);n&&this.connectOutlet(n,e,r)}selectorUnmatched(e,t,{outletName:r}){let n=this.getOutletFromMap(e,r);n&&this.disconnectOutlet(n,e,r)}selectorMatchElement(e,{outletName:t}){return this.hasOutlet(e,t)&&e.matches(`[${this.context.application.schema.controllerAttribute}~=${t}]`)}connectOutlet(e,t,r){var n;this.outletElementsByName.has(r,t)||(this.outletsByName.add(r,e),this.outletElementsByName.add(r,t),(n=this.selectorObserverMap.get(r))===null||n===void 0||n.pause(()=>this.delegate.outletConnected(e,t,r)))}disconnectOutlet(e,t,r){var n;this.outletElementsByName.has(r,t)&&(this.outletsByName.delete(r,e),this.outletElementsByName.delete(r,t),(n=this.selectorObserverMap.get(r))===null||n===void 0||n.pause(()=>this.delegate.outletDisconnected(e,t,r)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}get outletDependencies(){let e=new h;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;p(r,"outlets").forEach(i=>e.add(i,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(r=>r.element===e)}get scope(){return this.context.scope}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},X=class{constructor(e,t){this.logDebugActivity=(r,n={})=>{let{identifier:i,controller:o,element:a}=this;n=Object.assign({identifier:i,controller:o,element:a},n),this.application.logDebugActivity(this.identifier,r,n)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new J(this,this.dispatcher),this.valueObserver=new H(this,this.controller),this.targetObserver=new Z(this,this),this.outletObserver=new Q(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(r){this.handleError(r,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){let{identifier:n,controller:i,element:o}=this;r=Object.assign({identifier:n,controller:i,element:o},r),this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${E(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${E(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function xe(s){return Ve(s,Le(s))}function Ve(s,e){let t=Pe(s),r=je(s.prototype,e);return Object.defineProperties(t.prototype,r),t}function Le(s){return p(s,"blessings").reduce((t,r)=>{let n=r(s);for(let i in n){let o=t[i]||{};t[i]=Object.assign(o,n[i])}return t},{})}function je(s,e){return Ke(e).reduce((t,r)=>{let n=Ie(s,e,r);return n&&Object.assign(t,{[r]:n}),t},{})}function Ie(s,e,t){let r=Object.getOwnPropertyDescriptor(s,t);if(!(r&&"value"in r)){let i=Object.getOwnPropertyDescriptor(e,t).value;return r&&(i.get=r.get||i.get,i.set=r.set||i.set),i}}var Ke=(()=>typeof Object.getOwnPropertySymbols=="function"?s=>[...Object.getOwnPropertyNames(s),...Object.getOwnPropertySymbols(s)]:Object.getOwnPropertyNames)(),Pe=(()=>{function s(t){function r(){return Reflect.construct(t,arguments,new.target)}return r.prototype=Object.create(t.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,t),r}function e(){let r=s(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),s}catch{return r=>class extends r{}}})();function Re(s){return{identifier:s.identifier,controllerConstructor:xe(s.controllerConstructor)}}var Y=class{constructor(e,t){this.application=e,this.definition=Re(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new X(this,e),this.contextsByScope.set(e,t)),t}},ee=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return Ee(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},te=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${P(e)}`}},re=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let n=this.warnedKeysByObject.get(e);n||(n=new Set,this.warnedKeysByObject.set(e,n)),n.has(t)||(n.add(t),this.logger.warn(r,e))}};function w(s,e){return`[${s}~="${e}"]`}var se=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findTarget(r)||this.findLegacyTarget(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllTargets(r),...this.findAllLegacyTargets(r)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return w(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(r=>this.deprecate(r,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return w(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:r}=this,n=this.schema.targetAttribute,i=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${n}="${r}.${t}" with ${i}="${t}". The ${n} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},ne=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findOutlet(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllOutlets(r)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(n=>this.matchesElement(n,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(n=>this.matchesElement(n,e,t))}matchesElement(e,t,r){let n=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&n.split(" ").includes(r)}},A=class{constructor(e,t,r,n){this.targets=new se(this),this.classes=new ee(this),this.data=new te(this),this.containsElement=i=>i.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new re(n),this.outlets=new ne(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return w(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new A(this.schema,document.documentElement,this.identifier,this.guide.logger)}},ie=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new F(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:r}=e,n=this.fetchScopesByIdentifierForElement(t),i=n.get(r);return i||(i=this.delegate.createScopeForElementAndIdentifier(t,r),n.set(r,i)),i}elementMatchedValue(e,t){let r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),r==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),r==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},oe=class{constructor(e){this.application=e,this.scopeObserver=new ie(this.element,this.schema,this),this.scopesByIdentifier=new h,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new Y(this.application,e);this.connectModule(t);let r=e.controllerConstructor.afterLoad;r&&r(e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find(n=>n.element==e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new A(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.connectContextForScope(r))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.disconnectContextForScope(r))}},Ue={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:s=>`data-${s}-target`,outletAttributeForScope:(s,e)=>`data-${s}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End"},V("abcdefghijklmnopqrstuvwxyz".split("").map(s=>[s,s]))),V("0123456789".split("").map(s=>[s,s])))};function V(s){return s.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var B=class{constructor(e=document.documentElement,t=Ue){this.logger=console,this.debug=!1,this.logDebugActivity=(r,n,i={})=>{this.debug&&this.logFormattedMessage(r,n,i)},this.element=e,this.schema=t,this.dispatcher=new K(this),this.router=new oe(this),this.actionDescriptorFilters=Object.assign({},me)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await _e(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(n=>{n.controllerConstructor.shouldLoad&&this.router.loadDefinition(n)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(n=>this.router.unloadIdentifier(n))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var n;this.logger.error(`%s
|
2
|
-
|
3
|
-
%o
|
4
|
-
|
5
|
-
%o`,t,e,r),(n=window.onerror)===null||n===void 0||n.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}};function _e(){return new Promise(s=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>s()):s()})}function ze(s){return p(s,"classes").reduce((t,r)=>Object.assign(t,We(r)),{})}function We(s){return{[`${s}Class`]:{get(){let{classes:e}=this;if(e.has(s))return e.get(s);{let t=e.getAttributeName(s);throw new Error(`Missing attribute "${t}"`)}}},[`${s}Classes`]:{get(){return this.classes.getAll(s)}},[`has${g(s)}Class`]:{get(){return this.classes.has(s)}}}}function qe(s){return p(s,"outlets").reduce((t,r)=>Object.assign(t,Je(r)),{})}function Je(s){let e=E(s);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(s);if(t){let r=this.application.getControllerForElementAndIdentifier(t,s);if(r)return r;throw new Error(`Missing "data-controller=${s}" attribute on outlet element for "${this.identifier}" controller`)}throw new Error(`Missing outlet element "${s}" for "${this.identifier}" controller`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(s);return t.length>0?t.map(r=>{let n=this.application.getControllerForElementAndIdentifier(r,s);if(n)return n;console.warn(`The provided outlet element is missing the outlet controller "${s}" for "${this.identifier}"`,r)}).filter(r=>r):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(s);if(t)return t;throw new Error(`Missing outlet element "${s}" for "${this.identifier}" controller`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(s)}},[`has${g(e)}Outlet`]:{get(){return this.outlets.has(s)}}}}function He(s){return p(s,"targets").reduce((t,r)=>Object.assign(t,Ze(r)),{})}function Ze(s){return{[`${s}Target`]:{get(){let e=this.targets.find(s);if(e)return e;throw new Error(`Missing target element "${s}" for "${this.identifier}" controller`)}},[`${s}Targets`]:{get(){return this.targets.findAll(s)}},[`has${g(s)}Target`]:{get(){return this.targets.has(s)}}}}function Ge(s){let e=$e(s,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,n)=>{let i=ae(n,this.identifier),o=this.data.getAttributeNameForKey(i.key);return Object.assign(r,{[o]:i})},{})}}};return e.reduce((r,n)=>Object.assign(r,Qe(n)),t)}function Qe(s,e){let t=ae(s,e),{key:r,name:n,reader:i,writer:o}=t;return{[n]:{get(){let a=this.data.get(r);return a!==null?i(a):t.defaultValue},set(a){a===void 0?this.data.delete(r):this.data.set(r,o(a))}},[`has${g(n)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function ae([s,e],t){return tt({controller:t,token:s,typeDefinition:e})}function k(s){switch(s){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function f(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(s))return"array";if(Object.prototype.toString.call(s)==="[object Object]")return"object"}function Xe(s){let e=k(s.typeObject.type);if(!e)return;let t=f(s.typeObject.default);if(e!==t){let r=s.controller?`${s.controller}.${s.token}`:s.token;throw new Error(`The specified default value for the Stimulus Value "${r}" must match the defined type "${e}". The provided default value of "${s.typeObject.default}" is of type "${t}".`)}return e}function Ye(s){let e=Xe({controller:s.controller,token:s.token,typeObject:s.typeDefinition}),t=f(s.typeDefinition),r=k(s.typeDefinition),n=e||t||r;if(n)return n;let i=s.controller?`${s.controller}.${s.typeDefinition}`:s.token;throw new Error(`Unknown value type "${i}" for "${s.token}" value`)}function et(s){let e=k(s);if(e)return rt[e];let t=s.default;return t!==void 0?t:s}function tt(s){let e=`${P(s.token)}-value`,t=Ye(s);return{type:t,key:e,name:M(e),get defaultValue(){return et(s.typeDefinition)},get hasCustomDefaultValue(){return f(s.typeDefinition)!==void 0},reader:st[t],writer:L[t]||L.default}}var rt={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},st={array(s){let e=JSON.parse(s);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${s}" of type "${f(e)}"`);return e},boolean(s){return!(s=="0"||String(s).toLowerCase()=="false")},number(s){return Number(s)},object(s){let e=JSON.parse(s);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${s}" of type "${f(e)}"`);return e},string(s){return s}},L={default:nt,array:j,object:j};function j(s){return JSON.stringify(s)}function nt(s){return`${s}`}var u=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:n=this.identifier,bubbles:i=!0,cancelable:o=!0}={}){let a=n?`${n}:${e}`:e,c=new CustomEvent(a,{detail:r,bubbles:i,cancelable:o});return t.dispatchEvent(c),c}};u.blessings=[ze,He,Ge,qe];u.targets=[];u.outlets=[];u.values={};var it="absolute bg-gray-100 opacity-10 w-full h-full",d=class extends u{get placeholder(){return this.citySelectInputTarget.ariaPlaceholder}set loading(s){if(s){let e=document.createElement("div");e.className=it,e.dataset.target="city-loader",this.citySelectWrapperTarget.prepend(e),this.citySelectWrapperTarget.classList.add("opacity-50")}else this.citySelectWrapperTarget.querySelector('[data-target="city-loader"]').remove(),this.citySelectWrapperTarget.classList.remove("opacity-50")}connect(){return v(this,null,function*(){["edit","new"].includes(this.viewValue)&&(this.captureTheInitialValue(),yield this.onCountryChange())})}onCountryChange(){return v(this,null,function*(){if(this.hasCountrySelectInputTarget&&this.countrySelectInputTarget){let s=this.countrySelectInputTarget.value,e=yield this.fetchCitiesForCountry(s);Object.keys(this.citySelectInputTarget.options).forEach(()=>{this.citySelectInputTarget.options.remove(0)}),this.citySelectInputTarget.add(new Option(this.placeholder)),e.forEach(r=>{this.citySelectInputTarget.add(new Option(r,r))}),Array.from(this.citySelectInputTarget.options).map(r=>r.value).includes(this.initialValue)?this.citySelectInputTarget.value=this.initialValue:this.citySelectInputTarget.value=this.citySelectInputTarget.options[0].value}})}captureTheInitialValue(){this.initialValue=this.citySelectInputTarget.value}fetchCitiesForCountry(s){return v(this,null,function*(){if(!s)return[];this.loading=!0;let t=yield(yield fetch(`${window.Avo.configuration.root_path}/resources/courses/cities?country=${s}`)).json();return this.loading=!1,t})}};b(d,"targets",["countrySelectInput","citySelectInput","citySelectWrapper"]),b(d,"values",{view:String}),b(d,"initialValue");function ot(s){return s.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function S(s){return s.charAt(0).toUpperCase()+s.slice(1)}function at(s){return s.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function he(s,e){let t=ue(s);return Array.from(t.reduce((r,n)=>(lt(n,e).forEach(i=>r.add(i)),r),new Set))}function ct(s,e){return ue(s).reduce((r,n)=>(r.push(...ht(n,e)),r),[])}function ue(s){let e=[];for(;s;)e.push(s),s=Object.getPrototypeOf(s);return e.reverse()}function lt(s,e){let t=s[e];return Array.isArray(t)?t:[]}function ht(s,e){let t=s[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}(()=>{function s(t){function r(){return Reflect.construct(t,arguments,new.target)}return r.prototype=Object.create(t.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,t),r}function e(){let r=s(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),s}catch{return r=>class extends r{}}})();function ut(s){return he(s,"classes").reduce((t,r)=>Object.assign(t,dt(r)),{})}function dt(s){return{[`${s}Class`]:{get(){let{classes:e}=this;if(e.has(s))return e.get(s);{let t=e.getAttributeName(s);throw new Error(`Missing attribute "${t}"`)}}},[`${s}Classes`]:{get(){return this.classes.getAll(s)}},[`has${S(s)}Class`]:{get(){return this.classes.has(s)}}}}function ft(s){return he(s,"targets").reduce((t,r)=>Object.assign(t,gt(r)),{})}function gt(s){return{[`${s}Target`]:{get(){let e=this.targets.find(s);if(e)return e;throw new Error(`Missing target element "${s}" for "${this.identifier}" controller`)}},[`${s}Targets`]:{get(){return this.targets.findAll(s)}},[`has${S(s)}Target`]:{get(){return this.targets.has(s)}}}}function pt(s){let e=ct(s,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,n)=>{let i=de(n),o=this.data.getAttributeNameForKey(i.key);return Object.assign(r,{[o]:i})},{})}}};return e.reduce((r,n)=>Object.assign(r,mt(n)),t)}function mt(s){let e=de(s),{key:t,name:r,reader:n,writer:i}=e;return{[r]:{get(){let o=this.data.get(t);return o!==null?n(o):e.defaultValue},set(o){o===void 0?this.data.delete(t):this.data.set(t,i(o))}},[`has${S(r)}`]:{get(){return this.data.has(t)||e.hasCustomDefaultValue}}}}function de([s,e]){return Ot(s,e)}function $(s){switch(s){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function D(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(s))return"array";if(Object.prototype.toString.call(s)==="[object Object]")return"object"}function yt(s){let e=$(s.type);if(e){let t=D(s.default);if(e!==t)throw new Error(`Type "${e}" must match the type of the default value. Given default value: "${s.default}" as "${t}"`);return e}}function bt(s){let e=yt(s),t=D(s),r=$(s),n=e||t||r;if(n)return n;throw new Error(`Unknown value type "${s}"`)}function vt(s){let e=$(s);if(e)return At[e];let t=s.default;return t!==void 0?t:s}function Ot(s,e){let t=`${at(s)}-value`,r=bt(e);return{type:r,key:t,name:ot(t),get defaultValue(){return vt(e)},get hasCustomDefaultValue(){return D(e)!==void 0},reader:Et[r],writer:ce[r]||ce.default}}var At={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Et={array(s){let e=JSON.parse(s);if(!Array.isArray(e))throw new TypeError("Expected array");return e},boolean(s){return!(s=="0"||s=="false")},number(s){return Number(s)},object(s){let e=JSON.parse(s);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("Expected object");return e},string(s){return s}},ce={default:wt,array:le,object:le};function le(s){return JSON.stringify(s)}function wt(s){return`${s}`}var m=class{constructor(e){this.context=e}static get shouldLoad(){return!0}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:n=this.identifier,bubbles:i=!0,cancelable:o=!0}={}){let a=n?`${n}:${e}`:e,c=new CustomEvent(a,{detail:r,bubbles:i,cancelable:o});return t.dispatchEvent(c),c}};m.blessings=[ut,ft,pt];m.targets=[];m.values={};var y=class extends m{add(e){e.preventDefault();let t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",t)}remove(e){e.preventDefault();let t=e.target.closest(this.wrapperSelectorValue);if(t.dataset.newRecord==="true")t.remove();else{t.style.display="none";let r=t.querySelector("input[name*='_destroy']");r.value="1"}}};y.targets=["target","template"];y.values={wrapperSelector:{type:String,default:".nested-form-wrapper"}};var N=B.start();N.debug=window==null?void 0:window.localStorage.getItem("avo.debug");N.register("course-resource",d);N.register("nested-form",y);console.log("Hi from Avo custom JS \u{1F44B}");})();
|
6
|
-
//# sourceMappingURL=avo.custom.js.map
|
@@ -1,7 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"sources": ["../../../node_modules/@hotwired/stimulus/dist/stimulus.js", "../../../spec/dummy/app/javascript/avo_custom/course_resource_controller.js", "../../../spec/dummy/node_modules/stimulus-rails-nested-form/dist/stimulus-rails-nested-form.es.js", "../../../spec/dummy/app/javascript/avo.custom.js"],
|
4
|
-
"sourcesContent": ["/*\nStimulus 3.2.1\nCopyright \u00A9 2022 Basecamp, LLC\n */\nclass EventListener {\n constructor(eventTarget, eventName, eventOptions) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.eventOptions = eventOptions;\n this.unorderedBindings = new Set();\n }\n connect() {\n this.eventTarget.addEventListener(this.eventName, this, this.eventOptions);\n }\n disconnect() {\n this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions);\n }\n bindingConnected(binding) {\n this.unorderedBindings.add(binding);\n }\n bindingDisconnected(binding) {\n this.unorderedBindings.delete(binding);\n }\n handleEvent(event) {\n const extendedEvent = extendEvent(event);\n for (const binding of this.bindings) {\n if (extendedEvent.immediatePropagationStopped) {\n break;\n }\n else {\n binding.handleEvent(extendedEvent);\n }\n }\n }\n hasBindings() {\n return this.unorderedBindings.size > 0;\n }\n get bindings() {\n return Array.from(this.unorderedBindings).sort((left, right) => {\n const leftIndex = left.index, rightIndex = right.index;\n return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;\n });\n }\n}\nfunction extendEvent(event) {\n if (\"immediatePropagationStopped\" in event) {\n return event;\n }\n else {\n const { stopImmediatePropagation } = event;\n return Object.assign(event, {\n immediatePropagationStopped: false,\n stopImmediatePropagation() {\n this.immediatePropagationStopped = true;\n stopImmediatePropagation.call(this);\n },\n });\n }\n}\n\nclass Dispatcher {\n constructor(application) {\n this.application = application;\n this.eventListenerMaps = new Map();\n this.started = false;\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.eventListeners.forEach((eventListener) => eventListener.connect());\n }\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.eventListeners.forEach((eventListener) => eventListener.disconnect());\n }\n }\n get eventListeners() {\n return Array.from(this.eventListenerMaps.values()).reduce((listeners, map) => listeners.concat(Array.from(map.values())), []);\n }\n bindingConnected(binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n }\n bindingDisconnected(binding, clearEventListeners = false) {\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n if (clearEventListeners)\n this.clearEventListenersForBinding(binding);\n }\n handleError(error, message, detail = {}) {\n this.application.handleError(error, `Error ${message}`, detail);\n }\n clearEventListenersForBinding(binding) {\n const eventListener = this.fetchEventListenerForBinding(binding);\n if (!eventListener.hasBindings()) {\n eventListener.disconnect();\n this.removeMappedEventListenerFor(binding);\n }\n }\n removeMappedEventListenerFor(binding) {\n const { eventTarget, eventName, eventOptions } = binding;\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n eventListenerMap.delete(cacheKey);\n if (eventListenerMap.size == 0)\n this.eventListenerMaps.delete(eventTarget);\n }\n fetchEventListenerForBinding(binding) {\n const { eventTarget, eventName, eventOptions } = binding;\n return this.fetchEventListener(eventTarget, eventName, eventOptions);\n }\n fetchEventListener(eventTarget, eventName, eventOptions) {\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n let eventListener = eventListenerMap.get(cacheKey);\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName, eventOptions);\n eventListenerMap.set(cacheKey, eventListener);\n }\n return eventListener;\n }\n createEventListener(eventTarget, eventName, eventOptions) {\n const eventListener = new EventListener(eventTarget, eventName, eventOptions);\n if (this.started) {\n eventListener.connect();\n }\n return eventListener;\n }\n fetchEventListenerMapForEventTarget(eventTarget) {\n let eventListenerMap = this.eventListenerMaps.get(eventTarget);\n if (!eventListenerMap) {\n eventListenerMap = new Map();\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n return eventListenerMap;\n }\n cacheKey(eventName, eventOptions) {\n const parts = [eventName];\n Object.keys(eventOptions)\n .sort()\n .forEach((key) => {\n parts.push(`${eventOptions[key] ? \"\" : \"!\"}${key}`);\n });\n return parts.join(\":\");\n }\n}\n\nconst defaultActionDescriptorFilters = {\n stop({ event, value }) {\n if (value)\n event.stopPropagation();\n return true;\n },\n prevent({ event, value }) {\n if (value)\n event.preventDefault();\n return true;\n },\n self({ event, value, element }) {\n if (value) {\n return element === event.target;\n }\n else {\n return true;\n }\n },\n};\nconst descriptorPattern = /^(?:(.+?)(?:\\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;\nfunction parseActionDescriptorString(descriptorString) {\n const source = descriptorString.trim();\n const matches = source.match(descriptorPattern) || [];\n let eventName = matches[1];\n let keyFilter = matches[2];\n if (keyFilter && ![\"keydown\", \"keyup\", \"keypress\"].includes(eventName)) {\n eventName += `.${keyFilter}`;\n keyFilter = \"\";\n }\n return {\n eventTarget: parseEventTarget(matches[3]),\n eventName,\n eventOptions: matches[6] ? parseEventOptions(matches[6]) : {},\n identifier: matches[4],\n methodName: matches[5],\n keyFilter,\n };\n}\nfunction parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n }\n else if (eventTargetName == \"document\") {\n return document;\n }\n}\nfunction parseEventOptions(eventOptions) {\n return eventOptions\n .split(\":\")\n .reduce((options, token) => Object.assign(options, { [token.replace(/^!/, \"\")]: !/^!/.test(token) }), {});\n}\nfunction stringifyEventTarget(eventTarget) {\n if (eventTarget == window) {\n return \"window\";\n }\n else if (eventTarget == document) {\n return \"document\";\n }\n}\n\nfunction camelize(value) {\n return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase());\n}\nfunction namespaceCamelize(value) {\n return camelize(value.replace(/--/g, \"-\").replace(/__/g, \"_\"));\n}\nfunction capitalize(value) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\nfunction dasherize(value) {\n return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`);\n}\nfunction tokenize(value) {\n return value.match(/[^\\s]+/g) || [];\n}\n\nclass Action {\n constructor(element, index, descriptor, schema) {\n this.element = element;\n this.index = index;\n this.eventTarget = descriptor.eventTarget || element;\n this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error(\"missing event name\");\n this.eventOptions = descriptor.eventOptions || {};\n this.identifier = descriptor.identifier || error(\"missing identifier\");\n this.methodName = descriptor.methodName || error(\"missing method name\");\n this.keyFilter = descriptor.keyFilter || \"\";\n this.schema = schema;\n }\n static forToken(token, schema) {\n return new this(token.element, token.index, parseActionDescriptorString(token.content), schema);\n }\n toString() {\n const eventFilter = this.keyFilter ? `.${this.keyFilter}` : \"\";\n const eventTarget = this.eventTargetName ? `@${this.eventTargetName}` : \"\";\n return `${this.eventName}${eventFilter}${eventTarget}->${this.identifier}#${this.methodName}`;\n }\n isFilterTarget(event) {\n if (!this.keyFilter) {\n return false;\n }\n const filteres = this.keyFilter.split(\"+\");\n const modifiers = [\"meta\", \"ctrl\", \"alt\", \"shift\"];\n const [meta, ctrl, alt, shift] = modifiers.map((modifier) => filteres.includes(modifier));\n if (event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== alt || event.shiftKey !== shift) {\n return true;\n }\n const standardFilter = filteres.filter((key) => !modifiers.includes(key))[0];\n if (!standardFilter) {\n return false;\n }\n if (!Object.prototype.hasOwnProperty.call(this.keyMappings, standardFilter)) {\n error(`contains unknown key filter: ${this.keyFilter}`);\n }\n return this.keyMappings[standardFilter].toLowerCase() !== event.key.toLowerCase();\n }\n get params() {\n const params = {};\n const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`, \"i\");\n for (const { name, value } of Array.from(this.element.attributes)) {\n const match = name.match(pattern);\n const key = match && match[1];\n if (key) {\n params[camelize(key)] = typecast(value);\n }\n }\n return params;\n }\n get eventTargetName() {\n return stringifyEventTarget(this.eventTarget);\n }\n get keyMappings() {\n return this.schema.keyMappings;\n }\n}\nconst defaultEventNames = {\n a: () => \"click\",\n button: () => \"click\",\n form: () => \"submit\",\n details: () => \"toggle\",\n input: (e) => (e.getAttribute(\"type\") == \"submit\" ? \"click\" : \"input\"),\n select: () => \"change\",\n textarea: () => \"input\",\n};\nfunction getDefaultEventNameForElement(element) {\n const tagName = element.tagName.toLowerCase();\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n}\nfunction error(message) {\n throw new Error(message);\n}\nfunction typecast(value) {\n try {\n return JSON.parse(value);\n }\n catch (o_O) {\n return value;\n }\n}\n\nclass Binding {\n constructor(context, action) {\n this.context = context;\n this.action = action;\n }\n get index() {\n return this.action.index;\n }\n get eventTarget() {\n return this.action.eventTarget;\n }\n get eventOptions() {\n return this.action.eventOptions;\n }\n get identifier() {\n return this.context.identifier;\n }\n handleEvent(event) {\n if (this.willBeInvokedByEvent(event) && this.applyEventModifiers(event)) {\n this.invokeWithEvent(event);\n }\n }\n get eventName() {\n return this.action.eventName;\n }\n get method() {\n const method = this.controller[this.methodName];\n if (typeof method == \"function\") {\n return method;\n }\n throw new Error(`Action \"${this.action}\" references undefined method \"${this.methodName}\"`);\n }\n applyEventModifiers(event) {\n const { element } = this.action;\n const { actionDescriptorFilters } = this.context.application;\n let passes = true;\n for (const [name, value] of Object.entries(this.eventOptions)) {\n if (name in actionDescriptorFilters) {\n const filter = actionDescriptorFilters[name];\n passes = passes && filter({ name, value, event, element });\n }\n else {\n continue;\n }\n }\n return passes;\n }\n invokeWithEvent(event) {\n const { target, currentTarget } = event;\n try {\n const { params } = this.action;\n const actionEvent = Object.assign(event, { params });\n this.method.call(this.controller, actionEvent);\n this.context.logDebugActivity(this.methodName, { event, target, currentTarget, action: this.methodName });\n }\n catch (error) {\n const { identifier, controller, element, index } = this;\n const detail = { identifier, controller, element, index, event };\n this.context.handleError(error, `invoking action \"${this.action}\"`, detail);\n }\n }\n willBeInvokedByEvent(event) {\n const eventTarget = event.target;\n if (event instanceof KeyboardEvent && this.action.isFilterTarget(event)) {\n return false;\n }\n if (this.element === eventTarget) {\n return true;\n }\n else if (eventTarget instanceof Element && this.element.contains(eventTarget)) {\n return this.scope.containsElement(eventTarget);\n }\n else {\n return this.scope.containsElement(this.action.element);\n }\n }\n get controller() {\n return this.context.controller;\n }\n get methodName() {\n return this.action.methodName;\n }\n get element() {\n return this.scope.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\n\nclass ElementObserver {\n constructor(element, delegate) {\n this.mutationObserverInit = { attributes: true, childList: true, subtree: true };\n this.element = element;\n this.started = false;\n this.delegate = delegate;\n this.elements = new Set();\n this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.refresh();\n }\n }\n pause(callback) {\n if (this.started) {\n this.mutationObserver.disconnect();\n this.started = false;\n }\n callback();\n if (!this.started) {\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n const matches = new Set(this.matchElementsInTree());\n for (const element of Array.from(this.elements)) {\n if (!matches.has(element)) {\n this.removeElement(element);\n }\n }\n for (const element of Array.from(matches)) {\n this.addElement(element);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n if (mutation.type == \"attributes\") {\n this.processAttributeChange(mutation.target, mutation.attributeName);\n }\n else if (mutation.type == \"childList\") {\n this.processRemovedNodes(mutation.removedNodes);\n this.processAddedNodes(mutation.addedNodes);\n }\n }\n processAttributeChange(node, attributeName) {\n const element = node;\n if (this.elements.has(element)) {\n if (this.delegate.elementAttributeChanged && this.matchElement(element)) {\n this.delegate.elementAttributeChanged(element, attributeName);\n }\n else {\n this.removeElement(element);\n }\n }\n else if (this.matchElement(element)) {\n this.addElement(element);\n }\n }\n processRemovedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element) {\n this.processTree(element, this.removeElement);\n }\n }\n }\n processAddedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n }\n matchElement(element) {\n return this.delegate.matchElement(element);\n }\n matchElementsInTree(tree = this.element) {\n return this.delegate.matchElementsInTree(tree);\n }\n processTree(tree, processor) {\n for (const element of this.matchElementsInTree(tree)) {\n processor.call(this, element);\n }\n }\n elementFromNode(node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\n }\n }\n elementIsActive(element) {\n if (element.isConnected != this.element.isConnected) {\n return false;\n }\n else {\n return this.element.contains(element);\n }\n }\n addElement(element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n }\n removeElement(element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n }\n}\n\nclass AttributeObserver {\n constructor(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n get element() {\n return this.elementObserver.element;\n }\n get selector() {\n return `[${this.attributeName}]`;\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get started() {\n return this.elementObserver.started;\n }\n matchElement(element) {\n return element.hasAttribute(this.attributeName);\n }\n matchElementsInTree(tree) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(this.selector));\n return match.concat(matches);\n }\n elementMatched(element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n }\n elementUnmatched(element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\n }\n }\n elementAttributeChanged(element, attributeName) {\n if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {\n this.delegate.elementAttributeValueChanged(element, attributeName);\n }\n }\n}\n\nfunction add(map, key, value) {\n fetch(map, key).add(value);\n}\nfunction del(map, key, value) {\n fetch(map, key).delete(value);\n prune(map, key);\n}\nfunction fetch(map, key) {\n let values = map.get(key);\n if (!values) {\n values = new Set();\n map.set(key, values);\n }\n return values;\n}\nfunction prune(map, key) {\n const values = map.get(key);\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n}\n\nclass Multimap {\n constructor() {\n this.valuesByKey = new Map();\n }\n get keys() {\n return Array.from(this.valuesByKey.keys());\n }\n get values() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((values, set) => values.concat(Array.from(set)), []);\n }\n get size() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((size, set) => size + set.size, 0);\n }\n add(key, value) {\n add(this.valuesByKey, key, value);\n }\n delete(key, value) {\n del(this.valuesByKey, key, value);\n }\n has(key, value) {\n const values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n }\n hasKey(key) {\n return this.valuesByKey.has(key);\n }\n hasValue(value) {\n const sets = Array.from(this.valuesByKey.values());\n return sets.some((set) => set.has(value));\n }\n getValuesForKey(key) {\n const values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\n }\n getKeysForValue(value) {\n return Array.from(this.valuesByKey)\n .filter(([_key, values]) => values.has(value))\n .map(([key, _values]) => key);\n }\n}\n\nclass IndexedMultimap extends Multimap {\n constructor() {\n super();\n this.keysByValue = new Map();\n }\n get values() {\n return Array.from(this.keysByValue.keys());\n }\n add(key, value) {\n super.add(key, value);\n add(this.keysByValue, value, key);\n }\n delete(key, value) {\n super.delete(key, value);\n del(this.keysByValue, value, key);\n }\n hasValue(value) {\n return this.keysByValue.has(value);\n }\n getKeysForValue(value) {\n const set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n }\n}\n\nclass SelectorObserver {\n constructor(element, selector, delegate, details = {}) {\n this.selector = selector;\n this.details = details;\n this.elementObserver = new ElementObserver(element, this);\n this.delegate = delegate;\n this.matchesByElement = new Multimap();\n }\n get started() {\n return this.elementObserver.started;\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get element() {\n return this.elementObserver.element;\n }\n matchElement(element) {\n const matches = element.matches(this.selector);\n if (this.delegate.selectorMatchElement) {\n return matches && this.delegate.selectorMatchElement(element, this.details);\n }\n return matches;\n }\n matchElementsInTree(tree) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(this.selector)).filter((match) => this.matchElement(match));\n return match.concat(matches);\n }\n elementMatched(element) {\n this.selectorMatched(element);\n }\n elementUnmatched(element) {\n this.selectorUnmatched(element);\n }\n elementAttributeChanged(element, _attributeName) {\n const matches = this.matchElement(element);\n const matchedBefore = this.matchesByElement.has(this.selector, element);\n if (!matches && matchedBefore) {\n this.selectorUnmatched(element);\n }\n }\n selectorMatched(element) {\n if (this.delegate.selectorMatched) {\n this.delegate.selectorMatched(element, this.selector, this.details);\n this.matchesByElement.add(this.selector, element);\n }\n }\n selectorUnmatched(element) {\n this.delegate.selectorUnmatched(element, this.selector, this.details);\n this.matchesByElement.delete(this.selector, element);\n }\n}\n\nclass StringMapObserver {\n constructor(element, delegate) {\n this.element = element;\n this.delegate = delegate;\n this.started = false;\n this.stringMap = new Map();\n this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, { attributes: true, attributeOldValue: true });\n this.refresh();\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n for (const attributeName of this.knownAttributeNames) {\n this.refreshAttribute(attributeName, null);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n const attributeName = mutation.attributeName;\n if (attributeName) {\n this.refreshAttribute(attributeName, mutation.oldValue);\n }\n }\n refreshAttribute(attributeName, oldValue) {\n const key = this.delegate.getStringMapKeyForAttribute(attributeName);\n if (key != null) {\n if (!this.stringMap.has(attributeName)) {\n this.stringMapKeyAdded(key, attributeName);\n }\n const value = this.element.getAttribute(attributeName);\n if (this.stringMap.get(attributeName) != value) {\n this.stringMapValueChanged(value, key, oldValue);\n }\n if (value == null) {\n const oldValue = this.stringMap.get(attributeName);\n this.stringMap.delete(attributeName);\n if (oldValue)\n this.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n else {\n this.stringMap.set(attributeName, value);\n }\n }\n }\n stringMapKeyAdded(key, attributeName) {\n if (this.delegate.stringMapKeyAdded) {\n this.delegate.stringMapKeyAdded(key, attributeName);\n }\n }\n stringMapValueChanged(value, key, oldValue) {\n if (this.delegate.stringMapValueChanged) {\n this.delegate.stringMapValueChanged(value, key, oldValue);\n }\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n if (this.delegate.stringMapKeyRemoved) {\n this.delegate.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n }\n get knownAttributeNames() {\n return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)));\n }\n get currentAttributeNames() {\n return Array.from(this.element.attributes).map((attribute) => attribute.name);\n }\n get recordedAttributeNames() {\n return Array.from(this.stringMap.keys());\n }\n}\n\nclass TokenListObserver {\n constructor(element, attributeName, delegate) {\n this.attributeObserver = new AttributeObserver(element, attributeName, this);\n this.delegate = delegate;\n this.tokensByElement = new Multimap();\n }\n get started() {\n return this.attributeObserver.started;\n }\n start() {\n this.attributeObserver.start();\n }\n pause(callback) {\n this.attributeObserver.pause(callback);\n }\n stop() {\n this.attributeObserver.stop();\n }\n refresh() {\n this.attributeObserver.refresh();\n }\n get element() {\n return this.attributeObserver.element;\n }\n get attributeName() {\n return this.attributeObserver.attributeName;\n }\n elementMatchedAttribute(element) {\n this.tokensMatched(this.readTokensForElement(element));\n }\n elementAttributeValueChanged(element) {\n const [unmatchedTokens, matchedTokens] = this.refreshTokensForElement(element);\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n }\n elementUnmatchedAttribute(element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n }\n tokensMatched(tokens) {\n tokens.forEach((token) => this.tokenMatched(token));\n }\n tokensUnmatched(tokens) {\n tokens.forEach((token) => this.tokenUnmatched(token));\n }\n tokenMatched(token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n }\n tokenUnmatched(token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\n }\n refreshTokensForElement(element) {\n const previousTokens = this.tokensByElement.getValuesForKey(element);\n const currentTokens = this.readTokensForElement(element);\n const firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(([previousToken, currentToken]) => !tokensAreEqual(previousToken, currentToken));\n if (firstDifferingIndex == -1) {\n return [[], []];\n }\n else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\n }\n }\n readTokensForElement(element) {\n const attributeName = this.attributeName;\n const tokenString = element.getAttribute(attributeName) || \"\";\n return parseTokenString(tokenString, element, attributeName);\n }\n}\nfunction parseTokenString(tokenString, element, attributeName) {\n return tokenString\n .trim()\n .split(/\\s+/)\n .filter((content) => content.length)\n .map((content, index) => ({ element, attributeName, content, index }));\n}\nfunction zip(left, right) {\n const length = Math.max(left.length, right.length);\n return Array.from({ length }, (_, index) => [left[index], right[index]]);\n}\nfunction tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n}\n\nclass ValueListObserver {\n constructor(element, attributeName, delegate) {\n this.tokenListObserver = new TokenListObserver(element, attributeName, this);\n this.delegate = delegate;\n this.parseResultsByToken = new WeakMap();\n this.valuesByTokenByElement = new WeakMap();\n }\n get started() {\n return this.tokenListObserver.started;\n }\n start() {\n this.tokenListObserver.start();\n }\n stop() {\n this.tokenListObserver.stop();\n }\n refresh() {\n this.tokenListObserver.refresh();\n }\n get element() {\n return this.tokenListObserver.element;\n }\n get attributeName() {\n return this.tokenListObserver.attributeName;\n }\n tokenMatched(token) {\n const { element } = token;\n const { value } = this.fetchParseResultForToken(token);\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n }\n tokenUnmatched(token) {\n const { element } = token;\n const { value } = this.fetchParseResultForToken(token);\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n }\n fetchParseResultForToken(token) {\n let parseResult = this.parseResultsByToken.get(token);\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n return parseResult;\n }\n fetchValuesByTokenForElement(element) {\n let valuesByToken = this.valuesByTokenByElement.get(element);\n if (!valuesByToken) {\n valuesByToken = new Map();\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n return valuesByToken;\n }\n parseToken(token) {\n try {\n const value = this.delegate.parseValueForToken(token);\n return { value };\n }\n catch (error) {\n return { error };\n }\n }\n}\n\nclass BindingObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map();\n }\n start() {\n if (!this.valueListObserver) {\n this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this);\n this.valueListObserver.start();\n }\n }\n stop() {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n }\n get element() {\n return this.context.element;\n }\n get identifier() {\n return this.context.identifier;\n }\n get actionAttribute() {\n return this.schema.actionAttribute;\n }\n get schema() {\n return this.context.schema;\n }\n get bindings() {\n return Array.from(this.bindingsByAction.values());\n }\n connectAction(action) {\n const binding = new Binding(this.context, action);\n this.bindingsByAction.set(action, binding);\n this.delegate.bindingConnected(binding);\n }\n disconnectAction(action) {\n const binding = this.bindingsByAction.get(action);\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n }\n disconnectAllActions() {\n this.bindings.forEach((binding) => this.delegate.bindingDisconnected(binding, true));\n this.bindingsByAction.clear();\n }\n parseValueForToken(token) {\n const action = Action.forToken(token, this.schema);\n if (action.identifier == this.identifier) {\n return action;\n }\n }\n elementMatchedValue(element, action) {\n this.connectAction(action);\n }\n elementUnmatchedValue(element, action) {\n this.disconnectAction(action);\n }\n}\n\nclass ValueObserver {\n constructor(context, receiver) {\n this.context = context;\n this.receiver = receiver;\n this.stringMapObserver = new StringMapObserver(this.element, this);\n this.valueDescriptorMap = this.controller.valueDescriptorMap;\n }\n start() {\n this.stringMapObserver.start();\n this.invokeChangedCallbacksForDefaultValues();\n }\n stop() {\n this.stringMapObserver.stop();\n }\n get element() {\n return this.context.element;\n }\n get controller() {\n return this.context.controller;\n }\n getStringMapKeyForAttribute(attributeName) {\n if (attributeName in this.valueDescriptorMap) {\n return this.valueDescriptorMap[attributeName].name;\n }\n }\n stringMapKeyAdded(key, attributeName) {\n const descriptor = this.valueDescriptorMap[attributeName];\n if (!this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), descriptor.writer(descriptor.defaultValue));\n }\n }\n stringMapValueChanged(value, name, oldValue) {\n const descriptor = this.valueDescriptorNameMap[name];\n if (value === null)\n return;\n if (oldValue === null) {\n oldValue = descriptor.writer(descriptor.defaultValue);\n }\n this.invokeChangedCallback(name, value, oldValue);\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n const descriptor = this.valueDescriptorNameMap[key];\n if (this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), oldValue);\n }\n else {\n this.invokeChangedCallback(key, descriptor.writer(descriptor.defaultValue), oldValue);\n }\n }\n invokeChangedCallbacksForDefaultValues() {\n for (const { key, name, defaultValue, writer } of this.valueDescriptors) {\n if (defaultValue != undefined && !this.controller.data.has(key)) {\n this.invokeChangedCallback(name, writer(defaultValue), undefined);\n }\n }\n }\n invokeChangedCallback(name, rawValue, rawOldValue) {\n const changedMethodName = `${name}Changed`;\n const changedMethod = this.receiver[changedMethodName];\n if (typeof changedMethod == \"function\") {\n const descriptor = this.valueDescriptorNameMap[name];\n try {\n const value = descriptor.reader(rawValue);\n let oldValue = rawOldValue;\n if (rawOldValue) {\n oldValue = descriptor.reader(rawOldValue);\n }\n changedMethod.call(this.receiver, value, oldValue);\n }\n catch (error) {\n if (error instanceof TypeError) {\n error.message = `Stimulus Value \"${this.context.identifier}.${descriptor.name}\" - ${error.message}`;\n }\n throw error;\n }\n }\n }\n get valueDescriptors() {\n const { valueDescriptorMap } = this;\n return Object.keys(valueDescriptorMap).map((key) => valueDescriptorMap[key]);\n }\n get valueDescriptorNameMap() {\n const descriptors = {};\n Object.keys(this.valueDescriptorMap).forEach((key) => {\n const descriptor = this.valueDescriptorMap[key];\n descriptors[descriptor.name] = descriptor;\n });\n return descriptors;\n }\n hasValue(attributeName) {\n const descriptor = this.valueDescriptorNameMap[attributeName];\n const hasMethodName = `has${capitalize(descriptor.name)}`;\n return this.receiver[hasMethodName];\n }\n}\n\nclass TargetObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.targetsByName = new Multimap();\n }\n start() {\n if (!this.tokenListObserver) {\n this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this);\n this.tokenListObserver.start();\n }\n }\n stop() {\n if (this.tokenListObserver) {\n this.disconnectAllTargets();\n this.tokenListObserver.stop();\n delete this.tokenListObserver;\n }\n }\n tokenMatched({ element, content: name }) {\n if (this.scope.containsElement(element)) {\n this.connectTarget(element, name);\n }\n }\n tokenUnmatched({ element, content: name }) {\n this.disconnectTarget(element, name);\n }\n connectTarget(element, name) {\n var _a;\n if (!this.targetsByName.has(name, element)) {\n this.targetsByName.add(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetConnected(element, name));\n }\n }\n disconnectTarget(element, name) {\n var _a;\n if (this.targetsByName.has(name, element)) {\n this.targetsByName.delete(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetDisconnected(element, name));\n }\n }\n disconnectAllTargets() {\n for (const name of this.targetsByName.keys) {\n for (const element of this.targetsByName.getValuesForKey(name)) {\n this.disconnectTarget(element, name);\n }\n }\n }\n get attributeName() {\n return `data-${this.context.identifier}-target`;\n }\n get element() {\n return this.context.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\n\nfunction readInheritableStaticArrayValues(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce((values, constructor) => {\n getOwnStaticArrayValues(constructor, propertyName).forEach((name) => values.add(name));\n return values;\n }, new Set()));\n}\nfunction readInheritableStaticObjectPairs(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return ancestors.reduce((pairs, constructor) => {\n pairs.push(...getOwnStaticObjectPairs(constructor, propertyName));\n return pairs;\n }, []);\n}\nfunction getAncestorsForConstructor(constructor) {\n const ancestors = [];\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n return ancestors.reverse();\n}\nfunction getOwnStaticArrayValues(constructor, propertyName) {\n const definition = constructor[propertyName];\n return Array.isArray(definition) ? definition : [];\n}\nfunction getOwnStaticObjectPairs(constructor, propertyName) {\n const definition = constructor[propertyName];\n return definition ? Object.keys(definition).map((key) => [key, definition[key]]) : [];\n}\n\nclass OutletObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.outletsByName = new Multimap();\n this.outletElementsByName = new Multimap();\n this.selectorObserverMap = new Map();\n }\n start() {\n if (this.selectorObserverMap.size === 0) {\n this.outletDefinitions.forEach((outletName) => {\n const selector = this.selector(outletName);\n const details = { outletName };\n if (selector) {\n this.selectorObserverMap.set(outletName, new SelectorObserver(document.body, selector, this, details));\n }\n });\n this.selectorObserverMap.forEach((observer) => observer.start());\n }\n this.dependentContexts.forEach((context) => context.refresh());\n }\n stop() {\n if (this.selectorObserverMap.size > 0) {\n this.disconnectAllOutlets();\n this.selectorObserverMap.forEach((observer) => observer.stop());\n this.selectorObserverMap.clear();\n }\n }\n refresh() {\n this.selectorObserverMap.forEach((observer) => observer.refresh());\n }\n selectorMatched(element, _selector, { outletName }) {\n const outlet = this.getOutlet(element, outletName);\n if (outlet) {\n this.connectOutlet(outlet, element, outletName);\n }\n }\n selectorUnmatched(element, _selector, { outletName }) {\n const outlet = this.getOutletFromMap(element, outletName);\n if (outlet) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n selectorMatchElement(element, { outletName }) {\n return (this.hasOutlet(element, outletName) &&\n element.matches(`[${this.context.application.schema.controllerAttribute}~=${outletName}]`));\n }\n connectOutlet(outlet, element, outletName) {\n var _a;\n if (!this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.add(outletName, outlet);\n this.outletElementsByName.add(outletName, element);\n (_a = this.selectorObserverMap.get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletConnected(outlet, element, outletName));\n }\n }\n disconnectOutlet(outlet, element, outletName) {\n var _a;\n if (this.outletElementsByName.has(outletName, element)) {\n this.outletsByName.delete(outletName, outlet);\n this.outletElementsByName.delete(outletName, element);\n (_a = this.selectorObserverMap\n .get(outletName)) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.outletDisconnected(outlet, element, outletName));\n }\n }\n disconnectAllOutlets() {\n for (const outletName of this.outletElementsByName.keys) {\n for (const element of this.outletElementsByName.getValuesForKey(outletName)) {\n for (const outlet of this.outletsByName.getValuesForKey(outletName)) {\n this.disconnectOutlet(outlet, element, outletName);\n }\n }\n }\n }\n selector(outletName) {\n return this.scope.outlets.getSelectorForOutletName(outletName);\n }\n get outletDependencies() {\n const dependencies = new Multimap();\n this.router.modules.forEach((module) => {\n const constructor = module.definition.controllerConstructor;\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n outlets.forEach((outlet) => dependencies.add(outlet, module.identifier));\n });\n return dependencies;\n }\n get outletDefinitions() {\n return this.outletDependencies.getKeysForValue(this.identifier);\n }\n get dependentControllerIdentifiers() {\n return this.outletDependencies.getValuesForKey(this.identifier);\n }\n get dependentContexts() {\n const identifiers = this.dependentControllerIdentifiers;\n return this.router.contexts.filter((context) => identifiers.includes(context.identifier));\n }\n hasOutlet(element, outletName) {\n return !!this.getOutlet(element, outletName) || !!this.getOutletFromMap(element, outletName);\n }\n getOutlet(element, outletName) {\n return this.application.getControllerForElementAndIdentifier(element, outletName);\n }\n getOutletFromMap(element, outletName) {\n return this.outletsByName.getValuesForKey(outletName).find((outlet) => outlet.element === element);\n }\n get scope() {\n return this.context.scope;\n }\n get identifier() {\n return this.context.identifier;\n }\n get application() {\n return this.context.application;\n }\n get router() {\n return this.application.router;\n }\n}\n\nclass Context {\n constructor(module, scope) {\n this.logDebugActivity = (functionName, detail = {}) => {\n const { identifier, controller, element } = this;\n detail = Object.assign({ identifier, controller, element }, detail);\n this.application.logDebugActivity(this.identifier, functionName, detail);\n };\n this.module = module;\n this.scope = scope;\n this.controller = new module.controllerConstructor(this);\n this.bindingObserver = new BindingObserver(this, this.dispatcher);\n this.valueObserver = new ValueObserver(this, this.controller);\n this.targetObserver = new TargetObserver(this, this);\n this.outletObserver = new OutletObserver(this, this);\n try {\n this.controller.initialize();\n this.logDebugActivity(\"initialize\");\n }\n catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n connect() {\n this.bindingObserver.start();\n this.valueObserver.start();\n this.targetObserver.start();\n this.outletObserver.start();\n try {\n this.controller.connect();\n this.logDebugActivity(\"connect\");\n }\n catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n }\n refresh() {\n this.outletObserver.refresh();\n }\n disconnect() {\n try {\n this.controller.disconnect();\n this.logDebugActivity(\"disconnect\");\n }\n catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n this.outletObserver.stop();\n this.targetObserver.stop();\n this.valueObserver.stop();\n this.bindingObserver.stop();\n }\n get application() {\n return this.module.application;\n }\n get identifier() {\n return this.module.identifier;\n }\n get schema() {\n return this.application.schema;\n }\n get dispatcher() {\n return this.application.dispatcher;\n }\n get element() {\n return this.scope.element;\n }\n get parentElement() {\n return this.element.parentElement;\n }\n handleError(error, message, detail = {}) {\n const { identifier, controller, element } = this;\n detail = Object.assign({ identifier, controller, element }, detail);\n this.application.handleError(error, `Error ${message}`, detail);\n }\n targetConnected(element, name) {\n this.invokeControllerMethod(`${name}TargetConnected`, element);\n }\n targetDisconnected(element, name) {\n this.invokeControllerMethod(`${name}TargetDisconnected`, element);\n }\n outletConnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletConnected`, outlet, element);\n }\n outletDisconnected(outlet, element, name) {\n this.invokeControllerMethod(`${namespaceCamelize(name)}OutletDisconnected`, outlet, element);\n }\n invokeControllerMethod(methodName, ...args) {\n const controller = this.controller;\n if (typeof controller[methodName] == \"function\") {\n controller[methodName](...args);\n }\n }\n}\n\nfunction bless(constructor) {\n return shadow(constructor, getBlessedProperties(constructor));\n}\nfunction shadow(constructor, properties) {\n const shadowConstructor = extend(constructor);\n const shadowProperties = getShadowProperties(constructor.prototype, properties);\n Object.defineProperties(shadowConstructor.prototype, shadowProperties);\n return shadowConstructor;\n}\nfunction getBlessedProperties(constructor) {\n const blessings = readInheritableStaticArrayValues(constructor, \"blessings\");\n return blessings.reduce((blessedProperties, blessing) => {\n const properties = blessing(constructor);\n for (const key in properties) {\n const descriptor = blessedProperties[key] || {};\n blessedProperties[key] = Object.assign(descriptor, properties[key]);\n }\n return blessedProperties;\n }, {});\n}\nfunction getShadowProperties(prototype, properties) {\n return getOwnKeys(properties).reduce((shadowProperties, key) => {\n const descriptor = getShadowedDescriptor(prototype, properties, key);\n if (descriptor) {\n Object.assign(shadowProperties, { [key]: descriptor });\n }\n return shadowProperties;\n }, {});\n}\nfunction getShadowedDescriptor(prototype, properties, key) {\n const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key);\n const shadowedByValue = shadowingDescriptor && \"value\" in shadowingDescriptor;\n if (!shadowedByValue) {\n const descriptor = Object.getOwnPropertyDescriptor(properties, key).value;\n if (shadowingDescriptor) {\n descriptor.get = shadowingDescriptor.get || descriptor.get;\n descriptor.set = shadowingDescriptor.set || descriptor.set;\n }\n return descriptor;\n }\n}\nconst getOwnKeys = (() => {\n if (typeof Object.getOwnPropertySymbols == \"function\") {\n return (object) => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)];\n }\n else {\n return Object.getOwnPropertyNames;\n }\n})();\nconst extend = (() => {\n function extendWithReflect(constructor) {\n function extended() {\n return Reflect.construct(constructor, arguments, new.target);\n }\n extended.prototype = Object.create(constructor.prototype, {\n constructor: { value: extended },\n });\n Reflect.setPrototypeOf(extended, constructor);\n return extended;\n }\n function testReflectExtension() {\n const a = function () {\n this.a.call(this);\n };\n const b = extendWithReflect(a);\n b.prototype.a = function () { };\n return new b();\n }\n try {\n testReflectExtension();\n return extendWithReflect;\n }\n catch (error) {\n return (constructor) => class extended extends constructor {\n };\n }\n})();\n\nfunction blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: bless(definition.controllerConstructor),\n };\n}\n\nclass Module {\n constructor(application, definition) {\n this.application = application;\n this.definition = blessDefinition(definition);\n this.contextsByScope = new WeakMap();\n this.connectedContexts = new Set();\n }\n get identifier() {\n return this.definition.identifier;\n }\n get controllerConstructor() {\n return this.definition.controllerConstructor;\n }\n get contexts() {\n return Array.from(this.connectedContexts);\n }\n connectContextForScope(scope) {\n const context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n }\n disconnectContextForScope(scope) {\n const context = this.contextsByScope.get(scope);\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n }\n fetchContextForScope(scope) {\n let context = this.contextsByScope.get(scope);\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n return context;\n }\n}\n\nclass ClassMap {\n constructor(scope) {\n this.scope = scope;\n }\n has(name) {\n return this.data.has(this.getDataKey(name));\n }\n get(name) {\n return this.getAll(name)[0];\n }\n getAll(name) {\n const tokenString = this.data.get(this.getDataKey(name)) || \"\";\n return tokenize(tokenString);\n }\n getAttributeName(name) {\n return this.data.getAttributeNameForKey(this.getDataKey(name));\n }\n getDataKey(name) {\n return `${name}-class`;\n }\n get data() {\n return this.scope.data;\n }\n}\n\nclass DataMap {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.getAttribute(name);\n }\n set(key, value) {\n const name = this.getAttributeNameForKey(key);\n this.element.setAttribute(name, value);\n return this.get(key);\n }\n has(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.hasAttribute(name);\n }\n delete(key) {\n if (this.has(key)) {\n const name = this.getAttributeNameForKey(key);\n this.element.removeAttribute(name);\n return true;\n }\n else {\n return false;\n }\n }\n getAttributeNameForKey(key) {\n return `data-${this.identifier}-${dasherize(key)}`;\n }\n}\n\nclass Guide {\n constructor(logger) {\n this.warnedKeysByObject = new WeakMap();\n this.logger = logger;\n }\n warn(object, key, message) {\n let warnedKeys = this.warnedKeysByObject.get(object);\n if (!warnedKeys) {\n warnedKeys = new Set();\n this.warnedKeysByObject.set(object, warnedKeys);\n }\n if (!warnedKeys.has(key)) {\n warnedKeys.add(key);\n this.logger.warn(message, object);\n }\n }\n}\n\nfunction attributeValueContainsToken(attributeName, token) {\n return `[${attributeName}~=\"${token}\"]`;\n}\n\nclass TargetSet {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(targetName) {\n return this.find(targetName) != null;\n }\n find(...targetNames) {\n return targetNames.reduce((target, targetName) => target || this.findTarget(targetName) || this.findLegacyTarget(targetName), undefined);\n }\n findAll(...targetNames) {\n return targetNames.reduce((targets, targetName) => [\n ...targets,\n ...this.findAllTargets(targetName),\n ...this.findAllLegacyTargets(targetName),\n ], []);\n }\n findTarget(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findElement(selector);\n }\n findAllTargets(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findAllElements(selector);\n }\n getSelectorForTargetName(targetName) {\n const attributeName = this.schema.targetAttributeForScope(this.identifier);\n return attributeValueContainsToken(attributeName, targetName);\n }\n findLegacyTarget(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.deprecate(this.scope.findElement(selector), targetName);\n }\n findAllLegacyTargets(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.scope.findAllElements(selector).map((element) => this.deprecate(element, targetName));\n }\n getLegacySelectorForTargetName(targetName) {\n const targetDescriptor = `${this.identifier}.${targetName}`;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n }\n deprecate(element, targetName) {\n if (element) {\n const { identifier } = this;\n const attributeName = this.schema.targetAttribute;\n const revisedAttributeName = this.schema.targetAttributeForScope(identifier);\n this.guide.warn(element, `target:${targetName}`, `Please replace ${attributeName}=\"${identifier}.${targetName}\" with ${revisedAttributeName}=\"${targetName}\". ` +\n `The ${attributeName} attribute is deprecated and will be removed in a future version of Stimulus.`);\n }\n return element;\n }\n get guide() {\n return this.scope.guide;\n }\n}\n\nclass OutletSet {\n constructor(scope, controllerElement) {\n this.scope = scope;\n this.controllerElement = controllerElement;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(outletName) {\n return this.find(outletName) != null;\n }\n find(...outletNames) {\n return outletNames.reduce((outlet, outletName) => outlet || this.findOutlet(outletName), undefined);\n }\n findAll(...outletNames) {\n return outletNames.reduce((outlets, outletName) => [...outlets, ...this.findAllOutlets(outletName)], []);\n }\n getSelectorForOutletName(outletName) {\n const attributeName = this.schema.outletAttributeForScope(this.identifier, outletName);\n return this.controllerElement.getAttribute(attributeName);\n }\n findOutlet(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n if (selector)\n return this.findElement(selector, outletName);\n }\n findAllOutlets(outletName) {\n const selector = this.getSelectorForOutletName(outletName);\n return selector ? this.findAllElements(selector, outletName) : [];\n }\n findElement(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter((element) => this.matchesElement(element, selector, outletName))[0];\n }\n findAllElements(selector, outletName) {\n const elements = this.scope.queryElements(selector);\n return elements.filter((element) => this.matchesElement(element, selector, outletName));\n }\n matchesElement(element, selector, outletName) {\n const controllerAttribute = element.getAttribute(this.scope.schema.controllerAttribute) || \"\";\n return element.matches(selector) && controllerAttribute.split(\" \").includes(outletName);\n }\n}\n\nclass Scope {\n constructor(schema, element, identifier, logger) {\n this.targets = new TargetSet(this);\n this.classes = new ClassMap(this);\n this.data = new DataMap(this);\n this.containsElement = (element) => {\n return element.closest(this.controllerSelector) === this.element;\n };\n this.schema = schema;\n this.element = element;\n this.identifier = identifier;\n this.guide = new Guide(logger);\n this.outlets = new OutletSet(this.documentScope, element);\n }\n findElement(selector) {\n return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement);\n }\n findAllElements(selector) {\n return [\n ...(this.element.matches(selector) ? [this.element] : []),\n ...this.queryElements(selector).filter(this.containsElement),\n ];\n }\n queryElements(selector) {\n return Array.from(this.element.querySelectorAll(selector));\n }\n get controllerSelector() {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n }\n get isDocumentScope() {\n return this.element === document.documentElement;\n }\n get documentScope() {\n return this.isDocumentScope\n ? this\n : new Scope(this.schema, document.documentElement, this.identifier, this.guide.logger);\n }\n}\n\nclass ScopeObserver {\n constructor(element, schema, delegate) {\n this.element = element;\n this.schema = schema;\n this.delegate = delegate;\n this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this);\n this.scopesByIdentifierByElement = new WeakMap();\n this.scopeReferenceCounts = new WeakMap();\n }\n start() {\n this.valueListObserver.start();\n }\n stop() {\n this.valueListObserver.stop();\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n parseValueForToken(token) {\n const { element, content: identifier } = token;\n const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);\n let scope = scopesByIdentifier.get(identifier);\n if (!scope) {\n scope = this.delegate.createScopeForElementAndIdentifier(element, identifier);\n scopesByIdentifier.set(identifier, scope);\n }\n return scope;\n }\n elementMatchedValue(element, value) {\n const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n }\n elementUnmatchedValue(element, value) {\n const referenceCount = this.scopeReferenceCounts.get(value);\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n }\n fetchScopesByIdentifierForElement(element) {\n let scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map();\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n return scopesByIdentifier;\n }\n}\n\nclass Router {\n constructor(application) {\n this.application = application;\n this.scopeObserver = new ScopeObserver(this.element, this.schema, this);\n this.scopesByIdentifier = new Multimap();\n this.modulesByIdentifier = new Map();\n }\n get element() {\n return this.application.element;\n }\n get schema() {\n return this.application.schema;\n }\n get logger() {\n return this.application.logger;\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n get modules() {\n return Array.from(this.modulesByIdentifier.values());\n }\n get contexts() {\n return this.modules.reduce((contexts, module) => contexts.concat(module.contexts), []);\n }\n start() {\n this.scopeObserver.start();\n }\n stop() {\n this.scopeObserver.stop();\n }\n loadDefinition(definition) {\n this.unloadIdentifier(definition.identifier);\n const module = new Module(this.application, definition);\n this.connectModule(module);\n const afterLoad = definition.controllerConstructor.afterLoad;\n if (afterLoad) {\n afterLoad(definition.identifier, this.application);\n }\n }\n unloadIdentifier(identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n this.disconnectModule(module);\n }\n }\n getContextForElementAndIdentifier(element, identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n return module.contexts.find((context) => context.element == element);\n }\n }\n handleError(error, message, detail) {\n this.application.handleError(error, message, detail);\n }\n createScopeForElementAndIdentifier(element, identifier) {\n return new Scope(this.schema, element, identifier, this.logger);\n }\n scopeConnected(scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.connectContextForScope(scope);\n }\n }\n scopeDisconnected(scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.disconnectContextForScope(scope);\n }\n }\n connectModule(module) {\n this.modulesByIdentifier.set(module.identifier, module);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach((scope) => module.connectContextForScope(scope));\n }\n disconnectModule(module) {\n this.modulesByIdentifier.delete(module.identifier);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach((scope) => module.disconnectContextForScope(scope));\n }\n}\n\nconst defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\",\n targetAttributeForScope: (identifier) => `data-${identifier}-target`,\n outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`,\n keyMappings: Object.assign(Object.assign({ enter: \"Enter\", tab: \"Tab\", esc: \"Escape\", space: \" \", up: \"ArrowUp\", down: \"ArrowDown\", left: \"ArrowLeft\", right: \"ArrowRight\", home: \"Home\", end: \"End\" }, objectFromEntries(\"abcdefghijklmnopqrstuvwxyz\".split(\"\").map((c) => [c, c]))), objectFromEntries(\"0123456789\".split(\"\").map((n) => [n, n]))),\n};\nfunction objectFromEntries(array) {\n return array.reduce((memo, [k, v]) => (Object.assign(Object.assign({}, memo), { [k]: v })), {});\n}\n\nclass Application {\n constructor(element = document.documentElement, schema = defaultSchema) {\n this.logger = console;\n this.debug = false;\n this.logDebugActivity = (identifier, functionName, detail = {}) => {\n if (this.debug) {\n this.logFormattedMessage(identifier, functionName, detail);\n }\n };\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n this.actionDescriptorFilters = Object.assign({}, defaultActionDescriptorFilters);\n }\n static start(element, schema) {\n const application = new this(element, schema);\n application.start();\n return application;\n }\n async start() {\n await domReady();\n this.logDebugActivity(\"application\", \"starting\");\n this.dispatcher.start();\n this.router.start();\n this.logDebugActivity(\"application\", \"start\");\n }\n stop() {\n this.logDebugActivity(\"application\", \"stopping\");\n this.dispatcher.stop();\n this.router.stop();\n this.logDebugActivity(\"application\", \"stop\");\n }\n register(identifier, controllerConstructor) {\n this.load({ identifier, controllerConstructor });\n }\n registerActionOption(name, filter) {\n this.actionDescriptorFilters[name] = filter;\n }\n load(head, ...rest) {\n const definitions = Array.isArray(head) ? head : [head, ...rest];\n definitions.forEach((definition) => {\n if (definition.controllerConstructor.shouldLoad) {\n this.router.loadDefinition(definition);\n }\n });\n }\n unload(head, ...rest) {\n const identifiers = Array.isArray(head) ? head : [head, ...rest];\n identifiers.forEach((identifier) => this.router.unloadIdentifier(identifier));\n }\n get controllers() {\n return this.router.contexts.map((context) => context.controller);\n }\n getControllerForElementAndIdentifier(element, identifier) {\n const context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n }\n handleError(error, message, detail) {\n var _a;\n this.logger.error(`%s\\n\\n%o\\n\\n%o`, message, error, detail);\n (_a = window.onerror) === null || _a === void 0 ? void 0 : _a.call(window, message, \"\", 0, 0, error);\n }\n logFormattedMessage(identifier, functionName, detail = {}) {\n detail = Object.assign({ application: this }, detail);\n this.logger.groupCollapsed(`${identifier} #${functionName}`);\n this.logger.log(\"details:\", Object.assign({}, detail));\n this.logger.groupEnd();\n }\n}\nfunction domReady() {\n return new Promise((resolve) => {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", () => resolve());\n }\n else {\n resolve();\n }\n });\n}\n\nfunction ClassPropertiesBlessing(constructor) {\n const classes = readInheritableStaticArrayValues(constructor, \"classes\");\n return classes.reduce((properties, classDefinition) => {\n return Object.assign(properties, propertiesForClassDefinition(classDefinition));\n }, {});\n}\nfunction propertiesForClassDefinition(key) {\n return {\n [`${key}Class`]: {\n get() {\n const { classes } = this;\n if (classes.has(key)) {\n return classes.get(key);\n }\n else {\n const attribute = classes.getAttributeName(key);\n throw new Error(`Missing attribute \"${attribute}\"`);\n }\n },\n },\n [`${key}Classes`]: {\n get() {\n return this.classes.getAll(key);\n },\n },\n [`has${capitalize(key)}Class`]: {\n get() {\n return this.classes.has(key);\n },\n },\n };\n}\n\nfunction OutletPropertiesBlessing(constructor) {\n const outlets = readInheritableStaticArrayValues(constructor, \"outlets\");\n return outlets.reduce((properties, outletDefinition) => {\n return Object.assign(properties, propertiesForOutletDefinition(outletDefinition));\n }, {});\n}\nfunction propertiesForOutletDefinition(name) {\n const camelizedName = namespaceCamelize(name);\n return {\n [`${camelizedName}Outlet`]: {\n get() {\n const outlet = this.outlets.find(name);\n if (outlet) {\n const outletController = this.application.getControllerForElementAndIdentifier(outlet, name);\n if (outletController) {\n return outletController;\n }\n else {\n throw new Error(`Missing \"data-controller=${name}\" attribute on outlet element for \"${this.identifier}\" controller`);\n }\n }\n throw new Error(`Missing outlet element \"${name}\" for \"${this.identifier}\" controller`);\n },\n },\n [`${camelizedName}Outlets`]: {\n get() {\n const outlets = this.outlets.findAll(name);\n if (outlets.length > 0) {\n return outlets\n .map((outlet) => {\n const controller = this.application.getControllerForElementAndIdentifier(outlet, name);\n if (controller) {\n return controller;\n }\n else {\n console.warn(`The provided outlet element is missing the outlet controller \"${name}\" for \"${this.identifier}\"`, outlet);\n }\n })\n .filter((controller) => controller);\n }\n return [];\n },\n },\n [`${camelizedName}OutletElement`]: {\n get() {\n const outlet = this.outlets.find(name);\n if (outlet) {\n return outlet;\n }\n else {\n throw new Error(`Missing outlet element \"${name}\" for \"${this.identifier}\" controller`);\n }\n },\n },\n [`${camelizedName}OutletElements`]: {\n get() {\n return this.outlets.findAll(name);\n },\n },\n [`has${capitalize(camelizedName)}Outlet`]: {\n get() {\n return this.outlets.has(name);\n },\n },\n };\n}\n\nfunction TargetPropertiesBlessing(constructor) {\n const targets = readInheritableStaticArrayValues(constructor, \"targets\");\n return targets.reduce((properties, targetDefinition) => {\n return Object.assign(properties, propertiesForTargetDefinition(targetDefinition));\n }, {});\n}\nfunction propertiesForTargetDefinition(name) {\n return {\n [`${name}Target`]: {\n get() {\n const target = this.targets.find(name);\n if (target) {\n return target;\n }\n else {\n throw new Error(`Missing target element \"${name}\" for \"${this.identifier}\" controller`);\n }\n },\n },\n [`${name}Targets`]: {\n get() {\n return this.targets.findAll(name);\n },\n },\n [`has${capitalize(name)}Target`]: {\n get() {\n return this.targets.has(name);\n },\n },\n };\n}\n\nfunction ValuePropertiesBlessing(constructor) {\n const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, \"values\");\n const propertyDescriptorMap = {\n valueDescriptorMap: {\n get() {\n return valueDefinitionPairs.reduce((result, valueDefinitionPair) => {\n const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier);\n const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key);\n return Object.assign(result, { [attributeName]: valueDescriptor });\n }, {});\n },\n },\n };\n return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => {\n return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair));\n }, propertyDescriptorMap);\n}\nfunction propertiesForValueDefinitionPair(valueDefinitionPair, controller) {\n const definition = parseValueDefinitionPair(valueDefinitionPair, controller);\n const { key, name, reader: read, writer: write } = definition;\n return {\n [name]: {\n get() {\n const value = this.data.get(key);\n if (value !== null) {\n return read(value);\n }\n else {\n return definition.defaultValue;\n }\n },\n set(value) {\n if (value === undefined) {\n this.data.delete(key);\n }\n else {\n this.data.set(key, write(value));\n }\n },\n },\n [`has${capitalize(name)}`]: {\n get() {\n return this.data.has(key) || definition.hasCustomDefaultValue;\n },\n },\n };\n}\nfunction parseValueDefinitionPair([token, typeDefinition], controller) {\n return valueDescriptorForTokenAndTypeDefinition({\n controller,\n token,\n typeDefinition,\n });\n}\nfunction parseValueTypeConstant(constant) {\n switch (constant) {\n case Array:\n return \"array\";\n case Boolean:\n return \"boolean\";\n case Number:\n return \"number\";\n case Object:\n return \"object\";\n case String:\n return \"string\";\n }\n}\nfunction parseValueTypeDefault(defaultValue) {\n switch (typeof defaultValue) {\n case \"boolean\":\n return \"boolean\";\n case \"number\":\n return \"number\";\n case \"string\":\n return \"string\";\n }\n if (Array.isArray(defaultValue))\n return \"array\";\n if (Object.prototype.toString.call(defaultValue) === \"[object Object]\")\n return \"object\";\n}\nfunction parseValueTypeObject(payload) {\n const typeFromObject = parseValueTypeConstant(payload.typeObject.type);\n if (!typeFromObject)\n return;\n const defaultValueType = parseValueTypeDefault(payload.typeObject.default);\n if (typeFromObject !== defaultValueType) {\n const propertyPath = payload.controller ? `${payload.controller}.${payload.token}` : payload.token;\n throw new Error(`The specified default value for the Stimulus Value \"${propertyPath}\" must match the defined type \"${typeFromObject}\". The provided default value of \"${payload.typeObject.default}\" is of type \"${defaultValueType}\".`);\n }\n return typeFromObject;\n}\nfunction parseValueTypeDefinition(payload) {\n const typeFromObject = parseValueTypeObject({\n controller: payload.controller,\n token: payload.token,\n typeObject: payload.typeDefinition,\n });\n const typeFromDefaultValue = parseValueTypeDefault(payload.typeDefinition);\n const typeFromConstant = parseValueTypeConstant(payload.typeDefinition);\n const type = typeFromObject || typeFromDefaultValue || typeFromConstant;\n if (type)\n return type;\n const propertyPath = payload.controller ? `${payload.controller}.${payload.typeDefinition}` : payload.token;\n throw new Error(`Unknown value type \"${propertyPath}\" for \"${payload.token}\" value`);\n}\nfunction defaultValueForDefinition(typeDefinition) {\n const constant = parseValueTypeConstant(typeDefinition);\n if (constant)\n return defaultValuesByType[constant];\n const defaultValue = typeDefinition.default;\n if (defaultValue !== undefined)\n return defaultValue;\n return typeDefinition;\n}\nfunction valueDescriptorForTokenAndTypeDefinition(payload) {\n const key = `${dasherize(payload.token)}-value`;\n const type = parseValueTypeDefinition(payload);\n return {\n type,\n key,\n name: camelize(key),\n get defaultValue() {\n return defaultValueForDefinition(payload.typeDefinition);\n },\n get hasCustomDefaultValue() {\n return parseValueTypeDefault(payload.typeDefinition) !== undefined;\n },\n reader: readers[type],\n writer: writers[type] || writers.default,\n };\n}\nconst defaultValuesByType = {\n get array() {\n return [];\n },\n boolean: false,\n number: 0,\n get object() {\n return {};\n },\n string: \"\",\n};\nconst readers = {\n array(value) {\n const array = JSON.parse(value);\n if (!Array.isArray(array)) {\n throw new TypeError(`expected value of type \"array\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(array)}\"`);\n }\n return array;\n },\n boolean(value) {\n return !(value == \"0\" || String(value).toLowerCase() == \"false\");\n },\n number(value) {\n return Number(value);\n },\n object(value) {\n const object = JSON.parse(value);\n if (object === null || typeof object != \"object\" || Array.isArray(object)) {\n throw new TypeError(`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(object)}\"`);\n }\n return object;\n },\n string(value) {\n return value;\n },\n};\nconst writers = {\n default: writeString,\n array: writeJSON,\n object: writeJSON,\n};\nfunction writeJSON(value) {\n return JSON.stringify(value);\n}\nfunction writeString(value) {\n return `${value}`;\n}\n\nclass Controller {\n constructor(context) {\n this.context = context;\n }\n static get shouldLoad() {\n return true;\n }\n static afterLoad(_identifier, _application) {\n return;\n }\n get application() {\n return this.context.application;\n }\n get scope() {\n return this.context.scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get targets() {\n return this.scope.targets;\n }\n get outlets() {\n return this.scope.outlets;\n }\n get classes() {\n return this.scope.classes;\n }\n get data() {\n return this.scope.data;\n }\n initialize() {\n }\n connect() {\n }\n disconnect() {\n }\n dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true } = {}) {\n const type = prefix ? `${prefix}:${eventName}` : eventName;\n const event = new CustomEvent(type, { detail, bubbles, cancelable });\n target.dispatchEvent(event);\n return event;\n }\n}\nController.blessings = [\n ClassPropertiesBlessing,\n TargetPropertiesBlessing,\n ValuePropertiesBlessing,\n OutletPropertiesBlessing,\n];\nController.targets = [];\nController.outlets = [];\nController.values = {};\n\nexport { Application, AttributeObserver, Context, Controller, ElementObserver, IndexedMultimap, Multimap, SelectorObserver, StringMapObserver, TokenListObserver, ValueListObserver, add, defaultSchema, del, fetch, prune };\n", "import { Controller } from '@hotwired/stimulus'\n\nconst LOADER_CLASSES = 'absolute bg-gray-100 opacity-10 w-full h-full'\n\nexport default class extends Controller {\n static targets = ['countrySelectInput', 'citySelectInput', 'citySelectWrapper'];\n\n static values = {\n view: String,\n }\n\n // The fields initial value\n static initialValue\n\n get placeholder() {\n return this.citySelectInputTarget.ariaPlaceholder\n }\n\n set loading(isLoading) {\n if (isLoading) {\n // create a loader overlay\n const loadingDiv = document.createElement('div')\n loadingDiv.className = LOADER_CLASSES\n loadingDiv.dataset.target = 'city-loader'\n\n // add the loader overlay\n this.citySelectWrapperTarget.prepend(loadingDiv)\n this.citySelectWrapperTarget.classList.add('opacity-50')\n } else {\n // remove the loader overlay\n this.citySelectWrapperTarget.querySelector('[data-target=\"city-loader\"]').remove()\n this.citySelectWrapperTarget.classList.remove('opacity-50')\n }\n }\n\n async connect() {\n // Add the controller functionality only on forms\n if (['edit', 'new'].includes(this.viewValue)) {\n this.captureTheInitialValue()\n\n // Trigger the change on load\n await this.onCountryChange()\n }\n }\n\n // Read the country select.\n // If there's any value selected show the cities and prefill them.\n async onCountryChange() {\n if (this.hasCountrySelectInputTarget && this.countrySelectInputTarget) {\n // Get the country\n const country = this.countrySelectInputTarget.value\n // Dynamically fetch the cities for this country\n const cities = await this.fetchCitiesForCountry(country)\n\n // Clear the select of options\n Object.keys(this.citySelectInputTarget.options).forEach(() => {\n this.citySelectInputTarget.options.remove(0)\n })\n\n // Add blank option\n this.citySelectInputTarget.add(new Option(this.placeholder))\n\n // Add the new cities\n cities.forEach((city) => {\n this.citySelectInputTarget.add(new Option(city, city))\n })\n\n // Check if the initial value is present in the cities array and select it.\n // If not, select the first item\n const currentOptions = Array.from(this.citySelectInputTarget.options).map((item) => item.value)\n if (currentOptions.includes(this.initialValue)) {\n this.citySelectInputTarget.value = this.initialValue\n } else {\n // Select the first item\n this.citySelectInputTarget.value = this.citySelectInputTarget.options[0].value\n }\n }\n }\n\n // Private\n\n captureTheInitialValue() {\n this.initialValue = this.citySelectInputTarget.value\n }\n\n async fetchCitiesForCountry(country) {\n if (!country) {\n return []\n }\n\n this.loading = true\n\n const response = await fetch(\n `${window.Avo.configuration.root_path}/resources/courses/cities?country=${country}`,\n )\n const data = await response.json()\n\n this.loading = false\n\n return data\n }\n}\n", "function camelize(value) {\n return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase());\n}\nfunction capitalize(value) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\nfunction dasherize(value) {\n return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`);\n}\nfunction readInheritableStaticArrayValues(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce((values, constructor2) => {\n getOwnStaticArrayValues(constructor2, propertyName).forEach((name) => values.add(name));\n return values;\n }, new Set()));\n}\nfunction readInheritableStaticObjectPairs(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return ancestors.reduce((pairs, constructor2) => {\n pairs.push(...getOwnStaticObjectPairs(constructor2, propertyName));\n return pairs;\n }, []);\n}\nfunction getAncestorsForConstructor(constructor) {\n const ancestors = [];\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n return ancestors.reverse();\n}\nfunction getOwnStaticArrayValues(constructor, propertyName) {\n const definition = constructor[propertyName];\n return Array.isArray(definition) ? definition : [];\n}\nfunction getOwnStaticObjectPairs(constructor, propertyName) {\n const definition = constructor[propertyName];\n return definition ? Object.keys(definition).map((key) => [key, definition[key]]) : [];\n}\n(() => {\n function extendWithReflect(constructor) {\n function extended() {\n return Reflect.construct(constructor, arguments, new.target);\n }\n extended.prototype = Object.create(constructor.prototype, {\n constructor: { value: extended }\n });\n Reflect.setPrototypeOf(extended, constructor);\n return extended;\n }\n function testReflectExtension() {\n const a = function() {\n this.a.call(this);\n };\n const b = extendWithReflect(a);\n b.prototype.a = function() {\n };\n return new b();\n }\n try {\n testReflectExtension();\n return extendWithReflect;\n } catch (error) {\n return (constructor) => class extended extends constructor {\n };\n }\n})();\nfunction ClassPropertiesBlessing(constructor) {\n const classes = readInheritableStaticArrayValues(constructor, \"classes\");\n return classes.reduce((properties, classDefinition) => {\n return Object.assign(properties, propertiesForClassDefinition(classDefinition));\n }, {});\n}\nfunction propertiesForClassDefinition(key) {\n return {\n [`${key}Class`]: {\n get() {\n const { classes } = this;\n if (classes.has(key)) {\n return classes.get(key);\n } else {\n const attribute = classes.getAttributeName(key);\n throw new Error(`Missing attribute \"${attribute}\"`);\n }\n }\n },\n [`${key}Classes`]: {\n get() {\n return this.classes.getAll(key);\n }\n },\n [`has${capitalize(key)}Class`]: {\n get() {\n return this.classes.has(key);\n }\n }\n };\n}\nfunction TargetPropertiesBlessing(constructor) {\n const targets = readInheritableStaticArrayValues(constructor, \"targets\");\n return targets.reduce((properties, targetDefinition) => {\n return Object.assign(properties, propertiesForTargetDefinition(targetDefinition));\n }, {});\n}\nfunction propertiesForTargetDefinition(name) {\n return {\n [`${name}Target`]: {\n get() {\n const target = this.targets.find(name);\n if (target) {\n return target;\n } else {\n throw new Error(`Missing target element \"${name}\" for \"${this.identifier}\" controller`);\n }\n }\n },\n [`${name}Targets`]: {\n get() {\n return this.targets.findAll(name);\n }\n },\n [`has${capitalize(name)}Target`]: {\n get() {\n return this.targets.has(name);\n }\n }\n };\n}\nfunction ValuePropertiesBlessing(constructor) {\n const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, \"values\");\n const propertyDescriptorMap = {\n valueDescriptorMap: {\n get() {\n return valueDefinitionPairs.reduce((result, valueDefinitionPair) => {\n const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair);\n const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key);\n return Object.assign(result, { [attributeName]: valueDescriptor });\n }, {});\n }\n }\n };\n return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => {\n return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair));\n }, propertyDescriptorMap);\n}\nfunction propertiesForValueDefinitionPair(valueDefinitionPair) {\n const definition = parseValueDefinitionPair(valueDefinitionPair);\n const { key, name, reader: read, writer: write } = definition;\n return {\n [name]: {\n get() {\n const value = this.data.get(key);\n if (value !== null) {\n return read(value);\n } else {\n return definition.defaultValue;\n }\n },\n set(value) {\n if (value === void 0) {\n this.data.delete(key);\n } else {\n this.data.set(key, write(value));\n }\n }\n },\n [`has${capitalize(name)}`]: {\n get() {\n return this.data.has(key) || definition.hasCustomDefaultValue;\n }\n }\n };\n}\nfunction parseValueDefinitionPair([token, typeDefinition]) {\n return valueDescriptorForTokenAndTypeDefinition(token, typeDefinition);\n}\nfunction parseValueTypeConstant(constant) {\n switch (constant) {\n case Array:\n return \"array\";\n case Boolean:\n return \"boolean\";\n case Number:\n return \"number\";\n case Object:\n return \"object\";\n case String:\n return \"string\";\n }\n}\nfunction parseValueTypeDefault(defaultValue) {\n switch (typeof defaultValue) {\n case \"boolean\":\n return \"boolean\";\n case \"number\":\n return \"number\";\n case \"string\":\n return \"string\";\n }\n if (Array.isArray(defaultValue))\n return \"array\";\n if (Object.prototype.toString.call(defaultValue) === \"[object Object]\")\n return \"object\";\n}\nfunction parseValueTypeObject(typeObject) {\n const typeFromObject = parseValueTypeConstant(typeObject.type);\n if (typeFromObject) {\n const defaultValueType = parseValueTypeDefault(typeObject.default);\n if (typeFromObject !== defaultValueType) {\n throw new Error(`Type \"${typeFromObject}\" must match the type of the default value. Given default value: \"${typeObject.default}\" as \"${defaultValueType}\"`);\n }\n return typeFromObject;\n }\n}\nfunction parseValueTypeDefinition(typeDefinition) {\n const typeFromObject = parseValueTypeObject(typeDefinition);\n const typeFromDefaultValue = parseValueTypeDefault(typeDefinition);\n const typeFromConstant = parseValueTypeConstant(typeDefinition);\n const type = typeFromObject || typeFromDefaultValue || typeFromConstant;\n if (type)\n return type;\n throw new Error(`Unknown value type \"${typeDefinition}\"`);\n}\nfunction defaultValueForDefinition(typeDefinition) {\n const constant = parseValueTypeConstant(typeDefinition);\n if (constant)\n return defaultValuesByType[constant];\n const defaultValue = typeDefinition.default;\n if (defaultValue !== void 0)\n return defaultValue;\n return typeDefinition;\n}\nfunction valueDescriptorForTokenAndTypeDefinition(token, typeDefinition) {\n const key = `${dasherize(token)}-value`;\n const type = parseValueTypeDefinition(typeDefinition);\n return {\n type,\n key,\n name: camelize(key),\n get defaultValue() {\n return defaultValueForDefinition(typeDefinition);\n },\n get hasCustomDefaultValue() {\n return parseValueTypeDefault(typeDefinition) !== void 0;\n },\n reader: readers[type],\n writer: writers[type] || writers.default\n };\n}\nconst defaultValuesByType = {\n get array() {\n return [];\n },\n boolean: false,\n number: 0,\n get object() {\n return {};\n },\n string: \"\"\n};\nconst readers = {\n array(value) {\n const array = JSON.parse(value);\n if (!Array.isArray(array)) {\n throw new TypeError(\"Expected array\");\n }\n return array;\n },\n boolean(value) {\n return !(value == \"0\" || value == \"false\");\n },\n number(value) {\n return Number(value);\n },\n object(value) {\n const object = JSON.parse(value);\n if (object === null || typeof object != \"object\" || Array.isArray(object)) {\n throw new TypeError(\"Expected object\");\n }\n return object;\n },\n string(value) {\n return value;\n }\n};\nconst writers = {\n default: writeString,\n array: writeJSON,\n object: writeJSON\n};\nfunction writeJSON(value) {\n return JSON.stringify(value);\n}\nfunction writeString(value) {\n return `${value}`;\n}\nclass Controller {\n constructor(context) {\n this.context = context;\n }\n static get shouldLoad() {\n return true;\n }\n get application() {\n return this.context.application;\n }\n get scope() {\n return this.context.scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get targets() {\n return this.scope.targets;\n }\n get classes() {\n return this.scope.classes;\n }\n get data() {\n return this.scope.data;\n }\n initialize() {\n }\n connect() {\n }\n disconnect() {\n }\n dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true } = {}) {\n const type = prefix ? `${prefix}:${eventName}` : eventName;\n const event = new CustomEvent(type, { detail, bubbles, cancelable });\n target.dispatchEvent(event);\n return event;\n }\n}\nController.blessings = [ClassPropertiesBlessing, TargetPropertiesBlessing, ValuePropertiesBlessing];\nController.targets = [];\nController.values = {};\nclass src_default extends Controller {\n add(e) {\n e.preventDefault();\n const content = this.templateTarget.innerHTML.replace(/NEW_RECORD/g, new Date().getTime().toString());\n this.targetTarget.insertAdjacentHTML(\"beforebegin\", content);\n }\n remove(e) {\n e.preventDefault();\n const wrapper = e.target.closest(this.wrapperSelectorValue);\n if (wrapper.dataset.newRecord === \"true\") {\n wrapper.remove();\n } else {\n wrapper.style.display = \"none\";\n const input = wrapper.querySelector(\"input[name*='_destroy']\");\n input.value = \"1\";\n }\n }\n}\nsrc_default.targets = [\"target\", \"template\"];\nsrc_default.values = {\n wrapperSelector: {\n type: String,\n default: \".nested-form-wrapper\"\n }\n};\nexport { src_default as default };\n", "import { Application } from '@hotwired/stimulus'\nimport CourseController from './avo_custom/course_resource_controller'\nimport NestedForm from 'stimulus-rails-nested-form'\n\n// Use you own stimulus install\nconst application = Application.start()\n// Or hook into the stimulus instance provided by Avo\n// const application = window.Stimulus\n\n// Configure Stimulus development experience\napplication.debug = window?.localStorage.getItem('avo.debug')\napplication.register('course-resource', CourseController)\napplication.register('nested-form', NestedForm)\n\n// eslint-disable-next-line no-console\nconsole.log('Hi from Avo custom JS \uD83D\uDC4B')\n"],
|
5
|
-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A,OAAO,EAAG,CACR,EAAE,eAAe,EACjB,GAAM,GAAU,EAAE,OAAO,QAAQ,KAAK,oBAAoB,EAC1D,GAAI,EAAQ,QAAQ,YAAc,OAChC,EAAQ,OAAO,MACV,CACL,EAAQ,MAAM,QAAU,OACxB,GAAM,GAAQ,EAAQ,cAAc,yBAAyB,EAC7D,EAAM,MAAQ,GAChB,CACF,CACF,EACA,EAAY,QAAU,CAAC,SAAU,UAAU,EAC3C,EAAY,OAAS,CACnB,gBAAiB,CACf,KAAM,OACN,QAAS,sBACX,CACF,ECvWA,GAAM,GAAc,EAAY,MAAM,EAKtC,EAAY,MAAQ,2BAAQ,aAAa,QAAQ,aACjD,EAAY,SAAS,kBAAmB,CAAgB,EACxD,EAAY,SAAS,cAAe,CAAU,EAG9C,QAAQ,IAAI,iCAA0B",
|
6
|
-
"names": []
|
7
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
tags.tagify {
|
2
|
-
--tag-inset-shadow-size: 3em;
|
3
|
-
--tags-border-color: rgb(var(--color-primary-500));
|
4
|
-
--tags-hover-border-color: rgb(var(--color-primary-500));
|
5
|
-
--tags-hover-border-color: rgb(var(--color-primary-500));
|
6
|
-
}
|
7
|
-
|
8
|
-
.tagify__dropdown {
|
9
|
-
--tagify-dd-color-primary: rgb(var(--color-primary-500));
|
10
|
-
}
|
11
|
-
|
12
|
-
tags.tagify {
|
13
|
-
@apply !p-0;
|
14
|
-
|
15
|
-
span.tagify__input {
|
16
|
-
@apply my-1;
|
17
|
-
|
18
|
-
&:after {
|
19
|
-
/* The loader is not centered by default. This will make it look better. */
|
20
|
-
margin-top: 0.25rem;
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
tag.tagify__tag {
|
26
|
-
@apply text-sm my-1 mb-0;
|
27
|
-
}
|
28
|
-
|
29
|
-
/* When the tags field is used to select just one value there's a weird ZeroWidthSpace (\u200B) character that breaks the vertical spacing. */
|
30
|
-
[data-tags-field-mode-value="select"] tags.tagify {
|
31
|
-
height: 40px;
|
32
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Concerns
|
3
|
-
module HasHelpers
|
4
|
-
def helpers
|
5
|
-
@helpers ||= Class.new do
|
6
|
-
def initialize
|
7
|
-
helper_names = ActionController::Base.all_helpers_from_path Rails.root.join("app", "helpers")
|
8
|
-
helpers = ActionController::Base.modules_for_helpers helper_names
|
9
|
-
|
10
|
-
helpers.each do |helper|
|
11
|
-
extend helper
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end.new
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# This concern helps us figure out what items are visible for each tab, panel or sidebar
|
2
|
-
module Avo
|
3
|
-
module Concerns
|
4
|
-
module VisibleItems
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
def items
|
7
|
-
items_holder&.items || []
|
8
|
-
end
|
9
|
-
|
10
|
-
def visible_items
|
11
|
-
items
|
12
|
-
.select do |item|
|
13
|
-
if item.respond_to? :hydrate
|
14
|
-
item.hydrate(view: view, resource: resource)
|
15
|
-
end
|
16
|
-
|
17
|
-
visible(item)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def visible(item)
|
22
|
-
return item.visible? if !item.is_field?
|
23
|
-
|
24
|
-
return false if item.respond_to?(:authorized?) && item.resource.present? && !item.authorized?
|
25
|
-
|
26
|
-
item.visible? && item.visible_in_view?(view: view)
|
27
|
-
end
|
28
|
-
|
29
|
-
def visible?
|
30
|
-
any_item_visible = visible_items.any?
|
31
|
-
return any_item_visible if !respond_to?(:visible_on?)
|
32
|
-
|
33
|
-
visible_on?(view) && any_item_visible
|
34
|
-
end
|
35
|
-
|
36
|
-
def hydrate(view: nil)
|
37
|
-
@view = view
|
38
|
-
|
39
|
-
self
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|