@ampproject/amp-accordion
Advanced tools
Comparing version 1.2108232044.0 to 1.2108242314.0
; | ||
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__markAsModule=function(e){return __defProp(e,"__esModule",{value:!0})},__export=function(e,t){for(var r in __markAsModule(e),t)__defProp(e,r,{get:t[r],enumerable:!0})},__reExport=function(e,t,r){if(t&&"object"==typeof t||"function"==typeof t)for(var n,o=__getOwnPropNames(t),a=0,i=o.length;a<i;a++)n=o[a],__hasOwnProp.call(e,n)||"default"===n||__defProp(e,n,{get:function(e){return t[e]}.bind(null,n),enumerable:!(r=__getOwnPropDesc(t,n))||r.enumerable});return e},__toModule=function(e){return __reExport(__markAsModule(__defProp(null!=e?__create(__getProtoOf(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};__export(exports,{Accordion:function(){return Accordion},AccordionContent:function(){return AccordionContent},AccordionHeader:function(){return AccordionHeader},AccordionSection:function(){return AccordionSection}});var resolved,$sectionChild="section-child-00fce3c",$header="header-00fce3c",$contentHidden="content-hidden-00fce3c";function resolvedPromise(){return resolved||(resolved=Promise.resolve(void 0))}function sequentialIdGenerator(){var e=0;return function(){return String(++e)}}function randomIdGenerator(e){return function(){return String(Math.floor(Math.random()*e))}}var _Object$prototype=Object.prototype,hasOwn_=_Object$prototype.hasOwnProperty,toString_=_Object$prototype.toString;function map(e){var t=Object.create(null);return e&&Object.assign(t,e),t}function omit(e,t){return Object.keys(e).reduce((function(r,n){return t.includes(n)||(r[n]=e[n]),r}),{})}var preact=__toModule(require("preact")),preactDOM=__toModule(require("preact")),hooks=__toModule(require("preact/hooks"));function createElement2(e,t,r){return preact.createElement.apply(void 0,arguments)}function createContext2(e){return preact.createContext(e,void 0)}function useState2(e){return hooks.useState(e)}function useRef2(e){return hooks.useRef(e)}function useEffect2(e,t){hooks.useEffect(e,t)}function useLayoutEffect2(e,t){hooks.useLayoutEffect(e,t)}function useContext2(e){return hooks.useContext(e)}function useMemo2(e,t){return hooks.useMemo(e,t)}function useCallback2(e,t){return hooks.useCallback(e,t)}function useImperativeHandle2(e,t,r){return hooks.useImperativeHandle(e,t,r)}var _MAP,compat=__toModule(require("preact/compat"));function forwardRef2(e){return compat.forwardRef(e)}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var context,Loading={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ORDER=[Loading.AUTO,Loading.LAZY,Loading.EAGER,Loading.UNLOAD],MAP=(_defineProperty(_MAP={},Loading.AUTO,0),_defineProperty(_MAP,Loading.LAZY,1),_defineProperty(_MAP,Loading.EAGER,2),_defineProperty(_MAP,Loading.UNLOAD,3),_MAP);function reducer(e,t){var r=MAP[e]||0,n=MAP[t]||0,o=Math.max(r,n);return ORDER[o]}function getAmpContext(){return context||(context=createContext2({renderable:!0,playable:!0,loading:Loading.AUTO}))}function WithAmpContext(e){var t=e.children,r=e.loading,n=void 0===r?"auto":r,o=e.notify,a=e.playable,i=void 0===a||a,c=e.renderable,u=void 0===c||c,d=useAmpContext(),l=u&&d.renderable,s=l&&i&&d.playable,f=reducer(l?Loading.AUTO:Loading.LAZY,reducer(n,d.loading)),p=o||d.notify,_=useMemo2((function(){return{renderable:l,playable:s,loading:f,notify:p}}),[l,s,f,p]);return createElement2(getAmpContext().Provider,{children:t,value:_})}function useAmpContext(){return useContext2(getAmpContext())}var propertyNameCache,isArray=Array.isArray,vendorPrefixes=["Webkit","webkit","Moz","moz","ms","O","o"];function camelCaseToTitleCase(e){return e.charAt(0).toUpperCase()+e.slice(1)}function getVendorJsPropertyName_(e,t){for(var r=0;r<vendorPrefixes.length;r++){var n=vendorPrefixes[r]+t;if(void 0!==e[n])return n}return""}function getVendorJsPropertyName(e,t,r){if(isVar(t))return t;propertyNameCache||(propertyNameCache=map());var n=propertyNameCache[t];if(!n||r){if(n=t,void 0===e[t]){var o=getVendorJsPropertyName_(e,camelCaseToTitleCase(t));void 0!==e[o]&&(n=o)}r||(propertyNameCache[t]=n)}return n}function setStyle(e,t,r,n,o){var a=getVendorJsPropertyName(e.style,t,o);if(a){var i=n?r+n:r;isVar(a)?e.style.setProperty(a,i):e.style[a]=i}}function getStyle(e,t,r){var n=getVendorJsPropertyName(e.style,t,r);if(n)return isVar(n)?e.style.getPropertyValue(n):e.style[n]}function setStyles(e,t){for(var r in t)setStyle(e,r,t[r])}function isVar(e){return e.startsWith("--")}var MAX_TRANSITION_DURATION=500,MIN_TRANSITION_DURATION=200,EXPAND_CURVE="cubic-bezier(0.47, 0, 0.745, 0.715)",COLLAPSE_CURVE="cubic-bezier(0.39, 0.575, 0.565, 1)";function animateExpand(e){return animate(e,(function(){var t=getStyle(e,"height"),r=getStyle(e,"opacity"),n=getStyle(e,"overflowY");setStyles(e,{height:0,opacity:0,overflowY:"auto"});var o=e.scrollHeight;setStyles(e,{height:t,opacity:r,overflowY:n});var a=getTransitionDuration(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:EXPAND_CURVE,duration:a})}))}function animateCollapse(e){return animate(e,(function(){var t=e.offsetHeight,r=getTransitionDuration(t);return e.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:COLLAPSE_CURVE,duration:r})}))}function animate(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;e.classList.add("i-amphtml-animating");var n=t();return n.onfinish=n.oncancel=function(){n=null,r&&r(),e.classList.remove("i-amphtml-animating")},function(){n&&n.cancel()}}function getTransitionDuration(e){var t=window.innerHeight,r=Math.abs(e)/t*MAX_TRANSITION_DURATION;return Math.min(Math.max(r,MIN_TRANSITION_DURATION),MAX_TRANSITION_DURATION)}var _excluded=["animate","as","children","expandSingleSection","id"],_excluded2=["animate","as","children","expanded","id","onExpandStateChange"],_excluded3=["as","children","class","id","role","tabIndex"],_excluded4=["as","children","class","id","role"];function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty2(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty2(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,o=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}var AccordionContext=createContext2({}),SectionContext=createContext2({}),EMPTY_EXPANDED_MAP={},EMPTY_EVENT_MAP={},generateSectionId=sequentialIdGenerator(),generateRandomId=randomIdGenerator(1e5);function AccordionWithRef(e,t){var r=e.animate,n=void 0!==r&&r,o=e.as,a=void 0===o?"section":o,i=e.children,c=e.expandSingleSection,u=void 0!==c&&c,d=e.id,l=_objectWithoutProperties(e,_excluded),s=_slicedToArray(useState2(EMPTY_EXPANDED_MAP),2),f=s[0],p=s[1],_=useRef2(EMPTY_EVENT_MAP),y=_slicedToArray(useState2(generateRandomId),1)[0],v=d||"a".concat(y);useEffect2((function(){u&&p((function(e){var t={},r=0;for(var n in e)t[n]=e[n]&&0==r++;return t}))}),[u]);var m=useCallback2((function(e,t,r){var n=r.current;return p((function(r){return setExpanded(e,t,r,u)})),_.current=_objectSpread(_objectSpread({},_.current),{},_defineProperty2({},e,n)),function(){p((function(t){return omit(t,e)})),_.current=omit(_.current,e)}}),[u]),b=useCallback2((function(e,t){p((function(r){var n=null!=t?t:!r[e],o=setExpanded(e,n,r,u);return resolvedPromise().then((function(){for(var e in r){var t=_.current[e];t&&r[e]!=o[e]&&t(o[e])}})),o}))}),[u]),g=useCallback2((function(e,t){var r;return null!==(r=f[e])&&void 0!==r?r:t}),[f]),h=useCallback2((function(e){if(e)e in f&&b(e);else if(!u)for(var t in f)b(t)}),[f,b,u]),A=useCallback2((function(e){if(e)g(e,!0)||b(e);else if(!u)for(var t in f)g(t,!0)||b(t)}),[f,b,g,u]),P=useCallback2((function(e){if(e)g(e,!1)&&b(e);else for(var t in f)g(t,!1)&&b(t)}),[f,b,g]);useImperativeHandle2(t,(function(){return{toggle:h,expand:A,collapse:P}}),[h,P,A]);var O=useMemo2((function(){return{registerSection:m,toggleExpanded:b,isExpanded:g,animate:n,prefix:v}}),[m,b,g,n,v]);return createElement2(a,_objectSpread({id:d},l),createElement2(AccordionContext.Provider,{value:O},i))}var Accordion=forwardRef2(AccordionWithRef);function setExpanded(e,t,r,n){var o;if(n&&t)for(var a in o=_defineProperty2({},e,t),r)a!=e&&(o[a]=!1);else o=_objectSpread(_objectSpread({},r),{},_defineProperty2({},e,t));return o}function AccordionSection(e){var t=e.animate,r=void 0!==t&&t,n=e.as,o=void 0===n?"section":n,a=e.children,i=e.expanded,c=void 0!==i&&i,u=e.id,d=e.onExpandStateChange,l=_objectWithoutProperties(e,_excluded2),s=_slicedToArray(useState2(generateSectionId),1)[0],f=u||s,p=_slicedToArray(useState2(generateRandomId),1)[0],_=_slicedToArray(useState2(c),2),y=_[0],v=_[1],m=_slicedToArray(useState2(null),2),b=m[0],g=m[1],h=_slicedToArray(useState2(null),2),A=h[0],P=h[1],O=useContext2(AccordionContext),x=O.animate,S=O.isExpanded,E=O.prefix,C=O.registerSection,j=O.toggleExpanded,I=S?S(f,c):y,T=null!=x?x:r,M=b||"".concat(E||"a","-content-").concat(f,"-").concat(p),w=A||"".concat(E||"a","-header-").concat(f,"-").concat(p),N=useRef2(null);N.current=d,useLayoutEffect2((function(){if(C)return C(f,c,N)}),[C,f,c]);var L=useCallback2((function(e){j?j(f,e):v((function(t){var r=null!=e?e:!t;return resolvedPromise().then((function(){var e=N.current;e&&e(r)})),r}))}),[f,j]),R=useMemo2((function(){return{animate:T,contentId:M,headerId:w,expanded:I,toggleHandler:L,setContentId:g,setHeaderId:P}}),[T,M,w,I,L]);return createElement2(o,_objectSpread(_objectSpread({},l),{},{expanded:I}),createElement2(SectionContext.Provider,{value:R},a))}function AccordionHeader(e){var t=e.as,r=void 0===t?"div":t,n=e.children,o=e.class,a=void 0===o?"":o,i=e.id,c=e.role,u=void 0===c?"button":c,d=e.tabIndex,l=void 0===d?0:d,s=_objectWithoutProperties(e,_excluded3),f=useContext2(SectionContext),p=f.contentId,_=f.expanded,y=f.headerId,v=f.setHeaderId,m=f.toggleHandler;return useLayoutEffect2((function(){v&&v(i)}),[v,i]),createElement2(r,_objectSpread(_objectSpread({},s),{},{id:y,role:u,class:"".concat(a," ").concat($sectionChild," ").concat($header),tabIndex:l,"aria-controls":p,onClick:function(){return m()},"aria-expanded":String(_)}),n)}function AccordionContent(e){var t=e.as,r=void 0===t?"div":t,n=e.children,o=e.class,a=void 0===o?"":o,i=e.id,c=e.role,u=void 0===c?"region":c,d=_objectWithoutProperties(e,_excluded4),l=useRef2(null),s=useRef2(!1),f=useContext2(SectionContext),p=f.animate,_=f.contentId,y=f.expanded,v=f.headerId,m=f.setContentId;return useEffect2((function(){return s.current=!0,function(){return s.current=!1}}),[]),useLayoutEffect2((function(){m&&m(i)}),[m,i]),useLayoutEffect2((function(){var e=s.current,t=l.current;if(p&&e&&t&&t.animate)return y?animateExpand(t):animateCollapse(t)}),[y,p]),createElement2(WithAmpContext,{renderable:y},createElement2(r,_objectSpread(_objectSpread({},d),{},{ref:l,class:a+" "+$sectionChild+(y?"":" "+$contentHidden),id:_,"aria-labelledby":v,role:u}),n))}Accordion.displayName="Accordion"; | ||
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__markAsModule=function(e){return __defProp(e,"__esModule",{value:!0})},__export=function(e,t){for(var r in __markAsModule(e),t)__defProp(e,r,{get:t[r],enumerable:!0})},__reExport=function(e,t,r){if(t&&"object"==typeof t||"function"==typeof t)for(var n,o=__getOwnPropNames(t),a=0,i=o.length;a<i;a++)n=o[a],__hasOwnProp.call(e,n)||"default"===n||__defProp(e,n,{get:function(e){return t[e]}.bind(null,n),enumerable:!(r=__getOwnPropDesc(t,n))||r.enumerable});return e},__toModule=function(e){return __reExport(__markAsModule(__defProp(null!=e?__create(__getProtoOf(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};__export(exports,{Accordion:function(){return Accordion},AccordionContent:function(){return AccordionContent},AccordionHeader:function(){return AccordionHeader},AccordionSection:function(){return AccordionSection}});var resolved,$sectionChild="section-child-00fce3c",$header="header-00fce3c",$contentHidden="content-hidden-00fce3c";function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function resolvedPromise(){return resolved||(resolved=Promise.resolve(void 0))}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}function _nonIterableRest(){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 _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function sequentialIdGenerator(){var e=0;return function(){return String(++e)}}function randomIdGenerator(e){return function(){return String(Math.floor(Math.random()*e))}}var _Object$prototype=Object.prototype,hasOwn_=_Object$prototype.hasOwnProperty,toString_=_Object$prototype.toString;function map(e){var t=Object.create(null);return e&&Object.assign(t,e),t}function omit(e,t){return Object.keys(e).reduce((function(r,n){return t.includes(n)||(r[n]=e[n]),r}),{})}var preact=__toModule(require("preact")),preactDOM=__toModule(require("preact")),hooks=__toModule(require("preact/hooks"));function createElement2(e,t,r){return preact.createElement.apply(void 0,arguments)}function createContext2(e){return preact.createContext(e,void 0)}function useState2(e){return hooks.useState(e)}function useRef2(e){return hooks.useRef(e)}function useEffect2(e,t){hooks.useEffect(e,t)}function useLayoutEffect2(e,t){hooks.useLayoutEffect(e,t)}function useContext2(e){return hooks.useContext(e)}function useMemo2(e,t){return hooks.useMemo(e,t)}function useCallback2(e,t){return hooks.useCallback(e,t)}function useImperativeHandle2(e,t,r){return hooks.useImperativeHandle(e,t,r)}var _MAP,compat=__toModule(require("preact/compat"));function forwardRef2(e){return compat.forwardRef(e)}var context,Loading={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ORDER=[Loading.AUTO,Loading.LAZY,Loading.EAGER,Loading.UNLOAD],MAP=(_defineProperty(_MAP={},Loading.AUTO,0),_defineProperty(_MAP,Loading.LAZY,1),_defineProperty(_MAP,Loading.EAGER,2),_defineProperty(_MAP,Loading.UNLOAD,3),_MAP);function reducer(e,t){var r=MAP[e]||0,n=MAP[t]||0,o=Math.max(r,n);return ORDER[o]}function getAmpContext(){return context||(context=createContext2({renderable:!0,playable:!0,loading:Loading.AUTO}))}function WithAmpContext(e){var t=e.children,r=e.loading,n=void 0===r?"auto":r,o=e.notify,a=e.playable,i=void 0===a||a,c=e.renderable,u=void 0===c||c,d=useAmpContext(),l=u&&d.renderable,s=l&&i&&d.playable,f=reducer(l?Loading.AUTO:Loading.LAZY,reducer(n,d.loading)),p=o||d.notify,_=useMemo2((function(){return{renderable:l,playable:s,loading:f,notify:p}}),[l,s,f,p]);return createElement2(getAmpContext().Provider,{children:t,value:_})}function useAmpContext(){return useContext2(getAmpContext())}var propertyNameCache,isArray=Array.isArray,vendorPrefixes=["Webkit","webkit","Moz","moz","ms","O","o"];function camelCaseToTitleCase(e){return e.charAt(0).toUpperCase()+e.slice(1)}function getVendorJsPropertyName_(e,t){for(var r=0;r<vendorPrefixes.length;r++){var n=vendorPrefixes[r]+t;if(void 0!==e[n])return n}return""}function getVendorJsPropertyName(e,t,r){if(isVar(t))return t;propertyNameCache||(propertyNameCache=map());var n=propertyNameCache[t];if(!n||r){if(n=t,void 0===e[t]){var o=getVendorJsPropertyName_(e,camelCaseToTitleCase(t));void 0!==e[o]&&(n=o)}r||(propertyNameCache[t]=n)}return n}function setStyle(e,t,r,n,o){var a=getVendorJsPropertyName(e.style,t,o);if(a){var i=n?r+n:r;isVar(a)?e.style.setProperty(a,i):e.style[a]=i}}function getStyle(e,t,r){var n=getVendorJsPropertyName(e.style,t,r);if(n)return isVar(n)?e.style.getPropertyValue(n):e.style[n]}function setStyles(e,t){for(var r in t)setStyle(e,r,t[r])}function isVar(e){return e.startsWith("--")}var MAX_TRANSITION_DURATION=500,MIN_TRANSITION_DURATION=200,EXPAND_CURVE="cubic-bezier(0.47, 0, 0.745, 0.715)",COLLAPSE_CURVE="cubic-bezier(0.39, 0.575, 0.565, 1)";function animateExpand(e){return animate(e,(function(){var t=getStyle(e,"height"),r=getStyle(e,"opacity"),n=getStyle(e,"overflowY");setStyles(e,{height:0,opacity:0,overflowY:"auto"});var o=e.scrollHeight;setStyles(e,{height:t,opacity:r,overflowY:n});var a=getTransitionDuration(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:EXPAND_CURVE,duration:a})}))}function animateCollapse(e){return animate(e,(function(){var t=e.offsetHeight,r=getTransitionDuration(t);return e.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:COLLAPSE_CURVE,duration:r})}))}function animate(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;e.classList.add("i-amphtml-animating");var n=t();return n.onfinish=n.oncancel=function(){n=null,r&&r(),e.classList.remove("i-amphtml-animating")},function(){n&&n.cancel()}}function getTransitionDuration(e){var t=window.innerHeight,r=Math.abs(e)/t*MAX_TRANSITION_DURATION;return Math.min(Math.max(r,MIN_TRANSITION_DURATION),MAX_TRANSITION_DURATION)}var _excluded=["animate","as","children","expandSingleSection","id"],_excluded2=["animate","as","children","expanded","id","onExpandStateChange"],_excluded3=["as","children","class","id","role","tabIndex"],_excluded4=["as","children","class","id","role"],AccordionContext=createContext2({}),SectionContext=createContext2({}),EMPTY_EXPANDED_MAP={},EMPTY_EVENT_MAP={},generateSectionId=sequentialIdGenerator(),generateRandomId=randomIdGenerator(1e5);function AccordionWithRef(e,t){var r=e.animate,n=void 0!==r&&r,o=e.as,a=void 0===o?"section":o,i=e.children,c=e.expandSingleSection,u=void 0!==c&&c,d=e.id,l=_objectWithoutPropertiesLoose(e,_excluded),s=_slicedToArray(useState2(EMPTY_EXPANDED_MAP),2),f=s[0],p=s[1],_=useRef2(EMPTY_EVENT_MAP),y=_slicedToArray(useState2(generateRandomId),1)[0],v=d||"a".concat(y);useEffect2((function(){u&&p((function(e){var t={},r=0;for(var n in e)t[n]=e[n]&&0==r++;return t}))}),[u]);var m=useCallback2((function(e,t,r){var n=r.current;return p((function(r){return setExpanded(e,t,r,u)})),_.current=_objectSpread2(_objectSpread2({},_.current),{},_defineProperty({},e,n)),function(){p((function(t){return omit(t,e)})),_.current=omit(_.current,e)}}),[u]),h=useCallback2((function(e,t){p((function(r){var n=null!=t?t:!r[e],o=setExpanded(e,n,r,u);return resolvedPromise().then((function(){for(var e in r){var t=_.current[e];t&&r[e]!=o[e]&&t(o[e])}})),o}))}),[u]),g=useCallback2((function(e,t){var r;return null!==(r=f[e])&&void 0!==r?r:t}),[f]),b=useCallback2((function(e){if(e)e in f&&h(e);else if(!u)for(var t in f)h(t)}),[f,h,u]),A=useCallback2((function(e){if(e)g(e,!0)||h(e);else if(!u)for(var t in f)g(t,!0)||h(t)}),[f,h,g,u]),P=useCallback2((function(e){if(e)g(e,!1)&&h(e);else for(var t in f)g(t,!1)&&h(t)}),[f,h,g]);useImperativeHandle2(t,(function(){return{toggle:b,expand:A,collapse:P}}),[b,P,A]);var x=useMemo2((function(){return{registerSection:m,toggleExpanded:h,isExpanded:g,animate:n,prefix:v}}),[m,h,g,n,v]);return createElement2(a,_objectSpread2({id:d},l),createElement2(AccordionContext.Provider,{value:x},i))}var Accordion=forwardRef2(AccordionWithRef);function setExpanded(e,t,r,n){var o;if(n&&t)for(var a in o=_defineProperty({},e,t),r)a!=e&&(o[a]=!1);else o=_objectSpread2(_objectSpread2({},r),{},_defineProperty({},e,t));return o}function AccordionSection(e){var t=e.animate,r=void 0!==t&&t,n=e.as,o=void 0===n?"section":n,a=e.children,i=e.expanded,c=void 0!==i&&i,u=e.id,d=e.onExpandStateChange,l=_objectWithoutPropertiesLoose(e,_excluded2),s=_slicedToArray(useState2(generateSectionId),1)[0],f=u||s,p=_slicedToArray(useState2(generateRandomId),1)[0],_=_slicedToArray(useState2(c),2),y=_[0],v=_[1],m=_slicedToArray(useState2(null),2),h=m[0],g=m[1],b=_slicedToArray(useState2(null),2),A=b[0],P=b[1],x=useContext2(AccordionContext),O=x.animate,S=x.isExpanded,C=x.prefix,E=x.registerSection,I=x.toggleExpanded,T=S?S(f,c):y,j=null!=O?O:r,M=h||"".concat(C||"a","-content-").concat(f,"-").concat(p),L=A||"".concat(C||"a","-header-").concat(f,"-").concat(p),N=useRef2(null);N.current=d,useLayoutEffect2((function(){if(E)return E(f,c,N)}),[E,f,c]);var w=useCallback2((function(e){I?I(f,e):v((function(t){var r=null!=e?e:!t;return resolvedPromise().then((function(){var e=N.current;e&&e(r)})),r}))}),[f,I]),R=useMemo2((function(){return{animate:j,contentId:M,headerId:L,expanded:T,toggleHandler:w,setContentId:g,setHeaderId:P}}),[j,M,L,T,w]);return createElement2(o,_objectSpread2(_objectSpread2({},l),{},{expanded:T}),createElement2(SectionContext.Provider,{value:R},a))}function AccordionHeader(e){var t=e.as,r=void 0===t?"div":t,n=e.children,o=e.class,a=void 0===o?"":o,i=e.id,c=e.role,u=void 0===c?"button":c,d=e.tabIndex,l=void 0===d?0:d,s=_objectWithoutPropertiesLoose(e,_excluded3),f=useContext2(SectionContext),p=f.contentId,_=f.expanded,y=f.headerId,v=f.setHeaderId,m=f.toggleHandler;return useLayoutEffect2((function(){v&&v(i)}),[v,i]),createElement2(r,_objectSpread2(_objectSpread2({},s),{},{id:y,role:u,class:"".concat(a," ").concat($sectionChild," ").concat($header),tabIndex:l,"aria-controls":p,onClick:function(){return m()},"aria-expanded":String(_)}),n)}function AccordionContent(e){var t=e.as,r=void 0===t?"div":t,n=e.children,o=e.class,a=void 0===o?"":o,i=e.id,c=e.role,u=void 0===c?"region":c,d=_objectWithoutPropertiesLoose(e,_excluded4),l=useRef2(null),s=useRef2(!1),f=useContext2(SectionContext),p=f.animate,_=f.contentId,y=f.expanded,v=f.headerId,m=f.setContentId;return useEffect2((function(){return s.current=!0,function(){return s.current=!1}}),[]),useLayoutEffect2((function(){m&&m(i)}),[m,i]),useLayoutEffect2((function(){var e=s.current,t=l.current;if(p&&e&&t&&t.animate)return y?animateExpand(t):animateCollapse(t)}),[y,p]),createElement2(WithAmpContext,{renderable:y},createElement2(r,_objectSpread2(_objectSpread2({},d),{},{ref:l,class:a+" "+$sectionChild+(y?"":" "+$contentHidden),id:_,"aria-labelledby":v,role:u}),n))}Accordion.displayName="Accordion"; |
; | ||
var e;function n(){return e||(e=Promise.resolve(void 0))}var{hasOwnProperty:t,toString:r}=Object.prototype;function o(e,n){return Object.keys(e).reduce(((t,r)=>(n.includes(r)||(t[r]=e[r]),t)),{})}import{cloneElement as i,createContext as c,createElement as a,createRef as l}from"preact";import{hydrate as u,render as d}from"preact";import{useCallback as s,useContext as f,useEffect as p,useImperativeHandle as h,useLayoutEffect as g,useMemo as b,useRef as y,useState as m}from"preact/hooks";function v(e,n,t){return a.apply(void 0,arguments)}function O(e){return c(e,void 0)}function x(e){return m(e)}function w(e){return y(e)}function j(e,n){p(e,n)}function P(e,n){g(e,n)}function S(e){return f(e)}function I(e,n){return b(e,n)}function E(e,n){return s(e,n)}import{Children as $,createPortal as k,forwardRef as z}from"preact/compat";var H,M,Y=["auto","lazy","eager","unload"],C={auto:0,lazy:1,eager:2,unload:3};function D(e,n){const t=C[e]||0,r=C[n]||0,o=Math.max(t,r);return Y[o]}function A(){return H||(H=O({renderable:!0,playable:!0,loading:"auto"}))}function L({children:e,loading:n="auto",notify:t,playable:r=!0,renderable:o=!0}){let i=n,c=r,a=o;const l=S(A()),u=a&&l.renderable,d=u&&c&&l.playable,s=D(u?"auto":"lazy",D(i,l.loading)),f=t||l.notify,p=I((()=>({renderable:u,playable:d,loading:s,notify:f})),[u,d,s,f]);return v(A().Provider,{children:e,value:p})}var W=["Webkit","webkit","Moz","moz","ms","O","o"];function N(e,n,t){if(B(n))return n;M||(M=Object.create(null));let r=M[n];if(!r||t){if(r=n,void 0===e[n]){const t=function(e,n){for(let t=0;t<W.length;t++){const r=W[t]+n;if(void 0!==e[r])return r}return""}(e,function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(n));void 0!==e[t]&&(r=t)}t||(M[n]=r)}return r}function U(e,n,t,r,o){const i=N(e.style,n,o);if(!i)return;const c=r?t+r:t;B(i)?e.style.setProperty(i,c):e.style[i]=c}function V(e,n,t){const r=N(e.style,n,t);if(r)return B(r)?e.style.getPropertyValue(r):e.style[r]}function q(e,n){for(const t in n)U(e,t,n[t])}function B(e){return e.startsWith("--")}function F(e,n,t){let r=t;e.classList.add("i-amphtml-animating");let o=n();return o.onfinish=o.oncancel=()=>{o=null,r&&r(),e.classList.remove("i-amphtml-animating")},()=>{o&&o.cancel()}}function G(e){const n=window.innerHeight,t=Math.abs(e)/n*500;return Math.min(Math.max(t,200),500)}var J=["animate","as","children","expandSingleSection","id"],K=["animate","as","children","expanded","id","onExpandStateChange"],Q=["as","children","class","id","role","tabIndex"],R=["as","children","class","id","role"];function T(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function X(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?T(Object(t),!0).forEach((function(n){Z(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):T(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Z(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var ee=O({}),ne=O({}),te={},re={},oe=function(){let e=0;return()=>String(++e)}(),ie=()=>String(Math.floor(1e5*Math.random())),ce=z((function(e,t){let{animate:r=!1,as:i="section",children:c,expandSingleSection:a=!1,id:l}=e,u=_(e,J);const[d,s]=x(te),f=w(re),[p]=x(ie),g=l||`a${p}`;j((()=>{a&&s((e=>{const n={};let t=0;for(const r in e)n[r]=e[r]&&0==t++;return n}))}),[a]);const b=E(((e,n,{current:t})=>(s((t=>ae(e,n,t,a))),f.current=X(X({},f.current),{},{[e]:t}),()=>{s((n=>o(n,e))),f.current=o(f.current,e)})),[a]),y=E(((e,t)=>{s((r=>{const o=null!=t?t:!r[e],i=ae(e,o,r,a);return n().then((()=>{for(const e in r){const n=f.current[e];n&&r[e]!=i[e]&&n(i[e])}})),i}))}),[a]),m=E(((e,n)=>{var t;return null!==(t=d[e])&&void 0!==t?t:n}),[d]),O=E((e=>{if(e)e in d&&y(e);else if(!a)for(const e in d)y(e)}),[d,y,a]),P=E((e=>{if(e)m(e,!0)||y(e);else if(!a)for(const e in d)m(e,!0)||y(e)}),[d,y,m,a]),S=E((e=>{if(e)m(e,!1)&&y(e);else for(const e in d)m(e,!1)&&y(e)}),[d,y,m]);!function(e,n,t){h(e,(()=>({toggle:O,expand:P,collapse:S})),t)}(t,0,[O,S,P]);const $=I((()=>({registerSection:b,toggleExpanded:y,isExpanded:m,animate:r,prefix:g})),[b,y,m,r,g]);return v(i,X({id:l},u),v(ee.Provider,{value:$},c))}));function ae(e,n,t,r){let o;if(r&&n){o={[e]:n};for(const n in t)n!=e&&(o[n]=!1)}else o=X(X({},t),{},{[e]:n});return o}function le(e){let{animate:t=!1,as:r="section",children:o,expanded:i=!1,id:c,onExpandStateChange:a}=e,l=_(e,K);const[u]=x(oe),d=c||u,[s]=x(ie),[f,p]=x(i),[h,g]=x(null),[b,y]=x(null),{animate:m,isExpanded:O,prefix:j,registerSection:$,toggleExpanded:k}=S(ee),z=O?O(d,i):f,H=null!=m?m:t,M=h||`${j||"a"}-content-${d}-${s}`,Y=b||`${j||"a"}-header-${d}-${s}`,C=w(null);C.current=a,P((()=>{if($)return $(d,i,C)}),[$,d,i]);const D=E((e=>{k?k(d,e):p((t=>{const r=null!=e?e:!t;return n().then((()=>{const e=C.current;e&&e(r)})),r}))}),[d,k]),A=I((()=>({animate:H,contentId:M,headerId:Y,expanded:z,toggleHandler:D,setContentId:g,setHeaderId:y})),[H,M,Y,z,D]);return v(r,X(X({},l),{},{expanded:z}),v(ne.Provider,{value:A},o))}function ue(e){let{as:n="div",children:t,"class":r="",id:o,role:i="button",tabIndex:c=0}=e,a=_(e,Q);const{contentId:l,expanded:u,headerId:d,setHeaderId:s,toggleHandler:f}=S(ne);return P((()=>{s&&s(o)}),[s,o]),v(n,X(X({},a),{},{id:d,role:i,class:`${r} section-child-00fce3c header-00fce3c`,tabIndex:c,"aria-controls":l,onClick:()=>f(),"aria-expanded":String(u)}),t)}function de(e){let{as:n="div",children:t,"class":r="",id:o,role:i="region"}=e,c=_(e,R);const a=w(null),l=w(!1),{animate:u,contentId:d,expanded:s,headerId:f,setContentId:p}=S(ne);return j((()=>(l.current=!0,()=>l.current=!1)),[]),P((()=>{p&&p(o)}),[p,o]),P((()=>{const e=l.current,n=a.current;if(u&&e&&n&&n.animate)return s?function(e){return F(e,(()=>{const n=V(e,"height"),t=V(e,"opacity"),r=V(e,"overflowY");q(e,{height:0,opacity:0,overflowY:"auto"});const o=e.scrollHeight;q(e,{height:n,opacity:t,overflowY:r});const i=G(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(n):function(e){return F(e,(()=>{const n=e.offsetHeight,t=G(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)}),[s,u]),v(L,{renderable:s},v(n,X(X({},c),{},{ref:a,class:r+" section-child-00fce3c"+(s?"":" content-hidden-00fce3c"),id:d,"aria-labelledby":f,role:i}),t))}ce.displayName="Accordion";export{ce as Accordion,de as AccordionContent,ue as AccordionHeader,le as AccordionSection}; | ||
var e;function n(){return e||(e=Promise.resolve(void 0))}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))}))}return e}function i(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}var{hasOwnProperty:c,toString:a}=Object.prototype;function l(e,n){return Object.keys(e).reduce(((t,r)=>(n.includes(r)||(t[r]=e[r]),t)),{})}import{cloneElement as u,createContext as d,createElement as s,createRef as f}from"preact";import{hydrate as p,render as h}from"preact";import{useCallback as g,useContext as b,useEffect as y,useImperativeHandle as m,useLayoutEffect as v,useMemo as x,useRef as O,useState as w}from"preact/hooks";function j(e,n,t){return s.apply(void 0,arguments)}function P(e){return d(e,void 0)}function S(e){return w(e)}function I(e){return O(e)}function E(e,n){y(e,n)}function $(e,n){v(e,n)}function k(e){return b(e)}function z(e,n){return x(e,n)}function H(e,n){return g(e,n)}import{Children as M,createPortal as Y,forwardRef as C}from"preact/compat";var D,A,L=["auto","lazy","eager","unload"],W={auto:0,lazy:1,eager:2,unload:3};function N(e,n){const t=W[e]||0,r=W[n]||0,o=Math.max(t,r);return L[o]}function U(){return D||(D=P({renderable:!0,playable:!0,loading:"auto"}))}function V({children:e,loading:n="auto",notify:t,playable:r=!0,renderable:o=!0}){const i=k(U()),c=o&&i.renderable,a=c&&r&&i.playable,l=N(c?"auto":"lazy",N(n,i.loading)),u=t||i.notify,d=z((()=>({renderable:c,playable:a,loading:l,notify:u})),[c,a,l,u]);return j(U().Provider,{children:e,value:d})}var q=["Webkit","webkit","Moz","moz","ms","O","o"];function B(e,n,t){if(K(n))return n;A||(A=Object.create(null));let r=A[n];if(!r||t){if(r=n,void 0===e[n]){const t=function(e,n){for(let t=0;t<q.length;t++){const r=q[t]+n;if(void 0!==e[r])return r}return""}(e,function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(n));void 0!==e[t]&&(r=t)}t||(A[n]=r)}return r}function F(e,n,t,r,o){const i=B(e.style,n,o);if(!i)return;const c=r?t+r:t;K(i)?e.style.setProperty(i,c):e.style[i]=c}function G(e,n,t){const r=B(e.style,n,t);if(r)return K(r)?e.style.getPropertyValue(r):e.style[r]}function J(e,n){for(const t in n)F(e,t,n[t])}function K(e){return e.startsWith("--")}function Q(e,n,t){e.classList.add("i-amphtml-animating");let r=n();return r.onfinish=r.oncancel=()=>{r=null,t&&t(),e.classList.remove("i-amphtml-animating")},()=>{r&&r.cancel()}}function R(e){const n=window.innerHeight,t=Math.abs(e)/n*500;return Math.min(Math.max(t,200),500)}var T=["animate","as","children","expandSingleSection","id"],X=["animate","as","children","expanded","id","onExpandStateChange"],Z=["as","children","class","id","role","tabIndex"],_=["as","children","class","id","role"],ee=P({}),ne=P({}),te={},re={},oe=function(){let e=0;return()=>String(++e)}(),ie=()=>String(Math.floor(1e5*Math.random())),ce=C((function(e,t){let{animate:r=!1,as:c="section",children:a,expandSingleSection:u=!1,id:d}=e,s=i(e,T);const[f,p]=S(te),h=I(re),[g]=S(ie),b=d||`a${g}`;E((()=>{u&&p((e=>{const n={};let t=0;for(const r in e)n[r]=e[r]&&0==t++;return n}))}),[u]);const y=H(((e,n,{current:t})=>(p((t=>ae(e,n,t,u))),h.current=o(o({},h.current),{},{[e]:t}),()=>{p((n=>l(n,e))),h.current=l(h.current,e)})),[u]),v=H(((e,t)=>{p((r=>{const o=null!=t?t:!r[e],i=ae(e,o,r,u);return n().then((()=>{for(const e in r){const n=h.current[e];n&&r[e]!=i[e]&&n(i[e])}})),i}))}),[u]),x=H(((e,n)=>{var t;return null!==(t=f[e])&&void 0!==t?t:n}),[f]),O=H((e=>{if(e)e in f&&v(e);else if(!u)for(const e in f)v(e)}),[f,v,u]),w=H((e=>{if(e)x(e,!0)||v(e);else if(!u)for(const e in f)x(e,!0)||v(e)}),[f,v,x,u]),P=H((e=>{if(e)x(e,!1)&&v(e);else for(const e in f)x(e,!1)&&v(e)}),[f,v,x]);!function(e,n,t){m(e,(()=>({toggle:O,expand:w,collapse:P})),t)}(t,0,[O,P,w]);const $=z((()=>({registerSection:y,toggleExpanded:v,isExpanded:x,animate:r,prefix:b})),[y,v,x,r,b]);return j(c,o({id:d},s),j(ee.Provider,{value:$},a))}));function ae(e,n,t,r){let i;if(r&&n){i={[e]:n};for(const n in t)n!=e&&(i[n]=!1)}else i=o(o({},t),{},{[e]:n});return i}function le(e){let{animate:t=!1,as:r="section",children:c,expanded:a=!1,id:l,onExpandStateChange:u}=e,d=i(e,X);const[s]=S(oe),f=l||s,[p]=S(ie),[h,g]=S(a),[b,y]=S(null),[m,v]=S(null),{animate:x,isExpanded:O,prefix:w,registerSection:P,toggleExpanded:E}=k(ee),M=O?O(f,a):h,Y=null!=x?x:t,C=b||`${w||"a"}-content-${f}-${p}`,D=m||`${w||"a"}-header-${f}-${p}`,A=I(null);A.current=u,$((()=>{if(P)return P(f,a,A)}),[P,f,a]);const L=H((e=>{E?E(f,e):g((t=>{const r=null!=e?e:!t;return n().then((()=>{const e=A.current;e&&e(r)})),r}))}),[f,E]),W=z((()=>({animate:Y,contentId:C,headerId:D,expanded:M,toggleHandler:L,setContentId:y,setHeaderId:v})),[Y,C,D,M,L]);return j(r,o(o({},d),{},{expanded:M}),j(ne.Provider,{value:W},c))}function ue(e){let{as:n="div",children:t,"class":r="",id:c,role:a="button",tabIndex:l=0}=e,u=i(e,Z);const{contentId:d,expanded:s,headerId:f,setHeaderId:p,toggleHandler:h}=k(ne);return $((()=>{p&&p(c)}),[p,c]),j(n,o(o({},u),{},{id:f,role:a,class:`${r} section-child-00fce3c header-00fce3c`,tabIndex:l,"aria-controls":d,onClick:()=>h(),"aria-expanded":String(s)}),t)}function de(e){let{as:n="div",children:t,"class":r="",id:c,role:a="region"}=e,l=i(e,_);const u=I(null),d=I(!1),{animate:s,contentId:f,expanded:p,headerId:h,setContentId:g}=k(ne);return E((()=>(d.current=!0,()=>d.current=!1)),[]),$((()=>{g&&g(c)}),[g,c]),$((()=>{const e=d.current,n=u.current;if(s&&e&&n&&n.animate)return p?function(e){return Q(e,(()=>{const n=G(e,"height"),t=G(e,"opacity"),r=G(e,"overflowY");J(e,{height:0,opacity:0,overflowY:"auto"});const o=e.scrollHeight;J(e,{height:n,opacity:t,overflowY:r});const i=R(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(n):function(e){return Q(e,(()=>{const n=e.offsetHeight,t=R(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,s]),j(V,{renderable:p},j(n,o(o({},l),{},{ref:u,class:r+" section-child-00fce3c"+(p?"":" content-hidden-00fce3c"),id:f,"aria-labelledby":h,role:a}),t))}ce.displayName="Accordion";export{ce as Accordion,de as AccordionContent,ue as AccordionHeader,le as AccordionSection}; |
; | ||
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__markAsModule=function(e){return __defProp(e,"__esModule",{value:!0})},__export=function(e,t){for(var r in __markAsModule(e),t)__defProp(e,r,{get:t[r],enumerable:!0})},__reExport=function(e,t,r){if(t&&"object"==typeof t||"function"==typeof t)for(var n,o=__getOwnPropNames(t),a=0,i=o.length;a<i;a++)n=o[a],__hasOwnProp.call(e,n)||"default"===n||__defProp(e,n,{get:function(e){return t[e]}.bind(null,n),enumerable:!(r=__getOwnPropDesc(t,n))||r.enumerable});return e},__toModule=function(e){return __reExport(__markAsModule(__defProp(null!=e?__create(__getProtoOf(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};__export(exports,{Accordion:function(){return Accordion},AccordionContent:function(){return AccordionContent},AccordionHeader:function(){return AccordionHeader},AccordionSection:function(){return AccordionSection}});var resolved,$sectionChild="section-child-00fce3c",$header="header-00fce3c",$contentHidden="content-hidden-00fce3c";function resolvedPromise(){return resolved||(resolved=Promise.resolve(void 0))}function sequentialIdGenerator(){var e=0;return function(){return String(++e)}}function randomIdGenerator(e){return function(){return String(Math.floor(Math.random()*e))}}var _Object$prototype=Object.prototype,hasOwn_=_Object$prototype.hasOwnProperty,toString_=_Object$prototype.toString;function map(e){var t=Object.create(null);return e&&Object.assign(t,e),t}function omit(e,t){return Object.keys(e).reduce((function(r,n){return t.includes(n)||(r[n]=e[n]),r}),{})}var preact=__toModule(require("react")),preactDOM=__toModule(require("react-dom")),hooks=__toModule(require("react"));function createElement2(e,t,r){return preact.createElement.apply(void 0,arguments)}function createContext2(e){return preact.createContext(e,void 0)}function useState2(e){return hooks.useState(e)}function useRef2(e){return hooks.useRef(e)}function useEffect2(e,t){hooks.useEffect(e,t)}function useLayoutEffect2(e,t){hooks.useLayoutEffect(e,t)}function useContext2(e){return hooks.useContext(e)}function useMemo2(e,t){return hooks.useMemo(e,t)}function useCallback2(e,t){return hooks.useCallback(e,t)}function useImperativeHandle2(e,t,r){return hooks.useImperativeHandle(e,t,r)}var _MAP,compat=__toModule(require("react"));function forwardRef2(e){return compat.forwardRef(e)}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var context,Loading={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ORDER=[Loading.AUTO,Loading.LAZY,Loading.EAGER,Loading.UNLOAD],MAP=(_defineProperty(_MAP={},Loading.AUTO,0),_defineProperty(_MAP,Loading.LAZY,1),_defineProperty(_MAP,Loading.EAGER,2),_defineProperty(_MAP,Loading.UNLOAD,3),_MAP);function reducer(e,t){var r=MAP[e]||0,n=MAP[t]||0,o=Math.max(r,n);return ORDER[o]}function getAmpContext(){return context||(context=createContext2({renderable:!0,playable:!0,loading:Loading.AUTO}))}function WithAmpContext(e){var t=e.children,r=e.loading,n=void 0===r?"auto":r,o=e.notify,a=e.playable,i=void 0===a||a,c=e.renderable,u=void 0===c||c,d=useAmpContext(),l=u&&d.renderable,s=l&&i&&d.playable,f=reducer(l?Loading.AUTO:Loading.LAZY,reducer(n,d.loading)),p=o||d.notify,_=useMemo2((function(){return{renderable:l,playable:s,loading:f,notify:p}}),[l,s,f,p]);return createElement2(getAmpContext().Provider,{children:t,value:_})}function useAmpContext(){return useContext2(getAmpContext())}var propertyNameCache,isArray=Array.isArray,vendorPrefixes=["Webkit","webkit","Moz","moz","ms","O","o"];function camelCaseToTitleCase(e){return e.charAt(0).toUpperCase()+e.slice(1)}function getVendorJsPropertyName_(e,t){for(var r=0;r<vendorPrefixes.length;r++){var n=vendorPrefixes[r]+t;if(void 0!==e[n])return n}return""}function getVendorJsPropertyName(e,t,r){if(isVar(t))return t;propertyNameCache||(propertyNameCache=map());var n=propertyNameCache[t];if(!n||r){if(n=t,void 0===e[t]){var o=getVendorJsPropertyName_(e,camelCaseToTitleCase(t));void 0!==e[o]&&(n=o)}r||(propertyNameCache[t]=n)}return n}function setStyle(e,t,r,n,o){var a=getVendorJsPropertyName(e.style,t,o);if(a){var i=n?r+n:r;isVar(a)?e.style.setProperty(a,i):e.style[a]=i}}function getStyle(e,t,r){var n=getVendorJsPropertyName(e.style,t,r);if(n)return isVar(n)?e.style.getPropertyValue(n):e.style[n]}function setStyles(e,t){for(var r in t)setStyle(e,r,t[r])}function isVar(e){return e.startsWith("--")}var MAX_TRANSITION_DURATION=500,MIN_TRANSITION_DURATION=200,EXPAND_CURVE="cubic-bezier(0.47, 0, 0.745, 0.715)",COLLAPSE_CURVE="cubic-bezier(0.39, 0.575, 0.565, 1)";function animateExpand(e){return animate(e,(function(){var t=getStyle(e,"height"),r=getStyle(e,"opacity"),n=getStyle(e,"overflowY");setStyles(e,{height:0,opacity:0,overflowY:"auto"});var o=e.scrollHeight;setStyles(e,{height:t,opacity:r,overflowY:n});var a=getTransitionDuration(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:EXPAND_CURVE,duration:a})}))}function animateCollapse(e){return animate(e,(function(){var t=e.offsetHeight,r=getTransitionDuration(t);return e.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:COLLAPSE_CURVE,duration:r})}))}function animate(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;e.classList.add("i-amphtml-animating");var n=t();return n.onfinish=n.oncancel=function(){n=null,r&&r(),e.classList.remove("i-amphtml-animating")},function(){n&&n.cancel()}}function getTransitionDuration(e){var t=window.innerHeight,r=Math.abs(e)/t*MAX_TRANSITION_DURATION;return Math.min(Math.max(r,MIN_TRANSITION_DURATION),MAX_TRANSITION_DURATION)}var _excluded=["animate","as","children","expandSingleSection","id"],_excluded2=["animate","as","children","expanded","id","onExpandStateChange"],_excluded3=["as","children","class","id","role","tabIndex"],_excluded4=["as","children","class","id","role"];function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty2(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty2(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,o=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}var AccordionContext=createContext2({}),SectionContext=createContext2({}),EMPTY_EXPANDED_MAP={},EMPTY_EVENT_MAP={},generateSectionId=sequentialIdGenerator(),generateRandomId=randomIdGenerator(1e5);function AccordionWithRef(e,t){var r=e.animate,n=void 0!==r&&r,o=e.as,a=void 0===o?"section":o,i=e.children,c=e.expandSingleSection,u=void 0!==c&&c,d=e.id,l=_objectWithoutProperties(e,_excluded),s=_slicedToArray(useState2(EMPTY_EXPANDED_MAP),2),f=s[0],p=s[1],_=useRef2(EMPTY_EVENT_MAP),y=_slicedToArray(useState2(generateRandomId),1)[0],v=d||"a".concat(y);useEffect2((function(){u&&p((function(e){var t={},r=0;for(var n in e)t[n]=e[n]&&0==r++;return t}))}),[u]);var m=useCallback2((function(e,t,r){var n=r.current;return p((function(r){return setExpanded(e,t,r,u)})),_.current=_objectSpread(_objectSpread({},_.current),{},_defineProperty2({},e,n)),function(){p((function(t){return omit(t,e)})),_.current=omit(_.current,e)}}),[u]),b=useCallback2((function(e,t){p((function(r){var n=null!=t?t:!r[e],o=setExpanded(e,n,r,u);return resolvedPromise().then((function(){for(var e in r){var t=_.current[e];t&&r[e]!=o[e]&&t(o[e])}})),o}))}),[u]),g=useCallback2((function(e,t){var r;return null!==(r=f[e])&&void 0!==r?r:t}),[f]),h=useCallback2((function(e){if(e)e in f&&b(e);else if(!u)for(var t in f)b(t)}),[f,b,u]),A=useCallback2((function(e){if(e)g(e,!0)||b(e);else if(!u)for(var t in f)g(t,!0)||b(t)}),[f,b,g,u]),P=useCallback2((function(e){if(e)g(e,!1)&&b(e);else for(var t in f)g(t,!1)&&b(t)}),[f,b,g]);useImperativeHandle2(t,(function(){return{toggle:h,expand:A,collapse:P}}),[h,P,A]);var O=useMemo2((function(){return{registerSection:m,toggleExpanded:b,isExpanded:g,animate:n,prefix:v}}),[m,b,g,n,v]);return createElement2(a,_objectSpread({id:d},l),createElement2(AccordionContext.Provider,{value:O},i))}var Accordion=forwardRef2(AccordionWithRef);function setExpanded(e,t,r,n){var o;if(n&&t)for(var a in o=_defineProperty2({},e,t),r)a!=e&&(o[a]=!1);else o=_objectSpread(_objectSpread({},r),{},_defineProperty2({},e,t));return o}function AccordionSection(e){var t=e.animate,r=void 0!==t&&t,n=e.as,o=void 0===n?"section":n,a=e.children,i=e.expanded,c=void 0!==i&&i,u=e.id,d=e.onExpandStateChange,l=_objectWithoutProperties(e,_excluded2),s=_slicedToArray(useState2(generateSectionId),1)[0],f=u||s,p=_slicedToArray(useState2(generateRandomId),1)[0],_=_slicedToArray(useState2(c),2),y=_[0],v=_[1],m=_slicedToArray(useState2(null),2),b=m[0],g=m[1],h=_slicedToArray(useState2(null),2),A=h[0],P=h[1],O=useContext2(AccordionContext),x=O.animate,S=O.isExpanded,E=O.prefix,C=O.registerSection,j=O.toggleExpanded,I=S?S(f,c):y,T=null!=x?x:r,M=b||"".concat(E||"a","-content-").concat(f,"-").concat(p),w=A||"".concat(E||"a","-header-").concat(f,"-").concat(p),N=useRef2(null);N.current=d,useLayoutEffect2((function(){if(C)return C(f,c,N)}),[C,f,c]);var L=useCallback2((function(e){j?j(f,e):v((function(t){var r=null!=e?e:!t;return resolvedPromise().then((function(){var e=N.current;e&&e(r)})),r}))}),[f,j]),R=useMemo2((function(){return{animate:T,contentId:M,headerId:w,expanded:I,toggleHandler:L,setContentId:g,setHeaderId:P}}),[T,M,w,I,L]);return createElement2(o,_objectSpread(_objectSpread({},l),{},{expanded:I}),createElement2(SectionContext.Provider,{value:R},a))}function AccordionHeader(e){var t=e.as,r=void 0===t?"div":t,n=e.children,o=e.class,a=void 0===o?"":o,i=e.id,c=e.role,u=void 0===c?"button":c,d=e.tabIndex,l=void 0===d?0:d,s=_objectWithoutProperties(e,_excluded3),f=useContext2(SectionContext),p=f.contentId,_=f.expanded,y=f.headerId,v=f.setHeaderId,m=f.toggleHandler;return useLayoutEffect2((function(){v&&v(i)}),[v,i]),createElement2(r,_objectSpread(_objectSpread({},s),{},{id:y,role:u,class:"".concat(a," ").concat($sectionChild," ").concat($header),tabIndex:l,"aria-controls":p,onClick:function(){return m()},"aria-expanded":String(_)}),n)}function AccordionContent(e){var t=e.as,r=void 0===t?"div":t,n=e.children,o=e.class,a=void 0===o?"":o,i=e.id,c=e.role,u=void 0===c?"region":c,d=_objectWithoutProperties(e,_excluded4),l=useRef2(null),s=useRef2(!1),f=useContext2(SectionContext),p=f.animate,_=f.contentId,y=f.expanded,v=f.headerId,m=f.setContentId;return useEffect2((function(){return s.current=!0,function(){return s.current=!1}}),[]),useLayoutEffect2((function(){m&&m(i)}),[m,i]),useLayoutEffect2((function(){var e=s.current,t=l.current;if(p&&e&&t&&t.animate)return y?animateExpand(t):animateCollapse(t)}),[y,p]),createElement2(WithAmpContext,{renderable:y},createElement2(r,_objectSpread(_objectSpread({},d),{},{ref:l,class:a+" "+$sectionChild+(y?"":" "+$contentHidden),id:_,"aria-labelledby":v,role:u}),n))}Accordion.displayName="Accordion"; | ||
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__markAsModule=function(e){return __defProp(e,"__esModule",{value:!0})},__export=function(e,t){for(var r in __markAsModule(e),t)__defProp(e,r,{get:t[r],enumerable:!0})},__reExport=function(e,t,r){if(t&&"object"==typeof t||"function"==typeof t)for(var n,o=__getOwnPropNames(t),a=0,i=o.length;a<i;a++)n=o[a],__hasOwnProp.call(e,n)||"default"===n||__defProp(e,n,{get:function(e){return t[e]}.bind(null,n),enumerable:!(r=__getOwnPropDesc(t,n))||r.enumerable});return e},__toModule=function(e){return __reExport(__markAsModule(__defProp(null!=e?__create(__getProtoOf(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};__export(exports,{Accordion:function(){return Accordion},AccordionContent:function(){return AccordionContent},AccordionHeader:function(){return AccordionHeader},AccordionSection:function(){return AccordionSection}});var resolved,$sectionChild="section-child-00fce3c",$header="header-00fce3c",$contentHidden="content-hidden-00fce3c";function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function resolvedPromise(){return resolved||(resolved=Promise.resolve(void 0))}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}function _nonIterableRest(){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 _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function sequentialIdGenerator(){var e=0;return function(){return String(++e)}}function randomIdGenerator(e){return function(){return String(Math.floor(Math.random()*e))}}var _Object$prototype=Object.prototype,hasOwn_=_Object$prototype.hasOwnProperty,toString_=_Object$prototype.toString;function map(e){var t=Object.create(null);return e&&Object.assign(t,e),t}function omit(e,t){return Object.keys(e).reduce((function(r,n){return t.includes(n)||(r[n]=e[n]),r}),{})}var preact=__toModule(require("react")),preactDOM=__toModule(require("react-dom")),hooks=__toModule(require("react"));function createElement2(e,t,r){return preact.createElement.apply(void 0,arguments)}function createContext2(e){return preact.createContext(e,void 0)}function useState2(e){return hooks.useState(e)}function useRef2(e){return hooks.useRef(e)}function useEffect2(e,t){hooks.useEffect(e,t)}function useLayoutEffect2(e,t){hooks.useLayoutEffect(e,t)}function useContext2(e){return hooks.useContext(e)}function useMemo2(e,t){return hooks.useMemo(e,t)}function useCallback2(e,t){return hooks.useCallback(e,t)}function useImperativeHandle2(e,t,r){return hooks.useImperativeHandle(e,t,r)}var _MAP,compat=__toModule(require("react"));function forwardRef2(e){return compat.forwardRef(e)}var context,Loading={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ORDER=[Loading.AUTO,Loading.LAZY,Loading.EAGER,Loading.UNLOAD],MAP=(_defineProperty(_MAP={},Loading.AUTO,0),_defineProperty(_MAP,Loading.LAZY,1),_defineProperty(_MAP,Loading.EAGER,2),_defineProperty(_MAP,Loading.UNLOAD,3),_MAP);function reducer(e,t){var r=MAP[e]||0,n=MAP[t]||0,o=Math.max(r,n);return ORDER[o]}function getAmpContext(){return context||(context=createContext2({renderable:!0,playable:!0,loading:Loading.AUTO}))}function WithAmpContext(e){var t=e.children,r=e.loading,n=void 0===r?"auto":r,o=e.notify,a=e.playable,i=void 0===a||a,c=e.renderable,u=void 0===c||c,d=useAmpContext(),l=u&&d.renderable,s=l&&i&&d.playable,f=reducer(l?Loading.AUTO:Loading.LAZY,reducer(n,d.loading)),p=o||d.notify,_=useMemo2((function(){return{renderable:l,playable:s,loading:f,notify:p}}),[l,s,f,p]);return createElement2(getAmpContext().Provider,{children:t,value:_})}function useAmpContext(){return useContext2(getAmpContext())}var propertyNameCache,isArray=Array.isArray,vendorPrefixes=["Webkit","webkit","Moz","moz","ms","O","o"];function camelCaseToTitleCase(e){return e.charAt(0).toUpperCase()+e.slice(1)}function getVendorJsPropertyName_(e,t){for(var r=0;r<vendorPrefixes.length;r++){var n=vendorPrefixes[r]+t;if(void 0!==e[n])return n}return""}function getVendorJsPropertyName(e,t,r){if(isVar(t))return t;propertyNameCache||(propertyNameCache=map());var n=propertyNameCache[t];if(!n||r){if(n=t,void 0===e[t]){var o=getVendorJsPropertyName_(e,camelCaseToTitleCase(t));void 0!==e[o]&&(n=o)}r||(propertyNameCache[t]=n)}return n}function setStyle(e,t,r,n,o){var a=getVendorJsPropertyName(e.style,t,o);if(a){var i=n?r+n:r;isVar(a)?e.style.setProperty(a,i):e.style[a]=i}}function getStyle(e,t,r){var n=getVendorJsPropertyName(e.style,t,r);if(n)return isVar(n)?e.style.getPropertyValue(n):e.style[n]}function setStyles(e,t){for(var r in t)setStyle(e,r,t[r])}function isVar(e){return e.startsWith("--")}var MAX_TRANSITION_DURATION=500,MIN_TRANSITION_DURATION=200,EXPAND_CURVE="cubic-bezier(0.47, 0, 0.745, 0.715)",COLLAPSE_CURVE="cubic-bezier(0.39, 0.575, 0.565, 1)";function animateExpand(e){return animate(e,(function(){var t=getStyle(e,"height"),r=getStyle(e,"opacity"),n=getStyle(e,"overflowY");setStyles(e,{height:0,opacity:0,overflowY:"auto"});var o=e.scrollHeight;setStyles(e,{height:t,opacity:r,overflowY:n});var a=getTransitionDuration(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:EXPAND_CURVE,duration:a})}))}function animateCollapse(e){return animate(e,(function(){var t=e.offsetHeight,r=getTransitionDuration(t);return e.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:COLLAPSE_CURVE,duration:r})}))}function animate(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;e.classList.add("i-amphtml-animating");var n=t();return n.onfinish=n.oncancel=function(){n=null,r&&r(),e.classList.remove("i-amphtml-animating")},function(){n&&n.cancel()}}function getTransitionDuration(e){var t=window.innerHeight,r=Math.abs(e)/t*MAX_TRANSITION_DURATION;return Math.min(Math.max(r,MIN_TRANSITION_DURATION),MAX_TRANSITION_DURATION)}var _excluded=["animate","as","children","expandSingleSection","id"],_excluded2=["animate","as","children","expanded","id","onExpandStateChange"],_excluded3=["as","children","class","id","role","tabIndex"],_excluded4=["as","children","class","id","role"],AccordionContext=createContext2({}),SectionContext=createContext2({}),EMPTY_EXPANDED_MAP={},EMPTY_EVENT_MAP={},generateSectionId=sequentialIdGenerator(),generateRandomId=randomIdGenerator(1e5);function AccordionWithRef(e,t){var r=e.animate,n=void 0!==r&&r,o=e.as,a=void 0===o?"section":o,i=e.children,c=e.expandSingleSection,u=void 0!==c&&c,d=e.id,l=_objectWithoutPropertiesLoose(e,_excluded),s=_slicedToArray(useState2(EMPTY_EXPANDED_MAP),2),f=s[0],p=s[1],_=useRef2(EMPTY_EVENT_MAP),y=_slicedToArray(useState2(generateRandomId),1)[0],v=d||"a".concat(y);useEffect2((function(){u&&p((function(e){var t={},r=0;for(var n in e)t[n]=e[n]&&0==r++;return t}))}),[u]);var m=useCallback2((function(e,t,r){var n=r.current;return p((function(r){return setExpanded(e,t,r,u)})),_.current=_objectSpread2(_objectSpread2({},_.current),{},_defineProperty({},e,n)),function(){p((function(t){return omit(t,e)})),_.current=omit(_.current,e)}}),[u]),g=useCallback2((function(e,t){p((function(r){var n=null!=t?t:!r[e],o=setExpanded(e,n,r,u);return resolvedPromise().then((function(){for(var e in r){var t=_.current[e];t&&r[e]!=o[e]&&t(o[e])}})),o}))}),[u]),h=useCallback2((function(e,t){var r;return null!==(r=f[e])&&void 0!==r?r:t}),[f]),b=useCallback2((function(e){if(e)e in f&&g(e);else if(!u)for(var t in f)g(t)}),[f,g,u]),A=useCallback2((function(e){if(e)h(e,!0)||g(e);else if(!u)for(var t in f)h(t,!0)||g(t)}),[f,g,h,u]),P=useCallback2((function(e){if(e)h(e,!1)&&g(e);else for(var t in f)h(t,!1)&&g(t)}),[f,g,h]);useImperativeHandle2(t,(function(){return{toggle:b,expand:A,collapse:P}}),[b,P,A]);var x=useMemo2((function(){return{registerSection:m,toggleExpanded:g,isExpanded:h,animate:n,prefix:v}}),[m,g,h,n,v]);return createElement2(a,_objectSpread2({id:d},l),createElement2(AccordionContext.Provider,{value:x},i))}var Accordion=forwardRef2(AccordionWithRef);function setExpanded(e,t,r,n){var o;if(n&&t)for(var a in o=_defineProperty({},e,t),r)a!=e&&(o[a]=!1);else o=_objectSpread2(_objectSpread2({},r),{},_defineProperty({},e,t));return o}function AccordionSection(e){var t=e.animate,r=void 0!==t&&t,n=e.as,o=void 0===n?"section":n,a=e.children,i=e.expanded,c=void 0!==i&&i,u=e.id,d=e.onExpandStateChange,l=_objectWithoutPropertiesLoose(e,_excluded2),s=_slicedToArray(useState2(generateSectionId),1)[0],f=u||s,p=_slicedToArray(useState2(generateRandomId),1)[0],_=_slicedToArray(useState2(c),2),y=_[0],v=_[1],m=_slicedToArray(useState2(null),2),g=m[0],h=m[1],b=_slicedToArray(useState2(null),2),A=b[0],P=b[1],x=useContext2(AccordionContext),O=x.animate,S=x.isExpanded,C=x.prefix,E=x.registerSection,I=x.toggleExpanded,T=S?S(f,c):y,j=null!=O?O:r,M=g||"".concat(C||"a","-content-").concat(f,"-").concat(p),L=A||"".concat(C||"a","-header-").concat(f,"-").concat(p),N=useRef2(null);N.current=d,useLayoutEffect2((function(){if(E)return E(f,c,N)}),[E,f,c]);var w=useCallback2((function(e){I?I(f,e):v((function(t){var r=null!=e?e:!t;return resolvedPromise().then((function(){var e=N.current;e&&e(r)})),r}))}),[f,I]),R=useMemo2((function(){return{animate:j,contentId:M,headerId:L,expanded:T,toggleHandler:w,setContentId:h,setHeaderId:P}}),[j,M,L,T,w]);return createElement2(o,_objectSpread2(_objectSpread2({},l),{},{expanded:T}),createElement2(SectionContext.Provider,{value:R},a))}function AccordionHeader(e){var t=e.as,r=void 0===t?"div":t,n=e.children,o=e.class,a=void 0===o?"":o,i=e.id,c=e.role,u=void 0===c?"button":c,d=e.tabIndex,l=void 0===d?0:d,s=_objectWithoutPropertiesLoose(e,_excluded3),f=useContext2(SectionContext),p=f.contentId,_=f.expanded,y=f.headerId,v=f.setHeaderId,m=f.toggleHandler;return useLayoutEffect2((function(){v&&v(i)}),[v,i]),createElement2(r,_objectSpread2(_objectSpread2({},s),{},{id:y,role:u,class:"".concat(a," ").concat($sectionChild," ").concat($header),tabIndex:l,"aria-controls":p,onClick:function(){return m()},"aria-expanded":String(_)}),n)}function AccordionContent(e){var t=e.as,r=void 0===t?"div":t,n=e.children,o=e.class,a=void 0===o?"":o,i=e.id,c=e.role,u=void 0===c?"region":c,d=_objectWithoutPropertiesLoose(e,_excluded4),l=useRef2(null),s=useRef2(!1),f=useContext2(SectionContext),p=f.animate,_=f.contentId,y=f.expanded,v=f.headerId,m=f.setContentId;return useEffect2((function(){return s.current=!0,function(){return s.current=!1}}),[]),useLayoutEffect2((function(){m&&m(i)}),[m,i]),useLayoutEffect2((function(){var e=s.current,t=l.current;if(p&&e&&t&&t.animate)return y?animateExpand(t):animateCollapse(t)}),[y,p]),createElement2(WithAmpContext,{renderable:y},createElement2(r,_objectSpread2(_objectSpread2({},d),{},{ref:l,class:a+" "+$sectionChild+(y?"":" "+$contentHidden),id:_,"aria-labelledby":v,role:u}),n))}Accordion.displayName="Accordion"; |
; | ||
var e;function n(){return e||(e=Promise.resolve(void 0))}var{hasOwnProperty:t,toString:r}=Object.prototype;function o(e,n){return Object.keys(e).reduce(((t,r)=>(n.includes(r)||(t[r]=e[r]),t)),{})}import{cloneElement as i,createContext as c,createElement as a,createRef as l}from"react";import{hydrate as u,render as d}from"react-dom";import{useCallback as s,useContext as f,useEffect as p,useImperativeHandle as h,useLayoutEffect as g,useMemo as b,useRef as y,useState as m}from"react";function v(e,n,t){return a.apply(void 0,arguments)}function O(e){return c(e,void 0)}function x(e){return m(e)}function w(e){return y(e)}function j(e,n){p(e,n)}function P(e,n){g(e,n)}function S(e){return f(e)}function I(e,n){return b(e,n)}function E(e,n){return s(e,n)}import{Children as $,createPortal as z,forwardRef as H}from"react";var M,Y,k=["auto","lazy","eager","unload"],C={auto:0,lazy:1,eager:2,unload:3};function D(e,n){const t=C[e]||0,r=C[n]||0,o=Math.max(t,r);return k[o]}function A(){return M||(M=O({renderable:!0,playable:!0,loading:"auto"}))}function L({children:e,loading:n="auto",notify:t,playable:r=!0,renderable:o=!0}){let i=n,c=r,a=o;const l=S(A()),u=a&&l.renderable,d=u&&c&&l.playable,s=D(u?"auto":"lazy",D(i,l.loading)),f=t||l.notify,p=I((()=>({renderable:u,playable:d,loading:s,notify:f})),[u,d,s,f]);return v(A().Provider,{children:e,value:p})}var W=["Webkit","webkit","Moz","moz","ms","O","o"];function N(e,n,t){if(B(n))return n;Y||(Y=Object.create(null));let r=Y[n];if(!r||t){if(r=n,void 0===e[n]){const t=function(e,n){for(let t=0;t<W.length;t++){const r=W[t]+n;if(void 0!==e[r])return r}return""}(e,function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(n));void 0!==e[t]&&(r=t)}t||(Y[n]=r)}return r}function U(e,n,t,r,o){const i=N(e.style,n,o);if(!i)return;const c=r?t+r:t;B(i)?e.style.setProperty(i,c):e.style[i]=c}function V(e,n,t){const r=N(e.style,n,t);if(r)return B(r)?e.style.getPropertyValue(r):e.style[r]}function q(e,n){for(const t in n)U(e,t,n[t])}function B(e){return e.startsWith("--")}function F(e,n,t){let r=t;e.classList.add("i-amphtml-animating");let o=n();return o.onfinish=o.oncancel=()=>{o=null,r&&r(),e.classList.remove("i-amphtml-animating")},()=>{o&&o.cancel()}}function G(e){const n=window.innerHeight,t=Math.abs(e)/n*500;return Math.min(Math.max(t,200),500)}var J=["animate","as","children","expandSingleSection","id"],K=["animate","as","children","expanded","id","onExpandStateChange"],Q=["as","children","class","id","role","tabIndex"],R=["as","children","class","id","role"];function T(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function X(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?T(Object(t),!0).forEach((function(n){Z(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):T(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Z(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var ee=O({}),ne=O({}),te={},re={},oe=function(){let e=0;return()=>String(++e)}(),ie=()=>String(Math.floor(1e5*Math.random())),ce=H((function(e,t){let{animate:r=!1,as:i="section",children:c,expandSingleSection:a=!1,id:l}=e,u=_(e,J);const[d,s]=x(te),f=w(re),[p]=x(ie),g=l||`a${p}`;j((()=>{a&&s((e=>{const n={};let t=0;for(const r in e)n[r]=e[r]&&0==t++;return n}))}),[a]);const b=E(((e,n,{current:t})=>(s((t=>ae(e,n,t,a))),f.current=X(X({},f.current),{},{[e]:t}),()=>{s((n=>o(n,e))),f.current=o(f.current,e)})),[a]),y=E(((e,t)=>{s((r=>{const o=null!=t?t:!r[e],i=ae(e,o,r,a);return n().then((()=>{for(const e in r){const n=f.current[e];n&&r[e]!=i[e]&&n(i[e])}})),i}))}),[a]),m=E(((e,n)=>{var t;return null!==(t=d[e])&&void 0!==t?t:n}),[d]),O=E((e=>{if(e)e in d&&y(e);else if(!a)for(const e in d)y(e)}),[d,y,a]),P=E((e=>{if(e)m(e,!0)||y(e);else if(!a)for(const e in d)m(e,!0)||y(e)}),[d,y,m,a]),S=E((e=>{if(e)m(e,!1)&&y(e);else for(const e in d)m(e,!1)&&y(e)}),[d,y,m]);!function(e,n,t){h(e,(()=>({toggle:O,expand:P,collapse:S})),t)}(t,0,[O,S,P]);const $=I((()=>({registerSection:b,toggleExpanded:y,isExpanded:m,animate:r,prefix:g})),[b,y,m,r,g]);return v(i,X({id:l},u),v(ee.Provider,{value:$},c))}));function ae(e,n,t,r){let o;if(r&&n){o={[e]:n};for(const n in t)n!=e&&(o[n]=!1)}else o=X(X({},t),{},{[e]:n});return o}function le(e){let{animate:t=!1,as:r="section",children:o,expanded:i=!1,id:c,onExpandStateChange:a}=e,l=_(e,K);const[u]=x(oe),d=c||u,[s]=x(ie),[f,p]=x(i),[h,g]=x(null),[b,y]=x(null),{animate:m,isExpanded:O,prefix:j,registerSection:$,toggleExpanded:z}=S(ee),H=O?O(d,i):f,M=null!=m?m:t,Y=h||`${j||"a"}-content-${d}-${s}`,k=b||`${j||"a"}-header-${d}-${s}`,C=w(null);C.current=a,P((()=>{if($)return $(d,i,C)}),[$,d,i]);const D=E((e=>{z?z(d,e):p((t=>{const r=null!=e?e:!t;return n().then((()=>{const e=C.current;e&&e(r)})),r}))}),[d,z]),A=I((()=>({animate:M,contentId:Y,headerId:k,expanded:H,toggleHandler:D,setContentId:g,setHeaderId:y})),[M,Y,k,H,D]);return v(r,X(X({},l),{},{expanded:H}),v(ne.Provider,{value:A},o))}function ue(e){let{as:n="div",children:t,"class":r="",id:o,role:i="button",tabIndex:c=0}=e,a=_(e,Q);const{contentId:l,expanded:u,headerId:d,setHeaderId:s,toggleHandler:f}=S(ne);return P((()=>{s&&s(o)}),[s,o]),v(n,X(X({},a),{},{id:d,role:i,class:`${r} section-child-00fce3c header-00fce3c`,tabIndex:c,"aria-controls":l,onClick:()=>f(),"aria-expanded":String(u)}),t)}function de(e){let{as:n="div",children:t,"class":r="",id:o,role:i="region"}=e,c=_(e,R);const a=w(null),l=w(!1),{animate:u,contentId:d,expanded:s,headerId:f,setContentId:p}=S(ne);return j((()=>(l.current=!0,()=>l.current=!1)),[]),P((()=>{p&&p(o)}),[p,o]),P((()=>{const e=l.current,n=a.current;if(u&&e&&n&&n.animate)return s?function(e){return F(e,(()=>{const n=V(e,"height"),t=V(e,"opacity"),r=V(e,"overflowY");q(e,{height:0,opacity:0,overflowY:"auto"});const o=e.scrollHeight;q(e,{height:n,opacity:t,overflowY:r});const i=G(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(n):function(e){return F(e,(()=>{const n=e.offsetHeight,t=G(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)}),[s,u]),v(L,{renderable:s},v(n,X(X({},c),{},{ref:a,class:r+" section-child-00fce3c"+(s?"":" content-hidden-00fce3c"),id:d,"aria-labelledby":f,role:i}),t))}ce.displayName="Accordion";export{ce as Accordion,de as AccordionContent,ue as AccordionHeader,le as AccordionSection}; | ||
var e;function n(){return e||(e=Promise.resolve(void 0))}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))}))}return e}function i(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}var{hasOwnProperty:c,toString:a}=Object.prototype;function l(e,n){return Object.keys(e).reduce(((t,r)=>(n.includes(r)||(t[r]=e[r]),t)),{})}import{cloneElement as u,createContext as d,createElement as s,createRef as f}from"react";import{hydrate as p,render as h}from"react-dom";import{useCallback as g,useContext as b,useEffect as y,useImperativeHandle as m,useLayoutEffect as v,useMemo as x,useRef as O,useState as w}from"react";function j(e,n,t){return s.apply(void 0,arguments)}function P(e){return d(e,void 0)}function S(e){return w(e)}function I(e){return O(e)}function E(e,n){y(e,n)}function $(e,n){v(e,n)}function z(e){return b(e)}function H(e,n){return x(e,n)}function M(e,n){return g(e,n)}import{Children as Y,createPortal as k,forwardRef as C}from"react";var D,A,L=["auto","lazy","eager","unload"],W={auto:0,lazy:1,eager:2,unload:3};function N(e,n){const t=W[e]||0,r=W[n]||0,o=Math.max(t,r);return L[o]}function U(){return D||(D=P({renderable:!0,playable:!0,loading:"auto"}))}function V({children:e,loading:n="auto",notify:t,playable:r=!0,renderable:o=!0}){const i=z(U()),c=o&&i.renderable,a=c&&r&&i.playable,l=N(c?"auto":"lazy",N(n,i.loading)),u=t||i.notify,d=H((()=>({renderable:c,playable:a,loading:l,notify:u})),[c,a,l,u]);return j(U().Provider,{children:e,value:d})}var q=["Webkit","webkit","Moz","moz","ms","O","o"];function B(e,n,t){if(K(n))return n;A||(A=Object.create(null));let r=A[n];if(!r||t){if(r=n,void 0===e[n]){const t=function(e,n){for(let t=0;t<q.length;t++){const r=q[t]+n;if(void 0!==e[r])return r}return""}(e,function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(n));void 0!==e[t]&&(r=t)}t||(A[n]=r)}return r}function F(e,n,t,r,o){const i=B(e.style,n,o);if(!i)return;const c=r?t+r:t;K(i)?e.style.setProperty(i,c):e.style[i]=c}function G(e,n,t){const r=B(e.style,n,t);if(r)return K(r)?e.style.getPropertyValue(r):e.style[r]}function J(e,n){for(const t in n)F(e,t,n[t])}function K(e){return e.startsWith("--")}function Q(e,n,t){e.classList.add("i-amphtml-animating");let r=n();return r.onfinish=r.oncancel=()=>{r=null,t&&t(),e.classList.remove("i-amphtml-animating")},()=>{r&&r.cancel()}}function R(e){const n=window.innerHeight,t=Math.abs(e)/n*500;return Math.min(Math.max(t,200),500)}var T=["animate","as","children","expandSingleSection","id"],X=["animate","as","children","expanded","id","onExpandStateChange"],Z=["as","children","class","id","role","tabIndex"],_=["as","children","class","id","role"],ee=P({}),ne=P({}),te={},re={},oe=function(){let e=0;return()=>String(++e)}(),ie=()=>String(Math.floor(1e5*Math.random())),ce=C((function(e,t){let{animate:r=!1,as:c="section",children:a,expandSingleSection:u=!1,id:d}=e,s=i(e,T);const[f,p]=S(te),h=I(re),[g]=S(ie),b=d||`a${g}`;E((()=>{u&&p((e=>{const n={};let t=0;for(const r in e)n[r]=e[r]&&0==t++;return n}))}),[u]);const y=M(((e,n,{current:t})=>(p((t=>ae(e,n,t,u))),h.current=o(o({},h.current),{},{[e]:t}),()=>{p((n=>l(n,e))),h.current=l(h.current,e)})),[u]),v=M(((e,t)=>{p((r=>{const o=null!=t?t:!r[e],i=ae(e,o,r,u);return n().then((()=>{for(const e in r){const n=h.current[e];n&&r[e]!=i[e]&&n(i[e])}})),i}))}),[u]),x=M(((e,n)=>{var t;return null!==(t=f[e])&&void 0!==t?t:n}),[f]),O=M((e=>{if(e)e in f&&v(e);else if(!u)for(const e in f)v(e)}),[f,v,u]),w=M((e=>{if(e)x(e,!0)||v(e);else if(!u)for(const e in f)x(e,!0)||v(e)}),[f,v,x,u]),P=M((e=>{if(e)x(e,!1)&&v(e);else for(const e in f)x(e,!1)&&v(e)}),[f,v,x]);!function(e,n,t){m(e,(()=>({toggle:O,expand:w,collapse:P})),t)}(t,0,[O,P,w]);const $=H((()=>({registerSection:y,toggleExpanded:v,isExpanded:x,animate:r,prefix:b})),[y,v,x,r,b]);return j(c,o({id:d},s),j(ee.Provider,{value:$},a))}));function ae(e,n,t,r){let i;if(r&&n){i={[e]:n};for(const n in t)n!=e&&(i[n]=!1)}else i=o(o({},t),{},{[e]:n});return i}function le(e){let{animate:t=!1,as:r="section",children:c,expanded:a=!1,id:l,onExpandStateChange:u}=e,d=i(e,X);const[s]=S(oe),f=l||s,[p]=S(ie),[h,g]=S(a),[b,y]=S(null),[m,v]=S(null),{animate:x,isExpanded:O,prefix:w,registerSection:P,toggleExpanded:E}=z(ee),Y=O?O(f,a):h,k=null!=x?x:t,C=b||`${w||"a"}-content-${f}-${p}`,D=m||`${w||"a"}-header-${f}-${p}`,A=I(null);A.current=u,$((()=>{if(P)return P(f,a,A)}),[P,f,a]);const L=M((e=>{E?E(f,e):g((t=>{const r=null!=e?e:!t;return n().then((()=>{const e=A.current;e&&e(r)})),r}))}),[f,E]),W=H((()=>({animate:k,contentId:C,headerId:D,expanded:Y,toggleHandler:L,setContentId:y,setHeaderId:v})),[k,C,D,Y,L]);return j(r,o(o({},d),{},{expanded:Y}),j(ne.Provider,{value:W},c))}function ue(e){let{as:n="div",children:t,"class":r="",id:c,role:a="button",tabIndex:l=0}=e,u=i(e,Z);const{contentId:d,expanded:s,headerId:f,setHeaderId:p,toggleHandler:h}=z(ne);return $((()=>{p&&p(c)}),[p,c]),j(n,o(o({},u),{},{id:f,role:a,class:`${r} section-child-00fce3c header-00fce3c`,tabIndex:l,"aria-controls":d,onClick:()=>h(),"aria-expanded":String(s)}),t)}function de(e){let{as:n="div",children:t,"class":r="",id:c,role:a="region"}=e,l=i(e,_);const u=I(null),d=I(!1),{animate:s,contentId:f,expanded:p,headerId:h,setContentId:g}=z(ne);return E((()=>(d.current=!0,()=>d.current=!1)),[]),$((()=>{g&&g(c)}),[g,c]),$((()=>{const e=d.current,n=u.current;if(s&&e&&n&&n.animate)return p?function(e){return Q(e,(()=>{const n=G(e,"height"),t=G(e,"opacity"),r=G(e,"overflowY");J(e,{height:0,opacity:0,overflowY:"auto"});const o=e.scrollHeight;J(e,{height:n,opacity:t,overflowY:r});const i=R(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(n):function(e){return Q(e,(()=>{const n=e.offsetHeight,t=R(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,s]),j(V,{renderable:p},j(n,o(o({},l),{},{ref:u,class:r+" section-child-00fce3c"+(p?"":" content-hidden-00fce3c"),id:f,"aria-labelledby":h,role:a}),t))}ce.displayName="Accordion";export{ce as Accordion,de as AccordionContent,ue as AccordionHeader,le as AccordionSection}; |
{ | ||
"name": "@ampproject/amp-accordion", | ||
"version": "1.2108232044.0", | ||
"version": "1.2108242314.0", | ||
"description": "AMP HTML amp-accordion Component", | ||
@@ -5,0 +5,0 @@ "author": "The AMP HTML Authors", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
396671