import{cd as H,aK as c,s as p,bH as r,v as m,I as s,cn as V,aW as F,cl as G,aS as q,aQ as z,ct as M,bi as o,t as y,cs as S,u as P,co as D,aV as E,F as k,ch as T,ci as v,b9 as f,H as g,cQ as Y,c5 as Q}from"./index-UvaAT40e.js";import{O as K}from"./ObjectBar-BQn-rAYH.js";import{T as J}from"./ThreeColumnLayout-BRd-Jgmr.js";import{T as Z}from"./Tooltip-DTPzcq8Y.js";import{L as ee}from"./LoadingSpinner-CRcacgcO.js";import{_ as A,P as te}from"./PlaceHolderImage-OI0HV4no.js";import{I as ae,_ as re}from"./ImageViewer-B7OLRv7S.js";import{A as U}from"./Anchor-DbUVFTxQ.js";import{e as B,u as oe,a as se,c as ne,d as ie,S as _e}from"./useTriplestore-BZngkwQJ.js";import{a as N,c as C}from"./triplestore-YmGWX4yk.js";import{V as le,a as ce,b as de,c as pe}from"./VTabs-CxMeqQ0V.js";/* empty css */import"./ChildTreeSearchButton-C65ZPLlZ.js";import"./_commonjsHelpers-C4iS2aBk.js";import"./VSlider-tpXMn7rf.js";import"./VSliderTrack-BSvqM6gM.js";import"./VInput-tBjZAjEz.js";import"./VDataTable-BagkVmHP.js";import"./VChip-DWC_1h7b.js";import"./VSlideGroup-BkB-Mi6K.js";import"./transform-CA9Jdjju.js";import"./ObjectCard-Ck5X7LdM.js";const ue={class:"d-flex align-center justify-space-between"},me={__name:"ListCard",props:{to:{type:Object,required:!1,default:()=>null}},setup(t){return(a,e)=>(c(),p(G,{to:t.to,style:{width:"100%"},class:"list-card mb-2",variant:"outlined"},{default:r(()=>[m("div",ue,[s(V,{class:"text-body-2 pa-2 name"},{default:r(()=>[F(a.$slots,"left-text",{},void 0,!0)]),_:3}),s(V,{class:"text-right pa-2"},{default:r(()=>[F(a.$slots,"right-text",{},void 0,!0)]),_:3})])]),_:3},8,["to"]))}},be=H(me,[["__scopeId","data-v-3a49a95c"]]),O=` BASE <https://db.antiquitatum-thesaurus.eu> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> PREFIX owl: <http://www.w3.org/2002/07/owl#> `,fe={production_person:"Herstellung",commission_person:"Auftrag",modification_person:"Überarbeitung",find_person:"Auffindung",provenance_person:"Provenienz",depicted_person:"Abbildung"},h={production_person:t=>`?object crm:P108i_was_produced_by / crm:P01i_is_domain_of ?x . ?x crm:P02_has_range <person/${t}> . ?x crm:P14.1_in_the_role_of ?role_iri . ?role_iri rdfs:label ?role .`,commission_person:t=>`?object crm:P108i_was_produced_by / crm:P17_was_motivated_by / crm:P01i_is_domain_of ?x . ?x crm:P02_has_range <person/${t}> . ?x crm:P14.1_in_the_role_of ?role_iri . ?role_iri rdfs:label ?role .`,modification_person:t=>`?object crm:P31i_was_modified_by / crm:P01i_is_domain_of ?x . ?x crm:P02_has_range <person/${t}> . ?x crm:P14.1_in_the_role_of ?role_iri . ?role_iri rdfs:label ?role .`,find_person:t=>`?object crm:O19i_was_objectencountered_at / crm:P01i_is_domain_of ?x . ?x crm:P02_has_range <person/${t}> . ?x crm:P14.1_in_the_role_of ?role_iri . ?role_iri rdfs:label ?role .`,provenance_person:t=>`?object crm:P30i_custody_transferred_through ?transfer_of_custody . ?transfer_of_custody crm:P2_has_type <type/provenance> . ?transfer_of_custody crm:P29_custody_received_by <person/${t}> . <person/${t}> crm:P2_has_type ?role_iri . FILTER (?role_iri = <type/owner>) ?role_iri rdfs:label ?role . FILTER (lang(?role) = "de") `,depicted_person:t=>`?object crm:P62_depicts <person/${t}> .`};function W(t,a){let[,e,i,n]=t.split("T")[0].match(/(-*\d+)-(\d+)-(\d+)/);if(a==11)return{from_date:`${e}-${i}-${n}`,to_date:`${e}-${i}-${n}`};if(a==9)return{from_date:`${e}-${i}-${n}`,to_date:`${e}-12-31`};if(a==8)return{from_date:`${e}-${i}-${n}`,to_date:`${+e+9}-12-31`};if(a==7)return{from_date:`${e}-${i}-${n}`,to_date:`${+e+99}-12-31`};if(a==6)return{from_date:`${e}-${i}-${n}`,to_date:`${+e+999}-12-31`}}function x(t,a,e){let i=[],n=[];if(typeof a=="string"&&(a=[a]),a&&a.length)for(const u of a){let[b,I]=u.split("-IS_OR-");if(b=="context"&&e!="context")for(const w of I.split("-OR-"))i.push(w);else if(b=="roles"&&e!="roles")for(const w of I.split("-OR-"))n.push(`?role_iri = <type/${w}>`)}i.length==0&&(i=Object.keys(h));let l=`{ ${i.map(u=>h[u](t)).join("} UNION {")} }`;return n.length>0&&(l+=`FILTER ( ${n.join(" || ")}) .`),l}async function ge({id:t,lang:a,signal:e}){let i=` ${O} PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX psv: <http://www.wikidata.org/prop/statement/value/> PREFIX p: <http://www.wikidata.org/prop/> PREFIX wikibase: <http://wikiba.se/ontology#> SELECT * WHERE { <person/${t}> crm:P1_is_identified_by / crm:P190_has_symbolic_content ?person_name . OPTIONAL { <person/${t}> owl:sameAs ?person_gnd . } SERVICE <https://query.wikidata.org/sparql> { OPTIONAL { ?wd wdt:P227 "${t.replace("gnd_","")}" . { ?wd p:P569 / psv:P569 ?birth_date . ?birth_date wikibase:timeValue ?birth_date_value . ?birth_date wikibase:timePrecision ?birth_date_precision . } UNION { ?wd wdt:P19 ?birth_place . ?birth_place rdfs:label ?birth_place_label . FILTER (LANG(?birth_place_label) = "${a}") . } UNION { ?wd p:P570 / psv:P570 ?death_date . ?death_date wikibase:timeValue ?death_date_value . ?death_date wikibase:timePrecision ?death_date_precision . } UNION { ?wd wdt:P20 ?death_place . ?death_place rdfs:label ?death_place_label . FILTER (LANG(?death_place_label) = "${a}") . } UNION { ?wd wdt:P106 ?occupation . ?occupation rdfs:label ?occupation_label . FILTER (LANG(?occupation_label) = "${a}") . } UNION { ?wd wdt:P18 ?image . } } } } `,n=await N(i,{signal:e}),l=C(n,{person:{wikidata:"wd",name:"person_name",gnd:"person_gnd",birth_date:"birth_date_value",birth_date_precision:"birth_date_precision",birth_place:"birth_place_label",death_date:"death_date_value",death_date_precision:"death_date_precision",death_place:"death_place_label",occupation:["occupation_label"],images:[{image_url:"image"}]}});return l.person.birth_date&&(l.person.birth_date=W(l.person.birth_date,l.person.birth_date_precision)),l.person.death_date&&(l.person.death_date=W(l.person.death_date,l.person.death_date_precision)),l.person}async function he({id:t,signal:a}){let e=` ${O} SELECT (COUNT(DISTINCT ?all_objects) as ?count) ?person ?person_name WHERE { ?object ( crm:P108i_was_produced_by | crm:O19i_was_objectencountered_at | crm:P31i_was_modified_by | (crm:P108i_was_produced_by / crm:P17_was_motivated_by) ) / crm:P01i_is_domain_of ?x . ?x crm:P02_has_range <person/${t}> . ?base_object crm:P46i_forms_part_of* ?object . ?object a crm:E24_Physical_Human-Made_Thing . FILTER NOT EXISTS { ?base_object crm:P46i_forms_part_of ?x . ?x a crm:E24_Physical_Human-Made_Thing . } . ?all_objects crm:P46_is_composed_of* ?base_object . ?all_objects ( crm:P108i_was_produced_by | crm:O19i_was_objectencountered_at | crm:P31i_was_modified_by | (crm:P108i_was_produced_by / crm:P17_was_motivated_by) ) / crm:P01i_is_domain_of ?y . ?y a crm:PC14_carried_out_by . ?y crm:P02_has_range ?person . FILTER (?person != <person/${t}>) ?person crm:P1_is_identified_by / crm:P190_has_symbolic_content ?person_name } GROUP BY ?person ?person_name ORDER BY DESC(?count) ASC(?person_name) `,i=await N(e,{signal:a}),n=C(i,{results:[{iri:"person",name:"person_name",count:"count"}]});return n.results?n.results:[]}async function we({id:t,qfilter:a,signal:e}){let i=` ${O} SELECT (COUNT(DISTINCT ?prod_object) as ?production_person) (COUNT(DISTINCT ?find_object) as ?find_person) (COUNT(DISTINCT ?mod_object) as ?modification_person) (COUNT(DISTINCT ?prov_object) as ?provenance_person) (COUNT(DISTINCT ?depiction_object) as ?depicted_person) WHERE { ${x(t,a,"context")} OPTIONAL { ${h.production_person(t)} BIND(?object as ?prod_object) } OPTIONAL { ${h.find_person(t)} BIND(?object as ?find_object) } OPTIONAL { ${h.modification_person(t)} BIND(?object as ?mod_object) } OPTIONAL { ${h.provenance_person(t)} BIND(?object as ?prov_object) } OPTIONAL { ${h.depicted_person(t)} BIND(?object as ?depiction_object) } } `,n=await N(i,{signal:e}),l=[];for(const[u,b]of Object.entries(n.results.bindings[0]))+b.value>0&&l.push({label:fe[u],count:+b.value,iri:u});return l}async function ye({id:t,qfilter:a,lang:e,signal:i}){let n=` ${O} SELECT ?role ?role_iri (COUNT(?object) as ?count) WHERE { ${x(t,a,"roles")} FILTER (LANG(?role) = "${e}") . } GROUP BY ?role ?role_iri `,l=await N(n,{signal:i}),u=C(l,{results:[{label:"role",count:"count",iri:"role_iri"}]});return u.results?u.results:[]}const $={build_person_condition:x,get_person_data:ge,get_related_persons:he,get_person_aggregation:we,get_role_aggregation:ye},Pe={key:0},$e={class:"text-body-2"},Ie={key:1},je={key:1},Te={class:"mt-2 pa-1 scroll-box"},ve={__name:"Person",setup(t){const a=q(),{data:e,dataLoading:i}=B($.get_person_data),{data:n,dataLoading:l}=B($.get_related_persons),{objectsCount:u,iris:b,searchLoading:I}=oe({conditionFunction:$.build_person_condition,defaultResultsPerPage:20}),{objectCardsData:w,objectCardsDataLoading:L}=se(b),{objectCardsDataWithRelations:X}=ne(w);let R=z({no_grouping:{roles:{type:"term_aggregation",loading:!0,values:[],fetch_function:$.get_role_aggregation},context:{type:"term_aggregation",loading:!0,values:[],fetch_function:$.get_person_aggregation}}});return ie(R,L),(j,d)=>(c(),p(M,null,{default:r(()=>[s(K),s(J,null,{"col-1":r(()=>[j.$vuetify.display.xs?(c(),p(A,{key:0,class:"px-2 mb-3",title:o(e).name},null,8,["title"])):y("",!0),s(S,{border:"",rounded:"",height:476},{default:r(()=>[o(i)?(c(),p(ee,{key:0})):o(e).images.length?(c(),p(ae,{key:1,"image-data":o(e).images,height:"430",copyright:"Wikimedia"},null,8,["image-data"])):(c(),p(te,{key:2}))]),_:1})]),"col-2":r(()=>[s(S,{class:"px-2"},{default:r(()=>[j.$vuetify.display.xs?y("",!0):(c(),P("div",Pe,[s(A,{title:o(e).name},null,8,["title"]),s(D,{class:"my-4"})])),m("span",$e,[(c(),P(k,null,E(["birth","death"],_=>m("div",{key:_},[o(e)[`${_}_place`]||o(e)[`${_}_date`]?(c(),p(T,{key:0},{default:r(()=>[s(v,{cols:"4"},{default:r(()=>[m("h5",null,f(j.$t(`person_page.${_}`))+":",1)]),_:2},1024),s(v,{cols:"8"},{default:r(()=>[o(e)[`${_}_date`]?(c(),p(re,{key:0,data:o(e)[`${_}_date`]},null,8,["data"])):y("",!0),o(e)[`${_}_place`]?(c(),P("span",Ie," in "+f(o(e)[`${_}_place`]),1)):y("",!0),s(U,{url:o(e).wikidata,sup:""},{default:r(()=>d[2]||(d[2]=[g(" WD")])),_:1},8,["url"])]),_:2},1024)]),_:2},1024)):y("",!0)])),64)),"occupation"in o(e)&&o(e).occupation.length?(c(),p(T,{key:0},{default:r(()=>[s(v,{cols:"4"},{default:r(()=>[m("h5",null,f(j.$t("person_page.occupation"))+":",1)]),_:1}),s(v,{cols:"8"},{default:r(()=>[(c(!0),P(k,null,E(o(e).occupation,_=>(c(),p(T,{key:_,class:"ma-0 pa-0 mb-1"},{default:r(()=>[g(f(_)+" ",1),s(U,{url:o(e).wikidata,sup:""},{default:r(()=>d[3]||(d[3]=[g(" WD")])),_:1},8,["url"])]),_:2},1024))),128))]),_:1})]),_:1})):y("",!0)])]),_:1})]),"col-3":r(()=>[s(le,{modelValue:a.value,"onUpdate:modelValue":d[0]||(d[0]=_=>a.value=_),style:{"margin-top":"3.5px"}},{default:r(()=>[s(ce,{ripple:!1},{default:r(()=>[m("span",null,[d[6]||(d[6]=g(" Ähnliche Personen ")),o(l)?(c(),p(Y,{key:0,class:"mx-1",size:"20",width:"3",indeterminate:"",color:"grey-lighten-4"})):(c(),P("span",je,"("+f(o(n).length)+") ",1)),s(Z,{"nudge-bottom":12},{activator:r(()=>[s(Q,{size:"24",color:"grey"},{default:r(()=>d[4]||(d[4]=[g("mdi-information")])),_:1})]),content:r(()=>d[5]||(d[5]=[m("span",null," Der Grad der Ähnlichkeit wird anhand der Anzahl gemeinsam beteiligter Objekte berechnet. ",-1)])),_:1})])]),_:1})]),_:1},8,["modelValue"]),s(de,{modelValue:a.value,"onUpdate:modelValue":d[1]||(d[1]=_=>a.value=_)},{default:r(()=>[s(pe,null,{default:r(()=>[m("div",Te,[(c(!0),P(k,null,E(o(n),_=>(c(),p(T,{key:_.iri,class:"ma-0 pa-0"},{default:r(()=>[s(be,{to:{name:"Person",params:{id:_.iri.split("/").slice(-1)[0]}}},{"left-text":r(()=>[g(f(_.name),1)]),"right-text":r(()=>[g(" ("+f(_.count)+") ",1)]),_:2},1032,["to"])]),_:2},1024))),128))])]),_:1})]),_:1},8,["modelValue"])]),_:1}),s(D),s(_e,{"object-cards-data":o(w),"object-cards-data-with-relations":o(X),"search-loading":o(I)||o(L),"total-count":o(u),aggregation:o(R),"default-results-per-page":20,"default-sorting":"production_date_asc",mode:"objects_person"},null,8,["object-cards-data","object-cards-data-with-relations","search-loading","total-count","aggregation"])]),_:1}))}},Ye=H(ve,[["__scopeId","data-v-cc036149"]]);export{Ye as default};