{"version":3,"file":"scroll-action-controller-Cu0yK8Dp.js","sources":["../../../app/frontend/src/jobseeker/account/js/controllers/scroll-action-controller.js"],"sourcesContent":["import { Controller } from '@hotwired/stimulus';\nimport { useIntersection } from 'stimulus-use';\n\nexport default class extends Controller {\n static classes = ['toggle'];\n static targets = ['sentinel', 'class'];\n static values = {\n threshold: { type: Number, default: 1 },\n rootMargin: { type: String, default: '0px 0px 0px 0px' }\n };\n\n connect() {\n if (this.hasSentinelTarget) {\n this.observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n this.classTarget.classList.remove(...this.toggleClasses);\n } else {\n this.classTarget.classList.add(...this.toggleClasses);\n }\n });\n });\n\n this.observer.observe(this.sentinelTarget);\n } else {\n useIntersection(this, {\n threshold: this.thresholdValue,\n rootMargin: this.rootMarginValue\n });\n }\n\n this.checkInitialState();\n }\n\n checkInitialState() {\n if (this.hasSentinelTarget) return;\n\n if (this.isVisible()) {\n this.appear({ target: this.element });\n } else {\n this.disappear({ target: this.element });\n }\n }\n\n disconnect() {\n if (this.observer) {\n this.observer.disconnect();\n }\n }\n\n appear(entry) {\n entry.target.classList.remove(...this.toggleClasses);\n }\n\n disappear(entry) {\n entry.target.classList.add(...this.toggleClasses);\n }\n}\n"],"names":["ScrollActionController","Controller","entries","entry","useIntersection","__publicField"],"mappings":"mQAGe,MAAKA,UAASC,CAAW,CAQtC,SAAU,CACJ,KAAK,mBACP,KAAK,SAAW,IAAI,qBAAsBC,GAAY,CACpDA,EAAQ,QAASC,GAAU,CACrBA,EAAM,eACR,KAAK,YAAY,UAAU,OAAO,GAAG,KAAK,aAAa,EAEvD,KAAK,YAAY,UAAU,IAAI,GAAG,KAAK,aAAa,CAEhE,CAAS,CACT,CAAO,EAED,KAAK,SAAS,QAAQ,KAAK,cAAc,GAEzCC,EAAgB,KAAM,CACpB,UAAW,KAAK,eAChB,WAAY,KAAK,eACzB,CAAO,EAGH,KAAK,kBAAmB,CAC5B,CAEE,mBAAoB,CACd,KAAK,oBAEL,KAAK,YACP,KAAK,OAAO,CAAE,OAAQ,KAAK,OAAO,CAAE,EAEpC,KAAK,UAAU,CAAE,OAAQ,KAAK,OAAO,CAAE,EAE7C,CAEE,YAAa,CACP,KAAK,UACP,KAAK,SAAS,WAAY,CAEhC,CAEE,OAAOD,EAAO,CACZA,EAAM,OAAO,UAAU,OAAO,GAAG,KAAK,aAAa,CACvD,CAEE,UAAUA,EAAO,CACfA,EAAM,OAAO,UAAU,IAAI,GAAG,KAAK,aAAa,CACpD,CACA,CArDEE,EADkBL,EACX,UAAU,CAAC,QAAQ,GAC1BK,EAFkBL,EAEX,UAAU,CAAC,WAAY,OAAO,GACrCK,EAHkBL,EAGX,SAAS,CACd,UAAW,CAAE,KAAM,OAAQ,QAAS,CAAG,EACvC,WAAY,CAAE,KAAM,OAAQ,QAAS,iBAAiB,CACvD"}