sanity-plugin-taxonomy-manager
Version:
Create and manage SKOS compliant taxonomies, thesauri, and classification schemes in Sanity Studio.
142 lines • 92 kB
JavaScript
import{useFormValue as e,set as t,useDocumentStore as n,useClient as r,isPublishedId as o,useColorSchemeValue as i,usePerspective as a,isDraftId as s,isVersionId as c,unset as l,defineField as d,defineType as p,defineArrayMember as h,definePlugin as u}from"sanity";import{usePaneRouter as f,structureTool as m}from"sanity/structure";import g,{useCallback as y,useDebugValue as v,createElement as b,useRef as w,useContext as C,useState as _,useEffect as k,useMemo as S,createContext as I}from"react";import x from"react-fast-compare";import{distinctUntilChanged as N,catchError as O}from"rxjs/operators";import{jsxs as P,jsx as E,Fragment as T}from"react/jsx-runtime";import{Stack as A,Text as R,useToast as V,Inline as $,Button as z,Card as M,Dialog as H,Box as D,Label as j,Tooltip as L,TextInput as F,TextArea as U,Flex as B,Spinner as q,Container as G,Grid as Z}from"@sanity/ui";import{hues as W}from"@sanity/color";import{isVersionId as Y,getVersionNameFromId as K,getVersionId as X,DocumentId as J,getDraftId as Q,getPublishedId as ee}from"@sanity/id-utils";import{InfoOutlineIcon as te,ToggleArrowRightIcon as ne,SquareIcon as re,AddCircleIcon as oe,TrashIcon as ie,ErrorOutlineIcon as ae,AddIcon as se,WarningOutlineIcon as ce,EditIcon as le}from"@sanity/icons";import{nanoid as de}from"nanoid";import{RouterContext as pe}from"sanity/router";import{AiOutlineTags as he,AiOutlineTag as ue}from"react-icons/ai";const fe=e=>{const{onChange:n}=e,r=V(),o=y((()=>{n(t(de(6))),r.push({status:"success",title:"Identifier created.",closable:!0})}),[n,r]);return E(A,{space:2,children:E($,{space:[3,3,4],children:E(z,{tone:"primary",fontSize:2,onClick:o,text:"Generate Identifier"})})})};var me=function(){return me=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},me.apply(this,arguments)};function ge(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 ye(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var ve=/^((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)-.*))$/,be=ye((function(e){return ve.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91})),we="-ms-",Ce="-moz-",_e="-webkit-",ke="comm",Se="rule",Ie="decl",xe="@import",Ne="@keyframes",Oe="@layer",Pe=Math.abs,Ee=String.fromCharCode,Te=Object.assign;function Ae(e){return e.trim()}function Re(e,t){return(e=t.exec(e))?e[0]:e}function Ve(e,t,n){return e.replace(t,n)}function $e(e,t,n){return e.indexOf(t,n)}function ze(e,t){return 0|e.charCodeAt(t)}function Me(e,t,n){return e.slice(t,n)}function He(e){return e.length}function De(e){return e.length}function je(e,t){return t.push(e),e}function Le(e,t){return e.filter((function(e){return!Re(e,t)}))}var Fe=1,Ue=1,Be=0,qe=0,Ge=0,Ze="";function We(e,t,n,r,o,i,a,s){return{value:e,root:t,parent:n,type:r,props:o,children:i,line:Fe,column:Ue,length:a,return:"",siblings:s}}function Ye(e,t){return Te(We("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function Ke(e){for(;e.root;)e=Ye(e.root,{children:[e]});je(e,e.siblings)}function Xe(){return Ge=qe<Be?ze(Ze,qe++):0,Ue++,10===Ge&&(Ue=1,Fe++),Ge}function Je(){return ze(Ze,qe)}function Qe(){return qe}function et(e,t){return Me(Ze,e,t)}function tt(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 nt(e){return Ae(et(qe-1,it(91===e?e+2:40===e?e+1:e)))}function rt(e){for(;(Ge=Je())&&Ge<33;)Xe();return tt(e)>2||tt(Ge)>3?"":" "}function ot(e,t){for(;--t&&Xe()&&!(Ge<48||Ge>102||Ge>57&&Ge<65||Ge>70&&Ge<97););return et(e,Qe()+(t<6&&32==Je()&&32==Xe()))}function it(e){for(;Xe();)switch(Ge){case e:return qe;case 34:case 39:34!==e&&39!==e&&it(Ge);break;case 40:41===e&&it(e);break;case 92:Xe()}return qe}function at(e,t){for(;Xe()&&e+Ge!==57&&(e+Ge!==84||47!==Je()););return"/*"+et(t,qe-1)+"*"+Ee(47===e?e:Xe())}function st(e){for(;!tt(Je());)Xe();return et(e,qe)}function ct(e){return function(e){return Ze="",e}(lt("",null,null,null,[""],e=function(e){return Fe=Ue=1,Be=He(Ze=e),qe=0,[]}(e),0,[0],e))}function lt(e,t,n,r,o,i,a,s,c){for(var l=0,d=0,p=a,h=0,u=0,f=0,m=1,g=1,y=1,v=0,b="",w=o,C=i,_=r,k=b;g;)switch(f=v,v=Xe()){case 40:if(108!=f&&58==ze(k,p-1)){-1!=$e(k+=Ve(nt(v),"&","&\f"),"&\f",Pe(l?s[l-1]:0))&&(y=-1);break}case 34:case 39:case 91:k+=nt(v);break;case 9:case 10:case 13:case 32:k+=rt(f);break;case 92:k+=ot(Qe()-1,7);continue;case 47:switch(Je()){case 42:case 47:je(pt(at(Xe(),Qe()),t,n,c),c);break;default:k+="/"}break;case 123*m:s[l++]=He(k)*y;case 125*m:case 59:case 0:switch(v){case 0:case 125:g=0;case 59+d:-1==y&&(k=Ve(k,/\f/g,"")),u>0&&He(k)-p&&je(u>32?ht(k+";",r,n,p-1,c):ht(Ve(k," ","")+";",r,n,p-2,c),c);break;case 59:k+=";";default:if(je(_=dt(k,t,n,l,d,o,s,b,w=[],C=[],p,i),i),123===v)if(0===d)lt(k,t,_,_,w,i,p,s,C);else switch(99===h&&110===ze(k,3)?100:h){case 100:case 108:case 109:case 115:lt(e,_,_,r&&je(dt(e,_,_,0,0,o,s,b,o,w=[],p,C),C),o,C,p,s,r?w:C);break;default:lt(k,_,_,_,[""],C,0,s,C)}}l=d=u=0,m=y=1,b=k="",p=a;break;case 58:p=1+He(k),u=f;default:if(m<1)if(123==v)--m;else if(125==v&&0==m++&&125==(Ge=qe>0?ze(Ze,--qe):0,Ue--,10===Ge&&(Ue=1,Fe--),Ge))continue;switch(k+=Ee(v),v*m){case 38:y=d>0?1:(k+="\f",-1);break;case 44:s[l++]=(He(k)-1)*y,y=1;break;case 64:45===Je()&&(k+=nt(Xe())),h=Je(),d=p=He(b=k+=st(Qe())),v++;break;case 45:45===f&&2==He(k)&&(m=0)}}return i}function dt(e,t,n,r,o,i,a,s,c,l,d,p){for(var h=o-1,u=0===o?i:[""],f=De(u),m=0,g=0,y=0;m<r;++m)for(var v=0,b=Me(e,h+1,h=Pe(g=a[m])),w=e;v<f;++v)(w=Ae(g>0?u[v]+" "+b:Ve(b,/&\f/g,u[v])))&&(c[y++]=w);return We(e,t,n,0===o?Se:s,c,l,d,p)}function pt(e,t,n,r){return We(e,t,n,ke,Ee(Ge),Me(e,2,-2),0,r)}function ht(e,t,n,r,o){return We(e,t,n,Ie,Me(e,0,r),Me(e,r+1,-1),r,o)}function ut(e,t,n){switch(function(e,t){return 45^ze(e,0)?(((t<<2^ze(e,0))<<2^ze(e,1))<<2^ze(e,2))<<2^ze(e,3):0}(e,t)){case 5103:return _e+"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 _e+e+e;case 4789:return Ce+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return _e+e+Ce+e+we+e+e;case 5936:switch(ze(e,t+11)){case 114:return _e+e+we+Ve(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return _e+e+we+Ve(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return _e+e+we+Ve(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return _e+e+we+e+e;case 6165:return _e+e+we+"flex-"+e+e;case 5187:return _e+e+Ve(e,/(\w+).+(:[^]+)/,_e+"box-$1$2"+we+"flex-$1$2")+e;case 5443:return _e+e+we+"flex-item-"+Ve(e,/flex-|-self/g,"")+(Re(e,/flex-|baseline/)?"":we+"grid-row-"+Ve(e,/flex-|-self/g,""))+e;case 4675:return _e+e+we+"flex-line-pack"+Ve(e,/align-content|flex-|-self/g,"")+e;case 5548:return _e+e+we+Ve(e,"shrink","negative")+e;case 5292:return _e+e+we+Ve(e,"basis","preferred-size")+e;case 6060:return _e+"box-"+Ve(e,"-grow","")+_e+e+we+Ve(e,"grow","positive")+e;case 4554:return _e+Ve(e,/([^-])(transform)/g,"$1"+_e+"$2")+e;case 6187:return Ve(Ve(Ve(e,/(zoom-|grab)/,_e+"$1"),/(image-set)/,_e+"$1"),e,"")+e;case 5495:case 3959:return Ve(e,/(image-set\([^]*)/,_e+"$1$`$1");case 4968:return Ve(Ve(e,/(.+:)(flex-)?(.*)/,_e+"box-pack:$3"+we+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+_e+e+e;case 4200:if(!Re(e,/flex-|baseline/))return we+"grid-column-align"+Me(e,t)+e;break;case 2592:case 3360:return we+Ve(e,"template-","")+e;case 4384:case 3616:return n&&n.some((function(e,n){return t=n,Re(e.props,/grid-\w+-end/)}))?~$e(e+(n=n[t].value),"span",0)?e:we+Ve(e,"-start","")+e+we+"grid-row-span:"+(~$e(n,"span",0)?Re(n,/\d+/):+Re(n,/\d+/)-+Re(e,/\d+/))+";":we+Ve(e,"-start","")+e;case 4896:case 4128:return n&&n.some((function(e){return Re(e.props,/grid-\w+-start/)}))?e:we+Ve(Ve(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return Ve(e,/(.+)-inline(.+)/,_e+"$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(He(e)-1-t>6)switch(ze(e,t+1)){case 109:if(45!==ze(e,t+4))break;case 102:return Ve(e,/(.+:)(.+)-([^]+)/,"$1"+_e+"$2-$3$1"+Ce+(108==ze(e,t+3)?"$3":"$2-$3"))+e;case 115:return~$e(e,"stretch",0)?ut(Ve(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return Ve(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(t,n,r,o,i,a,s){return we+n+":"+r+s+(o?we+n+"-span:"+(i?a:+a-+r)+s:"")+e}));case 4949:if(121===ze(e,t+6))return Ve(e,":",":"+_e)+e;break;case 6444:switch(ze(e,45===ze(e,14)?18:11)){case 120:return Ve(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+_e+(45===ze(e,14)?"inline-":"")+"box$3$1"+_e+"$2$3$1"+we+"$2box$3")+e;case 100:return Ve(e,":",":"+we)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return Ve(e,"scroll-","scroll-snap-")+e}return e}function ft(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function mt(e,t,n,r){switch(e.type){case Oe:if(e.children.length)break;case xe:case Ie:return e.return=e.return||e.value;case ke:return"";case Ne:return e.return=e.value+"{"+ft(e.children,r)+"}";case Se:if(!He(e.value=e.props.join(",")))return""}return He(n=ft(e.children,r))?e.return=e.value+"{"+n+"}":""}function gt(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Ie:return void(e.return=ut(e.value,e.length,n));case Ne:return ft([Ye(e,{value:Ve(e.value,"@","@"+_e)})],r);case Se:if(e.length)return function(e,t){return e.map(t).join("")}(n=e.props,(function(t){switch(Re(t,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Ke(Ye(e,{props:[Ve(t,/:(read-\w+)/,":"+Ce+"$1")]})),Ke(Ye(e,{props:[t]})),Te(e,{props:Le(n,r)});break;case"::placeholder":Ke(Ye(e,{props:[Ve(t,/:(plac\w+)/,":"+_e+"input-$1")]})),Ke(Ye(e,{props:[Ve(t,/:(plac\w+)/,":"+Ce+"$1")]})),Ke(Ye(e,{props:[Ve(t,/:(plac\w+)/,we+"input-$1")]})),Ke(Ye(e,{props:[t]})),Te(e,{props:Le(n,r)})}return""}))}}var yt={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},vt=typeof process<"u"&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",bt="active",wt="data-styled-version",Ct="6.1.12",_t="/*!sc*/\n",kt=typeof window<"u"&&"HTMLElement"in window,St=!!("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:typeof process<"u"&&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:typeof process<"u"&&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),It=/invalid hook call/i,xt=new Set,Nt=Object.freeze([]),Ot=Object.freeze({});var Pt=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"]),Et=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Tt=/(^-|-$)/g;function At(e){return e.replace(Et,"-").replace(Tt,"")}var Rt=/(a)(d)/gi,Vt=52,$t=function(e){return String.fromCharCode(e+(e>25?39:97))};function zt(e){var t,n="";for(t=Math.abs(e);t>Vt;t=t/Vt|0)n=$t(t%Vt)+n;return($t(t%Vt)+n).replace(Rt,"$1-$2")}var Mt,Ht=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Dt=function(e){return Ht(5381,e)};function jt(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function Lt(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var Ft="function"==typeof Symbol&&Symbol.for,Ut=Ft?Symbol.for("react.memo"):60115,Bt=Ft?Symbol.for("react.forward_ref"):60112,qt={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Gt={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Zt={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Wt=((Mt={})[Bt]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Mt[Ut]=Zt,Mt);function Yt(e){return("type"in(t=e)&&t.type.$$typeof)===Ut?Zt:"$$typeof"in e?Wt[e.$$typeof]:qt;var t}var Kt=Object.defineProperty,Xt=Object.getOwnPropertyNames,Jt=Object.getOwnPropertySymbols,Qt=Object.getOwnPropertyDescriptor,en=Object.getPrototypeOf,tn=Object.prototype;function nn(e,t,n){if("string"!=typeof t){if(tn){var r=en(t);r&&r!==tn&&nn(e,r,n)}var o=Xt(t);Jt&&(o=o.concat(Jt(t)));for(var i=Yt(e),a=Yt(t),s=0;s<o.length;++s){var c=o[s];if(!(c in Gt||n&&n[c]||a&&c in a||i&&c in i)){var l=Qt(t,c);try{Kt(e,c,l)}catch{}}}}return e}function rn(e){return"function"==typeof e}function on(e){return"object"==typeof e&&"styledComponentId"in e}function an(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function sn(e,t){if(0===e.length)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function cn(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function ln(e,t,n){if(void 0===n&&(n=!1),!n&&!cn(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=ln(e[r],t[r]);else if(cn(t))for(var r in t)e[r]=ln(e[r],t[r]);return e}function dn(e,t){Object.defineProperty(e,"toString",{value:t})}var pn="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 hn(){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(hn.apply(void 0,ge([pn[e]],t,!1)).trim())}var fn=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(_t);return t},e}(),mn=1<<30,gn=new Map,yn=new Map,vn=1,bn=function(e){if(gn.has(e))return gn.get(e);for(;yn.has(vn);)vn++;var t=vn++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>mn))throw un(16,"".concat(t));return gn.set(e,t),yn.set(t,e),t},wn=function(e,t){vn=t+1,gn.set(e,t),yn.set(t,e)},Cn="style[".concat(vt,"][").concat(wt,'="').concat(Ct,'"]'),_n=new RegExp("^".concat(vt,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),kn=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)},Sn=function(e,t){for(var n,r=(null!==(n=t.textContent)&&void 0!==n?n:"").split(_t),o=[],i=0,a=r.length;i<a;i++){var s=r[i].trim();if(s){var c=s.match(_n);if(c){var l=0|parseInt(c[1],10),d=c[2];0!==l&&(wn(d,l),kn(e,d,c[3]),e.getTag().insertRules(l,o)),o.length=0}else o.push(s)}}},In=function(e){for(var t=document.querySelectorAll(Cn),n=0,r=t.length;n<r;n++){var o=t[n];o&&o.getAttribute(vt)!==bt&&(Sn(e,o),o.parentNode&&o.parentNode.removeChild(o))}};var xn=function(e){var t,n,r=document.head,o=e||r,i=document.createElement("style"),a=(t=o,(n=Array.from(t.querySelectorAll("style[".concat(vt,"]"))))[n.length-1]),s=void 0!==a?a.nextSibling:null;i.setAttribute(vt,bt),i.setAttribute(wt,Ct);var c=typeof __webpack_nonce__<"u"?__webpack_nonce__:null;return c&&i.setAttribute("nonce",c),o.insertBefore(i,s),i},Nn=function(){function e(e){this.element=xn(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{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}(),On=function(){function e(e){this.element=xn(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}(),Pn=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}(),En=kt,Tn={isServer:!kt,useCSSOMInjection:!St},An=function(){function e(e,t,n){void 0===e&&(e=Ot),void 0===t&&(t={});var r=this;this.options=me(me({},Tn),e),this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&kt&&En&&(En=!1,In(this)),dn(this,(function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=function(n){var o,i=(o=n,yn.get(o));if(void 0===i)return"continue";var a=e.names.get(i),s=t.getGroup(n);if(void 0===a||!a.size||0===s.length)return"continue";var c="".concat(vt,".g").concat(n,'[id="').concat(i,'"]'),l="";void 0!==a&&a.forEach((function(e){e.length>0&&(l+="".concat(e,","))})),r+="".concat(s).concat(c,'{content:"').concat(l,'"}').concat(_t)},i=0;i<n;i++)o(i);return r}(r)}))}return e.registerId=function(e){return bn(e)},e.prototype.rehydrate=function(){!this.server&&kt&&In(this)},e.prototype.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(me(me({},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=this.options,t=e.useCSSOMInjection,n=e.target,r=e.isServer?new Pn(n):t?new Nn(n):new On(n),new fn(r)));var e,t,n,r},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(bn(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(bn(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(bn(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Rn=/&/g,Vn=/^\s*\/\/.*$/gm;function $n(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=$n(e.children,t)),e}))}var zn=new An,Mn=function(){var e,t,n,r=Ot,o=r.options,i=void 0===o?Ot:o,a=r.plugins,s=void 0===a?Nt:a,c=function(n,r,o){return o.startsWith(t)&&o.endsWith(t)&&o.replaceAll(t,"").length>0?".".concat(e):n},l=s.slice();l.push((function(e){e.type===Se&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(Rn,t).replace(n,c))})),i.prefix&&l.push(gt),l.push(mt);var d=function(r,o,a,s){void 0===o&&(o=""),void 0===a&&(a=""),void 0===s&&(s="&"),e=s,t=o,n=new RegExp("\\".concat(t,"\\b"),"g");var c=r.replace(Vn,""),d=ct(a||o?"".concat(a," ").concat(o," { ").concat(c," }"):c);i.namespace&&(d=$n(d,i.namespace));var p,h,u,f=[];return ft(d,(p=l.concat((u=function(e){return f.push(e)},function(e){e.root||(e=e.return)&&u(e)})),h=De(p),function(e,t,n,r){for(var o="",i=0;i<h;i++)o+=p[i](e,t,n,r)||"";return o})),f};return d.hash=s.length?s.reduce((function(e,t){return t.name||un(15),Ht(e,t.name)}),5381).toString():"",d}(),Hn=g.createContext({shouldForwardProp:void 0,styleSheet:zn,stylis:Mn});function Dn(){return C(Hn)}g.createContext(void 0);var jn=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Mn);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,dn(this,(function(){throw un(12,String(n.name))}))}return e.prototype.getName=function(e){return void 0===e&&(e=Mn),this.name+e.hash},e}(),Ln=function(e){return e>="A"&&e<="Z"};function Fn(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(1===n&&"-"===r&&"-"===e[0])return e;Ln(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var Un=function(e){return null==e||!1===e||""===e},Bn=function(e){var t,n,r=[];for(var o in e){var i=e[o];e.hasOwnProperty(o)&&!Un(i)&&(Array.isArray(i)&&i.isCss||rn(i)?r.push("".concat(Fn(o),":"),i,";"):cn(i)?r.push.apply(r,ge(ge(["".concat(o," {")],Bn(i),!1),["}"],!1)):r.push("".concat(Fn(o),": ").concat((t=o,null==(n=i)||"boolean"==typeof n||""===n?"":"number"!=typeof n||0===n||t in yt||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function qn(e,t,n,r){if(Un(e))return[];if(on(e))return[".".concat(e.styledComponentId)];if(rn(e)){if(!rn(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 jn||cn(o)||null===o||console.error("".concat(jt(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.")),qn(o,t,n,r)}var i;return e instanceof jn?n?(e.inject(n,r),[e.getName(r)]):[e]:cn(e)?Bn(e):Array.isArray(e)?Array.prototype.concat.apply(Nt,e.map((function(e){return qn(e,t,n,r)}))):[e.toString()]}var Gn=Dt(Ct),Zn=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&function(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(rn(n)&&!on(n))return!1}return!0}(e),this.componentId=t,this.baseHash=Ht(Gn,t),this.baseStyle=n,An.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=an(r,this.staticRulesId);else{var o=sn(qn(this.rules,e,t,n)),i=zt(Ht(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=an(r,i),this.staticRulesId=i}else{for(var s=Ht(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=Ht(s,d));else if(d){var p=sn(qn(d,e,t,n));s=Ht(s,p+l),c+=p}}if(c){var h=zt(s>>>0);t.hasNameForId(this.componentId,h)||t.insertRules(this.componentId,h,n(c,".".concat(h),void 0,this.componentId)),r=an(r,h)}}return r},e}(),Wn=g.createContext(void 0),Yn={},Kn=new Set;function Xn(e,t,n){var r,o=on(e),i=e,a=!Lt(e),s=t.attrs,c=void 0===s?Nt:s,l=t.componentId,d=void 0===l?function(e,t){var n="string"!=typeof e?"sc":At(e);Yn[n]=(Yn[n]||0)+1;var r="".concat(n,"-").concat(function(e){return zt(Dt(e)>>>0)}(Ct+n+Yn[n]));return t?"".concat(t,"-").concat(r):r}(t.displayName,t.parentComponentId):l,p=t.displayName,h=void 0===p?Lt(r=e)?"styled.".concat(r):"Styled(".concat(jt(r),")"):p,u=t.displayName&&t.componentId?"".concat(At(t.displayName),"-").concat(t.componentId):t.componentId||d,f=o&&i.attrs?i.attrs.concat(c).filter(Boolean):c,m=t.shouldForwardProp;if(o&&i.shouldForwardProp){var y=i.shouldForwardProp;if(t.shouldForwardProp){var C=t.shouldForwardProp;m=function(e,t){return y(e,t)&&C(e,t)}}else m=y}var _=new Zn(n,u,o?i.componentStyle:void 0);function k(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=g.useContext(Wn),d=Dn(),p=e.shouldForwardProp||d.shouldForwardProp;"production"!==process.env.NODE_ENV&&v(s);var h=function(e,t,n){return void 0===n&&(n=Ot),e.theme!==n.theme&&e.theme||t||n.theme}(t,l,i)||Ot,u=function(e,t,n){for(var r,o=me(me({},t),{className:void 0,theme:n}),i=0;i<e.length;i+=1){var a=rn(r=e[i])?r(o):r;for(var s in a)o[s]="className"===s?an(o[s],a[s]):"style"===s?me(me({},o[s]),a[s]):a[s]}return t.className&&(o.className=an(o.className,t.className)),o}(r,t,h),f=u.as||c,m={};for(var y in u)void 0===u[y]||"$"===y[0]||"as"===y||"theme"===y&&u.theme===h||("forwardedAs"===y?m.as=u.forwardedAs:p&&!p(y,f)||(m[y]=u[y],p||"development"!==process.env.NODE_ENV||be(y)||Kn.has(y)||!Pt.has(f)||(Kn.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 w,C,_,k,S=(w=o,C=u,_=Dn(),k=w.generateAndInjectStyles(C,_.styleSheet,_.stylis),"production"!==process.env.NODE_ENV&&v(k),k);"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(S);var I=an(a,s);return S&&(I+=" "+S),u.className&&(I+=" "+u.className),m[Lt(f)&&!Pt.has(f)?"class":"className"]=I,m.ref=n,b(f,m)}(S,e,t)}k.displayName=h;var S=g.forwardRef(k);return S.attrs=f,S.componentStyle=_,S.displayName=h,S.shouldForwardProp=m,S.foldedComponentIds=o?an(i.foldedComponentIds,i.styledComponentId):"",S.styledComponentId=u,S.target=o?i.target:e,Object.defineProperty(S,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=o?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++)ln(e,o[r],!0);return e}({},i.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(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];It.test(e)?(i=!1,xt.delete(r)):o.apply(void 0,ge([e],t,!1))},w(),i&&!xt.has(r)&&(console.warn(r),xt.add(r))}catch(e){It.test(e.message)&&xt.delete(r)}finally{console.error=o}}}(h,u),S.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={}}}}(h,u)),dn(S,(function(){return".".concat(S.styledComponentId)})),a&&nn(S,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),S}function Jn(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 Qn=function(e){return Object.assign(e,{isCss:!0})};function er(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(rn(e)||cn(e))return Qn(qn(Jn(Nt,ge([e],t,!0))));var r=e;return 0===t.length&&1===r.length&&"string"==typeof r[0]?qn(r):Qn(qn(Jn(r,t)))}function tr(e,t,n){if(void 0===n&&(n=Ot),!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,er.apply(void 0,ge([r],o,!1)))};return r.attrs=function(r){return tr(e,t,me(me({},n),{attrs:Array.prototype.concat(n.attrs,r).filter(Boolean)}))},r.withConfig=function(r){return tr(e,t,me(me({},n),r))},r}var nr=function(e){return tr(Xn,e)},rr=nr;Pt.forEach((function(e){rr[e]=nr(e)})),"production"!==process.env.NODE_ENV&&typeof navigator<"u"&&"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 or="__sc-".concat(vt,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&typeof window<"u"&&(window[or]||(window[or]=0),1===window[or]&&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[or]+=1);var ir=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ar={},sr={},cr={};Object.defineProperty(cr,"__esModule",{value:!0});var lr="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg";cr.default=function(e){var t=e.split("-"),n=t[1],r=t[2],o=t[3];if(!n||!r||!o)throw new Error("Malformed asset _ref '".concat(e,"'. Expected an id like \"").concat(lr,'".'));var i=r.split("x"),a=+i[0],s=+i[1];if(!(isFinite(a)&&isFinite(s)))throw new Error("Malformed asset _ref '".concat(e,"'. Expected an id like \"").concat(lr,'".'));return{id:n,width:a,height:s,format:o}};var dr={},pr=ir&&ir.__assign||function(){return pr=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},pr.apply(this,arguments)};Object.defineProperty(dr,"__esModule",{value:!0});function hr(e){var t=e.split("/").slice(-1);return"image-".concat(t[0]).replace(/\.([a-z]+)$/,"-$1")}dr.default=function(e){if(!e)return null;var t,n;if("string"==typeof e&&/^https?:\/\//.test("".concat(e)))t={asset:{_ref:hr(e)}};else if("string"==typeof e)t={asset:{_ref:e}};else if((n=e)&&"string"==typeof n._ref)t={asset:e};else if(function(e){return!!e&&"string"==typeof e._id}(e))t={asset:{_ref:e._id||""}};else if(function(e){var t=e;return!(!t||!t.asset)&&"string"==typeof t.asset.url}(e))t={asset:{_ref:hr(e.asset.url)}};else{if("object"!=typeof e.asset)return null;t=pr({},e)}var r=e;return r.crop&&(t.crop=r.crop),r.hotspot&&(t.hotspot=r.hotspot),function(e){if(e.crop&&e.hotspot)return e;var t=pr({},e);return t.crop||(t.crop={left:0,top:0,bottom:0,right:0}),t.hotspot||(t.hotspot={x:.5,y:.5,height:1,width:1}),t}(t)},function(e){var t=ir&&ir.__assign||function(){return t=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},t.apply(this,arguments)},n=ir&&ir.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.parseSource=e.SPEC_NAME_TO_URL_NAME_MAPPINGS=void 0;var r=n(cr),o=n(dr);e.parseSource=o.default,e.SPEC_NAME_TO_URL_NAME_MAPPINGS=[["width","w"],["height","h"],["format","fm"],["download","dl"],["blur","blur"],["sharpen","sharp"],["invert","invert"],["orientation","or"],["minHeight","min-h"],["maxHeight","max-h"],["minWidth","min-w"],["maxWidth","max-w"],["quality","q"],["fit","fit"],["crop","crop"],["saturation","sat"],["auto","auto"],["dpr","dpr"],["pad","pad"]],e.default=function(n){var i=t({},n||{}),a=i.source;delete i.source;var s=(0,o.default)(a);if(!s)throw new Error("Unable to resolve image URL from source (".concat(JSON.stringify(a),")"));var c=s.asset._ref||s.asset._id||"",l=(0,r.default)(c),d=Math.round(s.crop.left*l.width),p=Math.round(s.crop.top*l.height),h={left:d,top:p,width:Math.round(l.width-s.crop.right*l.width-d),height:Math.round(l.height-s.crop.bottom*l.height-p)},u=s.hotspot.height*l.height/2,f=s.hotspot.width*l.width/2,m=s.hotspot.x*l.width,g=s.hotspot.y*l.height,y={left:m-f,top:g-u,right:m+f,bottom:g+u};return i.rect||i.focalPoint||i.ignoreImageParams||i.crop||(i=t(t({},i),function(e,t){var n,r=t.width,o=t.height;if(!r||!o)return{width:r,height:o,rect:e.crop};var i=e.crop,a=e.hotspot,s=r/o,c=i.width/i.height;if(c>s){var l=Math.round(i.height),d=Math.round(l*s),p=Math.max(0,Math.round(i.top)),h=Math.round((a.right-a.left)/2+a.left);(u=Math.max(0,Math.round(h-d/2)))<i.left?u=i.left:u+d>i.left+i.width&&(u=i.left+i.width-d),n={left:u,top:p,width:d,height:l}}else{d=i.width,l=Math.round(d/s);var u=Math.max(0,Math.round(i.left)),f=Math.round((a.bottom-a.top)/2+a.top),m=Math.max(0,Math.round(f-l/2));m<i.top?m=i.top:m+l>i.top+i.height&&(m=i.top+i.height-l),n={left:u,top:m,width:d,height:l}}return{width:r,height:o,rect:n}}({crop:h,hotspot:y},i))),function(t){var n=(t.baseUrl||"https://cdn.sanity.io").replace(/\/+$/,""),r="".concat(t.asset.id,"-").concat(t.asset.width,"x").concat(t.asset.height,".").concat(t.asset.format),o="".concat(n,"/images/").concat(t.projectId,"/").concat(t.dataset,"/").concat(r),i=[];if(t.rect){var a=t.rect,s=a.left,c=a.top,l=a.width,d=a.height;(0!==s||0!==c||d!==t.asset.height||l!==t.asset.width)&&i.push("rect=".concat(s,",").concat(c,",").concat(l,",").concat(d))}t.bg&&i.push("bg=".concat(t.bg)),t.focalPoint&&(i.push("fp-x=".concat(t.focalPoint.x)),i.push("fp-y=".concat(t.focalPoint.y)));var p=[t.flipHorizontal&&"h",t.flipVertical&&"v"].filter(Boolean).join("");return p&&i.push("flip=".concat(p)),e.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach((function(e){var n=e[0],r=e[1];typeof t[n]<"u"?i.push("".concat(r,"=").concat(encodeURIComponent(t[n]))):typeof t[r]<"u"&&i.push("".concat(r,"=").concat(encodeURIComponent(t[r])))})),0===i.length?o:"".concat(o,"?").concat(i.join("&"))}(t(t({},i),{asset:l}))}}(sr);var ur=ir&&ir.__assign||function(){return ur=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},ur.apply(this,arguments)},fr=ir&&ir.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),mr=ir&&ir.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gr=ir&&ir.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&fr(t,e,n);return mr(t,e),t};Object.defineProperty(ar,"__esModule",{value:!0}),ar.ImageUrlBuilder=void 0;var yr=gr(sr),vr=["clip","crop","fill","fillmax","max","scale","min"],br=["top","bottom","left","right","center","focalpoint","entropy"],wr=["format"];function Cr(e){for(var t=0,n=yr.SPEC_NAME_TO_URL_NAME_MAPPINGS;t<n.length;t++){var r=n[t],o=r[0],i=r[1];if(e===o||e===i)return o}return e}ar.default=function(e){if(function(e){return!(!e||!("config"in e))&&"function"==typeof e.config}(e)){var t=e.config(),n=t.apiHost,r=t.projectId,o=t.dataset;return new _r(null,{baseUrl:(n||"https://api.sanity.io").replace(/^https:\/\/api\./,"https://cdn."),projectId:r,dataset:o})}var i=e;if(function(e){return!(!e||!("clientConfig"in e))&&"object"==typeof e.clientConfig}(i)){var a=i.clientConfig;n=a.apiHost,r=a.projectId,o=a.dataset;return new _r(null,{baseUrl:(n||"https://api.sanity.io").replace(/^https:\/\/api\./,"https://cdn."),projectId:r,dataset:o})}return new _r(null,e)};var _r=function(){function e(e,t){this.options=ur(e?ur({},e.options||{}):{},t||{})}return e.prototype.withOptions=function(t){var n=t.baseUrl||this.options.baseUrl,r={baseUrl:n};for(var o in t)if(t.hasOwnProperty(o)){r[Cr(o)]=t[o]}return new e(this,ur({baseUrl:n},r))},e.prototype.image=function(e){return this.withOptions({source:e})},e.prototype.dataset=function(e){return this.withOptions({dataset:e})},e.prototype.projectId=function(e){return this.withOptions({projectId:e})},e.prototype.bg=function(e){return this.withOptions({bg:e})},e.prototype.dpr=function(e){return this.withOptions(e&&1!==e?{dpr:e}:{})},e.prototype.width=function(e){return this.withOptions({width:e})},e.prototype.height=function(e){return this.withOptions({height:e})},e.prototype.focalPoint=function(e,t){return this.withOptions({focalPoint:{x:e,y:t}})},e.prototype.maxWidth=function(e){return this.withOptions({maxWidth:e})},e.prototype.minWidth=function(e){return this.withOptions({minWidth:e})},e.prototype.maxHeight=function(e){return this.withOptions({maxHeight:e})},e.prototype.minHeight=function(e){return this.withOptions({minHeight:e})},e.prototype.size=function(e,t){return this.withOptions({width:e,height:t})},e.prototype.blur=function(e){return this.withOptions({blur:e})},e.prototype.sharpen=function(e){return this.withOptions({sharpen:e})},e.prototype.rect=function(e,t,n,r){return this.withOptions({rect:{left:e,top:t,width:n,height:r}})},e.prototype.format=function(e){return this.withOptions({format:e})},e.prototype.invert=function(e){return this.withOptions({invert:e})},e.prototype.orientation=function(e){return this.withOptions({orientation:e})},e.prototype.quality=function(e){return this.withOptions({quality:e})},e.prototype.forceDownload=function(e){return this.withOptions({download:e})},e.prototype.flipHorizontal=function(){return this.withOptions({flipHorizontal:!0})},e.prototype.flipVertical=function(){return this.withOptions({flipVertical:!0})},e.prototype.ignoreImageParams=function(){return this.withOptions({ignoreImageParams:!0})},e.prototype.fit=function(e){if(-1===vr.indexOf(e))throw new Error('Invalid fit mode "'.concat(e,'"'));return this.withOptions({fit:e})},e.prototype.crop=function(e){if(-1===br.indexOf(e))throw new Error('Invalid crop mode "'.concat(e,'"'));return this.withOptions({crop:e})},e.prototype.saturation=function(e){return this.withOptions({saturation:e})},e.prototype.auto=function(e){if(-1===wr.indexOf(e))throw new Error('Invalid auto mode "'.concat(e,'"'));return this.withOptions({auto:e})},e.prototype.pad=function(e){return this.withOptions({pad:e})},e.prototype.url=function(){return(0,yr.default)(this.options)},e.prototype.toString=function(){return this.url()},e}();ar.ImageUrlBuilder=_r,(ir&&ir.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(ar);const kr={},Sr={apiVersion:"v2023-05-01"},Ir=null;function xr(e){const t=S((()=>JSON.stringify(e||{})),[e]);return S((()=>JSON.parse(t)),[t])}function Nr(e,t){let{params:r=kr,options:o=Sr,initialValue:i=Ir}=t;const[a,s]=_(!0),[c,l]=_(!1),[d,p]=_(i),h=xr(r),u=xr(o),f=w(null),m=n();return k((()=>{if(e&&!c&&!f.current)try{f.current=m.listenQuery(e,h,u).pipe(N(x),O((e=>(console.error(e),l(e),s(!1),p(null),e)))).subscribe((e=>{p((t=>x(t,e)?t:e)),s(!1),l(!1)}))}catch(e){console.error(e),s(!1),l(e)}return c&&f.current&&f.current.unsubscribe(),()=>{var e;f.current&&(null==(e=f?.current)||e.unsubscribe(),f.current=null)}}),[e,c,h,u,m]),{data:d,loading:a,error:c}}var Or,Pr,Er,Tr=Object.freeze,Ar=Object.defineProperty,Rr=(e,t)=>Tr(Ar(e,"raw",{value:Tr(e.slice())}));rr((function(){return E(M,{as:"table",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})}))((()=>er(Or||(Or=Rr(["\n display: table;\n width: 100%;\n border-collapse: collapse;\n\n &:not([hidden]) {\n display: table;\n border-collapse: collapse;\n }\n "])))));rr((function(){return E(M,{as:"tr",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})}))((()=>er(Pr||(Pr=Rr(["\n display: table-row;\n\n &:not([hidden]) {\n display: table-row;\n }\n "])))));rr((function(){return E(M,{as:"td",...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})}))((()=>er(Er||(Er=Rr(["\n display: table-cell;\n\n &:not([hidden]) {\n display: table-cell;\n }\n "])))));const Vr=I(null),$r=I({editControls:!1}),zr=I(void 0),Mr=(e=1)=>{let t="^.^.concepts[]._ref",n=1;for(;e>n;)t=`^.${t}`,n++;return e>6?"":`"childConcepts": *[_id in ${t} && ^._id in broader[]._ref]|order(prefLabel)\n {\n "id": _id,\n "level": ${e},\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Mr(e+1)||""}\n }`},Hr=rr.details`
summary {
cursor: pointer;
}
div {
margin-top: 0.5rem;
margin-left: 0.75rem;
svg {
padding-right: 0.25rem;
}
}
`,Dr=rr.div`
margin-top: 2rem;
`,jr=rr.ul`
list-style: none;
padding-left: 0;
margin-block-start: 0;
li svg.info {
height: 1.2rem;
width: 1.2rem;
color: ${W.gray[800].hex};
border-radius: 3px;
transition: all 0.1s ease-in-out;
&.warning:hover {
color: ${W.gray[100].hex};
background-color: ${W.yellow[500].hex};
}
&.error {
color: ${W.red[500].hex};
&:hover {
color: ${W.gray[100].hex};
background-color: ${W.red[500].hex};
}
}
}
li svg.spacer {
height: 1.5rem;
width: 1.5rem;
visibility: hidden;
}
`,Lr=rr.button`
background: none;
border: none;
padding: 0.5rem;
border-radius: 3px;
cursor: pointer;
svg {
padding-right: 0.25rem;
}
&:hover {
background-color: ${W.gray[50].hex};
}
&.add:hover {
background-color: ${W.green[500].hex};
span,
svg {
color: white;
}
}
`,Fr=rr.button`
background: none;
border: none;
padding: 0.2rem 0 0;
cursor: pointer;
svg {
border-radius: 3px;
transition: all 0.1s ease-in-out;
}
&.toggle svg {
height: 1.5rem;
width: 1.5rem;
}
&.action svg {
height: 1.2rem;
height: 1.2rem;
width: 1.2rem;
&:hover {
color: ${W.gray[100].hex} !important;
}
&.info:hover {
background-color: ${W.blue[500].hex};
}
&.add:hover {
background-color: ${W.green[500].hex};
}
&.remove:hover {
background-color: ${W.red[500].hex};
}
}
`,Ur=rr.button`
background: none;
border: none;
padding: 0.2rem 0 0;
cursor: pointer;
svg {
height: 1.5rem;
width: 1.5rem;
}
`,Br=rr.li`
font-weight: bold;
margin-top: 1rem;
.untitled {
color: ${W.gray[400].hex};
font-weight: normal;
}
button[aria-expanded='true'] svg {
rotate: 90deg;
}
&.closed ul {
display: none;
}
`,qr=rr.li`
padding-top: 0.5rem;
font-weight: normal;
margin-top: 1rem;
.untitled {
color: ${W.gray[400].hex};
}
button[aria-expanded='true'] svg {
rotate: 90deg;
}
&.closed ul {
display: none;
}
`,Gr=rr.ul`
list-style: none;
`,Zr=rr.li`
font-weight: normal;
margin-top: 1rem;
button[aria-expanded='true'] svg {
rotate: 90deg;
}
&.closed ul {
display: none;
}
`,Wr=rr.a`
text-decoration: none;
&:hover {
text-decoration: underline;
}
`,Yr=rr.p``;var Kr,Xr=new Uint8Array(16);function Jr(){if(!Kr&&!(Kr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Kr(Xr)}var Qr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var eo=[],to=0;to<256;++to)eo.push((to+256).toString(16).substr(1));function no(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(eo[e[t+0]]+eo[e[t+1]]+eo[e[t+2]]+eo[e[t+3]]+"-"+eo[e[t+4]]+eo[e[t+5]]+"-"+eo[e[t+6]]+eo[e[t+7]]+"-"+eo[e[t+8]]+eo[e[t+9]]+"-"+eo[e[t+10]]+eo[e[t+11]]+eo[e[t+12]]+eo[e[t+13]]+eo[e[t+14]]+eo[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&Qr.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n}function ro(e,t,n){var r=(e=e||{}).random||(e.rng||Jr)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,no(r)}function oo(e){const t=V(),n=r({apiVersion:"2025-02-19"}),i=function(){const e=C(pe),{routerPanesState:t,groupIndex:n}=f();return y((r=>{if(!e||!r)return;const o=[...t];o.splice(n+1,n+1,[{id:r,params:{type:"skosConcept"}}]);const i=e.resolvePathFromState({panes:o});e.navigateUrl({path:i})}),[e,t,n])}(),a=e.displayed.baseIri;return y(((r,s)=>{const{id:c,_originalId:l=""}=s||{},d=Y(e.displayed._id),p=d?K(e.displayed._id):void 0,h=d?X(J(e.displayed._id),p):Q(J(e.displayed._id)),u=d?X(J(ro()),p):Q(J(ro())),f={_id:u,_type:"skosConcept",conceptId:`${de(6)}`,prefLabel:"",baseIri:a,broader:[],related:[]};if(c){const e=o(J(l));f.broader=[{_key:ro(),_ref:ee(J(c)),_type:"reference",_weak:!e,_strengthenOnPublish:e?void 0:{type:"skosConcept",template:{id:"skosConcept"}}}]}const m={_ref:ee(u),_type:"reference",_key:ro(),_strengthenOnPublish:{type:"skosConcept",template:{id:"skosConcept"}},_weak:!0};n.transaction().createIfNotExists({...e.displayed,_id:h}).create(f).patch(h,(e=>"topConcept"===r?e.setIfMissing({topConcepts:[]}).append("topConcepts",[m]):e.setIfMissing({concepts:[]}).append("concepts",[m]))).commit({autoGenerateArrayKeys:!0}).then((e=>{t.push({closable:!0,status:"success",title:"Created new concept"}),i(u)})).catch((e=>{t.push({closable:!0,status:"error",title:"Error creating concept",description:e instanceof Error?e.message:"Unknown error occurred"})}))}),[e.displayed,n,a,t,i])}function io(e){const t=V(),n=r({apiVersion:"2025-02-19"});return y(((r,o,i)=>{const a="topConcept"==o?"topConcepts":"concepts",s=Y(e.displayed._id),c=s?K(e.displayed._id):void 0,l=s?X(J(e.displayed._id),c):Q(J(e.displayed._id));n.transaction().createIfNotExists({...e.displayed,_id:l}).patch(l,(e=>e.unset([`${a}[_ref=="${r}"]`]))).commit().then((e=>{t.push({closable:!0,status:"success",title:(i?`"${i}"`:"Concept")+" removed from scheme"})})).catch((e=>{t.push({closable:!0,status:"error",title:"Error removing concept",description:e instanceof Error?e.message:"Unknown error occurred"})}))}),[n,e.displayed,t])}function ao(){return"dark"==i()?W.gray[50].hex:W.gray[800].hex}const so=({concept:e})=>{const[t,n]=_(!1),r=y((()=>n(!1)),[]),o=y((()=>n(!0)),[]),i=ao();return e&&(e.definition||e.example||e.scopeNote)?P(T,{children:[E(Fr,{className:"action","aria-label":"info",onClick:o,type:"button",children:E(te,{className:"info",style:{color:i}})}),t&&E(H,{header:e.prefLabel,id:"dialog-example",onClose:r,zOffset:1e3,width:1,children:E(D,{padding:4,paddingBottom:5,children:P(A,{space:4,children:[e.definition&&P(A,{space:2,children:[E(j,{size:1,children:"Definition"}),E(R,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e.definition})]}),e.example&&P(A,{space:2,children:[E(j,{size:1,children:"Example"}),E(R,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e.example})]}),e.scopeNote&&P(A,{space:2,children:[E(j,{size:1,children:"Scope Note"}),E(R,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e.scopeNote})]})]})})})]}):null};function co({concept:e}){const t=C(pe),{routerPanesState:n,groupIndex:r}=f(),o=ao(),{id:i,prefLabel:a}=e??{},s=y((()=>{if(!t||!i)return;const e=[...n];e.splice(r+1,r+1,[{id:i,params:{type:"skosConcept"}}]);const o=t.resolvePathFromState({panes:e});t.navigateUrl({path:o})}),[i,t,n,r]);return E(Wr,{href:"#",onClick:s,style:{color:o},children:a})}function lo({concept:e,selectConcept:t}){const{prefLabel:n,id:r,_originalId:o}=e??{},i=ao(),a=y((()=>{t({_ref:r,_type:"reference",_originalId:o})}),[r,o,t]);return E(T,{children:t?E(Wr,{href:"#",onClick:a,style:{color:i},children:n}):E(Yr,{children:n})})}const po=({concept:e,selectConcept:t,inputComponent:n=!1})=>{const r=C(Vr)||{},o=C(zr),{globalVisibility:{treeVisibility:i}}=C($r)||{},a=oo(r),s=io(r),c=y((()=>{a("concept",e)}),[e,a]),l=y((()=>{s(e.id,"concept",e?.prefLabel)}),[e.id,e?.prefLabel,s]),[d,p]=_(i),h=y((()=>{"open"==d?p("closed"):"closed"==d&&p("open")}),[d]);return P(Zr,{className:d,children:[P($,{space:2,children:[P($,{space:1,children:[P($,{space:1,children:[e?.childConcepts&&e.childConcepts.length>0&&E(Ur,{onClick:h,type:"button","aria-expanded":"open"==d,children:E(ne,{})}),e?.childConcepts&&0==e.childConcepts.length&&E(re,{className:"spacer"}),!e?.prefLabel&&E("span",{className:"untitled",children:"[new concept]"}),n?E(lo,{concept:e,selectConcept:t}):E(co,{concept:e})]}),n&&E(so,{concept:e})]}),!n&&"published"!==o&&e?.level&&e.level<5&&P($,{space:2,children:[E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"Add a child concept below this concept"})}),fallbackPlacements:["right","left"],placement:"top",children:E(Fr,{onClick:c,type:"button",className:"action","aria-label":"Add a child concept below this concept",children:E(oe,{className:"add"})})}),E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"Remove this concept from this scheme"})}),fallbackPlacements:["right","left"],placement:"top",children:E(Fr,{onClick:l,type:"button",className:"action","aria-label":"Remove this concept from this scheme",children:E(ie,{className:"remove"})})})]}),!n&&"published"!==o&&0==e.childConcepts?.length&&5==e.level&&P($,{space:2,children:[E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"This concept is at the maximum Taxonomy Manager hierarchy depth of 5 levels."})}),fallbackPlacements:["right","left"],placement:"top",children:E(te,{className:"info warning"})}),E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"Remove this concept from this scheme"})}),fallbackPlacements:["right","left"],placement:"top",children:E(Fr,{onClick:l,type:"button",className:"action","aria-label":"Remove concept from scheme",children:E(ie,{className:"remove"})})})]}),e?.childConcepts&&e?.childConcepts?.length>0&&5==e.level&&P($,{space:1,children:[E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"This concept has unlisted child concepts. The maximum validated hierarchy depth is 5 levels."})}),fallbackPlacements:["right","left"],placement:"top",children:E(ae,{className:"info error"})}),!n&&"published"!==o&&E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"Remove this concept from this scheme"})}),fallbackPlacements:["right","left"],placement:"top",children:E(Fr,{onClick:l,type:"button",className:"action","aria-label":"Remove concept from scheme",children:E(ie,{className:"remove"})})})]})]}),e?.childConcepts&&e.childConcepts.length>0&&e?.level&&e.level<5&&E(ho,{concepts:e.childConcepts,selectConcept:t,inputComponent:n})]})},ho=({concepts:e,inputComponent:t=!1,selectConcept:n})=>E(Gr,{children:e.map((e=>E(po,{concept:e,selectConcept:n,inputComponent:t},e.id)))}),uo=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const o=C(Vr)||{},i=C(zr),a=oo(o),s=io(o),[c,l]=_(t),d=y((()=>{"open"==c?l("closed"):"closed"==c&&l("open")}),[c]),p=y((()=>{a("concept",e)}),[e,a]),h=y((()=>{s(e.id,"concept",e?.prefLabel)}),[e.id,e?.prefLabel,s]);return P(qr,{className:c,children:[P($,{space:2,children:[e?.childConcepts&&e.childConcepts.length>0&&E(Ur,{onClick:d,type:"button","aria-expanded":"open"==c,children:E(ne,{})}),e?.childConcepts&&0==e.childConcepts.length&&E(re,{className:"spacer"}),!e?.prefLabel&&E("span",{className:"untitled",children:"[new concept]"}),n?E(lo,{concept:e,selectConcept:r}):E(co,{concept:e}),o.displayed?.topConcepts?.length&&E(R,{size:1,muted:!0,children:"orphan"}),n&&E(so,{concept:e}),!n&&"published"!==i&&P($,{space:2,children:[E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"Add a child concept below this concept"})}),fallbackPlacements:["right","left"],placement:"top",children:E(Fr,{onClick:p,type:"button",className:"action","aria-label":"Add a child concept below this concept",children:E(oe,{className:"add"})})}),E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"Remove this concept from this scheme"})}),fallbackPlacements:["right","left"],placement:"top",children:E(Fr,{onClick:h,type:"button",className:"action","aria-label":"Remove this concept from this scheme",children:E(ie,{className:"remove"})})})]})]}),e?.childConcepts&&e.childConcepts.length>0&&E(ho,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},fo=({document:e})=>{const[t,n]=_(!1),[o,i]=_(""),[a,s]=_(""),c=y((()=>n(!1)),[]),l=y((()=>n(!0)),[]),d=y((e=>{i(e.currentTarget.value)}),[]),p=y((e=>{s(e.currentTarget.value)}),[]),h=function(){const e=V(),t=r({apiVersion:"2021-10-21"});return y(((n,r,o)=>{const i=n.displayed?._id,a=n.displayed?.baseIri,s=n.displayed?.schemeId,c={_id:`drafts.${i}`,_type:"skosConceptScheme",schemeId:s,baseIri:a,title:r,description:o||""};t.createIfNotExists(c).then((t=>o?e.push({closable:!0,status:"success",title:"Title and Description added."}):e.push({closable:!0,status:"success",title:"Title added."}))).catch((t=>{e.push({closable:!0,status:"error",title:"There has been an error",description:t.message})}))}),[t,e])}(),u=y((()=>{h(e,o,a)}),[h,a,e,o]);return P(Dr,{children:[E(M,{padding:[3,3,4],radius:2,shadow:1,tone:"primary",children:P(A,{space:6,children:[P(A,{space:4,children:[E(j,{size:4,children:"New Concept Scheme"}),E(R,{size:2,children:'To start using hierarchy view taxonomy builder, first give your concept scheme a name and optional description. You can also use the "Editor" tab to add concepts to the tree manually.'})]}),E(z,{tone:"primary",fontSize:2,icon:se,onClick:l,text:"Add Title"})]})}),t&&E(H,{header:"Title & Description",id:"title-description",onClose:c,zOffset:1e3,width:1,children:E(D,{padding:4,children:P(A,{space:4,children:[P(A,{space:2,children:[E(j,{size:1,children:"Title"}),E(R,{size:1,muted:!0,children:"Describe the concept scheme in one or two words."})]}),E(F,{fontSize:2,onChange:d,padding:3,placeholder:"",value:o}),P(A,{space:2,children:[E(j,{size:1,children:"Description (optional)"}),E(R,{size:1,muted:!0,children:"Describe the intended use of this concept scheme."})]}),E(U,{fontSize:2,onChange:p,padding:3,placeholder:"",value:a,rows:3}),E(z,{tone:"primary",fontSize:2,onClick:u,text:"Save"})]})})})]})},mo=()=>E(Dr,{children:E(M,{padding:[3,3,4],radius:2,shadow:1,tone:"primary",children:P(A,{space:4,children:[E(j,{size:4,children:"No Concepts"}),E(R,{size:2,children:"There are not yet any concepts assigned to this scheme. To create a multi-level hierarchy with specific entry points, create Top Concepts first, then add child concepts to them. To create a flat list of concepts, create Concepts directly."})]})})}),go=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:r})=>{const o=C(Vr)||{},i=C(zr),a=oo(o),s=io(o),[c,l]=_(t),d=y((()=>{"open"==c?l("closed"):"closed"==c&&l("open")}),[c]),p=y((()=>{a("concept",e)}),[e,a]),h=y((()=>{s(e?.id,"topConcept",e?.prefLabel)}),[e?.id,e?.prefLabel,s]);return P(Br,{className:c,children:[P($,{space:2,children:[P($,{space:0,children:[e?.childConcepts&&e.childConcepts.length>0&&E(Ur,{onClick:d,type:"button","aria-expanded":"open"==c,children:E(ne,{})}),e?.childConcepts&&0==e.childConcepts.length&&E(re,{className:"spacer"}),!e?.prefLabel&&E("span",{className:"untitled",children:"[new concept]"}),n?E(lo,{concept:e,selectConcept:r}):E(co,{concept:e})]}),E(R,{size:1,muted:!0,children:"top concept"}),n&&E(so,{concept:e}),!n&&"published"!==i&&P($,{space:2,children:[E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"Add a child concept below this concept"})}),fallbackPlacements:["right","left"],placement:"top",children:E(Fr,{onClick:p,type:"button",className:"action","aria-label":"Add child a child concept",children:E(oe,{className:"add"})})}),E(L,{delay:{open:750},content:E(D,{padding:1,sizing:"content",children:E(R,{muted:!0,size:1,children:"Remove this concept from this scheme"})}),fallbackPlacements:["right","left"],placement:"top",children:E(Fr,{onClick:h,type:"button",className:"action","aria-label":"Remove concept from scheme",children:E(ie,{className:"remove"})})})]})]}),e?.childConcepts&&e.childConcepts.length>0&&E(ho,{concepts:e.childConcepts,selectConcept:r,inputComponent:n})]})},yo=({concepts:e,inputComponent:t,selectConcept:n})=>{const{globalVisibility:{treeId:r,treeVisibility:o}={treeId:123,treeVisibility:"open"}}=C($r)||{};return e?.topConcepts?.length||e?.concepts?.length?P(jr,{children:[e.topConcepts?.map((e=>E(go,{concept:e,treeVisibility:o,inputComponent:t,selectConcept:n},`${e?.id}+${r}`))),e.concepts?.filter((e=>e?.isOrphan)).map((e=>E(uo,{concept:e,treeVisibility:o,inputComponent:t,selectConcept:n},`${e.id}+${r}`)))]}):E(mo,{})},vo=({branchId:e="",selectConcept:t,inputComponent:n})=>{const r=C(Vr)||{},o=ee(r.displayed?._id),i=C(zr),{data:a,loading:s,error:c}=Nr({fetch:`\n select($branchId != null => \n *[_id == $id][0] {\n _updatedAt,\n "topConcepts":*[_type == "skosConcept" && conceptId == $branchId]{\n "id": _id,\n "level": 0,\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Mr()||""} \n }, \n "concepts": []\n },\n *[_id == $id][0] {\n _updatedAt,\n "topConcepts":topConcepts[]->|order(prefLabel){\n "id": _id,\n "level": 0,\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Mr()||""}\n }, \n "concepts": concepts[]->|order(prefLabel){\n "id": _id,\n "level": 0,\n "isOrphan": \n coalesce(\n !array::intersects(\n broader[]._ref, (\n coalesce(^.concepts[]._ref, []) + coalesce(^.topConcepts[]._ref, [])\n )\n ), \n true),\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Mr()||""}\n }\n }\n )`,listen:'*[_type == "skosConcept" || _id == $id]'},{params:{id:o,branchId:e},options:{perspective:void 0===i?"drafts":[i]}});return s?E(D,{padding:5,children:P(B,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[E(q,{muted:!0}),E(R,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):c?(console.warn(c),E(D,{padding:4,children:E(M,{padding:[3],radius:2,shadow:1,tone:"caution",children:E(R,{size:1,children:"There was a problem loading terms. Please check the scheme configuration and try again."})})})):a?E($r.Provider,{value:{globalVisibility:{treeId:"123",treeVisibility:"open"}},children:E(D,{padding:4,children:E(yo,{concepts:a,inputComponent:n||!1,selectConcept:t||(()=>{})})})}):E(D,{padding:4,children:E(M,{padding:[3],radius:2,shadow:1,tone:"caution",children:E(R,{size:1,children:"This configuration does not have any terms associated with it. Please check the scheme and branch supplied and try again."})})})},bo=({inputComponent:e=!1,branchId:t="",selectConcept:n})=>{const r=C(Vr)||{},o=ee(r.displayed?._id),i=C(zr),a=oo(r),s=y((()=>{a("topConcept")}),[a]),c=y((()=>{a("concept")}),[a]),[l,d]=_({treeId:de(6),treeVisibility:"open"}),p=y((()=>{d({treeId:de(6),treeVisibility:"open"})}),[]),h=y((()=>{d({treeId:de(6),treeVisibility:"closed"})}),[]),{data:u,loading:f,error:m}=Nr({fetch:`*[_id == $id][0] {\n _updatedAt,\n "topConcepts": topConcepts[]->|order(prefLabel) {\n "id": _id,\n "level": 0,\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Mr()||""}\n },\n "concepts": concepts[]->|order(prefLabel) {\n "id": _id,\n "level": 0,\n "isOrphan": \n coalesce(\n !array::intersects(\n broader[]._ref, (\n coalesce(^.concepts[]._ref, []) + coalesce(^.topConcepts[]._ref, [])\n )\n ),\n true),\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Mr()||""}\n }\n }`,listen:'*[_type == "skosConcept" || _type == "skosConceptScheme" ]'},{params:{id:o,branchId:t},options:{perspective:void 0===i?"drafts":[i]}});return f?E(D,{padding:5,children:P(B,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[E(q,{muted:!0}),E(R,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):m?(console.error(m),E("div",{children:"Error here"})):u?E($r.Provider,{value:{globalVisibility:l},children:E(D,{padding:4,paddingTop:2,children:P(T,{children:[E(A,{space:4,children:E(M,{borderBottom:!0,paddingBottom:1,display:"flex",flex:1,children:P(B,{justify:"space-between",flex:1,children:[E(M,{children:(u.topConcepts?.filter((e=>(e?.childConcepts?.length??0)>0)).length>0||u.concepts?.filter((e=>(e?.childConcepts?.length??0)>0)).length>0)&&P($,{space:1,children:[E(Lr,{type:"button",onClick:h,children:E(R,{weight:"semibold",muted:!0,size:1,children:"Collapse"})}),E(R,{weight:"semibold",muted:!0,size:1,children:"|"}),E(Lr,{type:"button",onClick:p,children:E(R,{weight:"semibold",muted:!0,size:1,children:"Expand"})})]})}),E(M,{children:"published"!==i&&P($,{space:1,children:[E(Lr,{type:"button",className:"add",onClick:s,children:P(R,{weight:"semibold",muted:!0,size:1,children:[E(oe,{})," Add Top Concept"]})}),E(Lr,{type:"button",className:"add",onClick:c,children:P(R,{weight:"semibold",muted:!0,size:1,children:[E(oe,{})," Add Concept"]})})]})})]})})}),E(yo,{concepts:u,inputComponent:e,selectConcept:n||(()=>{})})]})})}):E(fo,{document:r})},wo=({document:e,branchId:t,inputComponent:n=!1,selectConcept:r})=>{const{selectedPerspectiveName:o}=a();return E(Vr.Provider,{value:e||{},children:E(zr.Provider,{value:o,children:n?E(vo,{inputComponent:n,branchId:t,selectConcept:r}):P(G,{width:1,style:{paddingTop:"1.25rem"},children:[e?.displayed?.description&&E(D,{padding:4,children:E(A,{space:4,children:P(A,{space:2,children:[E(R,{size:1,weight:"semibold",children:"Description"}),E(R,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:e?.displayed.description})]})})}),E(bo,{inputComponent:n,branchId:t})]})})})};function Co(t){const n=r({apiVersion:"2025-02-19"}),o=e(["_id"]),{name:i,title:c}=t,l=Y(o),d=s(o),{selectedPerspectiveName:p}=a(),[h,u]=_(!0),[f,m]=_(!0),[g,v]=_(!1),[b,w]=_({}),[C,S]=_(),{schemeId:I,branchId:x=null}=C?.params||{},{filter:N}=t.schemaType.options;k((()=>{(async function(){try{const e=await N({getClient:()=>n});S(e),m(!1)}catch(e){console.error("Error fetching filter values: ",e)}})().catch((e=>console.error("Error fetching filter values: ",e)))}),[N,n]),k((()=>{I&&n.fetch(`{"displayed": *[schemeId == "${I}"][0]}`).then((e=>{e?.displayed&&(w(e),u(!1))})).catch((e=>console.warn(e)))}),[n,I]);const O=y((()=>{v(!0)}),[]),T=y((()=>{v(!1)}),[]),V=y((e=>{(s(e?._originalId)||Y(e?._originalId))&&(e._strengthenOnPublish={type:"skosConcept",template:{id:"skosConcept"}},e._weak=!0),delete e._originalId,d||l?n.patch(o).set({[i]:e}).commit().then((()=>v(!1))).catch((e=>console.error(e))):n.fetch(`*[_id == "${o}"][0]`).then((t=>{t._id=`drafts.${t._id}`,t[i]=e,n.create(t).catch((e=>console.error("Error creating draft: ",e)))})).then((()=>v(!1))).catch((e=>console.error(e)))}),[n,o,d,l,i]);return t.schemaType.options?.filter?0===t.schemaType.options?.filter.length?P(A,{space:3,children:[t.renderDefault(t),E(D,{padding:4,children:E(M,{padding:[3],radius:2,shadow:1,tone:"caution",children:P(R,{size:1,children:["There was a problem loading your filter settings. Please check the"," ",E("code",{children:"schemeFilter()"})," or ",E("code",{children:"branchFilter()"})," configuration for the"," ",c," field."]})})})]}):h||f?E(D,{padding:5,children:P(B,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[E(q,{muted:!0}),E(R,{muted:!0,size:1,children:"Loading input component…"})]})}):P(A,{space:3,children:[t.renderDefault(t),E(Z,{columns:1,gap:3,children:E(z,{disabled:"published"===p,text:"Browse Taxonomy Tree",mode:"ghost",onClick:O})}),g&&E(H,{header:c,id:"concept-select-dialog",onClose:T,zOffset:900,width:1,children:E(D,{padding:10,children:E(wo,{document:b,branchId:x,inputComponent:!0,selectConcept:V})})})]}):P(A,{space:3,children:[t.renderDefault(t),E(D,{padding:4,children:E(M,{padding:[3],radius:2,shadow:1,tone:"caution",children:P(R,{size:1,children:["The ",E("code",{children:"ReferenceHierarchyInput()"})," component must be used with an accompanying"," ",E("code",{children:"schemeFilter()"})," or ",E("code",{children:"branchFilter()"}),". Please add an appropriate filter to the configuration for the ",c," field."]})})})]})}function _o(t){const n=r({apiVersion:"2025-02-19"}),o=e(["_id"]),{name:i,title:l,value:d=[]}=t,p=c(o),h=s(o),{selectedPerspectiveName:u}=a(),[f,m]=_(!0),[g,v]=_(!0),[b,w]=_(!1),[C,S]=_({}),[I,x]=_(),{schemeId:N,branchId:O=null}=I?.params||{},{filter:T}=t.schemaType.of[0].options,$=V();k((()=>{(async function(){try{const e=await T({getClient:()=>n});x(e),v(!1)}catch(e){console.error("Error fetching filter values: ",e)}})().catch((e=>console.error("Error fetching filter values: ",e)))}),[T,n]),k((()=>{N&&n.fetch(`{"displayed": *[schemeId == "${N}"][0]}`).then((e=>{e?.displayed&&(S(e),m(!1))})).catch((e=>console.warn(e)))}),[n,N]);const L=y((()=>{w(!0)}),[]),F=y((()=>{w(!1)}),[]),U=y((e=>{if((s(e?._originalId)||c(e?._originalId))&&(e._strengthenOnPublish={type:"skosConcept",template:{id:"skosConcept"}},e._weak=!0),delete e._originalId,d?.map((e=>e._ref)).includes(e._ref))return w(!1),void $.push({status:"warning",title:"Taxonomy Term Not Added",description:"The selected concept is already included in this field.",duration:5e3,closable:!0});h||p?n.patch(o).setIfMissing({[i]:[]}).append(i,[e]).commit({autoGenerateArrayKeys:!0}).then((()=>w(!1))).catch((e=>console.error(e))):n.fetch(`*[_id == "${o}"][0]`).then((e=>{e._id=`drafts.${e._id}`,n.create(e).catch((e=>console.error("Error creating draft: ",e)))})).then((()=>{n.patch(`drafts.${o}`).setIfMissing({[i]:[]}).append(i,[e]).commit({autoGenerateArrayKeys:!0}).then((()=>w(!1))).catch((e=>console.error(e)))})).catch((e=>console.error(e)))}),[d,h,p,n,o,$,i]);return t.schemaType.of[0].options?.filter?0===t.schemaType.of[0].options?.filter?.length?P(A,{space:3,children:[t.renderDefault(t),E(D,{padding:4,children:E(M,{padding:[3],radius:2,shadow:1,tone:"caution",children:P(R,{size:1,children:["There was a problem loading your filter settings. Please check the"," ",E("code",{children:"schemeFilter()"})," or ",E("code",{children:"branchFilter()"})," configuration for the"," ",l," field."]})})})]}):t.schemaType.of.length>1?P(A,{space:3,children:[t.renderDefault(t),E(M,{padding:[3],radius:2,shadow:1,tone:"caution",children:E(A,{space:4,children:P(A,{space:2,children:[E(j,{size:2,children:"Input Component Not Supported for Multi-Schema Arrays"}),P(R,{size:1,children:["The Sanity Taxonomy Manager Hierarchy Input Component is not designed to support array inputs with more than one schema type. Please see the"," ",E("a",{href:"https://sanitytaxonomymanager.com",children:"Taxonomy Manager docs"})," for more information."]})]})})})]}):f||g?E(D,{padding:5,children:P(B,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[E(q,{muted:!0}),E(R,{muted:!0,size:1,children:"Loading input component…"})]})}):P(A,{space:3,children:[t.renderDefault(t),E(Z,{columns:1,gap:3,children:E(z,{disabled:"published"===u,text:"Browse Taxonomy Tree",mode:"ghost",onClick:L})}),b&&E(H,{header:l,id:"concept-select-dialog",onClose:F,zOffset:900,width:1,children:E(D,{padding:10,children:E(wo,{document:C,branchId:O,inputComponent:!0,selectConcept:U})})})]}):P(A,{space:3,children:[t.renderDefault(t),E(D,{padding:4,children:E(M,{padding:[3],radius:2,shadow:1,tone:"caution",children:P(R,{size:1,children:["The ",E("code",{children:"ArrayHierarchyInput()"})," component must be used with an accompanying"," ",E("code",{children:"schemeFilter()"})," or ",E("code",{children:"branchFilter()"}),". Please add an appropriate filter to the configuration for the ",l," field."]})})})]})}const ko=e=>{const{onChange:t}=e,n=V(),r=y((()=>{t(l()),n.push({status:"success",title:"Value removed.",duration:2500,closable:!0})}),[t,n]);return E(A,{space:2,children:P($,{space:[3,3,4],children:[e.renderDefault(e),E(z,{tone:"primary",fontSize:2,onClick:r,text:"Remove Value"})]})})};function So(){return E("svg",{"data-sanity-icon":!0,width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E("path",{d:"M5.5 6.5V5.9H4.9V6.5H5.5ZM11.5 6.5H12.1V5.9H11.5V6.5ZM5.5 9H4.9V9.6H5.5V9ZM11.5 9V9.6H12.1V9H11.5ZM13.5 11V10.4H12.9V11H13.5ZM19.5 11H20.1V10.4H19.5V11ZM13.5 13.5H12.9V14.1H13.5V13.5ZM19.5 13.5V14.1H20.1V13.5H19.5ZM13.5 16V15.4H12.9V16H13.5ZM19.5 16H20.1V15.4H19.5V16ZM13.5 18.5H12.9V19.1H13.5V18.5ZM19.5 18.5V19.1H20.1V18.5H19.5ZM5.5 7.1H11.5V5.9H5.5V7.1ZM6.1 9V6.5H4.9V9H6.1ZM11.5 8.4H5.5V9.6H11.5V8.4ZM10.9 6.5V9H12.1V6.5H10.9ZM13.5 11.6H19.5V10.4H13.5V11.6ZM14.1 13.5V11H12.9V13.5H14.1ZM19.5 12.9H13.5V14.1H19.5V12.9ZM18.9 11V13.5H20.1V11H18.9ZM13.5 16.6H19.5V15.4H13.5V16.6ZM14.1 18.5V16H12.9V18.5H14.1ZM19.5 17.9H13.5V19.1H19.5V17.9ZM18.9 16V18.5H20.1V16H18.9ZM8 17.85H13.5V16.65H8V17.85ZM8 12.85H13.5V11.65H8V12.85ZM7.9 9.5V17.85H9.1V9.5H7.9Z",fill:"currentColor"})})}const Io=e=>{const{schemeId:t}=e||{};if(!t||"string"!=typeof t)throw new Error("Invalid or missing schemeId: scheme Id must be a string");return async e=>{const n=e?.getClient({apiVersion:"2025-02-19"});if(!n)throw new Error("Client not available");const{concepts:r,topConcepts:o}=await n.fetch(`{\n "concepts": *[_type=="skosConceptScheme" && schemeId == "${t}"].concepts[]._ref,\n "topConcepts": *[_type=="skosConceptScheme" && schemeId == "${t}"].topConcepts[]._ref\n }`);return{filter:"(_id in $concepts\n || _id in $topConcepts)",params:{concepts:r,topConcepts:o,schemeId:t}}}},xo=e=>{const{schemeId:t,branchId:n=null}=e||{};if(!t||"string"!=typeof t)throw new Error("Invalid or missing schemeId: scheme Id must be a string");if(!n||"string"!=typeof n)throw new Error("Invalid or missing branchId: branch Id must be a string");return async e=>{const r=e?.getClient({apiVersion:"2023-01-01"});if(!r)throw new Error("Client not available");const{concepts:o}=await r.fetch('{ \n "concepts": *[\n _id in *[_type=="skosConceptScheme" && schemeId == $schemeId].concepts[]._ref\n && ($branchId in broader[]->conceptId\n || $branchId in broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->broader[]->conceptId)\n ]._id\n }',{schemeId:t,branchId:n});return{filter:"_id in $concepts",params:{concepts:o,schemeId:t,branchId:n}}}};var No=[d({name:"baseIri",title:"Base URI",type:"url",validation:e=>e.required().error("Please supply a base URI in the format 'http://example.com/'"),description:P(Hr,{children:[E("summary",{children:"The root URI (Uniform Resource Identifier) used to create unique concept identifiers."}),P("div",{children:["Unique identifiers allow for the clear an unambiguous identification of concepts across namespaces, for example between ",E("code",{children:"https://shipparts.com/vocab#Bow"})," and ",E("code",{children:"https://wrappingsupplies.com/vocab#Bow"}),"."]}),E("div",{children:"In most cases, it makes sense for your base URI to be the root or a subdirectory of your website. In all cases, the URI you choose should be in a domain that you control."}),E("div",{children:"For new Concepts and Concept Schemes, the Base URI field is pre-populated based on the most recently used Base URI value."})]}),components:{input:function(t){const n=e(["conceptId"]),r=e(["schemeId"]);return P(A,{space:2,children:[t.renderDefault(t),E(R,{muted:!0,size:1,onResize:void 0,onResizeCapture:void 0,children:P(T,{children:[E("strong",{children:"RDF URI: "}),t.value?t.value:"[base URI not defined] ",n||r||" [identifier not assigned]"]})})]})}}})];const Oo=({document:e})=>({filter:"!(_id in $broader || _id in $related || _id == $self)",params:{self:ee(J(e._id)),broader:Array.isArray(e?.broader)?e.broader.map((({_ref:e})=>e)):[],related:Array.isArray(e?.related)?e.related.map((({_ref:e})=>e)):[]}});function Po(e,t=[]){return p({name:"skosConcept",title:"Concept",type:"document",icon:he,initialValue:async(t,n)=>{if(e)return{baseIri:e,broader:[],related:[]};const{getClient:r}=n;return{baseIri:await r({apiVersion:"2021-03-25"}).fetch("\n *[(_type == 'skosConcept' || _type == 'skosConceptScheme') && defined(baseIri)]| order(_createdAt desc)[0].baseIri\n ")??void 0,broader:[],related:[]}},fields:[d({name:"prefLabel",title:"Preferred Label",type:"string",description:"The preferred lexical label for this concept.",validation:e=>e.required().custom(((e,t)=>{const{getClient:n}=t;return n({apiVersion:"2025-06-10"}).withConfig({perspective:"raw"}).fetch(`*[_type == "skosConcept" && prefLabel == "${e}" && !(_id in path("drafts.**") || _id in path("versions.**"))][0]._id`).then((e=>!(e&&!t.document?._id.includes(e))||"Preferred Label must be unique."))}))}),d({name:"definition",title:"Definition",type:"text",description:P(Hr,{children:[E("summary",{children:"A complete explanation of the intended meaning of the concept."}),P("div",{children:[P("kbd",{children:["Example: documentation",E("br",{}),'Definition: "The process of storing and retrieving information in all fields of knowledge."']}),P("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",P("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),d({name:"example",title:"Examples",type:"text",description:P(Hr,{children:[E("summary",{children:"An example of the use of the concept."}),P("div",{children:[P("kbd",{children:["Example: organizations of science and culture",E("br",{}),'Example: "academies of science, general museums, world fairs"']}),P("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",P("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),d({name:"scopeNote",title:"Scope Note",type:"text",description:P(Hr,{children:[E("summary",{children:"A brief statement on the intended meaning of this concept, especially as an indication of how the use of the concept is limited in indexing practice."}),P("div",{children:[P("kbd",{children:["Example: microwave frequencies",E("br",{}),'Scope Note: "Used for frequencies between 1Ghz and 300Ghz"']}),P("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",P("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),d({name:"altLabel",title:"Alternate Label(s)",type:"array",description:P(Hr,{children:[E("summary",{children:"Synonyms, near-synonyms, abbreviations, and acronyms to a concept."}),E("div",{children:P("p",{children:[E(ce,{})," Preferred, alternative, and hidden label sets must not overlap."]})})]}),of:[{type:"string"}],validation:e=>e.unique()}),d({name:"hiddenLabel",title:"Hidden Label(s)",type:"array",description:P(Hr,{children:[E("summary",{children:"Character strings that need to be accessible to applications performing text-based indexing and search operations, but which should not be displayed to end users."}),P("div",{children:[E("p",{children:"Hidden labels may for instance be used to include misspelled variants of other lexical labels."}),P("p",{children:[E(ce,{})," Preferred, alternative, and hidden label sets must not overlap."]})]})]}),of:[{type:"string"}],validation:e=>e.unique()}),...No,d({name:"conceptId",title:"Identifier",description:"This concept does not yet have a unique identifier.",type:"string",initialValue:()=>`${de(6)}`,hidden:({document:e})=>!!e?.conceptId,readOnly:({document:e})=>!!e?.conceptId,components:{input:fe}}),d({name:"broader",title:"Broader Concept(s)",description:P(Hr,{children:[E("summary",{children:"Create hierarchy between concepts, for example to create category/subcategory, part/whole, or class/instance relationships."}),E("div",{children:E("p",{children:"Broader and Associated relationships are mutually exclusive."})})]}),type:"array",of:[{type:"reference",to:{type:"skosConcept"},options:{filter:Oo}}]}),d({name:"related",title:"Related Concept(s)",description:P(Hr,{children:[E("summary",{children:'Indicate that two concepts are inherently "related", but that one is not in any way more general than the other.'}),E("div",{children:E("p",{children:"Broader and Associated relationships are mutually exclusive."})})]}),type:"array",of:[{type:"reference",to:[{type:"skosConcept"}],options:{filter:Oo}}]}),...t,d({name:"historyNote",title:"History Notes",type:"text",description:P(Hr,{children:[E("summary",{children:"Significant changes to the meaning or the form of this concept."}),P("div",{children:[P("kbd",{children:["Example: person with disabilities",E("br",{}),'History Note: "Estab. 1992; heading was: handicapped [1884 - 1992]."']}),P("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",P("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),d({name:"editorialNote",title:"Editorial Notes",type:"text",description:P(Hr,{children:[E("summary",{children:"Information to aid in administrative housekeeping, such as reminders of editorial work still to be done, or warnings in the event that future editorial changes might be made."}),P("div",{children:[P("kbd",{children:["Example: doubleclick",E("br",{}),'Editorial Note: "Review this term after the company merger is complete."']}),P("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",P("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3}),d({name:"changeNote",title:"Change Notes",type:"text",description:P(Hr,{children:[E("summary",{children:"Fine-grained changes to a concept, for the purposes of administration and maintenance."}),P("div",{children:[P("kbd",{children:["Example: tomato",E("br",{}),"Change Note: \"Moved from under 'fruits' to under 'vegetables' by Horace Gray\""]}),P("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",P("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3})],orderings:[{title:"Top Concepts",name:"topConcept",by:[{field:"topConcept",direction:"desc"},{field:"prefLabel",direction:"asc"}]},{title:"Preferred Label",name:"prefLabel",by:[{field:"prefLabel",direction:"asc"}]}],preview:{select:{title:"prefLabel"},prepare:({title:e})=>({title:e,media:ue})}})}function Eo(e,t=[]){return p({name:"skosConceptScheme",title:"Concept Scheme",type:"document",icon:So,initialValue:async(t,n)=>{if(e)return{baseIri:e};const{getClient:r}=n;return{baseIri:await r({apiVersion:"2021-03-25"}).fetch("\n *[(_type == 'skosConcept' || _type == 'skosConceptScheme') && defined(baseIri)]| order(_createdAt desc)[0].baseIri\n ")??void 0}},fields:[d({name:"title",title:"Title",type:"string",description:"Taxonomy schemes group concepts into defined sets, such as thesauri, classification schemes, or facets. Concepts may belong to many (or no) concept schemes, and you may create as many (or few) concept schemes as you like"}),d({name:"description",title:"Description",type:"text",rows:5,description:"Describe the intended use of this scheme."}),d({name:"controls",title:"Concept Management Controls",deprecated:{reason:"This field was used for a previous version of the plugin and is no longer needed. Remove the value to hide this field."},type:"boolean",readOnly:!0,hidden:({document:e})=>void 0===e?.controls,components:{input:ko}}),...No,d({name:"schemeId",title:"Identifier",description:"This scheme does not yet have a unique identifier.",type:"string",initialValue:()=>`${de(6)}`,hidden:({document:e})=>!!e?.schemeId,readOnly:({document:e})=>!!e?.schemeId,components:{input:fe}}),d({name:"topConcepts",title:"Top Concepts",type:"array",validation:e=>e.unique(),of:[h({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}}),d({name:"concepts",title:"Concepts",type:"array",validation:e=>e.unique(),of:[h({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}}),...t],preview:{select:{title:"title"},prepare:({title:e})=>({title:e,media:So})}})}const To=e=>e.list().title("Taxonomy Manager").items([e.documentTypeListItem("skosConceptScheme").title("Concept Schemes"),e.documentTypeListItem("skosConcept").title("Concepts")]),Ao=(e,{schemaType:t})=>{switch(t){case"skosConceptScheme":return e.document().views([e.view.component(wo).title("Tree View").icon(So),e.view.form().icon(le)]);case"skosConcept":return e.document().views([e.view.form().icon(le)]);default:e.view.form()}},Ro=u((e=>{const{baseUri:t,customConceptFields:n,customSchemeFields:r}=e||{};return{name:"taxonomyManager",options:e,schema:{types:[Po(t,n),Eo(t,r)]},plugins:[m({name:"taxonomy",title:"Taxonomy",structure:To,defaultDocumentNode:Ao,icon:So})]}}));export{_o as ArrayHierarchyInput,Co as ReferenceHierarchyInput,wo as TreeView,xo as branchFilter,Io as schemeFilter,Ro as taxonomyManager};//# sourceMappingURL=index.esm.mjs.map