Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bentoproject/accordion

Package Overview
Dependencies
Maintainers
3
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bentoproject/accordion - npm Package Compare versions

Comparing version 1.2203221937.0 to 1.2203231914.0

2

dist/web-component.js
;
var n=Object.create,r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,i=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,u=function(n){return r(n,"__esModule",{value:!0})},c=function(c){return function(n,i,u){if(i&&"object"==typeof i||"function"==typeof i)for(var c,a=t(i),f=0,l=a.length;f<l;f++)c=a[f],o.call(n,c)||"default"===c||r(n,c,{get:function(n){return i[n]}.bind(null,c),enumerable:!(u=e(i,c))||u.enumerable});return n}(u(r(null!=c?n(i(c)):{},"default",c&&c.__esModule&&"default"in c?{get:function(){return c.default},enumerable:!0}:{value:c,enumerable:!0})),c)};function a(n,r,e){return r in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}function f(n,r){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),e.push.apply(e,t)}return e}function l(n){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?f(Object(e),!0).forEach((function(r){a(n,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):f(Object(e)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))}))}return n}function d(n,r){return(d=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n})(n,r)}function v(n){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function b(n){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function p(n,r){if(r&&("object"===b(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n)}function s(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,t=new Array(r);e<r;e++)t[e]=n[e];return t}!function(n,e){for(var t in u(n),e)r(n,t,{get:e[t],enumerable:!0})}(exports,{defineElement:function(){return sn}}),Array.isArray;var h,y=Object.prototype;function m(n,r){return Object.keys(n).reduce((function(e,t){return r.includes(t)||(e[t]=n[t]),e}),{})}function j(n,r,e){var t=n[r];return void 0===t&&(t=e(n,r),n[r]=t),t}function g(n,r,e,t,i,o,u,c,a,f,l){return n}function O(n,r){return n.replace(/^|,/g,"$&".concat(r," "))}y.hasOwnProperty,y.toString;var S,w=c(require("@bentoproject/core")),x=c(require("@bentoproject/core")),M=c(require("@bentoproject/core")),_=c(require("@bentoproject/core")),A=c(require("@bentoproject/core")),q=c(require("@bentoproject/core"));function E(n){var r=function(n,r){if("object"!==b(n)||null===n)return n;var e=n[Symbol.toPrimitive];if(void 0!==e){var t=e.call(n,"string");if("object"!==b(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===b(r)?r:String(r)}function I(){return S||(S=Promise.resolve(void 0))}function P(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var e=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=e){var t,i,o=[],u=!0,c=!1;try{for(e=e.call(n);!(u=(t=e.next()).done)&&(o.push(t.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==e.return||e.return()}finally{if(c)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return s(n,r);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(n,r):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Y(n,r){if(null==n)return{};var e,t,i={},o=Object.keys(n);for(t=0;t<o.length;t++)e=o[t],r.indexOf(e)>=0||(i[e]=n[e]);return i}var k,C=c(require("@bentoproject/core")),H=c(require("@bentoproject/core")),R=c(require("@bentoproject/core")),T=c(require("@bentoproject/core"));function z(n){var r,e,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(e=n.tabindex)&&void 0!==e?e:n.tabIndex)&&void 0!==r?r:t}c(require("@bentoproject/core")),c(require("@bentoproject/core"));var $=["Webkit","webkit","Moz","moz","ms","O","o"];function B(n,r,e){if(N(r))return r;var t;k||(t=Object.create(null),k=t);var i=k[r];if(!i||e){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var e=0;e<$.length;e++){var t=$[e]+r;if(void 0!==n[t])return t}return""}(n,o);void 0!==n[u]&&(i=u)}e||(k[r]=i)}return i}function D(n,r,e,t,i){var o=B(n.style,r,i);if(o){var u,c=t?e+t:e;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),$.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function F(n,r,e){var t=B(n.style,r,e);if(t)return N(t)?n.style.getPropertyValue(t):n.style[t]}function L(n,r){for(var e in r)D(n,e,r[e])}function N(n){return n.startsWith("--")}function U(n,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var t=r();return t.onfinish=t.oncancel=function(){t=null,e&&e(),n.classList.remove("i-amphtml-animating")},function(){t&&t.cancel()}}function W(n){var r=window.innerHeight,e=Math.abs(n)/r*500;return Math.min(Math.max(e,200),500)}var X,Z=["animate","as","children","expandSingleSection","id"],G=["animate","as","children","expanded","id","onExpandStateChange"],J=C.createContext({}),K=C.createContext({}),Q={},V={},nn=(X=0,function(){return String(++X)}),rn=function(){return String(Math.floor(1e5*Math.random()))},en=(0,R.forwardRef)((function(n,r){var e=n.animate,t=void 0!==e&&e,i=n.as,o=void 0===i?"section":i,u=n.children,c=n.expandSingleSection,f=void 0!==c&&c,d=n.id,v=Y(n,Z),b=P((0,H.useState)(Q),2),p=b[0],s=b[1],h=(0,H.useRef)(V),y=P((0,H.useState)(rn),1)[0],j=d||"a".concat(y);(0,H.useEffect)((function(){f&&s((function(n){var r={},e=0;for(var t in n)r[t]=n[t]&&0==e++;return r}))}),[f]);var g=(0,H.useCallback)((function(n,r,e){var t=e.current;return s((function(e){return tn(n,r,e,f)})),h.current=l(l({},h.current),{},a({},n,t)),function(){s((function(r){return m(r,n)})),h.current=m(h.current,n)}}),[f]),O=(0,H.useCallback)((function(n,r){s((function(e){var t=null!=r?r:!e[n],i=tn(n,t,e,f);return I().then((function(){for(var n in e){var r=h.current[n];r&&e[n]!=i[n]&&r(i[n])}})),i}))}),[f]),S=(0,H.useCallback)((function(n,r){var e;return null!==(e=p[n])&&void 0!==e?e:r}),[p]),w=(0,H.useCallback)((function(n){if(n)n in p&&O(n);else if(!f)for(var r in p)O(r)}),[p,O,f]),x=(0,H.useCallback)((function(n){if(n)S(n,!0)||O(n);else if(!f)for(var r in p)S(r,!0)||O(r)}),[p,O,S,f]),M=(0,H.useCallback)((function(n){if(n)S(n,!1)&&O(n);else for(var r in p)S(r,!1)&&O(r)}),[p,O,S]);(0,H.useImperativeHandle)(r,(function(){return{toggle:w,expand:x,collapse:M}}),[w,M,x]);var _=(0,H.useMemo)((function(){return{registerSection:g,toggleExpanded:O,isExpanded:S,animate:t,prefix:j}}),[g,O,S,t,j]);return C.createElement(o,l({id:d},v),C.createElement(J.Provider,{value:_},u))}));function tn(n,r,e,t){var i;if(t&&r)for(var o in i=a({},n,r),e)o!=n&&(i[o]=!1);else i=l(l({},e),{},a({},n,r));return i}function on(n){var r=n.animate,e=void 0!==r&&r,t=n.as,i=void 0===t?"section":t,o=n.children,u=n.expanded,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,d=Y(n,G),v=P((0,H.useState)(nn),1)[0],b=a||v,p=P((0,H.useState)(rn),1)[0],s=P((0,H.useState)(c),2),h=s[0],y=s[1],m=P((0,H.useState)(null),2),j=m[0],g=m[1],O=P((0,H.useState)(null),2),S=O[0],w=O[1],x=(0,H.useContext)(J),M=x.animate,_=x.isExpanded,A=x.prefix,q=x.registerSection,E=x.toggleExpanded,k=_?_(b,c):h,R=null!=M?M:e,T=j||"".concat(A||"a","-content-").concat(b,"-").concat(p),z=S||"".concat(A||"a","-header-").concat(b,"-").concat(p),$=(0,H.useRef)(null);$.current=f,(0,H.useLayoutEffect)((function(){if(q)return q(b,c,$)}),[q,b,c]);var B=(0,H.useCallback)((function(n){E?E(b,n):y((function(r){var e=null!=n?n:!r;return I().then((function(){var n=$.current;n&&n(e)})),e}))}),[b,E]),D=(0,H.useMemo)((function(){return{animate:R,contentId:T,headerId:z,expanded:k,toggleHandler:B,setContentId:g,setHeaderId:w}}),[R,T,z,k,B]);return C.createElement(i,l({},d),C.createElement(K.Provider,{value:D},o))}function un(n){var r="class",e=n.as,t=void 0===e?"div":e,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,d=Y(n,["as","children","id","role",r].map(E)),v=(0,H.useContext)(K),b=v.contentId,p=v.expanded,s=v.headerId,h=v.setHeaderId,y=v.toggleHandler;return(0,H.useLayoutEffect)((function(){h&&h(o)}),[h,o]),C.createElement(t,l(l({},d),{},{id:s,role:c,class:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabindex:z(d),"aria-controls":b,onClick:function(){return y()},"aria-expanded":String(p)}),i)}function cn(n){var r="class",e=n.as,t=void 0===e?"div":e,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,d=Y(n,["as","children","id","role",r].map(E)),v=(0,H.useRef)(null),b=(0,H.useRef)(!1),p=(0,H.useContext)(K),s=p.animate,h=p.contentId,y=p.expanded,m=p.headerId,j=p.setContentId;return(0,H.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,H.useLayoutEffect)((function(){j&&j(o)}),[j,o]),(0,H.useLayoutEffect)((function(){var n=b.current,r=v.current;if(s&&n&&r&&r.animate)return y?function(n){return U(n,(function(){var r=F(n,"height"),e=F(n,"opacity"),t=F(n,"overflowY");L(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;L(n,{height:r,opacity:e,overflowY:t});var o=W(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return U(n,(function(){var r=n.offsetHeight,e=W(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(r)}),[y,s]),C.createElement(T.WithAmpContext,{renderable:y},C.createElement(t,l(l({},d),{},{ref:v,class:f+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:h,"aria-labelledby":m,role:c}),i))}en.displayName="Accordion";var an=function(n){!function(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(r&&r.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),r&&d(n,r)}(i,M.PreactBaseElement);var r,e,t=(r=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(n){return!1}}(),function(){var n,t=v(r);if(e){var i=v(this).constructor;n=Reflect.construct(t,arguments,i)}else n=t.apply(this,arguments);return p(this,n)});function i(){return t.apply(this,arguments)}return i.prototype.init=function(){var n=this,r=function(r){return function(e){var t;!function(n,r,e){var t=n.hasAttribute(r),i=void 0!==e?e:!t;i!==t&&(i?n.setAttribute(r,""):n.removeAttribute(r))}(r,"expanded",e),null===(t=r.__AMP_PR)||void 0===t||t.call(r),n.triggerEvent(r,e?"expand":"collapse")}},e=this.element,t=new MutationObserver((function(){n.mutateProps(fn(e,t,r))}));return t.observe(e,{attributeFilter:["expanded","id"],subtree:!0,childList:!0}),{"children":fn(e,t,r).children}},i}();function fn(n,r,e){var t,i,o,u,c;return{"children":(i=n,o="section",g(/^[\w-]+$/.test(o)),u=i,c="> ".concat(o),(t=(void 0!==h?h:h=function(n){try{var r=n.ownerDocument,e=r.createElement("div"),t=r.createElement("div");return e.appendChild(t),e.querySelector(":scope div")===t}catch(n){return!1}}(u))?u.querySelectorAll(O(c,":scope")):function(n,r){var e=n.classList,t="i-amphtml-scoped";e.add(t);var i=O(r,".".concat(t)),o=n.querySelectorAll(i);return e.remove(t),o}(u,c))?Array.prototype.slice.call(t):[]).map((function(n){n.__AMP_PR||(n.__AMP_PR=function(){return r.takeRecords()});var t=j(n,"__AMP_H_SHIM",dn),i=j(n,"__AMP_C_SHIM",bn),o=j(n,"__AMP_EXPAND_STATE_SHIM",e),u={"key":n,"expanded":n.hasAttribute("expanded"),"id":n.getAttribute("id"),"onExpandStateChange":o},c={"as":t,"id":n.firstElementChild.getAttribute("id"),"role":n.firstElementChild.getAttribute("role")||void 0},a={"as":i,"id":n.lastElementChild.getAttribute("id"),"role":n.lastElementChild.getAttribute("role")||void 0};return w.createElement(on,l({},u),w.createElement(un,l({},c)),w.createElement(cn,l({},a)))}))}}function ln(n,r){var e=r["aria-controls"],t=r["aria-expanded"],i=r.id,o=r.onClick,u=r.role,c=n.firstElementChild;return(0,x.useLayoutEffect)((function(){if(c&&o)return c.setAttribute("id",i),c.classList.add("i-amphtml-accordion-header"),c.addEventListener("click",o),c.hasAttribute("tabindex")||c.setAttribute("tabindex",0),c.setAttribute("aria-expanded",t),c.setAttribute("aria-controls",e),c.setAttribute("role",u),n.__AMP_PR&&n.__AMP_PR(),function(){c.removeEventListener("click",g(o))}}),[n,c,i,u,o,e,t]),w.createElement("header",null)}var dn=function(n){return ln.bind(null,n)};function vn(n,r,e){var t=r["aria-labelledby"],i=r.id,o=r.role,u=n.lastElementChild,c=(0,x.useRef)();return c.current=u,(0,q.useSlotContext)(c),(0,A.useDOMHandle)(e,u),(0,x.useLayoutEffect)((function(){u&&(u.classList.add("i-amphtml-accordion-content"),u.setAttribute("id",i),u.setAttribute("role",o),u.setAttribute("aria-labelledby",t),n.__AMP_PR&&n.__AMP_PR())}),[n,u,i,o,t]),w.createElement("div",null)}var bn=function(n){return(0,_.forwardRef)(vn.bind(null,n))};an.Component=en,an.detached=!0,an.props={"animate":{attr:"animate",type:"boolean",media:!0},"expandSingleSection":{attr:"expand-single-section",type:"boolean"}};var pn=c(require("@bentoproject/core"));function sn(){(0,pn.defineBentoElement)("bento-accordion",an)}
var n=Object.create,r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,i=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,u=function(n){return r(n,"__esModule",{value:!0})},c=function(c){return function(n,i,u){if(i&&"object"==typeof i||"function"==typeof i)for(var c,a=t(i),f=0,l=a.length;f<l;f++)c=a[f],o.call(n,c)||"default"===c||r(n,c,{get:function(n){return i[n]}.bind(null,c),enumerable:!(u=e(i,c))||u.enumerable});return n}(u(r(null!=c?n(i(c)):{},"default",c&&c.__esModule&&"default"in c?{get:function(){return c.default},enumerable:!0}:{value:c,enumerable:!0})),c)};function a(n,r,e){return r in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}function f(n,r){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),e.push.apply(e,t)}return e}function l(n){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?f(Object(e),!0).forEach((function(r){a(n,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):f(Object(e)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))}))}return n}function d(n,r){return(d=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n})(n,r)}function v(n){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function b(n){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function p(n,r){if(r&&("object"===b(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n)}function s(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,t=new Array(r);e<r;e++)t[e]=n[e];return t}!function(n,e){for(var t in u(n),e)r(n,t,{get:e[t],enumerable:!0})}(exports,{defineElement:function(){return sn}}),Array.isArray;var h,y=Object.prototype;function m(n,r){return Object.keys(n).reduce((function(e,t){return r.includes(t)||(e[t]=n[t]),e}),{})}function j(n,r,e){var t=n[r];return void 0===t&&(t=e(n,r),n[r]=t),t}function g(n,r,e,t,i,o,u,c,a,f,l){return n}function O(n,r){return n.replace(/^|,/g,"$&".concat(r," "))}y.hasOwnProperty,y.toString;var S,w=c(require("@bentoproject/core")),x=c(require("@bentoproject/core")),M=c(require("@bentoproject/core")),_=c(require("@bentoproject/core")),A=c(require("@bentoproject/core")),q=c(require("@bentoproject/core"));function E(n){var r=function(n,r){if("object"!==b(n)||null===n)return n;var e=n[Symbol.toPrimitive];if(void 0!==e){var t=e.call(n,"string");if("object"!==b(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===b(r)?r:String(r)}function I(){return S||(S=Promise.resolve(void 0))}function P(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var e=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=e){var t,i,o=[],u=!0,c=!1;try{for(e=e.call(n);!(u=(t=e.next()).done)&&(o.push(t.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==e.return||e.return()}finally{if(c)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return s(n,r);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(n,r):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Y(n,r){if(null==n)return{};var e,t,i={},o=Object.keys(n);for(t=0;t<o.length;t++)e=o[t],r.indexOf(e)>=0||(i[e]=n[e]);return i}var k,C=c(require("@bentoproject/core")),H=c(require("@bentoproject/core")),R=c(require("@bentoproject/core")),T=c(require("@bentoproject/core"));function z(n){var r,e,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(e=n.tabindex)&&void 0!==e?e:n.tabIndex)&&void 0!==r?r:t}c(require("@bentoproject/core")),c(require("@bentoproject/core"));var $=["Webkit","webkit","Moz","moz","ms","O","o"];function B(n,r,e){if(N(r))return r;var t;k||(t=Object.create(null),k=t);var i=k[r];if(!i||e){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var e=0;e<$.length;e++){var t=$[e]+r;if(void 0!==n[t])return t}return""}(n,o);void 0!==n[u]&&(i=u)}e||(k[r]=i)}return i}function D(n,r,e,t,i){var o=B(n.style,r,i);if(o){var u,c=t?e+t:e;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),$.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function F(n,r,e){var t=B(n.style,r,e);if(t)return N(t)?n.style.getPropertyValue(t):n.style[t]}function L(n,r){for(var e in r)D(n,e,r[e])}function N(n){return n.startsWith("--")}function U(n,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var t=r();return t.onfinish=t.oncancel=function(){t=null,e&&e(),n.classList.remove("i-amphtml-animating")},function(){t&&t.cancel()}}function W(n){var r=window.innerHeight,e=Math.abs(n)/r*500;return Math.min(Math.max(e,200),500)}var X,Z=["animate","as","children","expandSingleSection","id"],G=["animate","as","children","expanded","id","onExpandStateChange"],J=C.createContext({}),K=C.createContext({}),Q={},V={},nn=(X=0,function(){return String(++X)}),rn=function(){return String(Math.floor(1e5*Math.random()))},en=(0,R.forwardRef)((function(n,r){var e=n.animate,t=void 0!==e&&e,i=n.as,o=void 0===i?"section":i,u=n.children,c=n.expandSingleSection,f=void 0!==c&&c,d=n.id,v=Y(n,Z),b=P((0,H.useState)(Q),2),p=b[0],s=b[1],h=(0,H.useRef)(V),y=P((0,H.useState)(rn),1)[0],j=d||"a".concat(y);(0,H.useEffect)((function(){f&&s((function(n){var r={},e=0;for(var t in n)r[t]=n[t]&&0==e++;return r}))}),[f]);var g=(0,H.useCallback)((function(n,r,e){var t=e.current;return s((function(e){return tn(n,r,e,f)})),h.current=l(l({},h.current),{},a({},n,t)),function(){s((function(r){return m(r,n)})),h.current=m(h.current,n)}}),[f]),O=(0,H.useCallback)((function(n,r){s((function(e){var t=null!=r?r:!e[n],i=tn(n,t,e,f);return I().then((function(){for(var n in e){var r=h.current[n];r&&e[n]!=i[n]&&r(i[n])}})),i}))}),[f]),S=(0,H.useCallback)((function(n,r){var e;return null!==(e=p[n])&&void 0!==e?e:r}),[p]),w=(0,H.useCallback)((function(n){if(n)n in p&&O(n);else if(!f)for(var r in p)O(r)}),[p,O,f]),x=(0,H.useCallback)((function(n){if(n)S(n,!0)||O(n);else if(!f)for(var r in p)S(r,!0)||O(r)}),[p,O,S,f]),M=(0,H.useCallback)((function(n){if(n)S(n,!1)&&O(n);else for(var r in p)S(r,!1)&&O(r)}),[p,O,S]);(0,H.useImperativeHandle)(r,(function(){return{toggle:w,expand:x,collapse:M}}),[w,M,x]);var _=(0,H.useMemo)((function(){return{registerSection:g,toggleExpanded:O,isExpanded:S,animate:t,prefix:j}}),[g,O,S,t,j]);return C.createElement(o,l({id:d},v),C.createElement(J.Provider,{value:_},u))}));function tn(n,r,e,t){var i;if(t&&r)for(var o in i=a({},n,r),e)o!=n&&(i[o]=!1);else i=l(l({},e),{},a({},n,r));return i}function on(n){var r=n.animate,e=void 0!==r&&r,t=n.as,i=void 0===t?"section":t,o=n.children,u=n.expanded,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,d=Y(n,G),v=P((0,H.useState)(nn),1)[0],b=a||v,p=P((0,H.useState)(rn),1)[0],s=P((0,H.useState)(c),2),h=s[0],y=s[1],m=P((0,H.useState)(null),2),j=m[0],g=m[1],O=P((0,H.useState)(null),2),S=O[0],w=O[1],x=(0,H.useContext)(J),M=x.animate,_=x.isExpanded,A=x.prefix,q=x.registerSection,E=x.toggleExpanded,k=_?_(b,c):h,R=null!=M?M:e,T=j||"".concat(A||"a","-content-").concat(b,"-").concat(p),z=S||"".concat(A||"a","-header-").concat(b,"-").concat(p),$=(0,H.useRef)(null);$.current=f,(0,H.useLayoutEffect)((function(){if(q)return q(b,c,$)}),[q,b,c]);var B=(0,H.useCallback)((function(n){E?E(b,n):y((function(r){var e=null!=n?n:!r;return I().then((function(){var n=$.current;n&&n(e)})),e}))}),[b,E]),D=(0,H.useMemo)((function(){return{animate:R,contentId:T,headerId:z,expanded:k,toggleHandler:B,setContentId:g,setHeaderId:w}}),[R,T,z,k,B]);return C.createElement(i,l({},d),C.createElement(K.Provider,{value:D},o))}function un(n){var r="class",e=n.as,t=void 0===e?"div":e,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,d=Y(n,["as","children","id","role",r].map(E)),v=(0,H.useContext)(K),b=v.contentId,p=v.expanded,s=v.headerId,h=v.setHeaderId,y=v.toggleHandler;return(0,H.useLayoutEffect)((function(){h&&h(o)}),[h,o]),C.createElement(t,l(l({},d),{},{id:s,role:c,class:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabindex:z(d),"aria-controls":b,onClick:function(){return y()},"aria-expanded":String(p)}),i)}function cn(n){var r="class",e=n.as,t=void 0===e?"div":e,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,d=Y(n,["as","children","id","role",r].map(E)),v=(0,H.useRef)(null),b=(0,H.useRef)(!1),p=(0,H.useContext)(K),s=p.animate,h=p.contentId,y=p.expanded,m=p.headerId,j=p.setContentId;return(0,H.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,H.useLayoutEffect)((function(){j&&j(o)}),[j,o]),(0,H.useLayoutEffect)((function(){var n=b.current,r=v.current;if(s&&n&&r&&r.animate)return y?function(n){return U(n,(function(){var r=F(n,"height"),e=F(n,"opacity"),t=F(n,"overflowY");L(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;L(n,{height:r,opacity:e,overflowY:t});var o=W(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return U(n,(function(){var r=n.offsetHeight,e=W(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(r)}),[y,s]),C.createElement(T.WithAmpContext,{renderable:y},C.createElement(t,l(l({},d),{},{ref:v,class:f+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:h,"aria-labelledby":m,role:c}),i))}en.displayName="Accordion";var an=function(n){!function(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(r&&r.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),r&&d(n,r)}(i,M.PreactBaseElement);var r,e,t=(r=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(n){return!1}}(),function(){var n,t=v(r);if(e){var i=v(this).constructor;n=Reflect.construct(t,arguments,i)}else n=t.apply(this,arguments);return p(this,n)});function i(){return t.apply(this,arguments)}return i.prototype.init=function(){var n=this,r=function(r){return function(e){var t;!function(n,r,e){var t=n.hasAttribute(r),i=void 0!==e?e:!t;i!==t&&(i?n.setAttribute(r,""):n.removeAttribute(r))}(r,"expanded",e),null===(t=r.__AMP_PR)||void 0===t||t.call(r),n.triggerEvent(r,e?"expand":"collapse")}},e=this.element,t=new MutationObserver((function(){n.mutateProps(fn(e,t,r))}));return t.observe(e,{attributeFilter:["expanded","id"],subtree:!0,childList:!0}),{"children":fn(e,t,r).children}},i}();function fn(n,r,e){var t,i,o,u,c;return{"children":(i=n,o="section",g(/^[\w-]+$/.test(o)),u=i,c="> ".concat(o),(t=(void 0!==h?h:h=function(n){try{var r=n.ownerDocument,e=r.createElement("div"),t=r.createElement("div");return e.appendChild(t),e.querySelector(":scope div")===t}catch(n){return!1}}(u))?u.querySelectorAll(O(c,":scope")):function(n,r){var e=n.classList,t="i-amphtml-scoped";e.add(t);var i=O(r,".".concat(t)),o=n.querySelectorAll(i);return e.remove(t),o}(u,c))?Array.prototype.slice.call(t):[]).map((function(n){n.__AMP_PR||(n.__AMP_PR=function(){return r.takeRecords()});var t=j(n,"__AMP_H_SHIM",dn),i=j(n,"__AMP_C_SHIM",bn),o=j(n,"__AMP_EXPAND_STATE_SHIM",e),u={"key":n,"expanded":n.hasAttribute("expanded"),"id":n.getAttribute("id"),"onExpandStateChange":o},c={"as":t,"id":n.firstElementChild.getAttribute("id"),"role":n.firstElementChild.getAttribute("role")||void 0},a={"as":i,"id":n.lastElementChild.getAttribute("id"),"role":n.lastElementChild.getAttribute("role")||void 0};return w.createElement(on,l({},u),w.createElement(un,l({},c)),w.createElement(cn,l({},a)))}))}}function ln(n,r){var e=r["aria-controls"],t=r["aria-expanded"],i=r.id,o=r.onClick,u=r.role,c=n.firstElementChild;return(0,x.useLayoutEffect)((function(){if(c&&o)return c.setAttribute("id",i),c.classList.add("i-amphtml-accordion-header"),c.addEventListener("click",o),c.hasAttribute("tabindex")||c.setAttribute("tabindex",0),c.setAttribute("aria-expanded",t),c.setAttribute("aria-controls",e),c.setAttribute("role",u),n.__AMP_PR&&n.__AMP_PR(),function(){c.removeEventListener("click",g(o))}}),[n,c,i,u,o,e,t]),w.createElement("header",null)}var dn=function(n){return ln.bind(null,n)};function vn(n,r,e){var t=r["aria-labelledby"],i=r.id,o=r.role,u=n.lastElementChild,c=(0,x.useRef)();return c.current=u,(0,q.useSlotContext)(c),(0,A.useDOMHandle)(e,u),(0,x.useLayoutEffect)((function(){u&&(u.classList.add("i-amphtml-accordion-content"),u.setAttribute("id",i),u.setAttribute("role",o),u.setAttribute("aria-labelledby",t),n.__AMP_PR&&n.__AMP_PR())}),[n,u,i,o,t]),w.createElement("div",null)}var bn=function(n){return(0,_.forwardRef)(vn.bind(null,n))};an.Component=en,an.detached=!0,an.props={"animate":{attr:"animate",type:"boolean",media:!0},"expandSingleSection":{attr:"expand-single-section",type:"boolean"}};var pn=c(require("@bentoproject/core"));function sn(n){(0,pn.defineBentoElement)("bento-accordion",an,n)}
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
//# sourceMappingURL=web-component.js.map

@@ -909,4 +909,4 @@ var __create = Object.create;

var import_bento_ce = __toModule(require("@bentoproject/core"));
function defineElement() {
(0, import_bento_ce.defineBentoElement)("bento-accordion", BaseElement);
function defineElement(win) {
(0, import_bento_ce.defineBentoElement)("bento-accordion", BaseElement, win);
}

@@ -913,0 +913,0 @@ /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */

@@ -882,4 +882,4 @@ // src/core/mode/prod.js

import { defineBentoElement } from "@bentoproject/core";
function defineElement() {
defineBentoElement("bento-accordion", BaseElement);
function defineElement(win) {
defineBentoElement("bento-accordion", BaseElement, win);
}

@@ -886,0 +886,0 @@ export {

;
function e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function n(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function t(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?n(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var o,r,{hasOwnProperty:i,toString:c}=Object.prototype;function a(e,n){return Object.keys(e).reduce(((t,o)=>(n.includes(o)||(t[o]=e[o]),t)),{})}function l(e,n,t){let o=e[n];return void 0===o&&(o=t(e,n),e[n]=o),o}function d(e,n,t,o,r,i,c,a,l,d,u){return e}import{createElement as u}from"@bentoproject/core";import{useLayoutEffect as f,useRef as s}from"@bentoproject/core";import{PreactBaseElement as p}from"@bentoproject/core";import{forwardRef as b}from"@bentoproject/core";import{useDOMHandle as m}from"@bentoproject/core";import{useSlotContext as h}from"@bentoproject/core";function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e){var n=function(e,n){if("object"!==v(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==v(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===v(n)?n:String(n)}function x(){return o||(o=Promise.resolve(void 0))}function y(e,n){if(null==e)return{};var t,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],n.indexOf(t)>=0||(r[t]=e[t]);return r}import{createContext as j,createElement as S}from"@bentoproject/core";import{useCallback as O,useContext as w,useEffect as E,useImperativeHandle as I,useLayoutEffect as M,useMemo as _,useRef as $,useState as C}from"@bentoproject/core";import{forwardRef as k}from"@bentoproject/core";import{WithAmpContext as A}from"@bentoproject/core";import{useCallback as H,useLayoutEffect as P}from"@bentoproject/core";import{useAmpContext as Y}from"@bentoproject/core";function z(e,n=0){var t,o;return null!==(t=null!==(o=e.tabindex)&&void 0!==o?o:e.tabIndex)&&void 0!==t?t:n}var L=["Webkit","webkit","Moz","moz","ms","O","o"];function T(e,n,t){if(N(n))return n;r||(r=Object.create(null));let o=r[n];if(!o||t){if(o=n,void 0===e[n]){const t=function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(n),r=function(e,n){for(let t=0;t<L.length;t++){const o=L[t]+n;if(void 0!==e[o])return o}return""}(e,t);void 0!==e[r]&&(o=r)}t||(r[n]=o)}return o}function R(e,n,t,o,r){const i=T(e.style,n,r);if(!i)return;const c=o?t+o:t;e.style.setProperty(function(e){const n=e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()));return L.some((e=>n.startsWith(e+"-")))?`-${n}`:n}(i),c)}function D(e,n,t){const o=T(e.style,n,t);if(o)return N(o)?e.style.getPropertyValue(o):e.style[o]}function F(e,n){for(const t in n)R(e,t,n[t])}function N(e){return e.startsWith("--")}function W(e,n,t){e.classList.add("i-amphtml-animating");let o=n();return o.onfinish=o.oncancel=()=>{o=null,t&&t(),e.classList.remove("i-amphtml-animating")},()=>{o&&o.cancel()}}function X(e){const n=window.innerHeight,t=Math.abs(e)/n*500;return Math.min(Math.max(t,200),500)}var Z=["animate","as","children","expandSingleSection","id"],q=["animate","as","children","expanded","id","onExpandStateChange"],B=j({}),G=j({}),J={},K={},Q=function(){let e=0;return()=>String(++e)}(),U=()=>String(Math.floor(1e5*Math.random())),V=k((function(e,n){let{animate:o=!1,as:r="section",children:i,expandSingleSection:c=!1,id:l}=e,d=y(e,Z);const[u,f]=C(J),s=$(K),[p]=C(U),b=l||`a${p}`;E((()=>{c&&f((e=>{const n={};let t=0;for(const o in e)n[o]=e[o]&&0==t++;return n}))}),[c]);const m=O(((e,n,{current:o})=>(f((t=>ee(e,n,t,c))),s.current=t(t({},s.current),{},{[e]:o}),()=>{f((n=>a(n,e))),s.current=a(s.current,e)})),[c]),h=O(((e,n)=>{f((t=>{const o=null!=n?n:!t[e],r=ee(e,o,t,c);return x().then((()=>{for(const e in t){const n=s.current[e];n&&t[e]!=r[e]&&n(r[e])}})),r}))}),[c]),v=O(((e,n)=>{var t;return null!==(t=u[e])&&void 0!==t?t:n}),[u]),g=O((e=>{if(e)e in u&&h(e);else if(!c)for(const e in u)h(e)}),[u,h,c]),j=O((e=>{if(e)v(e,!0)||h(e);else if(!c)for(const e in u)v(e,!0)||h(e)}),[u,h,v,c]),w=O((e=>{if(e)v(e,!1)&&h(e);else for(const e in u)v(e,!1)&&h(e)}),[u,h,v]);I(n,(()=>({toggle:g,expand:j,collapse:w})),[g,w,j]);const M=_((()=>({registerSection:m,toggleExpanded:h,isExpanded:v,animate:o,prefix:b})),[m,h,v,o,b]);return S(r,t({id:l},d),S(B.Provider,{value:M},i))}));function ee(e,n,o,r){let i;if(r&&n){i={[e]:n};for(const n in o)n!=e&&(i[n]=!1)}else i=t(t({},o),{},{[e]:n});return i}function ne(e){let{animate:n=!1,as:o="section",children:r,expanded:i=!1,id:c,onExpandStateChange:a}=e,l=y(e,q);const[d]=C(Q),u=c||d,[f]=C(U),[s,p]=C(i),[b,m]=C(null),[h,v]=C(null),{animate:g,isExpanded:j,prefix:E,registerSection:I,toggleExpanded:k}=w(B),A=j?j(u,i):s,H=null!=g?g:n,P=b||`${E||"a"}-content-${u}-${f}`,Y=h||`${E||"a"}-header-${u}-${f}`,z=$(null);z.current=a,M((()=>{if(I)return I(u,i,z)}),[I,u,i]);const L=O((e=>{k?k(u,e):p((n=>{const t=null!=e?e:!n;return x().then((()=>{const e=z.current;e&&e(t)})),t}))}),[u,k]),T=_((()=>({animate:H,contentId:P,headerId:Y,expanded:A,toggleHandler:L,setContentId:m,setHeaderId:v})),[H,P,Y,A,L]);return S(o,t({},l),S(G.Provider,{value:T},r))}function te(e){let n="class",{as:o="div",children:r,id:i,role:c="button",[n]:a=""}=e,l=y(e,["as","children","id","role",n].map(g));const{contentId:d,expanded:u,headerId:f,setHeaderId:s,toggleHandler:p}=w(G);return M((()=>{s&&s(i)}),[s,i]),S(o,t(t({},l),{},{id:f,role:c,class:`${a} section-child-76fac82 header-76fac82`,tabindex:z(l),"aria-controls":d,onClick:()=>p(),"aria-expanded":String(u)}),r)}function oe(e){let n="class",{as:o="div",children:r,id:i,role:c="region",[n]:a=""}=e,l=y(e,["as","children","id","role",n].map(g));const d=$(null),u=$(!1),{animate:f,contentId:s,expanded:p,headerId:b,setContentId:m}=w(G);return E((()=>(u.current=!0,()=>u.current=!1)),[]),M((()=>{m&&m(i)}),[m,i]),M((()=>{const e=u.current,n=d.current;if(f&&e&&n&&n.animate)return p?function(e){return W(e,(()=>{const n=D(e,"height"),t=D(e,"opacity"),o=D(e,"overflowY");F(e,{height:0,opacity:0,overflowY:"auto"});const r=e.scrollHeight;F(e,{height:n,opacity:t,overflowY:o});const i=X(r);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:r+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(n):function(e){return W(e,(()=>{const n=e.offsetHeight,t=X(n);return e.animate([{height:n+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(n)}),[p,f]),S(A,{renderable:p},S(o,t(t({},l),{},{ref:d,class:a+" section-child-76fac82"+(p?"":" content-hidden-76fac82"),id:s,"aria-labelledby":b,role:c}),r))}V.displayName="Accordion";var re=class extends p{init(){const e=e=>n=>{var t;!function(e,n,t){const o=e.hasAttribute(n),r=void 0!==t?t:!o;r!==o&&(r?e.setAttribute(n,""):e.removeAttribute(n))}(e,"expanded",n),null===(t=e.__AMP_PR)||void 0===t||t.call(e),this.triggerEvent(e,n?"expand":"collapse")},{element:n}=this,t=new MutationObserver((()=>{this.mutateProps(ie(n,t,e))}));t.observe(n,{attributeFilter:["expanded","id"],subtree:!0,childList:!0});const{"children":o}=ie(n,t,e);return{"children":o}}};function ie(e,n,o){var r,i,c;return{"children":(i=e,c="section",d(/^[\w-]+$/.test(c)),"> section",(r=i.querySelectorAll(function(e,n){return e.replace(/^|,/g,"$&:scope ")}("> section")))?Array.prototype.slice.call(r):[]).map((e=>{e.__AMP_PR||(e.__AMP_PR=()=>n.takeRecords());const r=l(e,"__AMP_H_SHIM",ae),i=l(e,"__AMP_C_SHIM",de),c=l(e,"__AMP_EXPAND_STATE_SHIM",o),a={"key":e,"expanded":e.hasAttribute("expanded"),"id":e.getAttribute("id"),"onExpandStateChange":c},d={"as":r,"id":e.firstElementChild.getAttribute("id"),"role":e.firstElementChild.getAttribute("role")||void 0},f={"as":i,"id":e.lastElementChild.getAttribute("id"),"role":e.lastElementChild.getAttribute("role")||void 0};return u(ne,t({},a),u(te,t({},d)),u(oe,t({},f)))}))}}function ce(e,{"aria-controls":n,"aria-expanded":t,id:o,onClick:r,role:i}){const c=e.firstElementChild;return f((()=>{if(c&&r)return c.setAttribute("id",o),c.classList.add("i-amphtml-accordion-header"),c.addEventListener("click",r),c.hasAttribute("tabindex")||c.setAttribute("tabindex",0),c.setAttribute("aria-expanded",t),c.setAttribute("aria-controls",n),c.setAttribute("role",i),e.__AMP_PR&&e.__AMP_PR(),()=>{c.removeEventListener("click",d(r))}}),[e,c,o,i,r,n,t]),u("header",null)}var ae=e=>ce.bind(null,e);function le(e,{"aria-labelledby":n,id:t,role:o},r){const i=e.lastElementChild,c=s();return c.current=i,h(c),m(r,i),f((()=>{i&&(i.classList.add("i-amphtml-accordion-content"),i.setAttribute("id",t),i.setAttribute("role",o),i.setAttribute("aria-labelledby",n),e.__AMP_PR&&e.__AMP_PR())}),[e,i,t,o,n]),u("div",null)}var de=e=>b(le.bind(null,e));re.Component=V,re.detached=!0,re.props={"animate":{attr:"animate",type:"boolean",media:!0},"expandSingleSection":{attr:"expand-single-section",type:"boolean"}};import{defineBentoElement as ue}from"@bentoproject/core";function fe(){ue("bento-accordion",re)}export{fe as defineElement};
function e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function n(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function t(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?n(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var o,r,{hasOwnProperty:i,toString:c}=Object.prototype;function a(e,n){return Object.keys(e).reduce(((t,o)=>(n.includes(o)||(t[o]=e[o]),t)),{})}function l(e,n,t){let o=e[n];return void 0===o&&(o=t(e,n),e[n]=o),o}function d(e,n,t,o,r,i,c,a,l,d,u){return e}import{createElement as u}from"@bentoproject/core";import{useLayoutEffect as f,useRef as s}from"@bentoproject/core";import{PreactBaseElement as p}from"@bentoproject/core";import{forwardRef as b}from"@bentoproject/core";import{useDOMHandle as m}from"@bentoproject/core";import{useSlotContext as h}from"@bentoproject/core";function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e){var n=function(e,n){if("object"!==v(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==v(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===v(n)?n:String(n)}function x(){return o||(o=Promise.resolve(void 0))}function y(e,n){if(null==e)return{};var t,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],n.indexOf(t)>=0||(r[t]=e[t]);return r}import{createContext as j,createElement as S}from"@bentoproject/core";import{useCallback as O,useContext as w,useEffect as E,useImperativeHandle as I,useLayoutEffect as M,useMemo as _,useRef as $,useState as C}from"@bentoproject/core";import{forwardRef as k}from"@bentoproject/core";import{WithAmpContext as A}from"@bentoproject/core";import{useCallback as H,useLayoutEffect as P}from"@bentoproject/core";import{useAmpContext as Y}from"@bentoproject/core";function z(e,n=0){var t,o;return null!==(t=null!==(o=e.tabindex)&&void 0!==o?o:e.tabIndex)&&void 0!==t?t:n}var L=["Webkit","webkit","Moz","moz","ms","O","o"];function T(e,n,t){if(N(n))return n;r||(r=Object.create(null));let o=r[n];if(!o||t){if(o=n,void 0===e[n]){const t=function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(n),r=function(e,n){for(let t=0;t<L.length;t++){const o=L[t]+n;if(void 0!==e[o])return o}return""}(e,t);void 0!==e[r]&&(o=r)}t||(r[n]=o)}return o}function R(e,n,t,o,r){const i=T(e.style,n,r);if(!i)return;const c=o?t+o:t;e.style.setProperty(function(e){const n=e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()));return L.some((e=>n.startsWith(e+"-")))?`-${n}`:n}(i),c)}function D(e,n,t){const o=T(e.style,n,t);if(o)return N(o)?e.style.getPropertyValue(o):e.style[o]}function F(e,n){for(const t in n)R(e,t,n[t])}function N(e){return e.startsWith("--")}function W(e,n,t){e.classList.add("i-amphtml-animating");let o=n();return o.onfinish=o.oncancel=()=>{o=null,t&&t(),e.classList.remove("i-amphtml-animating")},()=>{o&&o.cancel()}}function X(e){const n=window.innerHeight,t=Math.abs(e)/n*500;return Math.min(Math.max(t,200),500)}var Z=["animate","as","children","expandSingleSection","id"],q=["animate","as","children","expanded","id","onExpandStateChange"],B=j({}),G=j({}),J={},K={},Q=function(){let e=0;return()=>String(++e)}(),U=()=>String(Math.floor(1e5*Math.random())),V=k((function(e,n){let{animate:o=!1,as:r="section",children:i,expandSingleSection:c=!1,id:l}=e,d=y(e,Z);const[u,f]=C(J),s=$(K),[p]=C(U),b=l||`a${p}`;E((()=>{c&&f((e=>{const n={};let t=0;for(const o in e)n[o]=e[o]&&0==t++;return n}))}),[c]);const m=O(((e,n,{current:o})=>(f((t=>ee(e,n,t,c))),s.current=t(t({},s.current),{},{[e]:o}),()=>{f((n=>a(n,e))),s.current=a(s.current,e)})),[c]),h=O(((e,n)=>{f((t=>{const o=null!=n?n:!t[e],r=ee(e,o,t,c);return x().then((()=>{for(const e in t){const n=s.current[e];n&&t[e]!=r[e]&&n(r[e])}})),r}))}),[c]),v=O(((e,n)=>{var t;return null!==(t=u[e])&&void 0!==t?t:n}),[u]),g=O((e=>{if(e)e in u&&h(e);else if(!c)for(const e in u)h(e)}),[u,h,c]),j=O((e=>{if(e)v(e,!0)||h(e);else if(!c)for(const e in u)v(e,!0)||h(e)}),[u,h,v,c]),w=O((e=>{if(e)v(e,!1)&&h(e);else for(const e in u)v(e,!1)&&h(e)}),[u,h,v]);I(n,(()=>({toggle:g,expand:j,collapse:w})),[g,w,j]);const M=_((()=>({registerSection:m,toggleExpanded:h,isExpanded:v,animate:o,prefix:b})),[m,h,v,o,b]);return S(r,t({id:l},d),S(B.Provider,{value:M},i))}));function ee(e,n,o,r){let i;if(r&&n){i={[e]:n};for(const n in o)n!=e&&(i[n]=!1)}else i=t(t({},o),{},{[e]:n});return i}function ne(e){let{animate:n=!1,as:o="section",children:r,expanded:i=!1,id:c,onExpandStateChange:a}=e,l=y(e,q);const[d]=C(Q),u=c||d,[f]=C(U),[s,p]=C(i),[b,m]=C(null),[h,v]=C(null),{animate:g,isExpanded:j,prefix:E,registerSection:I,toggleExpanded:k}=w(B),A=j?j(u,i):s,H=null!=g?g:n,P=b||`${E||"a"}-content-${u}-${f}`,Y=h||`${E||"a"}-header-${u}-${f}`,z=$(null);z.current=a,M((()=>{if(I)return I(u,i,z)}),[I,u,i]);const L=O((e=>{k?k(u,e):p((n=>{const t=null!=e?e:!n;return x().then((()=>{const e=z.current;e&&e(t)})),t}))}),[u,k]),T=_((()=>({animate:H,contentId:P,headerId:Y,expanded:A,toggleHandler:L,setContentId:m,setHeaderId:v})),[H,P,Y,A,L]);return S(o,t({},l),S(G.Provider,{value:T},r))}function te(e){let n="class",{as:o="div",children:r,id:i,role:c="button",[n]:a=""}=e,l=y(e,["as","children","id","role",n].map(g));const{contentId:d,expanded:u,headerId:f,setHeaderId:s,toggleHandler:p}=w(G);return M((()=>{s&&s(i)}),[s,i]),S(o,t(t({},l),{},{id:f,role:c,class:`${a} section-child-76fac82 header-76fac82`,tabindex:z(l),"aria-controls":d,onClick:()=>p(),"aria-expanded":String(u)}),r)}function oe(e){let n="class",{as:o="div",children:r,id:i,role:c="region",[n]:a=""}=e,l=y(e,["as","children","id","role",n].map(g));const d=$(null),u=$(!1),{animate:f,contentId:s,expanded:p,headerId:b,setContentId:m}=w(G);return E((()=>(u.current=!0,()=>u.current=!1)),[]),M((()=>{m&&m(i)}),[m,i]),M((()=>{const e=u.current,n=d.current;if(f&&e&&n&&n.animate)return p?function(e){return W(e,(()=>{const n=D(e,"height"),t=D(e,"opacity"),o=D(e,"overflowY");F(e,{height:0,opacity:0,overflowY:"auto"});const r=e.scrollHeight;F(e,{height:n,opacity:t,overflowY:o});const i=X(r);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:r+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(n):function(e){return W(e,(()=>{const n=e.offsetHeight,t=X(n);return e.animate([{height:n+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(n)}),[p,f]),S(A,{renderable:p},S(o,t(t({},l),{},{ref:d,class:a+" section-child-76fac82"+(p?"":" content-hidden-76fac82"),id:s,"aria-labelledby":b,role:c}),r))}V.displayName="Accordion";var re=class extends p{init(){const e=e=>n=>{var t;!function(e,n,t){const o=e.hasAttribute(n),r=void 0!==t?t:!o;r!==o&&(r?e.setAttribute(n,""):e.removeAttribute(n))}(e,"expanded",n),null===(t=e.__AMP_PR)||void 0===t||t.call(e),this.triggerEvent(e,n?"expand":"collapse")},{element:n}=this,t=new MutationObserver((()=>{this.mutateProps(ie(n,t,e))}));t.observe(n,{attributeFilter:["expanded","id"],subtree:!0,childList:!0});const{"children":o}=ie(n,t,e);return{"children":o}}};function ie(e,n,o){var r,i,c;return{"children":(i=e,c="section",d(/^[\w-]+$/.test(c)),"> section",(r=i.querySelectorAll(function(e,n){return e.replace(/^|,/g,"$&:scope ")}("> section")))?Array.prototype.slice.call(r):[]).map((e=>{e.__AMP_PR||(e.__AMP_PR=()=>n.takeRecords());const r=l(e,"__AMP_H_SHIM",ae),i=l(e,"__AMP_C_SHIM",de),c=l(e,"__AMP_EXPAND_STATE_SHIM",o),a={"key":e,"expanded":e.hasAttribute("expanded"),"id":e.getAttribute("id"),"onExpandStateChange":c},d={"as":r,"id":e.firstElementChild.getAttribute("id"),"role":e.firstElementChild.getAttribute("role")||void 0},f={"as":i,"id":e.lastElementChild.getAttribute("id"),"role":e.lastElementChild.getAttribute("role")||void 0};return u(ne,t({},a),u(te,t({},d)),u(oe,t({},f)))}))}}function ce(e,{"aria-controls":n,"aria-expanded":t,id:o,onClick:r,role:i}){const c=e.firstElementChild;return f((()=>{if(c&&r)return c.setAttribute("id",o),c.classList.add("i-amphtml-accordion-header"),c.addEventListener("click",r),c.hasAttribute("tabindex")||c.setAttribute("tabindex",0),c.setAttribute("aria-expanded",t),c.setAttribute("aria-controls",n),c.setAttribute("role",i),e.__AMP_PR&&e.__AMP_PR(),()=>{c.removeEventListener("click",d(r))}}),[e,c,o,i,r,n,t]),u("header",null)}var ae=e=>ce.bind(null,e);function le(e,{"aria-labelledby":n,id:t,role:o},r){const i=e.lastElementChild,c=s();return c.current=i,h(c),m(r,i),f((()=>{i&&(i.classList.add("i-amphtml-accordion-content"),i.setAttribute("id",t),i.setAttribute("role",o),i.setAttribute("aria-labelledby",n),e.__AMP_PR&&e.__AMP_PR())}),[e,i,t,o,n]),u("div",null)}var de=e=>b(le.bind(null,e));re.Component=V,re.detached=!0,re.props={"animate":{attr:"animate",type:"boolean",media:!0},"expandSingleSection":{attr:"expand-single-section",type:"boolean"}};import{defineBentoElement as ue}from"@bentoproject/core";function fe(e){ue("bento-accordion",re,e)}export{fe as defineElement};
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
//# sourceMappingURL=web-component.module.js.map
{
"name": "@bentoproject/accordion",
"version": "1.2203221937.0",
"version": "1.2203231914.0",
"description": "Displays content sections that can be collapsed and expanded.",

@@ -45,4 +45,4 @@ "author": "Bento Authors",

"dependencies": {
"@bentoproject/core": "0.2203221937.0"
"@bentoproject/core": "0.2203231914.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc