@sfgrp/distinguish 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2959,7 +2959,7 @@ function go(e, t) {
2959
2959
  });
2960
2960
  return r.use(Qt()), r.mount(e), r;
2961
2961
  }
2962
- window.addEventListener("DOMContentLoaded", mo);
2962
+ typeof window < "u" && window.addEventListener("DOMContentLoaded", mo);
2963
2963
  export {
2964
2964
  po as VueInteractiveKey,
2965
2965
  go as createInteractiveKey,
@@ -3,4 +3,4 @@
3
3
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const o=new this(t);return r.forEach(s=>o.set(s)),o}static accessor(t){const o=(this[Xe]=this[Xe]={accessors:{}}).accessors,s=this.prototype;function i(a){const c=J(a);o[c]||(Nn(s,a),o[c]=!0)}return l.isArray(t)?t.forEach(i):i(t),this}}N.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),l.reduceDescriptors(N.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(o){this[r]=o}}}),l.freezeMethods(N);function be(e,t){const r=this||K,o=t||r,s=N.from(o.headers);let i=o.data;return l.forEach(e,function(c){i=c.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Qe(e){return!!(e&&e.__CANCEL__)}function q(e,t,r){g.call(this,e??"canceled",g.ERR_CANCELED,t,r),this.name="CanceledError"}l.inherits(q,g,{__CANCEL__:!0});function Ye(e,t,r){const o=r.config.validateStatus;!r.status||!o||o(r.status)?e(r):t(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Rn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Tn(e,t){e=e||10;const r=new Array(e),o=new Array(e);let s=0,i=0,a;return t=t!==void 0?t:1e3,function(u){const d=Date.now(),p=o[i];a||(a=d),r[s]=u,o[s]=d;let f=i,b=0;for(;f!==s;)b+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-a<t)return;const k=p&&d-p;return k?Math.round(b*1e3/k):void 0}}function xn(e,t){let r=0,o=1e3/t,s,i;const a=(d,p=Date.now())=>{r=p,s=null,i&&(clearTimeout(i),i=null),e.apply(null,d)};return[(...d)=>{const p=Date.now(),f=p-r;f>=o?a(d,p):(s=d,i||(i=setTimeout(()=>{i=null,a(s)},o-f)))},()=>s&&a(s)]}const re=(e,t,r=3)=>{let o=0;const s=Tn(50,250);return xn(i=>{const a=i.loaded,c=i.lengthComputable?i.total:void 0,u=a-o,d=s(u),p=a<=c;o=a;const f={loaded:a,total:c,progress:c?a/c:void 0,bytes:u,rate:d||void 0,estimated:d&&c&&p?(c-a)/d:void 0,event:i,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(f)},r)},Ze=(e,t)=>{const r=e!=null;return[o=>t[0]({lengthComputable:r,total:e,loaded:o}),t[1]]},ve=e=>(...t)=>l.asap(()=>e(...t)),On=C.hasStandardBrowserEnv?function(){const t=C.navigator&&/(msie|trident)/i.test(C.navigator.userAgent),r=document.createElement("a");let o;function s(i){let a=i;return t&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return o=s(window.location.href),function(a){const c=l.isString(a)?s(a):a;return c.protocol===o.protocol&&c.host===o.host}}():function(){return function(){return!0}}(),Dn=C.hasStandardBrowserEnv?{write(e,t,r,o,s,i){const a=[e+"="+encodeURIComponent(t)];l.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),l.isString(o)&&a.push("path="+o),l.isString(s)&&a.push("domain="+s),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Vn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function An(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function et(e,t){return e&&!Vn(t)?An(e,t):t}const tt=e=>e instanceof N?{...e}:e;function U(e,t){t=t||{};const r={};function o(d,p,f){return l.isPlainObject(d)&&l.isPlainObject(p)?l.merge.call({caseless:f},d,p):l.isPlainObject(p)?l.merge({},p):l.isArray(p)?p.slice():p}function s(d,p,f){if(l.isUndefined(p)){if(!l.isUndefined(d))return o(void 0,d,f)}else return o(d,p,f)}function i(d,p){if(!l.isUndefined(p))return o(void 0,p)}function a(d,p){if(l.isUndefined(p)){if(!l.isUndefined(d))return o(void 0,d)}else return o(void 0,p)}function c(d,p,f){if(f in t)return o(d,p);if(f in e)return o(void 0,d)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c,headers:(d,p)=>s(tt(d),tt(p),!0)};return l.forEach(Object.keys(Object.assign({},e,t)),function(p){const f=u[p]||s,b=f(e[p],t[p],p);l.isUndefined(b)&&f!==c||(r[p]=b)}),r}const nt=e=>{const t=U({},e);let{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;t.headers=a=N.from(a),t.url=Ke(et(t.baseURL,t.url),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let u;if(l.isFormData(r)){if(C.hasStandardBrowserEnv||C.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){const[d,...p]=u?u.split(";").map(f=>f.trim()).filter(Boolean):[];a.setContentType([d||"multipart/form-data",...p].join("; "))}}if(C.hasStandardBrowserEnv&&(o&&l.isFunction(o)&&(o=o(t)),o||o!==!1&&On(t.url))){const d=s&&i&&Dn.read(i);d&&a.set(s,d)}return t},In=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,o){const s=nt(e);let i=s.data;const a=N.from(s.headers).normalize();let{responseType:c,onUploadProgress:u,onDownloadProgress:d}=s,p,f,b,k,m;function y(){k&&k(),m&&m(),s.cancelToken&&s.cancelToken.unsubscribe(p),s.signal&&s.signal.removeEventListener("abort",p)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function _(){if(!h)return;const S=N.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),R={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:S,config:e,request:h};Ye(function(M){r(M),y()},function(M){o(M),y()},R),h=null}"onloadend"in h?h.onloadend=_:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(_)},h.onabort=function(){h&&(o(new g("Request aborted",g.ECONNABORTED,e,h)),h=null)},h.onerror=function(){o(new g("Network Error",g.ERR_NETWORK,e,h)),h=null},h.ontimeout=function(){let V=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const R=s.transitional||We;s.timeoutErrorMessage&&(V=s.timeoutErrorMessage),o(new g(V,R.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,h)),h=null},i===void 0&&a.setContentType(null),"setRequestHeader"in h&&l.forEach(a.toJSON(),function(V,R){h.setRequestHeader(R,V)}),l.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),d&&([b,m]=re(d,!0),h.addEventListener("progress",b)),u&&h.upload&&([f,k]=re(u),h.upload.addEventListener("progress",f),h.upload.addEventListener("loadend",k)),(s.cancelToken||s.signal)&&(p=S=>{h&&(o(!S||S.type?new q(null,e,h):S),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(p),s.signal&&(s.signal.aborted?p():s.signal.addEventListener("abort",p)));const w=Rn(s.url);if(w&&C.protocols.indexOf(w)===-1){o(new g("Unsupported protocol "+w+":",g.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Ln=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let o=new AbortController,s;const i=function(d){if(!s){s=!0,c();const p=d instanceof Error?d:this.reason;o.abort(p instanceof g?p:new q(p instanceof Error?p.message:p))}};let a=t&&setTimeout(()=>{a=null,i(new g(`timeout ${t} of ms exceeded`,g.ETIMEDOUT))},t);const c=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:u}=o;return u.unsubscribe=()=>l.asap(c),u}},Un=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let o=0,s;for(;o<r;)s=o+t,yield e.slice(o,s),o=s},$n=async function*(e,t){for await(const r of Pn(e))yield*Un(r,t)},Pn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:o}=await t.read();if(r)break;yield o}}finally{await t.cancel()}},rt=(e,t,r,o)=>{const s=$n(e,t);let i=0,a,c=u=>{a||(a=!0,o&&o(u))};return new ReadableStream({async pull(u){try{const{done:d,value:p}=await s.next();if(d){c(),u.close();return}let f=p.byteLength;if(r){let b=i+=f;r(b)}u.enqueue(new Uint8Array(p))}catch(d){throw c(d),d}},cancel(u){return c(u),s.return()}},{highWaterMark:2})},oe=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ot=oe&&typeof ReadableStream=="function",Fn=oe&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),st=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Mn=ot&&st(()=>{let e=!1;const t=new Request(C.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),it=64*1024,_e=ot&&st(()=>l.isReadableStream(new Response("").body)),se={stream:_e&&(e=>e.body)};oe&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!se[t]&&(se[t]=l.isFunction(e[t])?r=>r[t]():(r,o)=>{throw new g(`Response type '${t}' is not supported`,g.ERR_NOT_SUPPORT,o)})})})(new Response);const jn=async e=>{if(e==null)return 0;if(l.isBlob(e))return e.size;if(l.isSpecCompliantForm(e))return(await new Request(C.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(l.isArrayBufferView(e)||l.isArrayBuffer(e))return e.byteLength;if(l.isURLSearchParams(e)&&(e=e+""),l.isString(e))return(await Fn(e)).byteLength},qn=async(e,t)=>{const r=l.toFiniteNumber(e.getContentLength());return r??jn(t)},Ee={http:ln,xhr:In,fetch:oe&&(async e=>{let{url:t,method:r,data:o,signal:s,cancelToken:i,timeout:a,onDownloadProgress:c,onUploadProgress:u,responseType:d,headers:p,withCredentials:f="same-origin",fetchOptions:b}=nt(e);d=d?(d+"").toLowerCase():"text";let k=Ln([s,i&&i.toAbortSignal()],a),m;const y=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let h;try{if(u&&Mn&&r!=="get"&&r!=="head"&&(h=await qn(p,o))!==0){let R=new Request(t,{method:"POST",body:o,duplex:"half"}),I;if(l.isFormData(o)&&(I=R.headers.get("content-type"))&&p.setContentType(I),R.body){const[M,le]=Ze(h,re(ve(u)));o=rt(R.body,it,M,le)}}l.isString(f)||(f=f?"include":"omit");const _="credentials"in Request.prototype;m=new Request(t,{...b,signal:k,method:r.toUpperCase(),headers:p.normalize().toJSON(),body:o,duplex:"half",credentials:_?f:void 0});let w=await fetch(m);const S=_e&&(d==="stream"||d==="response");if(_e&&(c||S&&y)){const R={};["status","statusText","headers"].forEach(wt=>{R[wt]=w[wt]});const I=l.toFiniteNumber(w.headers.get("content-length")),[M,le]=c&&Ze(I,re(ve(c),!0))||[];w=new Response(rt(w.body,it,M,()=>{le&&le(),y&&y()}),R)}d=d||"text";let V=await se[l.findKey(se,d)||"text"](w,e);return!S&&y&&y(),await new Promise((R,I)=>{Ye(R,I,{data:V,headers:N.from(w.headers),status:w.status,statusText:w.statusText,config:e,request:m})})}catch(_){throw y&&y(),_&&_.name==="TypeError"&&/fetch/i.test(_.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,e,m),{cause:_.cause||_}):g.from(_,_&&_.code,e,m)}})};l.forEach(Ee,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const at=e=>`- ${e}`,Hn=e=>l.isFunction(e)||e===null||e===!1,ct={getAdapter:e=>{e=l.isArray(e)?e:[e];const{length:t}=e;let r,o;const s={};for(let i=0;i<t;i++){r=e[i];let a;if(o=r,!Hn(r)&&(o=Ee[(a=String(r)).toLowerCase()],o===void 0))throw new g(`Unknown adapter '${a}'`);if(o)break;s[a||"#"+i]=o}if(!o){const i=Object.entries(s).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=t?i.length>1?`since :
4
4
  `+i.map(at).join(`
5
5
  `):" "+at(i[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o},adapters:Ee};function ke(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new q(null,e)}function lt(e){return ke(e),e.headers=N.from(e.headers),e.data=be.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ct.getAdapter(e.adapter||K.adapter)(e).then(function(o){return ke(e),o.data=be.call(e,e.transformResponse,o),o.headers=N.from(o.headers),o},function(o){return Qe(o)||(ke(e),o&&o.response&&(o.response.data=be.call(e,e.transformResponse,o.response),o.response.headers=N.from(o.response.headers))),Promise.reject(o)})}const dt="1.7.7",we={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{we[e]=function(o){return typeof o===e||"a"+(t<1?"n ":" ")+e}});const pt={};we.transitional=function(t,r,o){function s(i,a){return"[Axios v"+dt+"] Transitional option '"+i+"'"+a+(o?". "+o:"")}return(i,a,c)=>{if(t===!1)throw new g(s(a," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!pt[a]&&(pt[a]=!0,console.warn(s(a," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,a,c):!0}};function zn(e,t,r){if(typeof e!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);const o=Object.keys(e);let s=o.length;for(;s-- >0;){const i=o[s],a=t[i];if(a){const c=e[i],u=c===void 0||a(c,i,e);if(u!==!0)throw new g("option "+i+" must be "+u,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+i,g.ERR_BAD_OPTION)}}const Se={assertOptions:zn,validators:we},A=Se.validators;class ${constructor(t){this.defaults=t,this.interceptors={request:new Je,response:new Je}}async request(t,r){try{return await this._request(t,r)}catch(o){if(o instanceof Error){let s;Error.captureStackTrace?Error.captureStackTrace(s={}):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{o.stack?i&&!String(o.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(o.stack+=`
6
- `+i):o.stack=i}catch{}}throw o}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=U(this.defaults,r);const{transitional:o,paramsSerializer:s,headers:i}=r;o!==void 0&&Se.assertOptions(o,{silentJSONParsing:A.transitional(A.boolean),forcedJSONParsing:A.transitional(A.boolean),clarifyTimeoutError:A.transitional(A.boolean)},!1),s!=null&&(l.isFunction(s)?r.paramsSerializer={serialize:s}:Se.assertOptions(s,{encode:A.function,serialize:A.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&l.merge(i.common,i[r.method]);i&&l.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),r.headers=N.concat(a,i);const c=[];let u=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(r)===!1||(u=u&&y.synchronous,c.unshift(y.fulfilled,y.rejected))});const d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let p,f=0,b;if(!u){const m=[lt.bind(this),void 0];for(m.unshift.apply(m,c),m.push.apply(m,d),b=m.length,p=Promise.resolve(r);f<b;)p=p.then(m[f++],m[f++]);return p}b=c.length;let k=r;for(f=0;f<b;){const m=c[f++],y=c[f++];try{k=m(k)}catch(h){y.call(this,h);break}}try{p=lt.call(this,k)}catch(m){return Promise.reject(m)}for(f=0,b=d.length;f<b;)p=p.then(d[f++],d[f++]);return p}getUri(t){t=U(this.defaults,t);const r=et(t.baseURL,t.url);return Ke(r,t.params,t.paramsSerializer)}}l.forEach(["delete","get","head","options"],function(t){$.prototype[t]=function(r,o){return this.request(U(o||{},{method:t,url:r,data:(o||{}).data}))}}),l.forEach(["post","put","patch"],function(t){function r(o){return function(i,a,c){return this.request(U(c||{},{method:t,headers:o?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}$.prototype[t]=r(),$.prototype[t+"Form"]=r(!0)});class Be{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const o=this;this.promise.then(s=>{if(!o._listeners)return;let i=o._listeners.length;for(;i-- >0;)o._listeners[i](s);o._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(c=>{o.subscribe(c),i=c}).then(s);return a.cancel=function(){o.unsubscribe(i)},a},t(function(i,a,c){o.reason||(o.reason=new q(i,a,c),r(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=o=>{t.abort(o)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new Be(function(s){t=s}),cancel:t}}}function Kn(e){return function(r){return e.apply(null,r)}}function Jn(e){return l.isObject(e)&&e.isAxiosError===!0}const Ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ce).forEach(([e,t])=>{Ce[t]=e});function ut(e){const t=new $(e),r=xe($.prototype.request,t);return l.extend(r,$.prototype,t,{allOwnKeys:!0}),l.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return ut(U(e,s))},r}const E=ut(K);E.Axios=$,E.CanceledError=q,E.CancelToken=Be,E.isCancel=Qe,E.VERSION=dt,E.toFormData=te,E.AxiosError=g,E.Cancel=E.CanceledError,E.all=function(t){return Promise.all(t)},E.spread=Kn,E.isAxiosError=Jn,E.mergeConfig=U,E.AxiosHeaders=N,E.formToJSON=e=>Ge(l.isHTMLForm(e)?new FormData(e):e),E.getAdapter=ct.getAdapter,E.HttpStatusCode=Ce,E.default=E;const ft=(e={})=>{const t=P(),{baseURL:r,projectId:o,projectToken:s,userToken:i,csrfToken:a}=t.getAPIConfig,c={baseURL:r,params:{project_id:o,project_token:s,token:i},...e};return(!s||!(o&&i)&&a)&&Object.assign(c,{headers:{"X-CSRF-Token":a}}),E.create({...c})};class Wn{static key(t,r){return ft().get(`/observation_matrices/${t}/key`,r)}}const W={Used:"used",Useful:"useful",Useless:"useless"},Gn=e=>({characterStateId:e.id,depictionIds:e.depiction_ids,label:e.label,position:e.position,...mt(e)}),Xn=e=>({depictionId:e.id,caption:e.caption,figureLabel:e.figure_label,imageUrl:e.image.medium}),G={Qualitative:"Descriptor::Qualitative",Continuous:"Descriptor::Continuous",Sample:"Descriptor::Sample",PresenceAbsence:"Descriptor::PresenceAbsence"},X=e=>({descriptorId:e.id,name:e.name,description:e.description,position:e.position,status:e.status,type:e.type,depictionIds:e.depiction_ids,usefulness:e.usefulness,weight:e.weight}),Qn=e=>({...X(e),defaultUnit:e.default_unit,max:e.max,min:e.min}),Yn=e=>({...X(e),defaultUnit:e.default_unit,max:e.max,min:e.min}),Zn=e=>({...X(e),states:e.states.map(t=>mt(t))}),vn=e=>({...X(e),characterStates:e.states.map(t=>Gn(t))}),er=e=>{switch(e.type){case G.Continuous:return Qn(e);case G.Sample:return Yn(e);case G.PresenceAbsence:return Zn(e);case G.Qualitative:return vn(e);default:return X(e)}},tr=e=>({observationMatrixId:e.observation_matrix_id,name:e.observation_matrix.name,globalId:e.observation_matrix.global_id}),mt=e=>({name:e.name,numberOfObjects:e.number_of_objects,status:e.status}),ht=e=>({errorDescriptors:e.error_descriptors,errors:e.errors,objectLabel:e.object.object_label,objectTag:e.object.object_tag,observationObjectId:e.object.observation_object_id,observationObjectType:e.object.observation_object_type,rowId:e.object.id}),nr=e=>({keywordId:e.id,definition:e.description,name:e.name}),rr=e=>({languageId:e.id,name:e.english_name}),D=Q.defineStore("observationMatrix",{state:()=>({observationMatrix:void 0,citation:void 0,descriptors:[],eliminated:[],remaining:[],availableKeywords:[],availableLanguages:[]}),getters:{getCitation:e=>e.citation,getObservationMatrix:e=>e.observationMatrix,getDescriptors:e=>e.descriptors,getDescriptorById:e=>t=>e.descriptors.find(r=>r.descriptorId===t),getDescriptorsUsed:e=>e.descriptors.filter(t=>t.status===W.Used),getDescriptorsUseless:e=>e.descriptors.filter(t=>t.status===W.Useless),getDescriptorsUseful:e=>e.descriptors.filter(t=>t.status===W.Useful),getEliminated:e=>e.eliminated,getKeywords:e=>e.availableKeywords,getLanguages:e=>e.availableLanguages,getRemaining:e=>e.remaining},actions:{setDescriptors(e){this.descriptors=e},setEliminated(e){this.eliminated=e},setRemaining(e){this.remaining=e},setLanguages(e){this.availableLanguages=e},setKeywords(e){this.availableKeywords=e},setObservationMatrix(e){this.observationMatrix=e},async requestInteractiveKey({observationMatrixId:e,params:t={},opt:r={}}){const o=await Wn.key(e,{params:t}),{data:s}=o;return r.refreshOnlyTaxa||(this.setObservationMatrix(tr(s)),this.setDescriptors(s.list_of_descriptors.map(i=>er(i))),this.setKeywords(s.descriptor_available_keywords.map(i=>nr(i))),this.setLanguages(s.descriptor_available_languages.map(i=>rr(i)))),this.setEliminated(s.eliminated.map(i=>ht(i))),this.setRemaining(s.remaining.map(i=>ht(i))),o}}}),B=Q.defineStore("filter",{state:()=>({descriptors:{},eliminateUnknown:void 0,errorTolerance:void 0,identifiedToRank:void 0,keywordIds:[],languageId:void 0,rowIds:[],sorting:void 0}),getters:{getKeywordIds:e=>e.keywordIds,getLanguageId:e=>e.languageId,getRowIds:e=>e.rowIds,getDescriptors:e=>e.descriptors,getIdentifiedToRank:e=>e.identifiedToRank,getEliminateUknown:e=>e.eliminateUnknown,getErrorTolerance:e=>e.errorTolerance,getSorting:e=>e.sorting,getDescriptorValueById:e=>t=>{const r=e.descriptors[t];return typeof r=="boolean"?r:r||""},getFilterParams:e=>({selected_descriptors:Object.entries(e.descriptors).map(([r,o])=>Array.isArray(o)?`${r}:${o.join("|")}`:`${r}:${o}`).join("||"),language_id:e.languageId,keyword_ids:e.keywordIds,sorting:e.sorting,identified_to_rank:e.identifiedToRank,error_tolerance:e.errorTolerance,eliminate_unknown:e.eliminateUnknown,row_filter:e.rowIds.join("|")})},actions:{setDescriptor({descriptorId:e,value:t}){this.descriptors[e]=t},removeDescriptor(e){delete this.descriptors[e]},removeKeywordId(e){const t=this.keywordIds.findIndex(r=>r===e);t>-1&&this.keywordIds.splice(t,1)},addKeywordId(e){this.keywordIds.push(e)},setLanguageId(e){this.languageId=e},setErrorTolerance(e){this.errorTolerance=e},setEliminateUnknown(e){this.eliminateUnknown=e}}}),P=Q.defineStore("settings",{state:()=>({gridLayout:"distinguish-layout-mode-1",isLoading:!1,isRefreshing:!1,refreshOnlyTaxa:!1,rowFilter:!0,shouldUpdate:!0,observationMatrixId:void 0,errorMessage:"",apiConfig:{baseURL:"",projectId:void 0,projectToken:void 0,userToken:void 0}}),getters:{getErrorMessage:e=>e.errorMessage,getIsLoading:e=>e.isLoading,getLayout:e=>e.gridLayout,getRefreshOnlyTaxa:e=>e.refreshOnlyTaxa,getRowFilter:e=>e.rowFilter,getShouldUpdate:e=>e.shouldUpdate,getObservationMatrixId:e=>e.observationMatrixId,getAPIConfig:e=>e.apiConfig},actions:{setObservationMatrixId(e){this.observationMatrixId=e},setShouldUpdate(e){this.shouldUpdate=e},setRefreshOnlyTaxa(e){this.refreshOnlyTaxa=e},setAPIConfig(e){this.apiConfig=e},checkUpdate(){const e=B(),t=D(),r=this.observationMatrixId;this.shouldUpdate&&r&&(this.isLoading=!0,t.requestInteractiveKey({observationMatrixId:r,params:e.getFilterParams,opt:{refreshOnlyTaxa:this.refreshOnlyTaxa}}).then(o=>this.errorMessage="").catch(o=>this.errorMessage=o.message).finally(()=>this.isLoading=!1))}}}),or=n.defineComponent({__name:"FilterEliminateUnknowns",setup(e){const t=B(),r=n.computed({get:()=>!!t.getEliminateUknown,set:o=>{t.setEliminateUnknown(o)}});return(o,s)=>(n.openBlock(),n.createElementBlock("label",null,[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=i=>r.value=i),type:"checkbox"},null,512),[[n.vModelCheckbox,r.value]]),s[1]||(s[1]=n.createTextVNode(" Eliminate unknowns "))]))}}),sr=["value"],ir=n.defineComponent({__name:"FilterErrorTolerance",setup(e){const t=[0,1,2],r=B(),o=n.computed({get:()=>r.getErrorTolerance,set:s=>{r.setErrorTolerance(s)}});return(s,i)=>(n.openBlock(),n.createElementBlock("div",null,[i[2]||(i[2]=n.createElementVNode("label",{for:"languages",class:"distinguish-input-label"}," Error tolerance ",-1)),n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":i[0]||(i[0]=a=>o.value=a),name:"languages",role:"listbox"},[i[1]||(i[1]=n.createElementVNode("option",{value:""},null,-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(t,a=>n.createElementVNode("option",{key:a,value:a},n.toDisplayString(a),9,sr)),64))],512),[[n.vModelSelect,o.value]])]))}}),ar=["otu","subspecies","species","subgenus","genus","subtribe","tribe","subfamily","family"],cr=n.defineComponent({__name:"FilterRank",setup(e){const t=B(),r=n.computed({get(){return t.getIdentifiedToRank},set(o){t.$patch({identifiedToRank:o})}});return(o,s)=>(n.openBlock(),n.createElementBlock("div",null,[s[2]||(s[2]=n.createElementVNode("label",{class:"distinguish-input-label"},"Identified to rank",-1)),n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":s[0]||(s[0]=i=>r.value=i)},[s[1]||(s[1]=n.createElementVNode("option",{value:void 0},null,-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(ar),i=>(n.openBlock(),n.createElementBlock("option",{key:i},n.toDisplayString(i),1))),128))],512),[[n.vModelSelect,r.value]])]))}}),lr=n.defineComponent({__name:"FilterSort",setup(e){const t=["ordered","weighted","optimized"],r=B(),o=n.computed({get(){return r.getSorting},set(s){r.$patch({sorting:s})}});return(s,i)=>(n.openBlock(),n.createElementBlock("div",null,[i[2]||(i[2]=n.createElementVNode("label",{class:"distinguish-input-label"},"Descriptor sorting",-1)),n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":i[0]||(i[0]=a=>o.value=a)},[i[1]||(i[1]=n.createElementVNode("option",{value:void 0},null,-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(t,a=>n.createElementVNode("option",{key:a},n.toDisplayString(a),1)),64))],512),[[n.vModelSelect,o.value]])]))}}),dr=["value"],pr=n.defineComponent({__name:"FilterLanguage",setup(e){const t=B(),r=D(),o=n.computed({get:()=>t.getLanguageId,set:s=>{t.setLanguageId(Number(s))}});return(s,i)=>(n.openBlock(),n.createElementBlock("div",null,[i[1]||(i[1]=n.createElementVNode("label",{for:"languages",class:"distinguish-input-label"}," Languages ",-1)),n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":i[0]||(i[0]=a=>o.value=a),name:"languages",role:"listbox"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(r).getLanguages,({languageId:a,name:c})=>(n.openBlock(),n.createElementBlock("option",{key:a,value:a},n.toDisplayString(c),9,dr))),128))],512),[[n.vModelSelect,o.value]])]))}}),ur=["disabled"],ie=n.defineComponent({__name:"VBtn",props:{color:{default:"primary"},size:{default:"medium"},disabled:{type:Boolean}},setup(e){const t=e,r=n.computed(()=>[`distinguish-btn-${t.color}-color`,`distinguish-btn-${t.size}-size`]);return(o,s)=>(n.openBlock(),n.createElementBlock("button",{type:"button",class:n.normalizeClass(["distinguish-btn",r.value]),disabled:o.disabled},[n.renderSlot(o.$slots,"default")],10,ur))}}),fr={class:"distinguish-modal-wrapper"},mr={class:"distinguish-modal-header"},hr={class:"distinguish-modal-body"},gr={class:"distinguish-modal-footer"},Ne=n.defineComponent({__name:"VModal",props:{containerClass:{},containerStyle:{}},emits:["close"],setup(e,{emit:t}){const r=t,o=s=>{s.preventDefault(),s.key==="Escape"&&r("close")};return n.onMounted(()=>document.addEventListener("keydown",o)),n.onUnmounted(()=>document.removeEventListener("keydown",o)),(s,i)=>(n.openBlock(),n.createBlock(n.Transition,{name:"distinguish-modal"},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"distinguish-modal-mask",onClick:i[2]||(i[2]=a=>r("close")),onKey:i[3]||(i[3]=a=>r("close"))},[n.createElementVNode("div",fr,[n.createElementVNode("div",{class:n.normalizeClass(["distinguish-modal-container",s.containerClass]),style:n.normalizeStyle({...s.containerStyle}),onClick:i[1]||(i[1]=n.withModifiers(()=>{},["stop"]))},[n.createElementVNode("div",mr,[n.createElementVNode("div",{class:"distinguish-modal-close",onClick:i[0]||(i[0]=a=>r("close"))}),n.renderSlot(s.$slots,"header")]),n.createElementVNode("div",hr,[n.renderSlot(s.$slots,"body")]),n.createElementVNode("div",gr,[n.renderSlot(s.$slots,"footer")])],6)])],32)]),_:3}))}}),yr={class:"distinguish-list-checkboxes"},br=["value"],_r=n.defineComponent({__name:"FilterKeywords",setup(e){const t=D(),r=B(),o=n.ref(!1),s=n.computed({get:()=>r.getKeywordIds,set:i=>{r.$patch({keywordIds:i})}});return(i,a)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(ie,{color:"primary",size:"medium",disabled:!n.unref(t).getKeywords.length,title:n.unref(t).getKeywords.length?"":"No tags defined.",onClick:a[0]||(a[0]=c=>o.value=!0)},{default:n.withCtx(()=>a[3]||(a[3]=[n.createTextVNode(" Keyword ")])),_:1},8,["disabled","title"]),o.value?(n.openBlock(),n.createBlock(Ne,{key:0,onClose:a[2]||(a[2]=c=>o.value=!1)},{header:n.withCtx(()=>a[4]||(a[4]=[n.createElementVNode("h3",null,"Keywords",-1)])),body:n.withCtx(()=>[n.createElementVNode("ul",yr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(t).getKeywords,({keywordId:c,name:u})=>(n.openBlock(),n.createElementBlock("li",{key:c},[n.createElementVNode("label",null,[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":a[1]||(a[1]=d=>s.value=d),value:c,type:"checkbox"},null,8,br),[[n.vModelCheckbox,s.value]]),n.createTextVNode(" "+n.toDisplayString(u),1)])]))),128))])]),_:1})):n.createCommentVNode("",!0)],64))}}),Er=n.defineComponent({__name:"SettingRefresh",setup(e){const t=P(),r=n.computed({get:()=>t.getRefreshOnlyTaxa,set:o=>{t.setRefreshOnlyTaxa(o)}});return(o,s)=>(n.openBlock(),n.createElementBlock("label",null,[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=i=>r.value=i),type:"checkbox"},null,512),[[n.vModelCheckbox,r.value]]),s[1]||(s[1]=n.createTextVNode(" Refresh only taxa "))]))}}),ae=(e,t)=>{const r=e.__vccOpts||e;for(const[o,s]of t)r[o]=s;return r},kr={},wr={class:"distinguish-menu-list"};function Sr(e,t){return n.openBlock(),n.createElementBlock("ul",wr,[n.renderSlot(e.$slots,"default")])}const Br=ae(kr,[["render",Sr]]),Cr={},Nr={class:"distinguish-list-item"};function Rr(e,t){return n.openBlock(),n.createElementBlock("li",Nr,[n.renderSlot(e.$slots,"default")])}const F=ae(Cr,[["render",Rr]]),gt={"distinguish-layout-mode-1":"distinguish-layout-mode-2","distinguish-layout-mode-2":"distinguish-layout-mode-1"},Tr={},xr={class:"distinguish-grid"};function Or(e,t){return n.openBlock(),n.createElementBlock("div",xr,[n.renderSlot(e.$slots,"default")])}const yt=ae(Tr,[["render",Or]]),Dr=n.defineComponent({__name:"GridToggle",setup(e){const t=P(),r=n.computed(()=>t.getLayout),o=()=>{t.$patch({gridLayout:gt[r.value]})};return(s,i)=>(n.openBlock(),n.createBlock(ie,{class:n.normalizeClass(n.unref(gt)[r.value]),onClick:o},{default:n.withCtx(()=>[n.createVNode(yt,{class:"distinguish-grid-icon"},{default:n.withCtx(()=>i[0]||(i[0]=[n.createElementVNode("div",{class:"distinguish-panel-descriptors"},null,-1),n.createElementVNode("div",{class:"distinguish-panel-remaining"},null,-1),n.createElementVNode("div",{class:"distinguish-panel-eliminated"},null,-1)])),_:1})]),_:1},8,["class"]))}}),Vr=n.defineComponent({__name:"ResetButton",setup(e){const t=B();return(r,o)=>(n.openBlock(),n.createBlock(ie,{color:"primary",size:"medium",onClick:o[0]||(o[0]=s=>n.unref(t).$reset())},{default:n.withCtx(()=>o[1]||(o[1]=[n.createTextVNode(" Reset ")])),_:1}))}}),Ar={class:"distinguish-header-error-message"},Ir=n.defineComponent({__name:"ErrorMessage",setup(e){const t=P();return(r,o)=>(n.openBlock(),n.createElementBlock("span",Ar,n.toDisplayString(n.unref(t).getErrorMessage),1))}}),Lr={class:"distinguish-header-bar"},Ur={class:"distinguish-header-bar__buttons"},$r=n.defineComponent({__name:"HeaderBar",setup(e){return(t,r)=>(n.openBlock(),n.createElementBlock("div",Lr,[n.createVNode(Ir),n.createVNode(Br,null,{default:n.withCtx(()=>[n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(Er)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(or)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(ir)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(cr)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(pr)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(lr)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(_r)]),_:1})]),_:1}),n.createElementVNode("div",Ur,[n.createVNode(Vr),n.createVNode(Dr)])]))}}),Pr={},Fr={class:"distinguish-panel"};function Mr(e,t){return n.openBlock(),n.createElementBlock("div",Fr,[n.renderSlot(e.$slots,"default")])}const Re=ae(Pr,[["render",Mr]]),jr=["innerHTML"],qr=n.defineComponent({__name:"PanelEliminated",props:{render:{type:Function}},setup(e){const t=D(),r=n.computed(()=>t.getEliminated);return(o,s)=>(n.openBlock(),n.createBlock(Re,{class:"distinguish-panel-eliminated"},{default:n.withCtx(()=>[n.createElementVNode("h2",null,"Eliminated ("+n.toDisplayString(r.value.length)+")",1),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,i=>(n.openBlock(),n.createElementBlock("li",{key:i.rowId,class:"distinguish-row-item"},[n.renderSlot(o.$slots,"default",{item:i},()=>[n.createElementVNode("span",{innerHTML:o.render?o.render(i):i.objectTag},null,8,jr)])]))),128))])]),_:3}))}}),Hr={class:"distinguish-list-checkboxes"},zr=["value"],Kr=n.defineComponent({__name:"FilterRow",setup(e){const t=D(),r=P(),o=B(),s=n.ref(!1),i=n.ref([]),a=n.computed(()=>{const u=o.getRowIds,d=i.value;return u.length!==d.length||!u.every(p=>d.includes(p))}),c=n.computed({get:()=>o.getRowIds,set:u=>{o.$patch({rowIds:u})}});return n.watch(s,u=>{r.setShouldUpdate(!u),!u&&a.value&&r.checkUpdate(),i.value=o.getRowIds}),(u,d)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(ie,{color:"primary",size:"medium",onClick:d[0]||(d[0]=p=>s.value=!0)},{default:n.withCtx(()=>d[3]||(d[3]=[n.createTextVNode(" Select ")])),_:1}),s.value?(n.openBlock(),n.createBlock(Ne,{key:0,onClose:d[2]||(d[2]=p=>s.value=!1)},{header:n.withCtx(()=>d[4]||(d[4]=[n.createElementVNode("h3",null,"Filter row",-1)])),body:n.withCtx(()=>[n.createElementVNode("div",null,[n.createElementVNode("ul",Hr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(t).getRemaining,p=>(n.openBlock(),n.createElementBlock("li",{key:p.rowId},[n.createElementVNode("label",null,[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":d[1]||(d[1]=f=>c.value=f),value:p.rowId,type:"checkbox"},null,8,zr),[[n.vModelCheckbox,c.value]]),n.createTextVNode(" "+n.toDisplayString(p.objectLabel),1)])]))),128))])])]),_:1})):n.createCommentVNode("",!0)],64))}}),Jr={class:"distinguish-title-section"},Wr=["innerHTML"],Gr=n.defineComponent({__name:"PanelRemaining",props:{render:{type:Function}},setup(e){const t=D(),r=n.computed(()=>t.getRemaining);return(o,s)=>(n.openBlock(),n.createBlock(Re,{class:"distinguish-panel-remaining"},{default:n.withCtx(()=>[n.createElementVNode("div",Jr,[n.createElementVNode("h2",null,"Remaining ("+n.toDisplayString(r.value.length)+")",1),n.createVNode(Kr)]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,i=>(n.openBlock(),n.createElementBlock("li",{key:i.rowId,class:"distinguish-row-item"},[n.renderSlot(o.$slots,"default",{item:i},()=>[n.createElementVNode("span",{innerHTML:o.render?o.render(i):i.objectTag},null,8,Wr)])]))),128))])]),_:3}))}});class Xr{static find(t){return ft().get(`/depictions/${t}.json`,{params:{extend:["image"]}})}}const Qr={key:0,class:"distinguish-depiction-box"},Yr=["src"],bt=n.defineComponent({__name:"VDepiction",props:{depictionId:{}},setup(e){const t=e,r=n.ref();return Xr.find(t.depictionId).then(({data:o})=>{r.value=Xn(o)}),(o,s)=>r.value?(n.openBlock(),n.createElementBlock("div",Qr,[n.createElementVNode("img",{src:r.value.imageUrl},null,8,Yr)])):n.createCommentVNode("",!0)}}),Zr={class:"distinguish-character-descriptor__cell"},vr=["value"],eo=n.defineComponent({__name:"CharacterStateCell",props:{characterState:{},descriptorId:{}},setup(e){const t=e,r=B(),o=n.computed({get:()=>r.getDescriptorValueById(t.descriptorId)||[],set:s=>{s.length?r.setDescriptor({descriptorId:t.descriptorId,value:s}):r.removeDescriptor(t.descriptorId)}});return(s,i)=>(n.openBlock(),n.createElementBlock("div",Zr,[n.createElementVNode("label",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.characterState.depictionIds,a=>(n.openBlock(),n.createBlock(bt,{key:a,"depiction-id":a},null,8,["depiction-id"]))),128)),n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=a=>o.value=a),value:s.characterState.characterStateId,type:"checkbox"},null,8,vr),[[n.vModelCheckbox,o.value]]),n.createTextVNode(" "+n.toDisplayString(s.characterState.name),1)])]))}}),to={class:"distinguish-character-states-grid"},no=n.defineComponent({__name:"CharacterStateGrid",props:{descriptor:{}},setup(e){const t=e,r=B(),o=P(),s=n.ref(),i=n.computed(()=>{const a=r.getDescriptorValueById(t.descriptor.descriptorId)||[],c=s.value||[];return a.length!==c.length||!a.every(u=>c.includes(u))});return n.onMounted(()=>{o.setShouldUpdate(!1),s.value=r.getDescriptorValueById(t.descriptor.descriptorId)}),n.onUnmounted(()=>{o.setShouldUpdate(!0),i.value&&o.checkUpdate()}),(a,c)=>(n.openBlock(),n.createElementBlock("div",to,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.descriptor.characterStates,u=>(n.openBlock(),n.createBlock(eo,{key:u.characterStateId,"descriptor-id":a.descriptor.descriptorId,"character-state":u},null,8,["descriptor-id","character-state"]))),128))]))}}),ro={key:0},oo={key:1},so={class:"descriptor-modal__depiction"},io=n.defineComponent({__name:"DescriptorModal",props:{descriptor:{}},setup(e){return(t,r)=>(n.openBlock(),n.createBlock(Ne,{"container-class":"distinguish-descriptor-modal"},{header:n.withCtx(()=>[n.createElementVNode("h3",null,n.toDisplayString(t.descriptor.name),1),t.descriptor.description?(n.openBlock(),n.createElementBlock("span",ro,n.toDisplayString(t.descriptor.description),1)):(n.openBlock(),n.createElementBlock("i",oo," No further description available. "))]),body:n.withCtx(()=>[n.createElementVNode("div",so,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.descriptor.depictionIds,o=>(n.openBlock(),n.createBlock(bt,{key:o,"depiction-id":o},null,8,["depiction-id"]))),128))]),r[0]||(r[0]=n.createElementVNode("hr",null,null,-1)),t.descriptor.type===n.unref(G).Qualitative?(n.openBlock(),n.createBlock(no,{key:0,descriptor:t.descriptor},null,8,["descriptor"])):n.createCommentVNode("",!0)]),_:1}))}}),ao=["id"],co={class:"distinguish-input-label"},ce=n.defineComponent({__name:"DescriptorContainer",props:{descriptor:{}},setup(e){const t=n.ref(!1);return(r,o)=>(n.openBlock(),n.createElementBlock("div",{id:`descriptor-${r.descriptor.descriptorId}`,class:"distinguish-descriptor-container"},[n.createElementVNode("div",co,[n.createElementVNode("span",{class:"distinguish-link",onClick:o[0]||(o[0]=s=>t.value=!0)},[n.renderSlot(r.$slots,"title",{},()=>[n.createTextVNode(n.toDisplayString(r.descriptor.name),1)])])]),n.renderSlot(r.$slots,"default"),t.value?(n.openBlock(),n.createBlock(io,{key:0,descriptor:r.descriptor,onClose:o[1]||(o[1]=s=>t.value=!1)},null,8,["descriptor"])):n.createCommentVNode("",!0)],8,ao))}}),lo=n.defineComponent({__name:"DescriptorContinuous",props:{descriptor:{}},setup(e){const t=e,r=B(),o=n.ref(String(r.getDescriptorValueById(t.descriptor.descriptorId))),s=()=>{const{descriptorId:i}=t.descriptor,a=o.value.trim();a?r.setDescriptor({descriptorId:i,value:a}):r.removeDescriptor(i)};return(i,a)=>(n.openBlock(),n.createBlock(ce,{class:"distinguish-descriptor-continuous",descriptor:i.descriptor},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(i.descriptor.name)+" ("+n.toDisplayString(i.descriptor.min)+"-"+n.toDisplayString(i.descriptor.max)+" "+n.toDisplayString(i.descriptor.defaultUnit)+") ",1)]),default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=c=>o.value=c),type:"text",onBlur:s,onKeyup:n.withKeys(s,["enter"])},null,544),[[n.vModelText,o.value]])]),_:1},8,["descriptor"]))}}),po=["value"],uo={key:0},fo=n.defineComponent({__name:"DescriptorPresenceAbsence",props:{descriptor:{}},setup(e){const t={Presence:!0,Absent:!1},r=e,o=B(),s=n.computed({get:()=>o.getDescriptorValueById(r.descriptor.descriptorId),set:a=>{const{descriptorId:c}=r.descriptor;typeof a=="boolean"?o.setDescriptor({descriptorId:c,value:!!a}):o.removeDescriptor(c)}}),i=a=>{var u;const{states:c}=r.descriptor;return((u=c.find(d=>d.name===String(a)))==null?void 0:u.numberOfObjects)||0};return(a,c)=>(n.openBlock(),n.createBlock(ce,{class:"distinguish-descriptor-presence-absence",descriptor:a.descriptor},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":c[0]||(c[0]=u=>s.value=u)},[c[1]||(c[1]=n.createElementVNode("option",null,null,-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(t,(u,d)=>n.createElementVNode("option",{key:d,value:u},[a.descriptor.status===n.unref(W).Useless?(n.openBlock(),n.createElementBlock("span",uo,"-")):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(d)+" ("+n.toDisplayString(i(u))+") ",1)],8,po)),64))],512),[[n.vModelSelect,s.value]])]),_:1},8,["descriptor"]))}}),mo=["value","selected"],ho={key:0},go={key:1},yo=n.defineComponent({__name:"DescriptorQualitative",props:{descriptor:{}},setup(e){const t=e,r=B(),o=i=>{const a=i.target,{descriptorId:c}=t.descriptor;a.value?r.setDescriptor({descriptorId:c,value:[Number(a.value)]}):r.removeDescriptor(c)},s=i=>r.getDescriptorValueById(t.descriptor.descriptorId).includes(i.characterStateId);return(i,a)=>(n.openBlock(),n.createBlock(ce,{class:"distinguish-descriptor-qualitative",descriptor:i.descriptor},{default:n.withCtx(()=>[n.createElementVNode("select",{name:"listbox",onChange:o},[a[0]||(a[0]=n.createElementVNode("option",{value:""},null,-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.descriptor.characterStates,c=>(n.openBlock(),n.createElementBlock("option",{key:c.characterStateId,value:c.characterStateId,selected:s(c)},[s(c)?(n.openBlock(),n.createElementBlock("span",ho,">")):n.createCommentVNode("",!0),c.status===n.unref(W).Useless?(n.openBlock(),n.createElementBlock("span",go,"-")):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(c.name)+" ("+n.toDisplayString(c.numberOfObjects)+") ",1)],8,mo))),128))],32)]),_:1},8,["descriptor"]))}}),bo=n.defineComponent({__name:"DescriptorSample",props:{descriptor:{}},setup(e){const t=e,r=B(),o=n.ref(String(r.getDescriptorValueById(t.descriptor.descriptorId))),s=()=>{const{descriptorId:i}=t.descriptor,a=o.value.trim();a?r.setDescriptor({descriptorId:i,value:a}):r.removeDescriptor(i)};return(i,a)=>(n.openBlock(),n.createBlock(ce,{class:"distinguish-descriptor-sample",descriptor:i.descriptor},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(i.descriptor.name)+" ("+n.toDisplayString(i.descriptor.min)+"-"+n.toDisplayString(i.descriptor.max)+" "+n.toDisplayString(i.descriptor.defaultUnit)+") ",1)]),default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=c=>o.value=c),type:"text",onBlur:s,onKeyup:n.withKeys(s,["enter"])},null,544),[[n.vModelText,o.value]])]),_:1},8,["descriptor"]))}}),Te=n.defineComponent({__name:"DescriptorsList",props:{title:{},descriptors:{}},setup(e){const t={DescriptorContinuous:lo,DescriptorPresenceAbsence:fo,DescriptorQualitative:yo,DescriptorSample:bo},r=o=>{const s=o.replace("::","");return t[s]};return(o,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("h2",null,n.toDisplayString(o.title),1),n.createElementVNode("ol",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.descriptors,i=>(n.openBlock(),n.createElementBlock("li",{key:i.descriptorId},[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(r(i.type)),{descriptor:i},null,8,["descriptor"]))]))),128))])],64))}}),_o=n.defineComponent({__name:"PanelDescriptors",setup(e){const t=D();return(r,o)=>(n.openBlock(),n.createBlock(Re,{class:"distinguish-panel-descriptors"},{default:n.withCtx(()=>[n.unref(t).getDescriptorsUsed.length?(n.openBlock(),n.createBlock(Te,{key:0,descriptors:n.unref(t).getDescriptorsUsed,title:"Used Descriptors"},null,8,["descriptors"])):n.createCommentVNode("",!0),n.unref(t).getDescriptorsUseful.length?(n.openBlock(),n.createBlock(Te,{key:1,descriptors:n.unref(t).getDescriptorsUseful,title:"Descriptors Useful for Identification"},null,8,["descriptors"])):n.createCommentVNode("",!0),n.unref(t).getDescriptorsUseless.length?(n.openBlock(),n.createBlock(Te,{key:2,descriptors:n.unref(t).getDescriptorsUseless,title:"Descriptors no longer relevant for identification"},null,8,["descriptors"])):n.createCommentVNode("",!0)]),_:1}))}}),Eo={class:"distinguish-spinner-container"},ko={class:"distinguish-spinner-legend"},wo=["innerHTML"],So=n.defineComponent({__name:"VSpinner",props:{legend:{type:String,default:"Loading, please wait."}},setup(e){return(t,r)=>(n.openBlock(),n.createBlock(n.Transition,{name:"fade"},{default:n.withCtx(()=>[n.createElementVNode("div",Eo,[n.createElementVNode("div",null,[r[0]||(r[0]=n.createElementVNode("div",{class:"distinguish-spinner"},null,-1)),n.createElementVNode("div",ko,[n.createElementVNode("span",{innerHTML:e.legend},null,8,wo),n.renderSlot(t.$slots,"default")])])])]),_:3}))}}),Bo={class:"distinguish-title"},Co={key:0},No=n.defineComponent({__name:"TitleMatrix",setup(e){const t=D();return(r,o)=>(n.openBlock(),n.createElementBlock("h1",Bo,[o[0]||(o[0]=n.createTextVNode(" Interactive key ")),n.unref(t).getObservationMatrix?(n.openBlock(),n.createElementBlock("span",Co,"| "+n.toDisplayString(n.unref(t).getObservationMatrix.name),1)):n.createCommentVNode("",!0)]))}}),Ro=["title"],To=n.defineComponent({__name:"TitleMatrixCitation",setup(e){const t=D(),r=n.computed(()=>{const o=t.getCitation;return Object.values(o||{}).filter(Boolean).join(", ")});return(o,s)=>(n.openBlock(),n.createElementBlock("span",{class:"distinguish-title-citation",title:r.value},n.toDisplayString(r.value),9,Ro))}}),xo={class:"distinguish-title-section"},Oo=n.defineComponent({__name:"TitleKey",setup(e){return(t,r)=>(n.openBlock(),n.createElementBlock("div",xo,[n.createVNode(No),n.createVNode(To)]))}}),Do={class:"distinguish-app-container"},_t=n.defineComponent({name:"Distinguish",__name:"App",props:{observationMatrixId:{},apiConfig:{},renderItem:{type:Function}},setup(e){const t=e,r=P(),o=B(),s=n.computed(()=>r.getIsLoading),i=n.computed(()=>r.getLayout);return(()=>{r.setAPIConfig(t.apiConfig),r.setObservationMatrixId(t.observationMatrixId),r.checkUpdate()})(),o.$subscribe(c=>{r.shouldUpdate&&r.checkUpdate()}),(c,u)=>(n.openBlock(),n.createElementBlock("div",Do,[n.createVNode(Oo),n.createVNode($r),n.createVNode(yt,{class:n.normalizeClass(i.value)},{default:n.withCtx(()=>[n.createVNode(_o),n.createVNode(Gr,{render:t.renderItem},{default:n.withCtx(d=>[n.renderSlot(c.$slots,"remaining-item",n.normalizeProps(n.guardReactiveProps(d)))]),_:3},8,["render"]),n.createVNode(qr,{render:t.renderItem},{default:n.withCtx(d=>[n.renderSlot(c.$slots,"eliminated-item",n.normalizeProps(n.guardReactiveProps(d)))]),_:3},8,["render"])]),_:3},8,["class"]),s.value?(n.openBlock(),n.createBlock(So,{key:0,legend:"Loading interactive key..."})):n.createCommentVNode("",!0)]))}});function Et(e){const t=e||'[data-interactive-key="true"]';return[...document.querySelectorAll(t)].map(s=>kt(s,Ao(s)))}function Vo(){Et()}function Ao(e){return{observationMatrixId:Number(e.getAttribute("data-observation-matrix-id")),apiConfig:{baseURL:e.getAttribute("data-base-url")||"",projectToken:e.getAttribute("data-project-token")||void 0,projectId:Number(e.getAttribute("data-project-id"))||void 0,userToken:e.getAttribute("data-user-token")||void 0,csrfToken:e.getAttribute("data-csrf-token")||void 0}}}function kt(e,t){const{apiConfig:r,observationMatrixId:o}=t;if(!o)throw"Missing observation matrix ID";if(!r||!r.projectToken&&!r.csrfToken&&!(r.projectId&&r.userToken))throw"Missing API configuration";const s=n.createApp(_t,{observationMatrixId:o,apiConfig:r});return s.use(Q.createPinia()),s.mount(e),s}window.addEventListener("DOMContentLoaded",Vo),O.VueInteractiveKey=_t,O.createInteractiveKey=kt,O.discoverInteractiveKey=Et,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
6
+ `+i):o.stack=i}catch{}}throw o}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=U(this.defaults,r);const{transitional:o,paramsSerializer:s,headers:i}=r;o!==void 0&&Se.assertOptions(o,{silentJSONParsing:A.transitional(A.boolean),forcedJSONParsing:A.transitional(A.boolean),clarifyTimeoutError:A.transitional(A.boolean)},!1),s!=null&&(l.isFunction(s)?r.paramsSerializer={serialize:s}:Se.assertOptions(s,{encode:A.function,serialize:A.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&l.merge(i.common,i[r.method]);i&&l.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),r.headers=N.concat(a,i);const c=[];let u=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(r)===!1||(u=u&&y.synchronous,c.unshift(y.fulfilled,y.rejected))});const d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let p,f=0,b;if(!u){const m=[lt.bind(this),void 0];for(m.unshift.apply(m,c),m.push.apply(m,d),b=m.length,p=Promise.resolve(r);f<b;)p=p.then(m[f++],m[f++]);return p}b=c.length;let k=r;for(f=0;f<b;){const m=c[f++],y=c[f++];try{k=m(k)}catch(h){y.call(this,h);break}}try{p=lt.call(this,k)}catch(m){return Promise.reject(m)}for(f=0,b=d.length;f<b;)p=p.then(d[f++],d[f++]);return p}getUri(t){t=U(this.defaults,t);const r=et(t.baseURL,t.url);return Ke(r,t.params,t.paramsSerializer)}}l.forEach(["delete","get","head","options"],function(t){$.prototype[t]=function(r,o){return this.request(U(o||{},{method:t,url:r,data:(o||{}).data}))}}),l.forEach(["post","put","patch"],function(t){function r(o){return function(i,a,c){return this.request(U(c||{},{method:t,headers:o?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}$.prototype[t]=r(),$.prototype[t+"Form"]=r(!0)});class Be{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const o=this;this.promise.then(s=>{if(!o._listeners)return;let i=o._listeners.length;for(;i-- >0;)o._listeners[i](s);o._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(c=>{o.subscribe(c),i=c}).then(s);return a.cancel=function(){o.unsubscribe(i)},a},t(function(i,a,c){o.reason||(o.reason=new q(i,a,c),r(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=o=>{t.abort(o)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new Be(function(s){t=s}),cancel:t}}}function Kn(e){return function(r){return e.apply(null,r)}}function Jn(e){return l.isObject(e)&&e.isAxiosError===!0}const Ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ce).forEach(([e,t])=>{Ce[t]=e});function ut(e){const t=new $(e),r=xe($.prototype.request,t);return l.extend(r,$.prototype,t,{allOwnKeys:!0}),l.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return ut(U(e,s))},r}const E=ut(K);E.Axios=$,E.CanceledError=q,E.CancelToken=Be,E.isCancel=Qe,E.VERSION=dt,E.toFormData=te,E.AxiosError=g,E.Cancel=E.CanceledError,E.all=function(t){return Promise.all(t)},E.spread=Kn,E.isAxiosError=Jn,E.mergeConfig=U,E.AxiosHeaders=N,E.formToJSON=e=>Ge(l.isHTMLForm(e)?new FormData(e):e),E.getAdapter=ct.getAdapter,E.HttpStatusCode=Ce,E.default=E;const ft=(e={})=>{const t=P(),{baseURL:r,projectId:o,projectToken:s,userToken:i,csrfToken:a}=t.getAPIConfig,c={baseURL:r,params:{project_id:o,project_token:s,token:i},...e};return(!s||!(o&&i)&&a)&&Object.assign(c,{headers:{"X-CSRF-Token":a}}),E.create({...c})};class Wn{static key(t,r){return ft().get(`/observation_matrices/${t}/key`,r)}}const W={Used:"used",Useful:"useful",Useless:"useless"},Gn=e=>({characterStateId:e.id,depictionIds:e.depiction_ids,label:e.label,position:e.position,...mt(e)}),Xn=e=>({depictionId:e.id,caption:e.caption,figureLabel:e.figure_label,imageUrl:e.image.medium}),G={Qualitative:"Descriptor::Qualitative",Continuous:"Descriptor::Continuous",Sample:"Descriptor::Sample",PresenceAbsence:"Descriptor::PresenceAbsence"},X=e=>({descriptorId:e.id,name:e.name,description:e.description,position:e.position,status:e.status,type:e.type,depictionIds:e.depiction_ids,usefulness:e.usefulness,weight:e.weight}),Qn=e=>({...X(e),defaultUnit:e.default_unit,max:e.max,min:e.min}),Yn=e=>({...X(e),defaultUnit:e.default_unit,max:e.max,min:e.min}),Zn=e=>({...X(e),states:e.states.map(t=>mt(t))}),vn=e=>({...X(e),characterStates:e.states.map(t=>Gn(t))}),er=e=>{switch(e.type){case G.Continuous:return Qn(e);case G.Sample:return Yn(e);case G.PresenceAbsence:return Zn(e);case G.Qualitative:return vn(e);default:return X(e)}},tr=e=>({observationMatrixId:e.observation_matrix_id,name:e.observation_matrix.name,globalId:e.observation_matrix.global_id}),mt=e=>({name:e.name,numberOfObjects:e.number_of_objects,status:e.status}),ht=e=>({errorDescriptors:e.error_descriptors,errors:e.errors,objectLabel:e.object.object_label,objectTag:e.object.object_tag,observationObjectId:e.object.observation_object_id,observationObjectType:e.object.observation_object_type,rowId:e.object.id}),nr=e=>({keywordId:e.id,definition:e.description,name:e.name}),rr=e=>({languageId:e.id,name:e.english_name}),D=Q.defineStore("observationMatrix",{state:()=>({observationMatrix:void 0,citation:void 0,descriptors:[],eliminated:[],remaining:[],availableKeywords:[],availableLanguages:[]}),getters:{getCitation:e=>e.citation,getObservationMatrix:e=>e.observationMatrix,getDescriptors:e=>e.descriptors,getDescriptorById:e=>t=>e.descriptors.find(r=>r.descriptorId===t),getDescriptorsUsed:e=>e.descriptors.filter(t=>t.status===W.Used),getDescriptorsUseless:e=>e.descriptors.filter(t=>t.status===W.Useless),getDescriptorsUseful:e=>e.descriptors.filter(t=>t.status===W.Useful),getEliminated:e=>e.eliminated,getKeywords:e=>e.availableKeywords,getLanguages:e=>e.availableLanguages,getRemaining:e=>e.remaining},actions:{setDescriptors(e){this.descriptors=e},setEliminated(e){this.eliminated=e},setRemaining(e){this.remaining=e},setLanguages(e){this.availableLanguages=e},setKeywords(e){this.availableKeywords=e},setObservationMatrix(e){this.observationMatrix=e},async requestInteractiveKey({observationMatrixId:e,params:t={},opt:r={}}){const o=await Wn.key(e,{params:t}),{data:s}=o;return r.refreshOnlyTaxa||(this.setObservationMatrix(tr(s)),this.setDescriptors(s.list_of_descriptors.map(i=>er(i))),this.setKeywords(s.descriptor_available_keywords.map(i=>nr(i))),this.setLanguages(s.descriptor_available_languages.map(i=>rr(i)))),this.setEliminated(s.eliminated.map(i=>ht(i))),this.setRemaining(s.remaining.map(i=>ht(i))),o}}}),B=Q.defineStore("filter",{state:()=>({descriptors:{},eliminateUnknown:void 0,errorTolerance:void 0,identifiedToRank:void 0,keywordIds:[],languageId:void 0,rowIds:[],sorting:void 0}),getters:{getKeywordIds:e=>e.keywordIds,getLanguageId:e=>e.languageId,getRowIds:e=>e.rowIds,getDescriptors:e=>e.descriptors,getIdentifiedToRank:e=>e.identifiedToRank,getEliminateUknown:e=>e.eliminateUnknown,getErrorTolerance:e=>e.errorTolerance,getSorting:e=>e.sorting,getDescriptorValueById:e=>t=>{const r=e.descriptors[t];return typeof r=="boolean"?r:r||""},getFilterParams:e=>({selected_descriptors:Object.entries(e.descriptors).map(([r,o])=>Array.isArray(o)?`${r}:${o.join("|")}`:`${r}:${o}`).join("||"),language_id:e.languageId,keyword_ids:e.keywordIds,sorting:e.sorting,identified_to_rank:e.identifiedToRank,error_tolerance:e.errorTolerance,eliminate_unknown:e.eliminateUnknown,row_filter:e.rowIds.join("|")})},actions:{setDescriptor({descriptorId:e,value:t}){this.descriptors[e]=t},removeDescriptor(e){delete this.descriptors[e]},removeKeywordId(e){const t=this.keywordIds.findIndex(r=>r===e);t>-1&&this.keywordIds.splice(t,1)},addKeywordId(e){this.keywordIds.push(e)},setLanguageId(e){this.languageId=e},setErrorTolerance(e){this.errorTolerance=e},setEliminateUnknown(e){this.eliminateUnknown=e}}}),P=Q.defineStore("settings",{state:()=>({gridLayout:"distinguish-layout-mode-1",isLoading:!1,isRefreshing:!1,refreshOnlyTaxa:!1,rowFilter:!0,shouldUpdate:!0,observationMatrixId:void 0,errorMessage:"",apiConfig:{baseURL:"",projectId:void 0,projectToken:void 0,userToken:void 0}}),getters:{getErrorMessage:e=>e.errorMessage,getIsLoading:e=>e.isLoading,getLayout:e=>e.gridLayout,getRefreshOnlyTaxa:e=>e.refreshOnlyTaxa,getRowFilter:e=>e.rowFilter,getShouldUpdate:e=>e.shouldUpdate,getObservationMatrixId:e=>e.observationMatrixId,getAPIConfig:e=>e.apiConfig},actions:{setObservationMatrixId(e){this.observationMatrixId=e},setShouldUpdate(e){this.shouldUpdate=e},setRefreshOnlyTaxa(e){this.refreshOnlyTaxa=e},setAPIConfig(e){this.apiConfig=e},checkUpdate(){const e=B(),t=D(),r=this.observationMatrixId;this.shouldUpdate&&r&&(this.isLoading=!0,t.requestInteractiveKey({observationMatrixId:r,params:e.getFilterParams,opt:{refreshOnlyTaxa:this.refreshOnlyTaxa}}).then(o=>this.errorMessage="").catch(o=>this.errorMessage=o.message).finally(()=>this.isLoading=!1))}}}),or=n.defineComponent({__name:"FilterEliminateUnknowns",setup(e){const t=B(),r=n.computed({get:()=>!!t.getEliminateUknown,set:o=>{t.setEliminateUnknown(o)}});return(o,s)=>(n.openBlock(),n.createElementBlock("label",null,[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=i=>r.value=i),type:"checkbox"},null,512),[[n.vModelCheckbox,r.value]]),s[1]||(s[1]=n.createTextVNode(" Eliminate unknowns "))]))}}),sr=["value"],ir=n.defineComponent({__name:"FilterErrorTolerance",setup(e){const t=[0,1,2],r=B(),o=n.computed({get:()=>r.getErrorTolerance,set:s=>{r.setErrorTolerance(s)}});return(s,i)=>(n.openBlock(),n.createElementBlock("div",null,[i[2]||(i[2]=n.createElementVNode("label",{for:"languages",class:"distinguish-input-label"}," Error tolerance ",-1)),n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":i[0]||(i[0]=a=>o.value=a),name:"languages",role:"listbox"},[i[1]||(i[1]=n.createElementVNode("option",{value:""},null,-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(t,a=>n.createElementVNode("option",{key:a,value:a},n.toDisplayString(a),9,sr)),64))],512),[[n.vModelSelect,o.value]])]))}}),ar=["otu","subspecies","species","subgenus","genus","subtribe","tribe","subfamily","family"],cr=n.defineComponent({__name:"FilterRank",setup(e){const t=B(),r=n.computed({get(){return t.getIdentifiedToRank},set(o){t.$patch({identifiedToRank:o})}});return(o,s)=>(n.openBlock(),n.createElementBlock("div",null,[s[2]||(s[2]=n.createElementVNode("label",{class:"distinguish-input-label"},"Identified to rank",-1)),n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":s[0]||(s[0]=i=>r.value=i)},[s[1]||(s[1]=n.createElementVNode("option",{value:void 0},null,-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(ar),i=>(n.openBlock(),n.createElementBlock("option",{key:i},n.toDisplayString(i),1))),128))],512),[[n.vModelSelect,r.value]])]))}}),lr=n.defineComponent({__name:"FilterSort",setup(e){const t=["ordered","weighted","optimized"],r=B(),o=n.computed({get(){return r.getSorting},set(s){r.$patch({sorting:s})}});return(s,i)=>(n.openBlock(),n.createElementBlock("div",null,[i[2]||(i[2]=n.createElementVNode("label",{class:"distinguish-input-label"},"Descriptor sorting",-1)),n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":i[0]||(i[0]=a=>o.value=a)},[i[1]||(i[1]=n.createElementVNode("option",{value:void 0},null,-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(t,a=>n.createElementVNode("option",{key:a},n.toDisplayString(a),1)),64))],512),[[n.vModelSelect,o.value]])]))}}),dr=["value"],pr=n.defineComponent({__name:"FilterLanguage",setup(e){const t=B(),r=D(),o=n.computed({get:()=>t.getLanguageId,set:s=>{t.setLanguageId(Number(s))}});return(s,i)=>(n.openBlock(),n.createElementBlock("div",null,[i[1]||(i[1]=n.createElementVNode("label",{for:"languages",class:"distinguish-input-label"}," Languages ",-1)),n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":i[0]||(i[0]=a=>o.value=a),name:"languages",role:"listbox"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(r).getLanguages,({languageId:a,name:c})=>(n.openBlock(),n.createElementBlock("option",{key:a,value:a},n.toDisplayString(c),9,dr))),128))],512),[[n.vModelSelect,o.value]])]))}}),ur=["disabled"],ie=n.defineComponent({__name:"VBtn",props:{color:{default:"primary"},size:{default:"medium"},disabled:{type:Boolean}},setup(e){const t=e,r=n.computed(()=>[`distinguish-btn-${t.color}-color`,`distinguish-btn-${t.size}-size`]);return(o,s)=>(n.openBlock(),n.createElementBlock("button",{type:"button",class:n.normalizeClass(["distinguish-btn",r.value]),disabled:o.disabled},[n.renderSlot(o.$slots,"default")],10,ur))}}),fr={class:"distinguish-modal-wrapper"},mr={class:"distinguish-modal-header"},hr={class:"distinguish-modal-body"},gr={class:"distinguish-modal-footer"},Ne=n.defineComponent({__name:"VModal",props:{containerClass:{},containerStyle:{}},emits:["close"],setup(e,{emit:t}){const r=t,o=s=>{s.preventDefault(),s.key==="Escape"&&r("close")};return n.onMounted(()=>document.addEventListener("keydown",o)),n.onUnmounted(()=>document.removeEventListener("keydown",o)),(s,i)=>(n.openBlock(),n.createBlock(n.Transition,{name:"distinguish-modal"},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"distinguish-modal-mask",onClick:i[2]||(i[2]=a=>r("close")),onKey:i[3]||(i[3]=a=>r("close"))},[n.createElementVNode("div",fr,[n.createElementVNode("div",{class:n.normalizeClass(["distinguish-modal-container",s.containerClass]),style:n.normalizeStyle({...s.containerStyle}),onClick:i[1]||(i[1]=n.withModifiers(()=>{},["stop"]))},[n.createElementVNode("div",mr,[n.createElementVNode("div",{class:"distinguish-modal-close",onClick:i[0]||(i[0]=a=>r("close"))}),n.renderSlot(s.$slots,"header")]),n.createElementVNode("div",hr,[n.renderSlot(s.$slots,"body")]),n.createElementVNode("div",gr,[n.renderSlot(s.$slots,"footer")])],6)])],32)]),_:3}))}}),yr={class:"distinguish-list-checkboxes"},br=["value"],_r=n.defineComponent({__name:"FilterKeywords",setup(e){const t=D(),r=B(),o=n.ref(!1),s=n.computed({get:()=>r.getKeywordIds,set:i=>{r.$patch({keywordIds:i})}});return(i,a)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(ie,{color:"primary",size:"medium",disabled:!n.unref(t).getKeywords.length,title:n.unref(t).getKeywords.length?"":"No tags defined.",onClick:a[0]||(a[0]=c=>o.value=!0)},{default:n.withCtx(()=>a[3]||(a[3]=[n.createTextVNode(" Keyword ")])),_:1},8,["disabled","title"]),o.value?(n.openBlock(),n.createBlock(Ne,{key:0,onClose:a[2]||(a[2]=c=>o.value=!1)},{header:n.withCtx(()=>a[4]||(a[4]=[n.createElementVNode("h3",null,"Keywords",-1)])),body:n.withCtx(()=>[n.createElementVNode("ul",yr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(t).getKeywords,({keywordId:c,name:u})=>(n.openBlock(),n.createElementBlock("li",{key:c},[n.createElementVNode("label",null,[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":a[1]||(a[1]=d=>s.value=d),value:c,type:"checkbox"},null,8,br),[[n.vModelCheckbox,s.value]]),n.createTextVNode(" "+n.toDisplayString(u),1)])]))),128))])]),_:1})):n.createCommentVNode("",!0)],64))}}),Er=n.defineComponent({__name:"SettingRefresh",setup(e){const t=P(),r=n.computed({get:()=>t.getRefreshOnlyTaxa,set:o=>{t.setRefreshOnlyTaxa(o)}});return(o,s)=>(n.openBlock(),n.createElementBlock("label",null,[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=i=>r.value=i),type:"checkbox"},null,512),[[n.vModelCheckbox,r.value]]),s[1]||(s[1]=n.createTextVNode(" Refresh only taxa "))]))}}),ae=(e,t)=>{const r=e.__vccOpts||e;for(const[o,s]of t)r[o]=s;return r},kr={},wr={class:"distinguish-menu-list"};function Sr(e,t){return n.openBlock(),n.createElementBlock("ul",wr,[n.renderSlot(e.$slots,"default")])}const Br=ae(kr,[["render",Sr]]),Cr={},Nr={class:"distinguish-list-item"};function Rr(e,t){return n.openBlock(),n.createElementBlock("li",Nr,[n.renderSlot(e.$slots,"default")])}const F=ae(Cr,[["render",Rr]]),gt={"distinguish-layout-mode-1":"distinguish-layout-mode-2","distinguish-layout-mode-2":"distinguish-layout-mode-1"},Tr={},xr={class:"distinguish-grid"};function Or(e,t){return n.openBlock(),n.createElementBlock("div",xr,[n.renderSlot(e.$slots,"default")])}const yt=ae(Tr,[["render",Or]]),Dr=n.defineComponent({__name:"GridToggle",setup(e){const t=P(),r=n.computed(()=>t.getLayout),o=()=>{t.$patch({gridLayout:gt[r.value]})};return(s,i)=>(n.openBlock(),n.createBlock(ie,{class:n.normalizeClass(n.unref(gt)[r.value]),onClick:o},{default:n.withCtx(()=>[n.createVNode(yt,{class:"distinguish-grid-icon"},{default:n.withCtx(()=>i[0]||(i[0]=[n.createElementVNode("div",{class:"distinguish-panel-descriptors"},null,-1),n.createElementVNode("div",{class:"distinguish-panel-remaining"},null,-1),n.createElementVNode("div",{class:"distinguish-panel-eliminated"},null,-1)])),_:1})]),_:1},8,["class"]))}}),Vr=n.defineComponent({__name:"ResetButton",setup(e){const t=B();return(r,o)=>(n.openBlock(),n.createBlock(ie,{color:"primary",size:"medium",onClick:o[0]||(o[0]=s=>n.unref(t).$reset())},{default:n.withCtx(()=>o[1]||(o[1]=[n.createTextVNode(" Reset ")])),_:1}))}}),Ar={class:"distinguish-header-error-message"},Ir=n.defineComponent({__name:"ErrorMessage",setup(e){const t=P();return(r,o)=>(n.openBlock(),n.createElementBlock("span",Ar,n.toDisplayString(n.unref(t).getErrorMessage),1))}}),Lr={class:"distinguish-header-bar"},Ur={class:"distinguish-header-bar__buttons"},$r=n.defineComponent({__name:"HeaderBar",setup(e){return(t,r)=>(n.openBlock(),n.createElementBlock("div",Lr,[n.createVNode(Ir),n.createVNode(Br,null,{default:n.withCtx(()=>[n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(Er)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(or)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(ir)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(cr)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(pr)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(lr)]),_:1}),n.createVNode(F,null,{default:n.withCtx(()=>[n.createVNode(_r)]),_:1})]),_:1}),n.createElementVNode("div",Ur,[n.createVNode(Vr),n.createVNode(Dr)])]))}}),Pr={},Fr={class:"distinguish-panel"};function Mr(e,t){return n.openBlock(),n.createElementBlock("div",Fr,[n.renderSlot(e.$slots,"default")])}const Re=ae(Pr,[["render",Mr]]),jr=["innerHTML"],qr=n.defineComponent({__name:"PanelEliminated",props:{render:{type:Function}},setup(e){const t=D(),r=n.computed(()=>t.getEliminated);return(o,s)=>(n.openBlock(),n.createBlock(Re,{class:"distinguish-panel-eliminated"},{default:n.withCtx(()=>[n.createElementVNode("h2",null,"Eliminated ("+n.toDisplayString(r.value.length)+")",1),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,i=>(n.openBlock(),n.createElementBlock("li",{key:i.rowId,class:"distinguish-row-item"},[n.renderSlot(o.$slots,"default",{item:i},()=>[n.createElementVNode("span",{innerHTML:o.render?o.render(i):i.objectTag},null,8,jr)])]))),128))])]),_:3}))}}),Hr={class:"distinguish-list-checkboxes"},zr=["value"],Kr=n.defineComponent({__name:"FilterRow",setup(e){const t=D(),r=P(),o=B(),s=n.ref(!1),i=n.ref([]),a=n.computed(()=>{const u=o.getRowIds,d=i.value;return u.length!==d.length||!u.every(p=>d.includes(p))}),c=n.computed({get:()=>o.getRowIds,set:u=>{o.$patch({rowIds:u})}});return n.watch(s,u=>{r.setShouldUpdate(!u),!u&&a.value&&r.checkUpdate(),i.value=o.getRowIds}),(u,d)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(ie,{color:"primary",size:"medium",onClick:d[0]||(d[0]=p=>s.value=!0)},{default:n.withCtx(()=>d[3]||(d[3]=[n.createTextVNode(" Select ")])),_:1}),s.value?(n.openBlock(),n.createBlock(Ne,{key:0,onClose:d[2]||(d[2]=p=>s.value=!1)},{header:n.withCtx(()=>d[4]||(d[4]=[n.createElementVNode("h3",null,"Filter row",-1)])),body:n.withCtx(()=>[n.createElementVNode("div",null,[n.createElementVNode("ul",Hr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(t).getRemaining,p=>(n.openBlock(),n.createElementBlock("li",{key:p.rowId},[n.createElementVNode("label",null,[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":d[1]||(d[1]=f=>c.value=f),value:p.rowId,type:"checkbox"},null,8,zr),[[n.vModelCheckbox,c.value]]),n.createTextVNode(" "+n.toDisplayString(p.objectLabel),1)])]))),128))])])]),_:1})):n.createCommentVNode("",!0)],64))}}),Jr={class:"distinguish-title-section"},Wr=["innerHTML"],Gr=n.defineComponent({__name:"PanelRemaining",props:{render:{type:Function}},setup(e){const t=D(),r=n.computed(()=>t.getRemaining);return(o,s)=>(n.openBlock(),n.createBlock(Re,{class:"distinguish-panel-remaining"},{default:n.withCtx(()=>[n.createElementVNode("div",Jr,[n.createElementVNode("h2",null,"Remaining ("+n.toDisplayString(r.value.length)+")",1),n.createVNode(Kr)]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,i=>(n.openBlock(),n.createElementBlock("li",{key:i.rowId,class:"distinguish-row-item"},[n.renderSlot(o.$slots,"default",{item:i},()=>[n.createElementVNode("span",{innerHTML:o.render?o.render(i):i.objectTag},null,8,Wr)])]))),128))])]),_:3}))}});class Xr{static find(t){return ft().get(`/depictions/${t}.json`,{params:{extend:["image"]}})}}const Qr={key:0,class:"distinguish-depiction-box"},Yr=["src"],bt=n.defineComponent({__name:"VDepiction",props:{depictionId:{}},setup(e){const t=e,r=n.ref();return Xr.find(t.depictionId).then(({data:o})=>{r.value=Xn(o)}),(o,s)=>r.value?(n.openBlock(),n.createElementBlock("div",Qr,[n.createElementVNode("img",{src:r.value.imageUrl},null,8,Yr)])):n.createCommentVNode("",!0)}}),Zr={class:"distinguish-character-descriptor__cell"},vr=["value"],eo=n.defineComponent({__name:"CharacterStateCell",props:{characterState:{},descriptorId:{}},setup(e){const t=e,r=B(),o=n.computed({get:()=>r.getDescriptorValueById(t.descriptorId)||[],set:s=>{s.length?r.setDescriptor({descriptorId:t.descriptorId,value:s}):r.removeDescriptor(t.descriptorId)}});return(s,i)=>(n.openBlock(),n.createElementBlock("div",Zr,[n.createElementVNode("label",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.characterState.depictionIds,a=>(n.openBlock(),n.createBlock(bt,{key:a,"depiction-id":a},null,8,["depiction-id"]))),128)),n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=a=>o.value=a),value:s.characterState.characterStateId,type:"checkbox"},null,8,vr),[[n.vModelCheckbox,o.value]]),n.createTextVNode(" "+n.toDisplayString(s.characterState.name),1)])]))}}),to={class:"distinguish-character-states-grid"},no=n.defineComponent({__name:"CharacterStateGrid",props:{descriptor:{}},setup(e){const t=e,r=B(),o=P(),s=n.ref(),i=n.computed(()=>{const a=r.getDescriptorValueById(t.descriptor.descriptorId)||[],c=s.value||[];return a.length!==c.length||!a.every(u=>c.includes(u))});return n.onMounted(()=>{o.setShouldUpdate(!1),s.value=r.getDescriptorValueById(t.descriptor.descriptorId)}),n.onUnmounted(()=>{o.setShouldUpdate(!0),i.value&&o.checkUpdate()}),(a,c)=>(n.openBlock(),n.createElementBlock("div",to,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.descriptor.characterStates,u=>(n.openBlock(),n.createBlock(eo,{key:u.characterStateId,"descriptor-id":a.descriptor.descriptorId,"character-state":u},null,8,["descriptor-id","character-state"]))),128))]))}}),ro={key:0},oo={key:1},so={class:"descriptor-modal__depiction"},io=n.defineComponent({__name:"DescriptorModal",props:{descriptor:{}},setup(e){return(t,r)=>(n.openBlock(),n.createBlock(Ne,{"container-class":"distinguish-descriptor-modal"},{header:n.withCtx(()=>[n.createElementVNode("h3",null,n.toDisplayString(t.descriptor.name),1),t.descriptor.description?(n.openBlock(),n.createElementBlock("span",ro,n.toDisplayString(t.descriptor.description),1)):(n.openBlock(),n.createElementBlock("i",oo," No further description available. "))]),body:n.withCtx(()=>[n.createElementVNode("div",so,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.descriptor.depictionIds,o=>(n.openBlock(),n.createBlock(bt,{key:o,"depiction-id":o},null,8,["depiction-id"]))),128))]),r[0]||(r[0]=n.createElementVNode("hr",null,null,-1)),t.descriptor.type===n.unref(G).Qualitative?(n.openBlock(),n.createBlock(no,{key:0,descriptor:t.descriptor},null,8,["descriptor"])):n.createCommentVNode("",!0)]),_:1}))}}),ao=["id"],co={class:"distinguish-input-label"},ce=n.defineComponent({__name:"DescriptorContainer",props:{descriptor:{}},setup(e){const t=n.ref(!1);return(r,o)=>(n.openBlock(),n.createElementBlock("div",{id:`descriptor-${r.descriptor.descriptorId}`,class:"distinguish-descriptor-container"},[n.createElementVNode("div",co,[n.createElementVNode("span",{class:"distinguish-link",onClick:o[0]||(o[0]=s=>t.value=!0)},[n.renderSlot(r.$slots,"title",{},()=>[n.createTextVNode(n.toDisplayString(r.descriptor.name),1)])])]),n.renderSlot(r.$slots,"default"),t.value?(n.openBlock(),n.createBlock(io,{key:0,descriptor:r.descriptor,onClose:o[1]||(o[1]=s=>t.value=!1)},null,8,["descriptor"])):n.createCommentVNode("",!0)],8,ao))}}),lo=n.defineComponent({__name:"DescriptorContinuous",props:{descriptor:{}},setup(e){const t=e,r=B(),o=n.ref(String(r.getDescriptorValueById(t.descriptor.descriptorId))),s=()=>{const{descriptorId:i}=t.descriptor,a=o.value.trim();a?r.setDescriptor({descriptorId:i,value:a}):r.removeDescriptor(i)};return(i,a)=>(n.openBlock(),n.createBlock(ce,{class:"distinguish-descriptor-continuous",descriptor:i.descriptor},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(i.descriptor.name)+" ("+n.toDisplayString(i.descriptor.min)+"-"+n.toDisplayString(i.descriptor.max)+" "+n.toDisplayString(i.descriptor.defaultUnit)+") ",1)]),default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=c=>o.value=c),type:"text",onBlur:s,onKeyup:n.withKeys(s,["enter"])},null,544),[[n.vModelText,o.value]])]),_:1},8,["descriptor"]))}}),po=["value"],uo={key:0},fo=n.defineComponent({__name:"DescriptorPresenceAbsence",props:{descriptor:{}},setup(e){const t={Presence:!0,Absent:!1},r=e,o=B(),s=n.computed({get:()=>o.getDescriptorValueById(r.descriptor.descriptorId),set:a=>{const{descriptorId:c}=r.descriptor;typeof a=="boolean"?o.setDescriptor({descriptorId:c,value:!!a}):o.removeDescriptor(c)}}),i=a=>{var u;const{states:c}=r.descriptor;return((u=c.find(d=>d.name===String(a)))==null?void 0:u.numberOfObjects)||0};return(a,c)=>(n.openBlock(),n.createBlock(ce,{class:"distinguish-descriptor-presence-absence",descriptor:a.descriptor},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("select",{"onUpdate:modelValue":c[0]||(c[0]=u=>s.value=u)},[c[1]||(c[1]=n.createElementVNode("option",null,null,-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(t,(u,d)=>n.createElementVNode("option",{key:d,value:u},[a.descriptor.status===n.unref(W).Useless?(n.openBlock(),n.createElementBlock("span",uo,"-")):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(d)+" ("+n.toDisplayString(i(u))+") ",1)],8,po)),64))],512),[[n.vModelSelect,s.value]])]),_:1},8,["descriptor"]))}}),mo=["value","selected"],ho={key:0},go={key:1},yo=n.defineComponent({__name:"DescriptorQualitative",props:{descriptor:{}},setup(e){const t=e,r=B(),o=i=>{const a=i.target,{descriptorId:c}=t.descriptor;a.value?r.setDescriptor({descriptorId:c,value:[Number(a.value)]}):r.removeDescriptor(c)},s=i=>r.getDescriptorValueById(t.descriptor.descriptorId).includes(i.characterStateId);return(i,a)=>(n.openBlock(),n.createBlock(ce,{class:"distinguish-descriptor-qualitative",descriptor:i.descriptor},{default:n.withCtx(()=>[n.createElementVNode("select",{name:"listbox",onChange:o},[a[0]||(a[0]=n.createElementVNode("option",{value:""},null,-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.descriptor.characterStates,c=>(n.openBlock(),n.createElementBlock("option",{key:c.characterStateId,value:c.characterStateId,selected:s(c)},[s(c)?(n.openBlock(),n.createElementBlock("span",ho,">")):n.createCommentVNode("",!0),c.status===n.unref(W).Useless?(n.openBlock(),n.createElementBlock("span",go,"-")):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(c.name)+" ("+n.toDisplayString(c.numberOfObjects)+") ",1)],8,mo))),128))],32)]),_:1},8,["descriptor"]))}}),bo=n.defineComponent({__name:"DescriptorSample",props:{descriptor:{}},setup(e){const t=e,r=B(),o=n.ref(String(r.getDescriptorValueById(t.descriptor.descriptorId))),s=()=>{const{descriptorId:i}=t.descriptor,a=o.value.trim();a?r.setDescriptor({descriptorId:i,value:a}):r.removeDescriptor(i)};return(i,a)=>(n.openBlock(),n.createBlock(ce,{class:"distinguish-descriptor-sample",descriptor:i.descriptor},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(i.descriptor.name)+" ("+n.toDisplayString(i.descriptor.min)+"-"+n.toDisplayString(i.descriptor.max)+" "+n.toDisplayString(i.descriptor.defaultUnit)+") ",1)]),default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=c=>o.value=c),type:"text",onBlur:s,onKeyup:n.withKeys(s,["enter"])},null,544),[[n.vModelText,o.value]])]),_:1},8,["descriptor"]))}}),Te=n.defineComponent({__name:"DescriptorsList",props:{title:{},descriptors:{}},setup(e){const t={DescriptorContinuous:lo,DescriptorPresenceAbsence:fo,DescriptorQualitative:yo,DescriptorSample:bo},r=o=>{const s=o.replace("::","");return t[s]};return(o,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("h2",null,n.toDisplayString(o.title),1),n.createElementVNode("ol",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.descriptors,i=>(n.openBlock(),n.createElementBlock("li",{key:i.descriptorId},[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(r(i.type)),{descriptor:i},null,8,["descriptor"]))]))),128))])],64))}}),_o=n.defineComponent({__name:"PanelDescriptors",setup(e){const t=D();return(r,o)=>(n.openBlock(),n.createBlock(Re,{class:"distinguish-panel-descriptors"},{default:n.withCtx(()=>[n.unref(t).getDescriptorsUsed.length?(n.openBlock(),n.createBlock(Te,{key:0,descriptors:n.unref(t).getDescriptorsUsed,title:"Used Descriptors"},null,8,["descriptors"])):n.createCommentVNode("",!0),n.unref(t).getDescriptorsUseful.length?(n.openBlock(),n.createBlock(Te,{key:1,descriptors:n.unref(t).getDescriptorsUseful,title:"Descriptors Useful for Identification"},null,8,["descriptors"])):n.createCommentVNode("",!0),n.unref(t).getDescriptorsUseless.length?(n.openBlock(),n.createBlock(Te,{key:2,descriptors:n.unref(t).getDescriptorsUseless,title:"Descriptors no longer relevant for identification"},null,8,["descriptors"])):n.createCommentVNode("",!0)]),_:1}))}}),Eo={class:"distinguish-spinner-container"},ko={class:"distinguish-spinner-legend"},wo=["innerHTML"],So=n.defineComponent({__name:"VSpinner",props:{legend:{type:String,default:"Loading, please wait."}},setup(e){return(t,r)=>(n.openBlock(),n.createBlock(n.Transition,{name:"fade"},{default:n.withCtx(()=>[n.createElementVNode("div",Eo,[n.createElementVNode("div",null,[r[0]||(r[0]=n.createElementVNode("div",{class:"distinguish-spinner"},null,-1)),n.createElementVNode("div",ko,[n.createElementVNode("span",{innerHTML:e.legend},null,8,wo),n.renderSlot(t.$slots,"default")])])])]),_:3}))}}),Bo={class:"distinguish-title"},Co={key:0},No=n.defineComponent({__name:"TitleMatrix",setup(e){const t=D();return(r,o)=>(n.openBlock(),n.createElementBlock("h1",Bo,[o[0]||(o[0]=n.createTextVNode(" Interactive key ")),n.unref(t).getObservationMatrix?(n.openBlock(),n.createElementBlock("span",Co,"| "+n.toDisplayString(n.unref(t).getObservationMatrix.name),1)):n.createCommentVNode("",!0)]))}}),Ro=["title"],To=n.defineComponent({__name:"TitleMatrixCitation",setup(e){const t=D(),r=n.computed(()=>{const o=t.getCitation;return Object.values(o||{}).filter(Boolean).join(", ")});return(o,s)=>(n.openBlock(),n.createElementBlock("span",{class:"distinguish-title-citation",title:r.value},n.toDisplayString(r.value),9,Ro))}}),xo={class:"distinguish-title-section"},Oo=n.defineComponent({__name:"TitleKey",setup(e){return(t,r)=>(n.openBlock(),n.createElementBlock("div",xo,[n.createVNode(No),n.createVNode(To)]))}}),Do={class:"distinguish-app-container"},_t=n.defineComponent({name:"Distinguish",__name:"App",props:{observationMatrixId:{},apiConfig:{},renderItem:{type:Function}},setup(e){const t=e,r=P(),o=B(),s=n.computed(()=>r.getIsLoading),i=n.computed(()=>r.getLayout);return(()=>{r.setAPIConfig(t.apiConfig),r.setObservationMatrixId(t.observationMatrixId),r.checkUpdate()})(),o.$subscribe(c=>{r.shouldUpdate&&r.checkUpdate()}),(c,u)=>(n.openBlock(),n.createElementBlock("div",Do,[n.createVNode(Oo),n.createVNode($r),n.createVNode(yt,{class:n.normalizeClass(i.value)},{default:n.withCtx(()=>[n.createVNode(_o),n.createVNode(Gr,{render:t.renderItem},{default:n.withCtx(d=>[n.renderSlot(c.$slots,"remaining-item",n.normalizeProps(n.guardReactiveProps(d)))]),_:3},8,["render"]),n.createVNode(qr,{render:t.renderItem},{default:n.withCtx(d=>[n.renderSlot(c.$slots,"eliminated-item",n.normalizeProps(n.guardReactiveProps(d)))]),_:3},8,["render"])]),_:3},8,["class"]),s.value?(n.openBlock(),n.createBlock(So,{key:0,legend:"Loading interactive key..."})):n.createCommentVNode("",!0)]))}});function Et(e){const t=e||'[data-interactive-key="true"]';return[...document.querySelectorAll(t)].map(s=>kt(s,Ao(s)))}function Vo(){Et()}function Ao(e){return{observationMatrixId:Number(e.getAttribute("data-observation-matrix-id")),apiConfig:{baseURL:e.getAttribute("data-base-url")||"",projectToken:e.getAttribute("data-project-token")||void 0,projectId:Number(e.getAttribute("data-project-id"))||void 0,userToken:e.getAttribute("data-user-token")||void 0,csrfToken:e.getAttribute("data-csrf-token")||void 0}}}function kt(e,t){const{apiConfig:r,observationMatrixId:o}=t;if(!o)throw"Missing observation matrix ID";if(!r||!r.projectToken&&!r.csrfToken&&!(r.projectId&&r.userToken))throw"Missing API configuration";const s=n.createApp(_t,{observationMatrixId:o,apiConfig:r});return s.use(Q.createPinia()),s.mount(e),s}typeof window<"u"&&window.addEventListener("DOMContentLoaded",Vo),O.VueInteractiveKey=_t,O.createInteractiveKey=kt,O.discoverInteractiveKey=Et,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -2,12 +2,18 @@
2
2
  "name": "@sfgrp/distinguish",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.3.0",
5
+ "version": "0.3.2",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
- "main": "./dist/distinguish.umd.js",
9
+ "main": "./dist/distinguish.umd.cjs",
10
10
  "module": "./dist/distinguish.es.js",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/distinguish.es.js",
14
+ "require": "./dist/distinguish.umd.cjs"
15
+ }
16
+ },
11
17
  "publishConfig": {
12
18
  "access": "public"
13
19
  },