import{af as C,ad as F,ac as X,b6 as v}from"./index-pVvkWKzi.js";function P(_,i){let e={};for(const t of _.results.bindings)e=j(t,e,i);return e}function j(_,i,e){for(const[t,r]of Object.entries(e))if(typeof r=="string"){if(r in _){let s=_[r].value;(s==="true"||s==="false")&&(s=s==="true"),i[t]=s}}else if(Array.isArray(r)){t in i||(i[t]=[]);for(const s of r)if(typeof s=="string"&&_[s]){let c=_[s].value;c&&i[t].push(c)}else{let c=j(_,{},s);Object.keys(c).length>0&&i[t].push(c)}}else t in i||(i[t]={}),j(_,i[t],r),Object.keys(i[t]).length==0&&delete i[t];return i}function W(_){let i=_.match(/Point\((-*\d+.\d+) (-*\d+.\d+)\)/i);return[i[1],i[2]]}const w=`
  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#>
  PREFIX at: <https://db.antiquitatum-thesaurus.eu/ontology/>
`,u=`
  ?iri crm:P1_is_identified_by ?title .
  ?title crm:P2_has_type <type/preferred_title> .
  ?title crm:P190_has_symbolic_content ?label .
`,D=`
  ?iri crm:P1_is_identified_by ?title .
  ?title crm:P190_has_symbolic_content ?label .
`,y=`
  ?iri rdfs:label ?label .
  FILTER (LANG(?label) = "de") .
  `,f="?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .",S={object_type:y,classification:y,material:y,technique:y,mode_of_depiction:y,find_place:f,production_place:f,location:f,custody:f,provenance_institution:f,production_person:f,provenance_person:f,find_person:f,modification_person:f,depicted_person:f,depicted_place:f,is_part_of_source_work:u,is_depicted_in:u,depicts:u,is_copy_after:u,has_copy:u,is_based_on:u,is_precursor_for:u,is_related_to:u,is_duplicate_of:u,part_of_module:D,has_version:u,is_version_of:u};function I(_){return _=="object_type"?"?iri crm:P2_has_type <type/object_type> .":_=="classification"?"?iri crm:P2_has_type <type/classification> .":""}const A={object_type:(_,i)=>`
    ${_} crm:P2_has_type ${i} .
  `,classification:(_,i)=>`
    ${_} crm:P2_has_type ${i} .
  `,material:(_,i)=>`${_} crm:P45_consists_of ${i} .`,technique:(_,i)=>`
    ${_} crm:P108i_was_produced_by / crm:P32_used_general_technique ${i} .`,mode_of_depiction:(_,i,e,t)=>`
    ${_} crm:P01i_is_domain_of ?depicts_${e.join("_")}_${t} .
    ?depicts_${e.join("_")}_${t} a crm:PC62_depicts .
    ?depicts_${e.join("_")}_${t} crm:P62.1_mode_of_depiction ${i} .
  `,find_place:(_,i)=>`
    ${_} crm:O19i_was_objectencountered_at / crm:P7_took_place_at ${i} .`,production_place:(_,i)=>`${_} crm:P108i_was_produced_by / crm:P7_took_place_at ${i} .`,location:(_,i)=>`${_} crm:P55_has_current_location ${i} .`,all_places:(_,i)=>`
    ${_} crm:P55_has_current_location
      | ( crm:P108i_was_produced_by / crm:P7_took_place_at )
      | ( crm:O19i_was_objectencountered_at / crm:P7_took_place_at )
    ${i} .
  `,custody:(_,i,e,t)=>`
    ${_} crm:P30i_custody_transferred_through ?transfer_of_custody_${e.join("_")}_${t} . 
    ?transfer_of_custody_${e.join("_")}_${t} crm:P2_has_type <type/acquisition> .
    ?transfer_of_custody_${e.join("_")}_${t} crm:P29_custody_received_by ${i} .
  `,provenance_institution:(_,i,e,t)=>`
    ${_} crm:P30i_custody_transferred_through ?transfer_of_custody_${e.join("_")}_${t} .
    ?transfer_of_custody_${e.join("_")}_${t} crm:P2_has_type <type/provenance> .
    ?transfer_of_custody_${e.join("_")}_${t} crm:P29_custody_received_by ${i} .
  `,all_persons:(_,i,e,t)=>`
    {
      ${_} (crm:P108i_was_produced_by | crm:O19i_was_objectencountered_at | crm:P31i_was_modified_by) / crm:P01i_is_domain_of ?role_${e.join("_")}_${t} .
      ?role_${e.join("_")}_${t} a crm:PC14_carried_out_by .
      ?role_${e.join("_")}_${t} crm:P02_has_range ${i} .
    } UNION {
      ${_} crm:P30i_custody_transferred_through ?transfer_of_custody_${e.join("_")}_${t} .
      ?transfer_of_custody_${e.join("_")}_${t} crm:P2_has_type <type/provenance> .
      ?transfer_of_custody_${e.join("_")}_${t} crm:P29_custody_received_by ${i} .
    } UNION {
      ${_} crm:P62_depicts ${i} .
      ${i} a crm:E21_Person .
    }
  `,production_person:(_,i,e,t)=>`
    ${_} crm:P108i_was_produced_by / crm:P01i_is_domain_of ?role_${e.join("_")}_${t} .
    ?role_${e.join("_")}_${t} a crm:PC14_carried_out_by .
    ?role_${e.join("_")}_${t} crm:P02_has_range ${i} .
  `,provenance_person:(_,i,e,t)=>`
    ${_} crm:P30i_custody_transferred_through ?transfer_of_custody_${e.join("_")}_${t} .
    ?transfer_of_custody_${e.join("_")}_${t} crm:P2_has_type <type/provenance> .
    ?transfer_of_custody_${e.join("_")}_${t} crm:P29_custody_received_by ${i} .
  `,find_person:(_,i,e,t)=>`
    ${_} crm:O19i_was_objectencountered_at / crm:P01i_is_domain_of ?role_${e.join("_")}_${t} . 
    ?role_${e.join("_")}_${t} a crm:PC14_carried_out_by .
    ?role_${e.join("_")}_${t} crm:P02_has_range ${i} .
  `,modification_person:(_,i,e,t)=>`
    ${_} crm:P31i_was_modified_by / crm:P01i_is_domain_of ?role_${e.join("_")}_${t} .
    ?role_${e.join("_")}_${t} a crm:PC14_carried_out_by .
    ?role_${e.join("_")}_${t} crm:P02_has_range ${i} .
  `,depicted_person:(_,i)=>`
    ${_} crm:P62_depicts ${i} .
    ${i} a crm:E21_Person .
  `,depicted_place:(_,i)=>`
    ${_} crm:P62_depicts ${i} .
    ${i} a crm:E53_Place .
  `,is_part_of_source_work:(_,i)=>` ${_} at:is_part_of_source_work ${i} .`,is_part_of_source_work_subQueries:(_,i,e)=>`
    ${_} at:is_part_of_source_work ?object_${e.join("_")} .
  `,depicts:(_,i,e)=>`
    ${_} crm:P01i_is_domain_of ?depicts_${e.join("_")} .
    ?depicts_${e.join("_")} a crm:PC62_depicts .
    ?depicts_${e.join("_")} crm:P02_has_range ${i} .`,depicts_subQueries:(_,i,e)=>`${_} crm:P01i_is_domain_of ?depicts_${e.join("_")} .
    ?depicts_${e.join("_")} a crm:PC62_depicts .
    ?depicts_${e.join("_")} crm:P02_has_range ?object_${e.join("_")} .`,is_depicted_in:(_,i,e)=>`
    ${_} crm:P02i_is_range_of ?depicts_${e.join("_")} .
    ?depicts_${e.join("_")} a crm:PC62_depicts .
    { ?depicts_${e.join("_")} crm:P01_has_domain / at:is_part_of_source_work ${i} . } 
    UNION 
    { FILTER NOT EXISTS { ?depicts_${e.join("_")} crm:P01_has_domain / at:is_part_of_source_work ?father_${e.join("_")} . }
      ?depicts_${e.join("_")} crm:P01_has_domain ${i} .
    }`,is_depicted_in_subQueries:(_,i,e)=>`
    ${_} crm:P02i_is_range_of ?depicts_${e.join("_")} .
    ?depicts_${e.join("_")} a crm:PC62_depicts .
    ?depicts_${e.join("_")} crm:P01_has_domain ?object_${e.join("_")} .`,has_copy:(_,i,e)=>`
    ${_} crm:P02i_is_range_of ?has_copy_${e.join("_")} .
    ?has_copy_${e.join("_")} crm:P16.1_mode_of_use <type/original> .
    ?has_copy_${e.join("_")} crm:P01_has_domain ?domain_${e.join("_")} .
    { ?domain_${e.join("_")} crm:P108_has_produced / at:is_part_of_source_work ${i} . }
     UNION
    {  ?domain_${e.join("_")} crm:P108_has_produced ${i} .
       FILTER NOT EXISTS { ${i} at:is_part_of_source_work ?father_${e.join("_")} . }
    }
  `,has_copy_subQueries:(_,i,e)=>`
    ${_} crm:P02i_is_range_of ?has_copy_${e.join("_")} .
    ?has_copy_${e.join("_")} crm:P16.1_mode_of_use <type/original> .
    ?has_copy_${e.join("_")} crm:P01_has_domain / crm:P108_has_produced ?object_${e.join("_")} .
  `,is_copy_after:(_,i,e)=>`
    ${_} crm:P108i_was_produced_by / crm:P01i_is_domain_of ?copy_after_${e.join("_")} .
    ?copy_after_${e.join("_")} crm:P16.1_mode_of_use <type/original> .
    { ?copy_after_${e.join("_")} crm:P02_has_range / at:is_part_of_source_work ${i} . }
     UNION 
    { FILTER NOT EXISTS { ?copy_after_${e.join("_")} crm:P02_has_range / at:is_part_of_source_work ?father_${e.join("_")} . } 
      ?copy_after_${e.join("_")} crm:P02_has_range ${i} .
    }
  `,is_copy_after_subQueries:(_,i,e)=>`
    ${_} crm:P108i_was_produced_by / crm:P01i_is_domain_of ?copy_after_${e.join("_")} .
    ?copy_after_${e.join("_")} crm:P16.1_mode_of_use <type/original> .
    ?copy_after_${e.join("_")} crm:P02_has_range ?object_${e.join("_")} .
  `,is_based_on:(_,i,e)=>`
    ${_} crm:P108i_was_produced_by / crm:P01i_is_domain_of ?based_on_${e.join("_")} .
    ?based_on_${e.join("_")} crm:P16.1_mode_of_use <type/precursor> .
    { ?based_on_${e.join("_")} crm:P02_has_range / at:is_part_of_source_work ${i} . }
     UNION 
    { FILTER NOT EXISTS { ?based_on_${e.join("_")} crm:P02_has_range / at:is_part_of_source_work ?father_${e.join("_")} . }
      ?based_on_${e.join("_")} crm:P02_has_range ${i} .
    }
  `,is_based_on_subQueries:(_,i,e)=>`
    ${_} crm:P108i_was_produced_by / crm:P01i_is_domain_of ?based_on_${e.join("_")} .
    ?based_on_${e.join("_")} crm:P16.1_mode_of_use <type/precursor> .
    ?based_on_${e.join("_")} crm:P02_has_range ?object_${e.join("_")} .
  `,is_precursor_for:(_,i,e)=>`
    ${_} crm:P02i_is_range_of ?is_precursor_for_${e.join("_")} .
    ?is_precursor_for_${e.join("_")} crm:P16.1_mode_of_use <type/precursor> .
    ?is_precursor_for_${e.join("_")} crm:P01_has_domain ?domain_${e.join("_")} .
    { ?domain_${e.join("_")} crm:P108_has_produced / at:is_part_of_source_work ${i} . }
     UNION
    {  ?domain_${e.join("_")} crm:P108_has_produced ${i} .
      	FILTER NOT EXISTS { ${i} at:is_part_of_source_work ?father_${e.join("_")} . }
    }
  `,is_precursor_for_subQueries:(_,i,e)=>`
    ${_} crm:P02i_is_range_of ?is_precursor_for_${e.join("_")} .
    ?is_precursor_for_${e.join("_")} crm:P16.1_mode_of_use <type/precursor> .
    ?is_precursor_for_${e.join("_")} crm:P01_has_domain / crm:P108_has_produced ?object_${e.join("_")} .
  `,is_related_to:(_,i,e)=>`
    ${_} crm:P01i_is_domain_of ?rel_${e.join("_")} .
    ?rel_${e.join("_")} crm:P130.1_kind_of_similarity <type/1022295> .
    ?rel_${e.join("_")} crm:P02_has_range ${i} .
  `,is_related_to_subQueries:(_,i,e)=>`
    ${_} crm:P01i_is_domain_of ?rel_${e.join("_")} .
    ?rel_${e.join("_")} crm:P130.1_kind_of_similarity <type/1022295> .
    ?rel_${e.join("_")} crm:P02_has_range ?object_${e.join("_")} .
  `,is_duplicate_of:(_,i,e)=>` 
    ${_} crm:P01i_is_domain_of ?rel_${e.join("_")} .
    ?rel_${e.join("_")} crm:P130.1_kind_of_similarity <type/1641767> .
    { ?rel_${e.join("_")} crm:P02_has_range / at:is_part_of_source_work ${i} . }
     UNION 
    { FILTER NOT EXISTS { ?rel_${e.join("_")} crm:P02_has_range / at:is_part_of_source_work ?father_${e.join("_")} . }
      ?rel_${e.join("_")} crm:P02_has_range ${i} . 
    }
  `,is_duplicate_of_subQueries:(_,i,e)=>` 
    ${_} crm:P01i_is_domain_of ?rel_${e.join("_")} .
    ?rel_${e.join("_")} crm:P130.1_kind_of_similarity <type/1641767> .
    ?rel_${e.join("_")} crm:P02_has_range ?object_${e.join("_")} .
  `,part_of_module:(_,i)=>`
    ${_} crm:P46i_forms_part_of ${i} .
    ${i} a crm:E78_Curated_Holding .
  `,has_version:(_,i,e)=>`
    ${_} crm:P01i_is_domain_of ?rel_${e.join("_")} .
    ?rel_${e.join("_")} crm:P130.1_kind_of_similarity <type/object_version> .
    ?rel_${e.join("_")} crm:P02_has_range ${i} .
  `,has_version_subQueries:(_,i,e)=>`
    ${_} crm:P01i_is_domain_of ?rel_${e.join("_")} .
    ?rel_${e.join("_")} crm:P130.1_kind_of_similarity <type/object_version> .
    ?rel_${e.join("_")} crm:P02_has_range ?object_${e.join("_")} .
  `,is_version_of:(_,i,e)=>`
    ${_} crm:P02i_is_range_of ?rel_${e.join("_")} .
    ?rel_${e.join("_")} crm:P130.1_kind_of_similarity <type/object_version> .
    ?rel_${e.join("_")} crm:P01_has_domain ${i} .
  `,is_version_of_subQueries:(_,i,e)=>`
    ${_} crm:P02i_is_range_of ?rel_${e.join("_")} .
    ?rel_${e.join("_")} crm:P130.1_kind_of_similarity <type/object_version> .
    ?rel_${e.join("_")} crm:P01_has_domain ?object_${e.join("_")} .
  `};function q(_){return`
  BIND ( IF (exists { ${_} crm:P2_has_type ?iri . ?iri crm:P2_has_type <type/object_type> }, 1, 0) AS ?ot )
  BIND ( IF (exists { ${_} crm:P2_has_type ?iri . ?iri crm:P2_has_type <type/classification> }, 1, 0) AS ?c )
  BIND ( IF (exists { ${_} crm:P45_consists_of ?iri }, 1, 0) as ?m )
  BIND ( IF (exists { ${_} crm:P108i_was_produced_by ?x . ?x crm:P32_used_general_technique ?iri }, 1, 0) AS ?t )
  BIND ( IF (exists { ${_} crm:O19i_was_objectencountered_at ?x . ?x crm:P7_took_place_at ?iri }, 1, 0) AS ?fp )
  BIND ( IF (exists { ${_} crm:P108i_was_produced_by ?x . ?x crm:P7_took_place_at ?iri  }, 1, 0) AS ?pp )
  BIND ( IF (exists { ${_} crm:P55_has_current_location ?iri }, 1, 0) AS ?l )
  BIND ( IF (exists { ${_} crm:P30i_custody_transferred_through ?x . ?x crm:P2_has_type <type/acquisition> . ?x crm:P29_custody_received_by ?iri }, 1, 0) AS ?cu )
  BIND ( IF (exists { ${_} crm:P30i_custody_transferred_through ?x . ?x crm:P2_has_type <type/provenance> . ?x crm:P29_custody_received_by ?iri }, 1, 0) AS ?pi )
  BIND ( IF (exists { ${_} crm:P108i_was_produced_by ?x . ?x crm:P01i_is_domain_of ?y . ?y a crm:PC14_carried_out_by . ?y crm:P02_has_range ?iri }, 1, 0) AS ?ppe )
  BIND ( IF (exists { ${_} crm:P30i_custody_transferred_through ?x . ?x crm:P2_has_type <type/provenance> . ?x crm:P29_custody_received_by ?iri }, 1, 0) AS ?prope )
  BIND ( IF (exists { ${_} crm:O19i_was_objectencountered_at ?x . ?x crm:P01i_is_domain_of ?y . ?y a crm:PC14_carried_out_by . ?y crm:P02_has_range ?iri }, 1, 0) AS ?fpe )
  BIND ( IF (exists { ${_} crm:P31i_was_modified_by ?x . ?x crm:P01i_is_domain_of ?y . ?y a crm:PC14_carried_out_by . ?y crm:P02_has_range ?iri }, 1, 0) AS ?mp )
  BIND ( IF (exists { ${_} crm:P62_depicts ?iri . ?iri a crm:E21_Person }, 1, 0) AS ?dp )
  BIND ( IF (exists { ${_} crm:P62_depicts ?iri . ?iri a crm:E53_Place }, 1, 0) AS ?dpl )
  BIND ( IF (exists { ${_} at:is_part_of_source_work ?iri }, 1, 0) AS ?iposw )
  BIND ( IF (exists { ${_} crm:P02i_is_range_of ?depicts_in . ?depicts_in a crm:PC62_depicts . }, 1, 0) AS ?idi )
  BIND ( IF (exists { ${_} crm:P01i_is_domain_of ?depicts . ?depicts a crm:PC62_depicts . }, 1, 0) AS ?d )
  BIND ( IF (exists { ${_} crm:P108i_was_produced_by ?x . ?x crm:P01i_is_domain_of ?source . ?source crm:P16.1_mode_of_use <type/original> }, 1, 0) AS ?ica ) 
  BIND ( IF (exists { ${_} crm:P02i_is_range_of ?x . ?x crm:P16.1_mode_of_use <type/original> }, 1, 0) AS ?hc )
  BIND ( IF (exists { ${_} crm:P108i_was_produced_by ?x . ?x crm:P01i_is_domain_of ?source . ?source crm:P16.1_mode_of_use <type/precursor> }, 1, 0) AS ?ibo ) 
  BIND ( IF (exists { ${_} crm:P02i_is_range_of ?x . ?x crm:P16.1_mode_of_use <type/precursor> }, 1, 0) AS ?ipo )
  BIND ( IF (exists { ${_} crm:P01i_is_domain_of ?x . ?x crm:P130.1_kind_of_similarity <type/1022295> }, 1, 0) AS ?irt )
  BIND ( IF (exists { ${_} crm:P01i_is_domain_of ?x . ?x crm:P130.1_kind_of_similarity <type/1641767> }, 1, 0) AS ?dub )
  BIND ( IF (exists { ${_} crm:P01i_is_domain_of ?x . ?x crm:P130.1_kind_of_similarity <type/object_version> }, 1, 0) AS ?hve )
  BIND ( IF (exists { ${_} crm:P02i_is_range_of ?x . ?x crm:P130.1_kind_of_similarity <type/object_version> }, 1, 0) AS ?ive )
  BIND ( IF (exists { ${_} crm:P46i_forms_part_of ?x . ?x a crm:E78_Curated_Holding }, 1, 0) AS ?mo )
`}const L={deepToRaw(_){const i=e=>Array.isArray(e)?e.map(t=>i(t)):C(e)||F(e)||X(e)?i(v(e)):e&&typeof e=="object"?Object.keys(e).reduce((t,r)=>(t[r]=i(e[r]),t),{}):e;return i(_)},async fetchAvailableFields({queries:_,fieldIndex:i,signal:e}){let t=structuredClone(this.deepToRaw(_.value)),r=this.fieldIndexToQueryObject(t,i);if(this.toSparql(t)){let s=`
        ${w}
        SELECT
          (MAX(?ot) as ?object_type)
          (MAX(?c) as ?classification)
          (MAX(?m) as ?material)
          (MAX(?t) as ?technique)
          (MAX(?fp) as ?find_place)
          (MAX(?pp) as ?production_place)
          (MAX(?l) as ?location)
          (MAX(?cu) as ?custody)
          (MAX(?pi) as ?provenance_institution)
          (MAX(?ppe) as ?production_person)
          (MAX(?prope) as ?provenance_person)
          (MAX(?fpe) as ?find_person)
          (MAX(?mp) as ?modification_person)
          (MAX(?dp) as ?depicted_person)
          (MAX(?dpl) as ?depicted_place)
          (MAX(?iposw) as ?is_part_of_source_work)
          (MAX(?idi) as ?is_depicted_in)
          (MAX(?d) as ?depicts)
          (MAX(?d) as ?mode_of_depiction)
          (MAX(?ica) as ?is_copy_after)
          (MAX(?hc) as ?has_copy)
          (MAX(?ibo) as ?is_based_on)
          (MAX(?ipo) as ?is_precursor_for)
          (MAX(?irt) as ?is_related_to)
          (MAX(?dub) as ?is_duplicate_of)
          (MAX(?mo) as ?part_of_module)
          (MAX(?hve) as ?has_version)
          (MAX(?ive) as ?is_version_of)
        WHERE {
          ${this.toSparql(t)}
          ${q(r.sparqlVariable)}
        }
      `,c=await p(s,{signal:e}),a=[];for(const[o,n]of Object.entries(c.results.bindings[0]))n.value==1&&a.push(o);return a}else return Object.keys(S)},async fetchOptions({queries:_,fieldIndex:i,signal:e}){let t=structuredClone(this.deepToRaw(_.value)),r=this.fieldIndexToQueryObject(t,i),s=`
      ${w}
      SELECT DISTINCT ?iri ?label WHERE {
        hint:Query hint:optimizer "None" .
        ${this.toSparql(t)}
        ${A[r.field](r.sparqlVariable,"?iri",r.queryIndex,r.rowIndex)}
        ${I(r.field)}
        ${S[r.field]}
      } ORDER BY ?label
    `,c=await p(s,{signal:e}),a=[];for(let o of c.results.bindings)a.push({value:o.iri.value.replace("https://db.antiquitatum-thesaurus.eu/",""),label:o.label.value});return a},fieldIndexToQueryObject(_,i){function e(r,s,c){for(let[a,o]of r.entries()){let n=[...s],d;if(n.length==1?d="?object":d=`?object_${n.join("_")}`,c.length==1&&c[0]==a)return o.iri=void 0,{field:o.field,sparqlVariable:d,queryIndex:s,rowIndex:a};if(o.subQueries&&o.subQueries.length){n.push(a),c&&c[0]==a&&c.shift();let l=e(o.subQueries,n,c);if(l)return l}}}let t=[...i];return e(_,[0],t)},toSparql(_,i){i===void 0&&(i=[0]);let e="";for(let[t,r]of _.entries()){let s=[...i],c;s.length==1?c="?object":c=`?object_${s.join("_")}`;let a=r.field;r.subQueries&&r.subQueries.length>0&&(a=a+"_subQueries",s.push(t));let o;r.iri&&(r.iri.length==1?o=`<${r.iri[0].value}>`:o=`?x_${t} . FILTER (${r.iri.map(n=>`?x_${t} = <${n.value}>`).join(" || ")})`),(o||r.subQueries&&r.subQueries.length>0)&&(e+=A[a](c,o,s,t)+`
`),r.subQueries&&r.subQueries.length&&(e+=this.toSparql(r.subQueries,s,t))}return e}};var m=[];for(var g=0;g<256;++g)m.push((g+256).toString(16).slice(1));function k(_,i=0){return(m[_[i+0]]+m[_[i+1]]+m[_[i+2]]+m[_[i+3]]+"-"+m[_[i+4]]+m[_[i+5]]+"-"+m[_[i+6]]+m[_[i+7]]+"-"+m[_[i+8]]+m[_[i+9]]+"-"+m[_[i+10]]+m[_[i+11]]+m[_[i+12]]+m[_[i+13]]+m[_[i+14]]+m[_[i+15]]).toLowerCase()}var b,B=new Uint8Array(16);function M(){if(!b&&(b=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!b))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return b(B)}var U=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const R={randomUUID:U};function Q(_,i,e){if(R.randomUUID&&!i&&!_)return R.randomUUID();_=_||{};var t=_.random||(_.rng||M)();return t[6]=t[6]&15|64,t[8]=t[8]&63|128,k(t)}const O="/triplestore/sparql";async function p(_,{signal:i}={}){let e=Q();try{const t=new Request(`${O}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/sparql-results+json"},body:new URLSearchParams({query:_})});return await(await fetch(t,{signal:i})).json()}catch(t){if(t.name=="AbortError")throw await fetch(`${O}?cancelQuery&queryId=${e}`,{method:"POST"}),t;console.error("Triplestore error:",t)}}function $(_,i,e,t=""){let r="";if(_)if(_.startsWith("[{"))r=L.toSparql(JSON.parse(_));else{let a="",o=_;o=o.replaceAll('"',"'"),_.includes("+:+")&&(a=`?query ates:field "${_.split("+:+")[0]}" .`,o=_.split("+:+")[1]),r=`
      hint:Query hint:optimizer "None" .
      {
        SERVICE <http://fulltext-search-sparql-service> {
          ates:parameter ates:index "objects" .
          ?query a ates:queryObject .
          ?query ates:query "${o}" .
          ${a}
          ?object ates:output ates:iri .
          ?score ates:output ates:score .
        }
      }
      `}else r="?object a crm:E24_Physical_Human-Made_Thing .";let s="";if(i){typeof i=="string"&&(i=[i]);for(const a of i){let o=a.split("-IS")[0];if(o in h){if(a.includes("-IS_OR-")&&o!=t){let n=a.split("-IS_OR-")[1].split("-OR-");n=n.map(d=>`?${o}_iri = <${h[o].prefix}${d}>`),s+=h[o].filter_query().replaceAll("?iri",`?${o}_iri`),s+=`FILTER (${n.join(" || ")}) .`}else if(a.includes("-IS_AND-")){let n=a.split("-IS_AND-")[1].split("-AND-");for(const[d,l]of n.entries())s+=h[o].filter_query(d).replaceAll(`?iri${d}`,`<${h[o].prefix}${l}>`)}}if(o in E&&o!=t){let n=a.split("-IS-")[1].split(":");const d=N(n[1]),l=N(n[3]);s+=E[o].replaceAll("?timespan",`?${o}_timespan`).replaceAll("?date_start",`?${o}_start`).replaceAll("?date_end",`?${o}_end`),s+=`FILTER (
          ( ?${o}_start <= "${d}"^^xsd:date && ?${o}_end >= "${l}"^^xsd:date)
          ||
          ( ?${o}_start >= "${d}"^^xsd:date && ?${o}_start <= "${l}"^^xsd:date)
          ||
          ( ?${o}_end >= "${d}"^^xsd:date && ?${o}_end <= "${l}"^^xsd:date)
        ).`}}}let c="";return e&&(c=`?object crm:P46i_forms_part_of <object/${e}> .`),r+c+s}const Y={async get_resource(_){let i=`
    SELECT * WHERE {
      {
        <${_}> ?p_outgoing ?o_outgoing .
      } UNION 
      {
        ?s_incoming ?p_incoming <${_}> .
      }
    }
    `,e=await p(i),t={properties:[],outgoing_links:[],incoming_links:[]};if(e)for(const r of e.results.bindings)"s_incoming"in r?t.incoming_links.push({link:r.p_incoming,node:r.s_incoming}):r.o_outgoing.type==="literal"?t.properties.push({link:r.p_outgoing,node:r.o_outgoing}):t.outgoing_links.push({link:r.p_outgoing,node:r.o_outgoing});return t},async completion_suggester(_,i){let e=`
      PREFIX ates: <http://at-es/>
      SELECT ?suggestion WHERE {
        hint:Query hint:optimizer "None" .
        SERVICE <http://fulltext-search-sparql-service> {
          ates:parameter ates:index "objects" .
          ?query a ates:completionSuggester .
          ?query ates:prefix "${_}" .
          ?suggestion ates:output ates:suggestion .
        }
      }
    `;return(await p(e,{signal:i})).results.bindings.map(r=>{var s;return(s=r.suggestion)==null?void 0:s.value})},async search({condition:_="",q:i="",qfilter:e="",filter_object_id:t=null,limit:r=60,offset:s=0,sorting:c="",signal:a=null}){let 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 xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX at: <https://db.antiquitatum-thesaurus.eu/ontology/>
    PREFIX ates: <http://at-es/>
    SELECT DISTINCT ?object WHERE {

      ${_}

      ${$(i,e,t)}

      ${T[c].query}

    } ORDER BY ${T[c].order} LIMIT ${r} OFFSET ${s}
    `,n=await p(o,{signal:a}),l=P(n,{objects:[{iri:"object"}]});return l.objects?l.objects:[]},async get_total_count({condition:_="",q:i="",qfilter:e="",filter_object_id:t=null,signal:r=null}){let s=`
    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 at: <https://db.antiquitatum-thesaurus.eu/ontology/>
    PREFIX ates: <http://at-es/>
    SELECT (COUNT(DISTINCT ?object) as ?count) WHERE {

      ${_}

      ${$(i,e,t)}
    }
    `;return+(await p(s,{signal:r})).results.bindings[0].count.value},async get_object_hierarchy({filter_object_id:_=null,signal:i=null}){let e=`
    BASE <https://db.antiquitatum-thesaurus.eu>
    PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
    SELECT ?iri ?title (COUNT(?mid) as ?distance)
    WHERE {
      <object/${_}> crm:P46i_forms_part_of* ?mid .
      ?mid a crm:E24_Physical_Human-Made_Thing .
      ?mid crm:P46i_forms_part_of* ?iri .
      ?iri a crm:E24_Physical_Human-Made_Thing .
      ?iri crm:P1_is_identified_by ?title_iri .
      ?title_iri crm:P2_has_type <type/preferred_title> .
      ?title_iri crm:P190_has_symbolic_content ?title .

    } GROUP BY ?iri ?title ORDER BY DESC(?distance)
    `,t=await p(e,{signal:i}),r=P(t,{path:[{iri:"iri",title:"title"}]});return r.path?r.path.map(s=>({...s,id:s.iri.split("/").slice(-1)[0]})):[]},async get_object_cards_data(_,{signal:i}){let e=_.map((a,o)=>`(<${a.replace("https://db.antiquitatum-thesaurus.eu","")}> ${o})`),t=`
    BASE <https://db.antiquitatum-thesaurus.eu>
    PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX at: <https://db.antiquitatum-thesaurus.eu/ontology/>

    SELECT
      ?iri ?order ?main_title ?location ?custody 
      (GROUP_CONCAT(DISTINCT ?mt; SEPARATOR=";") AS ?path_title)  
      (COUNT(?child) > 0 AS ?has_children) 
      (GROUP_CONCAT(?thumbnail_urls;separator=";") AS ?thumbnail_url)
    WHERE {
      ?iri crm:P1_is_identified_by ?title .
      ?title crm:P2_has_type <type/preferred_title> .
      ?title crm:P190_has_symbolic_content ?main_title .

      OPTIONAL {
        ?iri crm:P55_has_current_location / crm:P1_is_identified_by /
        crm:P190_has_symbolic_content ?location
      }

      OPTIONAL {
        ?iri crm:P30i_custody_transferred_through ?acquisition .
        ?acquisition crm:P2_has_type <type/acquisition> .
        ?acquisition crm:P29_custody_received_by / crm:P1_is_identified_by / crm:P190_has_symbolic_content ?custody .
      }

      OPTIONAL {
        ?iri crm:P46_is_composed_of ?child .  
      }

      OPTIONAL {
        ?iri crm:P138i_has_representation ?vi . 

        ?vi at:has_sorting_index "1"^^xsd:int ;
            crm:P165i_is_incorporated_in ?image .

        ?image crm:P2_has_type <type/thumbnail> .
        ?image crm:P1_is_identified_by / crm:P190_has_symbolic_content ?thumbnail_urls .
      }

      OPTIONAL {
        { # selecting the breadcrumb path elements for each iri
          SELECT ?iri ?mt (COUNT(?m) as ?distance) 
          WHERE {
            VALUES (?iri ?order) {
              ${e.join(" ")}
            }
            ?iri crm:P46i_forms_part_of* ?m .
            ?m a crm:E24_Physical_Human-Made_Thing .
            ?m crm:P46i_forms_part_of+ ?final . 
            ?final a crm:E24_Physical_Human-Made_Thing .
            ?final crm:P1_is_identified_by ?mi .
            ?mi crm:P2_has_type <type/preferred_title> .
            ?mi crm:P190_has_symbolic_content ?mt .
          } 
          GROUP BY ?mt ?iri 
          ORDER BY DESC(?distance)}
      }
       

      VALUES (?iri ?order) {
        ${e.join(" ")}
      }
    } GROUP BY ?iri ?main_title ?location ?custody ?order ORDER BY ?order
    `,r=await p(t,{signal:i}),c=P(r,{objects:[{iri:"iri",title:"main_title",custody:"custody",location:"location",has_children:"has_children",path:"path_title",images:"thumbnail_url"}]}).objects;return c=c.map(a=>({...a,images:a.images?a.images.split(";").map(o=>({url:o})):[]})),c=c.map(a=>({...a,path:a.path?a.path.split(";").filter(o=>o).map(o=>({title:o})):[]})),c},async get_object_card_data(_){let i=`
    BASE <https://db.antiquitatum-thesaurus.eu>
    PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX at: <https://db.antiquitatum-thesaurus.eu/ontology/>

    SELECT ?main_title ?location ?custody ?thumbnail_urls ?path_title ?has_children
    WHERE {
      {
        <${_}> crm:P1_is_identified_by ?title .
        ?title crm:P2_has_type <type/preferred_title> .
        ?title crm:P190_has_symbolic_content ?main_title .

        OPTIONAL {
        <${_}> crm:P55_has_current_location / crm:P1_is_identified_by /
          crm:P190_has_symbolic_content ?location
        }

        OPTIONAL {
        <${_}/acquisition>  crm:P29_custody_received_by /
          crm:P1_is_identified_by / crm:P190_has_symbolic_content ?custody
        }
      }
      
      UNION {
        <${_}> crm:P138i_has_representation ?vi . 

        ?vi at:has_sorting_index "1"^^xsd:int ;
            crm:P165i_is_incorporated_in ?image .

        ?image crm:P2_has_type <type/thumbnail> .
        ?image crm:P1_is_identified_by / crm:P190_has_symbolic_content ?thumbnail_urls .
      }

      UNION {
        SELECT ?path_title (COUNT(?mid) as ?distance) WHERE {
          <${_}> crm:P46i_forms_part_of* ?mid .
          ?mid a crm:E24_Physical_Human-Made_Thing .
          ?mid crm:P46i_forms_part_of+ ?final .
          ?final a crm:E24_Physical_Human-Made_Thing .
          ?final crm:P1_is_identified_by ?title_path_iri .
          ?title_path_iri crm:P2_has_type <type/preferred_title> .
          ?title_path_iri crm:P190_has_symbolic_content ?path_title .
        } GROUP BY ?path_title ORDER BY DESC(?distance)
      }

      UNION {
        SELECT (COUNT(?child) > 0 as ?has_children)
        WHERE {
          <${_}> crm:P46_is_composed_of ?child .
        }
      }
    }
    `,e=await p(i);return P(e,{title:"main_title",custody:"custody",location:"location",path:[{title:"path_title"}],images:[{url:"thumbnail_urls"}],has_children:"has_children"})},async get_depicts_data({iri:_=null,signal:i=null}){let e=`
    BASE <https://db.antiquitatum-thesaurus.eu>
    PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX at: <https://db.antiquitatum-thesaurus.eu/ontology/>

    SELECT ?obj (SAMPLE(?thumbnail_urls) as ?thumbnail) WHERE {
      <${_}> crm:P01i_is_domain_of ?depicts .
      ?depicts a crm:PC62_depicts .
      ?depicts crm:P02_has_range ?obj .
      OPTIONAL { 
        ?obj crm:P108i_was_produced_by ?production .
        ?production crm:P4_has_time-span / crm:P82a_begin_of_the_beginning ?date_from .
        ?production crm:P4_has_time-span / crm:P82b_end_of_the_end ?date_to .
      }

      ?obj crm:P1_is_identified_by ?title_iri .
      ?title_iri crm:P2_has_type <type/preferred_title> .
      ?title_iri crm:P190_has_symbolic_content ?title .
      
      OPTIONAL {
        ?obj crm:P138i_has_representation ?vi . 

        ?vi at:has_sorting_index "1"^^xsd:int ;
            crm:P165i_is_incorporated_in ?image .

        ?image crm:P2_has_type <type/thumbnail> .
        ?image crm:P1_is_identified_by / crm:P190_has_symbolic_content ?thumbnail_urls .
      }
    }
    GROUP BY ?obj
    ORDER BY (bound(?date_to)) (bound(?date_from)) ?date_to ?date_from ?title
    `,t=await p(e,{signal:i}),s=P(t,{objects:[{iri:"obj",images:[{url:"thumbnail"}]}]});return"objects"in s?s.objects:[]},async get_depicted_data({iri:_=null,signal:i=null}){let e=`
    BASE <https://db.antiquitatum-thesaurus.eu>
    PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX at: <https://db.antiquitatum-thesaurus.eu/ontology/>
    
    SELECT ?obj (SAMPLE(?thumbnail_urls) as ?thumbnail) WHERE {
      ?depicts crm:P02_has_range <${_}> .
      ?depicts a crm:PC62_depicts .
      ?obj crm:P01i_is_domain_of ?depicts .

      ?obj crm:P46i_forms_part_of* ?final .
      ?final a crm:E24_Physical_Human-Made_Thing .
      ?final crm:P108i_was_produced_by ?production .
      ?production crm:P4_has_time-span / crm:P82a_begin_of_the_beginning ?date_from .
      ?production crm:P4_has_time-span / crm:P82b_end_of_the_end ?date_to .
        
      FILTER NOT EXISTS {
        # ignore all following after the first dated final
        ?final crm:P46i_forms_part_of+ ?x .
        ?x a crm:E24_Physical_Human-Made_Thing .
      }
      
      ?obj crm:P1_is_identified_by ?title_iri .
      ?title_iri crm:P2_has_type <type/preferred_title> .
      ?title_iri crm:P190_has_symbolic_content ?title .
      
      OPTIONAL {
        ?obj crm:P138i_has_representation ?vi . 

        ?vi at:has_sorting_index "1"^^xsd:int ;
           crm:P165i_is_incorporated_in ?image .

        ?image crm:P2_has_type <type/thumbnail> .
        ?image crm:P1_is_identified_by / crm:P190_has_symbolic_content ?thumbnail_urls .
      }
    }
    GROUP BY ?obj
    ORDER BY (bound(?date_to)) (bound(?date_from)) ?date_to ?date_from ?title_iri
    `,t=await p(e,{signal:i}),s=P(t,{objects:[{iri:"obj",images:[{url:"thumbnail"}]}]});return"objects"in s?s.objects:[]},async get_term_aggregation({q:_="",qfilter:i="",filter_object_id:e=null,field:t=null,signal:r=null}){let s=`
    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 at: <https://db.antiquitatum-thesaurus.eu/ontology/>
    PREFIX ates: <http://at-es/>
    SELECT ?iri ?label (COUNT(DISTINCT ?object) as ?count) WHERE {
      
      ${$(_,i,e,t)}

      ${h[t].aggregation_query}

      ${t=="mode_of_depiction"?'FILTER (LANG(?label) = "de") .':""}

    } GROUP BY ?iri ?label ORDER BY DESC(?count) ?label
    `,c=await p(s,{signal:r}),o=P(c,{results:[{iri:"iri",label:"label",count:"count"}]});return o.results?o.results:[]},async get_date_aggregation({q:_="",qfilter:i="",filter_object_id:e=null,field:t=null,signal:r=null}){let s=`
    BASE <https://db.antiquitatum-thesaurus.eu>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
    PREFIX at: <https://db.antiquitatum-thesaurus.eu/ontology/>
    PREFIX ates: <http://at-es/>
    SELECT ?mid WHERE {
      
      ${$(_,i,e,t)}

      ${E[t]}

      BIND(REPLACE(STR(?date_start), "(\\\\d+)-\\\\d+-\\\\d+", "$1") AS ?year_start)
      BIND(REPLACE(STR(?date_end), "(\\\\d+)-\\\\d+-\\\\d+", "$1") AS ?year_end)
      BIND ( ROUND ((xsd:integer(?year_start) + xsd:integer(?year_end))/2) as ?mid)

    }
    `;return(await p(s,{signal:r})).results.bindings.map(a=>parseInt(a.mid.value))}};function N(_){return _>=0?_.padStart(4,"0"):"-"+_.replace("-","").padStart(4,"0")}let T={relevance:{query:`?object crm:P1_is_identified_by ?title .
    ?title crm:P2_has_type <type/preferred_title> .
    ?title crm:P190_has_symbolic_content ?main_title .
    `,order:"DESC(?score) DESC(?main_title)"},recently_added:{query:`OPTIONAL{
      ?object crm:P67i_is_referred_to_by ?cataloging .
      ?cataloging crm:P2_has_type <type/online_document> .
      ?cataloging crm:P94i_was_created_by / crm:P4_has_time-span / crm:P82b_end_of_the_end ?create_date .
    }
    BIND(bound(?create_date) as ?date_exists)
    `,order:"DESC(?date_exists) DESC(?create_date)"},title:{query:`?object crm:P1_is_identified_by ?title .
    ?title crm:P2_has_type <type/preferred_title> .
    ?title crm:P190_has_symbolic_content ?main_title .
    `,order:"ASC(?main_title)"},production_date_asc:{query:`
    OPTIONAL {
      ?object at:is_part_of_source_work ?father .
      ?father crm:P108i_was_produced_by ?father_prod .
      ?father_prod crm:P4_has_time-span ?father_prod_timespan . 
      ?father_prod_timespan crm:P82a_begin_of_the_beginning ?father_date_from .
    }
    OPTIONAL {
      ?object crm:P108i_was_produced_by ?prod .
      ?prod crm:P4_has_time-span ?prod_timespan . 
      ?prod_timespan crm:P82a_begin_of_the_beginning ?prod_date_start .
    }
    BIND(bound(?prod_date_start) as ?date_exists)
    ?object crm:P1_is_identified_by ?title .
    ?title crm:P2_has_type <type/preferred_title> .
    ?title crm:P190_has_symbolic_content ?main_title .
    `,order:"DESC(?date_exists) ASC(?father_date_from) ASC(?prod_date_start) ASC(?main_title)"},production_date_desc:{query:`
    OPTIONAL {
      ?object at:is_part_of_source_work ?father .
      ?father crm:P108i_was_produced_by ?father_prod .
      ?father_prod crm:P4_has_time-span ?father_prod_timespan . 
      ?father_prod_timespan crm:P82b_end_of_the_end ?father_date_end .
    }
    OPTIONAL {
      ?object crm:P108i_was_produced_by ?prod .
      ?prod crm:P4_has_time-span ?prod_timespan . 
      ?prod_timespan crm:P82b_end_of_the_end ?prod_date_end .
    }
    BIND(bound(?prod_date_end) as ?date_exists)
    ?object crm:P1_is_identified_by ?title .
    ?title crm:P2_has_type <type/preferred_title> .
    ?title crm:P190_has_symbolic_content ?main_title .
    `,order:"DESC(?date_exists) DESC(?father_date_end) DESC(?prod_date_end) ASC(?main_title)"},find_date_asc:{query:`OPTIONAL {
      ?object crm:O19i_was_objectencountered_at ?find .
      ?find crm:P4_has_time-span ?find_timespan . 
      ?find_timespan crm:P82a_begin_of_the_beginning ?find_date_start .
    }
    BIND(bound(?find_date_start) as ?date_exists)
    ?object crm:P1_is_identified_by ?title .
    ?title crm:P2_has_type <type/preferred_title> .
    ?title crm:P190_has_symbolic_content ?main_title .
    `,order:"DESC(?date_exists) ASC(?find_date_start) ASC(?main_title)"},find_date_desc:{query:`OPTIONAL {
      ?object crm:O19i_was_objectencountered_at ?find .
      ?find crm:P4_has_time-span ?find_timespan . 
      ?find_timespan crm:P82b_end_of_the_end ?find_date_end .
    }
    BIND(bound(?find_date_end) as ?date_exists)
    ?object crm:P1_is_identified_by ?title .
    ?title crm:P2_has_type <type/preferred_title> .
    ?title crm:P190_has_symbolic_content ?main_title .
    `,order:"DESC(?date_exists) DESC(?find_date_end) ASC(?main_title)"}},h={object_type:{aggregation_query:`
      ?object crm:P2_has_type ?iri .
      ?iri crm:P2_has_type <type/object_type> .
      ?iri rdfs:label ?label .
    `,filter_query:(_="")=>`
      ?object crm:P2_has_type ?iri${_} .
    `,prefix:"type/"},classification:{aggregation_query:`
      ?object crm:P2_has_type ?iri .
      ?iri crm:P2_has_type <type/classification> .
      ?iri rdfs:label ?label .
    `,filter_query:(_="")=>`
      ?object crm:P2_has_type ?iri${_} .
    `,prefix:"type/"},material:{aggregation_query:`
      ?object crm:P45_consists_of ?iri .
      ?iri rdfs:label ?label .
    `,filter_query:(_="")=>`
      ?object crm:P45_consists_of ?iri${_} .
    `,prefix:"material/"},technic:{aggregation_query:`
      ?object crm:P108i_was_produced_by ?production .
      ?production crm:P32_used_general_technique ?iri .
      ?iri rdfs:label ?label .
    `,filter_query:(_="")=>`
      ?object crm:P108i_was_produced_by ?production .
      ?production crm:P32_used_general_technique ?iri${_} .
    `,prefix:"type/"},mode_of_depiction:{aggregation_query:`
      ?object crm:P01i_is_domain_of ?depicts .
      ?depicts a crm:PC62_depicts .
    	?depicts crm:P62.1_mode_of_depiction ?iri .
      ?iri rdfs:label ?label .
    `,filter_query:(_="")=>`
      ?object crm:P01i_is_domain_of ?depicts .
      ?depicts a crm:PC62_depicts .
      ?depicts crm:P62.1_mode_of_depiction ?iri${_} .
    `,prefix:"type/"},custody:{aggregation_query:`
      ?object crm:P30i_custody_transferred_through ?transfer_of_custody .
      ?transfer_of_custody crm:P2_has_type <type/acquisition> .
      ?transfer_of_custody crm:P29_custody_received_by ?iri .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label
    `,filter_query:(_="")=>`
      ?object crm:P30i_custody_transferred_through ?transfer_of_custody${_} .
      ?transfer_of_custody${_} crm:P2_has_type <type/acquisition> .
      ?transfer_of_custody${_} crm:P29_custody_received_by ?iri${_} .
    `,prefix:"actor/"},location:{aggregation_query:`
      ?object crm:P55_has_current_location ?iri .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P55_has_current_location ?iri${_} .
    `,prefix:"place/"},production_person:{aggregation_query:`
      ?object crm:P108i_was_produced_by / crm:P01i_is_domain_of ?pp_role .
      ?pp_role a crm:PC14_carried_out_by .
      ?pp_role crm:P02_has_range ?iri .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P108i_was_produced_by / crm:P01i_is_domain_of ?pp_role${_} .
      ?pp_role${_} a crm:PC14_carried_out_by .
      ?pp_role${_} crm:P02_has_range ?iri${_} .
    `,prefix:"person/"},production_place:{aggregation_query:`
      ?object crm:P108i_was_produced_by ?production .
      ?production crm:P7_took_place_at ?iri .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P108i_was_produced_by ?production .
      ?production crm:P7_took_place_at ?iri${_} .
    `,prefix:"place/"},modification_person:{aggregation_query:`
      ?object crm:P31i_was_modified_by / crm:P01i_is_domain_of ?mp_role .
      ?mp_role a crm:PC14_carried_out_by .
      ?mp_role crm:P02_has_range ?iri .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P31i_was_modified_by / crm:P01i_is_domain_of ?mp_role${_} .
      ?mp_role${_} a crm:PC14_carried_out_by .
      ?mp_role${_} crm:P02_has_range ?iri${_} .
    `,prefix:"person/"},find_place:{aggregation_query:`
      ?object crm:O19i_was_objectencountered_at ?find .
      ?find crm:P7_took_place_at ?iri .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:O19i_was_objectencountered_at ?find .
      ?find crm:P7_took_place_at ?iri${_} .
    `,prefix:"place/"},find_person:{aggregation_query:`
      ?object crm:O19i_was_objectencountered_at / crm:P01i_is_domain_of / crm:P02_has_range ?iri .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:O19i_was_objectencountered_at / crm:P01i_is_domain_of / crm:P02_has_range ?iri${_} .
    `,prefix:"person/"},provenance_person:{aggregation_query:`
      ?object crm:P30i_custody_transferred_through ?pp_transfer_of_custody .
      ?pp_transfer_of_custody crm:P2_has_type <type/provenance> .
      ?pp_transfer_of_custody crm:P29_custody_received_by ?iri .
      ?iri a crm:E21_Person . 
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P30i_custody_transferred_through ?pp_transfer_of_custody${_} .
      ?pp_transfer_of_custody${_} crm:P2_has_type <type/provenance> .
      ?pp_transfer_of_custody${_} crm:P29_custody_received_by ?iri${_} .
      ?iri${_} a crm:E21_Person . 
    `,prefix:"person/"},provenance_institution:{aggregation_query:`
      ?object crm:P30i_custody_transferred_through ?pi_transfer_of_custody .
      ?pi_transfer_of_custody crm:P2_has_type <type/provenance> .
      ?pi_transfer_of_custody crm:P29_custody_received_by ?iri .
      ?iri a crm:E39_Actor . 
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P30i_custody_transferred_through ?pi_transfer_of_custody${_} .
      ?pi_transfer_of_custody${_} crm:P2_has_type <type/provenance> .
      ?pi_transfer_of_custody${_} crm:P29_custody_received_by ?iri${_} .
      ?iri${_} a crm:E39_Actor . 
    `,prefix:"actor/"},depicted_person:{aggregation_query:`
      ?object crm:P62_depicts ?iri .
      ?iri a crm:E21_Person .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P62_depicts ?iri${_} .
      ?iri${_} a crm:E21_Person .
    `,prefix:"person/"},depicted_place:{aggregation_query:`
      ?object crm:P62_depicts ?iri .
      ?iri a crm:E53_Place .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P62_depicts ?iri${_} .
      ?iri${_} a crm:E53_Place .
    `,prefix:"place/"},depicted_in_source_work:{aggregation_query:`
      ?object crm:P02i_is_range_of ?depicts .
      ?depicts a crm:PC62_depicts .
      ?depicts crm:P01_has_domain / at:is_part_of_source_work ?iri .
      ?iri crm:P1_is_identified_by ?title .
      ?title crm:P2_has_type <type/preferred_title> .
      ?title crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P02i_is_range_of / crm:P01_has_domain / at:is_part_of_source_work ?iri${_} .
    `,prefix:"object/"},is_part_of_source_work:{aggregation_query:`
      ?object at:is_part_of_source_work ?iri .
      ?iri crm:P1_is_identified_by ?title .
      ?title crm:P2_has_type <type/preferred_title> .
      ?title crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object at:is_part_of_source_work ?iri${_} .
    `,prefix:"object/"},projects:{aggregation_query:`
      ?object crm:P46i_forms_part_of ?iri .
      ?iri a crm:E78_Curated_Holding .
      ?iri crm:P2_has_type <type/project> .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P46i_forms_part_of ?iri${_} .
    `,prefix:"project/"},modules:{aggregation_query:`
      ?object crm:P46i_forms_part_of ?iri .
      ?iri a crm:E78_Curated_Holding .
      ?iri crm:P2_has_type <type/module> .
      ?iri crm:P1_is_identified_by / crm:P190_has_symbolic_content ?label .
    `,filter_query:(_="")=>`
      ?object crm:P46i_forms_part_of ?iri${_} .
    `,prefix:"module/"}},E={production_dating:`
    ?object crm:P108i_was_produced_by ?production .
    ?production crm:P4_has_time-span ?timespan .
    ?timespan crm:P82a_begin_of_the_beginning ?date_start .
    ?timespan crm:P82b_end_of_the_end ?date_end .
    `,find_dating:`
    ?object crm:O19i_was_objectencountered_at ?find .
    ?find crm:P4_has_time-span ?timespan .
    ?timespan crm:P82a_begin_of_the_beginning ?date_start .
    ?timespan crm:P82b_end_of_the_end ?date_end .
  `,modification_dating:`
    ?object crm:P31i_was_modified_by ?modification .
    ?modification crm:P4_has_time-span ?timespan .
    ?timespan crm:P82a_begin_of_the_beginning ?date_start .
    ?timespan crm:P82b_end_of_the_end ?date_end .
  `,acquisition_dating:`
    ?object crm:P30i_custody_transferred_through ?acquisition .
    ?acquisition crm:P4_has_time-span ?timespan .
    ?timespan crm:P82a_begin_of_the_beginning ?date_start .
    ?timespan crm:P82b_end_of_the_end ?date_end .
  `};export{p as a,P as c,W as p,L as q,Y as t};