likec4 1.56.0 → 1.57.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.
Files changed (154) hide show
  1. package/__app__/chunks/AIChat2.mjs +2 -0
  2. package/__app__/chunks/DiagramActorProvider.mjs +4 -4
  3. package/__app__/chunks/EmbedPage.mjs +1 -0
  4. package/__app__/chunks/ExportPage.mjs +2 -0
  5. package/__app__/chunks/LikeC4Diagram.mjs +5 -5
  6. package/__app__/chunks/LikeC4Styles.mjs +11 -11
  7. package/__app__/chunks/Markdown.mjs +1 -0
  8. package/__app__/chunks/NavigationPanel.mjs +1 -1
  9. package/__app__/chunks/ViewReact.mjs +1 -1
  10. package/__app__/chunks/adhoc-editor.mjs +1 -1
  11. package/__app__/chunks/aichat.mjs +1 -0
  12. package/__app__/chunks/box.mjs +1 -0
  13. package/__app__/chunks/create-style-context.mjs +1 -0
  14. package/__app__/chunks/css.mjs +1 -0
  15. package/__app__/chunks/factory.mjs +1 -0
  16. package/__app__/chunks/hooks.mjs +1 -1
  17. package/__app__/chunks/hstack.mjs +1 -0
  18. package/__app__/chunks/libs/@dagrejs/dagre.mjs +1 -1
  19. package/__app__/chunks/libs/@floating-ui/core.mjs +1 -1
  20. package/__app__/chunks/libs/@floating-ui/dom.mjs +1 -1
  21. package/__app__/chunks/libs/@floating-ui/react.mjs +1 -1
  22. package/__app__/chunks/libs/@mantine/core.mjs +24 -24
  23. package/__app__/chunks/libs/@mantine/hooks.mjs +1 -1
  24. package/__app__/chunks/libs/@nanostores/react.mjs +1 -1
  25. package/__app__/chunks/libs/@react-hookz/web.mjs +1 -1
  26. package/__app__/chunks/libs/@tabler/icons-react.mjs +347 -4
  27. package/__app__/chunks/libs/@tanstack/ai-client.mjs +2 -0
  28. package/__app__/chunks/libs/@tanstack/ai-react-ui.mjs +1 -0
  29. package/__app__/chunks/libs/@tanstack/ai-react.mjs +1 -0
  30. package/__app__/chunks/libs/@tanstack/ai.mjs +2 -0
  31. package/__app__/chunks/libs/@tanstack/history.mjs +1 -1
  32. package/__app__/chunks/libs/@tanstack/react-router.mjs +3 -3
  33. package/__app__/chunks/libs/@tanstack/router-core.mjs +1 -1
  34. package/__app__/chunks/libs/@xstate/react.mjs +1 -1
  35. package/__app__/chunks/libs/@xstate/store.mjs +1 -1
  36. package/__app__/chunks/libs/@xyflow/react.mjs +3 -3
  37. package/__app__/chunks/libs/@zag-js/anatomy.mjs +1 -1
  38. package/__app__/chunks/libs/@zag-js/collection.mjs +1 -1
  39. package/__app__/chunks/libs/@zag-js/core.mjs +1 -1
  40. package/__app__/chunks/libs/@zag-js/react.mjs +1 -1
  41. package/__app__/chunks/libs/@zag-js/tree-view.mjs +1 -1
  42. package/__app__/chunks/libs/bezier-js.mjs +1 -1
  43. package/__app__/chunks/libs/copy-anything.mjs +1 -0
  44. package/__app__/chunks/libs/d3-path.mjs +1 -1
  45. package/__app__/chunks/libs/d3-shape.mjs +1 -1
  46. package/__app__/chunks/libs/fast-equals.mjs +1 -1
  47. package/__app__/chunks/libs/framer-motion.mjs +3 -3
  48. package/__app__/chunks/libs/html-to-image.mjs +2 -2
  49. package/__app__/chunks/libs/motion-dom.mjs +1 -1
  50. package/__app__/chunks/libs/nanostores.mjs +1 -1
  51. package/__app__/chunks/libs/react-error-boundary.mjs +1 -1
  52. package/__app__/chunks/libs/react-resizable-panels.mjs +1 -1
  53. package/__app__/chunks/libs/remeda.mjs +1 -1
  54. package/__app__/chunks/libs/superjson.mjs +1 -0
  55. package/__app__/chunks/libs/zod.mjs +39 -14
  56. package/__app__/chunks/rolldown-runtime.mjs +1 -1
  57. package/__app__/chunks/styles.css.mjs +1 -1
  58. package/__app__/chunks/txt.mjs +1 -0
  59. package/__app__/chunks/useLikeC4Project.mjs +1 -1
  60. package/__app__/codegen/webcomponent.mjs +221 -69
  61. package/__app__/src/aichat/index.mjs +1 -0
  62. package/__app__/src/main.mjs +45 -1
  63. package/__app__/src/pages/AdHocViewEditor.mjs +1 -1
  64. package/__app__/src/pages/EmbedPage.mjs +1 -1
  65. package/__app__/src/pages/ExportPage.mjs +1 -1
  66. package/__app__/src/pages/ProjectsOverview.mjs +1 -1
  67. package/__app__/src/pages/ViewAsD2.mjs +1 -1
  68. package/__app__/src/pages/ViewAsDot.mjs +1 -1
  69. package/__app__/src/pages/ViewAsMmd.mjs +1 -1
  70. package/__app__/src/pages/ViewAsPuml.mjs +1 -1
  71. package/__app__/src/pages/ViewEditor.mjs +1 -1
  72. package/__app__/src/style.css +1 -1
  73. package/config/schema.json +14 -41
  74. package/dist/chunks/enableServer.mjs +1 -0
  75. package/dist/chunks/index2.d.mts +569 -377
  76. package/dist/chunks/libs/@hono/mcp.mjs +33 -8
  77. package/dist/chunks/libs/@hono/node-server.mjs +1 -1
  78. package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +7 -7
  79. package/dist/chunks/libs/@ts-graphviz/ast.mjs +3 -0
  80. package/dist/chunks/libs/@ts-graphviz/common.d.mts +9 -0
  81. package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -0
  82. package/dist/chunks/libs/ajv.mjs +1 -1
  83. package/dist/chunks/libs/ansi-styles.mjs +1 -1
  84. package/dist/chunks/libs/boxen.mjs +2 -2
  85. package/dist/chunks/libs/chevrotain.mjs +2 -2
  86. package/dist/chunks/libs/conf.mjs +1 -1
  87. package/dist/chunks/libs/langium.d.mts +5 -5
  88. package/dist/chunks/libs/langium.mjs +10 -10
  89. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  90. package/dist/chunks/libs/pako.mjs +3 -1
  91. package/dist/chunks/libs/remeda.mjs +1 -1
  92. package/dist/chunks/libs/ts-graphviz.mjs +1 -4
  93. package/dist/chunks/libs/unctx.mjs +1 -0
  94. package/dist/chunks/libs/vscode-languageserver.mjs +1 -1
  95. package/dist/chunks/libs/zod.d.mts +60 -25
  96. package/dist/chunks/node.mjs +62 -45
  97. package/dist/chunks/plugin.mjs +234 -41
  98. package/dist/chunks/sequence-view.mjs +1 -1
  99. package/dist/cli/index.mjs +142 -139
  100. package/dist/index.d.mts +1 -130
  101. package/dist/model/index.d.mts +1 -1
  102. package/dist/vite-plugin/index.d.mts +53 -2
  103. package/dist/vite-plugin/internal/index.d.mts +331 -3
  104. package/dist/vite-plugin/internal/index.mjs +1 -1
  105. package/package.json +65 -51
  106. package/react/index.d.mts +82 -50
  107. package/react/index.mjs +34017 -32421
  108. package/vite-plugin-modules.d.ts +4 -0
  109. package/__app__/chunks/ColorSchemeToggle.mjs +0 -1
  110. package/__app__/chunks/Fallback.mjs +0 -1
  111. package/__app__/chunks/Header.mjs +0 -13
  112. package/__app__/chunks/IconRenderer.mjs +0 -1
  113. package/__app__/chunks/LikeC4ModelContext.mjs +0 -1
  114. package/__app__/chunks/LikeC4ModelContext2.mjs +0 -1
  115. package/__app__/chunks/StaticLikeC4Diagram.mjs +0 -1
  116. package/__app__/chunks/__root.mjs +0 -1
  117. package/__app__/chunks/libs/motion.mjs +0 -1
  118. package/__app__/chunks/libs/xstate.mjs +0 -1
  119. package/__app__/chunks/safeCtx.mjs +0 -1
  120. package/__app__/chunks/searchParams.mjs +0 -1
  121. package/__app__/chunks/single-index.mjs +0 -1
  122. package/__app__/chunks/styled-system.mjs +0 -1
  123. package/__app__/chunks/useUpdateEffect.mjs +0 -1
  124. package/__app__/src/routeTree.gen.mjs +0 -1
  125. package/__app__/src/routes/__root.mjs +0 -1
  126. package/__app__/src/routes/_single/adhoc.mjs +0 -1
  127. package/__app__/src/routes/_single/embed._viewId.mjs +0 -1
  128. package/__app__/src/routes/_single/export._viewId.mjs +0 -1
  129. package/__app__/src/routes/_single/route.mjs +0 -1
  130. package/__app__/src/routes/_single/single-index.mjs +0 -1
  131. package/__app__/src/routes/_single/view._viewId.d2.mjs +0 -1
  132. package/__app__/src/routes/_single/view._viewId.dot.mjs +0 -1
  133. package/__app__/src/routes/_single/view._viewId.index.mjs +0 -1
  134. package/__app__/src/routes/_single/view._viewId.mjs +0 -1
  135. package/__app__/src/routes/_single/view._viewId.mmd.mjs +0 -1
  136. package/__app__/src/routes/_single/view._viewId.puml.mjs +0 -1
  137. package/__app__/src/routes/_single/webcomponent._.mjs +0 -33
  138. package/__app__/src/routes/index.mjs +0 -1
  139. package/__app__/src/routes/project._projectId/-components.mjs +0 -1
  140. package/__app__/src/routes/project._projectId/adhoc.mjs +0 -1
  141. package/__app__/src/routes/project._projectId/embed._viewId.mjs +0 -1
  142. package/__app__/src/routes/project._projectId/export._viewId.mjs +0 -1
  143. package/__app__/src/routes/project._projectId/index.mjs +0 -1
  144. package/__app__/src/routes/project._projectId/route.mjs +0 -1
  145. package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +0 -1
  146. package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +0 -1
  147. package/__app__/src/routes/project._projectId/view._viewId.index.mjs +0 -1
  148. package/__app__/src/routes/project._projectId/view._viewId.mjs +0 -1
  149. package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +0 -1
  150. package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +0 -1
  151. package/__app__/src/routes/projects.mjs +0 -1
  152. package/dist/chunks/libs/ts-graphviz.d.mts +0 -12
  153. package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.d.mts +0 -269
  154. package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +0 -59
