From d545bd88d21de01121481c50f31bbce30f9b7218 Mon Sep 17 00:00:00 2001 From: Sub-Xaero Date: Sun, 24 Jan 2021 02:23:09 +0000 Subject: [PATCH] TurboFrameRCController - Beta controller for driving turbo frames using external links/buttons --- dist/index.d.ts | 1 + dist/index.d.ts.map | 2 +- dist/stimulus-library.js | 2 +- dist/stimulus-library.js.map | 2 +- dist/stimulus-library.modern.js | 2 +- dist/stimulus-library.modern.js.map | 2 +- dist/stimulus-library.module.js | 2 +- dist/stimulus-library.module.js.map | 2 +- dist/stimulus-library.umd.js | 2 +- dist/stimulus-library.umd.js.map | 2 +- dist/turbo_frame_rc_controller.d.ts | 19 +++++ dist/turbo_frame_rc_controller.d.ts.map | 1 + dist/utilities/elements.d.ts | 2 + dist/utilities/elements.d.ts.map | 1 + dist/utilities/turbo.d.ts | 2 + dist/utilities/turbo.d.ts.map | 1 + docs/_sidebar.md | 1 + docs/controllers/turbo_frame_rc_controller.md | 70 +++++++++++++++++ package.json | 2 +- src/index.ts | 1 + src/turbo_frame_rc_controller.ts | 76 +++++++++++++++++++ src/utilities/elements.ts | 3 + src/utilities/turbo.ts | 3 + src/utilities/types.d.ts | 4 + 24 files changed, 195 insertions(+), 10 deletions(-) create mode 100644 dist/turbo_frame_rc_controller.d.ts create mode 100644 dist/turbo_frame_rc_controller.d.ts.map create mode 100644 dist/utilities/elements.d.ts create mode 100644 dist/utilities/elements.d.ts.map create mode 100644 dist/utilities/turbo.d.ts create mode 100644 dist/utilities/turbo.d.ts.map create mode 100644 docs/controllers/turbo_frame_rc_controller.md create mode 100644 src/turbo_frame_rc_controller.ts create mode 100644 src/utilities/elements.ts create mode 100644 src/utilities/turbo.ts create mode 100644 src/utilities/types.d.ts diff --git a/dist/index.d.ts b/dist/index.d.ts index 63d9f993..824baad3 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -23,5 +23,6 @@ export { ScrollToTopController } from "./scroll_to_top_controller"; export { SelfDestructController } from "./self_destruct_controller"; export { TeleportController } from "./teleport_controller"; export { ToggleClassController } from "./toggle_class_controller"; +export { TurboFrameRCController } from "./turbo_frame_rc_controller"; export { WordCountController } from "./word_count_controller"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 73305648..15b86135 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,2BAA2B,EAAC,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAC,oCAAoC,EAAC,MAAM,2CAA2C,CAAC;AAC/F,OAAO,EAAC,yBAAyB,EAAC,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,8BAA8B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;AACpE,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAC,oCAAoC,EAAC,MAAM,2CAA2C,CAAC;AAC/F,OAAO,EAAC,yBAAyB,EAAC,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,8BAA8B,EAAE,iCAAiC,EAAC,MAAM,gCAAgC,CAAC;AACjH,OAAO,EAAC,yBAAyB,EAAC,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC"} \ No newline at end of file diff --git a/dist/stimulus-library.js b/dist/stimulus-library.js index 738e010f..f1dbeabd 100644 --- a/dist/stimulus-library.js +++ b/dist/stimulus-library.js @@ -1,2 +1,2 @@ -var e=require("stimulus");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var r=t(require("lodash.camelcase"));function i(){return(i=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},h=(e,t,n)=>{let r=e;return!0===n?r=`${t.identifier}:${e}`:"string"==typeof n&&(r=`${n}:${e}`),r},d=(e,t,n)=>{const{bubbles:r,cancelable:i,composed:o}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:r,cancelable:i,composed:o,detail:n})},p={dispatchEvent:!0,eventPrefix:!0},f={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},v={debug:!1,logger:console};class g{constructor(e,t={}){var n,r,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(r=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==r?r:v.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:v.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class m extends g{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{u(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{u(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class b extends g{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{u(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const y=e=>{const t=t=>{const{innerWidth:n,innerHeight:r}=window,i={height:r||Infinity,width:n||Infinity,event:t};u(e,"windowResize").call(e,i)},n=e.disconnect.bind(e),r=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),n()}}),r(),[r,i]},E=(e,t=200)=>{let n=null;return function(){const r=arguments,i=this,o=()=>e.apply(i,r);n&&clearTimeout(n),n=setTimeout(o,t)}};var w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),y(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(a),C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(a);C.targets=["input","output"],C.values={min:Number,max:Number},C.classes=["error"];var T=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}o(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(a);T.targets=["button","copy","fallback"],T.values={removeUnused:Boolean};var V=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(a);V.values={message:String};var L=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(a);L.targets=["test"];var x=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(a),k=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(a);k.targets=["disabler","disable"],k.values={clear:Boolean};var S=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(a),H=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new b(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e=this;0===(this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0})))},t}(a);H.classes=["empty","notEmpty"],H.values={scopeSelector:String};var I=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(a);I.targets=["enabler","enable"],I.values={clear:Boolean};var M=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(a);M.values={placeholder:String};var O=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:r}=Object.assign({},p,t),i=(null==t?void 0:t.element)||e.element,o=e.disconnect.bind(e),s=new IntersectionObserver(t=>{const[o]=t;o.isIntersecting?(t=>{if(e.isVisible=!0,u(e,"appear").call(e,t),n){const n=h("appear",e,r),o=d(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o):e.isVisible&&(t=>{if(e.isVisible=!1,u(e,"disappear").call(e,t),n){const n=h("disappear",e,r),o=d(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o)},t),a=()=>{s.observe(i)},l=()=>{s.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){l(),o()}}),a(),[a,l]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(l),P=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(a);P.targets=["input","error"],P.values={max:Number,message:String};var j=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundCheckPasswordsMatch=t.checkPasswordsMatch.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e.boundCheckPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e.boundCheckPasswordsMatch)})},n.allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n.checkPasswordsMatch=function(){var e=this;this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.remove(e.errorClass)})):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.add(e.errorClass)}))},t}(a);j.targets=["password"],j.classes=["error"];var A=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.peak=function(e){e&&e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){e&&e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(a);A.targets=["password"];var D=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundMessageReceived=t.messageReceived.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){window.addEventListener("message",this.boundMessageReceived)},n.disconnect=function(){window.removeEventListener("message",this.boundMessageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.element.style.height=e+"px"},t}(a),R=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(y(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=E(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:r,wait:i}=n;if(!r)return;e[r]=E(e[r],i||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(a);R.debounces=["postUpdate"];var z,B=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.cleanupSelf=function(){this.cleanup(this.element)},n.cleanup=function(e){var t,n,i,o=this;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var s=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-class")]})},t}(a),q=function(e,t){var r=void 0===t?{}:t,i=r.behavior,o=void 0===i?"smooth":i,s=r.block,a=void 0===s?"start":s,l=r.inline,c=void 0===l?"nearest":l;try{var u=function(){e.scrollIntoView({behavior:o,block:a,inline:c})},h=function(){if("smooth"==o&&!W)return Promise.resolve(function(){try{return Promise.resolve(Promise.resolve().then(function(){return n(require("smoothscroll-polyfill"))})).then(function(e){z||(z=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(h&&h.then?h.then(u):u())}catch(e){return Promise.reject(e)}},W="scrollBehavior"in document.documentElement.style;function N(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:N(e.parentElement)||document.body}var $=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){q(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(B);$.values={behavior:String,block:String,inline:String};var F=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:N(this.element))&&q(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(a);F.values={mode:String};var U=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?q(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(a);U.values={selector:String,behavior:String,block:String,inline:String};var _=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:N(this.element))&&q(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(a);_.values={mode:String};var Y=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(a);Y.values={seconds:Number};var G=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(B);G.values={target:String,insert:String,immediate:Boolean};var J=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new m(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:r,events:i,eventPrefix:o}=Object.assign({},f,t),s=i=>{const s=(null==t?void 0:t.element)||e.element;if(!(s.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=r&&t.left+t.width>=0}(s)&&n)&&(e.clickOutside&&e.clickOutside(i),r)){const t=h("click:outside",e,o),n=d(t,i,{controller:e});s.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,s,!1)}),a()}}),null==i||i.forEach(e=>{window.addEventListener(e,s,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(a);J.targets=["toggle"],J.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var K=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(a);K.targets=["input","output"],K.values={min:Number,max:Number},K.classes=["error"],exports.AsyncBlockController=l,exports.AutoSubmitFormController=c,exports.AutosizeController=w,exports.CharCountController=C,exports.ClipboardController=T,exports.ConfirmNavigationController=V,exports.DebugController=L,exports.DetectDirtyController=x,exports.DisableInputsController=k,exports.DismissableController=S,exports.EmptyDomController=H,exports.EnableInputsController=I,exports.FallbackImageController=M,exports.LazyBlockController=O,exports.LimitedSelectionCheckboxesController=P,exports.PasswordConfirmController=j,exports.PasswordPeekController=A,exports.ResponsiveIframeBodyController=R,exports.ResponsiveIframeWrapperController=D,exports.ScrollIntoFocusController=$,exports.ScrollToBottomController=F,exports.ScrollToController=U,exports.ScrollToTopController=_,exports.SelfDestructController=Y,exports.TeleportController=G,exports.ToggleClassController=J,exports.WordCountController=K; +var e=require("stimulus");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var r=t(require("lodash.camelcase"));function i(){return(i=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},h=(e,t,n)=>{let r=e;return!0===n?r=`${t.identifier}:${e}`:"string"==typeof n&&(r=`${n}:${e}`),r},d=(e,t,n)=>{const{bubbles:r,cancelable:i,composed:o}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:r,cancelable:i,composed:o,detail:n})},p={dispatchEvent:!0,eventPrefix:!0},f={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},v={debug:!1,logger:console};class g{constructor(e,t={}){var n,r,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(r=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==r?r:v.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:v.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class m extends g{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{u(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{u(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class b extends g{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{u(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const y=e=>{const t=t=>{const{innerWidth:n,innerHeight:r}=window,i={height:r||Infinity,width:n||Infinity,event:t};u(e,"windowResize").call(e,i)},n=e.disconnect.bind(e),r=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),n()}}),r(),[r,i]},E=(e,t=200)=>{let n=null;return function(){const r=arguments,i=this,o=()=>e.apply(i,r);n&&clearTimeout(n),n=setTimeout(o,t)}};var w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),y(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(a),C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(a);C.targets=["input","output"],C.values={min:Number,max:Number},C.classes=["error"];var T=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}o(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(a);T.targets=["button","copy","fallback"],T.values={removeUnused:Boolean};var V=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(a);V.values={message:String};var L=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(a);L.targets=["test"];var x=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(a),S=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(a);S.targets=["disabler","disable"],S.values={clear:Boolean};var k=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(a),H=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new b(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e=this;0===(this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0})))},t}(a);H.classes=["empty","notEmpty"],H.values={scopeSelector:String};var I=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(a);I.targets=["enabler","enable"],I.values={clear:Boolean};var M=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(a);M.values={placeholder:String};var O=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:r}=Object.assign({},p,t),i=(null==t?void 0:t.element)||e.element,o=e.disconnect.bind(e),s=new IntersectionObserver(t=>{const[o]=t;o.isIntersecting?(t=>{if(e.isVisible=!0,u(e,"appear").call(e,t),n){const n=h("appear",e,r),o=d(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o):e.isVisible&&(t=>{if(e.isVisible=!1,u(e,"disappear").call(e,t),n){const n=h("disappear",e,r),o=d(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o)},t),a=()=>{s.observe(i)},l=()=>{s.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){l(),o()}}),a(),[a,l]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(l),P=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(a);P.targets=["input","error"],P.values={max:Number,message:String};var j=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundCheckPasswordsMatch=t.checkPasswordsMatch.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e.boundCheckPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e.boundCheckPasswordsMatch)})},n.allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n.checkPasswordsMatch=function(){var e=this;this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.remove(e.errorClass)})):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.add(e.errorClass)}))},t}(a);j.targets=["password"],j.classes=["error"];var D=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.peak=function(e){e&&e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){e&&e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(a);D.targets=["password"];var A=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundMessageReceived=t.messageReceived.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){window.addEventListener("message",this.boundMessageReceived)},n.disconnect=function(){window.removeEventListener("message",this.boundMessageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.element.style.height=e+"px"},t}(a),R=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(y(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=E(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:r,wait:i}=n;if(!r)return;e[r]=E(e[r],i||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(a);R.debounces=["postUpdate"];var B,z=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.cleanupSelf=function(){this.cleanup(this.element)},n.cleanup=function(e){var t,n,i,o=this;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var s=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-class")]})},t}(a),F=function(e,t){var r=void 0===t?{}:t,i=r.behavior,o=void 0===i?"smooth":i,s=r.block,a=void 0===s?"start":s,l=r.inline,c=void 0===l?"nearest":l;try{var u=function(){e.scrollIntoView({behavior:o,block:a,inline:c})},h=function(){if("smooth"==o&&!N)return Promise.resolve(function(){try{return Promise.resolve(Promise.resolve().then(function(){return n(require("smoothscroll-polyfill"))})).then(function(e){B||(B=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(h&&h.then?h.then(u):u())}catch(e){return Promise.reject(e)}},N="scrollBehavior"in document.documentElement.style;function q(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:q(e.parentElement)||document.body}var W=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){F(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(z);W.values={behavior:String,block:String,inline:String};var $=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:q(this.element))&&F(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(a);$.values={mode:String};var U=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?F(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(a);U.values={selector:String,behavior:String,block:String,inline:String};var _=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:q(this.element))&&F(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(a);_.values={mode:String};var Y=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(a);Y.values={seconds:Number};var G=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(z);G.values={target:String,insert:String,immediate:Boolean};var J=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new m(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:r,events:i,eventPrefix:o}=Object.assign({},f,t),s=i=>{const s=(null==t?void 0:t.element)||e.element;if(!(s.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=r&&t.left+t.width>=0}(s)&&n)&&(e.clickOutside&&e.clickOutside(i),r)){const t=h("click:outside",e,o),n=d(t,i,{controller:e});s.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,s,!1)}),a()}}),null==i||i.forEach(e=>{window.addEventListener(e,s,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(a);J.targets=["toggle"],J.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var K=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.toggle=function(e){e&&e.preventDefault();var t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()},n.setSrc=function(e){e&&e.preventDefault();var t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()},n.clear=function(e){e&&e.preventDefault();var t=this.getFrame();t.src="",t.innerHTML=""},n.getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if("TURBO-FRAME"!=e.nodeName)throw new Error("Element targeted by ID '"+this.frameIdValue+"'");return e},n.getSrc=function(){var e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")},t}(a);K.values={frameId:String,src:String,loadingMessage:String};var Q=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(s(t)),t}o(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(a);Q.targets=["input","output"],Q.values={min:Number,max:Number},Q.classes=["error"],exports.AsyncBlockController=l,exports.AutoSubmitFormController=c,exports.AutosizeController=w,exports.CharCountController=C,exports.ClipboardController=T,exports.ConfirmNavigationController=V,exports.DebugController=L,exports.DetectDirtyController=x,exports.DisableInputsController=S,exports.DismissableController=k,exports.EmptyDomController=H,exports.EnableInputsController=I,exports.FallbackImageController=M,exports.LazyBlockController=O,exports.LimitedSelectionCheckboxesController=P,exports.PasswordConfirmController=j,exports.PasswordPeekController=D,exports.ResponsiveIframeBodyController=R,exports.ResponsiveIframeWrapperController=A,exports.ScrollIntoFocusController=W,exports.ScrollToBottomController=$,exports.ScrollToController=U,exports.ScrollToTopController=_,exports.SelfDestructController=Y,exports.TeleportController=G,exports.ToggleClassController=J,exports.TurboFrameRCController=K,exports.WordCountController=Q; //# sourceMappingURL=stimulus-library.js.map diff --git a/dist/stimulus-library.js.map b/dist/stimulus-library.js.map index 58491276..627edc12 100644 --- a/dist/stimulus-library.js.map +++ b/dist/stimulus-library.js.map @@ -1 +1 @@ -{"version":3,"file":"stimulus-library.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:empty\", {bubbles: true, cancelable: true}));\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:not-empty\", {bubbles: true, cancelable: true}));\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","hasScopeSelectorValue","scopeSelectorValue","children","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","Promise","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"k0BAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWJ,MAAMI,EAAW,CAC1BM,eAAMC,EAAaC,EAAcC,GAI/B,OAHAP,EAAKQ,IAAIX,EAAKM,WAAY,C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OrI,KAAKsI,YAExCtI,KAAKgI,aAAaI,UAAUG,IAAIvI,KAAKsI,gBAK3CH,aAAA,SAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARI1I,KAAK2I,cACPF,EAAMzI,KAAK4I,UAGT5I,KAAK6I,cACPH,EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhCyY,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC5O,IAAKM,OAAQL,IAAKK,QAC5BsO,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"stimulus-library.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:empty\", {bubbles: true, cancelable: true}));\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:not-empty\", {bubbles: true, cancelable: true}));\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\r\n return element.nodeName == \"A\";\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","hasScopeSelectorValue","scopeSelectorValue","children","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","Promise","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"k0BAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAb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ASE,MArDK9J,GAEhC0Z,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC7P,IAAKM,OAAQL,IAAKK,QAC5BuP,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/stimulus-library.modern.js b/dist/stimulus-library.modern.js index fe2f4b58..7f0deaea 100644 --- a/dist/stimulus-library.modern.js +++ b/dist/stimulus-library.modern.js @@ -1,2 +1,2 @@ -import{Controller as e}from"stimulus";import t from"lodash.camelcase";function s(){return(s=Object.assign||function(e){for(var t=1;t{let s=Reflect.get(e,t),n=this;if(function(e){switch(e){case"application":case"element":case"constructor":case"initialize":case"log":case"data":case"valueDescriptorMap":case"identifier":return!1}return!(/^.*?Target(s)?$/.test(e)||/^.*?Value$/.test(e)||/^.*?ValueChanged$/.test(e)||/^.*?Class$/.test(e))}(t.toString())){if("function"==typeof s)return new Proxy(s,{apply:(e,s,i)=>(n.log(t.toString(),{args:i}),Reflect.apply(e,s,i))});this.log(t.toString())}return s}})}log(e,t={}){if(!this.application.debug)return;let n=console;n.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: #3B82F6","color: unset"),n.log(s({element:this.element},t)),n.groupEnd()}}class i extends n{connect(){this.loadContent()}loadContent(){let e=this.hasReplaceTarget?this.replaceTarget:this.element;fetch(this.endpointValue).then(e=>e.text()).then(t=>{let s=document.createElement("div");s.innerHTML=t,e.replaceWith(s);let n=new CustomEvent("ajax:success",{detail:""});e.dispatchEvent(n)}).catch(t=>{e.replaceWith("Sorry, this content failed to load");let s=new CustomEvent("ajax:error",{detail:""});e.dispatchEvent(s)}).finally(()=>{let t=new CustomEvent("ajax:complete",{detail:""});e.dispatchEvent(t)})}}i.targets=["replace"],i.values={endpoint:String};class a extends n{constructor(){super(...arguments),this.boundHandler=this.handler.bind(this)}connect(){this.element.querySelectorAll("input, select, textarea").forEach(e=>e.addEventListener("change",this.boundHandler))}disconnect(){this.element.querySelectorAll("input, select, textarea").forEach(e=>e.removeEventListener("change",this.boundHandler))}handler(e){this.element.dispatchEvent(new CustomEvent("submit",{bubbles:!0,cancelable:!0}))}}const l=(e,t)=>{const s=e[t];return"function"==typeof s?s:(...e)=>{}},o=(e,t,s)=>{let n=e;return!0===s?n=`${t.identifier}:${e}`:"string"==typeof s&&(n=`${s}:${e}`),n},r=(e,t,s)=>{const{bubbles:n,cancelable:i,composed:a}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(s,{originalEvent:t}),new CustomEvent(e,{bubbles:n,cancelable:i,composed:a,detail:s})},c={dispatchEvent:!0,eventPrefix:!0},h={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},u={debug:!1,logger:console};class d{constructor(e,t={}){var s,n,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(n=null!==(s=null==t?void 0:t.debug)&&void 0!==s?s:e.application.stimulusUseDebug)&&void 0!==n?n:u.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:u.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class g extends d{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{l(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{l(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class m extends d{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{l(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const p=e=>{const t=t=>{const{innerWidth:s,innerHeight:n}=window,i={height:n||Infinity,width:s||Infinity,event:t};l(e,"windowResize").call(e,i)},s=e.disconnect.bind(e),n=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),s()}}),n(),[n,i]},b=(e,t=200)=>{let s=null;return function(){const n=arguments,i=this,a=()=>e.apply(i,n);s&&clearTimeout(s),s=setTimeout(a,t)}};class v extends n{constructor(){super(...arguments),this.boundHandler=this.handler.bind(this)}connect(){let e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),p(this),requestAnimationFrame(this.boundHandler)}windowResize(){this.handler()}handler(){this.autosize(this.element)}autosize(e){let t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"}}class f extends n{constructor(){super(...arguments),this.boundHandler=this.updateCharCount.bind(this)}connect(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)}disconnect(){this.inputTarget.removeEventListener("input",this.boundHandler)}updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))}isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}f.targets=["input","output"],f.values={min:Number,max:Number},f.classes=["error"];class E extends n{constructor(){super(...arguments),this.supported=!1}connect(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())}select(e){e&&e.preventDefault(),this.sourceTarget.select()}copy(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")}}E.targets=["button","copy","fallback"],E.values={removeUnused:Boolean};class w extends n{connect(){let e=this.messageValue;window.onbeforeunload=()=>null==e||e,window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",()=>{window.removeEventListener("popstate",this.handlePopstate),window.onbeforeunload=null})}handlePopstate(e){return!1}}w.values={message:String};class y extends n{connect(){console.log("Debug Controller",this,this.testTargets)}}y.targets=["test"];class V extends n{constructor(){super(...arguments),this.initialValue=null,this.boundHandler=this.handler.bind(this)}connect(){let e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)}disconnect(){let e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)}restore(){let e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue}handler(e){let t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")}isCheckable(e){return"radio"===e.type||"checkbox"===e.type}isInputElement(e){return"INPUT"===e.tagName}}class T extends n{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach((t,s)=>{e&&(t.value=""),t.disabled=!0})}enableInputs(){this.disableTargets.forEach((e,t)=>{e.disabled=!1})}}T.targets=["disabler","disable"],T.values={clear:Boolean};class C extends n{dismiss(){this.element.remove()}}class x extends n{connect(){((e,t={})=>{new m(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e;e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children,0===e.length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(e=>this.element.classList.remove(e)),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(e=>this.element.classList.add(e)),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(e=>this.element.classList.add(e)),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(e=>this.element.classList.remove(e)),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0})))}}x.classes=["empty","notEmpty"],x.values={scopeSelector:String};class L extends n{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach((t,s)=>{e&&(t.value=""),t.disabled=!0})}enableInputs(){this.enableTargets.forEach((e,t)=>{e.disabled=!1})}}L.targets=["enabler","enable"],L.values={clear:Boolean};class k extends n{connect(){let e=this.element;e.onerror=()=>{this.hasPlaceholderValue?e.src=this.placeholderValue:e.style.display="none"}}}k.values={placeholder:String};class H extends i{connect(){this.options={element:this.element,threshold:.3},"IntersectionObserver"in window?[this.observe,this.unobserve]=((e,t={})=>{const{dispatchEvent:s,eventPrefix:n}=Object.assign({},c,t),i=(null==t?void 0:t.element)||e.element,a=e.disconnect.bind(e),h=new IntersectionObserver(t=>{const[a]=t;a.isIntersecting?(t=>{if(e.isVisible=!0,l(e,"appear").call(e,t),s){const s=o("appear",e,n),a=r(s,null,{controller:e,entry:t});i.dispatchEvent(a)}})(a):e.isVisible&&(t=>{if(e.isVisible=!1,l(e,"disappear").call(e,t),s){const s=o("disappear",e,n),a=r(s,null,{controller:e,entry:t});i.dispatchEvent(a)}})(a)},t),u=()=>{h.observe(i)},d=()=>{h.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){d(),a()}}),u(),[u,d]})(this,this.options):this.loadContent()}appear(e){let t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())}}class S extends n{constructor(){super(...arguments),this.maxSelections=0,this.boundHandleInputs=this.handleInputs.bind(this)}connect(){this.inputTargets.forEach(e=>e.addEventListener("change",this.boundHandleInputs))}disconnect(){this.inputTargets.forEach(e=>e.removeEventListener("change",this.boundHandleInputs))}handleInputs(e){let t=this.inputTargets.reduce((e,t)=>t.checked?e+1:e,0),s=e.target;t>this.maxSelections?(e.preventDefault(),s.checked=!1,s.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),s.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:s}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(s.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:s}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}S.targets=["input","error"],S.values={max:Number,message:String};class I extends n{constructor(){super(...arguments),this.boundCheckPasswordsMatch=this.checkPasswordsMatch.bind(this)}connect(){this.passwordTargets.forEach(e=>e.addEventListener("change",this.boundCheckPasswordsMatch))}disconnect(){this.passwordTargets.forEach(e=>e.removeEventListener("change",this.boundCheckPasswordsMatch))}allPasswordsMatch(){let e=new Set(this.passwordTargets.map(e=>e.value));return e.has("")||1==e.size}checkPasswordsMatch(){this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(e=>e.classList.remove(this.errorClass))):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(e=>e.classList.add(this.errorClass)))}}I.targets=["password"],I.classes=["error"];class M extends n{peak(e){e&&e.preventDefault(),this.passwordTarget.type="text"}hide(e){e&&e.preventDefault(),this.passwordTarget.type="password"}toggle(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()}}M.targets=["password"];class O extends n{constructor(){super(...arguments),this.boundMessageReceived=this.messageReceived.bind(this)}connect(){window.addEventListener("message",this.boundMessageReceived)}disconnect(){window.removeEventListener("message",this.boundMessageReceived)}messageReceived(e){let t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)}resize(e){this.element.style.height=`${e}px`}}class $ extends n{connect(){var e,t,s;window.self!==window.top&&(p(this),t={},null===(s=(e=this).constructor.debounces)||void 0===s||s.forEach(s=>{if("string"==typeof s&&(e[s]=b(e[s],null==t?void 0:t.wait)),"object"==typeof s){const{name:n,wait:i}=s;if(!n)return;e[n]=b(e[n],i||(null==t?void 0:t.wait))}}),this.postUpdate())}windowResize(e){this.postUpdate()}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}}$.debounces=["postUpdate"];class P extends n{cleanupSelf(){this.cleanup(this.element)}cleanup(e){var s,n,i;e.dataset.controller=(null==(s=e.dataset.controller)?void 0:s.replaceAll(new RegExp(`(s|^)${this.identifier}(s|$)`,"g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;let a=new RegExp(`(s|^)${this.identifier}\\..+?(s|$)`,"g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(a,""))||"",delete e.dataset[t(`${this.identifier}-target`)],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(a,""))||"",delete e.dataset[t(`${this.identifier}-action`)],""==e.dataset.action&&delete e.dataset.action;let l=this.constructor.values;l&&Object.keys(l).forEach(s=>delete e.dataset[t(`${this.identifier}-${s}-value`)]);let o=this.constructor.classes;o&&Object.keys(o).forEach(s=>delete e.dataset[t(`${this.identifier}-${s}-class`)])}}const j="scrollBehavior"in document.documentElement.style;let A;async function z(e,{behavior:t="smooth",block:s="start",inline:n="nearest"}={}){"smooth"!=t||j||await async function(){const{polyfill:e}=await import("smoothscroll-polyfill");A||(A=!0,e())}(),e.scrollIntoView({behavior:t,block:s,inline:n})}function D(e){if(!e)return null;const t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:D(e.parentElement)||document.body}class R extends P{connect(){requestAnimationFrame(()=>{z(this.element,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>this.element.scrollIntoView()),this.cleanupSelf()})}}R.values={behavior:String,block:String,inline:String};class B extends n{scroll(e){let t;e&&e.preventDefault(),t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:D(this.element),null!=t&&z(t,{behavior:"smooth",block:"end"}).catch(()=>t.scrollIntoView(!1))}}B.values={mode:String};class q extends n{scroll(){let e=document.querySelector(this.selectorValue);e?z(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView()):console.warn(`Could not find target for '${this.selectorValue}'`)}}q.values={selector:String,behavior:String,block:String,inline:String};class N extends n{scroll(e){let t;e&&e.preventDefault(),t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:D(this.element),null!=t&&z(t,{behavior:"smooth",block:"start"}).catch(()=>t.scrollIntoView(!1))}}N.values={mode:String};class W extends n{constructor(){super(...arguments),this.timeout=null}connect(){requestAnimationFrame(()=>{this.timeout=setTimeout(()=>this.element.remove(),1e3*this.secondsValue)})}disconnect(){this.timeout&&clearTimeout(this.timeout)}}W.values={seconds:Number};class U extends P{connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()})}execute(e){e&&e.preventDefault();let t=document.querySelector(this.targetValue);if(null==t)return void this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}));let s=this.element.cloneNode(!0);switch(this.cleanup(s),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,s.outerHTML);break;case"replaceOuter":t.outerHTML=s.outerHTML;break;case"replaceInner":t.innerHTML=s.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",s.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",s.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}}U.values={target:String,insert:String,immediate:Boolean};class F extends n{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new g(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:s,dispatchEvent:n,events:i,eventPrefix:a}=Object.assign({},h,t),l=i=>{const l=(null==t?void 0:t.element)||e.element;if(!(l.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth;return t.top<=s&&t.top+t.height>=0&&t.left<=n&&t.left+t.width>=0}(l)&&s)&&(e.clickOutside&&e.clickOutside(i),n)){const t=o("click:outside",e,a),s=r(t,i,{controller:e});l.dispatchEvent(s)}},c=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,l,!1)}),c()}}),null==i||i.forEach(e=>{window.addEventListener(e,l,!1)})})(this),requestAnimationFrame(()=>{this.hasInitialValue&&this.toggleTargets.forEach("on"===this.initialValue?e=>this.elementOn(e):e=>this.elementOff(e))})}clickOutside(){this.toggleTargets.forEach(e=>{this.elementWasToggled(e)&&(this.elementToggleStatus(e),this.elementToggle(e))})}mouseEnter(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}on(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementOn(e)})}off(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementOff(e)})}toggle(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementToggle(e)})}elementWasToggled(e){return"true"==e.dataset.toggled}elementToggleStatus(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}elementToggle(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t))}elementOn(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t,!0))}elementOff(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t,!1))}}F.targets=["toggle"],F.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};class Y extends n{constructor(){super(...arguments),this.boundHandler=this.updateWordCount.bind(this)}connect(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)}disconnect(){this.inputTarget.removeEventListener("input",this.boundHandler)}updateWordCount(){let e=0,t=this.inputTarget.value.match(/\S+/g);e=t&&t.length||0,this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))}isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}Y.targets=["input","output"],Y.values={min:Number,max:Number},Y.classes=["error"];export{i as AsyncBlockController,a as AutoSubmitFormController,v as AutosizeController,f as CharCountController,E as ClipboardController,w as ConfirmNavigationController,y as DebugController,V as DetectDirtyController,T as DisableInputsController,C as DismissableController,x as EmptyDomController,L as EnableInputsController,k as FallbackImageController,H as LazyBlockController,S as LimitedSelectionCheckboxesController,I as PasswordConfirmController,M as PasswordPeekController,$ as ResponsiveIframeBodyController,O as ResponsiveIframeWrapperController,R as ScrollIntoFocusController,B as ScrollToBottomController,q as ScrollToController,N as ScrollToTopController,W as SelfDestructController,U as TeleportController,F as ToggleClassController,Y as WordCountController}; +import{Controller as e}from"stimulus";import t from"lodash.camelcase";function s(){return(s=Object.assign||function(e){for(var t=1;t{let s=Reflect.get(e,t),n=this;if(function(e){switch(e){case"application":case"element":case"constructor":case"initialize":case"log":case"data":case"valueDescriptorMap":case"identifier":return!1}return!(/^.*?Target(s)?$/.test(e)||/^.*?Value$/.test(e)||/^.*?ValueChanged$/.test(e)||/^.*?Class$/.test(e))}(t.toString())){if("function"==typeof s)return new Proxy(s,{apply:(e,s,i)=>(n.log(t.toString(),{args:i}),Reflect.apply(e,s,i))});this.log(t.toString())}return s}})}log(e,t={}){if(!this.application.debug)return;let n=console;n.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: #3B82F6","color: unset"),n.log(s({element:this.element},t)),n.groupEnd()}}class i extends n{connect(){this.loadContent()}loadContent(){let e=this.hasReplaceTarget?this.replaceTarget:this.element;fetch(this.endpointValue).then(e=>e.text()).then(t=>{let s=document.createElement("div");s.innerHTML=t,e.replaceWith(s);let n=new CustomEvent("ajax:success",{detail:""});e.dispatchEvent(n)}).catch(t=>{e.replaceWith("Sorry, this content failed to load");let s=new CustomEvent("ajax:error",{detail:""});e.dispatchEvent(s)}).finally(()=>{let t=new CustomEvent("ajax:complete",{detail:""});e.dispatchEvent(t)})}}i.targets=["replace"],i.values={endpoint:String};class a extends n{constructor(){super(...arguments),this.boundHandler=this.handler.bind(this)}connect(){this.element.querySelectorAll("input, select, textarea").forEach(e=>e.addEventListener("change",this.boundHandler))}disconnect(){this.element.querySelectorAll("input, select, textarea").forEach(e=>e.removeEventListener("change",this.boundHandler))}handler(e){this.element.dispatchEvent(new CustomEvent("submit",{bubbles:!0,cancelable:!0}))}}const l=(e,t)=>{const s=e[t];return"function"==typeof s?s:(...e)=>{}},r=(e,t,s)=>{let n=e;return!0===s?n=`${t.identifier}:${e}`:"string"==typeof s&&(n=`${s}:${e}`),n},o=(e,t,s)=>{const{bubbles:n,cancelable:i,composed:a}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(s,{originalEvent:t}),new CustomEvent(e,{bubbles:n,cancelable:i,composed:a,detail:s})},c={dispatchEvent:!0,eventPrefix:!0},h={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},u={debug:!1,logger:console};class d{constructor(e,t={}){var s,n,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(n=null!==(s=null==t?void 0:t.debug)&&void 0!==s?s:e.application.stimulusUseDebug)&&void 0!==n?n:u.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:u.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class g extends d{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{l(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{l(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class m extends d{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{l(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const p=e=>{const t=t=>{const{innerWidth:s,innerHeight:n}=window,i={height:n||Infinity,width:s||Infinity,event:t};l(e,"windowResize").call(e,i)},s=e.disconnect.bind(e),n=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),s()}}),n(),[n,i]},b=(e,t=200)=>{let s=null;return function(){const n=arguments,i=this,a=()=>e.apply(i,n);s&&clearTimeout(s),s=setTimeout(a,t)}};class v extends n{constructor(){super(...arguments),this.boundHandler=this.handler.bind(this)}connect(){let e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),p(this),requestAnimationFrame(this.boundHandler)}windowResize(){this.handler()}handler(){this.autosize(this.element)}autosize(e){let t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"}}class f extends n{constructor(){super(...arguments),this.boundHandler=this.updateCharCount.bind(this)}connect(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)}disconnect(){this.inputTarget.removeEventListener("input",this.boundHandler)}updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))}isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}f.targets=["input","output"],f.values={min:Number,max:Number},f.classes=["error"];class E extends n{constructor(){super(...arguments),this.supported=!1}connect(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())}select(e){e&&e.preventDefault(),this.sourceTarget.select()}copy(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")}}E.targets=["button","copy","fallback"],E.values={removeUnused:Boolean};class w extends n{connect(){let e=this.messageValue;window.onbeforeunload=()=>null==e||e,window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",()=>{window.removeEventListener("popstate",this.handlePopstate),window.onbeforeunload=null})}handlePopstate(e){return!1}}w.values={message:String};class V extends n{connect(){console.log("Debug Controller",this,this.testTargets)}}V.targets=["test"];class y extends n{constructor(){super(...arguments),this.initialValue=null,this.boundHandler=this.handler.bind(this)}connect(){let e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)}disconnect(){let e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)}restore(){let e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue}handler(e){let t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")}isCheckable(e){return"radio"===e.type||"checkbox"===e.type}isInputElement(e){return"INPUT"===e.tagName}}class T extends n{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach((t,s)=>{e&&(t.value=""),t.disabled=!0})}enableInputs(){this.disableTargets.forEach((e,t)=>{e.disabled=!1})}}T.targets=["disabler","disable"],T.values={clear:Boolean};class C extends n{dismiss(){this.element.remove()}}class L extends n{connect(){((e,t={})=>{new m(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e;e=this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children,0===e.length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(e=>this.element.classList.remove(e)),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(e=>this.element.classList.add(e)),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(e=>this.element.classList.add(e)),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(e=>this.element.classList.remove(e)),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0})))}}L.classes=["empty","notEmpty"],L.values={scopeSelector:String};class x extends n{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()}disableInputs(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach((t,s)=>{e&&(t.value=""),t.disabled=!0})}enableInputs(){this.enableTargets.forEach((e,t)=>{e.disabled=!1})}}x.targets=["enabler","enable"],x.values={clear:Boolean};class S extends n{connect(){let e=this.element;e.onerror=()=>{this.hasPlaceholderValue?e.src=this.placeholderValue:e.style.display="none"}}}S.values={placeholder:String};class k extends i{connect(){this.options={element:this.element,threshold:.3},"IntersectionObserver"in window?[this.observe,this.unobserve]=((e,t={})=>{const{dispatchEvent:s,eventPrefix:n}=Object.assign({},c,t),i=(null==t?void 0:t.element)||e.element,a=e.disconnect.bind(e),h=new IntersectionObserver(t=>{const[a]=t;a.isIntersecting?(t=>{if(e.isVisible=!0,l(e,"appear").call(e,t),s){const s=r("appear",e,n),a=o(s,null,{controller:e,entry:t});i.dispatchEvent(a)}})(a):e.isVisible&&(t=>{if(e.isVisible=!1,l(e,"disappear").call(e,t),s){const s=r("disappear",e,n),a=o(s,null,{controller:e,entry:t});i.dispatchEvent(a)}})(a)},t),u=()=>{h.observe(i)},d=()=>{h.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){d(),a()}}),u(),[u,d]})(this,this.options):this.loadContent()}appear(e){let t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())}}class H extends n{constructor(){super(...arguments),this.maxSelections=0,this.boundHandleInputs=this.handleInputs.bind(this)}connect(){this.inputTargets.forEach(e=>e.addEventListener("change",this.boundHandleInputs))}disconnect(){this.inputTargets.forEach(e=>e.removeEventListener("change",this.boundHandleInputs))}handleInputs(e){let t=this.inputTargets.reduce((e,t)=>t.checked?e+1:e,0),s=e.target;t>this.maxSelections?(e.preventDefault(),s.checked=!1,s.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),s.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:s}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(s.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:s}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}H.targets=["input","error"],H.values={max:Number,message:String};class I extends n{constructor(){super(...arguments),this.boundCheckPasswordsMatch=this.checkPasswordsMatch.bind(this)}connect(){this.passwordTargets.forEach(e=>e.addEventListener("change",this.boundCheckPasswordsMatch))}disconnect(){this.passwordTargets.forEach(e=>e.removeEventListener("change",this.boundCheckPasswordsMatch))}allPasswordsMatch(){let e=new Set(this.passwordTargets.map(e=>e.value));return e.has("")||1==e.size}checkPasswordsMatch(){this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(e=>e.classList.remove(this.errorClass))):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(e=>e.classList.add(this.errorClass)))}}I.targets=["password"],I.classes=["error"];class M extends n{peak(e){e&&e.preventDefault(),this.passwordTarget.type="text"}hide(e){e&&e.preventDefault(),this.passwordTarget.type="password"}toggle(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()}}M.targets=["password"];class O extends n{constructor(){super(...arguments),this.boundMessageReceived=this.messageReceived.bind(this)}connect(){window.addEventListener("message",this.boundMessageReceived)}disconnect(){window.removeEventListener("message",this.boundMessageReceived)}messageReceived(e){let t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)}resize(e){this.element.style.height=`${e}px`}}class $ extends n{connect(){var e,t,s;window.self!==window.top&&(p(this),t={},null===(s=(e=this).constructor.debounces)||void 0===s||s.forEach(s=>{if("string"==typeof s&&(e[s]=b(e[s],null==t?void 0:t.wait)),"object"==typeof s){const{name:n,wait:i}=s;if(!n)return;e[n]=b(e[n],i||(null==t?void 0:t.wait))}}),this.postUpdate())}windowResize(e){this.postUpdate()}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}}$.debounces=["postUpdate"];class A extends n{cleanupSelf(){this.cleanup(this.element)}cleanup(e){var s,n,i;e.dataset.controller=(null==(s=e.dataset.controller)?void 0:s.replaceAll(new RegExp(`(s|^)${this.identifier}(s|$)`,"g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;let a=new RegExp(`(s|^)${this.identifier}\\..+?(s|$)`,"g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(a,""))||"",delete e.dataset[t(`${this.identifier}-target`)],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(a,""))||"",delete e.dataset[t(`${this.identifier}-action`)],""==e.dataset.action&&delete e.dataset.action;let l=this.constructor.values;l&&Object.keys(l).forEach(s=>delete e.dataset[t(`${this.identifier}-${s}-value`)]);let r=this.constructor.classes;r&&Object.keys(r).forEach(s=>delete e.dataset[t(`${this.identifier}-${s}-class`)])}}const P="scrollBehavior"in document.documentElement.style;let j;async function D(e,{behavior:t="smooth",block:s="start",inline:n="nearest"}={}){"smooth"!=t||P||await async function(){const{polyfill:e}=await import("smoothscroll-polyfill");j||(j=!0,e())}(),e.scrollIntoView({behavior:t,block:s,inline:n})}function R(e){if(!e)return null;const t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:R(e.parentElement)||document.body}class z extends A{connect(){requestAnimationFrame(()=>{D(this.element,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>this.element.scrollIntoView()),this.cleanupSelf()})}}z.values={behavior:String,block:String,inline:String};class B extends n{scroll(e){let t;e&&e.preventDefault(),t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:R(this.element),null!=t&&D(t,{behavior:"smooth",block:"end"}).catch(()=>t.scrollIntoView(!1))}}B.values={mode:String};class N extends n{scroll(){let e=document.querySelector(this.selectorValue);e?D(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView()):console.warn(`Could not find target for '${this.selectorValue}'`)}}N.values={selector:String,behavior:String,block:String,inline:String};class F extends n{scroll(e){let t;e&&e.preventDefault(),t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:R(this.element),null!=t&&D(t,{behavior:"smooth",block:"start"}).catch(()=>t.scrollIntoView(!1))}}F.values={mode:String};class q extends n{constructor(){super(...arguments),this.timeout=null}connect(){requestAnimationFrame(()=>{this.timeout=setTimeout(()=>this.element.remove(),1e3*this.secondsValue)})}disconnect(){this.timeout&&clearTimeout(this.timeout)}}q.values={seconds:Number};class W extends A{connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()})}execute(e){e&&e.preventDefault();let t=document.querySelector(this.targetValue);if(null==t)return void this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}));let s=this.element.cloneNode(!0);switch(this.cleanup(s),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,s.outerHTML);break;case"replaceOuter":t.outerHTML=s.outerHTML;break;case"replaceInner":t.innerHTML=s.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",s.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",s.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}}W.values={target:String,insert:String,immediate:Boolean};class U extends n{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new g(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:s,dispatchEvent:n,events:i,eventPrefix:a}=Object.assign({},h,t),l=i=>{const l=(null==t?void 0:t.element)||e.element;if(!(l.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth;return t.top<=s&&t.top+t.height>=0&&t.left<=n&&t.left+t.width>=0}(l)&&s)&&(e.clickOutside&&e.clickOutside(i),n)){const t=r("click:outside",e,a),s=o(t,i,{controller:e});l.dispatchEvent(s)}},c=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,l,!1)}),c()}}),null==i||i.forEach(e=>{window.addEventListener(e,l,!1)})})(this),requestAnimationFrame(()=>{this.hasInitialValue&&this.toggleTargets.forEach("on"===this.initialValue?e=>this.elementOn(e):e=>this.elementOff(e))})}clickOutside(){this.toggleTargets.forEach(e=>{this.elementWasToggled(e)&&(this.elementToggleStatus(e),this.elementToggle(e))})}mouseEnter(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}on(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementOn(e)})}off(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementOff(e)})}toggle(e){this.toggleTargets.forEach(e=>{this.elementToggleStatus(e),this.elementToggle(e)})}elementWasToggled(e){return"true"==e.dataset.toggled}elementToggleStatus(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}elementToggle(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t))}elementOn(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t,!0))}elementOff(e){this.classValue.split(" ").forEach(t=>e.classList.toggle(t,!1))}}U.targets=["toggle"],U.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};class Y extends n{toggle(e){e&&e.preventDefault();let t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()}setSrc(e){e&&e.preventDefault();let t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()}clear(e){e&&e.preventDefault();let t=this.getFrame();t.src="",t.innerHTML=""}getFrame(){let e=document.getElementById(`${this.frameIdValue}`);if(null==e)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if("TURBO-FRAME"!=e.nodeName)throw new Error(`Element targeted by ID '${this.frameIdValue}'`);return e}getSrc(){let e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")}}Y.values={frameId:String,src:String,loadingMessage:String};class G extends n{constructor(){super(...arguments),this.boundHandler=this.updateWordCount.bind(this)}connect(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)}disconnect(){this.inputTarget.removeEventListener("input",this.boundHandler)}updateWordCount(){let e=0,t=this.inputTarget.value.match(/\S+/g);e=t&&t.length||0,this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))}isValidCount(e){let t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}G.targets=["input","output"],G.values={min:Number,max:Number},G.classes=["error"];export{i as AsyncBlockController,a as AutoSubmitFormController,v as AutosizeController,f as CharCountController,E as ClipboardController,w as ConfirmNavigationController,V as DebugController,y as DetectDirtyController,T as DisableInputsController,C as DismissableController,L as EmptyDomController,x as EnableInputsController,S as FallbackImageController,k as LazyBlockController,H as LimitedSelectionCheckboxesController,I as PasswordConfirmController,M as PasswordPeekController,$ as ResponsiveIframeBodyController,O as ResponsiveIframeWrapperController,z as ScrollIntoFocusController,B as ScrollToBottomController,N as ScrollToController,F as ScrollToTopController,q as SelfDestructController,W as TeleportController,U as ToggleClassController,Y as TurboFrameRCController,G as WordCountController}; //# sourceMappingURL=stimulus-library.modern.js.map diff --git a/dist/stimulus-library.modern.js.map b/dist/stimulus-library.modern.js.map index ffc31f8f..6fcd603c 100644 --- a/dist/stimulus-library.modern.js.map +++ b/dist/stimulus-library.modern.js.map @@ -1 +1 @@ -{"version":3,"file":"stimulus-library.modern.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/ephemeral_controller.ts","../src/utilities/scroll.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:empty\", {bubbles: true, cancelable: true}));\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:not-empty\", {bubbles: true, cancelable: true}));\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","Controller","constructor","context","super","Proxy","this","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","catch","err","finally","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","boundHandler","disconnect","removeEventListener","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","smoothSupported","smoothPolyfilled","scrollToElement","behavior","block","inline","async","polyfill","polyfillSmooth","scrollIntoView","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","toggled","classValue","class","clickAway","initial","WordCountController","updateWordCount","wordCount","matches","match"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J,KAAK8I,aAAaI,UAAUG,IAAIrJ,KAAKoJ,aAK3CH,aAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARIxJ,KAAKyJ,cACPF,EAAMvJ,KAAK0J,UAGT1J,KAAK2J,cACPH,EAAMxJ,KAAK4J,UAGNN,GAASC,GAAOD,GAASE,GAnD3BwO,UAAU,CAAC,QAAS,UACpBA,SAAS,CAACzO,IAAKM,OAAQL,IAAKK,QAC5BmO,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"stimulus-library.modern.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/ephemeral_controller.ts","../src/utilities/scroll.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:empty\", {bubbles: true, cancelable: true}));\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:not-empty\", {bubbles: true, cancelable: true}));\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\r\n return element.nodeName == \"A\";\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","Controller","constructor","context","super","Proxy","this","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","catch","err","finally","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","boundHandler","disconnect","removeEventListener","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","children","hasScopeSelectorValue","scopeSelectorValue","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","smoothSupported","smoothPolyfilled","scrollToElement","behavior","block","inline","async","polyfill","polyfillSmooth","scrollIntoView","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"2RAEaA,UAAuBC,EAElCC,YAAYC,GAEV,OADAC,MAAMD,OACKE,MAAMC,KAAM,CACrBC,IAAK,CAACC,EAAKC,KACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,EAAON,KACX,GAmCR,SAAqBG,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWL,MAAMK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,gBAAgB7V,KAAKrD,MAEzC0B,UACE1B,KAAKkZ,kBACLlZ,KAAK0I,YAAYlF,iBAAiB,QAASxD,KAAKyD,cAGlDC,aACE1D,KAAK0I,YAAY/E,oBAAoB,QAAS3D,KAAKyD,cAGrDyV,kBACE,IAAIC,EAAY,EAEZC,EADgBpZ,KAAK0I,YAAYE,MACTyQ,MAAM,QAClCF,EAAaC,GAAWA,EAAQvQ,QAAW,EAC3C7I,KAAK8I,aAAaC,UAAYoQ,EAAU1Y,WACpCT,KAAKgJ,gBACHhJ,KAAKiJ,aAAakQ,GACpBnZ,KAAK8I,aAAaI,UAAUC,OAAOnJ,KAAKoJ,YAExCpJ,KAAK8I,aAAaI,UAAUG,IAAIrJ,KAAKoJ,aAK3CH,aAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARIxJ,KAAKyJ,cACPF,EAAMvJ,KAAK0J,UAGT1J,KAAK2J,cACPH,EAAMxJ,KAAK4J,UAGNN,GAASC,GAAOD,GAASE,GAnD3ByP,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC1P,IAAKM,OAAQL,IAAKK,QAC5BoP,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/stimulus-library.module.js b/dist/stimulus-library.module.js index b3e2da30..4ab104c3 100644 --- a/dist/stimulus-library.module.js +++ b/dist/stimulus-library.module.js @@ -1,2 +1,2 @@ -import{Controller as e}from"stimulus";import t from"lodash.camelcase";function n(){return(n=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},c=(e,t,n)=>{let i=e;return!0===n?i=`${t.identifier}:${e}`:"string"==typeof n&&(i=`${n}:${e}`),i},u=(e,t,n)=>{const{bubbles:i,cancelable:s,composed:r}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:i,cancelable:s,composed:r,detail:n})},h={dispatchEvent:!0,eventPrefix:!0},d={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},p={debug:!1,logger:console};class f{constructor(e,t={}){var n,i,s;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(i=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==i?i:p.debug,this.logger=null!==(s=null==t?void 0:t.logger)&&void 0!==s?s:p.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class v extends f{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{l(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{l(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class g extends f{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{l(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const m=e=>{const t=t=>{const{innerWidth:n,innerHeight:i}=window,s={height:i||Infinity,width:n||Infinity,event:t};l(e,"windowResize").call(e,s)},n=e.disconnect.bind(e),i=()=>{window.addEventListener("resize",t),t()},s=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){s(),n()}}),i(),[i,s]},b=(e,t=200)=>{let n=null;return function(){const i=arguments,s=this,r=()=>e.apply(s,i);n&&clearTimeout(n),n=setTimeout(r,t)}};var y=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(s(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),m(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(r),E=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(s(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(r);E.targets=["input","output"],E.values={min:Number,max:Number},E.classes=["error"];var w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}i(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(r);w.targets=["button","copy","fallback"],w.values={removeUnused:Boolean};var V=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(r);V.values={message:String};var T=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(r);T.targets=["test"];var C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(s(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(r),L=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(r);L.targets=["disabler","disable"],L.values={clear:Boolean};var k=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(r),H=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new g(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e=this;0===(this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0})))},t}(r);H.classes=["empty","notEmpty"],H.values={scopeSelector:String};var S=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(r);S.targets=["enabler","enable"],S.values={clear:Boolean};var x=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(r);x.values={placeholder:String};var I=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:i}=Object.assign({},h,t),s=(null==t?void 0:t.element)||e.element,r=e.disconnect.bind(e),o=new IntersectionObserver(t=>{const[r]=t;r.isIntersecting?(t=>{if(e.isVisible=!0,l(e,"appear").call(e,t),n){const n=c("appear",e,i),r=u(n,null,{controller:e,entry:t});s.dispatchEvent(r)}})(r):e.isVisible&&(t=>{if(e.isVisible=!1,l(e,"disappear").call(e,t),n){const n=c("disappear",e,i),r=u(n,null,{controller:e,entry:t});s.dispatchEvent(r)}})(r)},t),a=()=>{o.observe(s)},d=()=>{o.unobserve(s)};return Object.assign(e,{isVisible:!1,disconnect(){d(),r()}}),a(),[a,d]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(o),M=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(s(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(r);M.targets=["input","error"],M.values={max:Number,message:String};var O=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundCheckPasswordsMatch=t.checkPasswordsMatch.bind(s(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e.boundCheckPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e.boundCheckPasswordsMatch)})},n.allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n.checkPasswordsMatch=function(){var e=this;this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.remove(e.errorClass)})):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.add(e.errorClass)}))},t}(r);O.targets=["password"],O.classes=["error"];var P=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.peak=function(e){e&&e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){e&&e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(r);P.targets=["password"];var j=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundMessageReceived=t.messageReceived.bind(s(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){window.addEventListener("message",this.boundMessageReceived)},n.disconnect=function(){window.removeEventListener("message",this.boundMessageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.element.style.height=e+"px"},t}(r),A=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(m(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=b(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:i,wait:s}=n;if(!i)return;e[i]=b(e[i],s||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(r);A.debounces=["postUpdate"];var R,z=function(e){function n(){return e.apply(this,arguments)||this}i(n,e);var s=n.prototype;return s.cleanupSelf=function(){this.cleanup(this.element)},s.cleanup=function(e){var n,i,s,r=this;e.dataset.controller=(null==(n=e.dataset.controller)?void 0:n.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var o=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(i=e.dataset.target)?void 0:i.replaceAll(o,""))||"",delete e.dataset[t(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(s=e.dataset.target)?void 0:s.replaceAll(o,""))||"",delete e.dataset[t(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(n){return delete e.dataset[t(r.identifier+"-"+n+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(n){return delete e.dataset[t(r.identifier+"-"+n+"-class")]})},n}(r),D=function(e,t){var n=void 0===t?{}:t,i=n.behavior,s=void 0===i?"smooth":i,r=n.block,o=void 0===r?"start":r,a=n.inline,l=void 0===a?"nearest":a;try{var c=function(){e.scrollIntoView({behavior:s,block:o,inline:l})},u=function(){if("smooth"==s&&!B)return Promise.resolve(function(){try{return Promise.resolve(import("smoothscroll-polyfill")).then(function(e){R||(R=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(u&&u.then?u.then(c):c())}catch(e){return Promise.reject(e)}},B="scrollBehavior"in document.documentElement.style;function $(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:$(e.parentElement)||document.body}var q=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){D(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(z);q.values={behavior:String,block:String,inline:String};var N=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:$(this.element))&&D(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(r);N.values={mode:String};var W=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?D(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(r);W.values={selector:String,behavior:String,block:String,inline:String};var U=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:$(this.element))&&D(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(r);U.values={mode:String};var F=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(r);F.values={seconds:Number};var _=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(z);_.values={target:String,insert:String,immediate:Boolean};var Y=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new v(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:i,events:s,eventPrefix:r}=Object.assign({},d,t),o=s=>{const o=(null==t?void 0:t.element)||e.element;if(!(o.contains(s.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=i&&t.left+t.width>=0}(o)&&n)&&(e.clickOutside&&e.clickOutside(s),i)){const t=c("click:outside",e,r),n=u(t,s,{controller:e});o.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==s||s.forEach(e=>{window.removeEventListener(e,o,!1)}),a()}}),null==s||s.forEach(e=>{window.addEventListener(e,o,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(r);Y.targets=["toggle"],Y.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var G=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(s(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(r);G.targets=["input","output"],G.values={min:Number,max:Number},G.classes=["error"];export{o as AsyncBlockController,a as AutoSubmitFormController,y as AutosizeController,E as CharCountController,w as ClipboardController,V as ConfirmNavigationController,T as DebugController,C as DetectDirtyController,L as DisableInputsController,k as DismissableController,H as EmptyDomController,S as EnableInputsController,x as FallbackImageController,I as LazyBlockController,M as LimitedSelectionCheckboxesController,O as PasswordConfirmController,P as PasswordPeekController,A as ResponsiveIframeBodyController,j as ResponsiveIframeWrapperController,q as ScrollIntoFocusController,N as ScrollToBottomController,W as ScrollToController,U as ScrollToTopController,F as SelfDestructController,_ as TeleportController,Y as ToggleClassController,G as WordCountController}; +import{Controller as e}from"stimulus";import t from"lodash.camelcase";function n(){return(n=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},c=(e,t,n)=>{let i=e;return!0===n?i=`${t.identifier}:${e}`:"string"==typeof n&&(i=`${n}:${e}`),i},u=(e,t,n)=>{const{bubbles:i,cancelable:r,composed:s}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:i,cancelable:r,composed:s,detail:n})},h={dispatchEvent:!0,eventPrefix:!0},d={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},p={debug:!1,logger:console};class f{constructor(e,t={}){var n,i,r;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(i=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==i?i:p.debug,this.logger=null!==(r=null==t?void 0:t.logger)&&void 0!==r?r:p.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class v extends f{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{l(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{l(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class g extends f{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{l(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const m=e=>{const t=t=>{const{innerWidth:n,innerHeight:i}=window,r={height:i||Infinity,width:n||Infinity,event:t};l(e,"windowResize").call(e,r)},n=e.disconnect.bind(e),i=()=>{window.addEventListener("resize",t),t()},r=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){r(),n()}}),i(),[i,r]},b=(e,t=200)=>{let n=null;return function(){const i=arguments,r=this,s=()=>e.apply(r,i);n&&clearTimeout(n),n=setTimeout(s,t)}};var E=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),m(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(s),y=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(s);y.targets=["input","output"],y.values={min:Number,max:Number},y.classes=["error"];var w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}i(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(s);w.targets=["button","copy","fallback"],w.values={removeUnused:Boolean};var V=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(s);V.values={message:String};var T=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(s);T.targets=["test"];var C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(s),L=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(s);L.targets=["disabler","disable"],L.values={clear:Boolean};var S=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(s),k=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new g(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e=this;0===(this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0})))},t}(s);k.classes=["empty","notEmpty"],k.values={scopeSelector:String};var H=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(s);H.targets=["enabler","enable"],H.values={clear:Boolean};var I=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(s);I.values={placeholder:String};var M=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:i}=Object.assign({},h,t),r=(null==t?void 0:t.element)||e.element,s=e.disconnect.bind(e),o=new IntersectionObserver(t=>{const[s]=t;s.isIntersecting?(t=>{if(e.isVisible=!0,l(e,"appear").call(e,t),n){const n=c("appear",e,i),s=u(n,null,{controller:e,entry:t});r.dispatchEvent(s)}})(s):e.isVisible&&(t=>{if(e.isVisible=!1,l(e,"disappear").call(e,t),n){const n=c("disappear",e,i),s=u(n,null,{controller:e,entry:t});r.dispatchEvent(s)}})(s)},t),a=()=>{o.observe(r)},d=()=>{o.unobserve(r)};return Object.assign(e,{isVisible:!1,disconnect(){d(),s()}}),a(),[a,d]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(o),x=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(s);x.targets=["input","error"],x.values={max:Number,message:String};var O=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundCheckPasswordsMatch=t.checkPasswordsMatch.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e.boundCheckPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e.boundCheckPasswordsMatch)})},n.allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n.checkPasswordsMatch=function(){var e=this;this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.remove(e.errorClass)})):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.add(e.errorClass)}))},t}(s);O.targets=["password"],O.classes=["error"];var P=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.peak=function(e){e&&e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){e&&e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(s);P.targets=["password"];var j=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundMessageReceived=t.messageReceived.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){window.addEventListener("message",this.boundMessageReceived)},n.disconnect=function(){window.removeEventListener("message",this.boundMessageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.element.style.height=e+"px"},t}(s),A=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(m(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=b(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:i,wait:r}=n;if(!i)return;e[i]=b(e[i],r||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(s);A.debounces=["postUpdate"];var D,R=function(e){function n(){return e.apply(this,arguments)||this}i(n,e);var r=n.prototype;return r.cleanupSelf=function(){this.cleanup(this.element)},r.cleanup=function(e){var n,i,r,s=this;e.dataset.controller=(null==(n=e.dataset.controller)?void 0:n.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var o=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(i=e.dataset.target)?void 0:i.replaceAll(o,""))||"",delete e.dataset[t(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(r=e.dataset.target)?void 0:r.replaceAll(o,""))||"",delete e.dataset[t(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(n){return delete e.dataset[t(s.identifier+"-"+n+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(n){return delete e.dataset[t(s.identifier+"-"+n+"-class")]})},n}(s),z=function(e,t){var n=void 0===t?{}:t,i=n.behavior,r=void 0===i?"smooth":i,s=n.block,o=void 0===s?"start":s,a=n.inline,l=void 0===a?"nearest":a;try{var c=function(){e.scrollIntoView({behavior:r,block:o,inline:l})},u=function(){if("smooth"==r&&!B)return Promise.resolve(function(){try{return Promise.resolve(import("smoothscroll-polyfill")).then(function(e){D||(D=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(u&&u.then?u.then(c):c())}catch(e){return Promise.reject(e)}},B="scrollBehavior"in document.documentElement.style;function N(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:N(e.parentElement)||document.body}var F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){z(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(R);F.values={behavior:String,block:String,inline:String};var $=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:N(this.element))&&z(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(s);$.values={mode:String};var q=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?z(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(s);q.values={selector:String,behavior:String,block:String,inline:String};var W=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:N(this.element))&&z(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(s);W.values={mode:String};var U=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(s);U.values={seconds:Number};var _=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(R);_.values={target:String,insert:String,immediate:Boolean};var Y=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new v(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:i,events:r,eventPrefix:s}=Object.assign({},d,t),o=r=>{const o=(null==t?void 0:t.element)||e.element;if(!(o.contains(r.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=i&&t.left+t.width>=0}(o)&&n)&&(e.clickOutside&&e.clickOutside(r),i)){const t=c("click:outside",e,s),n=u(t,r,{controller:e});o.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==r||r.forEach(e=>{window.removeEventListener(e,o,!1)}),a()}}),null==r||r.forEach(e=>{window.addEventListener(e,o,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(s);Y.targets=["toggle"],Y.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var G=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.toggle=function(e){e&&e.preventDefault();var t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()},n.setSrc=function(e){e&&e.preventDefault();var t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()},n.clear=function(e){e&&e.preventDefault();var t=this.getFrame();t.src="",t.innerHTML=""},n.getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if("TURBO-FRAME"!=e.nodeName)throw new Error("Element targeted by ID '"+this.frameIdValue+"'");return e},n.getSrc=function(){var e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")},t}(s);G.values={frameId:String,src:String,loadingMessage:String};var J=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(r(t)),t}i(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(s);J.targets=["input","output"],J.values={min:Number,max:Number},J.classes=["error"];export{o as AsyncBlockController,a as AutoSubmitFormController,E as AutosizeController,y as CharCountController,w as ClipboardController,V as ConfirmNavigationController,T as DebugController,C as DetectDirtyController,L as DisableInputsController,S as DismissableController,k as EmptyDomController,H as EnableInputsController,I as FallbackImageController,M as LazyBlockController,x as LimitedSelectionCheckboxesController,O as PasswordConfirmController,P as PasswordPeekController,A as ResponsiveIframeBodyController,j as ResponsiveIframeWrapperController,F as ScrollIntoFocusController,$ as ScrollToBottomController,q as ScrollToController,W as ScrollToTopController,U as SelfDestructController,_ as TeleportController,Y as ToggleClassController,G as TurboFrameRCController,J as WordCountController}; //# sourceMappingURL=stimulus-library.module.js.map diff --git a/dist/stimulus-library.module.js.map b/dist/stimulus-library.module.js.map index 11135a87..a37a89c9 100644 --- a/dist/stimulus-library.module.js.map +++ b/dist/stimulus-library.module.js.map @@ -1 +1 @@ -{"version":3,"file":"stimulus-library.module.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:empty\", {bubbles: true, cancelable: true}));\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:not-empty\", {bubbles: true, cancelable: true}));\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","hasScopeSelectorValue","scopeSelectorValue","children","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","import","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classVal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OyB,GAAO,SA5If/N,GAElCmW,UAAU,CAAC,UACXA,SAAS,CACdmC,MAAOjV,OACPwU,WAAYxU,OACZ4U,WAAY5U,OACZkV,UAAWpN,QACXqN,QAASnV,QCXAoV,IAAAA,cAAb,wEAeiBvY,EAAKwY,gBAAgBlV,oBAftC,2BAiBEzB,QAAA,WACEX,KAAKsX,kBACLtX,KAAK4H,YAAYrF,iBAAiB,QAASvC,KAAKyC,iBAGlDC,WAAA,WACE1C,KAAK4H,YAAYjF,oBAAoB,QAAS3C,KAAKyC,iBAGrD6U,gBAAA,WACE,IAAIC,EAAY,EAEZC,EADgBxX,KAAK4H,YAAYE,MACT2P,MAAM,QAElCzX,KAAKgI,aAAaC,WADlBsP,EAAaC,GAAWA,EAAQzP,QAAW,GACHvI,WACpCQ,KAAKkI,gBACHlI,KAAKmI,aAAaoP,GACpBvX,KAAKgI,aAAaI,UAAUC,OAAOrI,KAAKsI,YAExCtI,KAAKgI,aAAaI,UAAUG,IAAIvI,KAAKsI,gBAK3CH,aAAA,SAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARI1I,KAAK2I,cACPF,EAAMzI,KAAK4I,UAGT5I,KAAK6I,cACPH,EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhCyY,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC5O,IAAKM,OAAQL,IAAKK,QAC5BsO,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"stimulus-library.module.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:empty\", {bubbles: true, cancelable: true}));\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:not-empty\", {bubbles: true, cancelable: true}));\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\r\n return element.nodeName == \"A\";\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","hasScopeSelectorValue","scopeSelectorValue","children","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","import","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"mfAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWJ,MAAMI,EAAW,CAC1BM,eAAMC,EAAaC,EAAcC,GAI/B,OAHAP,EAAKQ,IAAIX,EAAKM,WAAY,CACxBM,KAAMF,IAEDR,QAAQK,MAAMC,EAAQC,EAASC,MAI1Cd,EAAKe,IAAIX,EAAKM,YAGlB,OAAOL,qCAKbU,IAAA,SAAIE,EAAsBD,GAExB,YAFwBA,IAAAA,EAAW,IAE9BE,KAAKC,YAAYC,MAAtB,CAGA,IAAIC,EAASC,QACbD,EAAOE,oBAAoBL,KAAKM,kBAAiBP,EAAgB,iBAAkB,gBACnFI,EAAON,OACLU,QAASP,KAAKO,SACXT,IAELK,EAAOK,gBAtCyBC,GCAvBC,kGAYXC,QAAA,WACEX,KAAKY,iBAGPA,YAAA,WACE,IAAIC,EAAMb,KAAKc,iBAAmBd,KAAKe,cAAgBf,KAAKO,QAC5DS,MAAMhB,KAAKiB,eACVC,KAAK,SAACC,UAAaA,EAASC,SAC5BF,KAAK,SAACG,GACL,IAAIC,EAAQC,SAASC,cAAc,OACnCF,EAAMG,UAAYJ,EAClBR,E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AK4H,YAAYrF,iBAAiB,QAASvC,KAAKyC,iBAGlDC,WAAA,WACE1C,KAAK4H,YAAYjF,oBAAoB,QAAS3C,KAAKyC,iBAGrD8V,gBAAA,WACE,IAAIC,EAAY,EAEZC,EADgBzY,KAAK4H,YAAYE,MACT4Q,MAAM,QAElC1Y,KAAKgI,aAAaC,WADlBuQ,EAAaC,GAAWA,EAAQ1Q,QAAW,GACHvI,WACpCQ,KAAKkI,gBACHlI,KAAKmI,aAAaqQ,GACpBxY,KAAKgI,aAAaI,UAAUC,OAAOrI,KAAKsI,YAExCtI,KAAKgI,aAAaI,UAAUG,IAAIvI,KAAKsI,gBAK3CH,aAAA,SAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARI1I,KAAK2I,cACPF,EAAMzI,KAAK4I,UAGT5I,KAAK6I,cACPH,EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhC0Z,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC7P,IAAKM,OAAQL,IAAKK,QAC5BuP,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/stimulus-library.umd.js b/dist/stimulus-library.umd.js index 82bc19a6..8774ee8b 100644 --- a/dist/stimulus-library.umd.js +++ b/dist/stimulus-library.umd.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("stimulus"),require("lodash.camelcase")):"function"==typeof define&&define.amd?define(["exports","stimulus","lodash.camelcase"],t):t((e||self).stimulusLibrary={},e.stimulus,e.camelCase)}(this,function(e,t,n){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(n);function o(){return(o=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},d=(e,t,n)=>{let i=e;return!0===n?i=`${t.identifier}:${e}`:"string"==typeof n&&(i=`${n}:${e}`),i},p=(e,t,n)=>{const{bubbles:i,cancelable:r,composed:o}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:i,cancelable:r,composed:o,detail:n})},f={dispatchEvent:!0,eventPrefix:!0},v={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},m={debug:!1,logger:console};class g{constructor(e,t={}){var n,i,r;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(i=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==i?i:m.debug,this.logger=null!==(r=null==t?void 0:t.logger)&&void 0!==r?r:m.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class b extends g{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{h(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{h(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class y extends g{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{h(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const E=e=>{const t=t=>{const{innerWidth:n,innerHeight:i}=window,r={height:i||Infinity,width:n||Infinity,event:t};h(e,"windowResize").call(e,r)},n=e.disconnect.bind(e),i=()=>{window.addEventListener("resize",t),t()},r=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){r(),n()}}),i(),[i,r]},w=(e,t=200)=>{let n=null;return function(){const i=arguments,r=this,o=()=>e.apply(r,i);n&&clearTimeout(n),n=setTimeout(o,t)}};var C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),E(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(l),T=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(l);T.targets=["input","output"],T.values={min:Number,max:Number},T.classes=["error"];var V=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}s(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(l);V.targets=["button","copy","fallback"],V.values={removeUnused:Boolean};var L=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(l);L.values={message:String};var k=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(l);k.targets=["test"];var S=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(l),H=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(l);H.targets=["disabler","disable"],H.values={clear:Boolean};var I=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(l),x=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new y(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e=this;0===(this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0})))},t}(l);x.classes=["empty","notEmpty"],x.values={scopeSelector:String};var M=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(l);M.targets=["enabler","enable"],M.values={clear:Boolean};var O=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(l);O.values={placeholder:String};var P=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:i}=Object.assign({},f,t),r=(null==t?void 0:t.element)||e.element,o=e.disconnect.bind(e),s=new IntersectionObserver(t=>{const[o]=t;o.isIntersecting?(t=>{if(e.isVisible=!0,h(e,"appear").call(e,t),n){const n=d("appear",e,i),o=p(n,null,{controller:e,entry:t});r.dispatchEvent(o)}})(o):e.isVisible&&(t=>{if(e.isVisible=!1,h(e,"disappear").call(e,t),n){const n=d("disappear",e,i),o=p(n,null,{controller:e,entry:t});r.dispatchEvent(o)}})(o)},t),a=()=>{s.observe(r)},l=()=>{s.unobserve(r)};return Object.assign(e,{isVisible:!1,disconnect(){l(),o()}}),a(),[a,l]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(c),j=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(l);j.targets=["input","error"],j.values={max:Number,message:String};var A=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundCheckPasswordsMatch=t.checkPasswordsMatch.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e.boundCheckPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e.boundCheckPasswordsMatch)})},n.allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n.checkPasswordsMatch=function(){var e=this;this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.remove(e.errorClass)})):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.add(e.errorClass)}))},t}(l);A.targets=["password"],A.classes=["error"];var D=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.peak=function(e){e&&e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){e&&e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(l);D.targets=["password"];var R=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundMessageReceived=t.messageReceived.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){window.addEventListener("message",this.boundMessageReceived)},n.disconnect=function(){window.removeEventListener("message",this.boundMessageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.element.style.height=e+"px"},t}(l),z=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(E(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=w(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:i,wait:r}=n;if(!i)return;e[i]=w(e[i],r||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(l);z.debounces=["postUpdate"];var B,q=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.cleanupSelf=function(){this.cleanup(this.element)},n.cleanup=function(e){var t,n,i,o=this;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var s=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(s,""))||"",delete e.dataset[r.default(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(t){return delete e.dataset[r.default(o.identifier+"-"+t+"-class")]})},t}(l),W=function(e,t){var n=void 0===t?{}:t,i=n.behavior,r=void 0===i?"smooth":i,o=n.block,s=void 0===o?"start":o,a=n.inline,l=void 0===a?"nearest":a;try{var c=function(){e.scrollIntoView({behavior:r,block:s,inline:l})},u=function(){if("smooth"==r&&!N)return Promise.resolve(function(){try{return Promise.resolve(import("smoothscroll-polyfill")).then(function(e){B||(B=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(u&&u.then?u.then(c):c())}catch(e){return Promise.reject(e)}},N="scrollBehavior"in document.documentElement.style;function $(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:$(e.parentElement)||document.body}var F=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){W(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(q);F.values={behavior:String,block:String,inline:String};var U=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:$(this.element))&&W(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(l);U.values={mode:String};var _=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?W(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(l);_.values={selector:String,behavior:String,block:String,inline:String};var Y=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:$(this.element))&&W(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(l);Y.values={mode:String};var G=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(l);G.values={seconds:Number};var J=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(q);J.values={target:String,insert:String,immediate:Boolean};var K=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new b(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:i,events:r,eventPrefix:o}=Object.assign({},v,t),s=r=>{const s=(null==t?void 0:t.element)||e.element;if(!(s.contains(r.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=i&&t.left+t.width>=0}(s)&&n)&&(e.clickOutside&&e.clickOutside(r),i)){const t=d("click:outside",e,o),n=p(t,r,{controller:e});s.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==r||r.forEach(e=>{window.removeEventListener(e,s,!1)}),a()}}),null==r||r.forEach(e=>{window.addEventListener(e,s,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(l);K.targets=["toggle"],K.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var Q=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(l);Q.targets=["input","output"],Q.values={min:Number,max:Number},Q.classes=["error"],e.AsyncBlockController=c,e.AutoSubmitFormController=u,e.AutosizeController=C,e.CharCountController=T,e.ClipboardController=V,e.ConfirmNavigationController=L,e.DebugController=k,e.DetectDirtyController=S,e.DisableInputsController=H,e.DismissableController=I,e.EmptyDomController=x,e.EnableInputsController=M,e.FallbackImageController=O,e.LazyBlockController=P,e.LimitedSelectionCheckboxesController=j,e.PasswordConfirmController=A,e.PasswordPeekController=D,e.ResponsiveIframeBodyController=z,e.ResponsiveIframeWrapperController=R,e.ScrollIntoFocusController=F,e.ScrollToBottomController=U,e.ScrollToController=_,e.ScrollToTopController=Y,e.SelfDestructController=G,e.TeleportController=J,e.ToggleClassController=K,e.WordCountController=Q}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("stimulus"),require("lodash.camelcase")):"function"==typeof define&&define.amd?define(["exports","stimulus","lodash.camelcase"],t):t((e||self).stimulusLibrary={},e.stimulus,e.camelCase)}(this,function(e,t,n){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(n);function o(){return(o=Object.assign||function(e){for(var t=1;t{const n=e[t];return"function"==typeof n?n:(...e)=>{}},d=(e,t,n)=>{let r=e;return!0===n?r=`${t.identifier}:${e}`:"string"==typeof n&&(r=`${n}:${e}`),r},p=(e,t,n)=>{const{bubbles:r,cancelable:i,composed:o}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(n,{originalEvent:t}),new CustomEvent(e,{bubbles:r,cancelable:i,composed:o,detail:n})},f={dispatchEvent:!0,eventPrefix:!0},v={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},g={debug:!1,logger:console};class m{constructor(e,t={}){var n,r,i;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.debug=null!==(r=null!==(n=null==t?void 0:t.debug)&&void 0!==n?n:e.application.stimulusUseDebug)&&void 0!==r?r:g.debug,this.logger=null!==(i=null==t?void 0:t.logger)&&void 0!==i?i:g.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class b extends m{constructor(e,t={}){super(e,t),this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=()=>{h(this.controller,"mouseEnter").call(this.controller),this.log("mouseEnter",{hover:!0})},this.onLeave=()=>{h(this.controller,"mouseLeave").call(this.controller),this.log("mouseLeave",{hover:!1})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class y extends m{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{h(this.controller,"mutate").call(this.controller,e),this.log("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const E=e=>{const t=t=>{const{innerWidth:n,innerHeight:r}=window,i={height:r||Infinity,width:n||Infinity,event:t};h(e,"windowResize").call(e,i)},n=e.disconnect.bind(e),r=()=>{window.addEventListener("resize",t),t()},i=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){i(),n()}}),r(),[r,i]},w=(e,t=200)=>{let n=null;return function(){const r=arguments,i=this,o=()=>e.apply(i,r);n&&clearTimeout(n),n=setTimeout(o,t)}};var C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.handler.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;e.style.resize="none",e.style.boxSizing="border-box",e.addEventListener("input",this.boundHandler),e.addEventListener("focus",this.boundHandler),E(this),requestAnimationFrame(this.boundHandler)},n.windowResize=function(){this.handler()},n.handler=function(){this.autosize(this.element)},n.autosize=function(e){var t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"},t}(l),T=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateCharCount.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){this.updateCharCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateCharCount=function(){var e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(l);T.targets=["input","output"],T.values={min:Number,max:Number},T.classes=["error"];var V=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).supported=!1,t}s(t,e);var n=t.prototype;return n.connect=function(){this.supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this.supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())},n.select=function(e){e&&e.preventDefault(),this.sourceTarget.select()},n.copy=function(e){e&&e.preventDefault(),this.sourceTarget.select(),this.supported&&document.execCommand("copy")},t}(l);V.targets=["button","copy","fallback"],V.values={removeUnused:Boolean};var L=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this,t=this.messageValue;window.onbeforeunload=function(){return null==t||t},window.addEventListener("popstate",this.handlePopstate),window.addEventListener("submit",function(){window.removeEventListener("popstate",e.handlePopstate),window.onbeforeunload=null})},n.handlePopstate=function(e){return!1},t}(l);L.values={message:String};var S=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){console.log("Debug Controller",this,this.testTargets)},t}(l);S.targets=["test"];var k=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).initialValue=null,t.boundHandler=t.handler.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this.element;this.initialValue=this.isInputElement(e)&&this.isCheckable(e)?e.checked:e.value,e.addEventListener("input",this.boundHandler),e.addEventListener("change",this.boundHandler)},n.disconnect=function(){var e=this.element;e.removeEventListener("input",this.boundHandler),e.removeEventListener("change",this.boundHandler)},n.restore=function(){var e=this.element;this.isInputElement(e)&&this.isCheckable(e)?e.checked=this.initialValue:e.value=this.initialValue},n.handler=function(e){var t=this.element;this.initialValue!==t.value?t.setAttribute("data-dirty","true"):t.removeAttribute("data-dirty")},n.isCheckable=function(e){return"radio"===e.type||"checkbox"===e.type},n.isInputElement=function(e){return"INPUT"===e.tagName},t}(l),H=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disableInputs():this.enableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.disableTargets.forEach(function(e,t){e.disabled=!1})},t}(l);H.targets=["disabler","disable"],H.values={clear:Boolean};var I=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.dismiss=function(){this.element.remove()},t}(l),M=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){((e,t={})=>{new y(this,t)})(0,{element:this.element,childList:!0}),this.checkEmpty()},n.mutate=function(e){this.checkEmpty()},n.checkEmpty=function(){var e=this;0===(this.hasScopeSelectorValue?this.element.querySelectorAll(this.scopeSelectorValue):this.element.children).length?(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.element.dispatchEvent(new CustomEvent("dom:empty",{bubbles:!0,cancelable:!0}))):(this.hasNotEmptyClass&&this.notEmptyClass.split(" ").forEach(function(t){return e.element.classList.add(t)}),this.hasEmptyClass&&this.emptyClass.split(" ").forEach(function(t){return e.element.classList.remove(t)}),this.element.dispatchEvent(new CustomEvent("dom:not-empty",{bubbles:!0,cancelable:!0})))},t}(l);M.classes=["empty","notEmpty"],M.values={scopeSelector:String};var x=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){this.toggle()},n.toggle=function(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enableInputs():this.disableInputs()},n.disableInputs=function(){var e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(function(t,n){e&&(t.value=""),t.disabled=!0})},n.enableInputs=function(){this.enableTargets.forEach(function(e,t){e.disabled=!1})},t}(l);x.targets=["enabler","enable"],x.values={clear:Boolean};var O=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){var e=this,t=this.element;t.onerror=function(){e.hasPlaceholderValue?t.src=e.placeholderValue:t.style.display="none"}},t}(l);O.values={placeholder:String};var P=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){if(this.options={element:this.element,threshold:.3},"IntersectionObserver"in window){var e=((e,t={})=>{const{dispatchEvent:n,eventPrefix:r}=Object.assign({},f,t),i=(null==t?void 0:t.element)||e.element,o=e.disconnect.bind(e),s=new IntersectionObserver(t=>{const[o]=t;o.isIntersecting?(t=>{if(e.isVisible=!0,h(e,"appear").call(e,t),n){const n=d("appear",e,r),o=p(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o):e.isVisible&&(t=>{if(e.isVisible=!1,h(e,"disappear").call(e,t),n){const n=d("disappear",e,r),o=p(n,null,{controller:e,entry:t});i.dispatchEvent(o)}})(o)},t),a=()=>{s.observe(i)},l=()=>{s.unobserve(i)};return Object.assign(e,{isVisible:!1,disconnect(){l(),o()}}),a(),[a,l]})(this,this.options);this.observe=e[0],this.unobserve=e[1]}else this.loadContent()},n.appear=function(e){var t=this.element;""===t.src&&e.target===t&&e.isIntersecting&&(this.loadContent(),this.unobserve&&this.unobserve())},t}(c),D=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).maxSelections=0,t.boundHandleInputs=t.handleInputs.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.inputTargets.forEach(function(t){return t.addEventListener("change",e.boundHandleInputs)})},n.disconnect=function(){var e=this;this.inputTargets.forEach(function(t){return t.removeEventListener("change",e.boundHandleInputs)})},n.handleInputs=function(e){var t=this.inputTargets.reduce(function(e,t){return t.checked?e+1:e},0),n=e.target;t>this.maxSelections?(e.preventDefault(),n.checked=!1,n.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new CustomEvent("limited-selection:too-many",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(n.dispatchEvent(new CustomEvent("limited-selection:selection",{bubbles:!0,cancelable:!0,detail:{target:n}})),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))},t}(l);D.targets=["input","error"],D.values={max:Number,message:String};var j=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundCheckPasswordsMatch=t.checkPasswordsMatch.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.addEventListener("change",e.boundCheckPasswordsMatch)})},n.disconnect=function(){var e=this;this.passwordTargets.forEach(function(t){return t.removeEventListener("change",e.boundCheckPasswordsMatch)})},n.allPasswordsMatch=function(){var e=new Set(this.passwordTargets.map(function(e){return e.value}));return e.has("")||1==e.size},n.checkPasswordsMatch=function(){var e=this;this.allPasswordsMatch()?(this.element.dispatchEvent(new CustomEvent("password-confirm:match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.remove(e.errorClass)})):(this.element.dispatchEvent(new CustomEvent("password-confirm:no-match")),this.hasErrorClass&&this.passwordTargets.forEach(function(t){return t.classList.add(e.errorClass)}))},t}(l);j.targets=["password"],j.classes=["error"];var A=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.peak=function(e){e&&e.preventDefault(),this.passwordTarget.type="text"},n.hide=function(e){e&&e.preventDefault(),this.passwordTarget.type="password"},n.toggle=function(e){e&&e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()},t}(l);A.targets=["password"];var R=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundMessageReceived=t.messageReceived.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){window.addEventListener("message",this.boundMessageReceived)},n.disconnect=function(){window.removeEventListener("message",this.boundMessageReceived)},n.messageReceived=function(e){var t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)},n.resize=function(e){this.element.style.height=e+"px"},t}(l),B=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e,t,n;window.self!==window.top&&(E(this),t={},null===(n=(e=this).constructor.debounces)||void 0===n||n.forEach(n=>{if("string"==typeof n&&(e[n]=w(e[n],null==t?void 0:t.wait)),"object"==typeof n){const{name:r,wait:i}=n;if(!r)return;e[r]=w(e[r],i||(null==t?void 0:t.wait))}}),this.postUpdate())},n.windowResize=function(e){this.postUpdate()},n.postUpdate=function(){var e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")},n.getHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},t}(l);B.debounces=["postUpdate"];var z,F=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.cleanupSelf=function(){this.cleanup(this.element)},n.cleanup=function(e){var t,n,r,o=this;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp("(s|^)"+this.identifier+"(s|$)","g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;var s=new RegExp("(s|^)"+this.identifier+"\\..+?(s|$)","g");e.dataset.target=(null==(n=e.dataset.target)?void 0:n.replaceAll(s,""))||"",delete e.dataset[i.default(this.identifier+"-target")],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(r=e.dataset.target)?void 0:r.replaceAll(s,""))||"",delete e.dataset[i.default(this.identifier+"-action")],""==e.dataset.action&&delete e.dataset.action;var a=this.constructor.values;a&&Object.keys(a).forEach(function(t){return delete e.dataset[i.default(o.identifier+"-"+t+"-value")]});var l=this.constructor.classes;l&&Object.keys(l).forEach(function(t){return delete e.dataset[i.default(o.identifier+"-"+t+"-class")]})},t}(l),N=function(e,t){var n=void 0===t?{}:t,r=n.behavior,i=void 0===r?"smooth":r,o=n.block,s=void 0===o?"start":o,a=n.inline,l=void 0===a?"nearest":a;try{var c=function(){e.scrollIntoView({behavior:i,block:s,inline:l})},u=function(){if("smooth"==i&&!q)return Promise.resolve(function(){try{return Promise.resolve(import("smoothscroll-polyfill")).then(function(e){z||(z=!0,(0,e.polyfill)())})}catch(e){return Promise.reject(e)}}()).then(function(){})}();return Promise.resolve(u&&u.then?u.then(c):c())}catch(e){return Promise.reject(e)}},q="scrollBehavior"in document.documentElement.style;function W(e){if(!e)return null;var t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:W(e.parentElement)||document.body}var $=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.connect=function(){var e=this;requestAnimationFrame(function(){N(e.element,{behavior:e.hasBehaviorValue?e.behaviorValue:"smooth",block:e.hasBlockValue?e.blockValue:"center",inline:e.hasInlineValue?e.inlineValue:"center"}).catch(function(){return e.element.scrollIntoView()}),e.cleanupSelf()})},t}(F);$.values={behavior:String,block:String,inline:String};var U=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:W(this.element))&&N(t,{behavior:"smooth",block:"end"}).catch(function(){return t.scrollIntoView(!1)})},t}(l);U.values={mode:String};var _=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(){var e=document.querySelector(this.selectorValue);e?N(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(function(){return e.scrollIntoView()}):console.warn("Could not find target for '"+this.selectorValue+"'")},t}(l);_.values={selector:String,behavior:String,block:String,inline:String};var Y=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.scroll=function(e){var t;e&&e.preventDefault(),null!=(t="document"==(this.hasModeValue?this.modeValue:"document")?document.body:W(this.element))&&N(t,{behavior:"smooth",block:"start"}).catch(function(){return t.scrollIntoView(!1)})},t}(l);Y.values={mode:String};var G=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).timeout=null,t}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;requestAnimationFrame(function(){e.timeout=setTimeout(function(){return e.element.remove()},1e3*e.secondsValue)})},n.disconnect=function(){this.timeout&&clearTimeout(this.timeout)},t}(l);G.values={seconds:Number};var J=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(function(){e.hasImmediateValue&&e.immediateValue&&e.execute()})},n.execute=function(e){e&&e.preventDefault();var t=document.querySelector(this.targetValue);if(null!=t){var n=this.element.cloneNode(!0);switch(this.cleanup(n),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":t.insertAdjacentHTML(this.insertValue,n.outerHTML);break;case"replaceOuter":t.outerHTML=n.outerHTML;break;case"replaceInner":t.innerHTML=n.outerHTML;break;case"prepend":t.insertAdjacentHTML("afterbegin",n.outerHTML);break;case"append":t.insertAdjacentHTML("beforeend",n.outerHTML);break;default:throw new Error("`insert` value was not specified")}this.element.remove()}else this.element.dispatchEvent(new CustomEvent("teleport:error",{bubbles:!0,cancelable:!0}))},t}(F);J.values={target:String,insert:String,immediate:Boolean};var K=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.connect=function(){var e=this;if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{new b(this,t)})(),this.hasClickAwayValue&&this.clickAwayValue&&((e,t={})=>{const{onlyVisible:n,dispatchEvent:r,events:i,eventPrefix:o}=Object.assign({},v,t),s=i=>{const s=(null==t?void 0:t.element)||e.element;if(!(s.contains(i.target)||!function(e){const t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth;return t.top<=n&&t.top+t.height>=0&&t.left<=r&&t.left+t.width>=0}(s)&&n)&&(e.clickOutside&&e.clickOutside(i),r)){const t=d("click:outside",e,o),n=p(t,i,{controller:e});s.dispatchEvent(n)}},a=e.disconnect.bind(e);Object.assign(e,{disconnect(){null==i||i.forEach(e=>{window.removeEventListener(e,s,!1)}),a()}}),null==i||i.forEach(e=>{window.addEventListener(e,s,!1)})})(this),requestAnimationFrame(function(){e.hasInitialValue&&e.toggleTargets.forEach("on"===e.initialValue?function(t){return e.elementOn(t)}:function(t){return e.elementOff(t)})})},n.clickOutside=function(){var e=this;this.toggleTargets.forEach(function(t){e.elementWasToggled(t)&&(e.elementToggleStatus(t),e.elementToggle(t))})},n.mouseEnter=function(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.mouseLeave=function(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}},n.on=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOn(e)})},n.off=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementOff(e)})},n.toggle=function(e){var t=this;this.toggleTargets.forEach(function(e){t.elementToggleStatus(e),t.elementToggle(e)})},n.elementWasToggled=function(e){return"true"==e.dataset.toggled},n.elementToggleStatus=function(e){this.elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"},n.elementToggle=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t)})},n.elementOn=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!0)})},n.elementOff=function(e){this.classValue.split(" ").forEach(function(t){return e.classList.toggle(t,!1)})},t}(l);K.targets=["toggle"],K.values={class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String};var Q=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.toggle=function(e){e&&e.preventDefault();var t=this.getFrame().src;null==t||t!==this.getSrc()?this.setSrc():this.clear()},n.setSrc=function(e){e&&e.preventDefault();var t=this.getFrame();this.hasLoadingMessageValue&&(t.innerHTML=this.loadingMessageValue),t.src=this.getSrc()},n.clear=function(e){e&&e.preventDefault();var t=this.getFrame();t.src="",t.innerHTML=""},n.getFrame=function(){var e=document.getElementById(""+this.frameIdValue);if(null==e)throw new Error("Could not find frame with ID '"+this.frameIdValue+"'");if("TURBO-FRAME"!=e.nodeName)throw new Error("Element targeted by ID '"+this.frameIdValue+"'");return e},n.getSrc=function(){var e=this.element;if(this.hasSrcValue)return this.srcValue;if(function(e){return"A"==e.nodeName}(e))return e.href;throw new Error("No link given to drive frame to")},t}(l);Q.values={frameId:String,src:String,loadingMessage:String};var X=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).boundHandler=t.updateWordCount.bind(a(t)),t}s(t,e);var n=t.prototype;return n.connect=function(){this.updateWordCount(),this.inputTarget.addEventListener("input",this.boundHandler)},n.disconnect=function(){this.inputTarget.removeEventListener("input",this.boundHandler)},n.updateWordCount=function(){var e=0,t=this.inputTarget.value.match(/\S+/g);this.outputTarget.innerText=(e=t&&t.length||0).toString(),this.hasErrorClass&&(this.isValidCount(e)?this.outputTarget.classList.remove(this.errorClass):this.outputTarget.classList.add(this.errorClass))},n.isValidCount=function(e){var t=0,n=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(n=this.maxValue),e>=t&&e<=n},t}(l);X.targets=["input","output"],X.values={min:Number,max:Number},X.classes=["error"],e.AsyncBlockController=c,e.AutoSubmitFormController=u,e.AutosizeController=C,e.CharCountController=T,e.ClipboardController=V,e.ConfirmNavigationController=L,e.DebugController=S,e.DetectDirtyController=k,e.DisableInputsController=H,e.DismissableController=I,e.EmptyDomController=M,e.EnableInputsController=x,e.FallbackImageController=O,e.LazyBlockController=P,e.LimitedSelectionCheckboxesController=D,e.PasswordConfirmController=j,e.PasswordPeekController=A,e.ResponsiveIframeBodyController=B,e.ResponsiveIframeWrapperController=R,e.ScrollIntoFocusController=$,e.ScrollToBottomController=U,e.ScrollToController=_,e.ScrollToTopController=Y,e.SelfDestructController=G,e.TeleportController=J,e.ToggleClassController=K,e.TurboFrameRCController=Q,e.WordCountController=X}); //# sourceMappingURL=stimulus-library.umd.js.map diff --git a/dist/stimulus-library.umd.js.map b/dist/stimulus-library.umd.js.map index 60794903..df85287c 100644 --- a/dist/stimulus-library.umd.js.map +++ b/dist/stimulus-library.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"stimulus-library.umd.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:empty\", {bubbles: true, cancelable: true}));\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:not-empty\", {bubbles: true, cancelable: true}));\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","hasScopeSelectorValue","scopeSelectorValue","children","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","import","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"k1BAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWJ,MAAMI,EAAW,CAC1BM,eAAMC,EAAaC,EAAcC,GAI/B,OAHAP,EAAKQ,IAAIX,EAAKM,WAAY,CACxBM,KAAMF,IAEDR,QAAQK,MAAMC,EAAQC,EAASC,MAI1Cd,EAAKe,IAAIX,EAAKM,YAGlB,OAAOL,qCAKbU,IAAA,SAAIE,EAAsBD,GAExB,YAFwBA,IAAAA,EAAW,IAE9BE,KAAKC,YAAYC,MAAtB,CAGA,IAAIC,EAASC,QACbD,E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umd.js","sources":["../src/base_controller.ts","../src/async_block_controller.ts","../src/auto_submit_form_controller.ts","../node_modules/stimulus-use/dist/support/index.js","../node_modules/stimulus-use/dist/use-intersection/use-intersection.js","../node_modules/stimulus-use/dist/use-click-outside/use-click-outside.js","../node_modules/stimulus-use/dist/stimulus_use.js","../node_modules/stimulus-use/dist/use-hover/use-hover.js","../node_modules/stimulus-use/dist/use-mutation/use-mutation.js","../node_modules/stimulus-use/dist/use-window-resize/use-window-resize.js","../node_modules/stimulus-use/dist/use-debounce/use-debounce.js","../src/autosize_controller.ts","../src/char_count_controller.ts","../src/clipboard_controller.ts","../src/confirm_navigation_controller.ts","../src/debug_controller.ts","../src/detect_dirty_controller.ts","../src/disable_inputs_controller.ts","../src/dismissable_controller.ts","../src/empty_dom_controller.ts","../src/enable_inputs_controller.ts","../src/fallback_image_controller.ts","../src/lazy_block_controller.ts","../src/limited_selection_checkboxes_controller.ts","../src/password_confirm_controller.ts","../src/password_peek_controller.ts","../src/responsive_iframe_controller.ts","../src/utilities/scroll.ts","../src/utilities/ephemeral_controller.ts","../src/scroll_into_focus_controller.ts","../src/scroll_to_bottom_controller.ts","../src/scroll_to_controller.ts","../src/scroll_to_top_controller.ts","../src/self_destruct_controller.ts","../src/teleport_controller.ts","../src/toggle_class_controller.ts","../src/turbo_frame_rc_controller.ts","../src/utilities/turbo.ts","../src/utilities/elements.ts","../src/word_count_controller.ts"],"sourcesContent":["import {Context, Controller} from \"stimulus\";\r\n\r\nexport class BaseController extends Controller {\r\n\r\n constructor(context: Context) {\r\n super(context);\r\n return new Proxy(this, {\r\n get: (obj, prop) => {\r\n let returnVal = Reflect.get(obj, prop);\r\n let self = this;\r\n if (logProperty(prop.toString())) {\r\n if (typeof returnVal == \"function\") {\r\n return new Proxy(returnVal, {\r\n apply(target: any, thisArg: any, argArray?: any): any {\r\n self.log(prop.toString(), {\r\n args: argArray,\r\n });\r\n return Reflect.apply(target, thisArg, argArray);\r\n },\r\n });\r\n } else {\r\n this.log(prop.toString());\r\n }\r\n }\r\n return returnVal;\r\n },\r\n });\r\n }\r\n\r\n log(functionName: string, args: {} = {}): void {\r\n // @ts-ignore\r\n if (!this.application.debug) {\r\n return;\r\n }\r\n let logger = console;\r\n logger.groupCollapsed(`%c${this.identifier} %c#${functionName}`, \"color: #3B82F6\", \"color: unset\");\r\n logger.log({\r\n element: this.element,\r\n ...args,\r\n });\r\n logger.groupEnd();\r\n }\r\n\r\n}\r\n\r\nfunction logProperty(prop: string): boolean {\r\n switch (prop) {\r\n case \"application\":\r\n case \"element\":\r\n case \"constructor\":\r\n case \"initialize\":\r\n case \"log\":\r\n case \"data\":\r\n case \"valueDescriptorMap\":\r\n case \"identifier\":\r\n return false;\r\n }\r\n\r\n if (/^.*?Target(s)?$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Value$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?ValueChanged$/.test(prop)) {\r\n return false;\r\n }\r\n if (/^.*?Class$/.test(prop)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class AsyncBlockController extends BaseController {\n static targets = [\"replace\"];\n static values = {endpoint: String};\n\n declare readonly replaceTarget: HTMLElement;\n declare readonly hasReplaceTarget: boolean;\n declare readonly endpointValue: string;\n\n\n // This is a simple controller to load a block of content when the page loads.\n // It should be used to give a quick initial response before calling out to an\n // an AJAX endpoint to do some expensive work.\n connect() {\n this.loadContent();\n }\n\n loadContent() {\n let el = (this.hasReplaceTarget ? this.replaceTarget : this.element) as HTMLElement;\n fetch(this.endpointValue)\n .then((response) => response.text())\n .then((html) => {\n let newEl = document.createElement(\"div\");\n newEl.innerHTML = html;\n el.replaceWith(newEl);\n\n // Trigger event to show block has loaded\n let event = new CustomEvent(\"ajax:success\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .catch(err => {\n el.replaceWith(\"Sorry, this content failed to load\");\n\n let event = new CustomEvent(\"ajax:error\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n })\n .finally(() => {\n let event = new CustomEvent(\"ajax:complete\", {\"detail\": \"\"});\n el.dispatchEvent(event);\n });\n }\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class AutoSubmitFormController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.addEventListener(\"change\", this.boundHandler));\n }\n\n disconnect() {\n (this.element as HTMLElement).querySelectorAll(\"input, select, textarea\").forEach(el => el.removeEventListener(\"change\", this.boundHandler));\n }\n\n private handler(e: Event) {\n // this.element.submit()\n // Moved to this to support remote forms and CSRF properly\n this.element.dispatchEvent(\n new CustomEvent(\"submit\", {\n bubbles: true,\n cancelable: true,\n }),\n );\n }\n}\n","export const method = (controller, methodName) => {\n const method = controller[methodName];\n if (typeof method == 'function') {\n return method;\n }\n else {\n return (...args) => { };\n }\n};\nexport const composeEventName = (name, controller, eventPrefix) => {\n let composedName = name;\n if (eventPrefix === true) {\n composedName = `${controller.identifier}:${name}`;\n }\n else if (typeof eventPrefix === 'string') {\n composedName = `${eventPrefix}:${name}`;\n }\n return composedName;\n};\nexport const extendedEvent = (type, event, detail) => {\n const { bubbles, cancelable, composed } = event || { bubbles: true, cancelable: true, composed: true };\n if (event) {\n Object.assign(detail, { originalEvent: event });\n }\n const customEvent = new CustomEvent(type, {\n bubbles,\n cancelable,\n composed,\n detail,\n });\n return customEvent;\n};\nexport function isElementInViewport(el) {\n const rect = el.getBoundingClientRect();\n const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\n const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\n const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\n const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\n return (vertInView && horInView);\n}\n//# sourceMappingURL=index.js.map","import { method, extendedEvent, composeEventName } from '../support/index';\nconst defaultOptions = {\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useIntersection = (controller, options = {}) => {\n const { dispatchEvent, eventPrefix } = Object.assign({}, defaultOptions, options);\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n const callback = (entries) => {\n const [entry] = entries;\n if (entry.isIntersecting) {\n dispatchAppear(entry);\n }\n else if (controller.isVisible) {\n dispatchDisappear(entry);\n }\n };\n const dispatchAppear = (entry) => {\n controller.isVisible = true;\n method(controller, 'appear').call(controller, entry);\n // emit a custom \"appear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('appear', controller, eventPrefix);\n const appearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(appearEvent);\n }\n };\n const dispatchDisappear = (entry) => {\n controller.isVisible = false;\n method(controller, 'disappear').call(controller, entry);\n // emit a custom \"disappear\" event\n if (dispatchEvent) {\n const eventName = composeEventName('disappear', controller, eventPrefix);\n const disappearEvent = extendedEvent(eventName, null, { controller, entry });\n targetElement.dispatchEvent(disappearEvent);\n }\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observer = new IntersectionObserver(callback, options);\n const observe = () => {\n observer.observe(targetElement);\n };\n const unobserve = () => {\n observer.unobserve(targetElement);\n };\n Object.assign(controller, {\n isVisible: false,\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-intersection.js.map","import { composeEventName, extendedEvent, isElementInViewport } from '../support/index';\nconst defaultOptions = {\n events: ['click', 'touchend'],\n onlyVisible: true,\n dispatchEvent: true,\n eventPrefix: true,\n};\nexport const useClickOutside = (controller, options = {}) => {\n const { onlyVisible, dispatchEvent, events, eventPrefix } = Object.assign({}, defaultOptions, options);\n const onEvent = (event) => {\n const targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n if (targetElement.contains(event.target) || (!isElementInViewport(targetElement) && onlyVisible)) {\n return;\n }\n // call the clickOutside method of the Stimulus controller\n if (controller.clickOutside) {\n controller.clickOutside(event);\n }\n // emit a custom event\n if (dispatchEvent) {\n const eventName = composeEventName('click:outside', controller, eventPrefix);\n const clickOutsideEvent = extendedEvent(eventName, event, { controller });\n targetElement.dispatchEvent(clickOutsideEvent);\n }\n };\n const observe = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.addEventListener(event, onEvent, false);\n });\n };\n const unobserve = () => {\n events === null || events === void 0 ? void 0 : events.forEach(event => {\n window.removeEventListener(event, onEvent, false);\n });\n };\n // keep a copy of the current disconnect() function of the controller\n // to support composing several behaviors\n const controllerDisconnect = controller.disconnect.bind(controller);\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-click-outside.js.map","const defaultOptions = {\n debug: false,\n logger: console\n};\nexport class StimulusUse {\n constructor(controller, options = {}) {\n var _a, _b, _c;\n this.log = (functionName, args) => {\n if (!this.debug)\n return;\n this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${functionName}`, 'color: #3B82F6', 'color: unset');\n this.logger.log(Object.assign({ controllerId: this.controllerId }, args));\n this.logger.groupEnd();\n };\n this.debug = (_b = (_a = options === null || options === void 0 ? void 0 : options.debug) !== null && _a !== void 0 ? _a : controller.application.stimulusUseDebug) !== null && _b !== void 0 ? _b : defaultOptions.debug;\n this.logger = (_c = options === null || options === void 0 ? void 0 : options.logger) !== null && _c !== void 0 ? _c : defaultOptions.logger;\n this.controller = controller;\n this.controllerId = controller.element.id || controller.element.dataset.id;\n // make copies of lifecycle functions\n this.controllerInitialize = controller.initialize.bind(controller);\n this.controllerConnect = controller.connect.bind(controller);\n this.controllerDisconnect = controller.disconnect.bind(controller);\n }\n}\n//# sourceMappingURL=stimulus_use.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseHover extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n this.targetElement.addEventListener('mouseenter', this.onEnter);\n this.targetElement.addEventListener('mouseleave', this.onLeave);\n };\n this.unobserve = () => {\n this.targetElement.removeEventListener('mouseenter', this.onEnter);\n this.targetElement.removeEventListener('mouseleave', this.onLeave);\n };\n this.onEnter = () => {\n method(this.controller, 'mouseEnter').call(this.controller);\n this.log('mouseEnter', { hover: true });\n };\n this.onLeave = () => {\n method(this.controller, 'mouseLeave').call(this.controller);\n this.log('mouseLeave', { hover: false });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useHover = (controller, options = {}) => {\n const observer = new UseHover(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-hover.js.map","import { StimulusUse } from '../stimulus_use';\nimport { method } from '../support/index';\nexport class UseMutation extends StimulusUse {\n constructor(controller, options = {}) {\n super(controller, options);\n this.observe = () => {\n try {\n this.observer.observe(this.targetElement, this.options);\n }\n catch (error) {\n this.controller.application.handleError(error, \"At a minimum, one of childList, attributes, and/or characterData must be true\", {});\n }\n };\n this.unobserve = () => {\n this.observer.disconnect();\n };\n this.mutation = (entries) => {\n method(this.controller, 'mutate').call(this.controller, entries);\n this.log('mutate', { entries });\n };\n this.targetElement = (options === null || options === void 0 ? void 0 : options.element) || controller.element;\n this.controller = controller;\n this.options = options;\n this.observer = new MutationObserver(this.mutation);\n this.enhanceController();\n this.observe();\n }\n enhanceController() {\n const controllerDisconnect = this.controller.disconnect.bind(this.controller);\n const disconnect = () => {\n this.unobserve();\n controllerDisconnect();\n };\n Object.assign(this.controller, { disconnect });\n }\n}\nexport const useMutation = (controller, options = {}) => {\n const observer = new UseMutation(controller, options);\n return [observer.observe, observer.unobserve];\n};\n//# sourceMappingURL=use-mutation.js.map","import { method } from '../support/index';\nexport const useWindowResize = (controller) => {\n const callback = (event) => {\n const { innerWidth, innerHeight } = window;\n const payload = {\n height: innerHeight || Infinity,\n width: innerWidth || Infinity,\n event\n };\n method(controller, 'windowResize').call(controller, payload);\n };\n const controllerDisconnect = controller.disconnect.bind(controller);\n const observe = () => {\n window.addEventListener('resize', callback);\n callback();\n };\n const unobserve = () => {\n window.removeEventListener('resize', callback);\n };\n Object.assign(controller, {\n disconnect() {\n unobserve();\n controllerDisconnect();\n },\n });\n observe();\n return [observe, unobserve];\n};\n//# sourceMappingURL=use-window-resize.js.map","import { Controller } from 'stimulus';\nclass DebounceController extends Controller {\n}\nDebounceController.debounces = [];\nconst defaultWait = 200;\nconst debounce = (fn, wait = defaultWait) => {\n let timeoutId = null;\n return function () {\n const args = arguments;\n const context = this;\n const callback = () => fn.apply(context, args);\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(callback, wait);\n };\n};\nexport const useDebounce = (controller, options) => {\n var _a;\n const constructor = controller.constructor;\n (_a = constructor.debounces) === null || _a === void 0 ? void 0 : _a.forEach((func) => {\n if (typeof func === \"string\") {\n controller[func] = debounce(controller[func], options === null || options === void 0 ? void 0 : options.wait);\n }\n if (typeof func === \"object\") {\n const { name, wait } = func;\n if (!name)\n return;\n controller[name] = debounce(controller[name], wait || (options === null || options === void 0 ? void 0 : options.wait));\n }\n });\n};\n//# sourceMappingURL=use-debounce.js.map","import {useWindowResize} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport class AutosizeController extends BaseController {\n\n private boundHandler = this.handler.bind(this);\n\n connect() {\n let target = this.element as HTMLTextAreaElement;\n target.style.resize = \"none\";\n target.style.boxSizing = \"border-box\";\n target.addEventListener(\"input\", this.boundHandler);\n target.addEventListener(\"focus\", this.boundHandler);\n useWindowResize(this);\n requestAnimationFrame(this.boundHandler);\n }\n\n windowResize() {\n this.handler();\n }\n\n private handler() {\n this.autosize(this.element as HTMLTextAreaElement);\n };\n\n private autosize(element: HTMLTextAreaElement) {\n let offset = element.offsetHeight - element.clientHeight;\n element.style.height = \"auto\";\n element.style.height = element.scrollHeight + offset + \"px\";\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class CharCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateCharCount.bind(this);\r\n\r\n connect() {\r\n this.updateCharCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateCharCount() {\r\n let charCount = this.inputTarget.value.length;\r\n this.outputTarget.innerText = charCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(charCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class ClipboardController extends BaseController {\r\n\r\n static targets = [\"button\", \"copy\", \"fallback\"];\r\n static values = {removeUnused: Boolean};\r\n\r\n declare readonly sourceTarget: HTMLElement;\r\n declare readonly copyTarget: HTMLElement;\r\n declare readonly hasCopyTarget: boolean;\r\n declare readonly fallbackTarget: HTMLElement;\r\n declare readonly hasFallbackTarget: boolean;\r\n\r\n declare readonly hasRemoveUnusedValue: boolean;\r\n declare readonly removeUnusedValue: boolean;\r\n\r\n supported = false;\r\n\r\n connect() {\r\n this.supported = document.queryCommandSupported(\"copy\");\r\n\r\n if (this.hasRemoveUnusedValue && this.removeUnusedValue) {\r\n if (this.supported && this.hasFallbackTarget) {\r\n this.fallbackTarget.remove();\r\n } else if (this.hasCopyTarget) {\r\n this.copyTarget.remove();\r\n }\r\n }\r\n }\r\n\r\n select(event: MouseEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n }\r\n\r\n copy(event: ClipboardEvent) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n (this.sourceTarget as HTMLInputElement | HTMLTextAreaElement).select();\r\n if (this.supported) {\r\n document.execCommand(\"copy\");\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\n\nexport class ConfirmNavigationController extends BaseController {\n\n static values = {message: String};\n\n declare readonly messageValue: string;\n\n connect() {\n let confirmMessage = this.messageValue;\n window.onbeforeunload = () => (confirmMessage == null ? true : confirmMessage);\n window.addEventListener(\"popstate\", this.handlePopstate);\n window.addEventListener(\"submit\", () => {\n window.removeEventListener(\"popstate\", this.handlePopstate);\n window.onbeforeunload = null;\n });\n // TODO: Turbo navigation events\n }\n\n handlePopstate(event: PopStateEvent) {\n return false;\n }\n\n}\n","import {BaseController} from \"./base_controller\";\n\nexport class DebugController extends BaseController {\n\n static targets = [\"test\"];\n declare testTargets: HTMLElement[];\n\n connect() {\n console.log(\"Debug Controller\", this, this.testTargets);\n }\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DetectDirtyController extends BaseController {\r\n\r\n initialValue: string | boolean | null = null;\r\n\r\n boundHandler = this.handler.bind(this);\r\n\r\n connect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n this.initialValue = element.checked;\r\n } else {\r\n this.initialValue = element.value;\r\n }\r\n element.addEventListener(\"input\", this.boundHandler);\r\n element.addEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n element.removeEventListener(\"input\", this.boundHandler);\r\n element.removeEventListener(\"change\", this.boundHandler);\r\n }\r\n\r\n restore() {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n if (this.isInputElement(element) && this.isCheckable(element)) {\r\n element.checked = this.initialValue as boolean;\r\n } else {\r\n element.value = this.initialValue as string;\r\n }\r\n }\r\n\r\n private handler(event?: Event) {\r\n let element = this.element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\r\n\r\n if (this.initialValue !== element.value) {\r\n element.setAttribute(\"data-dirty\", \"true\");\r\n } else {\r\n element.removeAttribute(\"data-dirty\");\r\n }\r\n }\r\n\r\n private isCheckable(element: HTMLInputElement): boolean {\r\n return (element.type === \"radio\" || element.type === \"checkbox\");\r\n }\r\n\r\n private isInputElement(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): element is HTMLInputElement {\r\n return element.tagName === \"INPUT\";\r\n }\r\n\r\n}\r\n\r\nexport function isDirty(element: HTMLElement) {\r\n return element.hasAttribute(\"data-dirty\");\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DisableInputsController extends BaseController {\r\n\r\n static targets = [\"disabler\", \"disable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasDisablerTarget: boolean;\r\n declare readonly disablerTarget: HTMLInputElement;\r\n declare readonly disableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasDisablerTarget && this.disablerTarget.checked) {\r\n this.disableInputs();\r\n } else {\r\n this.enableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.disableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.disableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class DismissableController extends BaseController {\r\n\r\n\r\n dismiss() {\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useMutation} from \"stimulus-use\";\r\nimport {BaseController} from \"./base_controller\";\r\n\r\nexport class EmptyDomController extends BaseController {\r\n\r\n static classes = [\"empty\", \"notEmpty\"];\r\n static values = {scopeSelector: String};\r\n\r\n declare hasEmptyClass: boolean;\r\n declare emptyClass: string;\r\n declare hasNotEmptyClass: boolean;\r\n declare notEmptyClass: string;\r\n\r\n declare hasScopeSelectorValue: boolean;\r\n declare scopeSelectorValue: string;\r\n\r\n connect() {\r\n useMutation(this, {element: this.element, childList: true});\r\n this.checkEmpty();\r\n }\r\n\r\n mutate(entries: MutationRecord[]) {\r\n this.checkEmpty();\r\n }\r\n\r\n checkEmpty() {\r\n let children;\r\n if (this.hasScopeSelectorValue) {\r\n children = this.element.querySelectorAll(this.scopeSelectorValue);\r\n } else {\r\n children = this.element.children;\r\n }\r\n\r\n if (children.length === 0) {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:empty\", {bubbles: true, cancelable: true}));\r\n } else {\r\n if (this.hasNotEmptyClass) {\r\n let classes = this.notEmptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.add(klass));\r\n }\r\n if (this.hasEmptyClass) {\r\n let classes = this.emptyClass.split(\" \");\r\n classes.forEach(klass => this.element.classList.remove(klass));\r\n }\r\n this.element.dispatchEvent(new CustomEvent(\"dom:not-empty\", {bubbles: true, cancelable: true}));\r\n }\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class EnableInputsController extends BaseController {\r\n\r\n static targets = [\"enabler\", \"enable\"];\r\n\r\n static values = {\r\n clear: Boolean,\r\n };\r\n\r\n declare readonly hasEnablerTarget: boolean;\r\n declare readonly enablerTarget: HTMLInputElement;\r\n declare readonly enableTargets: Array;\r\n declare readonly clearValue: boolean;\r\n declare readonly hasClearValue: boolean;\r\n\r\n connect() {\r\n this.toggle();\r\n }\r\n\r\n toggle() {\r\n if (this.hasEnablerTarget && this.enablerTarget.checked) {\r\n this.enableInputs();\r\n } else {\r\n this.disableInputs();\r\n }\r\n }\r\n\r\n disableInputs() {\r\n let shouldClear = this.hasClearValue && this.clearValue;\r\n this.enableTargets.forEach((el, _) => {\r\n if (shouldClear) {\r\n el.value = \"\";\r\n }\r\n el.disabled = true;\r\n });\r\n }\r\n\r\n enableInputs() {\r\n this.enableTargets.forEach((el, _) => {\r\n el.disabled = false;\r\n });\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class FallbackImageController extends BaseController {\r\n\r\n static values = {placeholder: String};\r\n\r\n declare readonly placeholderValue: string;\r\n declare readonly hasPlaceholderValue: boolean;\r\n\r\n connect() {\r\n let element = this.element as HTMLImageElement;\r\n\r\n element.onerror = () => {\r\n if (this.hasPlaceholderValue) {\r\n element.src = this.placeholderValue;\r\n } else {\r\n element.style.display = \"none\";\r\n }\r\n };\r\n }\r\n\r\n}\r\n","import {useIntersection} from \"stimulus-use\";\nimport {IntersectionOptions} from \"stimulus-use/dist/use-intersection/use-intersection\";\nimport {AsyncBlockController} from \"./async_block_controller\";\n\nexport class LazyBlockController extends AsyncBlockController {\n\n declare observe: () => void;\n declare unobserve: () => void;\n declare options: IntersectionOptions;\n declare isVisible: boolean;\n declare disappear: () => void;\n\n connect() {\n let element = this.element;\n this.options = {element, threshold: 0.3};\n\n if (\"IntersectionObserver\" in window) {\n [this.observe, this.unobserve] = useIntersection(this, this.options);\n } else {\n // Client doesn't support intersection observer, fallback to pre-loading\n this.loadContent();\n }\n }\n\n appear(entry: IntersectionObserverEntry) {\n let element = this.element as HTMLImageElement;\n if (element.src !== \"\") {\n return;\n }\n if (entry.target === element && entry.isIntersecting) {\n this.loadContent();\n if (this.unobserve) {\n this.unobserve();\n }\n }\n }\n\n}\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class LimitedSelectionCheckboxesController extends BaseController {\r\n\r\n static targets = [\"input\", \"error\"];\r\n static values = {max: Number, message: String};\r\n\r\n declare readonly hasErrorTarget: boolean;\r\n declare readonly errorTarget: HTMLElement;\r\n declare readonly inputTargets: HTMLInputElement[];\r\n declare readonly maxValue: number;\r\n declare readonly messageValue: string;\r\n\r\n maxSelections = 0;\r\n\r\n boundHandleInputs = this.handleInputs.bind(this);\r\n\r\n connect() {\r\n this.inputTargets.forEach((el) => el.addEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n disconnect() {\r\n this.inputTargets.forEach((el) => el.removeEventListener(\"change\", this.boundHandleInputs));\r\n }\r\n\r\n handleInputs(event: Event) {\r\n let tickedInputs = this.inputTargets.reduce((previousValue, el) => el.checked ? previousValue + 1 : previousValue, 0);\r\n let target = event.target as HTMLInputElement;\r\n if (tickedInputs > this.maxSelections) {\r\n event.preventDefault();\r\n target.checked = false;\r\n target.dispatchEvent(new CustomEvent(\"change\", {bubbles: true, cancelable: true}));\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:too-many\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = this.messageValue;\r\n }\r\n } else {\r\n target.dispatchEvent(new CustomEvent(\"limited-selection:selection\", {bubbles: true, cancelable: true, detail: {target}}));\r\n if (this.hasErrorTarget) {\r\n this.errorTarget.innerHTML = \"\";\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordConfirmController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n static classes = [\"error\"];\r\n\r\n declare readonly passwordTargets: HTMLInputElement[];\r\n\r\n declare readonly errorClass: string;\r\n declare readonly hasErrorClass: boolean;\r\n\r\n private boundCheckPasswordsMatch = this.checkPasswordsMatch.bind(this);\r\n\r\n connect() {\r\n this.passwordTargets.forEach((el) => el.addEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n disconnect() {\r\n this.passwordTargets.forEach((el) => el.removeEventListener(\"change\", this.boundCheckPasswordsMatch));\r\n }\r\n\r\n private allPasswordsMatch() {\r\n let values = new Set(this.passwordTargets.map(el => el.value)); // Create a unique set of the password values\r\n return values.has(\"\") || values.size == 1; // If any of the passwords are still blank, or there is only one distinct password value (i.e. they all are the same)\r\n }\r\n\r\n private checkPasswordsMatch() {\r\n if (this.allPasswordsMatch()) {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.remove(this.errorClass));\r\n }\r\n } else {\r\n this.element.dispatchEvent(new CustomEvent(\"password-confirm:no-match\"));\r\n if (this.hasErrorClass) {\r\n this.passwordTargets.forEach(el => el.classList.add(this.errorClass));\r\n }\r\n }\r\n }\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class PasswordPeekController extends BaseController {\r\n\r\n static targets = [\"password\"];\r\n\r\n declare readonly passwordTarget: HTMLInputElement;\r\n\r\n\r\n peak(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"text\";\r\n }\r\n\r\n hide(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n this.passwordTarget.type = \"password\";\r\n }\r\n\r\n toggle(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n if (this.passwordTarget.type === \"password\") {\r\n this.peak();\r\n } else {\r\n this.hide();\r\n }\r\n }\r\n}\r\n","import {useDebounce, useWindowResize} from \"stimulus-use\";\nimport {WindowResizePayload} from \"stimulus-use/dist/use-window-resize/use-window-resize\";\nimport {BaseController} from \"./base_controller\";\n\ninterface ResponsiveIframeMessage {\n name: string,\n height: number,\n}\n\nexport class ResponsiveIframeWrapperController extends BaseController {\n\n boundMessageReceived = this.messageReceived.bind(this);\n\n connect() {\n window.addEventListener(\"message\", this.boundMessageReceived);\n }\n\n disconnect() {\n window.removeEventListener(\"message\", this.boundMessageReceived);\n }\n\n messageReceived(message: MessageEvent) {\n let data = message.data;\n if (data.hasOwnProperty(\"name\") && data.name === \"iframe-body\" && data.hasOwnProperty(\"height\")) {\n this.resize(data.height);\n }\n }\n\n resize(height: number) {\n (this.element as HTMLIFrameElement).style.height = `${height}px`;\n }\n\n}\n\nexport class ResponsiveIframeBodyController extends BaseController {\n\n static debounces = [\"postUpdate\"];\n\n declare observe: () => void;\n declare unobserve: () => void;\n\n connect() {\n // If this Window is inside a frame\n if (window.self !== window.top) {\n useWindowResize(this);\n useDebounce(this, {});\n this.postUpdate();\n } else {\n // Not an iframe\n }\n }\n\n windowResize(payload: WindowResizePayload) {\n this.postUpdate();\n };\n\n postUpdate() {\n let payload: ResponsiveIframeMessage = {name: \"iframe-body\", height: this.getHeight()};\n window.parent.postMessage(\n payload,\n \"*\",\n );\n }\n\n getHeight(): number {\n const body = document.body;\n const html = document.documentElement;\n\n // Get the largest height out of body and html's various height measurements\n return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n }\n\n}\n","const smoothSupported = \"scrollBehavior\" in document.documentElement.style;\r\nlet smoothPolyfilled: boolean;\r\n\r\nexport async function scrollToElement(element: Element, {behavior = \"smooth\", block = \"start\", inline = \"nearest\"}: ScrollIntoViewOptions = {}) {\r\n if (behavior == \"smooth\" && !smoothSupported) {\r\n await polyfillSmooth();\r\n }\r\n element.scrollIntoView({behavior, block, inline});\r\n}\r\n\r\nasync function polyfillSmooth() {\r\n const {polyfill} = await import(/* webpackChunkName: \"smoothscroll-polyfill\" */ \"smoothscroll-polyfill\");\r\n if (smoothPolyfilled) {\r\n return;\r\n }\r\n smoothPolyfilled = true;\r\n polyfill();\r\n}\r\n\r\nexport function getScrollParent(node: HTMLElement | null): HTMLElement | null {\r\n if (!node) {\r\n return null;\r\n }\r\n const overflowY = getComputedStyle(node).overflowY;\r\n const isScrollable = overflowY !== \"visible\" && overflowY !== \"hidden\";\r\n\r\n if (isScrollable && node.scrollHeight >= node.clientHeight) {\r\n return node;\r\n }\r\n\r\n return getScrollParent(node.parentElement) || document.body;\r\n}\r\n","import camelCase from \"lodash.camelcase\";\r\nimport {BaseController} from \"../base_controller\";\r\n\r\nexport class EphemeralController extends BaseController {\r\n\r\n cleanupSelf() {\r\n this.cleanup(this.element as HTMLElement);\r\n }\r\n\r\n cleanup(element: HTMLElement) {\r\n element.dataset.controller = element.dataset.controller?.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`, \"g\"), \"\") || \"\";\r\n if (element.dataset.controller == \"\") {\r\n // If there are no controllers left, remove the attribute\r\n delete element.dataset.controller;\r\n }\r\n\r\n let substringIdentifierValueRegex = new RegExp(`(\\s|^)${this.identifier}\\\\..+?(\\s|$)`, \"g\");\r\n element.dataset.target = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-target`)];\r\n if (element.dataset.target == \"\") {\r\n // If there are no targets left, remove the attribute\r\n delete element.dataset.target;\r\n }\r\n\r\n element.dataset.action = element.dataset.target?.replaceAll(substringIdentifierValueRegex, \"\") || \"\";\r\n delete element.dataset[camelCase(`${this.identifier}-action`)];\r\n if (element.dataset.action == \"\") {\r\n // If there are no actions left, remove the attribute\r\n delete element.dataset.action;\r\n }\r\n\r\n // @ts-ignore\r\n let values = this.constructor.values;\r\n if (values) {\r\n Object.keys(values).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-value`)]);\r\n }\r\n\r\n // @ts-ignore\r\n let classes = this.constructor.classes;\r\n if (classes) {\r\n Object.keys(classes).forEach(val => delete element.dataset[camelCase(`${this.identifier}-${val}-class`)]);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollIntoFocusController extends EphemeralController {\r\n\r\n static values = {\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Attempt smooth scrolling, with polyfill\r\n scrollToElement(\r\n this.element,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => this.element.scrollIntoView()); // Fallback to snap-scrolling\r\n this.cleanupSelf();\r\n });\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToBottomController extends BaseController {\r\n\r\n static values = {\r\n mode: String,\r\n };\r\n\r\n declare modeValue: \"nearest\" | \"document\";\r\n declare hasModeValue: boolean;\r\n\r\n\r\n scroll(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let mode = this.hasModeValue ? this.modeValue : \"document\";\r\n let target: null | HTMLElement;\r\n if (mode == \"document\") {\r\n target = document.body;\r\n } else {\r\n target = getScrollParent(this.element as HTMLElement);\r\n }\r\n if (target == null) {\r\n return;\r\n }\r\n scrollToElement(target!, {behavior: \"smooth\", block: \"end\"}).catch(() => target!.scrollIntoView(false));\r\n }\r\n\r\n}\r\n\r\n","import {BaseController} from \"./base_controller\";\r\nimport {scrollToElement} from \"./utilities/scroll\";\r\n\r\nexport class ScrollToController extends BaseController {\r\n\r\n static values = {\r\n selector: String,\r\n behavior: String,\r\n block: String,\r\n inline: String,\r\n };\r\n\r\n declare selectorValue: string;\r\n declare behaviorValue: ScrollBehavior;\r\n declare hasBehaviorValue: boolean;\r\n declare blockValue: ScrollLogicalPosition;\r\n declare hasBlockValue: boolean;\r\n declare inlineValue: ScrollLogicalPosition;\r\n declare hasInlineValue: boolean;\r\n\r\n\r\n scroll() {\r\n let target = document.querySelector(this.selectorValue);\r\n if (!target) {\r\n console.warn(`Could not find target for '${this.selectorValue}'`);\r\n return;\r\n }\r\n\r\n scrollToElement(\r\n target!,\r\n {\r\n behavior: this.hasBehaviorValue ? this.behaviorValue : \"smooth\",\r\n block: this.hasBlockValue ? this.blockValue : \"center\",\r\n inline: this.hasInlineValue ? this.inlineValue : \"center\",\r\n },\r\n ).catch(() => target!.scrollIntoView()); // Fallback to snap-scrolling\r\n }\r\n\r\n}\r\n","import {BaseController} from \"./base_controller\";\nimport {getScrollParent, scrollToElement} from \"./utilities/scroll\";\n\nexport class ScrollToTopController extends BaseController {\n\n static values = {\n mode: String,\n };\n\n declare modeValue: \"nearest\" | \"document\";\n declare hasModeValue: boolean;\n\n\n scroll(event?: Event) {\n if (event) {\n event.preventDefault();\n }\n let mode = this.hasModeValue ? this.modeValue : \"document\";\n let target: null | HTMLElement;\n if (mode == \"document\") {\n target = document.body;\n } else {\n target = getScrollParent(this.element as HTMLElement);\n }\n if (target == null) {\n return;\n }\n scrollToElement(target!, {behavior: \"smooth\", block: \"start\"}).catch(() => target!.scrollIntoView(false));\n }\n\n}\n\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class SelfDestructController extends BaseController {\r\n\r\n static values = {seconds: Number};\r\n\r\n declare readonly secondsValue: number;\r\n timeout: null | ReturnType = null;\r\n\r\n connect() {\r\n requestAnimationFrame(() => {\r\n // Only start countdown on first paint\r\n this.timeout = setTimeout(() => this.element.remove(), this.secondsValue * 1000);\r\n });\r\n }\r\n\r\n disconnect() {\r\n if (this.timeout) {\r\n clearTimeout(this.timeout);\r\n }\r\n }\r\n\r\n}\r\n","import {EphemeralController} from \"./utilities/ephemeral_controller\";\r\n\r\nexport class TeleportController extends EphemeralController {\r\n\r\n static values = {target: String, insert: String, immediate: Boolean};\r\n\r\n declare readonly immediateValue: boolean;\r\n declare readonly hasImmediateValue: boolean;\r\n declare readonly targetValue: string;\r\n declare readonly hasInsertValue: boolean;\r\n declare readonly insertValue: InsertPosition | \"replaceOuter\" | \"replaceInner\" | \"prepend\" | \"append\";\r\n\r\n connect() {\r\n if (!this.hasInsertValue) {\r\n throw new Error(\"`insert` value was not specified\");\r\n }\r\n\r\n requestAnimationFrame(() => {\r\n if (this.hasImmediateValue && this.immediateValue) {\r\n this.execute();\r\n }\r\n });\r\n }\r\n\r\n execute(event?: Event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n let destination = document.querySelector(this.targetValue);\r\n\r\n if (destination == null) {\r\n this.element.dispatchEvent(new CustomEvent(\"teleport:error\", {bubbles: true, cancelable: true}));\r\n return;\r\n }\r\n\r\n let copy = this.element.cloneNode(true) as HTMLElement;\r\n this.cleanup(copy);\r\n\r\n switch (this.insertValue) {\r\n case \"beforebegin\":\r\n case \"beforeend\":\r\n case \"afterend\":\r\n case \"afterbegin\":\r\n destination.insertAdjacentHTML(this.insertValue, copy.outerHTML);\r\n break;\r\n case \"replaceOuter\":\r\n destination.outerHTML = copy.outerHTML;\r\n break;\r\n case \"replaceInner\":\r\n destination.innerHTML = copy.outerHTML;\r\n break;\r\n case \"prepend\":\r\n destination.insertAdjacentHTML(\"afterbegin\", copy.outerHTML);\r\n break;\r\n case \"append\":\r\n destination.insertAdjacentHTML(\"beforeend\", copy.outerHTML);\r\n break;\r\n default:\r\n throw new Error(\"`insert` value was not specified\");\r\n\r\n }\r\n this.element.remove();\r\n }\r\n\r\n}\r\n","import {useClickOutside, useHover} from \"stimulus-use\";\nimport {BaseController} from \"./base_controller\";\n\nexport type ToggleClassMode = \"on\" | \"off\" | \"toggle\"\n\nexport class ToggleClassController extends BaseController {\n\n static targets = [\"toggle\"];\n static values = {\n class: String,\n mouseEnter: String,\n mouseLeave: String,\n clickAway: Boolean,\n initial: String,\n };\n\n declare readonly toggleTargets: HTMLElement[];\n\n declare readonly classValue: string;\n declare readonly hasClassValue: boolean;\n\n declare readonly mouseEnterValue: ToggleClassMode;\n declare readonly hasMouseEnterValue: boolean;\n\n declare readonly mouseLeaveValue: ToggleClassMode;\n declare readonly hasMouseLeaveValue: boolean;\n\n declare readonly clickAwayValue: boolean;\n declare readonly hasClickAwayValue: boolean;\n\n declare readonly initialValue: \"on\" | \"off\";\n declare readonly hasInitialValue: boolean;\n\n connect() {\n if (!this.hasClassValue) {\n throw new Error(\"data-toggle-class-class-value must not be empty\");\n }\n\n if (this.hasMouseEnterValue || this.hasMouseLeaveValue) {\n useHover(this);\n }\n\n if (this.hasClickAwayValue && this.clickAwayValue) {\n useClickOutside(this);\n }\n\n requestAnimationFrame(() => {\n if (this.hasInitialValue) {\n if (this.initialValue === \"on\") {\n this.toggleTargets.forEach((target) => this.elementOn(target));\n } else {\n this.toggleTargets.forEach((target) => this.elementOff(target));\n }\n }\n });\n }\n\n clickOutside() {\n this.toggleTargets.forEach((target) => {\n if (this.elementWasToggled(target)) {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n }\n });\n }\n\n mouseEnter() {\n if (this.hasMouseEnterValue) {\n switch (this.mouseEnterValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n mouseLeave() {\n if (this.hasMouseLeaveValue) {\n switch (this.mouseLeaveValue) {\n case \"on\":\n this.on();\n break;\n case \"off\":\n this.off();\n break;\n case \"toggle\":\n this.toggle();\n break;\n }\n }\n return {};\n }\n\n on(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOn(target);\n });\n }\n\n off(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementOff(target);\n });\n }\n\n toggle(event?: Event) {\n this.toggleTargets.forEach((target) => {\n this.elementToggleStatus(target);\n this.elementToggle(target);\n });\n }\n\n private elementWasToggled(el: HTMLElement): boolean {\n return el.dataset.toggled == \"true\";\n }\n\n private elementToggleStatus(el: HTMLElement) {\n if (this.elementWasToggled(el)) {\n delete el.dataset.toggled;\n } else {\n el.dataset.toggled = \"true\";\n }\n }\n\n private elementToggle(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass));\n }\n\n private elementOn(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, true));\n }\n\n private elementOff(el: HTMLElement) {\n let classes = this.classValue.split(\" \");\n classes.forEach((klass) => el.classList.toggle(klass, false));\n }\n\n}\n","import {BaseController} from \"./base_controller\";\nimport {isHTMLLinkElement} from \"./utilities/elements\";\nimport {isTurboFrame} from \"./utilities/turbo\";\n\nexport class TurboFrameRCController extends BaseController {\n\n static values = {\n frameId: String,\n src: String,\n loadingMessage: String,\n };\n\n declare readonly frameIdValue: string;\n declare readonly srcValue: string;\n declare readonly hasSrcValue: boolean;\n declare readonly loadingMessageValue: string;\n declare readonly hasLoadingMessageValue: boolean;\n\n toggle(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n let frameSrc = frame.src;\n if (frameSrc == null || frameSrc !== this.getSrc()) {\n this.setSrc();\n } else {\n this.clear();\n }\n }\n\n setSrc(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n if (this.hasLoadingMessageValue) {\n frame.innerHTML = this.loadingMessageValue;\n }\n\n frame.src = this.getSrc();\n }\n\n clear(event?: Event | null) {\n if (event) {\n event.preventDefault();\n }\n let frame = this.getFrame();\n frame.src = \"\";\n frame.innerHTML = \"\";\n }\n\n private getFrame(): TurboFrame {\n let frame = document.getElementById(`${this.frameIdValue}`);\n if (frame == null) {\n throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);\n }\n if (!isTurboFrame(frame)) {\n throw new Error(`Element targeted by ID '${this.frameIdValue}'`);\n } else {\n return frame;\n }\n }\n\n private getSrc(): string {\n let element = this.element as HTMLElement;\n if (this.hasSrcValue) {\n return this.srcValue;\n } else if (isHTMLLinkElement(element)) {\n return element.href;\n } else {\n throw new Error(\"No link given to drive frame to\");\n }\n }\n\n}\n","export function isTurboFrame(element: HTMLElement): element is TurboFrame {\r\n return element.nodeName == \"TURBO-FRAME\";\r\n}\r\n","export function isHTMLLinkElement(element: Element): element is HTMLLinkElement {\r\n return element.nodeName == \"A\";\r\n}\r\n","import {BaseController} from \"./base_controller\";\r\n\r\nexport class WordCountController extends BaseController {\r\n\r\n static targets = [\"input\", \"output\"];\r\n static values = {min: Number, max: Number};\r\n static classes = [\"error\"];\r\n\r\n declare readonly inputTarget: HTMLInputElement | HTMLTextAreaElement;\r\n declare readonly outputTarget: HTMLElement;\r\n declare minValue: number;\r\n declare hasMinValue: boolean;\r\n declare maxValue: number;\r\n declare hasMaxValue: boolean;\r\n declare errorClass: string;\r\n declare hasErrorClass: boolean;\r\n\r\n boundHandler = this.updateWordCount.bind(this);\r\n\r\n connect() {\r\n this.updateWordCount();\r\n this.inputTarget.addEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n disconnect() {\r\n this.inputTarget.removeEventListener(\"input\", this.boundHandler);\r\n }\r\n\r\n updateWordCount() {\r\n let wordCount = 0;\r\n let textAreaValue = this.inputTarget.value;\r\n let matches = textAreaValue.match(/\\S+/g);\r\n wordCount = (matches && matches.length) || 0;\r\n this.outputTarget.innerText = wordCount.toString();\r\n if (this.hasErrorClass) {\r\n if (this.isValidCount(wordCount)) {\r\n this.outputTarget.classList.remove(this.errorClass);\r\n } else {\r\n this.outputTarget.classList.add(this.errorClass);\r\n }\r\n }\r\n }\r\n\r\n isValidCount(count: number) {\r\n let min = 0;\r\n let max = 99999;\r\n\r\n if (this.hasMinValue) {\r\n min = this.minValue;\r\n }\r\n\r\n if (this.hasMaxValue) {\r\n max = this.maxValue;\r\n }\r\n\r\n return count >= min && count <= max;\r\n }\r\n\r\n}\r\n"],"names":["BaseController","context","_this","Proxy","get","obj","prop","returnVal","Reflect","self","test","logProperty","toString","apply","target","thisArg","argArray","log","args","functionName","this","application","debug","logger","console","groupCollapsed","identifier","element","groupEnd","Controller","AsyncBlockController","connect","loadContent","el","hasReplaceTarget","replaceTarget","fetch","endpointValue","then","response","text","html","newEl","document","createElement","innerHTML","replaceWith","event","CustomEvent","detail","dispatchEvent","err","endpoint","String","AutoSubmitFormController","handler","bind","querySelectorAll","forEach","addEventListener","_this2","boundHandler","disconnect","removeEventListener","_this3","e","bubbles","cancelable","method","controller","methodName","composeEventName","name","eventPrefix","composedName","extendedEvent","type","composed","Object","assign","originalEvent","defaultOptions","events","onlyVisible","StimulusUse","[object Object]","options","_a","_b","_c","controllerId","stimulusUseDebug","id","dataset","controllerInitialize","initialize","controllerConnect","controllerDisconnect","UseHover","super","observe","targetElement","onEnter","onLeave","unobserve","call","hover","enhanceController","UseMutation","observer","error","handleError","mutation","entries","MutationObserver","useWindowResize","callback","innerWidth","innerHeight","window","payload","height","Infinity","width","debounce","fn","wait","timeoutId","arguments","clearTimeout","setTimeout","AutosizeController","style","resize","boxSizing","requestAnimationFrame","windowResize","autosize","offset","offsetHeight","clientHeight","scrollHeight","CharCountController","updateCharCount","inputTarget","charCount","value","length","outputTarget","innerText","hasErrorClass","isValidCount","classList","remove","errorClass","add","count","min","max","hasMinValue","minValue","hasMaxValue","maxValue","Number","ClipboardController","supported","queryCommandSupported","hasRemoveUnusedValue","removeUnusedValue","hasFallbackTarget","fallbackTarget","hasCopyTarget","copyTarget","select","preventDefault","sourceTarget","copy","execCommand","removeUnused","Boolean","ConfirmNavigationController","confirmMessage","messageValue","onbeforeunload","handlePopstate","message","DebugController","testTargets","DetectDirtyController","initialValue","isInputElement","isCheckable","checked","restore","setAttribute","removeAttribute","tagName","DisableInputsController","toggle","hasDisablerTarget","disablerTarget","disableInputs","enableInputs","shouldClear","hasClearValue","clearValue","disableTargets","_","disabled","clear","DismissableController","dismiss","EmptyDomController","useMutation","childList","checkEmpty","mutate","hasScopeSelectorValue","scopeSelectorValue","children","hasNotEmptyClass","notEmptyClass","split","klass","hasEmptyClass","emptyClass","scopeSelector","EnableInputsController","hasEnablerTarget","enablerTarget","enableTargets","FallbackImageController","onerror","hasPlaceholderValue","src","placeholderValue","display","placeholder","LazyBlockController","threshold","IntersectionObserver","entry","isIntersecting","isVisible","eventName","appearEvent","dispatchAppear","disappearEvent","dispatchDisappear","useIntersection","appear","LimitedSelectionCheckboxesController","handleInputs","inputTargets","boundHandleInputs","tickedInputs","reduce","previousValue","maxSelections","hasErrorTarget","errorTarget","PasswordConfirmController","checkPasswordsMatch","passwordTargets","boundCheckPasswordsMatch","allPasswordsMatch","values","Set","map","has","size","_this4","PasswordPeekController","peak","passwordTarget","hide","ResponsiveIframeWrapperController","messageReceived","boundMessageReceived","data","hasOwnProperty","ResponsiveIframeBodyController","top","constructor","debounces","func","postUpdate","getHeight","parent","postMessage","body","documentElement","Math","smoothPolyfilled","EphemeralController","cleanupSelf","cleanup","replaceAll","RegExp","substringIdentifierValueRegex","camelCase","action","keys","val","classes","scrollToElement","behavior","block","inline","scrollIntoView","smoothSupported","import","polyfill","polyfillSmooth","getScrollParent","node","overflowY","getComputedStyle","parentElement","ScrollIntoFocusController","hasBehaviorValue","behaviorValue","hasBlockValue","blockValue","hasInlineValue","inlineValue","ScrollToBottomController","scroll","hasModeValue","modeValue","mode","ScrollToController","querySelector","selectorValue","warn","selector","ScrollToTopController","SelfDestructController","timeout","secondsValue","seconds","TeleportController","hasInsertValue","Error","hasImmediateValue","immediateValue","execute","destination","targetValue","cloneNode","insertValue","insertAdjacentHTML","outerHTML","insert","immediate","ToggleClassController","hasClassValue","hasMouseEnterValue","hasMouseLeaveValue","useHover","hasClickAwayValue","clickAwayValue","onEvent","contains","rect","getBoundingClientRect","windowHeight","windowWidth","clientWidth","left","isElementInViewport","clickOutside","clickOutsideEvent","useClickOutside","hasInitialValue","toggleTargets","elementOn","elementOff","elementWasToggled","elementToggleStatus","elementToggle","mouseEnter","mouseEnterValue","on","off","mouseLeave","mouseLeaveValue","_this5","toggled","classValue","class","clickAway","initial","TurboFrameRCController","frameSrc","getFrame","getSrc","setSrc","frame","hasLoadingMessageValue","loadingMessageValue","getElementById","frameIdValue","nodeName","hasSrcValue","srcValue","isHTMLLinkElement","href","frameId","loadingMessage","WordCountController","updateWordCount","wordCount","matches","match"],"mappings":"k1BAEaA,cAEX,WAAYC,SAEV,OADAC,cAAMD,aACKE,WAAY,CACrBC,IAAK,SAACC,EAAKC,GACT,IAAIC,EAAYC,QAAQJ,IAAIC,EAAKC,GAC7BG,OACJ,GAmCR,SAAqBH,GACnB,OAAQA,GACN,IAAK,cACL,IAAK,UACL,IAAK,cACL,IAAK,aACL,IAAK,MACL,IAAK,OACL,IAAK,qBACL,IAAK,aACH,SAGJ,QAAI,kBAAkBI,KAAKJ,IAGvB,aAAaI,KAAKJ,IAGlB,oBAAoBI,KAAKJ,IAGzB,aAAaI,KAAKJ,IAzDZK,CAAYL,EAAKM,YAAa,CAChC,GAAwB,mBAAbL,EACT,WAAWJ,MAAMI,EAAW,CAC1BM,eAAMC,EAAaC,EAAcC,GAI/B,OAHAP,EAAKQ,IAAIX,EAAKM,WAAY,CACxBM,KAAMF,IAEDR,QAAQK,MAAMC,EAAQC,EAASC,MAI1Cd,EAAKe,IAAIX,EAAKM,YAGlB,OAAOL,qCAKbU,IAAA,SAAIE,EAAsBD,GAExB,YAFwBA,IAAAA,EAAW,IAE9BE,KAAKC,YAAYC,MAAtB,CAGA,IAAIC,EAASC,QACbD,EAAOE,oBAAoBL,KAAKM,kBAAiBP,EAAgB,iBAAkB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GAEnCyY,SAAS,CACde,QAASnW,OACTqL,IAAKrL,OACLoW,eAAgBpW,YGPPqW,cAAb,wEAeiBxZ,EAAKyZ,gBAAgBnW,oBAftC,2BAiBEzB,QAAA,WACEX,KAAKuY,kBACLvY,KAAK4H,YAAYrF,iBAAiB,QAASvC,KAAKyC,iBAGlDC,WAAA,WACE1C,KAAK4H,YAAYjF,oBAAoB,QAAS3C,KAAKyC,iBAGrD8V,gBAAA,WACE,IAAIC,EAAY,EAEZC,EADgBzY,KAAK4H,YAAYE,MACT4Q,MAAM,QAElC1Y,KAAKgI,aAAaC,WADlBuQ,EAAaC,GAAWA,EAAQ1Q,QAAW,GACHvI,WACpCQ,KAAKkI,gBACHlI,KAAKmI,aAAaqQ,GACpBxY,KAAKgI,aAAaI,UAAUC,OAAOrI,KAAKsI,YAExCtI,KAAKgI,aAAaI,UAAUG,IAAIvI,KAAKsI,gBAK3CH,aAAA,SAAaK,GACX,IAAIC,EAAM,EACNC,EAAM,MAUV,OARI1I,KAAK2I,cACPF,EAAMzI,KAAK4I,UAGT5I,KAAK6I,cACPH,EAAM1I,KAAK8I,UAGNN,GAASC,GAAOD,GAASE,MArDK9J,GAEhC0Z,UAAU,CAAC,QAAS,UACpBA,SAAS,CAAC7P,IAAKM,OAAQL,IAAKK,QAC5BuP,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/turbo_frame_rc_controller.d.ts b/dist/turbo_frame_rc_controller.d.ts new file mode 100644 index 00000000..40256be8 --- /dev/null +++ b/dist/turbo_frame_rc_controller.d.ts @@ -0,0 +1,19 @@ +import { BaseController } from "./base_controller"; +export declare class TurboFrameRCController extends BaseController { + static values: { + frameId: StringConstructor; + src: StringConstructor; + loadingMessage: StringConstructor; + }; + readonly frameIdValue: string; + readonly srcValue: string; + readonly hasSrcValue: boolean; + readonly loadingMessageValue: string; + readonly hasLoadingMessageValue: boolean; + toggle(event?: Event | null): void; + setSrc(event?: Event | null): void; + clear(event?: Event | null): void; + private getFrame; + private getSrc; +} +//# sourceMappingURL=turbo_frame_rc_controller.d.ts.map \ No newline at end of file diff --git a/dist/turbo_frame_rc_controller.d.ts.map b/dist/turbo_frame_rc_controller.d.ts.map new file mode 100644 index 00000000..6244eb5f --- /dev/null +++ b/dist/turbo_frame_rc_controller.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"turbo_frame_rc_controller.d.ts","sourceRoot":"","sources":["../src/turbo_frame_rc_controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAIjD,qBAAa,sBAAuB,SAAQ,cAAc;IAExD,MAAM,CAAC,MAAM;;;;MAIX;IAEF,SAAiB,YAAY,EAAE,MAAM,CAAC;IACtC,SAAiB,QAAQ,EAAE,MAAM,CAAC;IAClC,SAAiB,WAAW,EAAE,OAAO,CAAC;IACtC,SAAiB,mBAAmB,EAAE,MAAM,CAAC;IAC7C,SAAiB,sBAAsB,EAAE,OAAO,CAAC;IAEjD,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAa3B,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAY3B,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAS1B,OAAO,CAAC,QAAQ;IAYhB,OAAO,CAAC,MAAM;CAWf"} \ No newline at end of file diff --git a/dist/utilities/elements.d.ts b/dist/utilities/elements.d.ts new file mode 100644 index 00000000..5865b4d7 --- /dev/null +++ b/dist/utilities/elements.d.ts @@ -0,0 +1,2 @@ +export declare function isHTMLLinkElement(element: Element): element is HTMLLinkElement; +//# sourceMappingURL=elements.d.ts.map \ No newline at end of file diff --git a/dist/utilities/elements.d.ts.map b/dist/utilities/elements.d.ts.map new file mode 100644 index 00000000..6b64d0e0 --- /dev/null +++ b/dist/utilities/elements.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/utilities/elements.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,eAAe,CAE9E"} \ No newline at end of file diff --git a/dist/utilities/turbo.d.ts b/dist/utilities/turbo.d.ts new file mode 100644 index 00000000..7af6f3dc --- /dev/null +++ b/dist/utilities/turbo.d.ts @@ -0,0 +1,2 @@ +export declare function isTurboFrame(element: HTMLElement): element is TurboFrame; +//# sourceMappingURL=turbo.d.ts.map \ No newline at end of file diff --git a/dist/utilities/turbo.d.ts.map b/dist/utilities/turbo.d.ts.map new file mode 100644 index 00000000..22942313 --- /dev/null +++ b/dist/utilities/turbo.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"turbo.d.ts","sourceRoot":"","sources":["../../src/utilities/turbo.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,IAAI,UAAU,CAExE"} \ No newline at end of file diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 3eb1cd39..780a0a1c 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -26,4 +26,5 @@ ** [SelfDestructController](./controllers/self_destruct_controller.md "Stimulus Library - SelfDestructController") ** [TeleportController](./controllers/teleport_controller.md "Stimulus Library - TeleportController") ** [ToggleClassController](./controllers/toggle_class_controller.md "Stimulus Library - ToggleClassController") +** [TurboFrameRCController](./controllers/turbo_frame_rc_controller.md "Stimulus Library - TurboFrameRCController") ** [WordCountController](./controllers/word_count_controller.md "Stimulus Library - WordCountController") diff --git a/docs/controllers/turbo_frame_rc_controller.md b/docs/controllers/turbo_frame_rc_controller.md new file mode 100644 index 00000000..d73adeb2 --- /dev/null +++ b/docs/controllers/turbo_frame_rc_controller.md @@ -0,0 +1,70 @@ +# TurboFrameRCController + +## Purpose + +Remotely set the `src` of TurboFrames, and remotely clear their content. + +Possible use cases: + +1. Modal form. +1. Sidebar links to drive a main-content frame. + + + +## ** Actions ** + +#### [Actions](https://stimulus.hotwire.dev/reference/actions) + +| Action | Purpose | +| --- | --- | +| `teleport` | - | +| `clear` | - | +| `toggle` | - | + +## ** Targets ** + +#### [Targets](https://stimulus.hotwire.dev/reference/targets) + +[no-targets](../_partials/no-targets.md ':include') + +## ** Classes ** + +#### [Classes](https://stimulus.hotwire.dev/reference/classes) + +[no-classes](../_partials/no-classes.md ':include') + +## ** Values ** + +#### [Values](https://stimulus.hotwire.dev/reference/values) + +| Value | Type | Purpose | Default | +| --- | --- | --- | --- | +| `frameId` | String | The ID of the frame to drive | - | +| `src` | String | The URL set the remote frame's `src` to | - | +| `loadingMessage` (Optional) | String | The message to display while content is loading | - | + +## ** Events ** + +#### Events + +[no-events](../_partials/no-events.md ':include') + +## ** Side Effects ** + +None + + + +# How to Use + + + +## ** HTML ** +Example WIP +[comment]: <> ([example](../examples/turbo_frame_rc_controller.erb ':include :type=code')) + +## ** HAML ** +Example WIP +[comment]: <> ([example](../examples/turbo_frame_rc_controller.haml ':include :type=code')) + + diff --git a/package.json b/package.json index ae3ec693..b02d38ab 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "stimulus-library", "description": "A library of useful controllers for Stimulus", - "version": "0.1.1", + "version": "0.1.2", "license": "MIT", "author": "@Sub-Xaero", "repository": { diff --git a/src/index.ts b/src/index.ts index 66669e76..9aec4217 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,4 +23,5 @@ export {ScrollToTopController} from "./scroll_to_top_controller"; export {SelfDestructController} from "./self_destruct_controller"; export {TeleportController} from "./teleport_controller"; export {ToggleClassController} from "./toggle_class_controller"; +export {TurboFrameRCController} from "./turbo_frame_rc_controller"; export {WordCountController} from "./word_count_controller"; diff --git a/src/turbo_frame_rc_controller.ts b/src/turbo_frame_rc_controller.ts new file mode 100644 index 00000000..d8797d2a --- /dev/null +++ b/src/turbo_frame_rc_controller.ts @@ -0,0 +1,76 @@ +import {BaseController} from "./base_controller"; +import {isHTMLLinkElement} from "./utilities/elements"; +import {isTurboFrame} from "./utilities/turbo"; + +export class TurboFrameRCController extends BaseController { + + static values = { + frameId: String, + src: String, + loadingMessage: String, + }; + + declare readonly frameIdValue: string; + declare readonly srcValue: string; + declare readonly hasSrcValue: boolean; + declare readonly loadingMessageValue: string; + declare readonly hasLoadingMessageValue: boolean; + + toggle(event?: Event | null) { + if (event) { + event.preventDefault(); + } + let frame = this.getFrame(); + let frameSrc = frame.src; + if (frameSrc == null || frameSrc !== this.getSrc()) { + this.setSrc(); + } else { + this.clear(); + } + } + + setSrc(event?: Event | null) { + if (event) { + event.preventDefault(); + } + let frame = this.getFrame(); + if (this.hasLoadingMessageValue) { + frame.innerHTML = this.loadingMessageValue; + } + + frame.src = this.getSrc(); + } + + clear(event?: Event | null) { + if (event) { + event.preventDefault(); + } + let frame = this.getFrame(); + frame.src = ""; + frame.innerHTML = ""; + } + + private getFrame(): TurboFrame { + let frame = document.getElementById(`${this.frameIdValue}`); + if (frame == null) { + throw new Error(`Could not find frame with ID '${this.frameIdValue}'`); + } + if (!isTurboFrame(frame)) { + throw new Error(`Element targeted by ID '${this.frameIdValue}'`); + } else { + return frame; + } + } + + private getSrc(): string { + let element = this.element as HTMLElement; + if (this.hasSrcValue) { + return this.srcValue; + } else if (isHTMLLinkElement(element)) { + return element.href; + } else { + throw new Error("No link given to drive frame to"); + } + } + +} diff --git a/src/utilities/elements.ts b/src/utilities/elements.ts new file mode 100644 index 00000000..bfe5bbcd --- /dev/null +++ b/src/utilities/elements.ts @@ -0,0 +1,3 @@ +export function isHTMLLinkElement(element: Element): element is HTMLLinkElement { + return element.nodeName == "A"; +} diff --git a/src/utilities/turbo.ts b/src/utilities/turbo.ts new file mode 100644 index 00000000..8ed24d2b --- /dev/null +++ b/src/utilities/turbo.ts @@ -0,0 +1,3 @@ +export function isTurboFrame(element: HTMLElement): element is TurboFrame { + return element.nodeName == "TURBO-FRAME"; +} diff --git a/src/utilities/types.d.ts b/src/utilities/types.d.ts new file mode 100644 index 00000000..902bbb7d --- /dev/null +++ b/src/utilities/types.d.ts @@ -0,0 +1,4 @@ +interface TurboFrame extends HTMLElement { + nodeName: "TURBO-FRAME" + src: string +}