@sanity/hierarchical-document-list 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/hierarchical-document-list",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Sanity Plugin - Hierarchical Document List",
5
5
  "keywords": [
6
6
  "sanity",
@@ -10,6 +10,7 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/sanity-io/hierarchical-document-list/issues"
12
12
  },
13
+ "type": "commonjs",
13
14
  "repository": {
14
15
  "type": "git",
15
16
  "url": "git@github.com:sanity-io/hierarchical-document-list.git"
@@ -18,17 +19,15 @@
18
19
  "author": "Sanity <hello@sanity.io>",
19
20
  "exports": {
20
21
  ".": {
21
- "types": "./dist/index.d.ts",
22
22
  "source": "./src/index.ts",
23
- "import": "./dist/index.esm.js",
23
+ "import": "./dist/index.mjs",
24
24
  "require": "./dist/index.js",
25
- "default": "./dist/index.esm.js"
25
+ "default": "./dist/index.mjs"
26
26
  },
27
27
  "./package.json": "./package.json"
28
28
  },
29
29
  "main": "./dist/index.js",
30
- "module": "./dist/index.esm.js",
31
- "source": "./src/index.ts",
30
+ "module": "./dist/index.mjs",
32
31
  "types": "./dist/index.d.ts",
33
32
  "files": [
34
33
  "dist",
@@ -48,7 +47,6 @@
48
47
  "watch": "pkg-utils watch --strict"
49
48
  },
50
49
  "dependencies": {
51
- "@nosferatu500/react-sortable-tree": "^4.4.0",
52
50
  "@sanity/icons": "^3.7.0",
53
51
  "@sanity/incompatible-plugin": "^1.0.5",
54
52
  "@sanity/mutator": "^3.78.1",
@@ -60,8 +58,9 @@
60
58
  "devDependencies": {
61
59
  "@commitlint/cli": "^18.4.3",
62
60
  "@commitlint/config-conventional": "^18.4.3",
63
- "@sanity/pkg-utils": "^3.3.2",
64
- "@sanity/plugin-kit": "^3.1.10",
61
+ "@nosferatu500/react-sortable-tree": "^4.4.0",
62
+ "@sanity/pkg-utils": "^7.0.4",
63
+ "@sanity/plugin-kit": "^4.0.19",
65
64
  "@sanity/semantic-release-preset": "^4.1.6",
66
65
  "@sanity/vision": "^3.78.1",
67
66
  "@types/react": "^19.0.10",
@@ -84,11 +83,14 @@
84
83
  "rimraf": "^5.0.5",
85
84
  "sanity": "^3.78.1",
86
85
  "styled-components": "^6.1.15",
87
- "typescript": "5.3.2"
86
+ "typescript": "5.4.x"
88
87
  },
89
88
  "peerDependencies": {
90
89
  "react": "^18.3 || ^19",
91
- "sanity": "^3"
90
+ "react-dom": "^18.3 || ^19",
91
+ "react-is": "^18.3 || ^19",
92
+ "sanity": "^3 || ^4.0.0-0",
93
+ "styled-components": "^6.1"
92
94
  },
93
95
  "overrides": {
94
96
  "react": "$react",
package/dist/index.esm.js DELETED
@@ -1,151 +0,0 @@
1
- import*as e from"sanity";import{useClient as t,TextWithTone as n,useTimeAgo as r,useSchema as o,Preview as i,IntentButton as a,setIfMissing as s,PatchEvent as c,prefixPath as l,useEditState as d,useDocumentOperation as u,FormField as p,defineType as h,definePlugin as f}from"sanity";import{jsx as m,jsxs as y,Fragment as g}from"react/jsx-runtime";import{PublishIcon as v,EditIcon as b,HelpCircleIcon as w,RemoveCircleIcon as k,CopyIcon as _,LaunchIcon as S,EllipsisVerticalIcon as x,ChevronDownIcon as I,ChevronRightIcon as T,DragHandleIcon as C,AddCircleIcon as A,AddIcon as E}from"@sanity/icons";import{Container as P,Card as N,Stack as D,Heading as O,Text as R,Box as $,Inline as z,Tooltip as j,Flex as L,MenuButton as M,Menu as B,MenuItem as V,MenuDivider as H,Button as F,Spinner as G}from"@sanity/ui";import*as U from"react";import W,{useRef as Y,useContext as q,useDebugValue as X,createElement as K,useCallback as J,useMemo as Z}from"react";import Q,{getTreeFromFlatData as ee,getFlatDataFromTree as te,isDescendant as ne,getVisibleNodeCount as re}from"@nosferatu500/react-sortable-tree";import{DndProvider as oe}from"react-dnd";import{HTML5Backend as ie}from"react-dnd-html5-backend";import{randomKey as ae}from"@sanity/util/content";import{usePaneRouter as se}from"sanity/desk";import{arrayToJSONMatchPath as ce}from"@sanity/mutator";const le=e=>{let{text:t}=e;return m(g,{children:t.split("`").map(((e,t)=>m(U.Fragment,{children:t%2==0?e:m("code",{children:e})},t)))})},de=e=>m(P,{padding:5,style:{maxWidth:"25rem"},sizing:"content",children:m(N,{padding:4,border:!0,radius:2,width:0,tone:"caution",children:y(D,{space:3,children:[m(O,{size:1,children:e.title}),e.subtitle&&e.subtitle.split("\\n").map((e=>m(R,{size:1,children:m(le,{text:e})}))),e.children&&m($,{marginTop:2,children:e.children})]})})});function ue(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace("drafts.","")}function pe(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").startsWith("drafts.")}function he(e,t){const n={...e},r=ue(t._id);return n[r]={...n[r]||{},[pe(t._id)?"draft":"published"]:t},n}function fe(e,t){if("addOrEditItem"===t.type&&t.item?._id)return he(e,t.item);if("removeItem"===t.type){const n=ue(t.itemId);return{...e,[n]:pe(t.itemId)?{published:e[n]?.published}:{draft:e[n]?.draft}}}return"setInitialData"===t.type?t.items.reduce(he,{}):e}function me(){}const ye=U.createContext({addItem:me,duplicateItem:me,removeItem:me,handleMovedNode:me,moveItemDown:me,moveItemUp:me,allItemsStatus:"loading"});function ge(){return U.useContext(ye)}function ve(e){let{time:t}=e;const n=r(t);return y("span",{title:n,children:[n,n.toLowerCase().trim().startsWith("just now")?"":" ago"]})}const be=e=>{let{document:t}=e;return m(j,{portal:!0,content:m($,{padding:2,children:m(R,{size:1,children:t?y(g,{children:["Published ",t._updatedAt&&m(ve,{time:t._updatedAt})]}):m(g,{children:"Not published"})})}),children:m(n,{tone:"positive",dimmed:!t,muted:!t,size:1,children:m(v,{})})})},we=e=>{let{document:t}=e;return m(j,{portal:!0,content:m($,{padding:2,children:m(R,{size:1,children:t?y(g,{children:["Edited ",t?._updatedAt&&m(ve,{time:t?._updatedAt})]}):m(g,{children:"No unpublished edits"})})}),children:m(n,{tone:"caution",dimmed:!t,muted:!t,size:1,children:m(b,{})})})},ke=e=>{let{draft:t,published:n}=e;return y(z,{space:4,children:[m(be,{document:n}),m(we,{document:t})]})},_e=e=>{const{value:{reference:t,docType:r}={},draftId:a,publishedId:s}=e.item,{routerPanesState:c,ChildLink:l}=se(),{allItemsStatus:d}=ge(),u=o(),p=U.useMemo((()=>c.some((e=>e.some((e=>e.id===t?._ref))))),[c]),h=U.useMemo((()=>r?u.get(r):void 0),[r]),f=U.useMemo((()=>U.forwardRef(((e,n)=>m(l,{...e,childId:t?._ref,ref:n,childParameters:{type:r}})))),[l,t?._ref]);return t?._ref?y(L,{gap:2,align:"center",style:{flex:1},children:[m(N,s||"success"!==d?{__unstable_focusRing:!0,as:f,tone:p?"primary":"default",padding:1,radius:2,flex:1,"data-as":"a","data-ui":"PaneItem",children:m(i,{layout:"default",schemaType:h,value:{_ref:a||t?._ref},status:m(ke,{draft:a?{_id:a,_type:r,_updatedAt:e.item.draftUpdatedAt}:void 0,published:{_id:t?._ref,_type:r,_updatedAt:e.item.publishedUpdatedAt}})})}:{padding:3,radius:1,flex:1,children:y(L,{align:"center",children:[m(R,{size:2,muted:!0,style:{flex:1},children:"Invalid document"}),m(j,{placement:"left",portal:!0,content:m($,{padding:3,children:y(L,{align:"flex-start",gap:3,children:[m(n,{tone:"default",size:3,children:m(w,{})}),y(D,{space:3,children:[m(R,{as:"h2",size:1,weight:"semibold",children:"This document is not valid"}),y(R,{size:1,children:["ID: ",t?._ref]})]})]})}),children:m(n,{tone:"default",size:2,children:m(w,{})})})]})}),e.action]}):null},Se=e=>{let{nodeProps:t}=e;const n=ge(),{node:r}=t,{reference:o,docType:i}=r?.value||{},s=U.useMemo((()=>U.forwardRef((function(e,t){return m(a,{...e,intent:"edit",params:{id:o?._ref,type:i},target:"_blank",rel:"noopener noreferrer"})}))),[o?._ref,i]),c=!!r.publishedId;return m(M,{button:m(F,{padding:2,mode:"bleed",icon:x}),id:`hiearchical-doc-list--${r._key}-menuButton`,menu:y(B,{children:[m(V,{text:"Remove from list",tone:"critical",icon:k,onClick:()=>n.removeItem(t)}),m(V,{text:"Duplicate item",icon:_,disabled:!c,onClick:()=>n.duplicateItem(t)}),m(H,{}),m(V,{text:"Open in new tab",icon:S,disabled:!c,as:s,"data-as":"a"})]}),popover:{portal:!0,tone:"default",placement:"right"}})};function xe(e){return ee({flatData:e.map((e=>({...e,parent:e.parent||null}))),getKey:e=>e._key,getParentKey:e=>e.parent,rootKey:null})}function Ie(e,t){switch(t){case"document":default:return e;case"array":return`${e}.array`;case"node":return`${e}.node`;case"nodeValue":return`${e}.nodeValue`}}const Te="hierarchy.tree",Ce=Ie(Te,"node"),Ae=Ie(Te,"nodeValue"),Ee=Ie(Te,"array");function Pe(e,t){return Array.isArray(e)?e.map((e=>Pe(e,t))):"object"==typeof e&&null!==e?Object.keys(e).reduce(((n,r)=>{const o=e[r];return"_type"===r&&"string"==typeof o&&[Ce,Ae].includes(o)?{...n,[r]:Ie(t,o===Ce?"node":"nodeValue")}:{...n,[r]:Pe(o,t)}}),{}):e}const Ne=e=>{let{tree:t,allItems:n,visibilityMap:r}=e;return xe(t.filter((e=>e?.value?.reference?._ref)).map((e=>{const t=e.value?.reference?._ref,o=t?n[t]:void 0,i=o?.draft,a=o?.published,s={...e,expanded:!1!==r[e._key],draftId:i?._id,publishedId:a?._id,draftUpdatedAt:i?._updatedAt,publishedUpdatedAt:a?._updatedAt};return{...s,title:e=>m(_e,{item:s,action:m(Se,{nodeProps:e})}),children:[]}})))},De=e=>{if(e?.published?._id)return{_key:ae(12),_type:Ce,draftId:e.draft?._id,draftUpdatedAt:e.draft?._updatedAt,publishedId:e.published._id,publishedUpdatedAt:e.published?._updatedAt,value:{_type:Ae,reference:{_ref:e.published._id,_type:"reference",_weak:!0},docType:e.published._type}}};function Oe(e){return{_key:e._key,_type:e._type||Ce,value:e.value,parent:e.parent}}function Re(e){let{flatTree:t,node:n,treeIndex:r}=e;return{leadingNode:t.slice(0,r).reverse().find((e=>!e.path.includes(n._key))),followingNode:t.slice(r+1).find((e=>!e.path.includes(n._key)))}}function $e(t){let{node:n}=t;const r={_key:n._key},o=ze(n);return[e.unset([r]),...o.map((t=>e.unset([{_key:t}])))]}function ze(e){return Array.isArray(e.children)?e.children.reduce(((e,t)=>[...e,t._key,...ze(t)]),[]).filter(Boolean):[]}function je(t){let{nodeProps:{node:n,treeIndex:r},localTree:o,direction:i="up"}=t;const a={_key:n._key},s=r+("up"===i?-1:1),c=function(e){let{array:t,fromIndex:n,toIndex:r}=e;if(n===r)return t;const o=[...t],i=o[n],a=r<n?-1:1;for(let e=n;e!==r;e+=a)o[e]=o[e+a];return o[r]=i,o}({array:te({treeData:o,getNodeKey:e=>e.node._key}),fromIndex:r,toIndex:s}),{leadingNode:l,followingNode:d}=Re({flatTree:c,node:n,treeIndex:s}),u=Oe(n),p="up"===i?d:l,h=p?.parentNode;return[e.unset([a]),l?.node?._key?e.insert([u],"after",[{_key:l.node._key}]):e.insert([u],"before",[d?.node?._key?{_key:d.node._key}:s]),h?e.set(h._key,[a,"parent"]):e.unset([a,"parent"])]}function Le(t){const{localTree:n}=t;function r(e){const n=[s([]),...e||[]];let r=c.from(n);t.patchPrefix&&(r=c.from(n.map((e=>l(e,t.patchPrefix))))),t.onChange(r)}return{handleMovedNode:function(t){r(function(t){const{nextParentNode:n}=t,r={_key:t.node._key};if(!Array.isArray(t.nextPath))return $e({node:t.node});const o=te({treeData:t.treeData,getNodeKey:e=>e.node._key}),i=Oe(t.node),{leadingNode:a,followingNode:s}=Re({flatTree:o,node:t.node,treeIndex:t.nextTreeIndex});return[e.unset([r]),a?.node?._key?e.insert([i],"after",[{_key:a.node._key}]):e.insert([i],"before",[s?.node?._key?{_key:s.node._key}:t.nextTreeIndex]),n?e.set(n._key,[r,"parent"]):e.unset([r,"parent"])]}(t))},addItem:function(t){r(function(t){const n=Oe(t);return[e.insert([n],"after",[-1])]}(t))},removeItem:function(e){r($e(e))},moveItemUp:function(e){r(je({nodeProps:e,localTree:n,direction:"up"}))},moveItemDown:function(e){r(je({nodeProps:e,localTree:n,direction:"down"}))},duplicateItem:function(t){r(function(t){const n=Oe({...t.node,_key:ae(12)});return[e.insert([n],"before",[{_key:t.node._key}])]}(t))}}}const Me={hex:"#e3e4e8"},Be={hex:"#9499ad"},Ve={hex:"#7595ff"};var He=function(){return He=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},He.apply(this,arguments)};function Fe(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function Ge(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}"function"==typeof SuppressedError&&SuppressedError;var Ue=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,We=Ge((function(e){return Ue.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91})),Ye="-ms-",qe="-moz-",Xe="-webkit-",Ke="comm",Je="rule",Ze="decl",Qe="@import",et="@keyframes",tt="@layer",nt=Math.abs,rt=String.fromCharCode,ot=Object.assign;function it(e){return e.trim()}function at(e,t){return(e=t.exec(e))?e[0]:e}function st(e,t,n){return e.replace(t,n)}function ct(e,t,n){return e.indexOf(t,n)}function lt(e,t){return 0|e.charCodeAt(t)}function dt(e,t,n){return e.slice(t,n)}function ut(e){return e.length}function pt(e){return e.length}function ht(e,t){return t.push(e),e}function ft(e,t){return e.filter((function(e){return!at(e,t)}))}var mt=1,yt=1,gt=0,vt=0,bt=0,wt="";function kt(e,t,n,r,o,i,a,s){return{value:e,root:t,parent:n,type:r,props:o,children:i,line:mt,column:yt,length:a,return:"",siblings:s}}function _t(e,t){return ot(kt("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function St(e){for(;e.root;)e=_t(e.root,{children:[e]});ht(e,e.siblings)}function xt(){return bt=vt>0?lt(wt,--vt):0,yt--,10===bt&&(yt=1,mt--),bt}function It(){return bt=vt<gt?lt(wt,vt++):0,yt++,10===bt&&(yt=1,mt++),bt}function Tt(){return lt(wt,vt)}function Ct(){return vt}function At(e,t){return dt(wt,e,t)}function Et(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Pt(e){return it(At(vt-1,Ot(91===e?e+2:40===e?e+1:e)))}function Nt(e){for(;(bt=Tt())&&bt<33;)It();return Et(e)>2||Et(bt)>3?"":" "}function Dt(e,t){for(;--t&&It()&&!(bt<48||bt>102||bt>57&&bt<65||bt>70&&bt<97););return At(e,Ct()+(t<6&&32==Tt()&&32==It()))}function Ot(e){for(;It();)switch(bt){case e:return vt;case 34:case 39:34!==e&&39!==e&&Ot(bt);break;case 40:41===e&&Ot(e);break;case 92:It()}return vt}function Rt(e,t){for(;It()&&e+bt!==57&&(e+bt!==84||47!==Tt()););return"/*"+At(t,vt-1)+"*"+rt(47===e?e:It())}function $t(e){for(;!Et(Tt());)It();return At(e,vt)}function zt(e){return function(e){return wt="",e}(jt("",null,null,null,[""],e=function(e){return mt=yt=1,gt=ut(wt=e),vt=0,[]}(e),0,[0],e))}function jt(e,t,n,r,o,i,a,s,c){for(var l=0,d=0,u=a,p=0,h=0,f=0,m=1,y=1,g=1,v=0,b="",w=o,k=i,_=r,S=b;y;)switch(f=v,v=It()){case 40:if(108!=f&&58==lt(S,u-1)){-1!=ct(S+=st(Pt(v),"&","&\f"),"&\f",nt(l?s[l-1]:0))&&(g=-1);break}case 34:case 39:case 91:S+=Pt(v);break;case 9:case 10:case 13:case 32:S+=Nt(f);break;case 92:S+=Dt(Ct()-1,7);continue;case 47:switch(Tt()){case 42:case 47:ht(Mt(Rt(It(),Ct()),t,n,c),c);break;default:S+="/"}break;case 123*m:s[l++]=ut(S)*g;case 125*m:case 59:case 0:switch(v){case 0:case 125:y=0;case 59+d:-1==g&&(S=st(S,/\f/g,"")),h>0&&ut(S)-u&&ht(h>32?Bt(S+";",r,n,u-1,c):Bt(st(S," ","")+";",r,n,u-2,c),c);break;case 59:S+=";";default:if(ht(_=Lt(S,t,n,l,d,o,s,b,w=[],k=[],u,i),i),123===v)if(0===d)jt(S,t,_,_,w,i,u,s,k);else switch(99===p&&110===lt(S,3)?100:p){case 100:case 108:case 109:case 115:jt(e,_,_,r&&ht(Lt(e,_,_,0,0,o,s,b,o,w=[],u,k),k),o,k,u,s,r?w:k);break;default:jt(S,_,_,_,[""],k,0,s,k)}}l=d=h=0,m=g=1,b=S="",u=a;break;case 58:u=1+ut(S),h=f;default:if(m<1)if(123==v)--m;else if(125==v&&0==m++&&125==xt())continue;switch(S+=rt(v),v*m){case 38:g=d>0?1:(S+="\f",-1);break;case 44:s[l++]=(ut(S)-1)*g,g=1;break;case 64:45===Tt()&&(S+=Pt(It())),p=Tt(),d=u=ut(b=S+=$t(Ct())),v++;break;case 45:45===f&&2==ut(S)&&(m=0)}}return i}function Lt(e,t,n,r,o,i,a,s,c,l,d,u){for(var p=o-1,h=0===o?i:[""],f=pt(h),m=0,y=0,g=0;m<r;++m)for(var v=0,b=dt(e,p+1,p=nt(y=a[m])),w=e;v<f;++v)(w=it(y>0?h[v]+" "+b:st(b,/&\f/g,h[v])))&&(c[g++]=w);return kt(e,t,n,0===o?Je:s,c,l,d,u)}function Mt(e,t,n,r){return kt(e,t,n,Ke,rt(bt),dt(e,2,-2),0,r)}function Bt(e,t,n,r,o){return kt(e,t,n,Ze,dt(e,0,r),dt(e,r+1,-1),r,o)}function Vt(e,t,n){switch(function(e,t){return 45^lt(e,0)?(((t<<2^lt(e,0))<<2^lt(e,1))<<2^lt(e,2))<<2^lt(e,3):0}(e,t)){case 5103:return Xe+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Xe+e+e;case 4789:return qe+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Xe+e+qe+e+Ye+e+e;case 5936:switch(lt(e,t+11)){case 114:return Xe+e+Ye+st(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Xe+e+Ye+st(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Xe+e+Ye+st(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Xe+e+Ye+e+e;case 6165:return Xe+e+Ye+"flex-"+e+e;case 5187:return Xe+e+st(e,/(\w+).+(:[^]+)/,Xe+"box-$1$2"+Ye+"flex-$1$2")+e;case 5443:return Xe+e+Ye+"flex-item-"+st(e,/flex-|-self/g,"")+(at(e,/flex-|baseline/)?"":Ye+"grid-row-"+st(e,/flex-|-self/g,""))+e;case 4675:return Xe+e+Ye+"flex-line-pack"+st(e,/align-content|flex-|-self/g,"")+e;case 5548:return Xe+e+Ye+st(e,"shrink","negative")+e;case 5292:return Xe+e+Ye+st(e,"basis","preferred-size")+e;case 6060:return Xe+"box-"+st(e,"-grow","")+Xe+e+Ye+st(e,"grow","positive")+e;case 4554:return Xe+st(e,/([^-])(transform)/g,"$1"+Xe+"$2")+e;case 6187:return st(st(st(e,/(zoom-|grab)/,Xe+"$1"),/(image-set)/,Xe+"$1"),e,"")+e;case 5495:case 3959:return st(e,/(image-set\([^]*)/,Xe+"$1$`$1");case 4968:return st(st(e,/(.+:)(flex-)?(.*)/,Xe+"box-pack:$3"+Ye+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Xe+e+e;case 4200:if(!at(e,/flex-|baseline/))return Ye+"grid-column-align"+dt(e,t)+e;break;case 2592:case 3360:return Ye+st(e,"template-","")+e;case 4384:case 3616:return n&&n.some((function(e,n){return t=n,at(e.props,/grid-\w+-end/)}))?~ct(e+(n=n[t].value),"span",0)?e:Ye+st(e,"-start","")+e+Ye+"grid-row-span:"+(~ct(n,"span",0)?at(n,/\d+/):+at(n,/\d+/)-+at(e,/\d+/))+";":Ye+st(e,"-start","")+e;case 4896:case 4128:return n&&n.some((function(e){return at(e.props,/grid-\w+-start/)}))?e:Ye+st(st(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return st(e,/(.+)-inline(.+)/,Xe+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ut(e)-1-t>6)switch(lt(e,t+1)){case 109:if(45!==lt(e,t+4))break;case 102:return st(e,/(.+:)(.+)-([^]+)/,"$1"+Xe+"$2-$3$1"+qe+(108==lt(e,t+3)?"$3":"$2-$3"))+e;case 115:return~ct(e,"stretch",0)?Vt(st(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return st(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(t,n,r,o,i,a,s){return Ye+n+":"+r+s+(o?Ye+n+"-span:"+(i?a:+a-+r)+s:"")+e}));case 4949:if(121===lt(e,t+6))return st(e,":",":"+Xe)+e;break;case 6444:switch(lt(e,45===lt(e,14)?18:11)){case 120:return st(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Xe+(45===lt(e,14)?"inline-":"")+"box$3$1"+Xe+"$2$3$1"+Ye+"$2box$3")+e;case 100:return st(e,":",":"+Ye)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return st(e,"scroll-","scroll-snap-")+e}return e}function Ht(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function Ft(e,t,n,r){switch(e.type){case tt:if(e.children.length)break;case Qe:case Ze:return e.return=e.return||e.value;case Ke:return"";case et:return e.return=e.value+"{"+Ht(e.children,r)+"}";case Je:if(!ut(e.value=e.props.join(",")))return""}return ut(n=Ht(e.children,r))?e.return=e.value+"{"+n+"}":""}function Gt(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Ze:return void(e.return=Vt(e.value,e.length,n));case et:return Ht([_t(e,{value:st(e.value,"@","@"+Xe)})],r);case Je:if(e.length)return function(e,t){return e.map(t).join("")}(n=e.props,(function(t){switch(at(t,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":St(_t(e,{props:[st(t,/:(read-\w+)/,":"+qe+"$1")]})),St(_t(e,{props:[t]})),ot(e,{props:ft(n,r)});break;case"::placeholder":St(_t(e,{props:[st(t,/:(plac\w+)/,":"+Xe+"input-$1")]})),St(_t(e,{props:[st(t,/:(plac\w+)/,":"+qe+"$1")]})),St(_t(e,{props:[st(t,/:(plac\w+)/,Ye+"input-$1")]})),St(_t(e,{props:[t]})),ot(e,{props:ft(n,r)})}return""}))}}var Ut={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Wt="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Yt="active",qt="data-styled-version",Xt="6.1.15",Kt="/*!sc*/\n",Jt="undefined"!=typeof window&&"HTMLElement"in window,Zt=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),Qt={},en=/invalid hook call/i,tn=new Set,nn=function(e,t){if("production"!==process.env.NODE_ENV){var n=t?' with the id of "'.concat(t,'"'):"",r="The component ".concat(e).concat(n," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.",o=console.error;try{var i=!0;console.error=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];en.test(e)?(i=!1,tn.delete(r)):o.apply(void 0,Fe([e],t,!1))},Y(),i&&!tn.has(r)&&(console.warn(r),tn.add(r))}catch(e){en.test(e.message)&&tn.delete(r)}finally{console.error=o}}},rn=Object.freeze([]),on=Object.freeze({});function an(e,t,n){return void 0===n&&(n=on),e.theme!==n.theme&&e.theme||t||n.theme}var sn=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),cn=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,ln=/(^-|-$)/g;function dn(e){return e.replace(cn,"-").replace(ln,"")}var un=/(a)(d)/gi,pn=52,hn=function(e){return String.fromCharCode(e+(e>25?39:97))};function fn(e){var t,n="";for(t=Math.abs(e);t>pn;t=t/pn|0)n=hn(t%pn)+n;return(hn(t%pn)+n).replace(un,"$1-$2")}var mn,yn=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},gn=function(e){return yn(5381,e)};function vn(e){return fn(gn(e)>>>0)}function bn(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function wn(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var kn="function"==typeof Symbol&&Symbol.for,_n=kn?Symbol.for("react.memo"):60115,Sn=kn?Symbol.for("react.forward_ref"):60112,xn={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},In={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Tn={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Cn=((mn={})[Sn]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},mn[_n]=Tn,mn);function An(e){return("type"in(t=e)&&t.type.$$typeof)===_n?Tn:"$$typeof"in e?Cn[e.$$typeof]:xn;var t}var En=Object.defineProperty,Pn=Object.getOwnPropertyNames,Nn=Object.getOwnPropertySymbols,Dn=Object.getOwnPropertyDescriptor,On=Object.getPrototypeOf,Rn=Object.prototype;function $n(e,t,n){if("string"!=typeof t){if(Rn){var r=On(t);r&&r!==Rn&&$n(e,r,n)}var o=Pn(t);Nn&&(o=o.concat(Nn(t)));for(var i=An(e),a=An(t),s=0;s<o.length;++s){var c=o[s];if(!(c in In||n&&n[c]||a&&c in a||i&&c in i)){var l=Dn(t,c);try{En(e,c,l)}catch(e){}}}}return e}function zn(e){return"function"==typeof e}function jn(e){return"object"==typeof e&&"styledComponentId"in e}function Ln(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Mn(e,t){if(0===e.length)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function Bn(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Vn(e,t,n){if(void 0===n&&(n=!1),!n&&!Bn(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Vn(e[r],t[r]);else if(Bn(t))for(var r in t)e[r]=Vn(e[r],t[r]);return e}function Hn(e,t){Object.defineProperty(e,"toString",{value:t})}var Fn="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function Gn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],r=[],o=1,i=e.length;o<i;o+=1)r.push(e[o]);return r.forEach((function(e){n=n.replace(/%[a-z]/,e)})),n}function Un(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):"")):new Error(Gn.apply(void 0,Fe([Fn[e]],t,!1)).trim())}var Wn=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)if((o<<=1)<0)throw Un(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var i=r;i<o;i++)this.groupSizes[i]=0}for(var a=this.indexOfGroup(e+1),s=(i=0,t.length);i<s;i++)this.tag.insertRule(a,t[i])&&(this.groupSizes[e]++,a++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,i=r;i<o;i++)t+="".concat(this.tag.getRule(i)).concat(Kt);return t},e}(),Yn=new Map,qn=new Map,Xn=1,Kn=function(e){if(Yn.has(e))return Yn.get(e);for(;qn.has(Xn);)Xn++;var t=Xn++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>1073741824))throw Un(16,"".concat(t));return Yn.set(e,t),qn.set(t,e),t},Jn=function(e,t){Xn=t+1,Yn.set(e,t),qn.set(t,e)},Zn="style[".concat(Wt,"][").concat(qt,'="').concat(Xt,'"]'),Qn=new RegExp("^".concat(Wt,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),er=function(e,t,n){for(var r,o=n.split(","),i=0,a=o.length;i<a;i++)(r=o[i])&&e.registerName(t,r)},tr=function(e,t){for(var n,r=(null!==(n=t.textContent)&&void 0!==n?n:"").split(Kt),o=[],i=0,a=r.length;i<a;i++){var s=r[i].trim();if(s){var c=s.match(Qn);if(c){var l=0|parseInt(c[1],10),d=c[2];0!==l&&(Jn(d,l),er(e,d,c[3]),e.getTag().insertRules(l,o)),o.length=0}else o.push(s)}}},nr=function(e){for(var t=document.querySelectorAll(Zn),n=0,r=t.length;n<r;n++){var o=t[n];o&&o.getAttribute(Wt)!==Yt&&(tr(e,o),o.parentNode&&o.parentNode.removeChild(o))}};var rr=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){var t=Array.from(e.querySelectorAll("style[".concat(Wt,"]")));return t[t.length-1]}(n),i=void 0!==o?o.nextSibling:null;r.setAttribute(Wt,Yt),r.setAttribute(qt,Xt);var a="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null;return a&&r.setAttribute("nonce",a),n.insertBefore(r,i),r},or=function(){function e(e){this.element=rr(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}throw Un(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),ir=function(){function e(e){this.element=rr(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),ar=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),sr=Jt,cr={isServer:!Jt,useCSSOMInjection:!Zt},lr=function(){function e(e,t,n){void 0===e&&(e=on),void 0===t&&(t={});var r=this;this.options=He(He({},cr),e),this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&Jt&&sr&&(sr=!1,nr(this)),Hn(this,(function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=function(n){var o=function(e){return qn.get(e)}(n);if(void 0===o)return"continue";var i=e.names.get(o),a=t.getGroup(n);if(void 0===i||!i.size||0===a.length)return"continue";var s="".concat(Wt,".g").concat(n,'[id="').concat(o,'"]'),c="";void 0!==i&&i.forEach((function(e){e.length>0&&(c+="".concat(e,","))})),r+="".concat(a).concat(s,'{content:"').concat(c,'"}').concat(Kt)},i=0;i<n;i++)o(i);return r}(r)}))}return e.registerId=function(e){return Kn(e)},e.prototype.rehydrate=function(){!this.server&&Jt&&nr(this)},e.prototype.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(He(He({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new ar(n):t?new or(n):new ir(n)}(this.options),new Wn(e)));var e},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(Kn(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(Kn(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(Kn(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),dr=/&/g,ur=/^\s*\/\/.*$/gm;function pr(e,t){return e.map((function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map((function(e){return"".concat(t," ").concat(e)}))),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=pr(e.children,t)),e}))}var hr=new lr,fr=function(e){var t,n,r,o=on,i=o.options,a=void 0===i?on:i,s=o.plugins,c=void 0===s?rn:s,l=function(e,r,o){return o.startsWith(n)&&o.endsWith(n)&&o.replaceAll(n,"").length>0?".".concat(t):e},d=c.slice();d.push((function(e){e.type===Je&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(dr,n).replace(r,l))})),a.prefix&&d.push(Gt),d.push(Ft);var u=function(e,o,i,s){void 0===o&&(o=""),void 0===i&&(i=""),void 0===s&&(s="&"),t=s,n=o,r=new RegExp("\\".concat(n,"\\b"),"g");var c=e.replace(ur,""),l=zt(i||o?"".concat(i," ").concat(o," { ").concat(c," }"):c);a.namespace&&(l=pr(l,a.namespace));var u,p=[];return Ht(l,function(e){var t=pt(e);return function(n,r,o,i){for(var a="",s=0;s<t;s++)a+=e[s](n,r,o,i)||"";return a}}(d.concat((u=function(e){return p.push(e)},function(e){e.root||(e=e.return)&&u(e)})))),p};return u.hash=c.length?c.reduce((function(e,t){return t.name||Un(15),yn(e,t.name)}),5381).toString():"",u}(),mr=W.createContext({shouldForwardProp:void 0,styleSheet:hr,stylis:fr});function yr(){return q(mr)}W.createContext(void 0);var gr=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=fr);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,Hn(this,(function(){throw Un(12,String(n.name))}))}return e.prototype.getName=function(e){return void 0===e&&(e=fr),this.name+e.hash},e}(),vr=function(e){return e>="A"&&e<="Z"};function br(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(1===n&&"-"===r&&"-"===e[0])return e;vr(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var wr=function(e){return null==e||!1===e||""===e},kr=function(e){var t,n,r=[];for(var o in e){var i=e[o];e.hasOwnProperty(o)&&!wr(i)&&(Array.isArray(i)&&i.isCss||zn(i)?r.push("".concat(br(o),":"),i,";"):Bn(i)?r.push.apply(r,Fe(Fe(["".concat(o," {")],kr(i),!1),["}"],!1)):r.push("".concat(br(o),": ").concat((t=o,null==(n=i)||"boolean"==typeof n||""===n?"":"number"!=typeof n||0===n||t in Ut||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function _r(e,t,n,r){if(wr(e))return[];if(jn(e))return[".".concat(e.styledComponentId)];if(zn(e)){if(!zn(i=e)||i.prototype&&i.prototype.isReactComponent||!t)return[e];var o=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof o||Array.isArray(o)||o instanceof gr||Bn(o)||null===o||console.error("".concat(bn(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),_r(o,t,n,r)}var i;return e instanceof gr?n?(e.inject(n,r),[e.getName(r)]):[e]:Bn(e)?kr(e):Array.isArray(e)?Array.prototype.concat.apply(rn,e.map((function(e){return _r(e,t,n,r)}))):[e.toString()]}function Sr(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(zn(n)&&!jn(n))return!1}return!0}var xr=gn(Xt),Ir=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Sr(e),this.componentId=t,this.baseHash=yn(xr,t),this.baseStyle=n,lr.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))r=Ln(r,this.staticRulesId);else{var o=Mn(_r(this.rules,e,t,n)),i=fn(yn(this.baseHash,o)>>>0);if(!t.hasNameForId(this.componentId,i)){var a=n(o,".".concat(i),void 0,this.componentId);t.insertRules(this.componentId,i,a)}r=Ln(r,i),this.staticRulesId=i}else{for(var s=yn(this.baseHash,n.hash),c="",l=0;l<this.rules.length;l++){var d=this.rules[l];if("string"==typeof d)c+=d,"production"!==process.env.NODE_ENV&&(s=yn(s,d));else if(d){var u=Mn(_r(d,e,t,n));s=yn(s,u+l),c+=u}}if(c){var p=fn(s>>>0);t.hasNameForId(this.componentId,p)||t.insertRules(this.componentId,p,n(c,".".concat(p),void 0,this.componentId)),r=Ln(r,p)}}return r},e}(),Tr=W.createContext(void 0),Cr={},Ar=new Set;function Er(e,t,n){var r=jn(e),o=e,i=!wn(e),a=t.attrs,s=void 0===a?rn:a,c=t.componentId,l=void 0===c?function(e,t){var n="string"!=typeof e?"sc":dn(e);Cr[n]=(Cr[n]||0)+1;var r="".concat(n,"-").concat(vn(Xt+n+Cr[n]));return t?"".concat(t,"-").concat(r):r}(t.displayName,t.parentComponentId):c,d=t.displayName,u=void 0===d?function(e){return wn(e)?"styled.".concat(e):"Styled(".concat(bn(e),")")}(e):d,p=t.displayName&&t.componentId?"".concat(dn(t.displayName),"-").concat(t.componentId):t.componentId||l,h=r&&o.attrs?o.attrs.concat(s).filter(Boolean):s,f=t.shouldForwardProp;if(r&&o.shouldForwardProp){var m=o.shouldForwardProp;if(t.shouldForwardProp){var y=t.shouldForwardProp;f=function(e,t){return m(e,t)&&y(e,t)}}else f=m}var g=new Ir(n,p,r?o.componentStyle:void 0);function v(e,t){return function(e,t,n){var r=e.attrs,o=e.componentStyle,i=e.defaultProps,a=e.foldedComponentIds,s=e.styledComponentId,c=e.target,l=W.useContext(Tr),d=yr(),u=e.shouldForwardProp||d.shouldForwardProp;"production"!==process.env.NODE_ENV&&X(s);var p=an(t,l,i)||on,h=function(e,t,n){for(var r,o=He(He({},t),{className:void 0,theme:n}),i=0;i<e.length;i+=1){var a=zn(r=e[i])?r(o):r;for(var s in a)o[s]="className"===s?Ln(o[s],a[s]):"style"===s?He(He({},o[s]),a[s]):a[s]}return t.className&&(o.className=Ln(o.className,t.className)),o}(r,t,p),f=h.as||c,m={};for(var y in h)void 0===h[y]||"$"===y[0]||"as"===y||"theme"===y&&h.theme===p||("forwardedAs"===y?m.as=h.forwardedAs:u&&!u(y,f)||(m[y]=h[y],u||"development"!==process.env.NODE_ENV||We(y)||Ar.has(y)||!sn.has(f)||(Ar.add(y),console.warn('styled-components: it looks like an unknown prop "'.concat(y,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var g=function(e,t){var n=yr(),r=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return"production"!==process.env.NODE_ENV&&X(r),r}(o,h);"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(g);var v=Ln(a,s);return g&&(v+=" "+g),h.className&&(v+=" "+h.className),m[wn(f)&&!sn.has(f)?"class":"className"]=v,n&&(m.ref=n),K(f,m)}(b,e,t)}v.displayName=u;var b=W.forwardRef(v);return b.attrs=h,b.componentStyle=g,b.displayName=u,b.shouldForwardProp=f,b.foldedComponentIds=r?Ln(o.foldedComponentIds,o.styledComponentId):"",b.styledComponentId=p,b.target=r?o.target:e,Object.defineProperty(b,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=r?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0,o=t;r<o.length;r++)Vn(e,o[r],!0);return e}({},o.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(nn(u,p),b.warnTooManyClasses=function(e,t){var n={},r=!1;return function(o){if(!r&&(n[o]=!0,Object.keys(n).length>=200)){var i=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(i,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),r=!0,n={}}}}(u,p)),Hn(b,(function(){return".".concat(b.styledComponentId)})),i&&$n(b,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),b}function Pr(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n}var Nr=function(e){return Object.assign(e,{isCss:!0})};function Dr(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(zn(e)||Bn(e))return Nr(_r(Pr(rn,Fe([e],t,!0))));var r=e;return 0===t.length&&1===r.length&&"string"==typeof r[0]?_r(r):Nr(_r(Pr(r,t)))}function Or(e,t,n){if(void 0===n&&(n=on),!t)throw Un(1,t);var r=function(r){for(var o=[],i=1;i<arguments.length;i++)o[i-1]=arguments[i];return e(t,n,Dr.apply(void 0,Fe([r],o,!1)))};return r.attrs=function(r){return Or(e,t,He(He({},n),{attrs:Array.prototype.concat(n.attrs,r).filter(Boolean)}))},r.withConfig=function(r){return Or(e,t,He(He({},n),r))},r}var Rr=function(e){return Or(Er,e)},$r=Rr;sn.forEach((function(e){$r[e]=Rr(e)}));var zr=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Sr(e),lr.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,r){var o=r(Mn(_r(this.rules,t,n,r)),""),i=this.componentId+e;n.insertRules(i,i,o)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,n,r){e>2&&lr.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)},e}();"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");var jr="__sc-".concat(Wt,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[jr]||(window[jr]=0),1===window[jr]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window[jr]+=1);const Lr=$r.div`
2
- // Adapted from react-sortable-tree/style.css
3
- &[data-landing='true'] > *,
4
- &[data-cancel='true'] > * {
5
- opacity: 0 !important;
6
- }
7
- &[data-landing='true']::before,
8
- &[data-cancel='true']::before {
9
- background-color: ${"#e7fefe"};
10
- border: 2px dashed ${Be.hex};
11
- border-radius: 3px;
12
- content: '';
13
- position: absolute;
14
- top: 0;
15
- right: 0;
16
- bottom: 0;
17
- left: 0;
18
- z-index: -1;
19
- }
20
-
21
- &[data-cancel='true']::before {
22
- background-color: ${"#fff6f5"};
23
- }
24
- `,Mr=e=>{const{node:t,path:n,treeIndex:r,canDrag:o=!1}=e,i=t.title,a=U.useMemo((()=>{if(!o)return null;if("function"==typeof t.children&&t.expanded)return m(G,{});const n=m("div",{children:m(F,{mode:"bleed",paddingX:0,paddingY:1,style:{cursor:t.publishedId?"grab":"default",fontSize:"1.5625rem"},"data-ui":"DragHandleButton","data-drag-handle":o,disabled:!t.publishedId,children:m(C,{style:{marginBottom:"-0.1em"}})})});return t.publishedId?e.connectDragSource(n,{dropEffect:"copy"}):n}),[o,t,"function"==typeof t.children]),s=e.draggedNode&&ne(e.draggedNode,t),c=!e.didDrop&&e.isDragging;return y($,{style:{position:"relative"},children:[e.toggleChildrenVisibility&&t.children&&(t.children.length>0||"function"==typeof t.children)&&m("div",{style:{position:"absolute",left:"-2px",top:"40%",transform:"translate(-100%, -50%)"},children:m(F,{"aria-label":t.expanded?"Collapse":"Expand",icon:t.expanded?m(I,{color:Me.hex}):m(T,{color:Me.hex}),mode:"bleed",fontSize:2,padding:1,type:"button",onClick:()=>e.toggleChildrenVisibility?.({node:t,path:n,treeIndex:r})})}),e.connectDragPreview(m("div",{children:m(Lr,{"data-landing":c,"data-cancel":c&&!e.canDrop,style:{opacity:s?.5:1},children:y(L,{align:"center",children:[a,"function"==typeof i?i(e):i]})})}))]})},Br=e=>{const t=e.isOver&&e.canDrop,n=e.isOver&&!e.canDrop;let r="transparent";return t&&(r="positive"),n&&(r="caution"),m($,{padding:3,children:m(N,{padding:5,radius:2,border:!0,tone:r,style:{borderStyle:e.isOver?void 0:"dashed"},children:y(D,{space:2,style:{textAlign:"center"},children:[y(R,{size:2,as:"h2",muted:!0,children:[!e.isOver&&e.title,t&&"Drop here",n&&"Invalid location or element"]}),e.subtitle&&m(R,{size:1,children:e.subtitle}),e.children]})})})},Vr=(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Dr.apply(void 0,Fe([e],t,!1)),o="sc-global-".concat(vn(JSON.stringify(r))),i=new zr(r,o);"production"!==process.env.NODE_ENV&&nn(o);var a=function(e){var t=yr(),n=W.useContext(Tr),s=W.useRef(t.styleSheet.allocateGSInstance(o)).current;return"production"!==process.env.NODE_ENV&&W.Children.count(e.children)&&console.warn("The global style component ".concat(o," was given child JSX. createGlobalStyle does not render children.")),"production"!==process.env.NODE_ENV&&r.some((function(e){return"string"==typeof e&&-1!==e.indexOf("@import")}))&&console.warn("Please do not use @import CSS syntax in createGlobalStyle at this time, as the CSSOM APIs we use in production do not handle it well. Instead, we recommend using a library such as react-helmet to inject a typical <link> meta tag to the stylesheet, or simply embedding it manually in your index.html <head> section for a simpler app."),t.styleSheet.server&&function(e,t,n,r,o){if(i.isStatic)i.renderStyles(e,Qt,n,o);else{var s=He(He({},t),{theme:an(t,r,a.defaultProps)});i.renderStyles(e,s,n,o)}}(s,e,t.styleSheet,n,t.stylis),null};return W.memo(a)})`
25
- .rst__lineBlock,
26
- .rst__absoluteLineBlock {
27
- height: 100%;
28
- position: relative;
29
- display: inline-block;
30
- --stroke-width: 3px;
31
- }
32
-
33
- .rst__absoluteLineBlock {
34
- position: absolute;
35
- top: 0;
36
- }
37
-
38
- /* Highlight line for pointing to dragged row destination
39
- ========================================================================== */
40
- /**
41
- * +--+--+
42
- * | | |
43
- * | | |
44
- * | | |
45
- * +--+--+
46
- */
47
- .rst__highlightLineVertical {
48
- z-index: 3;
49
- }
50
- .rst__highlightLineVertical::before {
51
- position: absolute;
52
- content: '';
53
- background-color: ${Ve.hex};
54
- width: calc(var(--stroke-width) * 2);
55
- margin-left: calc(var(--stroke-width) * -1);
56
- left: 50%;
57
- top: 0;
58
- height: 100%;
59
- }
60
-
61
- @keyframes arrow-pulse {
62
- 0% {
63
- transform: translate(0, 0);
64
- opacity: 0;
65
- }
66
- 30% {
67
- transform: translate(0, 300%);
68
- opacity: 1;
69
- }
70
- 70% {
71
- transform: translate(0, 700%);
72
- opacity: 1;
73
- }
74
- 100% {
75
- transform: translate(0, 1000%);
76
- opacity: 0;
77
- }
78
- }
79
- .rst__highlightLineVertical::after {
80
- content: '';
81
- position: absolute;
82
- height: 0;
83
- margin-left: calc(var(--stroke-width) * -1);
84
- left: 50%;
85
- top: 0;
86
- border-left: var(--stroke-width) solid transparent;
87
- border-right: var(--stroke-width) solid transparent;
88
- border-top: var(--stroke-width) solid white;
89
- animation: arrow-pulse 1s infinite linear both;
90
- }
91
-
92
- /**
93
- * +-----+
94
- * | |
95
- * | +--+
96
- * | | |
97
- * +--+--+
98
- */
99
- .rst__highlightTopLeftCorner::before {
100
- z-index: 3;
101
- content: '';
102
- position: absolute;
103
- border-top: solid calc(var(--stroke-width) * 2) ${Ve.hex};
104
- border-left: solid calc(var(--stroke-width) * 2) ${Ve.hex};
105
- box-sizing: border-box;
106
- height: calc(50% + var(--stroke-width));
107
- top: 50%;
108
- margin-top: calc(var(--stroke-width) * -1);
109
- right: 0;
110
- width: calc(50% + var(--stroke-width));
111
- }
112
-
113
- /**
114
- * +--+--+
115
- * | | |
116
- * | | |
117
- * | +->|
118
- * +-----+
119
- */
120
- .rst__highlightBottomLeftCorner {
121
- z-index: 3;
122
- }
123
- .rst__highlightBottomLeftCorner::before {
124
- content: '';
125
- position: absolute;
126
- border-bottom: solid calc(var(--stroke-width) * 2) ${Ve.hex};
127
- border-left: solid calc(var(--stroke-width) * 2) ${Ve.hex};
128
- box-sizing: border-box;
129
- height: calc(100% + var(--stroke-width));
130
- top: 0;
131
- right: calc(var(--stroke-width) * 3);
132
- width: calc(50% - calc(var(--stroke-width) * 2));
133
- }
134
-
135
- .rst__highlightBottomLeftCorner::after {
136
- content: '';
137
- position: absolute;
138
- height: 0;
139
- right: 0;
140
- top: 100%;
141
- margin-top: calc(var(--stroke-width) * -3);
142
- border-top: calc(var(--stroke-width) * 3) solid transparent;
143
- border-bottom: calc(var(--stroke-width) * 3) solid transparent;
144
- border-left: calc(var(--stroke-width) * 3) solid ${Ve.hex};
145
- }
146
-
147
- .rst__unclickable {
148
- pointer-events: none;
149
- margin-top: -calc(var(--stroke-width) * 3);
150
- }
151
- `,Hr=e=>{const{lowerSiblingCounts:t,scaffoldBlockPxWidth:n,listIndex:r,swapDepth:o,swapFrom:i,swapLength:a,treeIndex:s}=e,c=t.map(((e,t)=>{if(e<0||s===r||t!==o)return null;let c="";c=r===(i||0)+(a||0)-1?"rst__highlightBottomLeftCorner":s===i?"rst__highlightTopLeftCorner":"rst__highlightLineVertical";return m("div",{style:{width:n,left:n*t},className:`rst__unclickable rst__absoluteLineBlock ${c||""}`,tabIndex:-1},t)}));return y(g,{children:[c,m(Vr,{})]})},Fr=e=>{const{children:t,lowerSiblingCounts:n,connectDropTarget:r,isOver:o,draggedNode:i,canDrop:a}=e,s=n.length;return r(y("div",{style:e.style,children:[m("div",{style:{paddingLeft:10+14*s+"px"},children:U.Children.map(t,(e=>U.cloneElement(e,{isOver:o,canDrop:a,draggedNode:i})))}),m(Hr,{...e})]}))};const Gr=e=>e.children,Ur=e=>{const{status:n,allItems:r}=function(e){const n=t({apiVersion:"2021-09-01"}),[r,o]=U.useState("loading"),[i,a]=U.useReducer(fe,{});function s(e){"mutation"===e.type&&(e.result?a({type:"addOrEditItem",item:e.result}):a({type:"removeItem",itemId:e.documentId}))}function c(e){a({type:"setInitialData",items:e}),o("success")}return U.useEffect((()=>{const{filter:t,params:r}=function(e){let{referenceTo:t,referenceOptions:n}=e;const r=["_type in $docTypes"];return n?.filter&&r.push(n.filter),{filter:r.join(" && "),params:{...n?.filterParams||{},docTypes:t.map((e=>e))}}}(e),i=`*[${t}] {\n _id,\n _type,\n _updatedAt,\n }`;n.fetch(i,r).then(c).catch((()=>{o("error")}));const a=n.listen(i,r).subscribe(s);return()=>{a.unsubscribe()}}),[]),{status:r,allItems:i}}(e.options),o=(i={tree:e.tree,allItems:r}).tree?Object.entries(i.allItems).filter((e=>{let[t]=e;return t&&!i.tree.some((e=>e?.value?.reference?._ref===t))})).map((e=>{let[,t]=e;return De(t)})).filter(Boolean):Object.entries(i.allItems).map((e=>De(e[1]))).filter(Boolean);var i;const{localTree:a,handleVisibilityToggle:s}=function(e){let{tree:t,allItems:n}=e;const[r,o]=U.useState({});return{localTree:Ne({tree:t,allItems:n,visibilityMap:r}),handleVisibilityToggle:function(e){o({...r,[e.node._key]:e.expanded})}}}({tree:e.tree,allItems:r}),c=Le({patchPrefix:e.patchPrefix,onChange:e.onChange,localTree:a}),[l,d]=U.useState(null),[u,p]=U.useState(""),h=()=>{const t=document.querySelector(`#${e.options.documentId} [data-known-size]`),n=Number(t?.dataset.knownSize||51);p(function(e,t){return 50+t*re({treeData:e})+"px"}(a,n))};U.useEffect((()=>{e.options.documentId&&d(document.getElementById(e.options.documentId))}),[e.options.documentId]),U.useEffect((()=>{setTimeout(h)}),[]),U.useEffect((()=>{h()}),[e.options.documentId,a]);const f=J((e=>c.handleMovedNode(e)),[c]),g=Z((()=>function(e){let{placeholder:t}=e;return{theme:{nodeContentRenderer:Mr,placeholderRenderer:e=>m(Br,{...t,...e}),treeNodeRenderer:Fr,style:{height:"100%"},innerStyle:void 0,scaffoldBlockPxWidth:44,slideRegionSize:100}}}({placeholder:{title:"Add items from the list below"}})),[]),v=Z((()=>({...c,allItemsStatus:n})),[c,n]);return m(Gr,{children:m($,{id:e.options.documentId,children:l?m(oe,{backend:ie,options:{rootElement:l},children:m(ye.Provider,{value:v,children:y(D,{space:4,paddingTop:4,children:[m(N,{style:{minHeight:u},borderBottom:"success"!==n||o?.length>0,children:m(Q,{maxDepth:e.options.maxDepth,onChange:Yr,onVisibilityToggle:s,canDrop:Wr,onMoveNode:f,treeData:a,...g})}),"success"===n&&o?.length>0&&y(D,{space:1,paddingX:2,paddingTop:3,children:[y(D,{space:2,paddingX:2,paddingBottom:3,children:[m(R,{size:2,as:"h2",weight:"semibold",children:"Add more items"}),m(R,{size:1,muted:!0,children:"Only published documents are shown."})]}),o.map((e=>m(_e,{item:e,action:m(j,{portal:!0,placement:"left",content:m($,{padding:2,children:m(R,{size:1,children:"Add to list"})}),children:m(F,{onClick:()=>{c.addItem(e)},mode:"bleed",icon:A,style:{cursor:"pointer"}})})},e.publishedId||e.draftId)))]}),"loading"===n&&m(L,{padding:4,align:"center",justify:"center",children:m(G,{size:3,muted:!0})}),"error"===n&&m(L,{padding:4,align:"center",justify:"center",children:m(R,{size:2,weight:"semibold",children:"Something went wrong when loading documents"})})]})})}):null})})};function Wr(e){let{nextPath:t,prevPath:n}=e;return!(t.length>=n.length&&n.every(((e,n)=>t[n]===e)))}const Yr=()=>{};function qr(e){const t=ce(e.path||[]);if("insert"===e.type){const{position:n,items:r}=e;return{insert:{[n]:t,items:r}}}if("unset"===e.type)return{unset:[t]};if(!e.type)throw new Error(`Missing patch type in patch ${JSON.stringify(e)}`);return t?{[e.type]:{[t]:e.value}}:{[e.type]:e.value}}const Xr="tree",Kr=e=>{const t=e.options.documentType||Te,n=e.options.fieldKeyInDocument||Xr,{published:r,draft:o,liveEdit:i}=d(e.options.documentId,t),{patch:a}=u(e.options.documentId,t),s=r?.[n]||[],c=U.useCallback((e=>{a?.execute&&a.execute(Pe(e.patches,t).map(qr))}),[a]);return U.useEffect((()=>{r?._id||!a?.execute||a?.disabled||a.execute([{setIfMissing:{[n]:[]}}])}),[r?._id,a]),i?o?._id?m(de,{title:"This hierarchy tree contains a draft",subtitle:"Click on the button below to publish your draft in order to continue editing the live\n published document."}):r?._id?m($,{paddingBottom:5,paddingRight:2,children:m(Ur,{options:e.options,tree:s,onChange:c,patchPrefix:n})}):m(L,{padding:5,align:"center",justify:"center",height:"fill",children:m(G,{width:4,muted:!0})}):m(de,{title:"Invalid configuration",subtitle:"The `documentType` passed to `createDeskHiearchy` isn't live editable. \\nTo continue using this plugin, add `liveEdit: true` to your custom schema type or unset `documentType` in your hierarchy configuration."})},Jr={invalidDocumentId:"Please add a documentId to your tree",invalidDocumentType:"Please add a valid documentType to createHierarchicalSchemas",invalidReferenceTo:"Missing valid 'referenceTo' value"};function Zr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";throw new Error(`[hierarchical input] ${Jr[e]} ${t}`)}const Qr=e=>{const{documentId:t,referenceTo:n}=e;return"string"==typeof t||t||Zr("invalidDocumentId"),Array.isArray(n)||Zr("invalidReferenceTo",`(documentId "${t}")`),t=>m(Kr,{...t,options:e})};function eo(e){const{documentId:t,referenceTo:n,referenceOptions:r,context:o,S:i,creatableTypes:a}=e;if(!i||!o)throw new Error("Invalid configuration. S or context props are undefined. These props are available as function parameters when configuring structure, and must be passed along to createDeskHierarchy. Confer the plugin README for example usage.");const{schema:s}=o,c=a&&!a.some((e=>n.indexOf(e)))?a:n;let l=(1===n?.length?i.documentTypeList(n[0]).schemaType(n[0]):i.documentList().filter("_type in $types").params({types:n})).id(t).menuItems((c||[]).map((e=>i.menuItem().intent({type:"create",params:{type:e}}).title(`Create ${s.get(e)?.title}`).icon(s.get(e)?.icon||E)))).canHandleIntent(((t,n)=>"edit"===t&&n.id===e.documentId||!!c.includes(n.type)));return r?.filter&&(l=l.filter(r.filter)),r?.filterParams&&(l=l.params(r.filterParams)),i.listItem().id(t).title(e.title||t).icon(e.icon).child(Object.assign(l.serialize(),{type:"component",component:Qr(e),options:e,__preserveInstance:!0},e.title?{title:e.title}:{}))}const to=e=>{const t=e.type.options.documentType||Te,n=U.useCallback((n=>{const r=Pe(n?.patches,t);e.onChange(new c(r))}),[e.onChange]);return m(p,{description:e.type.description,title:e.type.title,__unstable_presence:e.presence,children:m(Ur,{options:e.type.options,tree:e.value||[],onChange:n})})};function no(e){let{referenceTo:t,referenceOptions:n,documentType:r}=e;return{name:r?Ie(r,"nodeValue"):Ae,type:"object",title:`Hierarchical node value (${r})`,fields:[{name:"docType",type:"string"},{name:"reference",type:"reference",weak:!0,to:t.map((e=>({type:e}))),options:n}]}}function ro(e){return{name:e.documentType?Ie(e.documentType,"node"):Ce,title:`Hierarchical node (${e.documentType})`,type:"object",fields:[{name:"parent",type:"string"},e.documentType?{name:"value",type:Ie(e.documentType,"nodeValue")}:{...no(e),name:"value",type:"object"}]}}function oo(e){return{name:e.documentType?Ie(e.documentType,"array"):Ee,title:`Hierarchical array of nodes (${e.documentType})`,type:"array",of:[e.documentType?{type:Ie(e.documentType,"node")}:ro(e)]}}function io(e){let{name:t,title:n,options:r,...o}=e;return Array.isArray(r?.referenceTo)||Zr("invalidReferenceTo",`(field of name "${t}")`),{...o,name:t,title:n,inputComponent:to,options:r,...r.documentType?{type:Ie(r.documentType,"array")}:{...oo(r),name:t}}}function ao(e){return{name:e.documentType,title:"Hierarchical tree",type:"document",liveEdit:!0,fields:[io({name:e.fieldKeyInDocument||Xr,title:"Hierarchical Tree",options:e})],preview:{select:{id:"_id",tree:"tree"},prepare(e){let{id:t,tree:n}=e;return{title:`Hierarchical documents (ID: ${t})`,subtitle:`${n?.length||0} document(s) in its list.`}}}}}function so(e){return(!Array.isArray(e.referenceTo)||e.referenceTo.length<=0)&&Zr("invalidReferenceTo"),e.documentType||Zr("invalidDocumentType"),[ao(e),oo(e),ro(e),no(e)]}var co=h({name:"hierarchy.tree",title:"Hierarchical tree",type:"document",liveEdit:!0,fields:[{name:"unusedField",title:"Unused field",type:"string",hidden:!0}]});const lo=f({name:"sanity-plugin-hierarchical-document-list"});export{eo as createDeskHierarchy,so as createHierarchicalSchemas,xe as flatDataToTree,lo as hierarchicalDocumentList,co as hierarchyTree};//# sourceMappingURL=index.esm.js.map