PageSourceSearch

https://storybookrpg.com/_next/static/chunks/2319-ea261ea5d083efd5.js

js storybookrpg.com collected 2026-10-09 22:59:46 UTC 8,137 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2319],{12319:(e,t,i)=>{i.d(t,{default:()=>m});var a=i(95155),r=i(12115),s=i(32265),o=i(55958),l=i(13630),n=i(98460),d=i(21985),c=i(51115),p=i(59317),h=i(34282);let u={target_storybook_id:"",relationship:"ally",status:"requested",requires_source_membership:!1,trait_mappings:[]};function g(e){return e?{...e,trait_mappings:e.trait_mappings.map(e=>({...e}))}:{...u,trait_mappings:[]}}function m(){let{storybook:e,canManage:t}=(0,n.x)(),i=(0,d.$)(),{world:u,loading:m,error:_,reload:b}=(0,h.p)(e.id),[x,k]=(0,r.useState)([]),[j,v]=(0,r.useState)(!0),[y,f]=(0,r.useState)(null),[w,C]=(0,r.useState)(null),[S,N]=(0,r.useState)(g()),[A,q]=(0,r.useState)(!1),[z,D]=(0,r.useState)("idle"),[I,M]=(0,r.useState)(null),E=(0,r.useMemo)(()=>x.find(e=>e.target_storybook_id===w)||null,[x,w]),R=t("allies"),F=(0,r.useCallback)(async t=>{v(!0),f(null);try{let i=await p.EI.listManagedAlliances(e.id,t);if(null==t?void 0:t.aborted)return;k(i),C(e=>{var t;return e&&i.some(t=>t.target_storybook_id===e)?e:(null==(t=i[0])?void 0:t.target_storybook_id)||null})}catch(e){if((0,p.jz)(e)||(null==t?void 0:t.aborted))return;f((0,p.G0)(e))}finally{(null==t?void 0:t.aborted)||v(!1)}},[e.id]);(0,r.useEffect)(()=>{if("authenticated"!==i.status)return void v(!0);let e=new AbortController;return F(e.signal),()=>e.abort()},[F,i.epoch,i.status,i.uid]),(0,r.useEffect)(()=>{A||N(g(E)),D("idle"),M(null)},[A,E]);let L=()=>{q(!0),C(null),N(g())},T=async()=>{if(!S.target_storybook_id.trim()){M("Enter the stable ID of the Storybook to link."),D("error");return}D("saving"),M(null);try{let t=await p.EI.upsertAlliance(e.id,S.target_storybook_id.trim(),{relationship:S.relationship,status:S.status,requires_source_membership:S.requires_source_membership,trait_mappings:S.trait_mappings});k(e=>e.some(e=>e.target_storybook_id===t.target_storybook_id)?e.map(e=>e.target_storybook_id===t.target_storybook_id?t:e):[t,...e]),C(t.target_storybook_id),q(!1),N(g(t)),D("saved")}catch(e){M((0,p.G0)(e)),D("error")}};if(m||j)return(0,a.jsx)(c.ld,{label:"Loading linked Storybooks…"});let G=_||y;return G?(0,a.jsx)(c.bJ,{message:G,onRetry:()=>{b(),F()}}):(0,a.jsx)(c.Sq,{eyebrow:"".concat(x.filter(e=>"active"===e.status).length," active \xb7 ").concat(x.filter(e=>"requested"===e.status).length," requested \xb7 ").concat(x.filter(e=>"revoked"===e.status).length," revoked"),title:"Allied Storybooks",description:"Connect parent, child, and allied worlds. Membership requirements control travel; trait mappings decide what another world recognizes or copies on entry.",action:(0,a.jsxs)(c.tA,{onClick:L,disabled:!R,children:[(0,a.jsx)(s.A,{size:14})," Link Storybook"]}),children:(0,a.jsxs)("div",{className:"grid gap-6 lg:grid-cols-[minmax(250px,0.72fr)_minmax(0,1.8fr)]",children:[(0,a.jsx)("aside",{className:"space-y-2","aria-label":"Linked Storybooks",children:0===x.length?(0,a.jsx)(c.pp,{title:"No worlds are linked",description:"Create an alliance when members should travel between Storybooks or carry recognized progress."}):x.map(e=>(0,a.jsx)(c.mE,{active:!A&&e.target_storybook_id===w,title:e.target_storybook_id,meta:"".concat(e.relationship," \xb7 ").concat(e.status),detail:"".concat(e.trait_mappings.length," trait ").concat(1===e.trait_mappings.length?"mapping":"mappings"),onClick:()=>{q(!1),C(e.target_storybook_id)}},e.target_storybook_id))}),A||E?(0,a.jsx)("div",{className:"border-l-[3px] border-[#a4773f] pl-0 lg:pl-1",children:(0,a.jsx)(c.Zk,{title:A?"Link another world":S.target_storybook_id,description:"A link is directional. Configure the reciprocal link in the other Storybook when both worlds should describe the relationship.",action:(0,a.jsx)(o.A,{size:18,className:"text-[#b88749]"}),children:(0,a.jsxs)("fieldset",{disabled:!R,className:"space-y-7 disabled:opacity-60",children:[(0,a.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:[(0,a.jsx)(c.D0,{label:"Target Storybook ID",htmlFor:"ally-target-id",children:(0,a.jsx)(c.ks,{id:"ally-target-id",value:S.target_storybook_id,disabled:!A,onChange:e=>N({...S,target_storybook_id:e.target.value.trim()}),placeholder:"hidden_leaf_village"})}),(0,a.jsx)(c.D0,{label:"Relationship",htmlFor:"ally-relationship",children:(0,a.jsxs)(c.IM,{id:"ally-relationship",value:S.relationship,onChange:e=>N({...S,relationship:e.target.value}),children:[(0,a.jsx)("option",{value:"parent",children:"Parent world"}),(0,a.jsx)("option",{value:"child",children:"Child world"}),(0,a.jsx)("option",{value:"ally",children:"Allied world"})]})}),(0,a.jsx)(c.D0,{label:"Link status",htmlFor:"ally-status",children:(0,a.jsxs)(c.IM,{id:"ally-status",value:S.status,onChange:e=>N({...S,status:e.target.value}),children:[(0,a.jsx)("option",{value:"requested",children:"Requested"}),(0,a.jsx)("option",{value:"active",children:"Active"}),(0,a.jsx)("option",{value:"revoked",children:"Revoked"})]})}),(0,a.jsx)(c.lM,{checked:S.requires_source_membership,onChange:e=>N({...S,requires_source_membership:e}),label:"Require source membership",description:"Travel requires an active membership in this Storybook."})]}),(0,a.jsxs)("section",{"aria-labelledby":"trait-mappings-heading",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{id:"trait-mappings-heading",className:"font-serif-accent text-[19px] text-[#e7dcc8]",children:"Trait mappings"}),(0,a.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-[#85817a]",children:"Recognize reads the source value across the link. Copy on join seeds a separate value when a Persona enters."})]}),(0,a.jsxs)(c.tA,{onClick:()=>N({...S,trait_mappings:[...S.trait_mappings,{source_trait_id:"",target_trait_id:"",mode:"recognize"}]}),children:[(0,a.jsx)(s.A,{size:14})," Add mapping"]})]}),(0,a.jsx)("div",{className:"mt-4 space-y-4",children:0===S.trait_mappings.length?(0,a.jsx)("p",{className:"border border-dashed border-[#544d42] px-4 py-6 text-center text-[12px] text-[#817d76]",children:"No traits cross this world link."}):S.trait_mappings.map((e,t)=>(0,a.jsxs)("div",{className:"grid gap-3 border-b border-[#4f493f] pb-4 sm:grid-cols-[1fr_1fr_190px_auto] sm:items-end",children:[(0,a.jsx)(c.D0,{label:"Source trait",htmlFor:"mapping-".concat(t,"-source"),children:(0,a.jsxs)(c.IM,{id:"mapping-".concat(t,"-source"),value:e.source_trait_id,onChange:e=>N({...S,trait_mappings:S.trait_mappings.map((i,a)=>a===t?{...i,source_trait_id:e.target.value}:i)}),children:[(0,a.jsx)("option",{value:"",children:"Choose a local trait"}),((null==u?void 0:u.definition.traits)||[]).map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,a.jsx)(c.D0,{label:"Target trait ID",htmlFor:"mapping-".concat(t,"-target"),children:(0,a.jsx)(c.ks,{id:"mapping-".concat(t,"-target"),value:e.target_trait_id,onChange:e=>N({...S,trait_mappings:S.trait_mappings.map((i,a)=>a===t?{...i,target_trait_id:e.target.value}:i)})})}),(0,a.jsx)(c.D0,{label:"Transfer mode",htmlFor:"mapping-".concat(t,"-mode"),children:(0,a.jsxs)(c.IM,{id:"mapping-".concat(t,"-mode"),value:e.mode,onCh
1ange:e=>N({...S,trait_mappings:S.trait_mappings.map((i,a)=>a===t?{...i,mode:e.target.value}:i)}),children:[(0,a.jsx)("option",{value:"recognize",children:"Recognize"}),(0,a.jsx)("option",{value:"copy_on_join",children:"Copy on join"})]})}),(0,a.jsx)(c.tA,{onClick:()=>N({...S,trait_mappings:S.trait_mappings.filter((e,i)=>i!==t)}),"aria-label":"Remove trait mapping ".concat(t+1),className:"h-11 px-3",children:(0,a.jsx)(l.A,{size:14})})]},"".concat(e.source_trait_id,"-").concat(t)))})]}),(0,a.jsxs)("div",{className:"flex flex-col-reverse gap-3 border-t border-[#50483d] pt-5 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)(c.Mo,{state:z,error:I}),(0,a.jsx)(c.yY,{state:z,onClick:()=>void T(),disabled:!R,children:A?"Create world link":"Save world link"})]})]})})}):(0,a.jsx)(c.pp,{title:"Choose a linked world",description:"Select a Storybook link to inspect travel and trait mapping rules.",action:(0,a.jsxs)(c.tA,{onClick:L,children:[(0,a.jsx)(s.A,{size:14})," Link Storybook"]})})]})})}}}]);

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.