1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5179],{25179:(e,a,l)=>{l.r(a),l.d(a,{RelationshipComponent:()=>b});var t=l(38617),o=l(17757),n=l(90382),s=l(9079),c=l(18927),i=l(13499),r=l(52592),u=l(56617),d=l(32241),p=l(80958),h=l(91166),m={depth:0},b=e=>{var a,l,b;let{className:_,data:{relationTo:v,value:g},nodeKey:f}=e;if("object"==typeof g)throw Error("Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.");let j=(0,h.useRef)(null),[w]=(0,s.DF)(),x=(0,c.a)(),{config:{routes:{api:N},serverURL:C},getEntityConfig:R}=(0,r.c)(),[k]=(0,h.useState)(()=>R({collectionSlug:v})),{i18n:D,t:y}=(0,u.d)(),[S,B]=(0,h.useReducer)(e=>e+1,0),[{data:E},{setParams:P}]=(0,d.usePayloadAPI)("".concat(C).concat(N,"/").concat(k.slug,"/").concat(g),{initialParams:m}),{closeDocumentDrawer:T,DocumentDrawer:A,DocumentDrawerToggler:K}=(0,o.a)({id:g,collectionSlug:k.slug}),L=(0,h.useCallback)(()=>{w.update(()=>{var e;null==(e=(0,p.nsf)(f))||e.remove()})},[w,f]),F=h.useCallback(()=>{P({...m,cacheBust:S}),T(),B()},[S,P,T]);return(0,n.jsxs)("div",{className:"".concat(_,"__contents"),contentEditable:!1,ref:j,children:[(0,n.jsxs)("div",{className:"".concat(_,"__wrap"),children:[(0,n.jsx)("p",{className:"".concat(_,"__label"),children:y("fields:labelRelationship",{label:(null==(a=k.labels)?void 0:a.singular)?(0,i.s)(null==(l=k.labels)?void 0:l.singular,D):k.slug})}),(0,n.jsx)(K,{className:"".concat(_,"__doc-drawer-toggler"),children:(0,n.jsx)("p",{className:"".concat(_,"__title"),children:E?E[(null==k||null==(b=k.admin)?void 0:b.useAsTitle)||"id"]:g})})]}),x&&(0,n.jsxs)("div",{className:"".concat(_,"__actions"),children:[(0,n.jsx)(d.Button,{buttonStyle:"icon-label",className:"".concat(_,"__swapButton"),disabled:!x,el:"button",icon:"swap",onClick:()=>{f&&w.dispatchCommand(t.a,{replace:{nodeKey:f}})},round:!0,tooltip:y("fields:swapRelationship")}),(0,n.jsx)(d.Button,{buttonStyle:"icon-label",className:"".concat(_,"__removeButton"),disabled:!x,icon:"x",onClick:e=>{e.preventDefault(),L()},round:!0,tooltip:y("fields:removeRelationship")})]}),!!g&&(0,n.jsx)(A,{onSave:F})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.