@@ -1 +1 @@
1
- import"../../rolldown-runtime.mjs";var createAnatomy=(e,t=[])=>({parts:(...n)=>{if(isEmpty(t))return createAnatomy(e,n);throw Error(`createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?`)},extendWith:(...n)=>createAnatomy(e,[...t,...n]),omit:(...n)=>createAnatomy(e,t.filter(e=>!n.includes(e))),rename:e=>createAnatomy(e,t),keys:()=>t,build:()=>[...new Set(t)].reduce((t,n)=>Object.assign(t,{[n]:{selector:[`&[data-scope="${toKebabCase(e)}"][data-part="${toKebabCase(n)}"]`,`& [data-scope="${toKebabCase(e)}"][data-part="${toKebabCase(n)}"]`].join(`, `),attrs:{"data-scope":toKebabCase(e),"data-part":toKebabCase(n)}}}),{})}),toKebabCase=e=>e.replace(/([A-Z])([A-Z])/g,`$1-$2`).replace(/([a-z])([A-Z])/g,`$1-$2`).replace(/[\s_]+/g,`-`).toLowerCase(),isEmpty=e=>e.length===0;export{createAnatomy as t};
1
+ var e=(r,i=[])=>({parts:(...t)=>{if(n(i))return e(r,t);throw Error(`createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?`)},extendWith:(...t)=>e(r,[...i,...t]),omit:(...t)=>e(r,i.filter(e=>!t.includes(e))),rename:t=>e(t,i),keys:()=>i,build:()=>[...new Set(i)].reduce((e,n)=>Object.assign(e,{[n]:{selector:[`&[data-scope="${t(r)}"][data-part="${t(n)}"]`,`& [data-scope="${t(r)}"][data-part="${t(n)}"]`].join(`, `),attrs:{"data-scope":t(r),"data-part":t(n)}}}),{})}),t=e=>e.replace(/([A-Z])([A-Z])/g,`$1-$2`).replace(/([a-z])([A-Z])/g,`$1-$2`).replace(/[\s_]+/g,`-`).toLowerCase(),n=e=>e.length===0;export{e as t};
@@ -1 +1 @@
1
- import{i as e}from"../../rolldown-runtime.mjs";function toArray(e){return e==null?[]:Array.isArray(e)?e:[e]}var first=e=>e[0],last=e=>e[e.length-1],has=(e,t)=>e.indexOf(t)!==-1,add=(e,...t)=>e.concat(t),t=e((e,...t)=>e.filter(e=>!t.includes(e)),`remove`),uniq=e=>Array.from(new Set(e)),diff=(e,t)=>{let n=new Set(t);return e.filter(e=>!n.has(e))},addOrRemove=(e,n)=>has(e,n)?t(e,n):add(e,n);function partition(e,t){return e.reduce(([e,n],r)=>(t(r)?e.push(r):n.push(r),[e,n]),[[],[]])}var isArrayLike=e=>e?.constructor.name===`Array`,isArrayEqual=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!isEqual(e[n],t[n]))return!1;return!0},isEqual=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof e?.isEqual==`function`&&typeof t?.isEqual==`function`)return e.isEqual(t);if(typeof e==`function`&&typeof t==`function`)return e.toString()===t.toString();if(isArrayLike(e)&&isArrayLike(t))return isArrayEqual(Array.from(e),Array.from(t));if(typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(t??Object.create(null)),r=n.length;for(let t=0;t<r;t++)if(!Reflect.has(e,n[t]))return!1;for(let i=0;i<r;i++){let r=n[i];if(!isEqual(e[r],t[r]))return!1}return!0},isArray=e=>Array.isArray(e),isObjectLike=e=>typeof e==`object`&&!!e,isObject=e=>isObjectLike(e)&&!isArray(e),isString=e=>typeof e==`string`,isFunction=e=>typeof e==`function`,hasProp=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),baseGetTag=e=>Object.prototype.toString.call(e),n=Function.prototype.toString,r=n.call(Object),isPlainObject=e=>{if(!isObjectLike(e)||baseGetTag(e)!=`[object Object]`||isFrameworkElement(e))return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let i=hasProp(t,`constructor`)&&t.constructor;return typeof i==`function`&&i instanceof i&&n.call(i)==r},isReactElement=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&`props`in e,isVueElement=e=>typeof e==`object`&&!!e&&`__v_isVNode`in e,isFrameworkElement=e=>isReactElement(e)||isVueElement(e),identity=e=>e(),callAll=(...e)=>(...t)=>{e.forEach(function(e){e?.(...t)})},{floor:i,abs:a,round:o,min:s,max:c,pow:l,sign:u}=Math;function compact(e){if(!isPlainObject(e)||e===void 0)return e;let t=Reflect.ownKeys(e).filter(e=>typeof e==`string`),n={};for(let r of t){let t=e[r];t!==void 0&&(n[r]=compact(t))}return n}function splitProps(e,t){let n={},r={},i=new Set(t),a=Reflect.ownKeys(e);for(let t of a)i.has(t)?r[t]=e[t]:n[t]=e[t];return[r,n]}var createSplitProps=e=>function split(t){return splitProps(t,e)};function warn(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function ensure(e,t){if(e==null)throw Error(t())}var d=Object.defineProperty,__defNormalProp=(e,t,n)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__publicField=(e,t,n)=>__defNormalProp(e,typeof t==`symbol`?t:t+``,n);function access(e,t,n){for(let r=0;r<t.length;r++)e=n.getChildren(e,t.slice(r+1))[t[r]];return e}function ancestorIndexPaths(e){let t=sortIndexPaths(e),n=[],r=new Set;for(let e of t){let t=e.join();r.has(t)||(r.add(t),n.push(e))}return n}function compareIndexPaths(e,t){for(let n=0;n<Math.min(e.length,t.length);n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return e.length-t.length}function sortIndexPaths(e){return e.sort(compareIndexPaths)}function find(e,t){let n;return visit(e,{...t,onEnter:(e,r)=>{if(t.predicate(e,r))return n=e,`stop`}}),n}function findAll(e,t){let n=[];return visit(e,{onEnter:(e,r)=>{t.predicate(e,r)&&n.push(e)},getChildren:t.getChildren}),n}function findIndexPath(e,t){let n;return visit(e,{onEnter:(e,r)=>{if(t.predicate(e,r))return n=[...r],`stop`},getChildren:t.getChildren}),n}function reduce(e,t){let n=t.initialResult;return visit(e,{...t,onEnter:(e,r)=>{n=t.nextResult(n,e,r)}}),n}function flatMap(e,t){return reduce(e,{...t,initialResult:[],nextResult:(e,n,r)=>(e.push(...t.transform(n,r)),e)})}function filter(e,t){let{predicate:n,create:r,getChildren:i}=t,filterRecursive=(e,t)=>{let a=i(e,t),o=[];a.forEach((e,n)=>{let r=filterRecursive(e,[...t,n]);r&&o.push(r)});let s=t.length===0,c=n(e,t),l=o.length>0;return s||c||l?r(e,o,t):null};return filterRecursive(e,[])||r(e,[],[])}function flatten(e,t){let n=[],r=0,i=new Map,a=new Map;return visit(e,{getChildren:t.getChildren,onEnter:(e,o)=>{i.has(e)||i.set(e,r++);let s=t.getChildren(e,o);s.forEach(t=>{a.has(t)||a.set(t,e),i.has(t)||i.set(t,r++)});let c=s.length>0?s.map(e=>i.get(e)):void 0,l=a.get(e),u=l?i.get(l):void 0,d=i.get(e);n.push({...e,_children:c,_parent:u,_index:d})}}),n}function insertOperation(e,t){return{type:`insert`,index:e,nodes:t}}function removeOperation(e){return{type:`remove`,indexes:e}}function replaceOperation(){return{type:`replace`}}function splitIndexPath(e){return[e.slice(0,-1),e[e.length-1]]}function getInsertionOperations(e,t,n=new Map){let[r,i]=splitIndexPath(e);for(let e=r.length-1;e>=0;e--){let t=r.slice(0,e).join();switch(n.get(t)?.type){case`remove`:continue}n.set(t,replaceOperation())}let a=n.get(r.join());switch(a?.type){case`remove`:n.set(r.join(),{type:`removeThenInsert`,removeIndexes:a.indexes,insertIndex:i,insertNodes:t});break;default:n.set(r.join(),insertOperation(i,t))}return n}function getRemovalOperations(e){let t=new Map,n=new Map;for(let t of e){let e=t.slice(0,-1).join(),r=n.get(e)??[];r.push(t[t.length-1]),n.set(e,r.sort((e,t)=>e-t))}for(let n of e)for(let e=n.length-2;e>=0;e--){let r=n.slice(0,e).join();t.has(r)||t.set(r,replaceOperation())}for(let[e,r]of n)t.set(e,removeOperation(r));return t}function getReplaceOperations(e,t){let n=new Map,[r,i]=splitIndexPath(e);for(let e=r.length-1;e>=0;e--){let t=r.slice(0,e).join();n.set(t,replaceOperation())}return n.set(r.join(),{type:`removeThenInsert`,removeIndexes:[i],insertIndex:i,insertNodes:[t]}),n}function mutate(e,t,n){return map(e,{...n,getChildren:(e,r)=>{let i=r.join();switch(t.get(i)?.type){case`replace`:case`remove`:case`removeThenInsert`:case`insert`:return n.getChildren(e,r);default:return[]}},transform:(e,r,i)=>{let a=i.join(),o=t.get(a);switch(o?.type){case`remove`:return n.create(e,r.filter((e,t)=>!o.indexes.includes(t)),i);case`removeThenInsert`:let t=r.filter((e,t)=>!o.removeIndexes.includes(t)),a=o.removeIndexes.reduce((e,t)=>t<e?e-1:e,o.insertIndex);return n.create(e,splice(t,a,0,...o.insertNodes),i);case`insert`:return n.create(e,splice(r,o.index,0,...o.nodes),i);case`replace`:return n.create(e,r,i);default:return e}}})}function splice(e,t,n,...r){return[...e.slice(0,t),...r,...e.slice(t+n)]}function map(e,t){let n={};return visit(e,{...t,onLeave:(e,r)=>{let i=[0,...r],a=i.join(),o=t.transform(e,n[a]??[],r),s=i.slice(0,-1).join(),c=n[s]??[];c.push(o),n[s]=c}}),n[``][0]}function insert2(e,t){let{nodes:n,at:r}=t;if(r.length===0)throw Error(`Can't insert nodes at the root`);return mutate(e,getInsertionOperations(r,n),t)}function replace(e,t){return t.at.length===0?t.node:mutate(e,getReplaceOperations(t.at,t.node),t)}function remove(e,t){if(t.indexPaths.length===0)return e;for(let e of t.indexPaths)if(e.length===0)throw Error(`Can't remove the root node`);return mutate(e,getRemovalOperations(t.indexPaths),t)}function move2(e,t){if(t.indexPaths.length===0)return e;for(let e of t.indexPaths)if(e.length===0)throw Error(`Can't move the root node`);if(t.to.length===0)throw Error(`Can't move nodes to the root`);let n=ancestorIndexPaths(t.indexPaths),r=n.map(n=>access(e,n,t));return mutate(e,getInsertionOperations(t.to,r,getRemovalOperations(n)),t)}function visit(e,t){let{onEnter:n,onLeave:r,getChildren:i}=t,a=[],o=[{node:e}],s=t.reuseIndexPath?()=>a:()=>a.slice();for(;o.length>0;){let e=o[o.length-1];if(e.state===void 0){let t=n?.(e.node,s());if(t===`stop`)return;e.state=t===`skip`?-1:0}let t=e.children||i(e.node,s());if(e.children||=t,e.state!==-1){if(e.state<t.length){let n=e.state;a.push(n),o.push({node:t[n]}),e.state=n+1;continue}if(r?.(e.node,s())===`stop`)return}a.pop(),o.pop()}}var f=class _TreeCollection{constructor(e){this.options=e,__publicField(this,`rootNode`),__publicField(this,`isEqual`,e=>isEqual(this.rootNode,e.rootNode)),__publicField(this,`getNodeChildren`,e=>this.options.nodeToChildren?.(e)??p.nodeToChildren(e)??[]),__publicField(this,`resolveIndexPath`,e=>typeof e==`string`?this.getIndexPath(e):e),__publicField(this,`resolveNode`,e=>{let t=this.resolveIndexPath(e);return t?this.at(t):void 0}),__publicField(this,`getNodeChildrenCount`,e=>this.options.nodeToChildrenCount?.(e)??p.nodeToChildrenCount(e)),__publicField(this,`getNodeValue`,e=>this.options.nodeToValue?.(e)??p.nodeToValue(e)),__publicField(this,`getNodeDisabled`,e=>this.options.isNodeDisabled?.(e)??p.isNodeDisabled(e)),__publicField(this,`stringify`,e=>{let t=this.findNode(e);return t?this.stringifyNode(t):null}),__publicField(this,`stringifyNode`,e=>this.options.nodeToString?.(e)??p.nodeToString(e)),__publicField(this,`getFirstNode`,(e=this.rootNode,t={})=>{let n;return visit(e,{getChildren:this.getNodeChildren,onEnter:(r,i)=>{if(!this.isSameNode(r,e)){if(t.skip?.({value:this.getNodeValue(r),node:r,indexPath:i}))return`skip`;if(!n&&i.length>0&&!this.getNodeDisabled(r))return n=r,`stop`}}}),n}),__publicField(this,`getLastNode`,(e=this.rootNode,t={})=>{let n;return visit(e,{getChildren:this.getNodeChildren,onEnter:(r,i)=>{if(!this.isSameNode(r,e)){if(t.skip?.({value:this.getNodeValue(r),node:r,indexPath:i}))return`skip`;i.length>0&&!this.getNodeDisabled(r)&&(n=r)}}}),n}),__publicField(this,`at`,e=>access(this.rootNode,e,{getChildren:this.getNodeChildren})),__publicField(this,`findNode`,(e,t=this.rootNode)=>find(t,{getChildren:this.getNodeChildren,predicate:t=>this.getNodeValue(t)===e})),__publicField(this,`findNodes`,(e,t=this.rootNode)=>{let n=new Set(e.filter(e=>e!=null));return findAll(t,{getChildren:this.getNodeChildren,predicate:e=>n.has(this.getNodeValue(e))})}),__publicField(this,`sort`,e=>e.reduce((e,t)=>{let n=this.getIndexPath(t);return n&&e.push({value:t,indexPath:n}),e},[]).sort((e,t)=>compareIndexPaths(e.indexPath,t.indexPath)).map(({value:e})=>e)),__publicField(this,`getIndexPath`,e=>findIndexPath(this.rootNode,{getChildren:this.getNodeChildren,predicate:t=>this.getNodeValue(t)===e})),__publicField(this,`getValue`,e=>{let t=this.at(e);return t?this.getNodeValue(t):void 0}),__publicField(this,`getValuePath`,e=>{if(!e)return[];let t=[],n=[...e];for(;n.length>0;){let e=this.at(n);e&&t.unshift(this.getNodeValue(e)),n.pop()}return t}),__publicField(this,`getDepth`,e=>findIndexPath(this.rootNode,{getChildren:this.getNodeChildren,predicate:t=>this.getNodeValue(t)===e})?.length??0),__publicField(this,`isSameNode`,(e,t)=>this.getNodeValue(e)===this.getNodeValue(t)),__publicField(this,`isRootNode`,e=>this.isSameNode(e,this.rootNode)),__publicField(this,`contains`,(e,t)=>!e||!t?!1:t.slice(0,e.length).every((n,r)=>e[r]===t[r])),__publicField(this,`getNextNode`,(e,t={})=>{let n=!1,r;return visit(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(i,a)=>{if(this.isRootNode(i))return;let o=this.getNodeValue(i);if(t.skip?.({value:o,node:i,indexPath:a}))return o===e&&(n=!0),`skip`;if(n&&!this.getNodeDisabled(i))return r=i,`stop`;o===e&&(n=!0)}}),r}),__publicField(this,`getPreviousNode`,(e,t={})=>{let n,r=!1;return visit(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(i,a)=>{if(this.isRootNode(i))return;let o=this.getNodeValue(i);if(t.skip?.({value:o,node:i,indexPath:a}))return`skip`;if(o===e)return r=!0,`stop`;this.getNodeDisabled(i)||(n=i)}}),r?n:void 0}),__publicField(this,`getParentNodes`,e=>{let t=this.resolveIndexPath(e)?.slice();if(!t)return[];let n=[];for(;t.length>0;){t.pop();let e=this.at(t);e&&!this.isRootNode(e)&&n.unshift(e)}return n}),__publicField(this,`getDescendantNodes`,(e,t)=>{let n=this.resolveNode(e);if(!n)return[];let r=[];return visit(n,{getChildren:this.getNodeChildren,onEnter:(e,n)=>{n.length!==0&&(!t?.withBranch&&this.isBranchNode(e)||r.push(e))}}),r}),__publicField(this,`getDescendantValues`,(e,t)=>this.getDescendantNodes(e,t).map(e=>this.getNodeValue(e))),__publicField(this,`getParentIndexPath`,e=>e.slice(0,-1)),__publicField(this,`getParentNode`,e=>{let t=this.resolveIndexPath(e);return t?this.at(this.getParentIndexPath(t)):void 0}),__publicField(this,`visit`,e=>{let{skip:t,...n}=e;visit(this.rootNode,{...n,getChildren:this.getNodeChildren,onEnter:(e,r)=>{if(!this.isRootNode(e))return t?.({value:this.getNodeValue(e),node:e,indexPath:r})?`skip`:n.onEnter?.(e,r)}})}),__publicField(this,`getPreviousSibling`,e=>{let t=this.getParentNode(e);if(!t)return;let n=this.getNodeChildren(t),r=e[e.length-1];for(;--r>=0;){let e=n[r];if(!this.getNodeDisabled(e))return e}}),__publicField(this,`getNextSibling`,e=>{let t=this.getParentNode(e);if(!t)return;let n=this.getNodeChildren(t),r=e[e.length-1];for(;++r<n.length;){let e=n[r];if(!this.getNodeDisabled(e))return e}}),__publicField(this,`getSiblingNodes`,e=>{let t=this.getParentNode(e);return t?this.getNodeChildren(t):[]}),__publicField(this,`getValues`,(e=this.rootNode)=>flatMap(e,{getChildren:this.getNodeChildren,transform:e=>[this.getNodeValue(e)]}).slice(1)),__publicField(this,`isValidDepth`,(e,t)=>t==null?!0:typeof t==`function`?t(e.length):e.length===t),__publicField(this,`isBranchNode`,e=>this.getNodeChildren(e).length>0||this.getNodeChildrenCount(e)!=null),__publicField(this,`getBranchValues`,(e=this.rootNode,t={})=>{let n=[];return visit(e,{getChildren:this.getNodeChildren,onEnter:(e,r)=>{if(r.length===0)return;let i=this.getNodeValue(e);if(t.skip?.({value:i,node:e,indexPath:r}))return`skip`;this.isBranchNode(e)&&this.isValidDepth(r,t.depth)&&n.push(this.getNodeValue(e))}}),n}),__publicField(this,`flatten`,(e=this.rootNode)=>flatten(e,{getChildren:this.getNodeChildren})),__publicField(this,`_create`,(e,t)=>this.getNodeChildren(e).length>0||t.length>0?{...e,children:t}:{...e}),__publicField(this,`_insert`,(e,t,n)=>this.copy(insert2(e,{at:t,nodes:n,getChildren:this.getNodeChildren,create:this._create}))),__publicField(this,`copy`,e=>new _TreeCollection({...this.options,rootNode:e})),__publicField(this,`_replace`,(e,t,n)=>this.copy(replace(e,{at:t,node:n,getChildren:this.getNodeChildren,create:this._create}))),__publicField(this,`_move`,(e,t,n)=>this.copy(move2(e,{indexPaths:t,to:n,getChildren:this.getNodeChildren,create:this._create}))),__publicField(this,`_remove`,(e,t)=>this.copy(remove(e,{indexPaths:t,getChildren:this.getNodeChildren,create:this._create}))),__publicField(this,`replace`,(e,t)=>this._replace(this.rootNode,e,t)),__publicField(this,`remove`,e=>this._remove(this.rootNode,e)),__publicField(this,`insertBefore`,(e,t)=>this.getParentNode(e)?this._insert(this.rootNode,e,t):void 0),__publicField(this,`insertAfter`,(e,t)=>{if(!this.getParentNode(e))return;let n=[...e.slice(0,-1),e[e.length-1]+1];return this._insert(this.rootNode,n,t)}),__publicField(this,`move`,(e,t)=>this._move(this.rootNode,e,t)),__publicField(this,`filter`,e=>{let t=filter(this.rootNode,{predicate:e,getChildren:this.getNodeChildren,create:this._create});return this.copy(t)}),__publicField(this,`toJSON`,()=>this.getValues(this.rootNode)),this.rootNode=e.rootNode}},p={nodeToValue(e){return typeof e==`string`?e:isObject(e)&&hasProp(e,`value`)?e.value:``},nodeToString(e){return typeof e==`string`?e:isObject(e)&&hasProp(e,`label`)?e.label:p.nodeToValue(e)},isNodeDisabled(e){return isObject(e)&&hasProp(e,`disabled`)?!!e.disabled:!1},nodeToChildren(e){return e.children},nodeToChildrenCount(e){if(isObject(e)&&hasProp(e,`childrenCount`))return e.childrenCount}};export{t as _,compact as a,warn as b,ensure as c,isArray as d,isEqual as f,partition as g,last as h,callAll as i,first as l,isString as m,add as n,createSplitProps as o,isFunction as p,addOrRemove as r,diff as s,f as t,identity as u,toArray as v,uniq as y};
1
+ function e(e){return e==null?[]:Array.isArray(e)?e:[e]}var t=e=>e[0],n=e=>e[e.length-1],r=(e,t)=>e.indexOf(t)!==-1,i=(e,...t)=>e.concat(t),a=(e,...t)=>e.filter(e=>!t.includes(e)),o=e=>Array.from(new Set(e)),s=(e,t)=>{let n=new Set(t);return e.filter(e=>!n.has(e))},c=(e,t)=>r(e,t)?a(e,t):i(e,t);function l(e,t){return e.reduce(([e,n],r)=>(t(r)?e.push(r):n.push(r),[e,n]),[[],[]])}var u=e=>e?.constructor.name===`Array`,d=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!f(e[n],t[n]))return!1;return!0},f=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof e?.isEqual==`function`&&typeof t?.isEqual==`function`)return e.isEqual(t);if(typeof e==`function`&&typeof t==`function`)return e.toString()===t.toString();if(u(e)&&u(t))return d(Array.from(e),Array.from(t));if(typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(t??Object.create(null)),r=n.length;for(let t=0;t<r;t++)if(!Reflect.has(e,n[t]))return!1;for(let i=0;i<r;i++){let r=n[i];if(!f(e[r],t[r]))return!1}return!0},p=e=>Array.isArray(e),m=e=>typeof e==`object`&&!!e,h=e=>m(e)&&!p(e),g=e=>typeof e==`string`,_=e=>typeof e==`function`,v=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),y=e=>Object.prototype.toString.call(e),b=Function.prototype.toString,x=b.call(Object),S=e=>{if(!m(e)||y(e)!=`[object Object]`||te(e))return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let n=v(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&b.call(n)==x},C=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&`props`in e,ee=e=>typeof e==`object`&&!!e&&`__v_isVNode`in e,te=e=>C(e)||ee(e),ne=e=>e(),re=(...e)=>(...t)=>{e.forEach(function(e){e?.(...t)})},{floor:ie,abs:ae,round:oe,min:se,max:ce,pow:le,sign:ue}=Math;function w(e){if(!S(e)||e===void 0)return e;let t=Reflect.ownKeys(e).filter(e=>typeof e==`string`),n={};for(let r of t){let t=e[r];t!==void 0&&(n[r]=w(t))}return n}function T(e,t){let n={},r={},i=new Set(t),a=Reflect.ownKeys(e);for(let t of a)i.has(t)?r[t]=e[t]:n[t]=e[t];return[r,n]}var E=e=>function(t){return T(t,e)};function D(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function O(e,t){if(e==null)throw Error(t())}var k=Object.defineProperty,A=(e,t,n)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t,n)=>A(e,typeof t==`symbol`?t:t+``,n);function M(e,t,n){for(let r=0;r<t.length;r++)e=n.getChildren(e,t.slice(r+1))[t[r]];return e}function N(e){let t=F(e),n=[],r=new Set;for(let e of t){let t=e.join();r.has(t)||(r.add(t),n.push(e))}return n}function P(e,t){for(let n=0;n<Math.min(e.length,t.length);n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return e.length-t.length}function F(e){return e.sort(P)}function I(e,t){let n;return Z(e,{...t,onEnter:(e,r)=>{if(t.predicate(e,r))return n=e,`stop`}}),n}function de(e,t){let n=[];return Z(e,{onEnter:(e,r)=>{t.predicate(e,r)&&n.push(e)},getChildren:t.getChildren}),n}function L(e,t){let n;return Z(e,{onEnter:(e,r)=>{if(t.predicate(e,r))return n=[...r],`stop`},getChildren:t.getChildren}),n}function R(e,t){let n=t.initialResult;return Z(e,{...t,onEnter:(e,r)=>{n=t.nextResult(n,e,r)}}),n}function z(e,t){return R(e,{...t,initialResult:[],nextResult:(e,n,r)=>(e.push(...t.transform(n,r)),e)})}function B(e,t){let{predicate:n,create:r,getChildren:i}=t,a=(e,t)=>{let o=i(e,t),s=[];o.forEach((e,n)=>{let r=a(e,[...t,n]);r&&s.push(r)});let c=t.length===0,l=n(e,t),u=s.length>0;return c||l||u?r(e,s,t):null};return a(e,[])||r(e,[],[])}function V(e,t){let n=[],r=0,i=new Map,a=new Map;return Z(e,{getChildren:t.getChildren,onEnter:(e,o)=>{i.has(e)||i.set(e,r++);let s=t.getChildren(e,o);s.forEach(t=>{a.has(t)||a.set(t,e),i.has(t)||i.set(t,r++)});let c=s.length>0?s.map(e=>i.get(e)):void 0,l=a.get(e),u=l?i.get(l):void 0,d=i.get(e);n.push({...e,_children:c,_parent:u,_index:d})}}),n}function H(e,t){return{type:`insert`,index:e,nodes:t}}function U(e){return{type:`remove`,indexes:e}}function W(){return{type:`replace`}}function G(e){return[e.slice(0,-1),e[e.length-1]]}function K(e,t,n=new Map){let[r,i]=G(e);for(let e=r.length-1;e>=0;e--){let t=r.slice(0,e).join();switch(n.get(t)?.type){case`remove`:continue}n.set(t,W())}let a=n.get(r.join());switch(a?.type){case`remove`:n.set(r.join(),{type:`removeThenInsert`,removeIndexes:a.indexes,insertIndex:i,insertNodes:t});break;default:n.set(r.join(),H(i,t))}return n}function q(e){let t=new Map,n=new Map;for(let t of e){let e=t.slice(0,-1).join(),r=n.get(e)??[];r.push(t[t.length-1]),n.set(e,r.sort((e,t)=>e-t))}for(let n of e)for(let e=n.length-2;e>=0;e--){let r=n.slice(0,e).join();t.has(r)||t.set(r,W())}for(let[e,r]of n)t.set(e,U(r));return t}function fe(e,t){let n=new Map,[r,i]=G(e);for(let e=r.length-1;e>=0;e--){let t=r.slice(0,e).join();n.set(t,W())}return n.set(r.join(),{type:`removeThenInsert`,removeIndexes:[i],insertIndex:i,insertNodes:[t]}),n}function J(e,t,n){return X(e,{...n,getChildren:(e,r)=>{let i=r.join();switch(t.get(i)?.type){case`replace`:case`remove`:case`removeThenInsert`:case`insert`:return n.getChildren(e,r);default:return[]}},transform:(e,r,i)=>{let a=i.join(),o=t.get(a);switch(o?.type){case`remove`:return n.create(e,r.filter((e,t)=>!o.indexes.includes(t)),i);case`removeThenInsert`:let t=r.filter((e,t)=>!o.removeIndexes.includes(t)),a=o.removeIndexes.reduce((e,t)=>t<e?e-1:e,o.insertIndex);return n.create(e,Y(t,a,0,...o.insertNodes),i);case`insert`:return n.create(e,Y(r,o.index,0,...o.nodes),i);case`replace`:return n.create(e,r,i);default:return e}}})}function Y(e,t,n,...r){return[...e.slice(0,t),...r,...e.slice(t+n)]}function X(e,t){let n={};return Z(e,{...t,onLeave:(e,r)=>{let i=[0,...r],a=i.join(),o=t.transform(e,n[a]??[],r),s=i.slice(0,-1).join(),c=n[s]??[];c.push(o),n[s]=c}}),n[``][0]}function pe(e,t){let{nodes:n,at:r}=t;if(r.length===0)throw Error(`Can't insert nodes at the root`);return J(e,K(r,n),t)}function me(e,t){return t.at.length===0?t.node:J(e,fe(t.at,t.node),t)}function he(e,t){if(t.indexPaths.length===0)return e;for(let e of t.indexPaths)if(e.length===0)throw Error(`Can't remove the root node`);return J(e,q(t.indexPaths),t)}function ge(e,t){if(t.indexPaths.length===0)return e;for(let e of t.indexPaths)if(e.length===0)throw Error(`Can't move the root node`);if(t.to.length===0)throw Error(`Can't move nodes to the root`);let n=N(t.indexPaths),r=n.map(n=>M(e,n,t));return J(e,K(t.to,r,q(n)),t)}function Z(e,t){let{onEnter:n,onLeave:r,getChildren:i}=t,a=[],o=[{node:e}],s=t.reuseIndexPath?()=>a:()=>a.slice();for(;o.length>0;){let e=o[o.length-1];if(e.state===void 0){let t=n?.(e.node,s());if(t===`stop`)return;e.state=t===`skip`?-1:0}let t=e.children||i(e.node,s());if(e.children||=t,e.state!==-1){if(e.state<t.length){let n=e.state;a.push(n),o.push({node:t[n]}),e.state=n+1;continue}if(r?.(e.node,s())===`stop`)return}a.pop(),o.pop()}}var Q=class e{constructor(t){this.options=t,j(this,`rootNode`),j(this,`isEqual`,e=>f(this.rootNode,e.rootNode)),j(this,`getNodeChildren`,e=>this.options.nodeToChildren?.(e)??$.nodeToChildren(e)??[]),j(this,`resolveIndexPath`,e=>typeof e==`string`?this.getIndexPath(e):e),j(this,`resolveNode`,e=>{let t=this.resolveIndexPath(e);return t?this.at(t):void 0}),j(this,`getNodeChildrenCount`,e=>this.options.nodeToChildrenCount?.(e)??$.nodeToChildrenCount(e)),j(this,`getNodeValue`,e=>this.options.nodeToValue?.(e)??$.nodeToValue(e)),j(this,`getNodeDisabled`,e=>this.options.isNodeDisabled?.(e)??$.isNodeDisabled(e)),j(this,`stringify`,e=>{let t=this.findNode(e);return t?this.stringifyNode(t):null}),j(this,`stringifyNode`,e=>this.options.nodeToString?.(e)??$.nodeToString(e)),j(this,`getFirstNode`,(e=this.rootNode,t={})=>{let n;return Z(e,{getChildren:this.getNodeChildren,onEnter:(r,i)=>{if(!this.isSameNode(r,e)){if(t.skip?.({value:this.getNodeValue(r),node:r,indexPath:i}))return`skip`;if(!n&&i.length>0&&!this.getNodeDisabled(r))return n=r,`stop`}}}),n}),j(this,`getLastNode`,(e=this.rootNode,t={})=>{let n;return Z(e,{getChildren:this.getNodeChildren,onEnter:(r,i)=>{if(!this.isSameNode(r,e)){if(t.skip?.({value:this.getNodeValue(r),node:r,indexPath:i}))return`skip`;i.length>0&&!this.getNodeDisabled(r)&&(n=r)}}}),n}),j(this,`at`,e=>M(this.rootNode,e,{getChildren:this.getNodeChildren})),j(this,`findNode`,(e,t=this.rootNode)=>I(t,{getChildren:this.getNodeChildren,predicate:t=>this.getNodeValue(t)===e})),j(this,`findNodes`,(e,t=this.rootNode)=>{let n=new Set(e.filter(e=>e!=null));return de(t,{getChildren:this.getNodeChildren,predicate:e=>n.has(this.getNodeValue(e))})}),j(this,`sort`,e=>e.reduce((e,t)=>{let n=this.getIndexPath(t);return n&&e.push({value:t,indexPath:n}),e},[]).sort((e,t)=>P(e.indexPath,t.indexPath)).map(({value:e})=>e)),j(this,`getIndexPath`,e=>L(this.rootNode,{getChildren:this.getNodeChildren,predicate:t=>this.getNodeValue(t)===e})),j(this,`getValue`,e=>{let t=this.at(e);return t?this.getNodeValue(t):void 0}),j(this,`getValuePath`,e=>{if(!e)return[];let t=[],n=[...e];for(;n.length>0;){let e=this.at(n);e&&t.unshift(this.getNodeValue(e)),n.pop()}return t}),j(this,`getDepth`,e=>L(this.rootNode,{getChildren:this.getNodeChildren,predicate:t=>this.getNodeValue(t)===e})?.length??0),j(this,`isSameNode`,(e,t)=>this.getNodeValue(e)===this.getNodeValue(t)),j(this,`isRootNode`,e=>this.isSameNode(e,this.rootNode)),j(this,`contains`,(e,t)=>!e||!t?!1:t.slice(0,e.length).every((n,r)=>e[r]===t[r])),j(this,`getNextNode`,(e,t={})=>{let n=!1,r;return Z(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(i,a)=>{if(this.isRootNode(i))return;let o=this.getNodeValue(i);if(t.skip?.({value:o,node:i,indexPath:a}))return o===e&&(n=!0),`skip`;if(n&&!this.getNodeDisabled(i))return r=i,`stop`;o===e&&(n=!0)}}),r}),j(this,`getPreviousNode`,(e,t={})=>{let n,r=!1;return Z(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(i,a)=>{if(this.isRootNode(i))return;let o=this.getNodeValue(i);if(t.skip?.({value:o,node:i,indexPath:a}))return`skip`;if(o===e)return r=!0,`stop`;this.getNodeDisabled(i)||(n=i)}}),r?n:void 0}),j(this,`getParentNodes`,e=>{let t=this.resolveIndexPath(e)?.slice();if(!t)return[];let n=[];for(;t.length>0;){t.pop();let e=this.at(t);e&&!this.isRootNode(e)&&n.unshift(e)}return n}),j(this,`getDescendantNodes`,(e,t)=>{let n=this.resolveNode(e);if(!n)return[];let r=[];return Z(n,{getChildren:this.getNodeChildren,onEnter:(e,n)=>{n.length!==0&&(!t?.withBranch&&this.isBranchNode(e)||r.push(e))}}),r}),j(this,`getDescendantValues`,(e,t)=>this.getDescendantNodes(e,t).map(e=>this.getNodeValue(e))),j(this,`getParentIndexPath`,e=>e.slice(0,-1)),j(this,`getParentNode`,e=>{let t=this.resolveIndexPath(e);return t?this.at(this.getParentIndexPath(t)):void 0}),j(this,`visit`,e=>{let{skip:t,...n}=e;Z(this.rootNode,{...n,getChildren:this.getNodeChildren,onEnter:(e,r)=>{if(!this.isRootNode(e))return t?.({value:this.getNodeValue(e),node:e,indexPath:r})?`skip`:n.onEnter?.(e,r)}})}),j(this,`getPreviousSibling`,e=>{let t=this.getParentNode(e);if(!t)return;let n=this.getNodeChildren(t),r=e[e.length-1];for(;--r>=0;){let e=n[r];if(!this.getNodeDisabled(e))return e}}),j(this,`getNextSibling`,e=>{let t=this.getParentNode(e);if(!t)return;let n=this.getNodeChildren(t),r=e[e.length-1];for(;++r<n.length;){let e=n[r];if(!this.getNodeDisabled(e))return e}}),j(this,`getSiblingNodes`,e=>{let t=this.getParentNode(e);return t?this.getNodeChildren(t):[]}),j(this,`getValues`,(e=this.rootNode)=>z(e,{getChildren:this.getNodeChildren,transform:e=>[this.getNodeValue(e)]}).slice(1)),j(this,`isValidDepth`,(e,t)=>t==null?!0:typeof t==`function`?t(e.length):e.length===t),j(this,`isBranchNode`,e=>this.getNodeChildren(e).length>0||this.getNodeChildrenCount(e)!=null),j(this,`getBranchValues`,(e=this.rootNode,t={})=>{let n=[];return Z(e,{getChildren:this.getNodeChildren,onEnter:(e,r)=>{if(r.length===0)return;let i=this.getNodeValue(e);if(t.skip?.({value:i,node:e,indexPath:r}))return`skip`;this.isBranchNode(e)&&this.isValidDepth(r,t.depth)&&n.push(this.getNodeValue(e))}}),n}),j(this,`flatten`,(e=this.rootNode)=>V(e,{getChildren:this.getNodeChildren})),j(this,`_create`,(e,t)=>this.getNodeChildren(e).length>0||t.length>0?{...e,children:t}:{...e}),j(this,`_insert`,(e,t,n)=>this.copy(pe(e,{at:t,nodes:n,getChildren:this.getNodeChildren,create:this._create}))),j(this,`copy`,t=>new e({...this.options,rootNode:t})),j(this,`_replace`,(e,t,n)=>this.copy(me(e,{at:t,node:n,getChildren:this.getNodeChildren,create:this._create}))),j(this,`_move`,(e,t,n)=>this.copy(ge(e,{indexPaths:t,to:n,getChildren:this.getNodeChildren,create:this._create}))),j(this,`_remove`,(e,t)=>this.copy(he(e,{indexPaths:t,getChildren:this.getNodeChildren,create:this._create}))),j(this,`replace`,(e,t)=>this._replace(this.rootNode,e,t)),j(this,`remove`,e=>this._remove(this.rootNode,e)),j(this,`insertBefore`,(e,t)=>this.getParentNode(e)?this._insert(this.rootNode,e,t):void 0),j(this,`insertAfter`,(e,t)=>{if(!this.getParentNode(e))return;let n=[...e.slice(0,-1),e[e.length-1]+1];return this._insert(this.rootNode,n,t)}),j(this,`move`,(e,t)=>this._move(this.rootNode,e,t)),j(this,`filter`,e=>{let t=B(this.rootNode,{predicate:e,getChildren:this.getNodeChildren,create:this._create});return this.copy(t)}),j(this,`toJSON`,()=>this.getValues(this.rootNode)),this.rootNode=t.rootNode}},$={nodeToValue(e){return typeof e==`string`?e:h(e)&&v(e,`value`)?e.value:``},nodeToString(e){return typeof e==`string`?e:h(e)&&v(e,`label`)?e.label:$.nodeToValue(e)},isNodeDisabled(e){return h(e)&&v(e,`disabled`)?!!e.disabled:!1},nodeToChildren(e){return e.children},nodeToChildrenCount(e){if(h(e)&&v(e,`childrenCount`))return e.childrenCount}};export{a as _,w as a,D as b,O as c,p as d,f,l as g,n as h,re as i,t as l,g as m,i as n,E as o,_ as p,c as r,s,Q as t,ne as u,e as v,o as y};
@@ -1 +1 @@
1
- import"../../rolldown-runtime.mjs";import{i as e,m as t}from"./collection.mjs";var n=Object.defineProperty,__defNormalProp=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__publicField=(e,t,n)=>__defNormalProp(e,typeof t==`symbol`?t:t+``,n),wrap=(e,t)=>e.map((n,r)=>e[(Math.max(t,0)+r)%e.length]),isObject=e=>typeof e==`object`&&!!e,dataAttr=e=>e?``:void 0,ariaAttr=e=>e?`true`:void 0,r=1,i=9,a=11,isHTMLElement=e=>isObject(e)&&e.nodeType===r&&typeof e.nodeName==`string`,isDocument=e=>isObject(e)&&e.nodeType===i,isWindow=e=>isObject(e)&&e===e.window,isNode=e=>isObject(e)&&e.nodeType!==void 0,isShadowRoot=e=>isNode(e)&&e.nodeType===a&&`host`in e,isInputElement=e=>isHTMLElement(e)&&e.localName===`input`,isAnchorElement=e=>!!e?.matches(`a[href]`);function isActiveElement(e){return e?getActiveElement(e.getRootNode())===e:!1}var o=/(textarea|select)/;function isEditableElement(e){if(e==null||!isHTMLElement(e))return!1;try{return isInputElement(e)&&e.selectionStart!=null||o.test(e.localName)||e.isContentEditable||e.getAttribute(`contenteditable`)===`true`||e.getAttribute(`contenteditable`)===``}catch{return!1}}function getDocument(e){return isDocument(e)?e:isWindow(e)?e.document:e?.ownerDocument??document}function getWindow(e){return isShadowRoot(e)?getWindow(e.host):isDocument(e)?e.defaultView??window:isHTMLElement(e)?e.ownerDocument?.defaultView??window:window}function getActiveElement(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(!e||e===t)break;t=e}return t}function getComposedPath(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function getEventTarget(e){return getComposedPath(e)?.[0]??e.target}function isComposingEvent(e){return getNativeEvent(e).isComposing||e.keyCode===229}var isLeftClick=e=>e.button===0,isModifierKey=e=>e.ctrlKey||e.altKey||e.metaKey,s={Up:`ArrowUp`,Down:`ArrowDown`,Esc:`Escape`," ":`Space`,",":`Comma`,Left:`ArrowLeft`,Right:`ArrowRight`},c={ArrowLeft:`ArrowRight`,ArrowRight:`ArrowLeft`};function getEventKey(e,t={}){let{dir:n=`ltr`,orientation:r=`horizontal`}=t,i=e.key;return i=s[i]??i,n===`rtl`&&r===`horizontal`&&i in c&&(i=c[i]),i}function getNativeEvent(e){return e.nativeEvent??e}function getDescriptor(e,t){let{type:n=`HTMLInputElement`,property:r=`value`}=t,i=getWindow(e)[n].prototype;return Object.getOwnPropertyDescriptor(i,r)??{}}function getElementType(e){if(e.localName===`input`)return`HTMLInputElement`;if(e.localName===`textarea`)return`HTMLTextAreaElement`;if(e.localName===`select`)return`HTMLSelectElement`}function setElementValue(e,t,n=`value`){if(!e)return;let r=getElementType(e);r&&getDescriptor(e,{type:r,property:n}).set?.call(e,t),e.setAttribute(n,t)}var l=class _AnimationFrame{constructor(){__publicField(this,`id`,null),__publicField(this,`fn_cleanup`),__publicField(this,`cleanup`,()=>{this.cancel()})}static create(){return new _AnimationFrame}request(e){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=e?.()})}cancel(){this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),this.fn_cleanup?.(),this.fn_cleanup=void 0}isActive(){return this.id!==null}};function raf(e){let t=l.create();return t.request(e),t.cleanup}var defaultItemToId=e=>e.id;function itemById(e,t,n=defaultItemToId){return e.find(e=>n(e)===t)}function indexOfId(e,t,n=defaultItemToId){let r=itemById(e,t,n);return r?e.indexOf(r):-1}var sanitize=e=>e.split(``).map(e=>{let t=e.charCodeAt(0);return t>0&&t<128?e:t>=128&&t<=255?`/x${t.toString(16)}`.replace(`/`,`\\`):``}).join(``).trim(),getValueText=e=>sanitize(e.dataset?.valuetext??e.textContent??``),match=(e,t)=>e.trim().toLowerCase().startsWith(t.toLowerCase());function getByText(e,t,n,r=defaultItemToId){let i=n?indexOfId(e,n,r):-1,a=n?wrap(e,i):e;return t.length===1&&(a=a.filter(e=>r(e)!==n)),a.find(e=>match(getValueText(e),t))}function getByTypeaheadImpl(e,t){let{state:n,activeId:r,key:i,timeout:a=350,itemToId:o}=t,s=n.keysSoFar+i,c=s.length>1&&Array.from(s).every(e=>e===s[0])?s[0]:s,l=getByText(e.slice(),c,r,o);function cleanup(){clearTimeout(n.timer),n.timer=-1}function update(e){n.keysSoFar=e,cleanup(),e!==``&&(n.timer=+setTimeout(()=>{update(``),cleanup()},a))}return update(s),l}var u=Object.assign(getByTypeaheadImpl,{defaultOptions:{keysSoFar:``,timer:-1},isValidEvent:isValidTypeaheadEvent});function isValidTypeaheadEvent(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var clsx=(...e)=>e.map(e=>e?.trim?.()).filter(Boolean).join(` `),d=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,serialize=e=>{let t={},n;for(;n=d.exec(e);)t[n[1]]=n[2];return t},css=(e,n)=>{if(t(e)){if(t(n))return`${e};${n}`;e=serialize(e)}else t(n)&&(n=serialize(n));return Object.assign({},e??{},n??{})};function mergeProps(...t){let n={};for(let r of t){if(!r)continue;for(let t in n){if(t.startsWith(`on`)&&typeof n[t]==`function`&&typeof r[t]==`function`){n[t]=e(r[t],n[t]);continue}if(t===`className`||t===`class`){n[t]=clsx(n[t],r[t]);continue}if(t===`style`){n[t]=css(n[t],r[t]);continue}n[t]=r[t]===void 0?n[t]:r[t]}for(let e in r)n[e]===void 0&&(n[e]=r[e]);let t=Object.getOwnPropertySymbols(r);for(let e of t)n[e]=r[e]}return n}function createGuards(){return{and:(...e)=>function andGuard(t){return e.every(e=>t.guard(e))},or:(...e)=>function orGuard(t){return e.some(e=>t.guard(e))},not:e=>function notGuard(t){return!t.guard(e)}}}function createMachine(e){return e}var f=(e=>(e.NotStarted=`Not Started`,e.Started=`Started`,e.Stopped=`Stopped`,e))(f||{}),p=`__init__`;function createScope(e){let getRootNode=()=>e.getRootNode?.()??document,getDoc=()=>getDocument(getRootNode()),getWin=()=>getDoc().defaultView??window,getActiveElementFn=()=>getActiveElement(getRootNode()),getById=e=>getRootNode().getElementById(e);return{...e,getRootNode,getDoc,getWin,getActiveElement:getActiveElementFn,isActiveElement,getById}}export{raf as _,createScope as a,dataAttr as c,getEventTarget as d,isAnchorElement as f,isModifierKey as g,isLeftClick as h,createMachine as i,u as l,isEditableElement as m,f as n,mergeProps as o,isComposingEvent as p,createGuards as r,ariaAttr as s,p as t,getEventKey as u,setElementValue as v};
1
+ import{i as e,m as t}from"./collection.mjs";var n=Object.defineProperty,r=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t,n)=>r(e,typeof t==`symbol`?t:t+``,n),a=(e,t)=>e.map((n,r)=>e[(Math.max(t,0)+r)%e.length]),o=e=>typeof e==`object`&&!!e,s=e=>e?``:void 0,c=e=>e?`true`:void 0,l=1,u=9,d=11,f=e=>o(e)&&e.nodeType===l&&typeof e.nodeName==`string`,p=e=>o(e)&&e.nodeType===u,m=e=>o(e)&&e===e.window,h=e=>o(e)&&e.nodeType!==void 0,g=e=>h(e)&&e.nodeType===d&&`host`in e,_=e=>f(e)&&e.localName===`input`,v=e=>!!e?.matches(`a[href]`);function y(e){return e?C(e.getRootNode())===e:!1}var ee=/(textarea|select)/;function b(e){if(e==null||!f(e))return!1;try{return _(e)&&e.selectionStart!=null||ee.test(e.localName)||e.isContentEditable||e.getAttribute(`contenteditable`)===`true`||e.getAttribute(`contenteditable`)===``}catch{return!1}}function x(e){return p(e)?e:m(e)?e.document:e?.ownerDocument??document}function S(e){return g(e)?S(e.host):p(e)?e.defaultView??window:f(e)?e.ownerDocument?.defaultView??window:window}function C(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(!e||e===t)break;t=e}return t}function w(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function T(e){return w(e)?.[0]??e.target}function E(e){return M(e).isComposing||e.keyCode===229}var D=e=>e.button===0,O=e=>e.ctrlKey||e.altKey||e.metaKey,k={Up:`ArrowUp`,Down:`ArrowDown`,Esc:`Escape`," ":`Space`,",":`Comma`,Left:`ArrowLeft`,Right:`ArrowRight`},A={ArrowLeft:`ArrowRight`,ArrowRight:`ArrowLeft`};function j(e,t={}){let{dir:n=`ltr`,orientation:r=`horizontal`}=t,i=e.key;return i=k[i]??i,n===`rtl`&&r===`horizontal`&&i in A&&(i=A[i]),i}function M(e){return e.nativeEvent??e}function N(e,t){let{type:n=`HTMLInputElement`,property:r=`value`}=t,i=S(e)[n].prototype;return Object.getOwnPropertyDescriptor(i,r)??{}}function P(e){if(e.localName===`input`)return`HTMLInputElement`;if(e.localName===`textarea`)return`HTMLTextAreaElement`;if(e.localName===`select`)return`HTMLSelectElement`}function F(e,t,n=`value`){if(!e)return;let r=P(e);r&&N(e,{type:r,property:n}).set?.call(e,t),e.setAttribute(n,t)}var te=class e{constructor(){i(this,`id`,null),i(this,`fn_cleanup`),i(this,`cleanup`,()=>{this.cancel()})}static create(){return new e}request(e){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=e?.()})}cancel(){this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),this.fn_cleanup?.(),this.fn_cleanup=void 0}isActive(){return this.id!==null}};function I(e){let t=te.create();return t.request(e),t.cleanup}var L=e=>e.id;function R(e,t,n=L){return e.find(e=>n(e)===t)}function z(e,t,n=L){let r=R(e,t,n);return r?e.indexOf(r):-1}var B=e=>e.split(``).map(e=>{let t=e.charCodeAt(0);return t>0&&t<128?e:t>=128&&t<=255?`/x${t.toString(16)}`.replace(`/`,`\\`):``}).join(``).trim(),V=e=>B(e.dataset?.valuetext??e.textContent??``),H=(e,t)=>e.trim().toLowerCase().startsWith(t.toLowerCase());function U(e,t,n,r=L){let i=n?z(e,n,r):-1,o=n?a(e,i):e;return t.length===1&&(o=o.filter(e=>r(e)!==n)),o.find(e=>H(V(e),t))}function W(e,t){let{state:n,activeId:r,key:i,timeout:a=350,itemToId:o}=t,s=n.keysSoFar+i,c=s.length>1&&Array.from(s).every(e=>e===s[0])?s[0]:s,l=U(e.slice(),c,r,o);function u(){clearTimeout(n.timer),n.timer=-1}function d(e){n.keysSoFar=e,u(),e!==``&&(n.timer=+setTimeout(()=>{d(``),u()},a))}return d(s),l}var G=Object.assign(W,{defaultOptions:{keysSoFar:``,timer:-1},isValidEvent:K});function K(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var q=(...e)=>e.map(e=>e?.trim?.()).filter(Boolean).join(` `),J=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,Y=e=>{let t={},n;for(;n=J.exec(e);)t[n[1]]=n[2];return t},X=(e,n)=>{if(t(e)){if(t(n))return`${e};${n}`;e=Y(e)}else t(n)&&(n=Y(n));return Object.assign({},e??{},n??{})};function Z(...t){let n={};for(let r of t){if(!r)continue;for(let t in n){if(t.startsWith(`on`)&&typeof n[t]==`function`&&typeof r[t]==`function`){n[t]=e(r[t],n[t]);continue}if(t===`className`||t===`class`){n[t]=q(n[t],r[t]);continue}if(t===`style`){n[t]=X(n[t],r[t]);continue}n[t]=r[t]===void 0?n[t]:r[t]}for(let e in r)n[e]===void 0&&(n[e]=r[e]);let t=Object.getOwnPropertySymbols(r);for(let e of t)n[e]=r[e]}return n}function Q(){return{and:(...e)=>function(t){return e.every(e=>t.guard(e))},or:(...e)=>function(t){return e.some(e=>t.guard(e))},not:e=>function(t){return!t.guard(e)}}}function ne(e){return e}var $=(e=>(e.NotStarted=`Not Started`,e.Started=`Started`,e.Stopped=`Stopped`,e))($||{}),re=`__init__`;function ie(e){let t=()=>e.getRootNode?.()??document,n=()=>x(t()),r=()=>n().defaultView??window,i=()=>C(t()),a=e=>t().getElementById(e);return{...e,getRootNode:t,getDoc:n,getWin:r,getActiveElement:i,isActiveElement:y,getById:a}}export{I as _,ie as a,s as c,T as d,v as f,O as g,D as h,ne as i,G as l,b as m,$ as n,Z as o,E as p,Q as r,c as s,re as t,j as u,F as v};
@@ -1 +1 @@
1
- import"../../rolldown-runtime.mjs";import{a as e,b as t,c as n,m as r,p as i,u as a,v as o}from"./collection.mjs";import{a as s,n as c,t as l}from"./core.mjs";import{useEffect as u,useLayoutEffect as d,useMemo as f,useRef as p,useState as m}from"react";import"react/jsx-runtime";import{flushSync as h}from"react-dom";function createNormalizer(e){return new Proxy({},{get(t,n){return n===`style`?t=>e({style:t}).style:e}})}var createProps=()=>e=>Array.from(new Set(e)),g=globalThis.document===void 0?u:d;function useBindable(e){let t=e().value??e().defaultValue,n=e().isEqual??Object.is,[r]=m(t),[o,s]=m(r),c=e().value!==void 0,l=p(o);l.current=c?e().value:o;let u=p(l.current);g(()=>{u.current=l.current},[o,e().value]);let setFn=t=>{let r=u.current,a=i(t)?t(r):t;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:a,prev:r}),c||s(a),n(a,r)||e().onChange?.(a,r)};function get(){return c?e().value:o}return{initial:r,ref:l,get,set(t){(e().sync?h:a)(()=>setFn(t))},invoke(t,n){e().onChange?.(t,n)},hash(t){return e().hash?.(t)??String(t)}}}useBindable.cleanup=e=>{u(()=>e,[])},useBindable.ref=e=>{let t=p(e);return{get:()=>t.current,set:e=>{t.current=e}}};function useRefs(e){let t=p(e);return{get(e){return t.current[e]},set(e,n){t.current[e]=n}}}var useTrack=(e,t)=>{let n=p(!1),r=p(!1);u(()=>{if(n.current&&r.current)return t();r.current=!0},[...(e??[]).map(e=>typeof e==`function`?e():e)]),u(()=>(n.current=!0,()=>{n.current=!1}),[])};function useMachine(a,u={}){let d=f(()=>{let{id:e,ids:t,getRootNode:n}=u;return s({id:e,ids:t,getRootNode:n})},[u]),debug=(...e)=>{a.debug&&console.log(...e)},m=useProp(a.props?.({props:e(u),scope:d})??u),_=a.context?.({prop:m,bindable:useBindable,scope:d,flush,getContext(){return y},getComputed(){return computed},getRefs(){return w},getEvent(){return getEvent()}}),v=useLiveRef(_),y={get(e){return v.current?.[e].ref.current},set(e,t){v.current?.[e].set(t)},initial(e){return v.current?.[e].initial},hash(e){let t=v.current?.[e].get();return v.current?.[e].hash(t)}},b=p(new Map),x=p(null),S=p(null),C=p({type:``}),getEvent=()=>({...C.current,current(){return C.current},previous(){return S.current}}),getState=()=>({...T,matches(...e){return e.includes(T.ref.current)},hasTag(e){return!!a.states[T.ref.current]?.tags?.includes(e)}}),w=useRefs(a.refs?.({prop:m,context:y})??{}),getParams=()=>({state:getState(),context:y,event:getEvent(),prop:m,send,action,guard,track:useTrack,refs:w,computed,flush,scope:d,choose}),action=e=>{let n=i(e)?e(getParams()):e;if(!n)return;let r=n.map(e=>{let n=a.implementations?.actions?.[e];return n||t(`[zag-js] No implementation found for action "${JSON.stringify(e)}"`),n});for(let e of r)e?.(getParams())},guard=e=>i(e)?e(getParams()):a.implementations?.guards?.[e](getParams()),effect=e=>{let n=i(e)?e(getParams()):e;if(!n)return;let r=n.map(e=>{let n=a.implementations?.effects?.[e];return n||t(`[zag-js] No implementation found for effect "${JSON.stringify(e)}"`),n}),o=[];for(let e of r){let t=e?.(getParams());t&&o.push(t)}return()=>o.forEach(e=>e?.())},choose=e=>o(e).find(e=>{let t=!e.guard;return r(e.guard)?t=!!guard(e.guard):i(e.guard)&&(t=e.guard(getParams())),t}),computed=e=>{n(a.computed,()=>`[zag-js] No computed object found on machine`);let t=a.computed[e];return t({context:y,event:getEvent(),prop:m,refs:w,scope:d,computed})},T=useBindable(()=>({defaultValue:a.initialState({prop:m}),onChange(e,t){t&&(b.current.get(t)?.(),b.current.delete(t)),t&&action(a.states[t]?.exit),action(x.current?.actions);let n=effect(a.states[e]?.effects);if(n&&b.current.set(e,n),t===`__init__`){action(a.entry);let e=effect(a.effects);e&&b.current.set(l,e)}action(a.states[e]?.entry)}})),E=p(void 0),D=p(c.NotStarted);g(()=>{queueMicrotask(()=>{let e=D.current===c.Started;D.current=c.Started,debug(e?`rehydrating...`:`initializing...`);let t=E.current??T.initial;T.invoke(t,e?T.get():l)});let e=b.current,t=T.ref.current;return()=>{debug(`unmounting...`),E.current=t,D.current=c.Stopped,e.forEach(e=>e?.()),b.current=new Map,x.current=null,queueMicrotask(()=>{action(a.exit)})}},[]);let getCurrentState=()=>`ref`in T?T.ref.current:T.get(),send=e=>{queueMicrotask(()=>{if(D.current!==c.Started)return;S.current=C.current,C.current=e;let t=getCurrentState(),n=choose(a.states[t].on?.[e.type]??a.on?.[e.type]);if(!n)return;x.current=n;let r=n.target??t;debug(`transition`,e.type,n.target||t,`(${n.actions})`);let i=r!==t;i?h(()=>T.set(r)):n.reenter&&!i?T.invoke(t,t):action(n.actions??[])})};return a.watch?.(getParams()),{state:getState(),send,context:y,prop:m,scope:d,refs:w,computed,event:getEvent(),getStatus:()=>D.current}}function useLiveRef(e){let t=p(e);return t.current=e,t}function useProp(e){let t=useLiveRef(e);return function get(e){return t.current[e]}}function flush(e){queueMicrotask(()=>{h(()=>e())})}var _=createNormalizer(e=>e);export{useMachine as n,createProps as r,_ as t};
1
+ import{a as e,b as t,c as n,m as r,p as i,u as a,v as o}from"./collection.mjs";import{a as s,n as c,t as l}from"./core.mjs";import{useEffect as u,useLayoutEffect as d,useMemo as f,useRef as p,useState as m}from"react";import"react/jsx-runtime";import{flushSync as h}from"react-dom";function g(e){return new Proxy({},{get(t,n){return n===`style`?t=>e({style:t}).style:e}})}var _=()=>e=>Array.from(new Set(e)),v=globalThis.document===void 0?u:d;function y(e){let t=e().value??e().defaultValue,n=e().isEqual??Object.is,[r]=m(t),[o,s]=m(r),c=e().value!==void 0,l=p(o);l.current=c?e().value:o;let u=p(l.current);v(()=>{u.current=l.current},[o,e().value]);let d=t=>{let r=u.current,a=i(t)?t(r):t;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:a,prev:r}),c||s(a),n(a,r)||e().onChange?.(a,r)};function f(){return c?e().value:o}return{initial:r,ref:l,get:f,set(t){(e().sync?h:a)(()=>d(t))},invoke(t,n){e().onChange?.(t,n)},hash(t){return e().hash?.(t)??String(t)}}}y.cleanup=e=>{u(()=>e,[])},y.ref=e=>{let t=p(e);return{get:()=>t.current,set:e=>{t.current=e}}};function b(e){let t=p(e);return{get(e){return t.current[e]},set(e,n){t.current[e]=n}}}var x=(e,t)=>{let n=p(!1),r=p(!1);u(()=>{if(n.current&&r.current)return t();r.current=!0},[...(e??[]).map(e=>typeof e==`function`?e():e)]),u(()=>(n.current=!0,()=>{n.current=!1}),[])};function S(a,u={}){let d=f(()=>{let{id:e,ids:t,getRootNode:n}=u;return s({id:e,ids:t,getRootNode:n})},[u]),m=(...e)=>{a.debug&&console.log(...e)},g=w(a.props?.({props:e(u),scope:d})??u),_=a.context?.({prop:g,bindable:y,scope:d,flush:T,getContext(){return E},getComputed(){return z},getRefs(){return N},getEvent(){return j()}}),S=C(_),E={get(e){return S.current?.[e].ref.current},set(e,t){S.current?.[e].set(t)},initial(e){return S.current?.[e].initial},hash(e){let t=S.current?.[e].get();return S.current?.[e].hash(t)}},D=p(new Map),O=p(null),k=p(null),A=p({type:``}),j=()=>({...A.current,current(){return A.current},previous(){return k.current}}),M=()=>({...B,matches(...e){return e.includes(B.ref.current)},hasTag(e){return!!a.states[B.ref.current]?.tags?.includes(e)}}),N=b(a.refs?.({prop:g,context:E})??{}),P=()=>({state:M(),context:E,event:j(),prop:g,send:W,action:F,guard:I,track:x,refs:N,computed:z,flush:T,scope:d,choose:R}),F=e=>{let n=i(e)?e(P()):e;if(!n)return;let r=n.map(e=>{let n=a.implementations?.actions?.[e];return n||t(`[zag-js] No implementation found for action "${JSON.stringify(e)}"`),n});for(let e of r)e?.(P())},I=e=>i(e)?e(P()):a.implementations?.guards?.[e](P()),L=e=>{let n=i(e)?e(P()):e;if(!n)return;let r=n.map(e=>{let n=a.implementations?.effects?.[e];return n||t(`[zag-js] No implementation found for effect "${JSON.stringify(e)}"`),n}),o=[];for(let e of r){let t=e?.(P());t&&o.push(t)}return()=>o.forEach(e=>e?.())},R=e=>o(e).find(e=>{let t=!e.guard;return r(e.guard)?t=!!I(e.guard):i(e.guard)&&(t=e.guard(P())),t}),z=e=>{n(a.computed,()=>`[zag-js] No computed object found on machine`);let t=a.computed[e];return t({context:E,event:j(),prop:g,refs:N,scope:d,computed:z})},B=y(()=>({defaultValue:a.initialState({prop:g}),onChange(e,t){t&&(D.current.get(t)?.(),D.current.delete(t)),t&&F(a.states[t]?.exit),F(O.current?.actions);let n=L(a.states[e]?.effects);if(n&&D.current.set(e,n),t===`__init__`){F(a.entry);let e=L(a.effects);e&&D.current.set(l,e)}F(a.states[e]?.entry)}})),V=p(void 0),H=p(c.NotStarted);v(()=>{queueMicrotask(()=>{let e=H.current===c.Started;H.current=c.Started,m(e?`rehydrating...`:`initializing...`);let t=V.current??B.initial;B.invoke(t,e?B.get():l)});let e=D.current,t=B.ref.current;return()=>{m(`unmounting...`),V.current=t,H.current=c.Stopped,e.forEach(e=>e?.()),D.current=new Map,O.current=null,queueMicrotask(()=>{F(a.exit)})}},[]);let U=()=>`ref`in B?B.ref.current:B.get(),W=e=>{queueMicrotask(()=>{if(H.current!==c.Started)return;k.current=A.current,A.current=e;let t=U(),n=R(a.states[t].on?.[e.type]??a.on?.[e.type]);if(!n)return;O.current=n;let r=n.target??t;m(`transition`,e.type,n.target||t,`(${n.actions})`);let i=r!==t;i?h(()=>B.set(r)):n.reenter&&!i?B.invoke(t,t):F(n.actions??[])})};return a.watch?.(P()),{state:M(),send:W,context:E,prop:g,scope:d,refs:N,computed:z,event:j(),getStatus:()=>H.current}}function C(e){let t=p(e);return t.current=e,t}function w(e){let t=C(e);return function(e){return t.current[e]}}function T(e){queueMicrotask(()=>{h(()=>e())})}var E=g(e=>e);export{S as n,_ as r,E as t};
@@ -1 +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};
1
+ 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(),j=e=>new d(e);j.empty=()=>new d({rootNode:{children:[]}});var M=e=>e.ids?.root??`tree:${e.id}:root`,N=e=>e.ids?.label??`tree:${e.id}:label`,P=(e,t)=>e.ids?.node?.(t)??`tree:${e.id}:node:${t}`,F=e=>e.ids?.tree??`tree:${e.id}:tree`,I=(e,t)=>{t!=null&&e.getById(P(e,t))?.focus()},L=(e,t)=>`tree:${e.id}:rename-input:${t}`,R=(e,t)=>e.getById(L(e,t));function z(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 B(t,n,r){let i=t.getDescendantValues(n);return p(i.every(e=>r.includes(e))?e(r,...i):s(r,...i))}function V(e,t){let n=new Map;return e.visit({onEnter:r=>{let i=e.getNodeValue(r),a=e.isBranchNode(r),o=z(e,r,t);n.set(i,{type:a?`branch`:`leaf`,checked:o})}}),n}function H(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`),D=c.getFirstNode(void 0,{skip:({indexPath:e})=>c.getValuePath(e).slice(0,-1).some(e=>!l.includes(e))}),O=D?c.getNodeValue(D):null;function k(e){let{node:t,indexPath:n}=e,i=c.getNodeValue(t);return{id:P(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 z(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 V(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){I(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:M(r),dir:a(`dir`)})},getLabelProps(){return t.element({...A.label.attrs,id:N(r),dir:a(`dir`)})},getTreeProps(){return t.element({...A.tree.attrs,id:F(r),dir:a(`dir`),role:`tree`,"aria-label":`Tree View`,"aria-labelledby":N(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:k,getItemProps(e){let n=k(e);return t.element({...A.item.attrs,id:n.id,dir:a(`dir`),"data-ownedby":F(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=k(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=k(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=k(e);return t.element({...A.branch.attrs,"data-depth":n.depth,dir:a(`dir`),"data-branch":n.value,role:`treeitem`,"data-ownedby":F(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=k(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=k(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=k(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=k(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=k(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=k(e);return t.element({...A.branchIndentGuide.attrs,"data-depth":n.depth})},getNodeCheckboxProps(e){let n=k(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=k(e);return t.input({...A.nodeRenameInput.attrs,id:L(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 U(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 W(e){let{prop:t,context:n}=e;return function({indexPath:e}){return t(`collection`).getValuePath(e).slice(0,-1).some(e=>!n.get(`expandedValue`).includes(e))}}var{and:G}=w(),K=b({props({props:e}){return{selectionMode:`single`,collection:j.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:W({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:G(`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:G(`isShiftKey`,`isMultipleSelection`),actions:[`focusTreeNextNode`,`extendSelectionToNextNode`]},{actions:[`focusTreeNextNode`]}],"NODE.ARROW_UP":[{guard:G(`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:G(`isBranchFocused`,`isBranchExpanded`),actions:[`focusBranchFirstNode`]},{actions:[`expandBranch`]}],"SIBLINGS.EXPAND":{actions:[`expandSiblingBranches`]},"NODE.HOME":[{guard:G(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToFirstNode`,`focusTreeFirstNode`]},{actions:[`focusTreeFirstNode`]}],"NODE.END":[{guard:G(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToLastNode`,`focusTreeLastNode`]},{actions:[`focusTreeLastNode`]}],"NODE.CLICK":[{guard:G(`isCtrlKey`,`isMultipleSelection`),actions:[`toggleNodeSelection`]},{guard:G(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToNode`]},{actions:[`selectNode`]}],"BRANCH_NODE.CLICK":[{guard:G(`isCtrlKey`,`isMultipleSelection`),actions:[`toggleNodeSelection`]},{guard:G(`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;U(e,[t.id])},expandBranches(e){let{context:t,event:n}=e;U(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:W(e)});if(!i)return;let a=r.getNodeValue(i);q(e,a)?m(()=>I(n,a)):I(n,a)},focusTreeLastNode(e){let{prop:t,scope:n}=e,r=t(`collection`),i=r.getLastNode(void 0,{skip:W(e)}),a=r.getNodeValue(i);q(e,a)?m(()=>I(n,a)):I(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:W(e)});if(!o)return;let s=i.getNodeValue(o);q(e,s)?m(()=>I(r,s)):I(r,s)},focusTreeNextNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.getNextNode(t.id,{skip:W(e)});if(!a)return;let o=i.getNodeValue(a);q(e,o)?m(()=>I(r,o)):I(r,o)},focusTreePrevNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.getPreviousNode(t.id,{skip:W(e)});if(!a)return;let o=i.getNodeValue(a);q(e,o)?m(()=>I(r,o)):I(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&&(q(e,o)?m(()=>I(r,o)):I(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&&(q(e,s.id)?m(()=>I(a,s.id)):I(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;U(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&&U(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:W(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:W(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:W(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:W(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?B(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),I(r,i);return}n(`onRenameComplete`)?.({value:i,label:o,indexPath:a}),e.set(`renamingValue`,null),I(r,i)},cancelRenaming({context:e,scope:t}){let n=e.get(`renamingValue`);e.set(`renamingValue`,null),n&&I(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(R(t,r),o)},focusRenameInput({context:e,scope:t}){let n=e.get(`renamingValue`);if(!n)return;let r=R(t,n);r&&(r.focus(),r.select())}}}});function q(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(P(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{H as n,K as r,j as t};
@@ -1 +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};
1
+ const{abs:e,cos:n,sin:r,acos:i,atan2:a,sqrt:o,pow:s}=Math;function c(e){return e<0?-s(-e,1/3):s(e,1/3)}const l=Math.PI,u=2*l,d=l/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,d=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,d=e*s);let f={x:c*o[0].x+l*o[1].x+u*o[2].x+d*o[3].x,y:c*o[0].y+l*o[1].y+u*o[2].y+d*o[3].y,t:e};return r&&(f.z=c*o[0].z+l*o[1].z+u*o[2].z+d*o[3].z),f}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],d=o[3],f;if(c*=a,l*=e,s.length===2)return f=c+l,{x:(c*s[0].x+l*s[1].x)/f,y:(c*s[0].y+l*s[1].y)/f,z:i?(c*s[0].z+l*s[1].z)/f:!1,t:e};if(c*=a,l*=2*a,u*=e*e,s.length===3)return f=c+l+u,{x:(c*s[0].x+l*s[1].x+u*s[2].x)/f,y:(c*s[0].y+l*s[1].y+u*s[2].y)/f,z:i?(c*s[0].z+l*s[1].z+u*s[2].z)/f:!1,t:e};if(c*=a,l*=1.5*a,u*=3*a,d*=e*e*e,s.length===4)return f=c+l+u+d,{x:(c*s[0].x+l*s[1].x+u*s[2].x+d*s[3].x)/f,y:(c*s[0].y+l*s[1].y+u*s[2].y+d*s[3].y)/f,z:i?(c*s[0].z+l*s[1].z+u*s[2].z+d*s[3].z)/f:!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),d=(e-r)*(o-c)-(n-i)*(a-s);return d==0?!1:{x:l/d,y:u/d}},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,d=i.x,f=i.y;return h.lli8(a,o,s,c,l,u,d,f)},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);return e.map(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)}})},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),l=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(l)}else if(n!==r&&i===0)return[(2*n-r)/(2*n-2*r)].filter(l);return[]}let d=s[0].y,f=s[1].y,p=s[2].y,m=s[3].y,g=-d+3*f-3*p+m,_=3*d-6*f+3*p,v=-3*d+3*f,y=d;if(h.approximately(g,0)){if(h.approximately(_,0))return h.approximately(v,0)?[]:[-y/v].filter(l);let e=o(v*v-4*_*y),n=2*_;return[(e-v)/n,(-v-e)/n].filter(l)}_/=g,v/=g,y/=g;let b=(3*v-_*_)/3,x=b/3,S=(2*_*_*_-9*_*v+27*y)/27,C=S/2,w=C*C+x*x*x,T,E,D,O,k;if(w<0){let e=-b/3,r=o(e*e*e),a=-S/(2*r),s=i(a<-1?-1:a>1?1:a),d=2*c(r);return D=d*n(s/3)-_/3,O=d*n((s+u)/3)-_/3,k=d*n((s+2*u)/3)-_/3,[D,O,k].filter(l)}else if(w===0)return T=C<0?c(-C):-c(C),D=2*T-_/3,O=-T-_/3,[D,O].filter(l);else{let e=o(w);return T=c(-C+e),E=c(C+e),[T-E-_/3].filter(l)}},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,d,f,p=0,m=0,g=h.compute(n,r),_=h.compute(n,i),v=g.x*g.x+g.y*g.y;if(a?(l=o(s(g.y*_.z-_.y*g.z,2)+s(g.z*_.x-_.z*g.x,2)+s(g.x*_.y-_.x*g.y,2)),u=s(v+g.z*g.z,3/2)):(l=g.x*_.y-g.y*_.x,u=s(v,3/2)),l===0||u===0)return{k:0,r:0};if(p=l/u,m=u/l,!c){let o=h.curvature(n-.001,r,i,a,!0).k,s=h.curvature(n+.001,r,i,a,!0).k;f=(s-p+(p-o))/2,d=(e(s-p)+e(p-o))/2}return{k:p,r:m,dk:f,adk:d}},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 d=c*c-4*s*l;if(d<0)return[];let f=Math.sqrt(d);return[(f-c)/u,-(c+f)/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 d=[];return u.length===0?d:(u.forEach(function(e){d=d.concat(h.pairiteration(e.left,e.right,s))}),d=d.filter(function(e,n){return d.indexOf(e)===n}),d)},getccenter:function(e,i,o){let s=i.x-e.x,c=i.y-e.y,l=o.x-i.x,f=o.y-i.y,p=s*n(d)-c*r(d),m=s*r(d)+c*n(d),g=l*n(d)-f*r(d),_=l*r(d)+f*n(d),v=(e.x+i.x)/2,y=(e.y+i.y)/2,b=(i.x+o.x)/2,x=(i.y+o.y)/2,S=v+p,C=y+m,w=b+g,T=x+_,E=h.lli8(v,y,S,C,b,x,w,T),D=h.dist(E,e),O=a(e.y-E.y,e.x-E.x),k=a(i.y-E.y,i.x-E.x),A=a(o.y-E.y,o.x-E.x),j;return O<A?((O>k||k>A)&&(O+=u),O>A&&(j=A,A=O,O=j)):A<k&&k<O?(j=A,A=O,O=j):A+=u,E.s=O,E.e=A,E.r=D,E},numberSort:function(e,n){return e-n}};var g=class e{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(n){let r=[];return this.curves.forEach(function(e){r.push(...e.offset(n))}),new e(r)}};const{abs:_,min:v,max:y,cos:b,sin:x,acos:S,sqrt:C}=Math,w=Math.PI;var T=class e{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 d=h.align(s,{p1:s[0],p2:s[l]}),f=h.dist(s[0],s[l]);this._linear=d.reduce((e,n)=>e+_(n.y),0)<f/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,i,a){return a===void 0&&(a=.5),a===0?new e(r,r,i):a===1?new e(n,r,r):new e(n,e.getABC(2,n,r,i,a).A,i)}static cubicFromPoints(n,r,i,a,o){a===void 0&&(a=.5);let s=e.getABC(3,n,r,i,a);o===void 0&&(o=h.dist(r,s.C));let c=o*(1-a)/a,l=h.dist(n,i),u=(i.x-n.x)/l,d=(i.y-n.y)/l,f=o*u,p=o*d,m=c*u,g=c*d,_={x:r.x-f,y:r.y-p},v={x:r.x+m,y:r.y+g},y=s.A,b={x:y.x+(_.x-y.x)/(1-a),y:y.y+(_.y-y.y)/(1-a)},x={x:y.x+(v.x-y.x)/a,y:y.y+(v.y-y.y)/a};return new e(n,{x:n.x+(b.x-n.x)/a,y:n.y+(b.y-n.y)/a},{x:i.x+(x.x-i.x)/(1-a),y:i.y+(x.y-i.y)/(1-a)},i)}static getUtils(){return h}getUtils(){return e.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(n,r){r||=this.get(n);let i=this.points[0],a=this.points[this.order];return e.getABC(this.order,i,r,a,n)}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,d=u,f;l+=1;for(let n;u<s+c;u+=c)f=this.compute(u),n=h.dist(e,f),n<l&&(l=n,d=u);return d=d<0?0:d>1?1:d,f=this.compute(d),f.t=d,f.d=l,f}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 n=this.points,r=[n[0]],i=n.length;for(let e=1,a,o;e<i;e++)a=n[e],o=n[e-1],r[e]={x:(i-e)/i*a.x+e/i*o.x,y:(i-e)/i*a.y+e/i*o.y};return r[i]=n[i-1],new e(r)}derivative(e){return h.compute(e,this.dpoints[0],this._3d)}dderivative(e){return h.compute(e,this.dpoints[1],this._3d)}align(){let n=this.points;return new e(h.align(n,{p1:n[0],p2:n[n.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(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;let i=this.hull(n),a={left:this.order===2?new e([i[0],i[3],i[5]]):new e([i[0],i[4],i[7],i[9]]),right:this.order===2?new e([i[5],i[4],i[2]]):new e([i[9],i[8],i[6],i[3]]),span:i};return a.left._t1=h.map(0,0,1,this._t1,this._t2),a.left._t2=h.map(n,0,1,this._t1,this._t2),a.right._t1=h.map(n,0,1,this._t1,this._t2),a.right._t2=h.map(1,0,1,this._t1,this._t2),r?(r=h.map(r,n,1,0,1),a.right.split(r).left):a}extrema(){let e={},n=[];return this.dims.forEach(function(r){let i=function(e){return e[r]},a=this.dpoints[0].map(i);e[r]=h.droots(a),this.order===3&&(a=this.dpoints[1].map(i),e[r]=e[r].concat(h.droots(a))),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(n,r){if(r!==void 0){let e=this.get(n),i=this.normal(n),a={c:e,n:i,x:e.x+i.x*r,y:e.y+i.y*r};return this._3d&&(a.z=e.z+i.z*r),a}if(this._linear){let r=this.normal(0);return[new e(this.points.map(function(e){let i={x:e.x+n*r.x,y:e.y+n*r.y};return e.z&&r.z&&(i.z=e.z+n*r.z),i}))]}return this.reduce().map(function(e){return e._linear?e.offset(n)[0]:e.scale(n)})}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.01;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(n,r,i){i=typeof i==`number`?i:r;let a=this.order,o=this.points.map((e,n)=>(1-n/a)*r+n/a*i);return new e(this.points.map((e,r)=>({x:e.x+n.x*o[r],y:e.y+n.y*o[r]})))}scale(n){let r=this.order,i=!1;if(typeof n==`function`&&(i=n),i&&r===2)return this.raise().scale(i);let a=this.clockwise,o=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):n,i?i(1):n);let s=i?i(0):n,c=i?i(1):n,l=[this.offset(0,10),this.offset(1,10)],u=[],d=h.lli4(l[0],l[0].c,l[1],l[1].c);if(!d)throw Error(`cannot scale this curve. Try reducing it first.`);return[0,1].forEach(function(e){let n=u[e*r]=h.copy(o[e*r]);n.x+=(e?c:s)*l[e].n.x,n.y+=(e?c:s)*l[e].n.y}),i?([0,1].forEach(function(e){if(!(r===2&&e)){var s=o[e+1],c={x:s.x-d.x,y:s.y-d.y},l=i?i((e+1)/r):n;i&&!a&&(l=-l);var f=C(c.x*c.x+c.y*c.y);c.x/=f,c.y/=f,u[e+1]={x:s.x+l*c.x,y:s.y+l*c.y}}}),new e(u)):([0,1].forEach(e=>{if(r===2&&e)return;let n=u[e*r],i=this.derivative(e),a={x:n.x+i.x,y:n.y+i.y};u[e+1]=h.lli4(n,a,d,o[e+1])}),new e(u))}outline(n,r,i,a){if(r=r===void 0?n:r,this._linear){let o=this.normal(0),s=this.points[0],c=this.points[this.points.length-1],l,u,d;i===void 0&&(i=n,a=r),l={x:s.x+o.x*n,y:s.y+o.y*n},d={x:c.x+o.x*i,y:c.y+o.y*i},u={x:(l.x+d.x)/2,y:(l.y+d.y)/2};let f=[l,u,d];l={x:s.x-o.x*r,y:s.y-o.y*r},d={x:c.x-o.x*a,y:c.y-o.y*a},u={x:(l.x+d.x)/2,y:(l.y+d.y)/2};let p=[d,u,l],m=h.makeline(p[2],f[0]),_=h.makeline(f[2],p[0]);return new g([m,new e(f),_,new e(p)])}let o=this.reduce(),s=o.length,c=[],l=[],u,d=0,f=this.length(),p=i!==void 0&&a!==void 0;function m(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)}}o.forEach(function(e){let o=e.length();p?(c.push(e.scale(m(n,i,f,d,o))),l.push(e.scale(m(-r,-a,f,d,o)))):(c.push(e.scale(n)),l.push(e.scale(-r))),d+=o}),l=l.map(function(e){return u=e.points,u[3]?e.points=[u[3],u[2],u[1],u[0]]:e.points=[u[2],u[1],u[0]],e}).reverse();let _=c[0].points[0],v=c[s-1].points[c[s-1].points.length-1],y=l[s-1].points[l[s-1].points.length-1],b=l[0].points[0],x=h.makeline(y,_),S=h.makeline(v,b);return new g([x].concat(c,[S],l))}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(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof e&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}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,d=!1,f=!1,p,m=i,g=1,_=0;do if(f=d,u=l,m=(r+i)/2,_++,s=this.get(m),c=this.get(i),l=h.getccenter(o,s,c),l.interval={start:r,end:i},d=this._error(l,o,r,i)<=e,p=f&&!d,p||(g=i),d){if(i>=1){if(l.interval.end=g=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=m;while(!p&&a++<100);if(a>=100)break;u||=l,n.push(u),r=g}while(i<1);return n}};export{T as t};
@@ -0,0 +1 @@
1
+ function e(e){return Object.prototype.toString.call(e).slice(8,-1)}function t(t){return e(t)===`Array`}function n(t){if(e(t)!==`Object`)return!1;let n=Object.getPrototypeOf(t);return!!n&&n.constructor===Object&&n===Object.prototype}function r(e,t,n,r,i){let a={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;a===`enumerable`&&(e[t]=n),i&&a===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function i(e,a={}){if(t(e))return e.map(e=>i(e,a));if(!n(e))return e;let o=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...o,...s].reduce((n,o)=>{if(o===`__proto__`||t(a.props)&&!a.props.includes(o))return n;let s=e[o];return r(n,o,i(s,a),e,a.nonenumerable),n},{})}export{i as t};
@@ -1 +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};
1
+ const e=Math.PI,t=2*e,n=1e-6,r=t-n;function i(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function a(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return i;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 o=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?i:a(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 s(){return new o}s.prototype=o.prototype;export{o as t};
@@ -1 +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};
1
+ import{t as e}from"./d3-path.mjs";function t(e){return function(){return e}}const n=Math.PI;n/2,2*n;function r(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t},()=>new e(n)}Array.prototype.slice;function i(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function a(e){this._context=e}a.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 o(e){return new a(e)}function s(e){return e[0]}function c(e){return e[1]}function l(e,n){var a=t(!0),l=null,u=o,d=null,f=r(p);e=typeof e==`function`?e:e===void 0?s:t(e),n=typeof n==`function`?n:n===void 0?c:t(n);function p(t){var r,o=(t=i(t)).length,s,c=!1,p;for(l??(d=u(p=f())),r=0;r<=o;++r)!(r<o&&a(s=t[r],r,t))===c&&((c=!c)?d.lineStart():d.lineEnd()),c&&d.point(+e(s,r,t),+n(s,r,t));if(p)return d=null,p+``||null}return p.x=function(n){return arguments.length?(e=typeof n==`function`?n:t(+n),p):e},p.y=function(e){return arguments.length?(n=typeof e==`function`?e:t(+e),p):n},p.defined=function(e){return arguments.length?(a=typeof e==`function`?e:t(!!e),p):a},p.curve=function(e){return arguments.length?(u=e,l!=null&&(d=u(l)),p):u},p.context=function(e){return arguments.length?(e==null?l=d=null:d=u(l=e),p):l},p}function u(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)}function d(e,t){this._context=e,this._k=(1-t)/6}d.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:u(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:u(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 e(t){function n(e){return new d(e,t)}return n.tension=function(t){return e(+t)},n})(0);function f(e,t){this._context=e,this._k=(1-t)/6}f.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:u(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 e(t){function n(e){return new f(e,t)}return n.tension=function(t){return e(+t)},n})(0);function p(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 m(e,t){this._context=e,this._alpha=t}m.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:p(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 e(t){function n(e){return t?new m(e,t):new d(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function h(e,t){this._context=e,this._alpha=t}h.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:p(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 g=(function e(t){function n(e){return t?new h(e,t):new f(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);export{l as n,g as t};
@@ -1 +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};
1
+ const{getOwnPropertyNames:e,getOwnPropertySymbols:t}=Object,{hasOwnProperty:n}=Object.prototype;function r(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function i(e){return function(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 a(n){return e(n).concat(t(n))}const o=Object.hasOwn||((e,t)=>n.call(e,t)),{getOwnPropertyDescriptor:s,keys:c}=Object,l=Object.is||function(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t};function u(e,t){return e===t}function d(e,t){return e.byteLength===t.byteLength&&S(new Uint8Array(e),new Uint8Array(t))}function f(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 p(e,t){return e.byteLength===t.byteLength&&S(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function m(e,t){return l(e.getTime(),t.getTime())}function h(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function g(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 _(e,t,n){let r=c(e),i=r.length;if(c(t).length!==i)return!1;for(;i-- >0;)if(!w(e,t,n,r[i]))return!1;return!0}function v(e,t,n){let r=a(e),i=r.length;if(a(t).length!==i)return!1;let o,c,l;for(;i-- >0;)if(o=r[i],!w(e,t,n,o)||(c=s(e,o),l=s(t,o),(c||l)&&(!c||!l||c.configurable!==l.configurable||c.enumerable!==l.enumerable||c.writable!==l.writable)))return!1;return!0}function y(e,t){return l(e.valueOf(),t.valueOf())}function b(e,t){return e.source===t.source&&e.flags===t.flags}function x(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 S(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 C(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 w(e,t,n,r){return(r===`_owner`||r===`__o`||r===`__v`)&&(e.$$typeof||t.$$typeof)?!0:o(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const T=Object.prototype.toString;function E(e){let t=A(e),{areArraysEqual:n,areDatesEqual:r,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:s,areRegExpsEqual:c,areSetsEqual:l,getUnsupportedCustomComparator:u}=e;return function(e,d,f){if(e===d)return!0;if(e==null||d==null)return!1;let p=typeof e;if(p!==typeof d)return!1;if(p!==`object`)return p===`number`||p===`bigint`?o(e,d,f):p===`function`?i(e,d,f):!1;let m=e.constructor;if(m!==d.constructor)return!1;if(m===Object)return s(e,d,f);if(m===Array)return n(e,d,f);if(m===Date)return r(e,d,f);if(m===RegExp)return c(e,d,f);if(m===Map)return a(e,d,f);if(m===Set)return l(e,d,f);if(m===Promise)return!1;if(Array.isArray(e))return n(e,d,f);let h=T.call(e),g=t[h];if(g)return g(e,d,f);let _=u&&u(e,d,f,h);return _?_(e,d,f):!1}}function D({circular:e,createCustomConfig:t,strict:n}){let a={areArrayBuffersEqual:d,areArraysEqual:n?v:f,areDataViewsEqual:p,areDatesEqual:m,areErrorsEqual:h,areFunctionsEqual:u,areMapsEqual:n?r(g,v):g,areNumbersEqual:l,areObjectsEqual:n?v:_,arePrimitiveWrappersEqual:y,areRegExpsEqual:b,areSetsEqual:n?r(x,v):x,areTypedArraysEqual:n?r(S,v):S,areUrlsEqual:C,getUnsupportedCustomComparator:void 0};if(t&&(a=Object.assign({},a,t(a))),e){let e=i(a.areArraysEqual),t=i(a.areMapsEqual),n=i(a.areObjectsEqual),r=i(a.areSetsEqual);a=Object.assign({},a,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:r})}return a}function O(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function k({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(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(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(e,n){return t(e,n,a)}}function A({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 j=N();N({strict:!0}),N({circular:!0}),N({circular:!0,strict:!0});const M=N({createInternalComparator:()=>l});N({strict:!0,createInternalComparator:()=>l}),N({circular:!0,createInternalComparator:()=>l}),N({circular:!0,createInternalComparator:()=>l,strict:!0});function N(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=E(D(e));return k({circular:t,comparator:a,createState:r,equals:n?n(a):O(a),strict:i})}export{M as n,j as t};