likec4 1.55.1 → 1.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__app__/chunks/ColorSchemeToggle.mjs +1 -0
- package/__app__/chunks/DiagramActorProvider.mjs +10 -0
- package/__app__/chunks/Fallback.mjs +1 -0
- package/__app__/chunks/Header.mjs +13 -0
- package/__app__/chunks/IconRenderer.mjs +1 -0
- package/__app__/chunks/LikeC4Diagram.mjs +19 -0
- package/__app__/chunks/LikeC4ModelContext.mjs +1 -0
- package/__app__/chunks/LikeC4ModelContext2.mjs +1 -0
- package/__app__/chunks/LikeC4Styles.mjs +48 -0
- package/__app__/chunks/NavigationPanel.mjs +1 -0
- package/__app__/chunks/StaticLikeC4Diagram.mjs +1 -0
- package/__app__/chunks/ViewReact.mjs +1 -0
- package/__app__/chunks/__root.mjs +1 -0
- package/__app__/chunks/adhoc-editor.mjs +1 -0
- package/__app__/chunks/hooks.mjs +1 -0
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/core.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/dom.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/react.mjs +1 -0
- package/__app__/chunks/libs/@mantine/core.mjs +41 -0
- package/__app__/chunks/libs/@mantine/hooks.mjs +1 -0
- package/__app__/chunks/libs/@nanostores/react.mjs +1 -0
- package/__app__/chunks/libs/@react-hookz/web.mjs +1 -0
- package/__app__/chunks/libs/@tabler/icons-react.mjs +15 -0
- package/__app__/chunks/libs/@tanstack/history.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/react-router.mjs +3 -0
- package/__app__/chunks/libs/@tanstack/router-core.mjs +1 -0
- package/__app__/chunks/libs/@xstate/react.mjs +1 -0
- package/__app__/chunks/libs/@xstate/store.mjs +1 -0
- package/__app__/chunks/libs/@xyflow/react.mjs +7 -0
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/collection.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/core.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/react.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +1 -0
- package/__app__/chunks/libs/bezier-js.mjs +1 -0
- package/__app__/chunks/libs/d3-path.mjs +1 -0
- package/__app__/chunks/libs/d3-shape.mjs +1 -0
- package/__app__/chunks/libs/fast-equals.mjs +1 -0
- package/__app__/chunks/libs/framer-motion.mjs +9 -0
- package/__app__/chunks/libs/html-to-image.mjs +2 -0
- package/__app__/chunks/libs/motion-dom.mjs +1 -0
- package/__app__/chunks/libs/motion.mjs +1 -0
- package/__app__/chunks/libs/nanostores.mjs +1 -0
- package/__app__/chunks/libs/react-error-boundary.mjs +1 -0
- package/__app__/chunks/libs/react-resizable-panels.mjs +1 -0
- package/__app__/chunks/libs/remeda.mjs +1 -0
- package/__app__/chunks/libs/xstate.mjs +1 -0
- package/__app__/chunks/libs/zod.mjs +39 -0
- package/__app__/chunks/rolldown-runtime.mjs +1 -0
- package/__app__/chunks/safeCtx.mjs +1 -0
- package/__app__/chunks/searchParams.mjs +1 -0
- package/__app__/chunks/single-index.mjs +1 -0
- package/__app__/chunks/styled-system.mjs +1 -0
- package/__app__/chunks/styles.css.mjs +1 -0
- package/__app__/chunks/useLikeC4Project.mjs +1 -0
- package/__app__/chunks/useUpdateEffect.mjs +1 -0
- package/__app__/codegen/react.mjs +11 -0
- package/__app__/codegen/webcomponent.mjs +790 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.mjs +1 -0
- package/__app__/src/pages/AdHocViewEditor.mjs +1 -0
- package/__app__/src/pages/EmbedPage.mjs +1 -0
- package/__app__/src/pages/ExportPage.mjs +1 -0
- package/__app__/src/pages/ProjectsOverview.mjs +1 -0
- package/__app__/src/pages/ViewAsD2.mjs +1 -0
- package/__app__/src/pages/ViewAsDot.mjs +1 -0
- package/__app__/src/pages/ViewAsMmd.mjs +1 -0
- package/__app__/src/pages/ViewAsPuml.mjs +1 -0
- package/__app__/src/pages/ViewEditor.mjs +1 -0
- package/__app__/src/pages/ViewReact.mjs +1 -0
- package/__app__/src/routeTree.gen.mjs +1 -0
- package/__app__/src/routes/__root.mjs +1 -0
- package/__app__/src/routes/_single/adhoc.mjs +1 -0
- package/__app__/src/routes/_single/embed._viewId.mjs +1 -0
- package/__app__/src/routes/_single/export._viewId.mjs +1 -0
- package/__app__/src/routes/_single/route.mjs +1 -0
- package/__app__/src/routes/_single/single-index.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.d2.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.dot.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.index.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.mmd.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.puml.mjs +1 -0
- package/__app__/src/routes/_single/webcomponent._.mjs +33 -0
- package/__app__/src/routes/index.mjs +1 -0
- package/__app__/src/routes/project._projectId/-components.mjs +1 -0
- package/__app__/src/routes/project._projectId/adhoc.mjs +1 -0
- package/__app__/src/routes/project._projectId/embed._viewId.mjs +1 -0
- package/__app__/src/routes/project._projectId/export._viewId.mjs +1 -0
- package/__app__/src/routes/project._projectId/index.mjs +1 -0
- package/__app__/src/routes/project._projectId/route.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.index.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +1 -0
- package/__app__/src/routes/projects.mjs +1 -0
- package/__app__/src/style.css +1 -1
- package/dist/chunks/filenames.mjs +17 -0
- package/dist/{_chunks → chunks}/index.d.mts +2 -1
- package/dist/{_chunks → chunks}/index2.d.mts +70 -11
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -0
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
- package/dist/chunks/libs/@chevrotain/utils.mjs +1 -0
- package/dist/chunks/libs/@hono/mcp.mjs +45 -0
- package/dist/chunks/libs/@hono/node-server.mjs +1 -0
- package/dist/{_chunks → chunks}/libs/@logtape/logtape.d.mts +2 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -0
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -0
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
- package/dist/chunks/libs/ajv.mjs +1 -0
- package/dist/chunks/libs/ansi-align.mjs +2 -0
- package/dist/chunks/libs/ansi-regex.mjs +1 -0
- package/dist/chunks/libs/ansi-styles.mjs +1 -0
- package/dist/chunks/libs/atomically.mjs +1 -0
- package/dist/chunks/libs/birpc.mjs +1 -0
- package/dist/chunks/libs/boxen.mjs +22 -0
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -0
- package/dist/chunks/libs/chevrotain.mjs +58 -0
- package/dist/chunks/libs/conf.mjs +1 -0
- package/dist/chunks/libs/defu.mjs +1 -0
- package/dist/chunks/libs/destr.mjs +1 -0
- package/dist/chunks/libs/eventemitter3.mjs +1 -0
- package/dist/chunks/libs/find-up-simple.mjs +1 -0
- package/dist/chunks/libs/get-port.mjs +1 -0
- package/dist/chunks/libs/hono.mjs +1 -0
- package/dist/chunks/libs/is-docker.mjs +1 -0
- package/dist/chunks/libs/is-error-instance.mjs +1 -0
- package/dist/chunks/libs/is-inside-container.mjs +1 -0
- package/dist/chunks/libs/is-plain-obj.mjs +1 -0
- package/dist/chunks/libs/isexe.mjs +1 -0
- package/dist/chunks/libs/json5.mjs +14 -0
- package/dist/chunks/libs/khroma.mjs +1 -0
- package/dist/chunks/libs/ky.mjs +3 -0
- package/dist/{_chunks → chunks}/libs/langium.d.mts +4 -4
- package/dist/chunks/libs/langium.mjs +32 -0
- package/dist/chunks/libs/merge-error-cause.mjs +2 -0
- package/dist/chunks/libs/p-debounce.mjs +1 -0
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -0
- package/dist/chunks/libs/p-timeout.mjs +1 -0
- package/dist/chunks/libs/package-manager-detector.mjs +1 -0
- package/dist/chunks/libs/package-up.mjs +1 -0
- package/dist/chunks/libs/pako.mjs +1 -0
- package/dist/chunks/libs/parse-ms.mjs +1 -0
- package/dist/chunks/libs/pathe.mjs +1 -0
- package/dist/chunks/libs/picomatch.mjs +1 -0
- package/dist/chunks/libs/pretty-ms.mjs +1 -0
- package/dist/chunks/libs/remeda.mjs +1 -0
- package/dist/chunks/libs/safe-stringify.mjs +1 -0
- package/dist/chunks/libs/strip-indent.mjs +1 -0
- package/dist/chunks/libs/tinyrainbow.mjs +1 -0
- package/dist/{_chunks → chunks}/libs/ts-graphviz.d.mts +2 -0
- package/dist/chunks/libs/ts-graphviz.mjs +4 -0
- package/dist/chunks/libs/ufo.mjs +1 -0
- package/dist/chunks/libs/unstorage.mjs +1 -0
- package/dist/chunks/libs/which.mjs +1 -0
- package/dist/chunks/libs/word-wrap.mjs +12 -0
- package/dist/{_chunks → chunks}/libs/zod.d.mts +2 -0
- package/dist/chunks/node.mjs +76 -0
- package/dist/chunks/plugin.mjs +400 -0
- package/dist/chunks/rolldown-runtime.mjs +1 -0
- package/dist/chunks/sequence-view.mjs +1 -0
- package/dist/cli/index.mjs +262 -136
- package/dist/config/index.d.mts +1 -2
- package/dist/config/index.mjs +1 -1
- package/dist/index.d.mts +4 -8
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +2 -1
- package/dist/model/index.mjs +1 -1
- package/dist/vite-plugin/index.d.mts +38 -8
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/{_chunks → vite-plugin/internal/chunks}/libs/@nanostores/react.d.mts +2 -56
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +59 -0
- package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -0
- package/dist/vite-plugin/{internal.d.mts → internal/index.d.mts} +12 -3
- package/dist/vite-plugin/internal/index.mjs +1 -0
- package/package.json +35 -55
- package/react/index.d.mts +2 -28
- package/react/index.mjs +50520 -53863
- package/vite-plugin/internal/package.json +2 -2
- package/vite-plugin-modules.d.ts +14 -0
- package/__app__/react/likec4.tsx +0 -25
- package/__app__/src/ProjectsOverview.js +0 -16
- package/__app__/src/const.js +0 -19
- package/__app__/src/likec4.js +0 -21254
- package/__app__/src/main.js +0 -7
- package/__app__/src/routes/index.js +0 -324
- package/__app__/src/routes/projects.js +0 -193
- package/__app__/src/routes/single.js +0 -1983
- package/__app__/src/vendors.js +0 -52683
- package/__app__/src/webcomponent.js +0 -68
- package/dist/THIRD-PARTY-LICENSES.md +0 -1609
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +0 -30
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +0 -9
- package/dist/_chunks/libs/@chevrotain/types.d.mts +0 -1
- package/dist/_chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/_chunks/libs/@hono/mcp.mjs +0 -45
- package/dist/_chunks/libs/@hono/node-server.mjs +0 -1
- package/dist/_chunks/libs/@logtape/logtape.mjs +0 -4
- package/dist/_chunks/libs/@lume/kiwi.mjs +0 -1
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/_chunks/libs/@nanostores/react.mjs +0 -1
- package/dist/_chunks/libs/ajv.mjs +0 -1
- package/dist/_chunks/libs/ansi-align.mjs +0 -2
- package/dist/_chunks/libs/ansi-regex.mjs +0 -1
- package/dist/_chunks/libs/ansi-styles.mjs +0 -1
- package/dist/_chunks/libs/atomically.mjs +0 -1
- package/dist/_chunks/libs/birpc.mjs +0 -1
- package/dist/_chunks/libs/boxen.mjs +0 -22
- package/dist/_chunks/libs/chevrotain-allstar.mjs +0 -2
- package/dist/_chunks/libs/chevrotain.mjs +0 -58
- package/dist/_chunks/libs/conf.mjs +0 -1
- package/dist/_chunks/libs/defu.mjs +0 -1
- package/dist/_chunks/libs/destr.mjs +0 -1
- package/dist/_chunks/libs/esm-env.mjs +0 -1
- package/dist/_chunks/libs/eventemitter3.mjs +0 -1
- package/dist/_chunks/libs/fast-equals.mjs +0 -1
- package/dist/_chunks/libs/find-up-simple.mjs +0 -1
- package/dist/_chunks/libs/get-port.mjs +0 -1
- package/dist/_chunks/libs/is-docker.mjs +0 -1
- package/dist/_chunks/libs/is-error-instance.mjs +0 -1
- package/dist/_chunks/libs/is-inside-container.mjs +0 -1
- package/dist/_chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/_chunks/libs/isexe.mjs +0 -1
- package/dist/_chunks/libs/json5.mjs +0 -14
- package/dist/_chunks/libs/khroma.mjs +0 -1
- package/dist/_chunks/libs/ky.mjs +0 -3
- package/dist/_chunks/libs/langium.mjs +0 -33
- package/dist/_chunks/libs/merge-error-cause.mjs +0 -2
- package/dist/_chunks/libs/p-limit.mjs +0 -1
- package/dist/_chunks/libs/p-queue.mjs +0 -1
- package/dist/_chunks/libs/p-timeout.mjs +0 -1
- package/dist/_chunks/libs/package-manager-detector.mjs +0 -1
- package/dist/_chunks/libs/package-up.mjs +0 -1
- package/dist/_chunks/libs/pako.mjs +0 -1
- package/dist/_chunks/libs/parse-ms.mjs +0 -1
- package/dist/_chunks/libs/pathe.mjs +0 -1
- package/dist/_chunks/libs/picomatch.mjs +0 -1
- package/dist/_chunks/libs/pretty-ms.mjs +0 -1
- package/dist/_chunks/libs/remeda.mjs +0 -2
- package/dist/_chunks/libs/safe-stringify.mjs +0 -1
- package/dist/_chunks/libs/strip-indent.mjs +0 -1
- package/dist/_chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/_chunks/libs/ts-graphviz.mjs +0 -4
- package/dist/_chunks/libs/ufo.mjs +0 -1
- package/dist/_chunks/libs/unstorage.mjs +0 -1
- package/dist/_chunks/libs/which.mjs +0 -1
- package/dist/_chunks/libs/word-wrap.mjs +0 -12
- package/dist/_chunks/node.mjs +0 -76
- package/dist/_chunks/rolldown-runtime.mjs +0 -1
- package/dist/_chunks/sequence.mjs +0 -1
- package/dist/_chunks/src.mjs +0 -17
- package/dist/_chunks/src2.mjs +0 -499
- package/dist/vite-plugin/internal.mjs +0 -1
- /package/dist/{_chunks → chunks}/libs/vscode-languageserver.mjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";import{_ as e,c as t,d as n,f as r,g as i,h as a,l as o,n as s,o as c,r as l,s as u,t as d,v as f,y as p}from"./collection.mjs";import{_ as m,c as h,d as g,f as _,g as v,h as y,i as b,l as x,m as S,p as C,r as w,s as T,u as E,v as D}from"./core.mjs";import{r as O}from"./react.mjs";import{t as k}from"./anatomy.mjs";var A=k(`tree-view`).parts(`branch`,`branchContent`,`branchControl`,`branchIndentGuide`,`branchIndicator`,`branchText`,`branchTrigger`,`item`,`itemIndicator`,`itemText`,`label`,`nodeCheckbox`,`nodeRenameInput`,`root`,`tree`).build(),collection=e=>new d(e);collection.empty=()=>new d({rootNode:{children:[]}});var getRootId=e=>e.ids?.root??`tree:${e.id}:root`,getLabelId=e=>e.ids?.label??`tree:${e.id}:label`,getNodeId=(e,t)=>e.ids?.node?.(t)??`tree:${e.id}:node:${t}`,getTreeId=e=>e.ids?.tree??`tree:${e.id}:tree`,focusNode=(e,t)=>{t!=null&&e.getById(getNodeId(e,t))?.focus()},getRenameInputId=(e,t)=>`tree:${e.id}:rename-input:${t}`,getRenameInputEl=(e,t)=>e.getById(getRenameInputId(e,t));function getCheckedState(e,t,n){let r=e.getNodeValue(t);if(!e.isBranchNode(t))return n.includes(r);let i=e.getDescendantValues(r),a=i.every(e=>n.includes(e)),o=i.some(e=>n.includes(e));return a?!0:o?`indeterminate`:!1}function toggleBranchChecked(t,n,r){let i=t.getDescendantValues(n);return p(i.every(e=>r.includes(e))?e(r,...i):s(r,...i))}function getCheckedValueMap(e,t){let n=new Map;return e.visit({onEnter:r=>{let i=e.getNodeValue(r),a=e.isBranchNode(r),o=getCheckedState(e,r,t);n.set(i,{type:a?`branch`:`leaf`,checked:o})}}),n}function connect(e,t){let{context:n,scope:r,computed:i,prop:a,send:o}=e,c=a(`collection`),l=Array.from(n.get(`expandedValue`)),u=Array.from(n.get(`selectedValue`)),d=Array.from(n.get(`checkedValue`)),f=i(`isTypingAhead`),m=n.get(`focusedValue`),b=n.get(`loadingStatus`),w=n.get(`renamingValue`),skip=({indexPath:e})=>c.getValuePath(e).slice(0,-1).some(e=>!l.includes(e)),D=c.getFirstNode(void 0,{skip}),O=D?c.getNodeValue(D):null;function getNodeState(e){let{node:t,indexPath:n}=e,i=c.getNodeValue(t);return{id:getNodeId(r,i),value:i,indexPath:n,valuePath:c.getValuePath(n),disabled:!!t.disabled,focused:m==null?O===i:m===i,selected:u.includes(i),expanded:l.includes(i),loading:b[i]===`loading`,depth:n.length,isBranch:c.isBranchNode(t),renaming:w===i,get checked(){return getCheckedState(c,t,d)}}}return{collection:c,expandedValue:l,selectedValue:u,checkedValue:d,toggleChecked(e,t){o({type:`CHECKED.TOGGLE`,value:e,isBranch:t})},setChecked(e){o({type:`CHECKED.SET`,value:e})},clearChecked(){o({type:`CHECKED.CLEAR`})},getCheckedMap(){return getCheckedValueMap(c,d)},expand(e){o({type:e?`BRANCH.EXPAND`:`EXPANDED.ALL`,value:e})},collapse(e){o({type:e?`BRANCH.COLLAPSE`:`EXPANDED.CLEAR`,value:e})},deselect(e){o({type:e?`NODE.DESELECT`:`SELECTED.CLEAR`,value:e})},select(e){o({type:e?`NODE.SELECT`:`SELECTED.ALL`,value:e,isTrusted:!1})},getVisibleNodes(){return i(`visibleNodes`)},focus(e){focusNode(r,e)},selectParent(e){let t=c.getParentNode(e);t&&o({type:`SELECTED.SET`,value:s(u,c.getNodeValue(t)),src:`select.parent`})},expandParent(e){let t=c.getParentNode(e);t&&o({type:`EXPANDED.SET`,value:s(l,c.getNodeValue(t)),src:`expand.parent`})},setExpandedValue(e){o({type:`EXPANDED.SET`,value:p(e)})},setSelectedValue(e){o({type:`SELECTED.SET`,value:p(e)})},startRenaming(e){o({type:`NODE.RENAME`,value:e})},submitRenaming(e,t){o({type:`RENAME.SUBMIT`,value:e,label:t})},cancelRenaming(){o({type:`RENAME.CANCEL`})},getRootProps(){return t.element({...A.root.attrs,id:getRootId(r),dir:a(`dir`)})},getLabelProps(){return t.element({...A.label.attrs,id:getLabelId(r),dir:a(`dir`)})},getTreeProps(){return t.element({...A.tree.attrs,id:getTreeId(r),dir:a(`dir`),role:`tree`,"aria-label":`Tree View`,"aria-labelledby":getLabelId(r),"aria-multiselectable":a(`selectionMode`)===`multiple`||void 0,tabIndex:-1,onKeyDown(e){if(e.defaultPrevented||C(e))return;let t=g(e);if(S(t))return;let n=t?.closest(`[data-part=branch-control], [data-part=item]`);if(!n)return;let r=n.dataset.value;if(r==null){console.warn(`[zag-js/tree-view] Node id not found for node`,n);return}let i=n.matches(`[data-part=branch-control]`),s={ArrowDown(e){v(e)||(e.preventDefault(),o({type:`NODE.ARROW_DOWN`,id:r,shiftKey:e.shiftKey}))},ArrowUp(e){v(e)||(e.preventDefault(),o({type:`NODE.ARROW_UP`,id:r,shiftKey:e.shiftKey}))},ArrowLeft(e){v(e)||n.dataset.disabled||(e.preventDefault(),o({type:i?`BRANCH_NODE.ARROW_LEFT`:`NODE.ARROW_LEFT`,id:r}))},ArrowRight(e){!i||n.dataset.disabled||(e.preventDefault(),o({type:`BRANCH_NODE.ARROW_RIGHT`,id:r}))},Home(e){v(e)||(e.preventDefault(),o({type:`NODE.HOME`,id:r,shiftKey:e.shiftKey}))},End(e){v(e)||(e.preventDefault(),o({type:`NODE.END`,id:r,shiftKey:e.shiftKey}))},Space(e){n.dataset.disabled||(f?o({type:`TREE.TYPEAHEAD`,key:e.key}):s.Enter?.(e))},Enter(e){n.dataset.disabled||_(t)&&v(e)||(o({type:i?`BRANCH_NODE.CLICK`:`NODE.CLICK`,id:r,src:`keyboard`}),_(t)||e.preventDefault())},"*"(e){n.dataset.disabled||(e.preventDefault(),o({type:`SIBLINGS.EXPAND`,id:r}))},a(e){!e.metaKey||n.dataset.disabled||(e.preventDefault(),o({type:`SELECTED.ALL`,moveFocus:!0}))},F2(e){if(n.dataset.disabled)return;let t=a(`canRename`);if(!t)return;let i=c.getIndexPath(r);if(i){let e=c.at(i);if(e&&!t(e,i))return}e.preventDefault(),o({type:`NODE.RENAME`,value:r})}},l=s[E(e,{dir:a(`dir`)})];if(l){l(e);return}x.isValidEvent(e)&&(o({type:`TREE.TYPEAHEAD`,key:e.key,id:r}),e.preventDefault())}})},getNodeState,getItemProps(e){let n=getNodeState(e);return t.element({...A.item.attrs,id:n.id,dir:a(`dir`),"data-ownedby":getTreeId(r),"data-path":e.indexPath.join(`/`),"data-value":n.value,tabIndex:n.focused?0:-1,"data-focus":h(n.focused),role:`treeitem`,"aria-current":n.selected?`true`:void 0,"aria-selected":n.disabled?void 0:n.selected,"data-selected":h(n.selected),"aria-disabled":T(n.disabled),"data-disabled":h(n.disabled),"data-renaming":h(n.renaming),"aria-level":n.depth,"data-depth":n.depth,style:{"--depth":n.depth},onFocus(e){e.stopPropagation(),o({type:`NODE.FOCUS`,id:n.value})},onClick(e){if(n.disabled||!y(e)||_(e.currentTarget)&&v(e))return;let t=e.metaKey||e.ctrlKey;o({type:`NODE.CLICK`,id:n.value,shiftKey:e.shiftKey,ctrlKey:t}),e.stopPropagation(),_(e.currentTarget)||e.preventDefault()}})},getItemTextProps(e){let n=getNodeState(e);return t.element({...A.itemText.attrs,"data-disabled":h(n.disabled),"data-selected":h(n.selected),"data-focus":h(n.focused)})},getItemIndicatorProps(e){let n=getNodeState(e);return t.element({...A.itemIndicator.attrs,"aria-hidden":!0,"data-disabled":h(n.disabled),"data-selected":h(n.selected),"data-focus":h(n.focused),hidden:!n.selected})},getBranchProps(e){let n=getNodeState(e);return t.element({...A.branch.attrs,"data-depth":n.depth,dir:a(`dir`),"data-branch":n.value,role:`treeitem`,"data-ownedby":getTreeId(r),"data-value":n.value,"aria-level":n.depth,"aria-selected":n.disabled?void 0:n.selected,"data-path":e.indexPath.join(`/`),"data-selected":h(n.selected),"aria-expanded":n.expanded,"data-state":n.expanded?`open`:`closed`,"aria-disabled":T(n.disabled),"data-disabled":h(n.disabled),"data-loading":h(n.loading),"aria-busy":T(n.loading),style:{"--depth":n.depth}})},getBranchIndicatorProps(e){let n=getNodeState(e);return t.element({...A.branchIndicator.attrs,"aria-hidden":!0,"data-state":n.expanded?`open`:`closed`,"data-disabled":h(n.disabled),"data-selected":h(n.selected),"data-focus":h(n.focused),"data-loading":h(n.loading)})},getBranchTriggerProps(e){let n=getNodeState(e);return t.element({...A.branchTrigger.attrs,role:`button`,dir:a(`dir`),"data-disabled":h(n.disabled),"data-state":n.expanded?`open`:`closed`,"data-value":n.value,"data-loading":h(n.loading),disabled:n.loading,onClick(e){n.disabled||n.loading||(o({type:`BRANCH_TOGGLE.CLICK`,id:n.value}),e.stopPropagation())}})},getBranchControlProps(e){let n=getNodeState(e);return t.element({...A.branchControl.attrs,role:`button`,id:n.id,dir:a(`dir`),tabIndex:n.focused?0:-1,"data-path":e.indexPath.join(`/`),"data-state":n.expanded?`open`:`closed`,"data-disabled":h(n.disabled),"data-selected":h(n.selected),"data-focus":h(n.focused),"data-renaming":h(n.renaming),"data-value":n.value,"data-depth":n.depth,"data-loading":h(n.loading),"aria-busy":T(n.loading),onFocus(e){o({type:`NODE.FOCUS`,id:n.value}),e.stopPropagation()},onClick(e){if(n.disabled||n.loading||!y(e)||_(e.currentTarget)&&v(e))return;let t=e.metaKey||e.ctrlKey;o({type:`BRANCH_NODE.CLICK`,id:n.value,shiftKey:e.shiftKey,ctrlKey:t}),e.stopPropagation()}})},getBranchTextProps(e){let n=getNodeState(e);return t.element({...A.branchText.attrs,dir:a(`dir`),"data-disabled":h(n.disabled),"data-state":n.expanded?`open`:`closed`,"data-loading":h(n.loading)})},getBranchContentProps(e){let n=getNodeState(e);return t.element({...A.branchContent.attrs,role:`group`,dir:a(`dir`),"data-state":n.expanded?`open`:`closed`,"data-depth":n.depth,"data-path":e.indexPath.join(`/`),"data-value":n.value,hidden:!n.expanded})},getBranchIndentGuideProps(e){let n=getNodeState(e);return t.element({...A.branchIndentGuide.attrs,"data-depth":n.depth})},getNodeCheckboxProps(e){let n=getNodeState(e),r=n.checked;return t.element({...A.nodeCheckbox.attrs,tabIndex:-1,role:`checkbox`,"data-state":r===!0?`checked`:r===!1?`unchecked`:`indeterminate`,"aria-checked":r===!0?`true`:r===!1?`false`:`mixed`,"data-disabled":h(n.disabled),onClick(e){e.defaultPrevented||n.disabled||y(e)&&(o({type:`CHECKED.TOGGLE`,value:n.value,isBranch:n.isBranch}),e.stopPropagation(),e.currentTarget.closest(`[role=treeitem]`)?.focus({preventScroll:!0}))}})},getNodeRenameInputProps(e){let n=getNodeState(e);return t.input({...A.nodeRenameInput.attrs,id:getRenameInputId(r,n.value),type:`text`,"aria-label":`Rename tree item`,hidden:!n.renaming,onKeyDown(e){C(e)||(e.key===`Escape`&&(o({type:`RENAME.CANCEL`}),e.preventDefault()),e.key===`Enter`&&(o({type:`RENAME.SUBMIT`,label:e.currentTarget.value}),e.preventDefault()),e.stopPropagation())},onBlur(e){o({type:`RENAME.SUBMIT`,label:e.currentTarget.value})}})}}}function expandBranches(e,n){let{context:r,prop:a,refs:o}=e;if(!a(`loadChildren`)){r.set(`expandedValue`,e=>p(s(e,...n)));return}let c=r.get(`loadingStatus`),[l,u]=i(n,e=>c[e]===`loaded`);if(l.length>0&&r.set(`expandedValue`,e=>p(s(e,...l))),u.length===0)return;let d=a(`collection`),[f,m]=i(u,e=>{let t=d.findNode(e);return d.getNodeChildren(t).length>0});if(f.length>0&&r.set(`expandedValue`,e=>p(s(e,...f))),m.length===0)return;r.set(`loadingStatus`,e=>({...e,...m.reduce((e,t)=>({...e,[t]:`loading`}),{})}));let h=m.map(e=>{let t=d.getIndexPath(e);return{id:e,indexPath:t,valuePath:d.getValuePath(t),node:d.findNode(e)}}),g=o.get(`pendingAborts`),_=a(`loadChildren`);t(_,()=>"[zag-js/tree-view] `loadChildren` is required for async expansion");let v=h.map(({id:e,indexPath:t,valuePath:n,node:r})=>{let i=g.get(e);i&&(i.abort(),g.delete(e));let a=new AbortController;return g.set(e,a),_({valuePath:n,indexPath:t,node:r,signal:a.signal})});Promise.allSettled(v).then(e=>{let t=[],n=[],i=r.get(`loadingStatus`),o=a(`collection`);e.forEach((e,r)=>{let{id:a,indexPath:s,node:c,valuePath:l}=h[r];e.status===`fulfilled`?(i[a]=`loaded`,t.push(a),o=o.replace(s,{...c,children:e.value})):(g.delete(a),Reflect.deleteProperty(i,a),n.push({node:c,error:e.reason,indexPath:s,valuePath:l}))}),r.set(`loadingStatus`,i),t.length&&(r.set(`expandedValue`,e=>p(s(e,...t))),a(`onLoadChildrenComplete`)?.({collection:o})),n.length&&a(`onLoadChildrenError`)?.({nodes:n})})}function skipFn(e){let{prop:t,context:n}=e;return function skip({indexPath:e}){return t(`collection`).getValuePath(e).slice(0,-1).some(e=>!n.get(`expandedValue`).includes(e))}}var{and:j}=w(),M=b({props({props:e}){return{selectionMode:`single`,collection:collection.empty(),typeahead:!0,expandOnClick:!0,defaultExpandedValue:[],defaultSelectedValue:[],...e}},initialState(){return`idle`},context({prop:e,bindable:t,getContext:n}){return{expandedValue:t(()=>({defaultValue:e(`defaultExpandedValue`),value:e(`expandedValue`),isEqual:r,onChange(t){let r=n().get(`focusedValue`);e(`onExpandedChange`)?.({expandedValue:t,focusedValue:r,get expandedNodes(){return e(`collection`).findNodes(t)}})}})),selectedValue:t(()=>({defaultValue:e(`defaultSelectedValue`),value:e(`selectedValue`),isEqual:r,onChange(t){let r=n().get(`focusedValue`);e(`onSelectionChange`)?.({selectedValue:t,focusedValue:r,get selectedNodes(){return e(`collection`).findNodes(t)}})}})),focusedValue:t(()=>({defaultValue:e(`defaultFocusedValue`)||null,value:e(`focusedValue`),onChange(t){e(`onFocusChange`)?.({focusedValue:t,get focusedNode(){return t?e(`collection`).findNode(t):null}})}})),loadingStatus:t(()=>({defaultValue:{}})),checkedValue:t(()=>({defaultValue:e(`defaultCheckedValue`)||[],value:e(`checkedValue`),isEqual:r,onChange(t){e(`onCheckedChange`)?.({checkedValue:t})}})),renamingValue:t(()=>({sync:!0,defaultValue:null}))}},refs(){return{typeaheadState:{...x.defaultOptions},pendingAborts:new Map}},computed:{isMultipleSelection:({prop:e})=>e(`selectionMode`)===`multiple`,isTypingAhead:({refs:e})=>e.get(`typeaheadState`).keysSoFar.length>0,visibleNodes:({prop:e,context:t})=>{let n=[];return e(`collection`).visit({skip:skipFn({prop:e,context:t}),onEnter:(e,t)=>{n.push({node:e,indexPath:t})}}),n}},on:{"EXPANDED.SET":{actions:[`setExpanded`]},"EXPANDED.CLEAR":{actions:[`clearExpanded`]},"EXPANDED.ALL":{actions:[`expandAllBranches`]},"BRANCH.EXPAND":{actions:[`expandBranches`]},"BRANCH.COLLAPSE":{actions:[`collapseBranches`]},"SELECTED.SET":{actions:[`setSelected`]},"SELECTED.ALL":[{guard:j(`isMultipleSelection`,`moveFocus`),actions:[`selectAllNodes`,`focusTreeLastNode`]},{guard:`isMultipleSelection`,actions:[`selectAllNodes`]}],"SELECTED.CLEAR":{actions:[`clearSelected`]},"NODE.SELECT":{actions:[`selectNode`]},"NODE.DESELECT":{actions:[`deselectNode`]},"CHECKED.TOGGLE":{actions:[`toggleChecked`]},"CHECKED.SET":{actions:[`setChecked`]},"CHECKED.CLEAR":{actions:[`clearChecked`]},"NODE.FOCUS":{actions:[`setFocusedNode`]},"NODE.ARROW_DOWN":[{guard:j(`isShiftKey`,`isMultipleSelection`),actions:[`focusTreeNextNode`,`extendSelectionToNextNode`]},{actions:[`focusTreeNextNode`]}],"NODE.ARROW_UP":[{guard:j(`isShiftKey`,`isMultipleSelection`),actions:[`focusTreePrevNode`,`extendSelectionToPrevNode`]},{actions:[`focusTreePrevNode`]}],"NODE.ARROW_LEFT":{actions:[`focusBranchNode`]},"BRANCH_NODE.ARROW_LEFT":[{guard:`isBranchExpanded`,actions:[`collapseBranch`]},{actions:[`focusBranchNode`]}],"BRANCH_NODE.ARROW_RIGHT":[{guard:j(`isBranchFocused`,`isBranchExpanded`),actions:[`focusBranchFirstNode`]},{actions:[`expandBranch`]}],"SIBLINGS.EXPAND":{actions:[`expandSiblingBranches`]},"NODE.HOME":[{guard:j(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToFirstNode`,`focusTreeFirstNode`]},{actions:[`focusTreeFirstNode`]}],"NODE.END":[{guard:j(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToLastNode`,`focusTreeLastNode`]},{actions:[`focusTreeLastNode`]}],"NODE.CLICK":[{guard:j(`isCtrlKey`,`isMultipleSelection`),actions:[`toggleNodeSelection`]},{guard:j(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToNode`]},{actions:[`selectNode`]}],"BRANCH_NODE.CLICK":[{guard:j(`isCtrlKey`,`isMultipleSelection`),actions:[`toggleNodeSelection`]},{guard:j(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToNode`]},{guard:`expandOnClick`,actions:[`selectNode`,`toggleBranchNode`]},{actions:[`selectNode`]}],"BRANCH_TOGGLE.CLICK":{actions:[`toggleBranchNode`]},"TREE.TYPEAHEAD":{actions:[`focusMatchedNode`]}},exit:[`clearPendingAborts`],states:{idle:{on:{"NODE.RENAME":{target:`renaming`,actions:[`setRenamingValue`]}}},renaming:{entry:[`syncRenameInput`,`focusRenameInput`],on:{"RENAME.SUBMIT":{guard:`isRenameLabelValid`,target:`idle`,actions:[`submitRenaming`]},"RENAME.CANCEL":{target:`idle`,actions:[`cancelRenaming`]}}}},implementations:{guards:{isBranchFocused:({context:e,event:t})=>e.get(`focusedValue`)===t.id,isBranchExpanded:({context:e,event:t})=>e.get(`expandedValue`).includes(t.id),isShiftKey:({event:e})=>e.shiftKey,isCtrlKey:({event:e})=>e.ctrlKey,hasSelectedItems:({context:e})=>e.get(`selectedValue`).length>0,isMultipleSelection:({prop:e})=>e(`selectionMode`)===`multiple`,moveFocus:({event:e})=>!!e.moveFocus,expandOnClick:({prop:e})=>!!e(`expandOnClick`),isRenameLabelValid:({event:e})=>e.label.trim()!==``},actions:{selectNode({context:e,event:t}){let r=t.id||t.value;e.set(`selectedValue`,e=>r==null?e:!t.isTrusted&&n(r)?e.concat(...r):[n(r)?a(r):r].filter(Boolean))},deselectNode({context:t,event:n}){let r=f(n.id||n.value);t.set(`selectedValue`,t=>e(t,...r))},setFocusedNode({context:e,event:t}){e.set(`focusedValue`,t.id)},clearFocusedNode({context:e}){e.set(`focusedValue`,null)},clearSelectedItem({context:e}){e.set(`selectedValue`,[])},toggleBranchNode({context:e,event:t,action:n}){n(e.get(`expandedValue`).includes(t.id)?[`collapseBranch`]:[`expandBranch`])},expandBranch(e){let{event:t}=e;expandBranches(e,[t.id])},expandBranches(e){let{context:t,event:n}=e;expandBranches(e,u(f(n.value),t.get(`expandedValue`)))},collapseBranch({context:t,event:n}){t.set(`expandedValue`,t=>e(t,n.id))},collapseBranches(t){let{context:n,event:r}=t,i=f(r.value);n.set(`expandedValue`,t=>e(t,...i))},setExpanded({context:e,event:t}){n(t.value)&&e.set(`expandedValue`,t.value)},clearExpanded({context:e}){e.set(`expandedValue`,[])},setSelected({context:e,event:t}){n(t.value)&&e.set(`selectedValue`,t.value)},clearSelected({context:e}){e.set(`selectedValue`,[])},focusTreeFirstNode(e){let{prop:t,scope:n}=e,r=t(`collection`),i=r.getFirstNode(void 0,{skip:skipFn(e)});if(!i)return;let a=r.getNodeValue(i);scrollToNode(e,a)?m(()=>focusNode(n,a)):focusNode(n,a)},focusTreeLastNode(e){let{prop:t,scope:n}=e,r=t(`collection`),i=r.getLastNode(void 0,{skip:skipFn(e)}),a=r.getNodeValue(i);scrollToNode(e,a)?m(()=>focusNode(n,a)):focusNode(n,a)},focusBranchFirstNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.findNode(t.id),o=i.getFirstNode(a,{skip:skipFn(e)});if(!o)return;let s=i.getNodeValue(o);scrollToNode(e,s)?m(()=>focusNode(r,s)):focusNode(r,s)},focusTreeNextNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.getNextNode(t.id,{skip:skipFn(e)});if(!a)return;let o=i.getNodeValue(a);scrollToNode(e,o)?m(()=>focusNode(r,o)):focusNode(r,o)},focusTreePrevNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.getPreviousNode(t.id,{skip:skipFn(e)});if(!a)return;let o=i.getNodeValue(a);scrollToNode(e,o)?m(()=>focusNode(r,o)):focusNode(r,o)},focusBranchNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.getParentNode(t.id),o=a?i.getNodeValue(a):void 0;o&&(scrollToNode(e,o)?m(()=>focusNode(r,o)):focusNode(r,o))},selectAllNodes({context:e,prop:t}){e.set(`selectedValue`,t(`collection`).getValues())},focusMatchedNode(e){let{context:t,prop:n,refs:r,event:i,scope:a,computed:o}=e,s=x(o(`visibleNodes`).map(({node:e})=>({textContent:n(`collection`).stringifyNode(e),id:n(`collection`).getNodeValue(e)})),{state:r.get(`typeaheadState`),activeId:t.get(`focusedValue`),key:i.key});s?.id&&(scrollToNode(e,s.id)?m(()=>focusNode(a,s.id)):focusNode(a,s.id))},toggleNodeSelection({context:e,event:t}){let n=l(e.get(`selectedValue`),t.id);e.set(`selectedValue`,n)},expandAllBranches(e){let{context:t,prop:n}=e;expandBranches(e,u(n(`collection`).getBranchValues(),t.get(`expandedValue`)))},expandSiblingBranches(e){let{context:t,event:n,prop:r}=e,i=r(`collection`),a=i.getIndexPath(n.id);a&&expandBranches(e,u(i.getSiblingNodes(a).map(e=>i.getNodeValue(e)),t.get(`expandedValue`)))},extendSelectionToNode(e){let{context:t,event:n,prop:r,computed:i}=e,a=r(`collection`),s=o(t.get(`selectedValue`))||a.getNodeValue(a.getFirstNode()),c=n.id,l=[s,c],u=0;i(`visibleNodes`).forEach(({node:e})=>{let t=a.getNodeValue(e);u===1&&l.push(t),(t===s||t===c)&&u++}),t.set(`selectedValue`,p(l))},extendSelectionToNextNode(e){let{context:t,event:n,prop:r}=e,i=r(`collection`),a=i.getNextNode(n.id,{skip:skipFn(e)});if(!a)return;let o=new Set(t.get(`selectedValue`)),s=i.getNodeValue(a);s!=null&&(o.has(n.id)&&o.has(s)?o.delete(n.id):o.has(s)||o.add(s),t.set(`selectedValue`,Array.from(o)))},extendSelectionToPrevNode(e){let{context:t,event:n,prop:r}=e,i=r(`collection`),a=i.getPreviousNode(n.id,{skip:skipFn(e)});if(!a)return;let o=new Set(t.get(`selectedValue`)),s=i.getNodeValue(a);s!=null&&(o.has(n.id)&&o.has(s)?o.delete(n.id):o.has(s)||o.add(s),t.set(`selectedValue`,Array.from(o)))},extendSelectionToFirstNode(e){let{context:t,prop:n}=e,r=n(`collection`),i=o(t.get(`selectedValue`)),a=[];r.visit({skip:skipFn(e),onEnter:e=>{let t=r.getNodeValue(e);if(a.push(t),t===i)return`stop`}}),t.set(`selectedValue`,a)},extendSelectionToLastNode(e){let{context:t,prop:n}=e,r=n(`collection`),i=o(t.get(`selectedValue`)),a=[],s=!1;r.visit({skip:skipFn(e),onEnter:e=>{let t=r.getNodeValue(e);t===i&&(s=!0),s&&a.push(t)}}),t.set(`selectedValue`,a)},clearPendingAborts({refs:e}){let t=e.get(`pendingAborts`);t.forEach(e=>e.abort()),t.clear()},toggleChecked({context:e,event:t,prop:n}){let r=n(`collection`);e.set(`checkedValue`,e=>t.isBranch?toggleBranchChecked(r,t.value,e):l(e,t.value))},setChecked({context:e,event:t}){e.set(`checkedValue`,t.value)},clearChecked({context:e}){e.set(`checkedValue`,[])},setRenamingValue({context:e,event:t,prop:n}){e.set(`renamingValue`,t.value);let r=n(`onRenameStart`);if(r){let e=n(`collection`),i=e.getIndexPath(t.value);if(i){let n=e.at(i);n&&r({value:t.value,node:n,indexPath:i})}}},submitRenaming({context:e,event:t,prop:n,scope:r}){let i=e.get(`renamingValue`);if(!i)return;let a=n(`collection`).getIndexPath(i);if(!a)return;let o=t.label.trim(),s=n(`onBeforeRename`);if(s&&!s({value:i,label:o,indexPath:a})){e.set(`renamingValue`,null),focusNode(r,i);return}n(`onRenameComplete`)?.({value:i,label:o,indexPath:a}),e.set(`renamingValue`,null),focusNode(r,i)},cancelRenaming({context:e,scope:t}){let n=e.get(`renamingValue`);e.set(`renamingValue`,null),n&&focusNode(t,n)},syncRenameInput({context:e,scope:t,prop:n}){let r=e.get(`renamingValue`);if(!r)return;let i=n(`collection`),a=i.findNode(r);if(!a)return;let o=i.stringifyNode(a);D(getRenameInputEl(t,r),o)},focusRenameInput({context:e,scope:t}){let n=e.get(`renamingValue`);if(!n)return;let r=getRenameInputEl(t,n);r&&(r.focus(),r.select())}}}});function scrollToNode(e,t){let{prop:n,scope:r,computed:i}=e,a=n(`scrollToIndexFn`);if(!a)return!1;let o=n(`collection`),s=i(`visibleNodes`);for(let e=0;e<s.length;e++){let{node:n,indexPath:i}=s[e];if(o.getNodeValue(n)===t)return a({index:e,node:n,indexPath:i,getElement:()=>r.getById(getNodeId(r,t))}),!0}return!1}c(O()(`ids.collection.dir.expandedValue.expandOnClick.defaultFocusedValue.focusedValue.getRootNode.id.onExpandedChange.onFocusChange.onSelectionChange.checkedValue.selectedValue.selectionMode.typeahead.defaultExpandedValue.defaultSelectedValue.defaultCheckedValue.onCheckedChange.onLoadChildrenComplete.onLoadChildrenError.loadChildren.canRename.onRenameStart.onBeforeRename.onRenameComplete.scrollToIndexFn`.split(`.`))),c(O()([`node`,`indexPath`]));export{connect as n,M as r,collection as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../rolldown-runtime.mjs";const{abs:e,cos:n,sin:r,acos:i,atan2:a,sqrt:o,pow:s}=Math;function crt(e){return e<0?-s(-e,1/3):s(e,1/3)}const c=Math.PI,l=2*c,u=c/2,f=2**53-1||9007199254740991,p=-(2**53-1)||-9007199254740991,m={x:0,y:0,z:0},h={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){let r=n(e),i=r.x*r.x+r.y*r.y;return r.z!==void 0&&(i+=r.z*r.z),o(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];let i=n.length-1;if(e===1)return n[i].t=1,n[i];let a=1-e,o=n;if(i===0)return n[0].t=e,n[0];if(i===1){let n={x:a*o[0].x+e*o[1].x,y:a*o[0].y+e*o[1].y,t:e};return r&&(n.z=a*o[0].z+e*o[1].z),n}if(i<4){let n=a*a,s=e*e,c,l,u,f=0;i===2?(o=[o[0],o[1],o[2],m],c=n,l=a*e*2,u=s):i===3&&(c=n*a,l=n*e*3,u=a*s*3,f=e*s);let p={x:c*o[0].x+l*o[1].x+u*o[2].x+f*o[3].x,y:c*o[0].y+l*o[1].y+u*o[2].y+f*o[3].y,t:e};return r&&(p.z=c*o[0].z+l*o[1].z+u*o[2].z+f*o[3].z),p}let s=JSON.parse(JSON.stringify(n));for(;s.length>1;){for(let n=0;n<s.length-1;n++)s[n]={x:s[n].x+(s[n+1].x-s[n].x)*e,y:s[n].y+(s[n+1].y-s[n].y)*e},s[n].z!==void 0&&(s[n].z=s[n].z+(s[n+1].z-s[n].z)*e);s.splice(s.length-1,1)}return s[0].t=e,s[0]},computeWithRatios:function(e,n,r,i){let a=1-e,o=r,s=n,c=o[0],l=o[1],u=o[2],f=o[3],p;if(c*=a,l*=e,s.length===2)return p=c+l,{x:(c*s[0].x+l*s[1].x)/p,y:(c*s[0].y+l*s[1].y)/p,z:i?(c*s[0].z+l*s[1].z)/p:!1,t:e};if(c*=a,l*=2*a,u*=e*e,s.length===3)return p=c+l+u,{x:(c*s[0].x+l*s[1].x+u*s[2].x)/p,y:(c*s[0].y+l*s[1].y+u*s[2].y)/p,z:i?(c*s[0].z+l*s[1].z+u*s[2].z)/p:!1,t:e};if(c*=a,l*=1.5*a,u*=3*a,f*=e*e*e,s.length===4)return p=c+l+u+f,{x:(c*s[0].x+l*s[1].x+u*s[2].x+f*s[3].x)/p,y:(c*s[0].y+l*s[1].y+u*s[2].y+f*s[3].y)/p,z:i?(c*s[0].z+l*s[1].z+u*s[2].z+f*s[3].z)/p:!1,t:e}},derive:function(e,n){let r=[];for(let i=e,a=i.length,o=a-1;a>1;a--,o--){let e=[];for(let r=0,a;r<o;r++)a={x:o*(i[r+1].x-i[r].x),y:o*(i[r+1].y-i[r].y)},n&&(a.z=o*(i[r+1].z-i[r].z)),e.push(a);r.push(e),i=e}return r},between:function(e,n,r){return n<=e&&e<=r||h.approximately(e,n)||h.approximately(e,r)},approximately:function(n,r,i){return e(n-r)<=(i||1e-6)},length:function(e){let n=.5,r=h.Tvalues.length,i=0;for(let a=0,o;a<r;a++)o=n*h.Tvalues[a]+n,i+=h.Cvalues[a]*h.arcfn(o,e);return n*i},map:function(e,n,r,i,a){let o=r-n;return i+(a-i)*((e-n)/o)},lerp:function(e,n,r){let i={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(i.z=n.z+e*(r.z-n.z)),i},pointToString:function(e){let n=e.x+`/`+e.y;return e.z!==void 0&&(n+=`/`+e.z),n},pointsToString:function(e){return`[`+e.map(h.pointToString).join(`, `)+`]`},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){let i=n.x-e.x,o=n.y-e.y,s=r.x-e.x,c=r.y-e.y;return a(i*c-o*s,i*s+o*c)},round:function(e,n){let r=``+e,i=r.indexOf(`.`);return parseFloat(r.substring(0,i+1+n))},dist:function(e,n){let r=e.x-n.x,i=e.y-n.y;return o(r*r+i*i)},closest:function(e,n){let r=s(2,63),i,a;return e.forEach(function(e,o){a=h.dist(n,e),a<r&&(r=a,i=o)}),{mdist:r,mpos:i}},abcratio:function(n,r){if(r!==2&&r!==3)return!1;if(n===void 0)n=.5;else if(n===0||n===1)return n;let i=s(n,r)+s(1-n,r);return e((i-1)/i)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(e===void 0)e=.5;else if(e===0||e===1)return e;let r=s(1-e,n);return r/(s(e,n)+r)},lli8:function(e,n,r,i,a,o,s,c){let l=(e*i-n*r)*(a-s)-(e-r)*(a*c-o*s),u=(e*i-n*r)*(o-c)-(n-i)*(a*c-o*s),f=(e-r)*(o-c)-(n-i)*(a-s);return f==0?!1:{x:l/f,y:u/f}},lli4:function(e,n,r,i){let a=e.x,o=e.y,s=n.x,c=n.y,l=r.x,u=r.y,f=i.x,p=i.y;return h.lli8(a,o,s,c,l,u,f,p)},lli:function(e,n){return h.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new T(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=f,r=f,i=p,a=p;return e.forEach(function(e){let o=e.bbox();n>o.x.min&&(n=o.x.min),r>o.y.min&&(r=o.y.min),i<o.x.max&&(i=o.x.max),a<o.y.max&&(a=o.y.max)}),{x:{min:n,mid:(n+i)/2,max:i,size:i-n},y:{min:r,mid:(r+a)/2,max:a,size:a-r}}},shapeintersections:function(e,n,r,i,a){if(!h.bboxoverlap(n,i))return[];let o=[],s=[e.startcap,e.forward,e.back,e.endcap],c=[r.startcap,r.forward,r.back,r.endcap];return s.forEach(function(n){n.virtual||c.forEach(function(i){if(i.virtual)return;let s=n.intersects(i,a);s.length>0&&(s.c1=n,s.c2=i,s.s1=e,s.s2=r,o.push(s))})}),o},makeshape:function(e,n,r){let i=n.points.length,a=e.points.length,o=h.makeline(n.points[i-1],e.points[0]),s=h.makeline(e.points[a-1],n.points[0]),c={startcap:o,forward:e,back:n,endcap:s,bbox:h.findbbox([o,e,n,s])};return c.intersections=function(e){return h.shapeintersections(c,c.bbox,e,e.bbox,r)},c},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let i=f,a=p,o,s;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let c=0,l=r.length;c<l;c++)o=r[c],s=e.get(o),s[n]<i&&(i=s[n]),s[n]>a&&(a=s[n]);return{min:i,mid:(i+a)/2,max:a,size:a-i}},align:function(e,i){let o=i.p1.x,s=i.p1.y,c=-a(i.p2.y-s,i.p2.x-o),d=function(e){return{x:(e.x-o)*n(c)-(e.y-s)*r(c),y:(e.x-o)*r(c)+(e.y-s)*n(c)}};return e.map(d)},roots:function(e,r){r||={p1:{x:0,y:0},p2:{x:1,y:0}};let a=e.length-1,s=h.align(e,r),reduce=function(e){return 0<=e&&e<=1};if(a===2){let e=s[0].y,n=s[1].y,r=s[2].y,i=e-2*n+r;if(i!==0){let a=-o(n*n-e*r),s=-e+n;return[-(a+s)/i,-(-a+s)/i].filter(reduce)}else if(n!==r&&i===0)return[(2*n-r)/(2*n-2*r)].filter(reduce);return[]}let c=s[0].y,u=s[1].y,f=s[2].y,p=s[3].y,m=-c+3*u-3*f+p,g=3*c-6*u+3*f,_=-3*c+3*u,v=c;if(h.approximately(m,0)){if(h.approximately(g,0))return h.approximately(_,0)?[]:[-v/_].filter(reduce);let e=o(_*_-4*g*v),n=2*g;return[(e-_)/n,(-_-e)/n].filter(reduce)}g/=m,_/=m,v/=m;let y=(3*_-g*g)/3,b=y/3,x=(2*g*g*g-9*g*_+27*v)/27,S=x/2,C=S*S+b*b*b,w,T,E,D,O;if(C<0){let e=-y/3,r=o(e*e*e),a=-x/(2*r),s=i(a<-1?-1:a>1?1:a),c=2*crt(r);return E=c*n(s/3)-g/3,D=c*n((s+l)/3)-g/3,O=c*n((s+2*l)/3)-g/3,[E,D,O].filter(reduce)}else if(C===0)return w=S<0?crt(-S):-crt(S),E=2*w-g/3,D=-w-g/3,[E,D].filter(reduce);else{let e=o(C);return w=crt(-S+e),T=crt(S+e),[w-T-g/3].filter(reduce)}},droots:function(e){if(e.length===3){let n=e[0],r=e[1],i=e[2],a=n-2*r+i;if(a!==0){let e=-o(r*r-n*i),s=-n+r;return[-(e+s)/a,-(-e+s)/a]}else if(r!==i&&a===0)return[(2*r-i)/(2*(r-i))];return[]}if(e.length===2){let n=e[0],r=e[1];return n===r?[]:[n/(n-r)]}return[]},curvature:function(n,r,i,a,c){let l,u,f,p,m=0,g=0,_=h.compute(n,r),v=h.compute(n,i),y=_.x*_.x+_.y*_.y;if(a?(l=o(s(_.y*v.z-v.y*_.z,2)+s(_.z*v.x-v.z*_.x,2)+s(_.x*v.y-v.x*_.y,2)),u=s(y+_.z*_.z,3/2)):(l=_.x*v.y-_.y*v.x,u=s(y,3/2)),l===0||u===0)return{k:0,r:0};if(m=l/u,g=u/l,!c){let o=h.curvature(n-.001,r,i,a,!0).k,s=h.curvature(n+.001,r,i,a,!0).k;p=(s-m+(m-o))/2,f=(e(s-m)+e(m-o))/2}return{k:m,r:g,dk:p,adk:f}},inflections:function(e){if(e.length<4)return[];let n=h.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,i=n[3].x*n[1].y,a=n[1].x*n[2].y,o=n[3].x*n[2].y,s=18*(-3*r+2*i+3*a-o),c=18*(3*r-i-3*a),l=18*(a-r);if(h.approximately(s,0)){if(!h.approximately(c,0)){let e=-l/c;if(0<=e&&e<=1)return[e]}return[]}let u=2*s;if(h.approximately(u,0))return[];let f=c*c-4*s*l;if(f<0)return[];let p=Math.sqrt(f);return[(p-c)/u,-(c+p)/u].filter(function(e){return 0<=e&&e<=1})},bboxoverlap:function(n,r){let i=[`x`,`y`],a=i.length;for(let o=0,s,c,l,u;o<a;o++)if(s=i[o],c=n[s].mid,l=r[s].mid,u=(n[s].size+r[s].size)/2,e(c-l)>=u)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){let i=e.bbox(),a=n.bbox(),o=1e5,s=r||.5;if(i.x.size+i.y.size<s&&a.x.size+a.y.size<s)return[(o*(e._t1+e._t2)/2|0)/o+`/`+(o*(n._t1+n._t2)/2|0)/o];let c=e.split(.5),l=n.split(.5),u=[{left:c.left,right:l.left},{left:c.left,right:l.right},{left:c.right,right:l.right},{left:c.right,right:l.left}];u=u.filter(function(e){return h.bboxoverlap(e.left.bbox(),e.right.bbox())});let f=[];return u.length===0?f:(u.forEach(function(e){f=f.concat(h.pairiteration(e.left,e.right,s))}),f=f.filter(function(e,n){return f.indexOf(e)===n}),f)},getccenter:function(e,i,o){let s=i.x-e.x,c=i.y-e.y,f=o.x-i.x,p=o.y-i.y,m=s*n(u)-c*r(u),g=s*r(u)+c*n(u),_=f*n(u)-p*r(u),v=f*r(u)+p*n(u),y=(e.x+i.x)/2,b=(e.y+i.y)/2,x=(i.x+o.x)/2,S=(i.y+o.y)/2,C=y+m,w=b+g,T=x+_,E=S+v,D=h.lli8(y,b,C,w,x,S,T,E),O=h.dist(D,e),k=a(e.y-D.y,e.x-D.x),A=a(i.y-D.y,i.x-D.x),j=a(o.y-D.y,o.x-D.x),M;return k<j?((k>A||A>j)&&(k+=l),k>j&&(M=j,j=k,k=M)):j<A&&A<k?(M=j,j=k,k=M):j+=l,D.s=k,D.e=j,D.r=O,D},numberSort:function(e,n){return e-n}};var g=class PolyBezier{constructor(e){this.curves=[],this._3d=!1,e&&(this.curves=e,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return`[`+this.curves.map(function(e){return h.pointsToString(e.points)}).join(`, `)+`]`}addCurve(e){this.curves.push(e),this._3d=this._3d||e._3d}length(){return this.curves.map(function(e){return e.length()}).reduce(function(e,n){return e+n})}curve(e){return this.curves[e]}bbox(){let e=this.curves;for(var n=e[0].bbox(),r=1;r<e.length;r++)h.expandbox(n,e[r].bbox());return n}offset(e){let n=[];return this.curves.forEach(function(r){n.push(...r.offset(e))}),new PolyBezier(n)}};const{abs:_,min:v,max:y,cos:b,sin:x,acos:S,sqrt:C}=Math,w=Math.PI;var T=class Bezier{constructor(e){let n=e&&e.forEach?e:Array.from(arguments).slice(),r=!1;if(typeof n[0]==`object`){r=n.length;let e=[];n.forEach(function(n){[`x`,`y`,`z`].forEach(function(r){n[r]!==void 0&&e.push(n[r])})}),n=e}let i=!1,a=n.length;if(r){if(r>4){if(arguments.length!==1)throw Error(`Only new Bezier(point[]) is accepted for 4th and higher order curves`);i=!0}}else if(a!==6&&a!==8&&a!==9&&a!==12&&arguments.length!==1)throw Error(`Only new Bezier(point[]) is accepted for 4th and higher order curves`);let o=this._3d=!i&&(a===9||a===12)||e&&e[0]&&e[0].z!==void 0,s=this.points=[];for(let e=0,r=o?3:2;e<a;e+=r){var c={x:n[e],y:n[e+1]};o&&(c.z=n[e+2]),s.push(c)}let l=this.order=s.length-1,u=this.dims=[`x`,`y`];o&&u.push(`z`),this.dimlen=u.length;let f=h.align(s,{p1:s[0],p2:s[l]}),p=h.dist(s[0],s[l]);this._linear=f.reduce((e,n)=>e+_(n.y),0)<p/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(e,n,r,i){return i===void 0&&(i=.5),i===0?new Bezier(n,n,r):i===1?new Bezier(e,n,n):new Bezier(e,Bezier.getABC(2,e,n,r,i).A,r)}static cubicFromPoints(e,n,r,i,a){i===void 0&&(i=.5);let o=Bezier.getABC(3,e,n,r,i);a===void 0&&(a=h.dist(n,o.C));let s=a*(1-i)/i,c=h.dist(e,r),l=(r.x-e.x)/c,u=(r.y-e.y)/c,f=a*l,p=a*u,m=s*l,g=s*u,_={x:n.x-f,y:n.y-p},v={x:n.x+m,y:n.y+g},y=o.A,b={x:y.x+(_.x-y.x)/(1-i),y:y.y+(_.y-y.y)/(1-i)},x={x:y.x+(v.x-y.x)/i,y:y.y+(v.y-y.y)/i};return new Bezier(e,{x:e.x+(b.x-e.x)/i,y:e.y+(b.y-e.y)/i},{x:r.x+(x.x-r.x)/(1-i),y:r.y+(x.y-r.y)/(1-i)},r)}static getUtils(){return h}getUtils(){return Bezier.getUtils()}static get PolyBezier(){return g}valueOf(){return this.toString()}toString(){return h.pointsToString(this.points)}toSVG(){if(this._3d)return!1;let e=this.points,n=[`M`,e[0].x,e[0].y,this.order===2?`Q`:`C`];for(let r=1,i=e.length;r<i;r++)n.push(e[r].x),n.push(e[r].y);return n.join(` `)}setRatios(e){if(e.length!==this.points.length)throw Error(`incorrect number of ratio values`);this.ratios=e,this._lut=[]}verify(){let e=this.coordDigest();e!==this._print&&(this._print=e,this.update())}coordDigest(){return this.points.map(function(e,n){return``+n+e.x+e.y+(e.z?e.z:0)}).join(``)}update(){this._lut=[],this.dpoints=h.derive(this.points,this._3d),this.computedirection()}computedirection(){let e=this.points,n=h.angle(e[0],e[this.order],e[1]);this.clockwise=n>0}length(){return h.length(this.derivative.bind(this))}static getABC(e=2,n,r,i,a=.5){let o=h.projectionratio(a,e),s=1-o,c={x:o*n.x+s*i.x,y:o*n.y+s*i.y},l=h.abcratio(a,e);return{A:{x:r.x+(r.x-c.x)/l,y:r.y+(r.y-c.y)/l},B:r,C:c,S:n,E:i}}getABC(e,n){n||=this.get(e);let r=this.points[0],i=this.points[this.order];return Bezier.getABC(this.order,r,n,i,e)}getLUT(e){if(this.verify(),e||=100,this._lut.length===e+1)return this._lut;this._lut=[],e++,this._lut=[];for(let n=0,r,i;n<e;n++)i=n/(e-1),r=this.compute(i),r.t=i,this._lut.push(r);return this._lut}on(e,n){n||=5;let r=this.getLUT(),i=[];for(let a=0,o,s=0;a<r.length;a++)o=r[a],h.dist(o,e)<n&&(i.push(o),s+=a/r.length);return i.length?t/=i.length:!1}project(e){let n=this.getLUT(),r=n.length-1,i=h.closest(n,e),a=i.mpos,o=(a-1)/r,s=(a+1)/r,c=.1/r,l=i.mdist,u=o,f=u,p;l+=1;for(let n;u<s+c;u+=c)p=this.compute(u),n=h.dist(e,p),n<l&&(l=n,f=u);return f=f<0?0:f>1?1:f,p=this.compute(f),p.t=f,p.d=l,p}get(e){return this.compute(e)}point(e){return this.points[e]}compute(e){return this.ratios?h.computeWithRatios(e,this.points,this.ratios,this._3d):h.compute(e,this.points,this._3d,this.ratios)}raise(){let e=this.points,n=[e[0]],r=e.length;for(let i=1,a,o;i<r;i++)a=e[i],o=e[i-1],n[i]={x:(r-i)/r*a.x+i/r*o.x,y:(r-i)/r*a.y+i/r*o.y};return n[r]=e[r-1],new Bezier(n)}derivative(e){return h.compute(e,this.dpoints[0],this._3d)}dderivative(e){return h.compute(e,this.dpoints[1],this._3d)}align(){let e=this.points;return new Bezier(h.align(e,{p1:e[0],p2:e[e.length-1]}))}curvature(e){return h.curvature(e,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return h.inflections(this.points)}normal(e){return this._3d?this.__normal3(e):this.__normal2(e)}__normal2(e){let n=this.derivative(e),r=C(n.x*n.x+n.y*n.y);return{t:e,x:-n.y/r,y:n.x/r}}__normal3(e){let n=this.derivative(e),r=this.derivative(e+.01),i=C(n.x*n.x+n.y*n.y+n.z*n.z),a=C(r.x*r.x+r.y*r.y+r.z*r.z);n.x/=i,n.y/=i,n.z/=i,r.x/=a,r.y/=a,r.z/=a;let o={x:r.y*n.z-r.z*n.y,y:r.z*n.x-r.x*n.z,z:r.x*n.y-r.y*n.x},s=C(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;let c=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:e,x:c[0]*n.x+c[1]*n.y+c[2]*n.z,y:c[3]*n.x+c[4]*n.y+c[5]*n.z,z:c[6]*n.x+c[7]*n.y+c[8]*n.z}}hull(e){let n=this.points,r=[],i=[],a=0;for(i[a++]=n[0],i[a++]=n[1],i[a++]=n[2],this.order===3&&(i[a++]=n[3]);n.length>1;){r=[];for(let o=0,s,c=n.length-1;o<c;o++)s=h.lerp(e,n[o],n[o+1]),i[a++]=s,r.push(s);n=r}return i}split(e,n){if(e===0&&n)return this.split(n).left;if(n===1)return this.split(e).right;let r=this.hull(e),i={left:this.order===2?new Bezier([r[0],r[3],r[5]]):new Bezier([r[0],r[4],r[7],r[9]]),right:this.order===2?new Bezier([r[5],r[4],r[2]]):new Bezier([r[9],r[8],r[6],r[3]]),span:r};return i.left._t1=h.map(0,0,1,this._t1,this._t2),i.left._t2=h.map(e,0,1,this._t1,this._t2),i.right._t1=h.map(e,0,1,this._t1,this._t2),i.right._t2=h.map(1,0,1,this._t1,this._t2),n?(n=h.map(n,e,1,0,1),i.right.split(n).left):i}extrema(){let e={},n=[];return this.dims.forEach(function(r){let mfn=function(e){return e[r]},i=this.dpoints[0].map(mfn);e[r]=h.droots(i),this.order===3&&(i=this.dpoints[1].map(mfn),e[r]=e[r].concat(h.droots(i))),e[r]=e[r].filter(function(e){return e>=0&&e<=1}),n=n.concat(e[r].sort(h.numberSort))}.bind(this)),e.values=n.sort(h.numberSort).filter(function(e,r){return n.indexOf(e)===r}),e}bbox(){let e=this.extrema(),n={};return this.dims.forEach(function(r){n[r]=h.getminmax(this,r,e[r])}.bind(this)),n}overlaps(e){let n=this.bbox(),r=e.bbox();return h.bboxoverlap(n,r)}offset(e,n){if(n!==void 0){let r=this.get(e),i=this.normal(e),a={c:r,n:i,x:r.x+i.x*n,y:r.y+i.y*n};return this._3d&&(a.z=r.z+i.z*n),a}if(this._linear){let n=this.normal(0);return[new Bezier(this.points.map(function(r){let i={x:r.x+e*n.x,y:r.y+e*n.y};return r.z&&n.z&&(i.z=r.z+e*n.z),i}))]}return this.reduce().map(function(n){return n._linear?n.offset(e)[0]:n.scale(e)})}simple(){if(this.order===3){let e=h.angle(this.points[0],this.points[3],this.points[1]),n=h.angle(this.points[0],this.points[3],this.points[2]);if(e>0&&n<0||e<0&&n>0)return!1}let e=this.normal(0),n=this.normal(1),r=e.x*n.x+e.y*n.y;return this._3d&&(r+=e.z*n.z),_(S(r))<w/3}reduce(){let e,n=0,r=0,i=.01,a,o=[],s=[],c=this.extrema().values;for(c.indexOf(0)===-1&&(c=[0].concat(c)),c.indexOf(1)===-1&&c.push(1),n=c[0],e=1;e<c.length;e++)r=c[e],a=this.split(n,r),a._t1=n,a._t2=r,o.push(a),n=r;return o.forEach(function(e){for(n=0,r=0;r<=1;)for(r=n+i;r<=1+i;r+=i)if(a=e.split(n,r),!a.simple()){if(r-=i,_(n-r)<i)return[];a=e.split(n,r),a._t1=h.map(n,0,1,e._t1,e._t2),a._t2=h.map(r,0,1,e._t1,e._t2),s.push(a),n=r;break}n<1&&(a=e.split(n,1),a._t1=h.map(n,0,1,e._t1,e._t2),a._t2=e._t2,s.push(a))}),s}translate(e,n,r){r=typeof r==`number`?r:n;let i=this.order,a=this.points.map((e,a)=>(1-a/i)*n+a/i*r);return new Bezier(this.points.map((n,r)=>({x:n.x+e.x*a[r],y:n.y+e.y*a[r]})))}scale(e){let n=this.order,r=!1;if(typeof e==`function`&&(r=e),r&&n===2)return this.raise().scale(r);let i=this.clockwise,a=this.points;if(this._linear)return this.translate(this.normal(0),r?r(0):e,r?r(1):e);let o=r?r(0):e,s=r?r(1):e,c=[this.offset(0,10),this.offset(1,10)],l=[],u=h.lli4(c[0],c[0].c,c[1],c[1].c);if(!u)throw Error(`cannot scale this curve. Try reducing it first.`);return[0,1].forEach(function(e){let r=l[e*n]=h.copy(a[e*n]);r.x+=(e?s:o)*c[e].n.x,r.y+=(e?s:o)*c[e].n.y}),r?([0,1].forEach(function(o){if(!(n===2&&o)){var s=a[o+1],c={x:s.x-u.x,y:s.y-u.y},f=r?r((o+1)/n):e;r&&!i&&(f=-f);var p=C(c.x*c.x+c.y*c.y);c.x/=p,c.y/=p,l[o+1]={x:s.x+f*c.x,y:s.y+f*c.y}}}),new Bezier(l)):([0,1].forEach(e=>{if(n===2&&e)return;let r=l[e*n],i=this.derivative(e),o={x:r.x+i.x,y:r.y+i.y};l[e+1]=h.lli4(r,o,u,a[e+1])}),new Bezier(l))}outline(e,n,r,i){if(n=n===void 0?e:n,this._linear){let a=this.normal(0),o=this.points[0],s=this.points[this.points.length-1],c,l,u;r===void 0&&(r=e,i=n),c={x:o.x+a.x*e,y:o.y+a.y*e},u={x:s.x+a.x*r,y:s.y+a.y*r},l={x:(c.x+u.x)/2,y:(c.y+u.y)/2};let f=[c,l,u];c={x:o.x-a.x*n,y:o.y-a.y*n},u={x:s.x-a.x*i,y:s.y-a.y*i},l={x:(c.x+u.x)/2,y:(c.y+u.y)/2};let p=[u,l,c],m=h.makeline(p[2],f[0]),_=h.makeline(f[2],p[0]);return new g([m,new Bezier(f),_,new Bezier(p)])}let a=this.reduce(),o=a.length,s=[],c=[],l,u=0,f=this.length(),p=r!==void 0&&i!==void 0;function linearDistanceFunction(e,n,r,i,a){return function(o){let s=i/r,c=(i+a)/r,l=n-e;return h.map(o,0,1,e+s*l,e+c*l)}}a.forEach(function(a){let o=a.length();p?(s.push(a.scale(linearDistanceFunction(e,r,f,u,o))),c.push(a.scale(linearDistanceFunction(-n,-i,f,u,o)))):(s.push(a.scale(e)),c.push(a.scale(-n))),u+=o}),c=c.map(function(e){return l=e.points,l[3]?e.points=[l[3],l[2],l[1],l[0]]:e.points=[l[2],l[1],l[0]],e}).reverse();let m=s[0].points[0],_=s[o-1].points[s[o-1].points.length-1],v=c[o-1].points[c[o-1].points.length-1],y=c[0].points[0],b=h.makeline(v,m),x=h.makeline(_,y);return new g([b].concat(s,[x],c))}outlineshapes(e,n,r){n||=e;let i=this.outline(e,n).curves,a=[];for(let e=1,n=i.length;e<n/2;e++){let o=h.makeshape(i[e],i[n-e],r);o.startcap.virtual=e>1,o.endcap.virtual=e<n/2-1,a.push(o)}return a}intersects(e,n){return e?e.p1&&e.p2?this.lineIntersects(e):(e instanceof Bezier&&(e=e.reduce()),this.curveintersects(this.reduce(),e,n)):this.selfintersects(n)}lineIntersects(e){let n=v(e.p1.x,e.p2.x),r=v(e.p1.y,e.p2.y),i=y(e.p1.x,e.p2.x),a=y(e.p1.y,e.p2.y);return h.roots(this.points,e).filter(e=>{var o=this.get(e);return h.between(o.x,n,i)&&h.between(o.y,r,a)})}selfintersects(e){let n=this.reduce(),r=n.length-2,i=[];for(let a=0,o,s,c;a<r;a++)s=n.slice(a,a+1),c=n.slice(a+2),o=this.curveintersects(s,c,e),i.push(...o);return i}curveintersects(e,n,r){let i=[];e.forEach(function(e){n.forEach(function(n){e.overlaps(n)&&i.push({left:e,right:n})})});let a=[];return i.forEach(function(e){let n=h.pairiteration(e.left,e.right,r);n.length>0&&(a=a.concat(n))}),a}arcs(e){return e||=.5,this._iterate(e,[])}_error(e,n,r,i){let a=(i-r)/4,o=this.get(r+a),s=this.get(i-a),c=h.dist(e,n),l=h.dist(e,o),u=h.dist(e,s);return _(l-c)+_(u-c)}_iterate(e,n){let r=0,i=1,a;do{a=0,i=1;let o=this.get(r),s,c,l,u,f=!1,p=!1,m,g=i,_=1,v=0;do if(p=f,u=l,g=(r+i)/2,v++,s=this.get(g),c=this.get(i),l=h.getccenter(o,s,c),l.interval={start:r,end:i},f=this._error(l,o,r,i)<=e,m=p&&!f,m||(_=i),f){if(i>=1){if(l.interval.end=_=1,u=l,i>1){let e={x:l.x+l.r*b(l.e),y:l.y+l.r*x(l.e)};l.e+=h.angle({x:l.x,y:l.y},e,this.get(1))}break}i+=(i-r)/2}else i=g;while(!m&&a++<100);if(a>=100)break;u||=l,n.push(u),r=_}while(i<1);return n}};export{T as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../rolldown-runtime.mjs";const e=Math.PI,t=2*e,n=1e-6,r=t-n;function append(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function appendRound(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return append;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var Path=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?append:appendRound(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(t,r,i,a,o){if(t=+t,r=+r,i=+i,a=+a,o=+o,o<0)throw Error(`negative radius: ${o}`);let s=this._x1,c=this._y1,l=i-t,u=a-r,d=s-t,f=c-r,p=d*d+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(p>n)if(!(Math.abs(f*l-u*d)>n)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let m=i-s,h=a-c,g=l*l+u*u,_=m*m+h*h,v=Math.sqrt(g),y=Math.sqrt(p),b=o*Math.tan((e-Math.acos((g+p-_)/(2*v*y)))/2),x=b/y,S=b/v;Math.abs(x-1)>n&&this._append`L${t+x*d},${r+x*f}`,this._append`A${o},${o},0,0,${+(f*m>d*h)},${this._x1=t+S*l},${this._y1=r+S*u}`}}arc(i,a,o,s,c,l){if(i=+i,a=+a,o=+o,l=!!l,o<0)throw Error(`negative radius: ${o}`);let u=o*Math.cos(s),d=o*Math.sin(s),f=i+u,p=a+d,m=1^l,h=l?s-c:c-s;this._x1===null?this._append`M${f},${p}`:(Math.abs(this._x1-f)>n||Math.abs(this._y1-p)>n)&&this._append`L${f},${p}`,o&&(h<0&&(h=h%t+t),h>r?this._append`A${o},${o},0,1,${m},${i-u},${a-d}A${o},${o},0,1,${m},${this._x1=f},${this._y1=p}`:h>n&&this._append`A${o},${o},0,${+(h>=e)},${m},${this._x1=i+o*Math.cos(c)},${this._y1=a+o*Math.sin(c)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function path(){return new Path}path.prototype=Path.prototype;export{Path as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"../rolldown-runtime.mjs";import{t}from"./d3-path.mjs";function constant_default(e){return function constant(){return e}}e(constant_default,`default`);const n=Math.PI;n/2,2*n;function withPath(e){let n=3;return e.digits=function(t){if(!arguments.length)return n;if(t==null)n=null;else{let e=Math.floor(t);if(!(e>=0))throw RangeError(`invalid digits: ${t}`);n=e}return e},()=>new t(n)}Array.prototype.slice;function array_default(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}e(array_default,`default`);function Linear(e){this._context=e}Linear.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function linear_default(e){return new Linear(e)}e(linear_default,`default`);function x(e){return e[0]}function y(e){return e[1]}function line_default(e,t){var n=constant_default(!0),r=null,i=linear_default,a=null,o=withPath(line);e=typeof e==`function`?e:e===void 0?x:constant_default(e),t=typeof t==`function`?t:t===void 0?y:constant_default(t);function line(s){var c,l=(s=array_default(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return line.x=function(t){return arguments.length?(e=typeof t==`function`?t:constant_default(+t),line):e},line.y=function(e){return arguments.length?(t=typeof e==`function`?e:constant_default(+e),line):t},line.defined=function(e){return arguments.length?(n=typeof e==`function`?e:constant_default(!!e),line):n},line.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),line):i},line.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),line):r},line}e(line_default,`default`);function point$1(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}e(point$1,`point`);function Cardinal(e,t){this._context=e,this._k=(1-t)/6}Cardinal.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:point$1(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:point$1(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function custom(e){function cardinal(t){return new Cardinal(t,e)}return cardinal.tension=function(e){return custom(+e)},cardinal})(0);function CardinalOpen(e,t){this._context=e,this._k=(1-t)/6}CardinalOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:point$1(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function custom(e){function cardinal(t){return new CardinalOpen(t,e)}return cardinal.tension=function(e){return custom(+e)},cardinal})(0);function point(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>1e-12){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>1e-12){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function CatmullRom(e,t){this._context=e,this._alpha=t}CatmullRom.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:point(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function custom(e){function catmullRom(t){return e?new CatmullRom(t,e):new Cardinal(t,0)}return catmullRom.alpha=function(e){return custom(+e)},catmullRom})(.5);function CatmullRomOpen(e,t){this._context=e,this._alpha=t}CatmullRomOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:point(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var r=(function custom(e){function catmullRom(t){return e?new CatmullRomOpen(t,e):new CardinalOpen(t,0)}return catmullRom.alpha=function(e){return custom(+e)},catmullRom})(.5);export{line_default as n,r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../rolldown-runtime.mjs";const{getOwnPropertyNames:e,getOwnPropertySymbols:t}=Object,{hasOwnProperty:n}=Object.prototype;function combineComparators(e,t){return function isEqual(n,r,i){return e(n,r,i)&&t(n,r,i)}}function createIsCircular(e){return function isCircular(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function getStrictProperties(n){return e(n).concat(t(n))}const r=Object.hasOwn||((e,t)=>n.call(e,t)),{getOwnPropertyDescriptor:i,keys:a}=Object,o=Object.is||function sameValueEqual(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t};function strictEqual(e,t){return e===t}function areArrayBuffersEqual(e,t){return e.byteLength===t.byteLength&&areTypedArraysEqual(new Uint8Array(e),new Uint8Array(t))}function areArraysEqual(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function areDataViewsEqual(e,t){return e.byteLength===t.byteLength&&areTypedArraysEqual(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function areDatesEqual(e,t){return o(e.getTime(),t.getTime())}function areErrorsEqual(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function areMapsEqual(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}function areObjectsEqual(e,t,n){let r=a(e),i=r.length;if(a(t).length!==i)return!1;for(;i-- >0;)if(!isPropertyEqual(e,t,n,r[i]))return!1;return!0}function areObjectsEqualStrict(e,t,n){let r=getStrictProperties(e),a=r.length;if(getStrictProperties(t).length!==a)return!1;let o,s,c;for(;a-- >0;)if(o=r[a],!isPropertyEqual(e,t,n,o)||(s=i(e,o),c=i(t,o),(s||c)&&(!s||!c||s.configurable!==c.configurable||s.enumerable!==c.enumerable||s.writable!==c.writable)))return!1;return!0}function arePrimitiveWrappersEqual(e,t){return o(e.valueOf(),t.valueOf())}function areRegExpsEqual(e,t){return e.source===t.source&&e.flags===t.flags}function areSetsEqual(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function areTypedArraysEqual(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function areUrlsEqual(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function isPropertyEqual(e,t,n,i){return(i===`_owner`||i===`__o`||i===`__v`)&&(e.$$typeof||t.$$typeof)?!0:r(t,i)&&n.equals(e[i],t[i],i,i,e,t,n)}const s=Object.prototype.toString;function createEqualityComparator(e){let t=createSupportedComparatorMap(e),{areArraysEqual:n,areDatesEqual:r,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:c,areRegExpsEqual:l,areSetsEqual:u,getUnsupportedCustomComparator:d}=e;return function comparator(e,f,p){if(e===f)return!0;if(e==null||f==null)return!1;let m=typeof e;if(m!==typeof f)return!1;if(m!==`object`)return m===`number`||m===`bigint`?o(e,f,p):m===`function`?i(e,f,p):!1;let h=e.constructor;if(h!==f.constructor)return!1;if(h===Object)return c(e,f,p);if(h===Array)return n(e,f,p);if(h===Date)return r(e,f,p);if(h===RegExp)return l(e,f,p);if(h===Map)return a(e,f,p);if(h===Set)return u(e,f,p);if(h===Promise)return!1;if(Array.isArray(e))return n(e,f,p);let g=s.call(e),_=t[g];if(_)return _(e,f,p);let v=d&&d(e,f,p,g);return v?v(e,f,p):!1}}function createEqualityComparatorConfig({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual,areArraysEqual:n?areObjectsEqualStrict:areArraysEqual,areDataViewsEqual,areDatesEqual,areErrorsEqual,areFunctionsEqual:strictEqual,areMapsEqual:n?combineComparators(areMapsEqual,areObjectsEqualStrict):areMapsEqual,areNumbersEqual:o,areObjectsEqual:n?areObjectsEqualStrict:areObjectsEqual,arePrimitiveWrappersEqual,areRegExpsEqual,areSetsEqual:n?combineComparators(areSetsEqual,areObjectsEqualStrict):areSetsEqual,areTypedArraysEqual:n?combineComparators(areTypedArraysEqual,areObjectsEqualStrict):areTypedArraysEqual,areUrlsEqual,getUnsupportedCustomComparator:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=createIsCircular(r.areArraysEqual),t=createIsCircular(r.areMapsEqual),n=createIsCircular(r.areObjectsEqual),i=createIsCircular(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function createInternalEqualityComparator(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function createIsEqual({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function isEqual(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function isEqual(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function isEqual(e,n){return t(e,n,a)}}function createSupportedComparatorMap({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p}){return{"[object Arguments]":c,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":s,"[object BigInt64Array]":f,"[object BigUint64Array]":f,"[object Boolean]":l,"[object DataView]":n,"[object Date]":r,"[object Error]":i,"[object Float16Array]":f,"[object Float32Array]":f,"[object Float64Array]":f,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":f,"[object Int16Array]":f,"[object Int32Array]":f,"[object Map]":o,"[object Number]":l,"[object Object]":(e,t,n)=>typeof e.then!=`function`&&typeof t.then!=`function`&&c(e,t,n),"[object RegExp]":u,"[object Set]":d,"[object String]":l,"[object URL]":p,"[object Uint8Array]":f,"[object Uint8ClampedArray]":f,"[object Uint16Array]":f,"[object Uint32Array]":f}}const c=createCustomEqual();createCustomEqual({strict:!0}),createCustomEqual({circular:!0}),createCustomEqual({circular:!0,strict:!0});const l=createCustomEqual({createInternalComparator:()=>o});createCustomEqual({strict:!0,createInternalComparator:()=>o}),createCustomEqual({circular:!0,createInternalComparator:()=>o}),createCustomEqual({circular:!0,createInternalComparator:()=>o,strict:!0});function createCustomEqual(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=createEqualityComparator(createEqualityComparatorConfig(e));return createIsEqual({circular:t,comparator:a,createState:r,equals:n?n(a):createInternalEqualityComparator(a),strict:i})}export{l as n,c as t};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{a as e,i as t}from"../rolldown-runtime.mjs";import*as n from"react";import{Children as r,Component as i,Fragment as a,createContext as o,createElement as s,forwardRef as c,isValidElement as l,useCallback as u,useContext as d,useEffect as f,useId as p,useInsertionEffect as m,useLayoutEffect as h,useMemo as g,useRef as _,useState as v}from"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";const S=o({});function useConstant(e){let t=_(null);return t.current===null&&(t.current=e()),t.current}const C=typeof window<`u`?h:f,w=o(null);function addUniqueItem(e,t){e.indexOf(t)===-1&&e.push(t)}function removeItem(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}const clamp=(e,t,n)=>n>t?t:n<e?e:n,T={},isNumericalString=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function isObject(e){return typeof e==`object`&&!!e}const isZeroValueString=e=>/^0[^.\s]+$/u.test(e);function memo$1(e){let t;return()=>(t===void 0&&(t=e()),t)}t(memo$1,`memo`);const noop=e=>e,combineFunctions=(e,t)=>n=>t(e(n)),pipe=(...e)=>e.reduce(combineFunctions),progress=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r};var SubscriptionManager=class{constructor(){this.subscriptions=[]}add(e){return addUniqueItem(this.subscriptions,e),()=>removeItem(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};const secondsToMilliseconds=e=>e*1e3,millisecondsToSeconds=e=>e/1e3;function velocityPerSecond(e,t){return t?1e3/t*e:0}const wrap=(e,t,n)=>{let r=t-e;return((n-e)%r+r)%r+e},calcBezier=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function binarySubdivide(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=calcBezier(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>1e-7&&++s<12);return o}function cubicBezier(e,t,n,r){if(e===t&&n===r)return noop;let getTForX=t=>binarySubdivide(t,0,1,e,n);return e=>e===0||e===1?e:calcBezier(getTForX(e),t,r)}const mirrorEasing=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,reverseEasing=e=>t=>1-e(1-t),ee=cubicBezier(.33,1.53,.69,.99),te=reverseEasing(ee),E=mirrorEasing(te),anticipate=e=>e>=1?1:(e*=2)<1?.5*te(e):.5*(2-2**(-10*(e-1))),circIn=e=>1-Math.sin(Math.acos(e)),ne=reverseEasing(circIn),D=mirrorEasing(circIn),re=cubicBezier(.42,0,1,1),ie=cubicBezier(0,0,.58,1),ae=cubicBezier(.42,0,.58,1),isEasingArray=e=>Array.isArray(e)&&typeof e[0]!=`number`;function getEasingForSegment(e,t){return isEasingArray(e)?e[wrap(0,e.length,t)]:e}const isBezierDefinition=e=>Array.isArray(e)&&typeof e[0]==`number`,oe={linear:noop,easeIn:re,easeInOut:ae,easeOut:ie,circIn,circInOut:D,circOut:ne,backIn:te,backInOut:E,backOut:ee,anticipate},isValidEasing=e=>typeof e==`string`,easingDefinitionToFunction=e=>{if(isBezierDefinition(e)){e.length;let[t,n,r,i]=e;return cubicBezier(t,n,r,i)}else if(isValidEasing(e))return oe[e],`${e}`,oe[e];return e},se=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],O={value:null,addProjectionMetrics:null};function createRenderStep(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function triggerCallback(t){o.has(t)&&(l.schedule(t),e()),c++,t(s)}let l={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(triggerCallback),t&&O.value&&O.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,l.process(e))}};return l}function createRenderBatcher(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},flagRunNextFrame=()=>n=!0,a=se.reduce((e,n)=>(e[n]=createRenderStep(flagRunNextFrame,t?n:void 0),e),{}),{setup:o,read:s,resolveKeyframes:c,preUpdate:l,update:u,preRender:d,render:f,postRender:p}=a,processBatch=()=>{let a=T.useManualTiming,m=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(m-i.timestamp,40),1)),i.timestamp=m,i.isProcessing=!0,o.process(i),s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(processBatch))},wake=()=>{n=!0,r=!0,i.isProcessing||e(processBatch)},m=se.reduce((e,t)=>{let r=a[t];return e[t]=(e,t=!1,i=!1)=>(n||wake(),r.schedule(e,t,i)),e},{}),cancel=e=>{for(let t=0;t<se.length;t++)a[se[t]].cancel(e)};return{schedule:m,cancel,state:i,steps:a}}const{schedule:k,cancel:A,state:j,steps:ce}=createRenderBatcher(typeof requestAnimationFrame<`u`?requestAnimationFrame:noop,!0);let le;function clearTime(){le=void 0}const M={now:()=>(le===void 0&&M.set(j.isProcessing||T.useManualTiming?j.timestamp:performance.now()),le),set:e=>{le=e,queueMicrotask(clearTime)}},N={layout:0,mainThread:0,waapi:0},checkStringStartsWith=e=>t=>typeof t==`string`&&t.startsWith(e),ue=checkStringStartsWith(`--`),de=checkStringStartsWith(`var(--`),isCSSVariableToken=e=>de(e)?fe.test(e.split(`/*`)[0].trim()):!1,fe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function containsCSSVariable(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}const P={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},F={...P,transform:e=>clamp(0,1,e)},pe={...P,default:1},sanitize=e=>Math.round(e*1e5)/1e5,me=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function isNullish(e){return e==null}const he=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,isColorString=(e,t)=>n=>!!(typeof n==`string`&&he.test(n)&&n.startsWith(e)||t&&!isNullish(n)&&Object.prototype.hasOwnProperty.call(n,t)),splitColor=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(me);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},clampRgbUnit=e=>clamp(0,255,e),ge={...P,transform:e=>Math.round(clampRgbUnit(e))},I={test:isColorString(`rgb`,`red`),parse:splitColor(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+ge.transform(e)+`, `+ge.transform(t)+`, `+ge.transform(n)+`, `+sanitize(F.transform(r))+`)`};function parseHex(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const _e={test:isColorString(`#`),parse:parseHex,transform:I.transform},createUnitType=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),L=createUnitType(`deg`),R=createUnitType(`%`),z=createUnitType(`px`),ve=createUnitType(`vh`),ye=createUnitType(`vw`),be={...R,parse:e=>R.parse(e)/100,transform:e=>R.transform(e*100)},B={test:isColorString(`hsl`,`hue`),parse:splitColor(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+R.transform(sanitize(t))+`, `+R.transform(sanitize(n))+`, `+sanitize(F.transform(r))+`)`},V={test:e=>I.test(e)||_e.test(e)||B.test(e),parse:e=>I.test(e)?I.parse(e):B.test(e)?B.parse(e):_e.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?I.transform(e):B.transform(e),getAnimatableNone:e=>{let t=V.parse(e);return t.alpha=0,V.transform(t)}},xe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function test(e){return isNaN(e)&&typeof e==`string`&&(e.match(me)?.length||0)+(e.match(xe)?.length||0)>0}const Se=`number`,Ce=`color`,we=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function analyseComplexValue(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(we,e=>(V.test(e)?(r.color.push(a),i.push(Ce),n.push(V.parse(e))):e.startsWith(`var(`)?(r.var.push(a),i.push(`var`),n.push(e)):(r.number.push(a),i.push(Se),n.push(parseFloat(e))),++a,"${}")).split("${}"),indexes:r,types:i}}function parseComplexValue(e){return analyseComplexValue(e).values}function buildTransformer({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===Se?i+=sanitize(r[a]):e===Ce?i+=V.transform(r[a]):i+=r[a]}return i}}function createTransformer(e){return buildTransformer(analyseComplexValue(e))}const convertNumbersToZero=e=>typeof e==`number`?0:V.test(e)?V.getAnimatableNone(e):e,convertToZero=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:convertNumbersToZero(e);function getAnimatableNone$1(e){let t=analyseComplexValue(e);return buildTransformer(t)(t.values.map((e,n)=>convertToZero(e,t.split[n])))}t(getAnimatableNone$1,`getAnimatableNone`);const H={test,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1};function hueToRgb(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function hslaToRgba({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=hueToRgb(s,r,e+1/3),a=hueToRgb(s,r,e),o=hueToRgb(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function mixImmediate(e,t){return n=>n>0?t:e}const U=t((e,t,n)=>e+(t-e)*n,`mixNumber`),mixLinearColor=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Te=[_e,I,B],getColorType=e=>Te.find(t=>t.test(e));function asRGBA(e){let t=getColorType(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===B&&(n=hslaToRgba(n)),n}const mixColor=(e,t)=>{let n=asRGBA(e),r=asRGBA(t);if(!n||!r)return mixImmediate(e,t);let i={...n};return e=>(i.red=mixLinearColor(n.red,r.red,e),i.green=mixLinearColor(n.green,r.green,e),i.blue=mixLinearColor(n.blue,r.blue,e),i.alpha=U(n.alpha,r.alpha,e),I.transform(i))},Ee=new Set([`none`,`hidden`]);function mixVisibility(e,t){return Ee.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function mixNumber(e,t){return n=>U(e,t,n)}function getMixer(e){return typeof e==`number`?mixNumber:typeof e==`string`?isCSSVariableToken(e)?mixImmediate:V.test(e)?mixColor:mixComplex:Array.isArray(e)?mixArray:typeof e==`object`?V.test(e)?mixColor:mixObject:mixImmediate}function mixArray(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>getMixer(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function mixObject(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=getMixer(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function matchOrder(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}const mixComplex=(e,t)=>{let n=H.createTransformer(t),r=analyseComplexValue(e),i=analyseComplexValue(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Ee.has(e)&&!i.values.length||Ee.has(t)&&!r.values.length?mixVisibility(e,t):pipe(mixArray(matchOrder(r,i),i.values),n):(`${e}${t}`,mixImmediate(e,t))};function mix(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?U(e,t,n):getMixer(e)(e,t)}const frameloopDriver=e=>{let passTimestamp=({timestamp:t})=>e(t);return{start:(e=!0)=>k.update(passTimestamp,e),stop:()=>A(passTimestamp),now:()=>j.isProcessing?j.timestamp:M.now()}},generateLinearEasing=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},De=2e4;function calcGeneratorDuration(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function createGeneratorEasing(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(calcGeneratorDuration(r),De);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:millisecondsToSeconds(i)}}const W={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function calcAngularFreq(e,t){return e*Math.sqrt(1-t*t)}function approximateRoot(e,t,n){let r=n;for(let n=1;n<12;n++)r-=e(r)/t(r);return r}const Oe=.001;function findSpring({duration:e=W.duration,bounce:t=W.bounce,velocity:n=W.velocity,mass:r=W.mass}){let envelope,derivative;W.maxDuration;let i=1-t;i=clamp(W.minDamping,W.maxDamping,i),e=clamp(W.minDuration,W.maxDuration,millisecondsToSeconds(e)),i<1?(envelope=t=>{let r=t*i,a=r*e,o=r-n,s=calcAngularFreq(t,i),c=Math.exp(-a);return Oe-o/s*c},derivative=t=>{let r=t*i*e,a=r*n+n,o=i**2*t**2*e,s=Math.exp(-r),c=calcAngularFreq(t**2,i);return(-envelope(t)+Oe>0?-1:1)*((a-o)*s)/c}):(envelope=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Oe+r*i},derivative=t=>Math.exp(-t*e)*((n-t)*(e*e)));let a=5/e,o=approximateRoot(envelope,derivative,a);if(e=secondsToMilliseconds(e),isNaN(o))return{stiffness:W.stiffness,damping:W.damping,duration:e};{let t=o**2*r;return{stiffness:t,damping:i*2*Math.sqrt(r*t),duration:e}}}const ke=[`duration`,`bounce`],Ae=[`stiffness`,`damping`,`mass`];function isSpringType(e,t){return t.some(t=>e[t]!==void 0)}function getSpringOptions(e){let t={velocity:W.velocity,stiffness:W.stiffness,damping:W.damping,mass:W.mass,isResolvedFromDuration:!1,...e};if(!isSpringType(e,Ae)&&isSpringType(e,ke))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*clamp(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:W.mass,stiffness:i,damping:a}}else{let n=findSpring({...e,velocity:0});t={...t,...n,mass:W.mass},t.isResolvedFromDuration=!0}return t}function spring(e=W.visualDuration,t=W.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=getSpringOptions({...n,velocity:-millisecondsToSeconds(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=millisecondsToSeconds(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?W.restSpeed.granular:W.restSpeed.default,i||=v?W.restDelta.granular:W.restDelta.default;let resolveSpring,resolveVelocity,y,b,x,S;if(h<1)y=calcAngularFreq(_,h),b=(m+h*_*g)/y,resolveSpring=e=>o-Math.exp(-h*_*e)*(b*Math.sin(y*e)+g*Math.cos(y*e)),x=h*_*b+g*y,S=h*_*g-b*y,resolveVelocity=e=>Math.exp(-h*_*e)*(x*Math.sin(y*e)+S*Math.cos(y*e));else if(h===1){resolveSpring=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;resolveVelocity=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);resolveSpring=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;resolveVelocity=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let C={calculatedDuration:p&&d||null,velocity:e=>secondsToMilliseconds(resolveVelocity(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(y*e),a=Math.cos(y*e),c=o-t*(b*n+g*a),l=secondsToMilliseconds(t*(x*n+S*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=resolveSpring(e);if(p)s.done=e>=d;else{let n=secondsToMilliseconds(resolveVelocity(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(calcGeneratorDuration(C),De),t=generateLinearEasing(t=>C.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return C}spring.applyToOptions=e=>{let t=createGeneratorEasing(e,100,spring);return e.ease=t.ease,e.duration=secondsToMilliseconds(t.duration),e.type=`keyframes`,e};function getGeneratorVelocity(e,t,n){let r=Math.max(t-5,0);return velocityPerSecond(n-e(r),t-r)}function inertia({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},isOutOfBounds=e=>s!==void 0&&e<s||c!==void 0&&e>c,nearestBoundary=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,p=n*t,m=d+p,h=o===void 0?m:o(m);h!==m&&(p=h-d);let calcDelta=e=>-p*Math.exp(-e/r),calcLatest=e=>h+calcDelta(e),applyFriction=e=>{let t=calcDelta(e),n=calcLatest(e);f.done=Math.abs(t)<=l,f.value=f.done?h:n},g,_,checkCatchBoundary=e=>{isOutOfBounds(f.value)&&(g=e,_=spring({keyframes:[f.value,nearestBoundary(f.value)],velocity:getGeneratorVelocity(calcLatest,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return checkCatchBoundary(0),{calculatedDuration:null,next:e=>{let t=!1;return!_&&g===void 0&&(t=!0,applyFriction(e),checkCatchBoundary(e)),g!==void 0&&e>=g?_.next(e-g):(!t&&applyFriction(e),f)}}}function createMixers(e,t,n){let r=[],i=n||T.mix||mix,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=pipe(Array.isArray(t)?t[n]||noop:t,a)),r.push(a)}return r}function interpolate(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=createMixers(t,r,i),c=s.length,interpolator=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=progress(e[r],e[r+1],n);return s[r](i)};return n?t=>interpolator(clamp(e[0],e[a-1],t)):interpolator}function fillOffset(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=progress(0,t,r);e.push(U(n,1,i))}}function defaultOffset(e){let t=[0];return fillOffset(t,e.length-1),t}function convertOffsetToTimes(e,t){return e.map(e=>e*t)}function defaultEasing(e,t){return e.map(()=>t||ae).splice(0,e.length-1)}function keyframes({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=isEasingArray(r)?r.map(easingDefinitionToFunction):easingDefinitionToFunction(r),a={done:!1,value:t[0]},o=interpolate(convertOffsetToTimes(n&&n.length===t.length?n:defaultOffset(t),e),t,{ease:Array.isArray(i)?i:defaultEasing(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}const je=t(e=>e!==null,`isNotNull`);function getFinalKeyframe$1(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(je),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}t(getFinalKeyframe$1,`getFinalKeyframe`);const Me={decay:inertia,inertia,tween:keyframes,keyframes,spring};function replaceTransitionType(e){typeof e.type==`string`&&(e.type=Me[e.type])}var WithPromise=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}};const percentToProgress=e=>e/100;var JSAnimation=class extends WithPromise{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==M.now()&&this.tick(M.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},N.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;replaceTransitionType(e);let{type:t=keyframes,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||keyframes;s!==keyframes&&typeof o[0]!=`number`&&(this.mixKeyframes=pipe(percentToProgress,mix(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=calcGeneratorDuration(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=clamp(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==inertia&&(b.value=getFinalKeyframe$1(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return millisecondsToSeconds(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+millisecondsToSeconds(e)}get time(){return millisecondsToSeconds(this.currentTime)}set time(e){e=secondsToMilliseconds(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return getGeneratorVelocity(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(M.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=millisecondsToSeconds(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=frameloopDriver,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(M.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,N.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function fillWildcards(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const radToDeg=e=>e*180/Math.PI,rotate=e=>rebaseAngle(radToDeg(Math.atan2(e[1],e[0]))),Ne={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate,rotateZ:rotate,skewX:e=>radToDeg(Math.atan(e[1])),skewY:e=>radToDeg(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},rebaseAngle=e=>(e%=360,e<0&&(e+=360),e),Pe=rotate,scaleX=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),scaleY=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Fe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX,scaleY,scale:e=>(scaleX(e)+scaleY(e))/2,rotateX:e=>rebaseAngle(radToDeg(Math.atan2(e[6],e[5]))),rotateY:e=>rebaseAngle(radToDeg(Math.atan2(-e[2],e[0]))),rotateZ:Pe,rotate:Pe,skewX:e=>radToDeg(Math.atan(e[4])),skewY:e=>radToDeg(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function defaultTransformValue(e){return+!!e.includes(`scale`)}function parseValueFromTransform(e,t){if(!e||e===`none`)return defaultTransformValue(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Fe,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Ne,i=t}if(!i)return defaultTransformValue(t);let a=r[t],o=i[1].split(`,`).map(convertTransformToNumber);return typeof a==`function`?a(o):o[a]}const readTransformValue=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return parseValueFromTransform(n,t)};function convertTransformToNumber(e){return parseFloat(e.trim())}const G=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],K=new Set(G),isNumOrPxType=e=>e===P||e===z,Ie=new Set([`x`,`y`,`z`]),Le=G.filter(e=>!Ie.has(e));function removeNonTranslationalTransform(e){let t=[];return Le.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}const q={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>parseValueFromTransform(t,`x`),y:(e,{transform:t})=>parseValueFromTransform(t,`y`)};q.translateX=q.x,q.translateY=q.y;const J=new Set;let Re=!1,ze=!1,Be=!1;function measureAllKeyframes(){if(ze){let e=Array.from(J).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=removeNonTranslationalTransform(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}ze=!1,Re=!1,J.forEach(e=>e.complete(Be)),J.clear()}function readAllKeyframes(){J.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ze=!0)})}function flushKeyframeResolvers(){Be=!0,readAllKeyframes(),measureAllKeyframes(),Be=!1}var KeyframeResolver=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(J.add(this),Re||(Re=!0,k.read(readAllKeyframes),k.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}fillWildcards(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),J.delete(this)}cancel(){this.state===`scheduled`&&(J.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}};const isCSSVar=e=>e.startsWith(`--`);function setStyle(e,t,n){isCSSVar(t)?e.style.setProperty(t,n):e.style[t]=n}const Ve={};function memoSupports(e,t){let n=memo$1(e);return()=>Ve[t]??n()}const He=memoSupports(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Ue=memoSupports(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),cubicBezierAsString=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,We={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(e,t){if(e)return typeof e==`function`?Ue()?generateLinearEasing(e,t):`ease-out`:isBezierDefinition(e)?cubicBezierAsString(e):Array.isArray(e)?e.map(e=>mapEasingToNativeEasing(e,t)||We.easeOut):We[e]}function startWaapiAnimation(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=mapEasingToNativeEasing(s,i);Array.isArray(d)&&(u.easing=d),O.value&&N.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return O.value&&p.finished.finally(()=>{N.waapi--}),p}function isGenerator(e){return typeof e==`function`&&`applyToOptions`in e}function applyGeneratorOptions({type:e,...t}){return isGenerator(e)&&Ue()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var NativeAnimation=class extends WithPromise{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=applyGeneratorOptions(e);this.animation=startWaapiAnimation(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=getFinalKeyframe$1(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),setStyle(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return millisecondsToSeconds(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+millisecondsToSeconds(e)}get time(){return millisecondsToSeconds(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=secondsToMilliseconds(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&He()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),noop):r(this)}};const Ge={anticipate,backInOut:E,circInOut:D};function isUnsupportedEase(e){return e in Ge}function replaceStringEasing(e){typeof e.ease==`string`&&isUnsupportedEase(e.ease)&&(e.ease=Ge[e.ease])}var NativeAnimationExtended=class extends NativeAnimation{constructor(e){replaceStringEasing(e),replaceTransitionType(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new JSAnimation({...a,autoplay:!1}),s=Math.max(10,M.now()-this.startTime),c=clamp(0,10,s-10),l=o.sample(s).value,{name:u}=this.options;i&&u&&setStyle(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}};const isAnimatable=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(H.test(e)||e===`0`)&&!e.startsWith(`url(`));function hasKeyframesChanged(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function canAnimate(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=isAnimatable(i,t),s=isAnimatable(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:hasKeyframesChanged(e)||(n===`spring`||isGenerator(n))&&r}function makeAnimationInstant(e){e.duration=0,e.type=`keyframes`}const Ke=new Set([`opacity`,`clipPath`,`filter`,`transform`]),qe=memo$1(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function supportsBrowserAnimation(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return qe()&&n&&Ke.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var AsyncMotionValueAnimation=class extends WithPromise{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=M.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||KeyframeResolver;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=M.now();let u=!0;canAnimate(e,i,a,o)||(u=!1,(T.instantAnimations||!s)&&l?.(getFinalKeyframe$1(e,n,t)),e[0]=e[e.length-1],makeAnimationInstant(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&supportsBrowserAnimation(d),p=d.motionValue?.owner?.current,m=f?new NativeAnimationExtended({...d,element:p}):new JSAnimation(d);m.finished.then(()=>{this.notifyFinished()}).catch(noop),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),flushKeyframeResolvers()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},GroupAnimation=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){let t=this.animations.map(t=>t.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get state(){return this.getAll(`state`)}get startTime(){return this.getAll(`startTime`)}get duration(){return getMax(this.animations,`duration`)}get iterationDuration(){return getMax(this.animations,`iterationDuration`)}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}};function getMax(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r][t];i!==null&&i>n&&(n=i)}return n}var GroupAnimationWithThen=class extends GroupAnimation{then(e,t){return this.finished.finally(e).then(()=>{})}};function calcChildStagger(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}const Je=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(e){let t=Je.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function getVariableValue(e,t,n=1){`${e}`;let[r,i]=parseCSSVariable(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return isNumericalString(e)?parseFloat(e):e}return isCSSVariableToken(i)?getVariableValue(i,t,n+1):i}const Ye={type:`spring`,stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Xe={type:`keyframes`,duration:.8},Ze={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(e,{keyframes:t})=>t.length>2?Xe:K.has(e)?e.startsWith(`scale`)?criticallyDampedSpring(t[1]):Ye:Ze,isNotNull=e=>e!==null;function getFinalKeyframe(e,{repeat:t,repeatType:n=`loop`},r){let i=e.filter(isNotNull),a=t&&n!==`loop`&&t%2==1?0:i.length-1;return!a||r===void 0?i[a]:r}function resolveTransition(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function getValueTransition$1(e,t){let n=e?.[t]??e?.default??e;return n===e?n:resolveTransition(n,e)}t(getValueTransition$1,`getValueTransition`);function isTransitionDefined({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}const animateMotionValue=(e,t,n,r={},i,a)=>o=>{let s=getValueTransition$1(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=secondsToMilliseconds(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};isTransitionDefined(s)||Object.assign(u,getDefaultTransition(e,u)),u.duration&&=secondsToMilliseconds(u.duration),u.repeatDelay&&=secondsToMilliseconds(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(makeAnimationInstant(u),u.delay===0&&(d=!0)),(T.instantAnimations||T.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,makeAnimationInstant(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=getFinalKeyframe(u.keyframes,s);if(e!==void 0){k.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new JSAnimation(u):new AsyncMotionValueAnimation(u)};function getValueState(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function resolveVariantFromProps(e,t,n,r){if(typeof t==`function`){let[i,a]=getValueState(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=getValueState(r);t=t(n===void 0?e.custom:n,i,a)}return t}function resolveVariant(e,t,n){let r=e.getProps();return resolveVariantFromProps(r,t,n===void 0?r.custom:n,e)}const Qe=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...G]),isFloat=e=>!isNaN(parseFloat(e)),$e={current:void 0};var MotionValue=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=M.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=M.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=isFloat(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new SubscriptionManager);let n=this.events[e].add(t);return e===`change`?()=>{n(),k.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return $e.current&&$e.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=M.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>30)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function motionValue(e,t){return new MotionValue(e,t)}const isKeyframesTarget=e=>Array.isArray(e);function setMotionValue(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,motionValue(n))}function resolveFinalValueInKeyframes(e){return isKeyframesTarget(e)?e[e.length-1]||0:e}function setTarget(e,t){let{transitionEnd:n={},transition:r={},...i}=resolveVariant(e,t)||{};i={...i,...n};for(let t in i)setMotionValue(e,t,resolveFinalValueInKeyframes(i[t]))}const isMotionValue=e=>!!(e&&e.getVelocity);function isWillChangeMotionValue(e){return!!(isMotionValue(e)&&e.add)}function addValueToWillChange(e,t){let n=e.getValue(`willChange`);if(isWillChangeMotionValue(n))return n.add(t);if(!n&&T.WillChange){let n=new T.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function camelToDash(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const et=`data-`+camelToDash(`framerAppearId`);function getOptimisedAppearId(e){return e.props[et]}function shouldBlockAnimation({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function animateTarget(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?resolveTransition(a,c):c;let l=a?.reduceMotion;r&&(a=r);let u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||d&&shouldBlockAnimation(d,t))continue;let o={delay:n,...getValueTransition$1(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating&&!Array.isArray(i)&&i===c&&!o.velocity)continue;let f=!1;if(window.MotionHandoffAnimation){let n=getOptimisedAppearId(e);if(n){let e=window.MotionHandoffAnimation(n,t,k);e!==null&&(o.startTime=e,f=!0)}}addValueToWillChange(e,t);let p=l??e.shouldReduceMotion;r.start(animateMotionValue(t,r,i,p&&Qe.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let applyTransitionEnd=()=>k.update(()=>{o&&setTarget(e,o)});u.length?Promise.all(u).then(applyTransitionEnd):applyTransitionEnd()}return u}function animateVariant(e,t,n={}){let r=resolveVariant(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(animateTarget(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return animateChildren(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function animateChildren(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(animateVariant(c,t,{...o,delay:n+(typeof r==`function`?0:r)+calcChildStagger(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function animateVisualElement(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>animateVariant(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=animateVariant(e,t,n);else{let i=typeof t==`function`?resolveVariant(e,t,n.custom):t;r=Promise.all(animateTarget(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}const tt={test:e=>e===`auto`,parse:e=>e},testValueType=e=>t=>t.test(e),nt=[P,z,R,L,ye,ve,tt],findDimensionValueType=e=>nt.find(testValueType(e));function isNone(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||isZeroValueString(e)}const rt=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function applyDefaultFilter(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(me)||[];if(!r)return e;let i=n.replace(r,``),a=+!!rt.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}const it=/\b([a-z-]*)\(.*?\)/gu,at={...H,getAnimatableNone:e=>{let t=e.match(it);return t?t.map(applyDefaultFilter).join(` `):e}},ot={...H,getAnimatableNone:e=>{let t=H.parse(e);return H.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},st={...P,transform:Math.round},ct={borderWidth:z,borderTopWidth:z,borderRightWidth:z,borderBottomWidth:z,borderLeftWidth:z,borderRadius:z,borderTopLeftRadius:z,borderTopRightRadius:z,borderBottomRightRadius:z,borderBottomLeftRadius:z,width:z,maxWidth:z,height:z,maxHeight:z,top:z,right:z,bottom:z,left:z,inset:z,insetBlock:z,insetBlockStart:z,insetBlockEnd:z,insetInline:z,insetInlineStart:z,insetInlineEnd:z,padding:z,paddingTop:z,paddingRight:z,paddingBottom:z,paddingLeft:z,paddingBlock:z,paddingBlockStart:z,paddingBlockEnd:z,paddingInline:z,paddingInlineStart:z,paddingInlineEnd:z,margin:z,marginTop:z,marginRight:z,marginBottom:z,marginLeft:z,marginBlock:z,marginBlockStart:z,marginBlockEnd:z,marginInline:z,marginInlineStart:z,marginInlineEnd:z,fontSize:z,backgroundPositionX:z,backgroundPositionY:z,rotate:L,rotateX:L,rotateY:L,rotateZ:L,scale:pe,scaleX:pe,scaleY:pe,scaleZ:pe,skew:L,skewX:L,skewY:L,distance:z,translateX:z,translateY:z,translateZ:z,x:z,y:z,z,perspective:z,transformPerspective:z,opacity:F,originX:be,originY:be,originZ:z,zIndex:st,fillOpacity:F,strokeOpacity:F,numOctaves:st},lt={...ct,color:V,backgroundColor:V,outlineColor:V,fill:V,stroke:V,borderColor:V,borderTopColor:V,borderRightColor:V,borderBottomColor:V,borderLeftColor:V,filter:at,WebkitFilter:at,mask:ot,WebkitMask:ot},getDefaultValueType=e=>lt[e],ut=new Set([at,ot]);function getAnimatableNone(e,t){let n=getDefaultValueType(e);return ut.has(n)||(n=H),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const dt=new Set([`auto`,`none`,`0`]);function makeNoneKeyframesAnimatable(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!dt.has(t)&&analyseComplexValue(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=getAnimatableNone(n,i)}var DOMKeyframesResolver=class extends KeyframeResolver{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),isCSSVariableToken(r))){let i=getVariableValue(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Qe.has(n)||e.length!==2)return;let[r,i]=e,a=findDimensionValueType(r),o=findDimensionValueType(i);if(containsCSSVariable(r)!==containsCSSVariable(i)&&q[n]){this.needsMeasurement=!0;return}if(a!==o)if(isNumOrPxType(a)&&isNumOrPxType(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else q[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||isNone(e[t]))&&n.push(t);n.length&&makeNoneKeyframesAnimatable(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=q[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=q[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};const ft=new Set([`opacity`,`clipPath`,`filter`,`transform`]);function resolveElements(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}const getValueAsType=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function isHTMLElement(e){return isObject(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}const{schedule:pt,cancel:mt}=createRenderBatcher(queueMicrotask,!1),Y={x:!1,y:!1};function isDragActive(){return Y.x||Y.y}function setDragLock(e){return e===`x`||e===`y`?Y[e]?null:(Y[e]=!0,()=>{Y[e]=!1}):Y.x||Y.y?null:(Y.x=Y.y=!0,()=>{Y.x=Y.y=!1})}function setupGesture(e,t){let n=resolveElements(e),r=new AbortController,i={passive:!0,...t,signal:r.signal},cancel=()=>r.abort();return[n,i,cancel]}function isValidHover(e){return!(e.pointerType===`touch`||isDragActive())}function hover(e,t,n={}){let[r,i,a]=setupGesture(e,n);return r.forEach(e=>{let n=!1,r=!1,a,removePointerLeave=()=>{e.removeEventListener(`pointerleave`,onPointerLeave)},endHover=e=>{a&&=(a(e),void 0),removePointerLeave()},onPointerUp=e=>{n=!1,window.removeEventListener(`pointerup`,onPointerUp),window.removeEventListener(`pointercancel`,onPointerUp),r&&(r=!1,endHover(e))},onPointerDown=()=>{n=!0,window.addEventListener(`pointerup`,onPointerUp,i),window.addEventListener(`pointercancel`,onPointerUp,i)},onPointerLeave=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}endHover(e)}},onPointerEnter=n=>{if(!isValidHover(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,onPointerLeave,i))};e.addEventListener(`pointerenter`,onPointerEnter,i),e.addEventListener(`pointerdown`,onPointerDown,i)}),a}const isNodeOrChild=(e,t)=>t?e===t?!0:isNodeOrChild(e,t.parentElement):!1,isPrimaryPointer=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,ht=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function isElementKeyboardAccessible(e){return ht.has(e.tagName)||e.isContentEditable===!0}const gt=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function isElementTextInput(e){return gt.has(e.tagName)||e.isContentEditable===!0}const _t=new WeakSet;function filterEvents(e){return t=>{t.key===`Enter`&&e(t)}}function firePointerEvent(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}const enableKeyboardPress=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=filterEvents(()=>{if(_t.has(n))return;firePointerEvent(n,`down`);let e=filterEvents(()=>{firePointerEvent(n,`up`)}),handleBlur=()=>firePointerEvent(n,`cancel`);n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,handleBlur,t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function isValidPressEvent(e){return isPrimaryPointer(e)&&!isDragActive()}const vt=new WeakSet;function press(e,t,n={}){let[r,i,a]=setupGesture(e,n),startPress=e=>{let r=e.currentTarget;if(!isValidPressEvent(e)||vt.has(e))return;_t.add(r),n.stopPropagation&&vt.add(e);let a=t(r,e),onPointerEnd=(e,t)=>{window.removeEventListener(`pointerup`,onPointerUp),window.removeEventListener(`pointercancel`,onPointerCancel),_t.has(r)&&_t.delete(r),isValidPressEvent(e)&&typeof a==`function`&&a(e,{success:t})},onPointerUp=e=>{onPointerEnd(e,r===window||r===document||n.useGlobalTarget||isNodeOrChild(r,e.target))},onPointerCancel=e=>{onPointerEnd(e,!1)};window.addEventListener(`pointerup`,onPointerUp,i),window.addEventListener(`pointercancel`,onPointerCancel,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,startPress,i),isHTMLElement(e)&&(e.addEventListener(`focus`,e=>enableKeyboardPress(e,i)),!isElementKeyboardAccessible(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function isSVGElement(e){return isObject(e)&&`ownerSVGElement`in e}const yt=new WeakMap;let bt;const getSize=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:isSVGElement(r)&&`getBBox`in r?r.getBBox()[t]:r[n],xt=getSize(`inline`,`width`,`offsetWidth`),St=getSize(`block`,`height`,`offsetHeight`);function notifyTarget({target:e,borderBoxSize:t}){yt.get(e)?.forEach(n=>{n(e,{get width(){return xt(e,t)},get height(){return St(e,t)}})})}function notifyAll(e){e.forEach(notifyTarget)}function createResizeObserver(){typeof ResizeObserver>`u`||(bt=new ResizeObserver(notifyAll))}function resizeElement(e,t){bt||createResizeObserver();let n=resolveElements(e);return n.forEach(e=>{let n=yt.get(e);n||(n=new Set,yt.set(e,n)),n.add(t),bt?.observe(e)}),()=>{n.forEach(e=>{let n=yt.get(e);n?.delete(t),n?.size||bt?.unobserve(e)})}}const Ct=new Set;let windowResizeHandler;function createWindowResizeHandler(){windowResizeHandler=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ct.forEach(t=>t(e))},window.addEventListener(`resize`,windowResizeHandler)}function resizeWindow(e){return Ct.add(e),windowResizeHandler||createWindowResizeHandler(),()=>{Ct.delete(e),!Ct.size&&typeof windowResizeHandler==`function`&&(window.removeEventListener(`resize`,windowResizeHandler),windowResizeHandler=void 0)}}function resize(e,t){return typeof e==`function`?resizeWindow(e):resizeElement(e,t)}function isSVGSVGElement(e){return isSVGElement(e)&&e.tagName===`svg`}const wt=[...nt,V,H],findValueType=e=>wt.find(testValueType(e)),createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()}),X=new WeakMap;function isAnimationControls(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function isVariantLabel(e){return typeof e==`string`||Array.isArray(e)}const Tt=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Et=[`initial`,...Tt];function isControllingVariants(e){return isAnimationControls(e.animate)||Et.some(t=>isVariantLabel(e[t]))}function isVariantNode(e){return!!(isControllingVariants(e)||e.variants)}function updateMotionValuesFromProps(e,t,n){for(let r in t){let i=t[r],a=n[r];if(isMotionValue(i))e.addValue(r,i);else if(isMotionValue(a))e.addValue(r,motionValue(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,motionValue(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}const Dt={current:null},Ot={current:!1},kt=typeof window<`u`;function initPrefersReducedMotion(){if(Ot.current=!0,kt)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),setReducedMotionPreferences=()=>Dt.current=e.matches;e.addEventListener(`change`,setReducedMotionPreferences),setReducedMotionPreferences()}else Dt.current=!1}const At=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`];let jt={};function setFeatureDefinitions(e){jt=e}function getFeatureDefinitions(){return jt}var VisualElement=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=M.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,k.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=isControllingVariants(t),this.isVariantNode=isVariantNode(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&isMotionValue(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,X.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Ot.current||initPrefersReducedMotion(),this.shouldReduceMotion=Dt.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),A(this.notifyUpdate),A(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&ft.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new NativeAnimation({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:secondsToMilliseconds(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=K.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&k.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in jt){let t=jt[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<At.length;t++){let n=At[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=motionValue(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(isNumericalString(n)||isZeroValueString(n))?n=parseFloat(n):!findValueType(n)&&H.test(t)&&(n=getAnimatableNone(e,t)),this.setBaseTarget(e,isMotionValue(n)?n.get():n)),isMotionValue(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=resolveVariantFromProps(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!isMotionValue(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new SubscriptionManager),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){pt.render(this.render)}},DOMVisualElement=class extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;isMotionValue(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Feature=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function convertBoundingBoxToBox({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function convertBoxToBoundingBox({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function transformBoxPoints(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function isIdentityScale(e){return e===void 0||e===1}function hasScale({scale:e,scaleX:t,scaleY:n}){return!isIdentityScale(e)||!isIdentityScale(t)||!isIdentityScale(n)}function hasTransform(e){return hasScale(e)||has2DTranslate(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function has2DTranslate(e){return is2DTranslate(e.x)||is2DTranslate(e.y)}function is2DTranslate(e){return e&&e!==`0%`}function scalePoint(e,t,n){return n+t*(e-n)}function applyPointDelta(e,t,n,r,i){return i!==void 0&&(e=scalePoint(e,i,r)),scalePoint(e,n,r)+t}function applyAxisDelta(e,t=0,n=1,r,i){e.min=applyPointDelta(e.min,t,n,r,i),e.max=applyPointDelta(e.max,t,n,r,i)}function applyBoxDelta(e,{x:t,y:n}){applyAxisDelta(e.x,t.translate,t.scale,t.originPoint),applyAxisDelta(e.y,n.translate,n.scale,n.originPoint)}const Mt=.999999999999,Nt=1.0000000000001;function applyTreeDeltas(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&transformBox(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,applyBoxDelta(e,o)),r&&hasTransform(a.latestValues)&&transformBox(e,a.latestValues,a.layout?.layoutBox))}t.x<Nt&&t.x>Mt&&(t.x=1),t.y<Nt&&t.y>Mt&&(t.y=1)}function translateAxis(e,t){e.min+=t,e.max+=t}function transformAxis(e,t,n,r,i=.5){applyAxisDelta(e,t,n,U(e.min,e.max,i),r)}function resolveAxisTranslate(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function transformBox(e,t,n){let r=n??e;transformAxis(e.x,resolveAxisTranslate(t.x,r.x),t.scaleX,t.scale,t.originX),transformAxis(e.y,resolveAxisTranslate(t.y,r.y),t.scaleY,t.scale,t.originY)}function measureViewportBox(e,t){return convertBoundingBoxToBox(transformBoxPoints(e.getBoundingClientRect(),t))}function measurePageBox(e,t,n){let r=measureViewportBox(e,n),{scroll:i}=t;return i&&(translateAxis(r.x,i.offset.x),translateAxis(r.y,i.offset.y)),r}const Pt={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Ft=G.length;function buildTransform(e,t,n){let r=``,i=!0;for(let a=0;a<Ft;a++){let o=G[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=getValueAsType(s,ct[o]);if(!c){i=!1;let t=Pt[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function buildHTMLStyles(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(K.has(e)){o=!0;continue}else if(ue(e)){i[e]=n;continue}else{let t=getValueAsType(n,ct[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=buildTransform(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function renderHTML(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function pixelsToPercent(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Z={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(z.test(e))e=parseFloat(e);else return e;return`${pixelsToPercent(e,t.target.x)}% ${pixelsToPercent(e,t.target.y)}%`}},It={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=H.parse(e);if(i.length>5)return r;let a=H.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=U(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Lt={borderRadius:{...Z,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:Z,borderTopRightRadius:Z,borderBottomLeftRadius:Z,borderBottomRightRadius:Z,boxShadow:It};function isForcedMotionValue(e,{layout:t,layoutId:n}){return K.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Lt[e]||e===`opacity`)}function scrapeMotionValuesFromProps$1(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(isMotionValue(r[t])||i&&isMotionValue(i[t])||isForcedMotionValue(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}t(scrapeMotionValuesFromProps$1,`scrapeMotionValuesFromProps`);function getComputedStyle$1(e){return window.getComputedStyle(e)}t(getComputedStyle$1,`getComputedStyle`);var HTMLVisualElement=class extends DOMVisualElement{constructor(){super(...arguments),this.type=`html`,this.renderInstance=renderHTML}readValueFromInstance(e,t){if(K.has(t))return this.projection?.isProjecting?defaultTransformValue(t):readTransformValue(e,t);{let n=getComputedStyle$1(e),r=(ue(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return measureViewportBox(e,t)}build(e,t,n){buildHTMLStyles(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return scrapeMotionValuesFromProps$1(e,t,n)}};function isObjectKey(e,t){return e in t}var ObjectVisualElement=class extends VisualElement{constructor(){super(...arguments),this.type=`object`}readValueFromInstance(e,t){if(isObjectKey(t,e)){let n=e[t];if(typeof n==`string`||typeof n==`number`)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(e,t){delete t.output[e]}measureInstanceViewportBox(){return createBox()}build(e,t){Object.assign(e.output,t)}renderInstance(e,{output:t}){Object.assign(e,t)}sortInstanceNodePosition(){return 0}};const Rt={offset:`stroke-dashoffset`,array:`stroke-dasharray`},zt={offset:`strokeDashoffset`,array:`strokeDasharray`};function buildSVGPath(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Rt:zt;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}const Bt=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function buildSVGAttrs(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(buildHTMLStyles(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of Bt)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&buildSVGPath(d,i,a,o,!1)}const Vt=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),isSVGTag=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function renderSVG(e,t,n,r){renderHTML(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Vt.has(n)?n:camelToDash(n),t.attrs[n])}function scrapeMotionValuesFromProps(e,t,n){let r=scrapeMotionValuesFromProps$1(e,t,n);for(let n in e)if(isMotionValue(e[n])||isMotionValue(t[n])){let t=G.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var SVGVisualElement=class extends DOMVisualElement{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=createBox}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(K.has(t)){let e=getDefaultValueType(t);return e&&e.default||0}return t=Vt.has(t)?t:camelToDash(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return scrapeMotionValuesFromProps(e,t,n)}build(e,t,n){buildSVGAttrs(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){renderSVG(e,t,n,r)}mount(e){this.isSVGTag=isSVGTag(e.tagName),super.mount(e)}};const Ht=Et.length;function getVariantContext(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&getVariantContext(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<Ht;n++){let r=Et[n],i=e.props[r];(isVariantLabel(i)||i===!1)&&(t[r]=i)}return t}function shallowCompare(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const Ut=[...Tt].reverse(),Wt=Tt.length;function createAnimateFunction(e){return t=>Promise.all(t.map(({animation:t,options:n})=>animateVisualElement(e,t,n)))}function createAnimationState(e){let t=createAnimateFunction(e),n=createState(),r=!0,i=!1,buildResolvedTypeValues=t=>(n,r)=>{let i=resolveVariant(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function setAnimateFunction(n){t=n(e)}function animateChanges(a){let{props:o}=e,s=getVariantContext(e.parent)||{},c=[],l=new Set,u={},d=1/0;for(let t=0;t<Wt;t++){let f=Ut[t],p=n[f],m=o[f]===void 0?s[f]:o[f],h=isVariantLabel(m),g=f===a?p.isActive:null;g===!1&&(d=t);let _=m===s[f]&&m!==o[f]&&h;if(_&&(r||i)&&e.manuallyAnimateOnMount&&(_=!1),p.protectedKeys={...u},!p.isActive&&g===null||!m&&!p.prevProp||isAnimationControls(m)||typeof m==`boolean`)continue;if(f===`exit`&&p.isActive&&g!==!0){p.prevResolvedValues&&(u={...u,...p.prevResolvedValues});continue}let v=checkVariantsDidChange(p.prevProp,m),y=v||f===a&&p.isActive&&!_&&h||t>d&&h,b=!1,x=Array.isArray(m)?m:[m],S=x.reduce(buildResolvedTypeValues(f),{});g===!1&&(S={});let{prevResolvedValues:C={}}=p,w={...C,...S},markToAnimate=t=>{y=!0,l.has(t)&&(b=!0,l.delete(t)),p.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in w){let t=S[e],n=C[e];if(u.hasOwnProperty(e))continue;let r=!1;r=isKeyframesTarget(t)&&isKeyframesTarget(n)?!shallowCompare(t,n):t!==n,r?t==null?l.add(e):markToAnimate(e):t!==void 0&&l.has(e)?markToAnimate(e):p.protectedKeys[e]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),(r||i)&&e.blockInitialAnimation&&(y=!1);let T=_&&v;y&&(!T||b)&&c.push(...x.map(t=>{let n={type:f};if(typeof t==`string`&&(r||i)&&!T&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=resolveVariant(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=calcChildStagger(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(l.size){let t={};if(typeof o.initial!=`boolean`){let n=resolveVariant(e,Array.isArray(o.initial)?o.initial[0]:o.initial);n&&n.transition&&(t.transition=n.transition)}l.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let f=!!c.length;return r&&(o.initial===!1||o.initial===o.animate)&&!e.manuallyAnimateOnMount&&(f=!1),r=!1,i=!1,f?t(c):Promise.resolve()}function setActive(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=animateChanges(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges,setActive,setAnimateFunction,getState:()=>n,reset:()=>{n=createState(),i=!0}}}function checkVariantsDidChange(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!shallowCompare(t,e):!1}function createTypeState(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}function copyAxisInto(e,t){e.min=t.min,e.max=t.max}function copyBoxInto(e,t){copyAxisInto(e.x,t.x),copyAxisInto(e.y,t.y)}function copyAxisDeltaInto(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Gt=1e-4;1-Gt,1+Gt;const Kt=.01;0-Kt,0+Kt;function calcLength(e){return e.max-e.min}function isNear(e,t,n){return Math.abs(e-t)<=n}function calcAxisDelta(e,t,n,r=.5){e.origin=r,e.originPoint=U(t.min,t.max,e.origin),e.scale=calcLength(n)/calcLength(t),e.translate=U(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function calcBoxDelta(e,t,n,r){calcAxisDelta(e.x,t.x,n.x,r?r.originX:void 0),calcAxisDelta(e.y,t.y,n.y,r?r.originY:void 0)}function calcRelativeAxis(e,t,n){e.min=n.min+t.min,e.max=e.min+calcLength(t)}function calcRelativeBox(e,t,n){calcRelativeAxis(e.x,t.x,n.x),calcRelativeAxis(e.y,t.y,n.y)}function calcRelativeAxisPosition(e,t,n){e.min=t.min-n.min,e.max=e.min+calcLength(t)}function calcRelativePosition(e,t,n){calcRelativeAxisPosition(e.x,t.x,n.x),calcRelativeAxisPosition(e.y,t.y,n.y)}function removePointDelta(e,t,n,r,i){return e-=t,e=scalePoint(e,1/n,r),i!==void 0&&(e=scalePoint(e,1/i,r)),e}function removeAxisDelta(e,t=0,n=1,r=.5,i,a=e,o=e){if(R.test(t)&&(t=parseFloat(t),t=U(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=U(a.min,a.max,r);e===a&&(s-=t),e.min=removePointDelta(e.min,t,n,s,i),e.max=removePointDelta(e.max,t,n,s,i)}function removeAxisTransforms(e,t,[n,r,i],a,o){removeAxisDelta(e,t[n],t[r],t[i],t.scale,a,o)}const qt=[`x`,`scaleX`,`originX`],Jt=[`y`,`scaleY`,`originY`];function removeBoxTransforms(e,t,n,r){removeAxisTransforms(e.x,t,qt,n?n.x:void 0,r?r.x:void 0),removeAxisTransforms(e.y,t,Jt,n?n.y:void 0,r?r.y:void 0)}function isAxisDeltaZero(e){return e.translate===0&&e.scale===1}function isDeltaZero(e){return isAxisDeltaZero(e.x)&&isAxisDeltaZero(e.y)}function axisEquals(e,t){return e.min===t.min&&e.max===t.max}function boxEquals(e,t){return axisEquals(e.x,t.x)&&axisEquals(e.y,t.y)}function axisEqualsRounded(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function boxEqualsRounded(e,t){return axisEqualsRounded(e.x,t.x)&&axisEqualsRounded(e.y,t.y)}function aspectRatio(e){return calcLength(e.x)/calcLength(e.y)}function axisDeltaEquals(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function eachAxis(e){return[e(`x`),e(`y`)]}function buildProjectionTransform(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}const Yt=[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`],Xt=Yt.length,asNumber=e=>typeof e==`string`?parseFloat(e):e,isPx=e=>typeof e==`number`||z.test(e);function mixValues(e,t,n,r,i,a){i?(e.opacity=U(0,n.opacity??1,Zt(r)),e.opacityExit=U(t.opacity??1,0,Qt(r))):a&&(e.opacity=U(t.opacity??1,n.opacity??1,r));for(let i=0;i<Xt;i++){let a=`border${Yt[i]}Radius`,o=getRadius(t,a),s=getRadius(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||isPx(o)===isPx(s)?(e[a]=Math.max(U(asNumber(o),asNumber(s),r),0),(R.test(s)||R.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=U(t.rotate||0,n.rotate||0,r))}function getRadius(e,t){return e[t]===void 0?e.borderRadius:e[t]}const Zt=compress(0,.5,ne),Qt=compress(.5,.95,noop);function compress(e,t,n){return r=>r<e?0:r>t?1:n(progress(e,t,r))}function animateSingleValue(e,t,n){let r=isMotionValue(e)?e:motionValue(e);return r.start(animateMotionValue(``,r,t,n)),r.animation}function addDomEvent(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const compareByDepth=(e,t)=>e.depth-t.depth;var FlatTree=class{constructor(){this.children=[],this.isDirty=!1}add(e){addUniqueItem(this.children,e),this.isDirty=!0}remove(e){removeItem(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(e)}};function delay(e,t){let n=M.now(),checkElapsed=({timestamp:r})=>{let i=r-n;i>=t&&(A(checkElapsed),e(i-t))};return k.setup(checkElapsed,!0),()=>A(checkElapsed)}function resolveMotionValue(e){return isMotionValue(e)?e.get():e}var NodeStack=class{constructor(){this.members=[]}add(e){addUniqueItem(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(removeItem(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(removeItem(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}};const $t={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Q={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},en=[``,`X`,`Y`,`Z`];let tn=0;function resetDistortingTransform(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function cancelTreeOptimisedTransformAnimations(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=getOptimisedAppearId(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,k,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(r)}function createProjectionNode$1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class ProjectionNode{constructor(e={},n=t?.()){this.id=tn++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,O.value&&(Q.nodes=Q.calculatedTargetDeltas=Q.calculatedProjections=0),this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),O.addProjectionMetrics&&O.addProjectionMetrics(Q)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new SubscriptionManager),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=isSVGElement(t)&&!isSVGSVGElement(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,resizeUnblockUpdate=()=>this.root.updateBlockedByResize=!1;k.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=delay(resizeUnblockUpdate,250),$t.hasAnimatedSinceResize&&($t.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||nn,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!boxEqualsRounded(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...getValueTransition$1(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),A(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(clearMeasurements);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(clearIsLayoutDirty);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate)):this.nodes.forEach(clearIsLayoutDirty),this.clearAllSnapshots();let e=M.now();j.delta=clamp(0,1e3/60,e-j.timestamp),j.timestamp=e,j.isProcessing=!0,ce.update.process(j),ce.preRender.process(j),ce.render.process(j),j.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,pt.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,k.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){k.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!calcLength(this.snapshot.measuredBox.x)&&!calcLength(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!isDeltaZero(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||hasTransform(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),roundBox(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return createBox();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(checkNodeWasScrollRoot))){let{scroll:e}=this.root;e&&(translateAxis(t.x,e.offset.x),translateAxis(t.y,e.offset.y))}return t}removeElementScroll(e){let t=createBox();if(copyBoxInto(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&©BoxInto(t,e),translateAxis(t.x,i.offset.x),translateAxis(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let n=createBox();copyBoxInto(n,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&transformBox(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),hasTransform(r.latestValues)&&transformBox(n,r.latestValues,r.layout?.layoutBox)}return hasTransform(this.latestValues)&&transformBox(n,this.latestValues,this.layout?.layoutBox),n}removeTransform(e){let t=createBox();copyBoxInto(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!hasTransform(n.latestValues))continue;let r;n.instance&&(hasScale(n.latestValues)&&n.updateSnapshot(),r=createBox(),copyBoxInto(r,n.measurePageBox())),removeBoxTransforms(t,n.latestValues,n.snapshot?.layoutBox,r)}return hasTransform(this.latestValues)&&removeBoxTransforms(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==j.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=j.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),O.value&&Q.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,t,n),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===j.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=createBox());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)),calcBoxDelta(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)||!axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),O.value&&Q.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=createDelta(),this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=createBox(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;mixAxisDelta(a.x,e.x,n),mixAxisDelta(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&boxEquals(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=createBox(),copyBoxInto(d,this.relativeTarget)),s&&(this.animationValues=i,mixValues(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(A(this.pendingAnimation),void 0),this.pendingAnimation=k.update(()=>{$t.hasAnimatedSinceResize=!0,N.layout++,this.motionValue||=motionValue(0),this.motionValue.jump(0,!1),this.currentAnimation=animateSingleValue(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{N.layout--},onComplete:()=>{N.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||createBox();let t=calcLength(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=calcLength(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}copyBoxInto(t,n),transformBox(t,i),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new NodeStack),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&resetDistortingTransform(`z`,e,r,this.animationValues);for(let t=0;t<en.length;t++)resetDistortingTransform(`rotate${en[t]}`,e,r,this.animationValues),resetDistortingTransform(`skew${en[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=resolveMotionValue(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=resolveMotionValue(t?.pointerEvents)||``),this.hasProjected&&!hasTransform(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Lt){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Lt[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?resolveMotionValue(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}t(createProjectionNode$1,`createProjectionNode`);function updateLayout(e){e.updateLayout()}function notifyLayoutUpdate(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)eachAxis(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=calcLength(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;copyAxisInto(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else shouldAnimatePositionOnly(i,t.layoutBox,n)&&eachAxis(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=calcLength(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=createDelta();calcBoxDelta(o,n,t.layoutBox);let s=createDelta();a?calcBoxDelta(s,e.applyTransform(r,!0),t.measuredBox):calcBoxDelta(s,n,t.layoutBox);let c=!isDeltaZero(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=createBox();calcRelativePosition(o,t.layoutBox,i.layoutBox);let s=createBox();calcRelativePosition(s,n,a.layoutBox),boxEqualsRounded(o,s)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=s,e.relativeTargetOrigin=o,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function propagateDirtyNodes(e){O.value&&Q.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function cleanDirtyNodes(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function clearSnapshot(e){e.clearSnapshot()}function clearMeasurements(e){e.clearMeasurements()}function clearIsLayoutDirty(e){e.isLayoutDirty=!1}function resetTransformStyle(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function finishAnimation(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function resolveTargetDelta(e){e.resolveTargetDelta()}function calcProjection(e){e.calcProjection()}function resetSkewAndRotation(e){e.resetSkewAndRotation()}function removeLeadSnapshots(e){e.removeLeadSnapshot()}function mixAxisDelta(e,t,n){e.translate=U(t.translate,0,n),e.scale=U(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function mixAxis(e,t,n,r){e.min=U(t.min,n.min,r),e.max=U(t.max,n.max,r)}function mixBox(e,t,n,r){mixAxis(e.x,t.x,n.x,r),mixAxis(e.y,t.y,n.y,r)}function hasOpacityCrossfade(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const nn={duration:.45,ease:[.4,0,.1,1]},userAgentContains=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),rn=userAgentContains(`applewebkit/`)&&!userAgentContains(`chrome/`)?Math.round:noop;function roundAxis(e){e.min=rn(e.min),e.max=rn(e.max)}function roundBox(e){roundAxis(e.x),roundAxis(e.y)}function shouldAnimatePositionOnly(e,t,n){return e===`position`||e===`preserve-aspect`&&!isNear(aspectRatio(t),aspectRatio(n),.2)}function checkNodeWasScrollRoot(e){return e!==e.root&&e.scroll?.wasRoot}const an=createProjectionNode$1({attachResizeListener:(e,t)=>addDomEvent(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),notify=e=>!e.isLayoutDirty&&e.willUpdate(!1);function nodeGroup(){let e=new Set,t=new WeakMap,dirtyAll=()=>e.forEach(notify);return{add:n=>{e.add(n),t.set(n,n.addEventListener(`willUpdate`,dirtyAll))},remove:n=>{e.delete(n);let r=t.get(n);r&&(r(),t.delete(n)),dirtyAll()},dirty:dirtyAll}}const on={current:void 0},sn=createProjectionNode$1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!on.current){let e=new an({});e.mount(window),e.setOptions({layoutScroll:!0}),on.current=e}return on.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),$=o({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function setRef(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function composeRefs(...e){return t=>{let n=!1,r=e.map(e=>{let r=setRef(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():setRef(e[t],null)}}}}function useComposedRefs(...e){return n.useCallback(composeRefs(...e),e)}var PopChildMeasure=class extends n.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(isHTMLElement(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=isHTMLElement(e)&&e.offsetWidth||0,r=isHTMLElement(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}};function PopChild({children:e,isPresent:t,anchorX:r,anchorY:i,root:a,pop:o}){let s=p(),c=_(null),l=_({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:u}=d($),f=useComposedRefs(c,e.props?.ref??e?.ref);return m(()=>{let{width:e,height:n,top:d,left:f,right:p,bottom:m}=l.current;if(t||o===!1||!c.current||!e||!n)return;let h=r===`left`?`left: ${f}`:`right: ${p}`,g=i===`bottom`?`bottom: ${m}`:`top: ${d}`;c.current.dataset.motionPopId=s;let _=document.createElement(`style`);u&&(_.nonce=u);let v=a??document.head;return v.appendChild(_),_.sheet&&_.sheet.insertRule(`
|
|
2
|
+
[data-motion-pop-id="${s}"] {
|
|
3
|
+
position: absolute !important;
|
|
4
|
+
width: ${e}px !important;
|
|
5
|
+
height: ${n}px !important;
|
|
6
|
+
${h}px !important;
|
|
7
|
+
${g}px !important;
|
|
8
|
+
}
|
|
9
|
+
`),()=>{c.current?.removeAttribute(`data-motion-pop-id`),v.contains(_)&&v.removeChild(_)}},[t]),b(PopChildMeasure,{isPresent:t,childRef:c,sizeRef:l,pop:o,children:o===!1?e:n.cloneElement(e,{ref:f})})}const PresenceChild=({children:e,initial:t,isPresent:r,onExitComplete:i,custom:a,presenceAffectsLayout:o,mode:s,anchorX:c,anchorY:l,root:u})=>{let d=useConstant(newChildrenMap),f=p(),m=!0,h=g(()=>(m=!1,{id:f,initial:t,isPresent:r,custom:a,onExitComplete:e=>{d.set(e,!0);for(let e of d.values())if(!e)return;i&&i()},register:e=>(d.set(e,!1),()=>d.delete(e))}),[r,d,i]);return o&&m&&(h={...h}),g(()=>{d.forEach((e,t)=>d.set(t,!1))},[r]),n.useEffect(()=>{!r&&!d.size&&i&&i()},[r]),e=b(PopChild,{pop:s===`popLayout`,isPresent:r,anchorX:c,anchorY:l,root:u,children:e}),b(w.Provider,{value:h,children:e})};function newChildrenMap(){return new Map}function usePresence(e=!0){let t=d(w);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=p();f(()=>{if(e)return i(a)},[e]);let o=u(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}const getChildKey=e=>e.key||``;function onlyElements(e){let t=[];return r.forEach(e,e=>{l(e)&&t.push(e)}),t}const AnimatePresence=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,f]=usePresence(o),p=g(()=>onlyElements(e),[e]),m=o&&!u?[]:p.map(getChildKey),h=_(!0),x=_(p),w=useConstant(()=>new Map),T=_(new Set),[ee,te]=v(p),[E,ne]=v(p);C(()=>{h.current=!1,x.current=p;for(let e=0;e<E.length;e++){let t=getChildKey(E[e]);m.includes(t)?(w.delete(t),T.current.delete(t)):w.get(t)!==!0&&w.set(t,!1)}},[E,m.length,m.join(`-`)]);let D=[];if(p!==ee){let e=[...p];for(let t=0;t<E.length;t++){let n=E[t],r=getChildKey(n);m.includes(r)||(e.splice(t,0,n),D.push(n))}return a===`wait`&&D.length&&(e=D),ne(onlyElements(e)),te(p),null}let{forceRender:re}=d(S);return b(y,{children:E.map(e=>{let d=getChildKey(e),g=o&&!u?!1:p===E||m.includes(d),onExit=()=>{if(T.current.has(d))return;if(w.has(d))T.current.add(d),w.set(d,!0);else return;let e=!0;w.forEach(t=>{t||(e=!1)}),e&&(re?.(),ne(x.current),o&&f?.(),r&&r())};return b(PresenceChild,{isPresent:g,initial:!h.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:g?void 0:onExit,anchorX:s,anchorY:c,children:e},d)})})},cn=o(null);function useIsMounted(){let e=_(!1);return C(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function useForceUpdate(){let e=useIsMounted(),[t,n]=v(0),r=u(()=>{e.current&&n(t+1)},[t]);return[u(()=>k.postRender(r),[r]),t]}const shouldInheritGroup=e=>e===!0,shouldInheritId=e=>shouldInheritGroup(e===!0)||e===`id`,LayoutGroup=({children:e,id:t,inherit:n=!0})=>{let r=d(S),i=d(cn),[a,o]=useForceUpdate(),s=_(null),c=r.id||i;s.current===null&&(shouldInheritId(n)&&c&&(t=t?c+`-`+t:c),s.current={id:t,group:shouldInheritGroup(n)&&r.group||nodeGroup()});let l=g(()=>({...s.current,forceRender:a}),[o]);return b(S.Provider,{value:l,children:e})},ln=o({strict:!1}),un={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]};let dn=!1;function initFeatureDefinitions(){if(dn)return;let e={};for(let t in un)e[t]={isEnabled:e=>un[t].some(t=>!!e[t])};setFeatureDefinitions(e),dn=!0}function getInitializedFeatureDefinitions(){return initFeatureDefinitions(),getFeatureDefinitions()}function loadFeatures(e){let t=getInitializedFeatureDefinitions();for(let n in e)t[n]={...t[n],...e[n]};setFeatureDefinitions(t)}function LazyMotion({children:e,features:t,strict:n=!1}){let[,r]=v(!isLazyBundle(t)),i=_(void 0);if(!isLazyBundle(t)){let{renderer:e,...n}=t;i.current=e,loadFeatures(n)}return f(()=>{isLazyBundle(t)&&t().then(({renderer:e,...t})=>{loadFeatures(t),i.current=e,r(!0)})},[]),b(ln.Provider,{value:{renderer:i.current,strict:n},children:e})}function isLazyBundle(e){return typeof e==`function`}const fn=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function isValidMotionProp(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||fn.has(e)}let shouldForward=e=>!isValidMotionProp(e);function loadExternalIsValidProp(e){typeof e==`function`&&(shouldForward=t=>t.startsWith(`on`)?!isValidMotionProp(t):e(t))}try{loadExternalIsValidProp(e(`@emotion/is-prop-valid`).default)}catch{}function filterProps(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||isMotionValue(e[i])||(shouldForward(i)||n===!0&&isValidMotionProp(i)||!t&&!isValidMotionProp(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}function MotionConfig({children:e,isValidProp:t,...n}){t&&loadExternalIsValidProp(t);let r=d($);n={...r,...n},n.transition=resolveTransition(n.transition,r.transition),n.isStatic=useConstant(()=>n.isStatic);let i=g(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion,n.skipAnimations]);return b($.Provider,{value:i,children:e})}const pn=o({});function getCurrentTreeVariants(e,t){if(isControllingVariants(e)){let{initial:t,animate:n}=e;return{initial:t===!1||isVariantLabel(t)?t:void 0,animate:isVariantLabel(n)?n:void 0}}return e.inherit===!1?{}:t}function useCreateMotionContext(e){let{initial:t,animate:n}=getCurrentTreeVariants(e,d(pn));return g(()=>({initial:t,animate:n}),[variantLabelsAsDependency(t),variantLabelsAsDependency(n)])}function variantLabelsAsDependency(e){return Array.isArray(e)?e.join(` `):e}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(e,t,n){for(let r in t)!isMotionValue(t[r])&&!isForcedMotionValue(r,n)&&(e[r]=t[r])}function useInitialMotionValues({transformTemplate:e},t){return g(()=>{let n=createHtmlRenderState();return buildHTMLStyles(n,t,e),Object.assign({},n.vars,n.style)},[t])}function useStyle(e,t){let n=e.style||{},r={};return copyRawValuesOnly(r,n,e),Object.assign(r,useInitialMotionValues(e,t)),r}function useHTMLProps(e,t){let n={},r=useStyle(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}});function useSVGProps(e,t,n,r){let i=g(()=>{let n=createSvgRenderState();return buildSVGAttrs(n,t,isSVGTag(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};copyRawValuesOnly(t,e.style,e),i.style={...t,...i.style}}return i}const mn=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function isSVGComponent(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(mn.indexOf(e)>-1||/[A-Z]/u.test(e))}function useRender(e,t,n,{latestValues:r},i,o=!1,c){let l=(c??isSVGComponent(e)?useSVGProps:useHTMLProps)(t,r,i,e),u=filterProps(t,typeof e==`string`,o),d=e===a?{}:{...u,...l,ref:n},{children:f}=t,p=g(()=>isMotionValue(f)?f.get():f,[f]);return s(e,{...d,children:p})}function makeState({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:makeLatestValues(n,r,i,e),renderState:t()}}function makeLatestValues(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=resolveMotionValue(a[e]);let{initial:o,animate:s}=e,c=isControllingVariants(e),l=isVariantNode(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!isAnimationControls(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=resolveVariantFromProps(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}const makeUseVisualState=e=>(t,n)=>{let r=d(pn),i=d(w),make=()=>makeState(e,t,r,i);return n?make():useConstant(make)},hn=makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState}),gn=makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState}),_n=Symbol.for(`motionComponentSymbol`);function useMotionRef(e,t,n){let r=_(n);m(()=>{r.current=n});let i=_(null);return u(n=>{n&&e.onMount?.(n);let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n);t&&(n?t.mount(n):t.unmount())},[t])}const vn=o({});function isRefObject(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function useVisualElement(e,t,n,r,i,a){let{visualElement:o}=d(pn),s=d(ln),c=d(w),l=d($),u=l.reducedMotion,p=l.skipAnimations,h=_(null),g=_(!1);r||=s.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:p,isSVG:a}),g.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));let v=h.current,y=d(vn);v&&!v.projection&&i&&(v.type===`html`||v.type===`svg`)&&createProjectionNode(h.current,n,i,y);let b=_(!1);m(()=>{v&&b.current&&v.update(n,c)});let x=n[et],S=_(!!x&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(x)&&window.MotionHasOptimisedAnimation?.(x));return C(()=>{g.current=!0,v&&(b.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),v.scheduleRenderMicrotask(),S.current&&v.animationState&&v.animationState.animateChanges())}),f(()=>{v&&(!S.current&&v.animationState&&v.animationState.animateChanges(),S.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(x)}),!1),v.enteringChildren=void 0)}),v}function createProjectionNode(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:getClosestProjectingNode(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&isRefObject(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:l})}function getClosestProjectingNode(e){if(e)return e.options.allowProjection===!1?getClosestProjectingNode(e.parent):e.projection}function createMotionComponent(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&loadFeatures(r);let a=n?n===`svg`:isSVGComponent(e),o=a?gn:hn;function MotionDOMComponent(n,s){let c,l={...d($),...n,layoutId:useLayoutId(n)},{isStatic:u}=l,f=useCreateMotionContext(n),p=o(n,u);if(!u&&typeof window<`u`){useStrictMode(l,r);let t=getProjectionFunctionality(l);c=t.MeasureLayout,f.visualElement=useVisualElement(e,p,l,i,t.ProjectionNode,a)}return x(pn.Provider,{value:f,children:[c&&f.visualElement?b(c,{visualElement:f.visualElement,...l}):null,useRender(e,n,useMotionRef(p,f.visualElement,s),p,u,t,a)]})}MotionDOMComponent.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let s=c(MotionDOMComponent);return s[_n]=e,s}function useLayoutId({layoutId:e}){let t=d(S).id;return t&&e!==void 0?t+`-`+e:e}function useStrictMode(e,t){d(ln).strict}function getProjectionFunctionality(e){let{drag:t,layout:n}=getInitializedFeatureDefinitions();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function createMotionProxy(e,t){if(typeof Proxy>`u`)return createMotionComponent;let n=new Map,factory=(n,r)=>createMotionComponent(n,r,e,t),deprecatedFactoryFunction=(e,t)=>factory(e,t);return new Proxy(deprecatedFactoryFunction,{get:(r,i)=>i===`create`?factory:(n.has(i)||n.set(i,createMotionComponent(i,void 0,e,t)),n.get(i))})}const yn=createMotionProxy(),createDomVisualElement=(e,t)=>t.isSVG??isSVGComponent(e)?new SVGVisualElement(t):new HTMLVisualElement(t,{allowProjection:e!==a});var AnimationFeature=class extends Feature{constructor(e){super(e),e.animationState||=createAnimationState(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();isAnimationControls(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}};let bn=0;var ExitAnimationFeature=class extends Feature{constructor(){super(...arguments),this.id=bn++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`){let n=resolveVariant(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}};const xn={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}};function extractEventInfo(e){return{point:{x:e.pageX,y:e.pageY}}}const addPointerInfo=e=>t=>isPrimaryPointer(t)&&e(t,extractEventInfo(t));function addPointerEvent(e,t,n,r){return addDomEvent(e,t,addPointerInfo(n),r)}const getContextWindow=({current:e})=>e?e.ownerDocument.defaultView:null,distance=(e,t)=>Math.abs(e-t);function distance2D(e,t){let n=distance(e.x,t.x),r=distance(e.y,t.y);return Math.sqrt(n**2+r**2)}const Sn=new Set([`auto`,`scroll`]);var PanSession=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=transformPoint(this.lastRawMoveEventInfo,this.transformPagePoint));let e=getPanInfo(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=distance2D(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=j;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=transformPoint(t,this.transformPagePoint),k.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=getPanInfo(e.type===`pointercancel`?this.lastMoveEventInfo:transformPoint(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!isPrimaryPointer(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=transformPoint(extractEventInfo(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=j;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,getPanInfo(s,this.history)),this.removeListeners=pipe(addPointerEvent(this.contextWindow,`pointermove`,this.handlePointerMove),addPointerEvent(this.contextWindow,`pointerup`,this.handlePointerUp),addPointerEvent(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Sn.has(e.overflowX)||Sn.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),k.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),A(this.updatePoint)}};function transformPoint(e,t){return t?{point:t(e.point)}:e}function subtractPoint(e,t){return{x:e.x-t.x,y:e.y-t.y}}function getPanInfo({point:e},t){return{point:e,delta:subtractPoint(e,lastDevicePoint(t)),offset:subtractPoint(e,startDevicePoint(t)),velocity:getVelocity(t,.1)}}function startDevicePoint(e){return e[0]}function lastDevicePoint(e){return e[e.length-1]}function getVelocity(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=lastDevicePoint(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>secondsToMilliseconds(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>secondsToMilliseconds(t)*2&&(r=e[1]);let a=millisecondsToSeconds(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function applyConstraints(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?U(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?U(n,e,r.max):Math.min(e,n)),e}function calcRelativeAxisConstraints(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function calcRelativeConstraints(e,{top:t,left:n,bottom:r,right:i}){return{x:calcRelativeAxisConstraints(e.x,n,i),y:calcRelativeAxisConstraints(e.y,t,r)}}function calcViewportAxisConstraints(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function calcViewportConstraints(e,t){return{x:calcViewportAxisConstraints(e.x,t.x),y:calcViewportAxisConstraints(e.y,t.y)}}function calcOrigin(e,t){let n=.5,r=calcLength(e),i=calcLength(t);return i>r?n=progress(t.min,t.max-r,e.min):r>i&&(n=progress(e.min,e.max-i,t.min)),clamp(0,1,n)}function rebaseAxisConstraints(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Cn=.35;function resolveDragElastic(e=Cn){return e===!1?e=0:e===!0&&(e=Cn),{x:resolveAxisElastic(e,`left`,`right`),y:resolveAxisElastic(e,`top`,`bottom`)}}function resolveAxisElastic(e,t,n){return{min:resolvePointElastic(e,t),max:resolvePointElastic(e,n)}}function resolvePointElastic(e,t){return typeof e==`number`?e:e[t]||0}const wn=new WeakMap;var VisualElementDragControls=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let onSessionStart=e=>{t&&this.snapToCursor(extractEventInfo(e).point),this.stopAnimation()},onStart=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=setDragLock(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(e=>{let t=this.getAxisMotionValue(e).get()||0;if(R.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=calcLength(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&k.update(()=>i(e,t),!1,!0),addValueToWillChange(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},onMove=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=getCurrentDirection(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&k.update(()=>a(e,t),!1,!0)},onSessionEnd=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:i}=this.getProps();this.panSession=new PanSession(e,{onSessionStart,onStart,onMove,onSessionEnd,resumeAnimation},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:i,distanceThreshold:n,contextWindow:getContextWindow(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&k.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!shouldDrag(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=applyConstraints(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&isRefObject(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=calcRelativeConstraints(n.layoutBox,e):this.constraints=!1,this.elastic=resolveDragElastic(t),r!==this.constraints&&!isRefObject(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=rebaseAxisConstraints(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!isRefObject(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=measurePageBox(n,r.root,this.visualElement.getTransformPagePoint()),a=calcViewportConstraints(r.layout.layoutBox,i);if(t){let e=t(convertBoxToBoundingBox(a));this.hasMutatedConstraints=!!e,e&&(a=convertBoundingBoxToBox(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=eachAxis(o=>{if(!shouldDrag(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return addValueToWillChange(this.visualElement,e),n.start(animateMotionValue(e,n,0,t,this.visualElement,!1))}stopAnimation(){eachAxis(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){eachAxis(t=>{let{drag:n}=this.getProps();if(!shouldDrag(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-U(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!isRefObject(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};eachAxis(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=calcOrigin({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),eachAxis(t=>{if(!shouldDrag(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(U(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;wn.set(this.visualElement,this);let e=this.visualElement.current,t=addPointerEvent(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&isElementTextInput(i);n&&r&&!a&&this.start(t)}),n,measureDragConstraints=()=>{let{dragConstraints:t}=this.getProps();isRefObject(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=startResizeObservers(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:r}=this.visualElement,i=r.addEventListener(`measure`,measureDragConstraints);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),k.read(measureDragConstraints);let a=addDomEvent(window,`resize`,()=>this.scalePositionWithinConstraints()),o=r.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(eachAxis(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{a(),t(),i(),o&&o(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=Cn,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function skipFirstCall(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function startResizeObservers(e,t,n){let r=resize(e,skipFirstCall(n)),i=resize(t,skipFirstCall(n));return()=>{r(),i()}}function shouldDrag(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function getCurrentDirection(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var DragGesture=class extends Feature{constructor(e){super(e),this.removeGroupControls=noop,this.removeListeners=noop,this.controls=new VisualElementDragControls(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}};const asyncHandler=e=>(t,n)=>{e&&k.update(()=>e(t,n),!1,!0)};var PanGesture=class extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop}onPointerDown(e){this.session=new PanSession(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:asyncHandler(e),onStart:asyncHandler(t),onMove:asyncHandler(n),onEnd:(e,t)=>{delete this.session,r&&k.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};let Tn=!1;var MeasureLayoutWithContext=class extends i{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Tn&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),$t.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Tn=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||k.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),pt.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Tn=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function MeasureLayout(e){let[t,n]=usePresence(),r=d(S);return b(MeasureLayoutWithContext,{...e,layoutGroup:r,switchLayoutGroup:d(vn),isPresent:t,safeToRemove:n})}const En={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:sn,MeasureLayout}};function handleHoverEvent(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&k.postRender(()=>i(t,extractEventInfo(t)))}var HoverGesture=class extends Feature{mount(){let{current:e}=this.node;e&&(this.unmount=hover(e,(e,t)=>(handleHoverEvent(this.node,t,`Start`),e=>handleHoverEvent(this.node,e,`End`))))}unmount(){}},FocusGesture=class extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=pipe(addDomEvent(this.node.current,`focus`,()=>this.onFocus()),addDomEvent(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function handlePressEvent(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&k.postRender(()=>i(t,extractEventInfo(t)))}var PressGesture=class extends Feature{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=press(e,(e,t)=>(handlePressEvent(this.node,t,`Start`),(e,{success:t})=>handlePressEvent(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}};const Dn=new WeakMap,On=new WeakMap,fireObserverCallback=e=>{let t=Dn.get(e.target);t&&t(e)},fireAllObserverCallbacks=e=>{e.forEach(fireObserverCallback)};function initIntersectionObserver({root:e,...t}){let n=e||document;On.has(n)||On.set(n,{});let r=On.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(fireAllObserverCallbacks,{root:e,...t})),r[i]}function observeIntersection(e,t,n){let r=initIntersectionObserver(t);return Dn.set(e,n),r.observe(e),()=>{Dn.delete(e),r.unobserve(e)}}const kn={some:0,all:1};var InViewFeature=class extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:kn[r]},onIntersectionUpdate=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};return observeIntersection(this.node.current,a,onIntersectionUpdate)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(hasViewportOptionChanged(e,t))&&this.startObserver()}unmount(){}};function hasViewportOptionChanged({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const An={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}},jn={layout:{ProjectionNode:sn,MeasureLayout}},Mn={renderer:createDomVisualElement,...xn,...An,...En,...jn};function useMotionValue(e){let t=useConstant(()=>motionValue(e)),{isStatic:n}=d($);if(n){let[,n]=v(e);f(()=>t.on(`change`,n),[])}return t}function useReducedMotion(){!Ot.current&&initPrefersReducedMotion();let[e]=v(Dt.current);return e}function useReducedMotionConfig(){let e=useReducedMotion(),{reducedMotion:t}=d($);return t===`never`?!1:t===`always`?!0:e}function isDOMKeyframes(e){return typeof e==`object`&&!Array.isArray(e)}function resolveSubjects(e,t,n,r){return e==null?[]:typeof e==`string`&&isDOMKeyframes(t)?resolveElements(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(e=>e!=null):[e]}function calculateRepeatDuration(e,t,n){return e*(t+1)}function calcNextTime(e,t,n,r){return typeof t==`number`?t:t.startsWith(`-`)||t.startsWith(`+`)?Math.max(0,e+parseFloat(t)):t===`<`?n:t.startsWith(`<`)?Math.max(0,n+parseFloat(t.slice(1))):r.get(t)??e}function eraseKeyframes(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.at>t&&i.at<n&&(removeItem(e,i),r--)}}function addKeyframes(e,t,n,r,i,a){eraseKeyframes(e,i,a);for(let o=0;o<t.length;o++)e.push({value:t[o],at:U(i,a,r[o]),easing:getEasingForSegment(n,o)})}function normalizeTimes(e,t){for(let n=0;n<e.length;n++)e[n]=e[n]/(t+1)}function compareByTime(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}function createAnimationsFromSequence(e,{defaultTransition:t={},...n}={},r,i){let a=t.duration||.3,o=new Map,s=new Map,c={},l=new Map,u=0,d=0,f=0;for(let n=0;n<e.length;n++){let o=e[n];if(typeof o==`string`){l.set(o,d);continue}else if(!Array.isArray(o)){l.set(o.name,calcNextTime(d,o.at,u,l));continue}let[p,m,h={}]=o;h.at!==void 0&&(d=calcNextTime(d,h.at,u,l));let g=0,resolveValueSequence=(e,n,r,o=0,s=0)=>{let c=keyframesAsList(e),{delay:l=0,times:u=defaultOffset(c),type:p=t.type||`keyframes`,repeat:m,repeatType:h,repeatDelay:_=0,...v}=n,{ease:y=t.ease||`easeOut`,duration:b}=n,x=typeof l==`function`?l(o,s):l,S=c.length,C=isGenerator(p)?p:i?.[p||`keyframes`];if(S<=2&&C){let e=100;if(S===2&&isNumberKeyframesArray(c)){let t=c[1]-c[0];e=Math.abs(t)}let n={...t,...v};b!==void 0&&(n.duration=secondsToMilliseconds(b));let r=createGeneratorEasing(n,e,C);y=r.ease,b=r.duration}b??=a;let w=d+x;u.length===1&&u[0]===0&&(u[1]=1);let T=u.length-c.length;if(T>0&&fillOffset(u,T),c.length===1&&c.unshift(null),m){b=calculateRepeatDuration(b,m);let e=[...c],t=[...u];y=Array.isArray(y)?[...y]:[y];let n=[...y];for(let r=0;r<m;r++){c.push(...e);for(let i=0;i<e.length;i++)u.push(t[i]+(r+1)),y.push(i===0?`linear`:getEasingForSegment(n,i-1))}normalizeTimes(u,m)}let ee=w+b;addKeyframes(r,c,y,u,w,ee),g=Math.max(x+b,g),f=Math.max(ee,f)};if(isMotionValue(p)){let e=getSubjectSequence(p,s);resolveValueSequence(m,h,getValueSequence(`default`,e))}else{let e=resolveSubjects(p,m,r,c),t=e.length;for(let n=0;n<t;n++){m=m,h=h;let r=e[n],i=getSubjectSequence(r,s);for(let e in m)resolveValueSequence(m[e],getValueTransition(h,e),getValueSequence(e,i),n,t)}}u=d,d+=g}return s.forEach((e,r)=>{for(let i in e){let a=e[i];a.sort(compareByTime);let s=[],c=[],l=[];for(let e=0;e<a.length;e++){let{at:t,value:n,easing:r}=a[e];s.push(n),c.push(progress(0,f,t)),l.push(r||`easeOut`)}c[0]!==0&&(c.unshift(0),s.unshift(s[0]),l.unshift(`easeInOut`)),c[c.length-1]!==1&&(c.push(1),s.push(null)),o.has(r)||o.set(r,{keyframes:{},transition:{}});let u=o.get(r);u.keyframes[i]=s;let{type:d,...p}=t;u.transition[i]={...p,duration:f,ease:l,times:c,...n}}}),o}function getSubjectSequence(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function getValueSequence(e,t){return t[e]||(t[e]=[]),t[e]}function keyframesAsList(e){return Array.isArray(e)?e:[e]}function getValueTransition(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const isNumber=e=>typeof e==`number`,isNumberKeyframesArray=e=>e.every(isNumber);function createDOMVisualElement(e){let t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=isSVGElement(e)&&!isSVGSVGElement(e)?new SVGVisualElement(t):new HTMLVisualElement(t);n.mount(e),X.set(e,n)}function createObjectVisualElement(e){let t=new ObjectVisualElement({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});t.mount(e),X.set(e,t)}function isSingleValue(e,t){return isMotionValue(e)||typeof e==`number`||typeof e==`string`&&!isDOMKeyframes(t)}function animateSubject(e,t,n,r){let i=[];if(isSingleValue(e,t))i.push(animateSingleValue(e,isDOMKeyframes(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return i;let a=resolveSubjects(e,t,r),o=a.length;for(let e=0;e<o;e++){let r=a[e],s=r instanceof Element?createDOMVisualElement:createObjectVisualElement;X.has(r)||s(r);let c=X.get(r),l={...n};`delay`in l&&typeof l.delay==`function`&&(l.delay=l.delay(e,o)),i.push(...animateTarget(c,{...t,transition:l},{}))}}return i}function animateSequence(e,t,n){let r=[];return createAnimationsFromSequence(e.map(e=>{if(Array.isArray(e)&&typeof e[0]==`function`){let t=e[0],n=motionValue(0);return n.on(`change`,t),e.length===1?[n,[0,1]]:e.length===2?[n,[0,1],e[1]]:[n,e[1],e[2]]}return e}),t,n,{spring}).forEach(({keyframes:e,transition:t},n)=>{r.push(...animateSubject(n,e,t))}),r}function isSequence(e){return Array.isArray(e)&&e.some(Array.isArray)}function createScopedAnimate(e={}){let{scope:t,reduceMotion:n}=e;function scopedAnimate(e,r,i){let a=[],o;if(isSequence(e)){let{onComplete:i,...s}=r||{};typeof i==`function`&&(o=i),a=animateSequence(e,n===void 0?s:{reduceMotion:n,...s},t)}else{let{onComplete:s,...c}=i||{};typeof s==`function`&&(o=s),a=animateSubject(e,r,n===void 0?c:{reduceMotion:n,...c},t)}let s=new GroupAnimationWithThen(a);return o&&s.finished.then(o),t&&(t.animations.push(s),s.finished.then(()=>{removeItem(t.animations,s)})),s}return scopedAnimate}const Nn=createScopedAnimate();var DragControls=class{constructor(){this.componentControls=new Set}subscribe(e){return this.componentControls.add(e),()=>this.componentControls.delete(e)}start(e,t){this.componentControls.forEach(n=>{n.start(e.nativeEvent||e,t)})}cancel(){this.componentControls.forEach(e=>{e.cancel()})}stop(){this.componentControls.forEach(e=>{e.stop()})}};const createDragControls=()=>new DragControls;function useDragControls(){return useConstant(createDragControls)}function createMinimalMotionComponent(e,t){return createMotionComponent(e,t)}const Pn=createMinimalMotionComponent(`a`),Fn=createMinimalMotionComponent(`abbr`),In=createMinimalMotionComponent(`address`),Ln=createMinimalMotionComponent(`area`),Rn=createMinimalMotionComponent(`article`),zn=createMinimalMotionComponent(`aside`),Bn=createMinimalMotionComponent(`audio`),Vn=createMinimalMotionComponent(`b`),Hn=createMinimalMotionComponent(`base`),Un=createMinimalMotionComponent(`bdi`),Wn=createMinimalMotionComponent(`bdo`),Gn=createMinimalMotionComponent(`big`),Kn=createMinimalMotionComponent(`blockquote`),qn=createMinimalMotionComponent(`body`),Jn=createMinimalMotionComponent(`button`),Yn=createMinimalMotionComponent(`canvas`),Xn=createMinimalMotionComponent(`caption`),Zn=createMinimalMotionComponent(`cite`),Qn=createMinimalMotionComponent(`code`),$n=createMinimalMotionComponent(`col`),er=createMinimalMotionComponent(`colgroup`),tr=createMinimalMotionComponent(`data`),nr=createMinimalMotionComponent(`datalist`),rr=createMinimalMotionComponent(`dd`),ir=createMinimalMotionComponent(`del`),ar=createMinimalMotionComponent(`details`),or=createMinimalMotionComponent(`dfn`),sr=createMinimalMotionComponent(`dialog`),cr=createMinimalMotionComponent(`div`),lr=createMinimalMotionComponent(`dl`),ur=createMinimalMotionComponent(`dt`),dr=createMinimalMotionComponent(`em`),fr=createMinimalMotionComponent(`embed`),pr=createMinimalMotionComponent(`fieldset`),mr=createMinimalMotionComponent(`figcaption`),hr=createMinimalMotionComponent(`figure`),gr=createMinimalMotionComponent(`footer`),_r=createMinimalMotionComponent(`form`),vr=createMinimalMotionComponent(`h1`),yr=createMinimalMotionComponent(`h2`),br=createMinimalMotionComponent(`h3`),xr=createMinimalMotionComponent(`h4`),Sr=createMinimalMotionComponent(`h5`),Cr=createMinimalMotionComponent(`h6`),wr=createMinimalMotionComponent(`head`),Tr=createMinimalMotionComponent(`header`),Er=createMinimalMotionComponent(`hgroup`),Dr=createMinimalMotionComponent(`hr`),Or=createMinimalMotionComponent(`html`),kr=createMinimalMotionComponent(`i`),Ar=createMinimalMotionComponent(`iframe`),jr=createMinimalMotionComponent(`img`),Mr=createMinimalMotionComponent(`input`),Nr=createMinimalMotionComponent(`ins`),Pr=createMinimalMotionComponent(`kbd`),Fr=createMinimalMotionComponent(`keygen`),Ir=createMinimalMotionComponent(`label`),Lr=createMinimalMotionComponent(`legend`),Rr=createMinimalMotionComponent(`li`),zr=createMinimalMotionComponent(`link`),Br=createMinimalMotionComponent(`main`),Vr=createMinimalMotionComponent(`map`),Hr=createMinimalMotionComponent(`mark`),Ur=createMinimalMotionComponent(`menu`),Wr=createMinimalMotionComponent(`menuitem`),Gr=createMinimalMotionComponent(`meter`),Kr=createMinimalMotionComponent(`nav`),qr=createMinimalMotionComponent(`object`),Jr=createMinimalMotionComponent(`ol`),Yr=createMinimalMotionComponent(`optgroup`),Xr=createMinimalMotionComponent(`option`),Zr=createMinimalMotionComponent(`output`),Qr=createMinimalMotionComponent(`p`),$r=createMinimalMotionComponent(`param`),ei=createMinimalMotionComponent(`picture`),ti=createMinimalMotionComponent(`pre`),ni=createMinimalMotionComponent(`progress`),ri=createMinimalMotionComponent(`q`),ii=createMinimalMotionComponent(`rp`),ai=createMinimalMotionComponent(`rt`),oi=createMinimalMotionComponent(`ruby`),si=createMinimalMotionComponent(`s`),ci=createMinimalMotionComponent(`samp`),li=createMinimalMotionComponent(`script`),ui=createMinimalMotionComponent(`section`),di=createMinimalMotionComponent(`select`),fi=createMinimalMotionComponent(`small`),pi=createMinimalMotionComponent(`source`),mi=createMinimalMotionComponent(`span`),hi=createMinimalMotionComponent(`strong`),gi=createMinimalMotionComponent(`style`),_i=createMinimalMotionComponent(`sub`),vi=createMinimalMotionComponent(`summary`),yi=createMinimalMotionComponent(`sup`),bi=createMinimalMotionComponent(`table`),xi=createMinimalMotionComponent(`tbody`),Si=createMinimalMotionComponent(`td`),Ci=createMinimalMotionComponent(`textarea`),wi=createMinimalMotionComponent(`tfoot`),Ti=createMinimalMotionComponent(`th`),Ei=createMinimalMotionComponent(`thead`),Di=createMinimalMotionComponent(`time`),Oi=createMinimalMotionComponent(`title`),ki=createMinimalMotionComponent(`tr`),Ai=createMinimalMotionComponent(`track`),ji=createMinimalMotionComponent(`u`),Mi=createMinimalMotionComponent(`ul`),Ni=createMinimalMotionComponent(`video`),Pi=createMinimalMotionComponent(`wbr`),Fi=createMinimalMotionComponent(`webview`),Ii=createMinimalMotionComponent(`animate`),Li=createMinimalMotionComponent(`circle`),Ri=createMinimalMotionComponent(`defs`),zi=createMinimalMotionComponent(`desc`),Bi=createMinimalMotionComponent(`ellipse`),Vi=createMinimalMotionComponent(`g`),Hi=createMinimalMotionComponent(`image`),Ui=createMinimalMotionComponent(`line`),Wi=createMinimalMotionComponent(`filter`),Gi=createMinimalMotionComponent(`marker`),Ki=createMinimalMotionComponent(`mask`),qi=createMinimalMotionComponent(`metadata`),Ji=createMinimalMotionComponent(`path`),Yi=createMinimalMotionComponent(`pattern`),Xi=createMinimalMotionComponent(`polygon`),Zi=createMinimalMotionComponent(`polyline`),Qi=createMinimalMotionComponent(`rect`),$i=createMinimalMotionComponent(`stop`),ea=createMinimalMotionComponent(`svg`),ta=createMinimalMotionComponent(`symbol`),na=createMinimalMotionComponent(`text`),ra=createMinimalMotionComponent(`tspan`),ia=createMinimalMotionComponent(`use`),aa=createMinimalMotionComponent(`view`),oa=createMinimalMotionComponent(`clipPath`),sa=createMinimalMotionComponent(`feBlend`),ca=createMinimalMotionComponent(`feColorMatrix`),la=createMinimalMotionComponent(`feComponentTransfer`),ua=createMinimalMotionComponent(`feComposite`),da=createMinimalMotionComponent(`feConvolveMatrix`),fa=createMinimalMotionComponent(`feDiffuseLighting`),pa=createMinimalMotionComponent(`feDisplacementMap`),ma=createMinimalMotionComponent(`feDistantLight`),ha=createMinimalMotionComponent(`feDropShadow`),ga=createMinimalMotionComponent(`feFlood`),_a=createMinimalMotionComponent(`feFuncA`),va=createMinimalMotionComponent(`feFuncB`),ya=createMinimalMotionComponent(`feFuncG`),ba=createMinimalMotionComponent(`feFuncR`),xa=createMinimalMotionComponent(`feGaussianBlur`),Sa=createMinimalMotionComponent(`feImage`),Ca=createMinimalMotionComponent(`feMerge`),wa=createMinimalMotionComponent(`feMergeNode`),Ta=createMinimalMotionComponent(`feMorphology`),Ea=createMinimalMotionComponent(`feOffset`),Da=createMinimalMotionComponent(`fePointLight`),Oa=createMinimalMotionComponent(`feSpecularLighting`),ka=createMinimalMotionComponent(`feSpotLight`),Aa=createMinimalMotionComponent(`feTile`),ja=createMinimalMotionComponent(`feTurbulence`),Ma=createMinimalMotionComponent(`foreignObject`),Na=createMinimalMotionComponent(`linearGradient`),Pa=createMinimalMotionComponent(`radialGradient`),Fa=createMinimalMotionComponent(`textPath`);export{ba as $,Ni as $n,Kr as $t,zi as A,gi as An,kr as At,sa as B,Fa as Bn,Rr as Bt,$n as C,ui as Cn,isCSSVar as Cr,Sr as Ct,rr as D,mi as Dn,A as Dr,Er as Dt,nr as E,pi as En,interpolate as Er,Tr as Et,lr as F,ta as Fn,Nr as Ft,fa as G,Di as Gn,Vr as Gt,la as H,wi as Hn,Na as Ht,ur as I,bi as In,Pr as It,ha as J,Ai as Jn,Ki as Jt,pa as K,Oi as Kn,Hr as Kt,Bi as L,xi as Ln,Fr as Lt,or as M,vi as Mn,Hi as Mt,sr as N,yi as Nn,jr as Nt,Ri as O,$i as On,k as Or,Dr as Ot,cr as P,ea as Pn,Mr as Pt,ya as Q,ia as Qn,Gr as Qt,dr as R,Si as Rn,Ir as Rt,Qn as S,li as Sn,motionValue as Sr,xr as St,tr as T,fi as Tn,K as Tr,wr as Tt,ua as U,Ti as Un,zr as Ut,ca as V,Ci as Vn,Ui as Vt,da as W,Ei as Wn,Br as Wt,_a as X,ji as Xn,Wr as Xt,ga as Y,ra as Yn,Ur as Yt,va as Z,Mi as Zn,qi as Zt,Yn as _,ii as _n,getValueAsType as _r,_r as _t,Ln as a,Qr as an,Nn as ar,Ea as at,Zn as b,si as bn,MotionValue as br,yr as bt,Bn as c,Yi as cn,Mn as cr,ka as ct,Un as d,Zi as dn,isValidMotionProp as dr,pr as dt,qr as en,aa as er,xa as et,Wn as f,ti as fn,LazyMotion as fr,mr as ft,Jn as g,Qi as gn,isHTMLElement as gr,Ma as gt,qn as h,Pa as hn,usePresence as hr,gr as ht,Ii as i,Zr as in,useDragControls as ir,Ta as it,ar as j,_i as jn,Ar as jt,ir as k,hi as kn,easingDefinitionToFunction as kr,Or as kt,Vn as l,ei as ln,yn as lr,Aa as lt,Kn as m,ri as mn,AnimatePresence as mr,Wi as mt,Fn as n,Yr as nn,Fi as nr,Ca as nt,Rn as o,$r as on,useReducedMotionConfig as or,Da as ot,Gn as p,ni as pn,LayoutGroup as pr,hr as pt,ma as q,ki as qn,Gi as qt,In as r,Xr as rn,createMinimalMotionComponent as rr,wa as rt,zn as s,Ji as sn,useMotionValue as sr,Oa as st,Pn as t,Jr as tn,Pi as tr,Sa as tt,Hn as u,Xi as un,MotionConfig as ur,ja as ut,Xn as v,ai as vn,resolveElements as vr,Vi as vt,er as w,di as wn,G as wr,Cr as wt,oa as x,ci as xn,$e as xr,br as xt,Li as y,oi as yn,ct as yr,vr as yt,fr as z,na as zn,Lr as zt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"../rolldown-runtime.mjs";function resolveUrl(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}const t=(()=>{let e=0,random=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${random()}${e}`)})();function toArray(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}function px(e,t){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace(`px`,``)):0}function getNodeWidth(e){let t=px(e,`border-left-width`),n=px(e,`border-right-width`);return e.clientWidth+t+n}function getNodeHeight(e){let t=px(e,`border-top-width`),n=px(e,`border-bottom-width`);return e.clientHeight+t+n}function getImageSize(e,t={}){return{width:t.width||getNodeWidth(e),height:t.height||getNodeHeight(e)}}function getPixelRatio(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const n=16384;function checkCanvasDimensions(e){(e.width>n||e.height>n)&&(e.width>n&&e.height>n?e.width>e.height?(e.height*=n/e.width,e.width=n):(e.width*=n/e.height,e.height=n):e.width>n?(e.height*=n/e.width,e.width=n):(e.width*=n/e.height,e.height=n))}function canvasToBlob(e,t={}){return e.toBlob?new Promise(n=>{e.toBlob(n,t.type?t.type:`image/png`,t.quality?t.quality:1)}):new Promise(n=>{let r=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(`,`)[1]),i=r.length,a=new Uint8Array(i);for(let e=0;e<i;e+=1)a[e]=r.charCodeAt(e);n(new Blob([a],{type:t.type?t.type:`image/png`}))})}function createImage(e){return new Promise((t,n)=>{let r=new Image;r.decode=()=>t(r),r.onload=()=>t(r),r.onerror=n,r.crossOrigin=`anonymous`,r.decoding=`async`,r.src=e})}async function svgToDataURL(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function nodeToDataURL(e,t,n){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`),a=document.createElementNS(r,`foreignObject`);return i.setAttribute(`width`,`${t}`),i.setAttribute(`height`,`${n}`),i.setAttribute(`viewBox`,`0 0 ${t} ${n}`),a.setAttribute(`width`,`100%`),a.setAttribute(`height`,`100%`),a.setAttribute(`x`,`0`),a.setAttribute(`y`,`0`),a.setAttribute(`externalResourcesRequired`,`true`),i.appendChild(a),a.appendChild(e),svgToDataURL(i)}const isInstanceOfElement=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||isInstanceOfElement(n,t)};function formatCSSText(e){let t=e.getPropertyValue(`content`);return`${e.cssText} content: '${t.replace(/'|"/g,``)}';`}function formatCSSProperties(e){return toArray(e).map(t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?` !important`:``};`).join(` `)}function getPseudoElementStyle(e,t,n){let r=`.${e}:${t}`,i=n.cssText?formatCSSText(n):formatCSSProperties(n);return document.createTextNode(`${r}{${i}}`)}function clonePseudoElement(e,n,r){let i=window.getComputedStyle(e,r),a=i.getPropertyValue(`content`);if(a===``||a===`none`)return;let o=t();try{n.className=`${n.className} ${o}`}catch{return}let s=document.createElement(`style`);s.appendChild(getPseudoElementStyle(o,r,i)),n.appendChild(s)}function clonePseudoElements(e,t){clonePseudoElement(e,t,`:before`),clonePseudoElement(e,t,`:after`)}const r=`application/font-woff`,i=`image/jpeg`,a={woff:r,woff2:r,ttf:`application/font-truetype`,eot:`application/vnd.ms-fontobject`,png:`image/png`,jpg:i,jpeg:i,gif:`image/gif`,tiff:`image/tiff`,svg:`image/svg+xml`,webp:`image/webp`};function getExtension(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:``}function getMimeType(e){return a[getExtension(e).toLowerCase()]||``}function getContentFromDataUrl(e){return e.split(/,/)[1]}function isDataUrl(e){return e.search(/^(data:)/)!==-1}function makeDataUrl(e,t){return`data:${t};base64,${e}`}async function fetchAsDataURL(e,t,n){let r=await fetch(e,t);if(r.status===404)throw Error(`Resource "${r.url}" not found`);let i=await r.blob();return new Promise((e,t)=>{let a=new FileReader;a.onerror=t,a.onloadend=()=>{try{e(n({res:r,result:a.result}))}catch(e){t(e)}},a.readAsDataURL(i)})}const o={};function getCacheKey(e,t,n){let r=e.replace(/\?.*/,``);return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,``)),t?`[${t}]${r}`:r}async function resourceToDataURL(e,t,n){let r=getCacheKey(e,t,n.includeQueryParams);if(o[r]!=null)return o[r];n.cacheBust&&(e+=(/\?/.test(e)?`&`:`?`)+new Date().getTime());let i;try{i=makeDataUrl(await fetchAsDataURL(e,n.fetchRequestInit,({res:e,result:n})=>(t||=e.headers.get(`Content-Type`)||``,getContentFromDataUrl(n))),t)}catch(t){i=n.imagePlaceholder||``;let r=`Failed to fetch resource: ${e}`;t&&(r=typeof t==`string`?t:t.message),r&&console.warn(r)}return o[r]=i,i}async function cloneCanvasElement(e){let t=e.toDataURL();return t===`data:,`?e.cloneNode(!1):createImage(t)}async function cloneVideoElement(e,t){if(e.currentSrc){let t=document.createElement(`canvas`),n=t.getContext(`2d`);return t.width=e.clientWidth,t.height=e.clientHeight,n?.drawImage(e,0,0,t.width,t.height),createImage(t.toDataURL())}let n=e.poster;return createImage(await resourceToDataURL(n,getMimeType(n),t))}async function cloneIFrameElement(e){try{if(e?.contentDocument?.body)return await cloneNode(e.contentDocument.body,{},!0)}catch{}return e.cloneNode(!1)}async function cloneSingleNode(e,t){return isInstanceOfElement(e,HTMLCanvasElement)?cloneCanvasElement(e):isInstanceOfElement(e,HTMLVideoElement)?cloneVideoElement(e,t):isInstanceOfElement(e,HTMLIFrameElement)?cloneIFrameElement(e):e.cloneNode(!1)}const isSlotElement=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SLOT`;async function cloneChildren(e,t,n){let r=[];return r=isSlotElement(e)&&e.assignedNodes?toArray(e.assignedNodes()):isInstanceOfElement(e,HTMLIFrameElement)&&e.contentDocument?.body?toArray(e.contentDocument.body.childNodes):toArray((e.shadowRoot??e).childNodes),r.length===0||isInstanceOfElement(e,HTMLVideoElement)||await r.reduce((e,r)=>e.then(()=>cloneNode(r,n)).then(e=>{e&&t.appendChild(e)}),Promise.resolve()),t}function cloneCSSStyle(e,t){let n=t.style;if(!n)return;let r=window.getComputedStyle(e);r.cssText?(n.cssText=r.cssText,n.transformOrigin=r.transformOrigin):toArray(r).forEach(i=>{let a=r.getPropertyValue(i);i===`font-size`&&a.endsWith(`px`)&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),isInstanceOfElement(e,HTMLIFrameElement)&&i===`display`&&a===`inline`&&(a=`block`),i===`d`&&t.getAttribute(`d`)&&(a=`path(${t.getAttribute(`d`)})`),n.setProperty(i,a,r.getPropertyPriority(i))})}function cloneInputValue(e,t){isInstanceOfElement(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),isInstanceOfElement(e,HTMLInputElement)&&t.setAttribute(`value`,e.value)}function cloneSelectValue(e,t){if(isInstanceOfElement(e,HTMLSelectElement)){let n=t,r=Array.from(n.children).find(t=>e.value===t.getAttribute(`value`));r&&r.setAttribute(`selected`,``)}}function decorate(e,t){return isInstanceOfElement(t,Element)&&(cloneCSSStyle(e,t),clonePseudoElements(e,t),cloneInputValue(e,t),cloneSelectValue(e,t)),t}async function ensureSVGSymbols(e,t){let n=e.querySelectorAll?e.querySelectorAll(`use`):[];if(n.length===0)return e;let r={};for(let i=0;i<n.length;i++){let a=n[i].getAttribute(`xlink:href`);if(a){let n=e.querySelector(a),i=document.querySelector(a);!n&&i&&!r[a]&&(r[a]=await cloneNode(i,t,!0))}}let i=Object.values(r);if(i.length){let t=`http://www.w3.org/1999/xhtml`,n=document.createElementNS(t,`svg`);n.setAttribute(`xmlns`,t),n.style.position=`absolute`,n.style.width=`0`,n.style.height=`0`,n.style.overflow=`hidden`,n.style.display=`none`;let r=document.createElementNS(t,`defs`);n.appendChild(r);for(let e=0;e<i.length;e++)r.appendChild(i[e]);e.appendChild(n)}return e}async function cloneNode(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(e=>cloneSingleNode(e,t)).then(n=>cloneChildren(e,n,t)).then(t=>decorate(e,t)).then(e=>ensureSVGSymbols(e,t))}const s=/url\((['"]?)([^'"]+?)\1\)/g,c=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,l=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function toRegex(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}function parseURLs(e){let t=[];return e.replace(s,(e,n,r)=>(t.push(r),e)),t.filter(e=>!isDataUrl(e))}async function embed(e,t,n,r,i){try{let a=n?resolveUrl(t,n):t,o=getMimeType(t),s;return s=i?makeDataUrl(await i(a),o):await resourceToDataURL(a,o,r),e.replace(toRegex(t),`$1${s}$3`)}catch{}return e}function filterPreferredFontFormat(e,{preferredFontFormat:t}){return t?e.replace(l,e=>{for(;;){let[n,,r]=c.exec(e)||[];if(!r)return``;if(r===t)return`src: ${n};`}}):e}function shouldEmbed(e){return e.search(s)!==-1}async function embedResources(e,t,n){if(!shouldEmbed(e))return e;let r=filterPreferredFontFormat(e,n);return parseURLs(r).reduce((e,r)=>e.then(e=>embed(e,r,t,n)),Promise.resolve(r))}async function embedProp(e,t,n){let r=t.style?.getPropertyValue(e);if(r){let i=await embedResources(r,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function embedBackground(e,t){await embedProp(`background`,e,t)||await embedProp(`background-image`,e,t),await embedProp(`mask`,e,t)||await embedProp(`mask-image`,e,t)}async function embedImageNode(e,t){let n=isInstanceOfElement(e,HTMLImageElement);if(!(n&&!isDataUrl(e.src))&&!(isInstanceOfElement(e,SVGImageElement)&&!isDataUrl(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,i=await resourceToDataURL(r,getMimeType(r),t);await new Promise((t,r)=>{e.onload=t,e.onerror=r;let a=e;a.decode&&=t,a.loading===`lazy`&&(a.loading=`eager`),n?(e.srcset=``,e.src=i):e.href.baseVal=i})}async function embedChildren(e,t){let n=toArray(e.childNodes).map(e=>embedImages(e,t));await Promise.all(n).then(()=>e)}async function embedImages(e,t){isInstanceOfElement(e,Element)&&(await embedBackground(e,t),await embedImageNode(e,t),await embedChildren(e,t))}function applyStyle(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;return r!=null&&Object.keys(r).forEach(e=>{n[e]=r[e]}),e}const u={};async function fetchCSS(e){let t=u[e];return t??(t={url:e,cssText:await(await fetch(e)).text()},u[e]=t,t)}async function embedFonts(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async i=>{let a=i.replace(r,`$1`);return a.startsWith(`https://`)||(a=new URL(a,e.url).href),fetchAsDataURL(a,t.fetchRequestInit,({result:e})=>(n=n.replace(i,`url(${e})`),[i,e]))});return Promise.all(i).then(()=>n)}function parseCSS(e){if(e==null)return[];let t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,``),r=RegExp(`((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})`,`gi`);for(;;){let e=r.exec(n);if(e===null)break;t.push(e[0])}n=n.replace(r,``);let i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a=RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=i.exec(n);if(e===null){if(e=a.exec(n),e===null)break;i.lastIndex=a.lastIndex}else a.lastIndex=i.lastIndex;t.push(e[0])}return t}async function getCSSRules(e,t){let n=[],r=[];return e.forEach(n=>{if(`cssRules`in n)try{toArray(n.cssRules||[]).forEach((e,i)=>{if(e.type===CSSRule.IMPORT_RULE){let a=i+1,o=e.href,s=fetchCSS(o).then(e=>embedFonts(e,t)).then(e=>parseCSS(e).forEach(e=>{try{n.insertRule(e,e.startsWith(`@import`)?a+=1:n.cssRules.length)}catch(t){console.error(`Error inserting rule from remote css`,{rule:e,error:t})}})).catch(e=>{console.error(`Error loading remote css`,e.toString())});r.push(s)}})}catch(i){let a=e.find(e=>e.href==null)||document.styleSheets[0];n.href!=null&&r.push(fetchCSS(n.href).then(e=>embedFonts(e,t)).then(e=>parseCSS(e).forEach(e=>{a.insertRule(e,n.cssRules.length)})).catch(e=>{console.error(`Error loading remote stylesheet`,e)})),console.error(`Error inlining remote css file`,i)}}),Promise.all(r).then(()=>(e.forEach(e=>{if(`cssRules`in e)try{toArray(e.cssRules||[]).forEach(e=>{n.push(e)})}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}}),n))}function getWebFontRules(e){return e.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>shouldEmbed(e.style.getPropertyValue(`src`)))}async function parseWebFontRules(e,t){if(e.ownerDocument==null)throw Error(`Provided element is not within a Document`);return getWebFontRules(await getCSSRules(toArray(e.ownerDocument.styleSheets),t))}async function getWebFontCSS(e,t){let n=await parseWebFontRules(e,t);return(await Promise.all(n.map(e=>{let n=e.parentStyleSheet?e.parentStyleSheet.href:null;return embedResources(e.cssText,n,t)}))).join(`
|
|
2
|
+
`)}async function embedWebFonts(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await getWebFontCSS(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}var d=e({toBlob:()=>toBlob,toCanvas:()=>toCanvas,toJpeg:()=>toJpeg,toSvg:()=>toSvg});async function toSvg(e,t={}){let{width:n,height:r}=getImageSize(e,t),i=await cloneNode(e,t,!0);return await embedWebFonts(i,t),await embedImages(i,t),applyStyle(i,t),await nodeToDataURL(i,n,r)}async function toCanvas(e,t={}){let{width:n,height:r}=getImageSize(e,t),i=await createImage(await toSvg(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||getPixelRatio(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||checkCanvasDimensions(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function toJpeg(e,t={}){return(await toCanvas(e,t)).toDataURL(`image/jpeg`,t.quality||1)}async function toBlob(e,t={}){return await canvasToBlob(await toCanvas(e,t))}export{d as t};
|