nwl-components 1.6.0 → 1.6.1
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.
package/README.md
CHANGED
|
@@ -132,7 +132,8 @@ render();
|
|
|
132
132
|
```
|
|
133
133
|
|
|
134
134
|
- `sortRows(rows, { key, type }, ascending = true)`: a new, sorted array (stable; missing
|
|
135
|
-
values last in both directions;
|
|
135
|
+
values last in both directions; strings in natural order, `localeCompare` with
|
|
136
|
+
`numeric: true`, so "E90" comes before "E120"; since 1.6.1). `sortValue(row, column)`
|
|
136
137
|
is the value it compares.
|
|
137
138
|
- `sortableHeader(th, { direction, onSort })` turns a `<th>` into SortableTh's markup
|
|
138
139
|
(`class="nwl-sortable"`, `aria-sort`, a `<button type="button">` with the th's content
|
|
@@ -359,7 +359,7 @@ const Qs = { class: "content" }, Zs = {
|
|
|
359
359
|
const i = n ? 1 : -1, s = e.type || "string";
|
|
360
360
|
return o.map((r) => ({ row: r, value: Ws(r, e) })).sort((r, c) => {
|
|
361
361
|
const [g, l] = [r.value === null, c.value === null];
|
|
362
|
-
return g || l ? g - l : s === "string" ? i * r.value.localeCompare(c.value) : i * (r.value - c.value);
|
|
362
|
+
return g || l ? g - l : s === "string" ? i * r.value.localeCompare(c.value, [], { numeric: !0 }) : i * (r.value - c.value);
|
|
363
363
|
}).map(({ row: r }) => r);
|
|
364
364
|
}, Bs = ({ column: t, ascending: e }, n) => t === n ? { column: t, ascending: !e } : { column: n, ascending: !0 }, Be = (t) => t === "ascending" || t === "descending" ? t : "none", ui = {
|
|
365
365
|
ascending: ["M12 5l0 14", "M18 11l-6 -6", "M6 11l6 -6"],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(D,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(D=typeof globalThis!="undefined"?globalThis:D||self,t(D["nwl-components"]={},D.Vue))})(this,function(D,t){"use strict";var bM=Object.defineProperty,kM=Object.defineProperties;var YM=Object.getOwnPropertyDescriptors;var Ue=Object.getOwnPropertySymbols;var Ai=Object.prototype.hasOwnProperty,Li=Object.prototype.propertyIsEnumerable;var xn=(D,t,R)=>t in D?bM(D,t,{enumerable:!0,configurable:!0,writable:!0,value:R}):D[t]=R,G=(D,t)=>{for(var R in t||(t={}))Ai.call(t,R)&&xn(D,R,t[R]);if(Ue)for(var R of Ue(t))Li.call(t,R)&&xn(D,R,t[R]);return D},_t=(D,t)=>kM(D,YM(t));var hi=(D,t)=>{var R={};for(var st in D)Ai.call(D,st)&&t.indexOf(st)<0&&(R[st]=D[st]);if(D!=null&&Ue)for(var st of Ue(D))t.indexOf(st)<0&&Li.call(D,st)&&(R[st]=D[st]);return R};var At=(D,t,R)=>(xn(D,typeof t!="symbol"?t+"":t,R),R);var ct=(D,t,R)=>new Promise((st,x)=>{var On=Nt=>{try{ge(R.next(Nt))}catch(Xt){x(Xt)}},pt=Nt=>{try{ge(R.throw(Nt))}catch(Xt){x(Xt)}},ge=Nt=>Nt.done?st(Nt.value):Promise.resolve(Nt.value).then(On,pt);ge((R=R.apply(D,t)).next())});let R=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((n,o)=>(o&=63,o<36?n+=o.toString(36):o<62?n+=(o-26).toString(36).toUpperCase():o>62?n+="-":n+="_",n),"");const st="",x=(e,n)=>{const o=e.__vccOpts||e;for(const[i,s]of n)o[i]=s;return o},pt=x({__name:"TextInput",props:t.mergeModels({placeholder:{type:String,default:""},disabled:Boolean},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:t.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:n}){const o=e,i=t.useModel(e,"modelValue"),s=n,a=l=>{s("update:modelValue",l.target.value)};return(l,u)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",t.mergeProps({type:"text"},o,{onInput:a,"onUpdate:modelValue":u[0]||(u[0]=m=>i.value=m)}),null,16)),[[t.vModelText,i.value]])}},[["__scopeId","data-v-4d629f4f"]]),ge="",Nt=["aria-owns","aria-expanded"],Xt=["id"],Ci={key:0,class:"loading"},Ei=["onClick","id","aria-selected"],wn=x({__name:"Autocomplete",props:{items:{type:Array,default:()=>[]},isAsync:{type:Boolean,required:!1,default:!1},ariaLabel:{type:String,required:!0},defaultValue:{type:String,required:!1,default:""},disabled:{type:Boolean,required:!1,default:!1},extraSelectArgs:{type:Array,default:()=>[]},extractResultText:{type:Function,default:e=>e}},emits:["input","select"],setup(e,{emit:n}){const o=e,i=t.reactive({isOpen:!1,results:[],search:o.defaultValue,isLoading:!1,arrowCounter:0,activedescendant:""}),s=t.ref(null);t.watch(o.items,()=>{i.results=o.items,i.isLoading=!1});const a=n,l=()=>{i.results=i.items.filter(T=>T.toLowerCase().indexOf(i.search.toLowerCase())>-1)},u=()=>{a("input",i.search),i.isOpen=!0,o.isAsync?i.isLoading=!0:l()},m=T=>`result-item-${T}`,c=()=>{i.activedescendant=m(i.arrowCounter)},M=T=>T===i.arrowCounter,d=T=>(i.search=o.extractResultText(T),i.isOpen=!1,a("select",T,...o.extraSelectArgs),!1),g=()=>{i.isOpen&&(i.arrowCounter=(i.arrowCounter+1)%i.results.length,c())},I=()=>{i.isOpen&&(i.arrowCounter=i.arrowCounter>0?i.arrowCounter-1:i.results.length-1,c())},z=()=>{d(i.results[i.arrowCounter])},L=T=>{s.value.contains(T.target)||(i.isOpen=!1,i.arrowCounter=-1)},f=R();return t.onMounted(()=>{document.addEventListener("click",L)}),t.onUnmounted(()=>{document.removeEventListener("click",L)}),(T,S)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:s,class:"autocomplete",role:"combobox","aria-haspopup":"listbox","aria-owns":`${t.unref(f)}-autocomplete-results`,"aria-expanded":i.isOpen},[t.createVNode(pt,{onInput:u,modelValue:i.search,"onUpdate:modelValue":S[0]||(S[0]=A=>i.search=A),onKeydown:[t.withKeys(g,["down"]),t.withKeys(I,["up"]),t.withKeys(z,["enter"])],role:"searchbox","aria-autocomplete":"list","aria-controls":`${t.unref(f)}-autocomplete-results`,"aria-label":e.ariaLabel,"aria-activedescendant":i.activedescendant,disabled:o.disabled},null,8,["modelValue","aria-controls","aria-label","aria-activedescendant","disabled"]),t.withDirectives(t.createElementVNode("ul",{id:`${t.unref(f)}-autocomplete-results`,class:"autocomplete-results",role:"listbox"},[i.isLoading?(t.openBlock(),t.createElementBlock("li",Ci," Loading results... ")):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(i.results,(A,C)=>(t.openBlock(),t.createElementBlock("li",{key:C,onClick:Z=>d(A),class:t.normalizeClass(["autocomplete-result",{"is-active":M(C)}]),role:"option",id:m(C),"aria-selected":M(C)},t.toDisplayString(o.extractResultText(A)),11,Ei))),128))],8,Xt),[[t.vShow,i.isOpen]])],8,Nt))}},[["__scopeId","data-v-5d982740"]]),VM="",Si=["title","disabled"],v=x({__name:"Button",props:{className:{type:String,default:null},title:{type:String,default:null},disabled:Boolean,small:Boolean},setup(e){const n=e,o={small:n.small===!0};return n.className!==null&&(o[n.className]=!0),(i,s)=>(t.openBlock(),t.createElementBlock("button",{title:e.title,disabled:e.disabled,class:t.normalizeClass(o),tabindex:"-1"},[t.renderSlot(i.$slots,"default",{},void 0,!0)],8,Si))}},[["__scopeId","data-v-a070c49a"]]),PM="",xi=["value"],Ve=x({__name:"Select",props:{disabled:Boolean,modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,s=a=>{i("update:modelValue",a.target.value)};return(a,l)=>(t.openBlock(),t.createElementBlock("select",t.mergeProps(o,{value:e.modelValue,onInput:s}),[t.renderSlot(a.$slots,"default",{},void 0,!0)],16,xi))}},[["__scopeId","data-v-8ecfa0f7"]]),QM="",_n=x({__name:"TextArea",props:t.mergeModels({placeholder:{type:String,default:""},disabled:Boolean},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:t.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:n}){const o=e,i=t.useModel(e,"modelValue"),s=n,a=l=>{s("update:modelValue",l.target.value)};return(l,u)=>t.withDirectives((t.openBlock(),t.createElementBlock("textarea",t.mergeProps(o,{onInput:a,"onUpdate:modelValue":u[0]||(u[0]=m=>i.value=m)}),null,16)),[[t.vModelText,i.value]])}},[["__scopeId","data-v-7cd36e47"]]),GM="",Oi=["id"],bt=x({__name:"Table",props:{id:{type:String,default:null}},setup(e){const n=e;return(o,i)=>(t.openBlock(),t.createElementBlock("table",{id:n.id},[t.renderSlot(o.$slots,"default",{},void 0,!0)],8,Oi))}},[["__scopeId","data-v-233fc9dd"]]),$M="",wi=["aria-checked"],bn=x({__name:"Checkbox",props:{modelValue:Boolean},emits:["update:modelValue","change"],setup(e,{emit:n}){const o=n,i=e,s=t.ref(i.modelValue);typeof i.modelValue=="string"&&(s.value=i.modelValue==="true");const a=l=>{typeof l!="undefined"&&l!==" "||(s.value=!s.value,o("change",s.value),o("update:modelValue",s.value))};return(l,u)=>(t.openBlock(),t.createElementBlock("span",{role:"checkbox","aria-checked":s.value,onClick:u[0]||(u[0]=m=>a()),onKeydown:u[1]||(u[1]=m=>a(m.key)),tabindex:"0","aria-label":"label"},null,40,wi))}},[["__scopeId","data-v-59778f34"]]),FM="",_i={class:"tabs"},bi=["onClick"],ki=x({__name:"Tabs",setup(e){const n=t.ref(0),i=t.getCurrentInstance().vnode.children.default(),s={render:()=>i[n.value]},a=l=>{n.value=l};return(l,u)=>(t.openBlock(),t.createElementBlock("div",_i,[t.createElementVNode("ul",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i),(m,c)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[m&&m.props?(t.openBlock(),t.createElementBlock("li",{key:m.props.title,onClick:M=>a(c),class:t.normalizeClass({selected:c==n.value})},t.toDisplayString(m.props.title),11,bi)):t.createCommentVNode("",!0)],64))),256))]),t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(s,{key:n.value}))]))}},[["__scopeId","data-v-9e8a7527"]]),XM="",Yi={class:"content"},Ui=x({__name:"Tab",props:{title:{type:String,required:!0}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",Yi,[t.renderSlot(n.$slots,"default",{},void 0,!0)]))}},[["__scopeId","data-v-41512210"]]),Vi=e=>e===null||typeof e=="undefined"||e===""||Number.isNaN(e),kn=(e,{key:n,type:o="string"})=>{const i=typeof n=="function"?n(e):e==null?void 0:e[n];if(Vi(i))return null;switch(o){case"number":{const s=Number(i);return Number.isNaN(s)?null:s}case"date":{const s=(i instanceof Date?i:new Date(i)).getTime();return Number.isNaN(s)?null:s}default:return String(i)}},Yn=(e,n,o=!0)=>{const i=e||[];if(!n)return[...i];const s=o?1:-1,a=n.type||"string";return i.map(l=>({row:l,value:kn(l,n)})).sort((l,u)=>{const[m,c]=[l.value===null,u.value===null];return m||c?m-c:a==="string"?s*l.value.localeCompare(u.value):s*(l.value-u.value)}).map(({row:l})=>l)},Un=({column:e,ascending:n},o)=>e===o?{column:e,ascending:!n}:{column:o,ascending:!0},Kt=e=>e==="ascending"||e==="descending"?e:"none",Re={ascending:["M12 5l0 14","M18 11l-6 -6","M6 11l6 -6"],descending:["M12 5l0 14","M18 13l-6 6","M6 13l6 6"],none:["M3 9l4 -4l4 4m-4 -4v14","M21 15l-4 4l-4 -4m4 4v-14"]},Pe={class:"nwl-sort-indicator",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"},Be=e=>{const n=Kt(e),o=Object.entries(_t(G({},Pe),{"data-state":n})).map(([s,a])=>`${s}="${a}"`).join(" "),i=Re[n].map(s=>`<path d="${s}"></path>`).join("");return`<svg ${o}>${i}</svg>`},Ri=(e,n)=>{const o=e.ownerDocument,i=o.createElement("span");i.className="nwl-sort-label",i.append(...e.childNodes);const s=o.createElement("button");return s.type="button",s.className="nwl-sort-button",s.append(i),s.insertAdjacentHTML("beforeend",Be(n)),s},Pi=(e,{direction:n="none",onSort:o}={})=>{const i=Ri(e,n);return e.classList.add("nwl-sortable"),e.setAttribute("aria-sort",Kt(n)),e.append(i),o&&i.addEventListener("click",o),{th:e,button:i,setDirection:a=>{e.setAttribute("aria-sort",Kt(a)),i.querySelector("svg.nwl-sort-indicator").remove(),i.insertAdjacentHTML("beforeend",Be(a))}}},JM="",qM="",Bi=["aria-sort"],Qi={class:"nwl-sort-label"},Zi=["data-state"],Gi=["d"],vi=x({__name:"SortableTh",props:{sort:{type:Object,required:!0},column:{type:String,required:!0}},setup(e){const n=e,o=t.computed(()=>Kt(n.sort.direction(n.column)));return(i,s)=>(t.openBlock(),t.createElementBlock("th",{class:"nwl-sortable","aria-sort":o.value},[t.createElementVNode("button",{type:"button",class:"nwl-sort-button",onClick:s[0]||(s[0]=a=>e.sort.sortBy(e.column))},[t.createElementVNode("span",Qi,[t.renderSlot(i.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(e.column),1)],!0)]),(t.openBlock(),t.createElementBlock("svg",t.mergeProps(t.unref(Pe),{"data-state":o.value}),[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Re)[o.value],a=>(t.openBlock(),t.createElementBlock("path",{key:a,d:a},null,8,Gi))),128))],16,Zi))])],8,Bi))}},[["__scopeId","data-v-92689677"]]),$i=(e,n,o={})=>{var m,c;const i=t.ref((m=o.column)!=null?m:null),s=t.ref((c=o.ascending)!=null?c:!0);return{sortedRows:t.computed(()=>{const M=t.toValue(e)||[],d=n[i.value];return d?Yn(M,d,s.value):M}),sortColumn:i,sortAscending:s,sortBy:M=>{const d=Un({column:i.value,ascending:s.value},M);i.value=d.column,s.value=d.ascending},direction:M=>i.value!==M?"none":s.value?"ascending":"descending"}},eu="",Wi={class:"dialog"},Fi={class:"contents"},Hi={class:"scrollable"},Xi=["onBlur"],Ki={class:"actions"},Vn=x({__name:"ImportFilesDialog",props:{files:{type:Array,required:!0}},emits:["import","cancel"],setup(e){const n=e,o=t.ref(n.files);return(i,s)=>(t.openBlock(),t.createElementBlock("div",Wi,[t.createElementVNode("div",Fi,[t.createElementVNode("div",Hi,[t.createElementVNode("table",null,[s[2]||(s[2]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"URL"),t.createElementVNode("th",null,"Name")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,a=>(t.openBlock(),t.createElementBlock("tr",{key:a.source},[t.createElementVNode("td",{contentEditable:"true",onBlur:l=>a.source=l.currentTarget.textContent},t.toDisplayString(a.source),41,Xi),t.createElementVNode("td",null,t.toDisplayString(a.name),1)]))),128))])])]),t.createElementVNode("div",Ki,[t.createVNode(v,{"class-name":"push-button",onClick:s[0]||(s[0]=a=>i.$emit("import",o.value))},{default:t.withCtx(()=>[...s[3]||(s[3]=[t.createTextVNode(" Import ",-1)])]),_:1}),t.createVNode(v,{"class-name":"push-button",onClick:s[1]||(s[1]=a=>i.$emit("cancel"))},{default:t.withCtx(()=>[...s[4]||(s[4]=[t.createTextVNode(" Cancel ",-1)])]),_:1})])])]))}},[["__scopeId","data-v-d3c2feaa"]]),ou="",Ji={},qi={class:"container"},ts={class:"side"},es={class:"content"};function ns(e,n){return t.openBlock(),t.createElementBlock("div",qi,[t.createElementVNode("div",ts,[t.renderSlot(e.$slots,"side",{},void 0,!0)]),t.createElementVNode("div",es,[t.renderSlot(e.$slots,"content",{},void 0,!0)])])}const Rn=x(Ji,[["render",ns],["__scopeId","data-v-4b92cc95"]]),iu="",os={class:"wrapper"},is=["onClick"],ss=["value"],as=["value"],rs={class:"actions"},Pn=x({__name:"PureAnnotations",props:{annotations:{type:Array,required:!0}},emits:["addAnnotation","removeAnnotations","updateAnnotation"],setup(e,{emit:n}){const{fetchLabelSets:o,annotationTypes:i}=t.inject("config"),s=e,a=n,l=t.reactive([]);(()=>ct(this,null,function*(){l.push(...yield o())}))();const m=t.ref(null),c=(L,f)=>{m.value=f},M=(L,f)=>{a("updateAnnotation",L,G(G({},s.annotations[L]),f))},d=(L,f)=>{const T=s.annotations.indexOf(L);T<0||M(T,{name:f})},g=(L,f)=>{const T=s.annotations.indexOf(L);if(T<0)return;const S={type:f};f==="text"?S.values="":l.every(A=>A.source!==s.annotations[T].values)&&(S.values=l[0].source),M(T,S)},I=(L,f)=>{const T=s.annotations.indexOf(L);T<0||M(T,{values:f})},z=(L,f)=>{const T=s.annotations.indexOf(L);T<0||M(T,{display:f})};return(L,f)=>(t.openBlock(),t.createElementBlock("div",os,[f[5]||(f[5]=t.createElementVNode("h2",null,"Annotations",-1)),t.createVNode(bt,{id:"annotations"},{default:t.withCtx(()=>[f[2]||(f[2]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"Name"),t.createElementVNode("th",null,"Type"),t.createElementVNode("th",null,"Value"),t.createElementVNode("th",null,"Display")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.annotations,(T,S)=>(t.openBlock(),t.createElementBlock("tr",{key:S,class:t.normalizeClass({selected:m.value===S}),onClick:A=>c(A,S)},[t.createElementVNode("td",null,[t.createVNode(pt,{modelValue:T.name,"onUpdate:modelValue":A=>T.name=A,placeholder:"Enter annotation name",onBlur:A=>d(T,A.target.value),onKeyup:t.withKeys(A=>d(T,A.target.value),["enter"])},null,8,["modelValue","onUpdate:modelValue","onBlur","onKeyup"])]),t.createElementVNode("td",null,[t.createVNode(Ve,{modelValue:T.type,"onUpdate:modelValue":A=>T.type=A,onChange:A=>g(T,A.target.value)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i),A=>(t.openBlock(),t.createElementBlock("option",{key:`${T.name}${A}`,value:A},t.toDisplayString(A),9,ss))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),t.createElementVNode("td",null,[T.type!=="text"?(t.openBlock(),t.createBlock(Ve,{key:0,modelValue:T.values,"onUpdate:modelValue":A=>T.values=A,onChange:A=>I(T,A.target.value)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l,A=>(t.openBlock(),t.createElementBlock("option",{value:A.source,key:`${T.name}${A.source}`},t.toDisplayString(A.name),9,as))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])):t.createCommentVNode("",!0)]),t.createElementVNode("td",null,[t.createVNode(bn,{modelValue:T.display,"onUpdate:modelValue":A=>T.display=A,onChange:A=>z(T,A)},null,8,["modelValue","onUpdate:modelValue","onChange"])])],10,is))),128))])]),_:1}),t.createElementVNode("div",rs,[t.createVNode(v,{small:!0,onClick:f[0]||(f[0]=T=>L.$emit("addAnnotation")),title:"Add annotation"},{default:t.withCtx(()=>[...f[3]||(f[3]=[t.createTextVNode(" + ",-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:f[1]||(f[1]=T=>L.$emit("removeAnnotations",[m.value])),title:"Remove selected annotations",disabled:m.value==null},{default:t.withCtx(()=>[...f[4]||(f[4]=[t.createTextVNode(" - ",-1)])]),_:1},8,["disabled"])])]))}},[["__scopeId","data-v-99e79309"]]);class ls{constructor(n){this.baseURL=n}transformProjectFiles(n){var i;if(!n)return n;const o=Array.isArray((i=n.files)==null?void 0:i.list)?n.files.list:[];return _t(G({},n),{files:_t(G({},n.files),{list:o.map(s=>{if(typeof s=="string"){const a=s.lastIndexOf("/");return{source:s,name:a>0?s.substring(a+1):""}}return s})})})}fetch(n){return ct(this,null,function*(){return this.transformProjectFiles(yield(yield fetch(`${this.baseURL}/project/json/${n}`)).json())})}save(n){return ct(this,null,function*(){return(yield fetch(`${this.baseURL}/project/json/${n.shortname}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({data:n})})).json()})}delete(n){return ct(this,null,function*(){return(yield fetch(`${this.baseURL}/project/json/${n}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json()})}}const _=t.reactive({project:null,loading:!0});function Lt(){const{baseURL:e,usernameField:n}=t.inject("config"),o=new ls(e),i=T=>{_.project=o.transformProjectFiles(T)},s=T=>ct(this,null,function*(){_.loading=!0,_.project=yield o.fetch(T),_.loading=!1}),a=T=>o.save(T),l=T=>o.delete(T),u=T=>{_.project&&(_.project=G(G({},_.project),T))},m=()=>{_.project&&_.project.collaborators.list.push({[n]:"",name:"",access:{collaborators:"none",annotations:"none",files:"none"}})},c=(T,S)=>{if(!_.project)return;const A=_.project.collaborators.list[T];_.project.collaborators.list[T]=G(G({},A),S)},M=T=>{_.project&&(_.project.collaborators.list=_.project.collaborators.list.filter(S=>!T.includes(_.project.collaborators.list.indexOf(S))))},d=()=>{_.project&&_.project.annotations.list.push({type:"text",name:"",values:"",display:!0})},g=(T,S)=>{if(!_.project)return;const A=_.project.annotations.list[T];_.project.annotations.list[T]=G(G({},A),S)},I=T=>{_.project&&(_.project.annotations.list=_.project.annotations.list.filter(S=>!T.includes(_.project.annotations.list.indexOf(S))))},z=()=>{_.project&&_.project.files.list.push({source:"",name:""})},L=(T,S)=>{if(!_.project)return;const A=_.project.files.list[T];_.project.files.list[T]=G(G({},A),S)},f=T=>{_.project&&(_.project.files.list=_.project.files.list.filter(S=>!T.includes(_.project.files.list.indexOf(S))))};return _t(G({},t.toRefs(_)),{setProject:i,fetchProject:s,saveProject:a,deleteProject:l,updateProject:u,addCollaborator:m,updateCollaborator:c,removeCollaborators:M,addAnnotation:d,updateAnnotation:g,removeAnnotations:I,addFile:z,updateFile:L,removeFiles:f})}const Bn={__name:"Annotations",setup(e){const{project:n,addAnnotation:o,updateAnnotation:i,removeAnnotations:s}=Lt();return n.value&&n.value.annotations&&n.value.annotations.list&&n.value.annotations.list.length===0&&o(),(a,l)=>t.unref(n)&&t.unref(n).annotations?(t.openBlock(),t.createBlock(Pn,{key:0,annotations:t.unref(n).annotations.list,onAddAnnotation:t.unref(o),onRemoveAnnotations:t.unref(s),onUpdateAnnotation:t.unref(i)},null,8,["annotations","onAddAnnotation","onRemoveAnnotations","onUpdateAnnotation"])):t.createCommentVNode("",!0)}};var cs=typeof global=="object"&&global&&global.Object===Object&&global;const Ms=cs;var us=typeof self=="object"&&self&&self.Object===Object&&self,ds=Ms||us||Function("return this")();const me=ds;var Ns=me.Symbol;const kt=Ns;var Qn=Object.prototype,gs=Qn.hasOwnProperty,ms=Qn.toString,Jt=kt?kt.toStringTag:void 0;function Is(e){var n=gs.call(e,Jt),o=e[Jt];try{e[Jt]=void 0;var i=!0}catch(a){}var s=ms.call(e);return i&&(n?e[Jt]=o:delete e[Jt]),s}var Ts=Object.prototype,ps=Ts.toString;function ys(e){return ps.call(e)}var js="[object Null]",fs="[object Undefined]",Zn=kt?kt.toStringTag:void 0;function Gn(e){return e==null?e===void 0?fs:js:Zn&&Zn in Object(e)?Is(e):ys(e)}function zs(e){return e!=null&&typeof e=="object"}var Ds="[object Symbol]";function Ie(e){return typeof e=="symbol"||zs(e)&&Gn(e)==Ds}function As(e,n){for(var o=-1,i=e==null?0:e.length,s=Array(i);++o<i;)s[o]=n(e[o],o,e);return s}var Ls=Array.isArray;const Qe=Ls;var hs=1/0,vn=kt?kt.prototype:void 0,$n=vn?vn.toString:void 0;function Wn(e){if(typeof e=="string")return e;if(Qe(e))return As(e,Wn)+"";if(Ie(e))return $n?$n.call(e):"";var n=e+"";return n=="0"&&1/e==-hs?"-0":n}var Cs=/\s/;function Es(e){for(var n=e.length;n--&&Cs.test(e.charAt(n)););return n}var Ss=/^\s+/;function xs(e){return e&&e.slice(0,Es(e)+1).replace(Ss,"")}function qt(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var Fn=0/0,Os=/^[-+]0x[0-9a-f]+$/i,ws=/^0b[01]+$/i,_s=/^0o[0-7]+$/i,bs=parseInt;function Hn(e){if(typeof e=="number")return e;if(Ie(e))return Fn;if(qt(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=qt(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=xs(e);var o=ws.test(e);return o||_s.test(e)?bs(e.slice(2),o?2:8):Os.test(e)?Fn:+e}var ks="[object AsyncFunction]",Ys="[object Function]",Us="[object GeneratorFunction]",Vs="[object Proxy]";function Rs(e){if(!qt(e))return!1;var n=Gn(e);return n==Ys||n==Us||n==ks||n==Vs}var Ps=me["__core-js_shared__"];const Ze=Ps;var Xn=function(){var e=/[^.]+$/.exec(Ze&&Ze.keys&&Ze.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Bs(e){return!!Xn&&Xn in e}var Qs=Function.prototype,Zs=Qs.toString;function Gs(e){if(e!=null){try{return Zs.call(e)}catch(n){}try{return e+""}catch(n){}}return""}var vs=/[\\^$.*+?()[\]{}|]/g,$s=/^\[object .+?Constructor\]$/,Ws=Function.prototype,Fs=Object.prototype,Hs=Ws.toString,Xs=Fs.hasOwnProperty,Ks=RegExp("^"+Hs.call(Xs).replace(vs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Js(e){if(!qt(e)||Bs(e))return!1;var n=Rs(e)?Ks:$s;return n.test(Gs(e))}function qs(e,n){return e==null?void 0:e[n]}function Kn(e,n){var o=qs(e,n);return Js(o)?o:void 0}function ta(e,n){return e===n||e!==e&&n!==n}var ea=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,na=/^\w*$/;function oa(e,n){if(Qe(e))return!1;var o=typeof e;return o=="number"||o=="symbol"||o=="boolean"||e==null||Ie(e)?!0:na.test(e)||!ea.test(e)||n!=null&&e in Object(n)}var ia=Kn(Object,"create");const te=ia;function sa(){this.__data__=te?te(null):{},this.size=0}function aa(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}var ra="__lodash_hash_undefined__",la=Object.prototype,ca=la.hasOwnProperty;function Ma(e){var n=this.__data__;if(te){var o=n[e];return o===ra?void 0:o}return ca.call(n,e)?n[e]:void 0}var ua=Object.prototype,da=ua.hasOwnProperty;function Na(e){var n=this.__data__;return te?n[e]!==void 0:da.call(n,e)}var ga="__lodash_hash_undefined__";function ma(e,n){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=te&&n===void 0?ga:n,this}function ht(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var i=e[n];this.set(i[0],i[1])}}ht.prototype.clear=sa,ht.prototype.delete=aa,ht.prototype.get=Ma,ht.prototype.has=Na,ht.prototype.set=ma;function Ia(){this.__data__=[],this.size=0}function Te(e,n){for(var o=e.length;o--;)if(ta(e[o][0],n))return o;return-1}var Ta=Array.prototype,pa=Ta.splice;function ya(e){var n=this.__data__,o=Te(n,e);if(o<0)return!1;var i=n.length-1;return o==i?n.pop():pa.call(n,o,1),--this.size,!0}function ja(e){var n=this.__data__,o=Te(n,e);return o<0?void 0:n[o][1]}function fa(e){return Te(this.__data__,e)>-1}function za(e,n){var o=this.__data__,i=Te(o,e);return i<0?(++this.size,o.push([e,n])):o[i][1]=n,this}function Yt(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var i=e[n];this.set(i[0],i[1])}}Yt.prototype.clear=Ia,Yt.prototype.delete=ya,Yt.prototype.get=ja,Yt.prototype.has=fa,Yt.prototype.set=za;var Da=Kn(me,"Map");const Aa=Da;function La(){this.size=0,this.__data__={hash:new ht,map:new(Aa||Yt),string:new ht}}function ha(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}function pe(e,n){var o=e.__data__;return ha(n)?o[typeof n=="string"?"string":"hash"]:o.map}function Ca(e){var n=pe(this,e).delete(e);return this.size-=n?1:0,n}function Ea(e){return pe(this,e).get(e)}function Sa(e){return pe(this,e).has(e)}function xa(e,n){var o=pe(this,e),i=o.size;return o.set(e,n),this.size+=o.size==i?0:1,this}function Ct(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var i=e[n];this.set(i[0],i[1])}}Ct.prototype.clear=La,Ct.prototype.delete=Ca,Ct.prototype.get=Ea,Ct.prototype.has=Sa,Ct.prototype.set=xa;var Oa="Expected a function";function Ge(e,n){if(typeof e!="function"||n!=null&&typeof n!="function")throw new TypeError(Oa);var o=function(){var i=arguments,s=n?n.apply(this,i):i[0],a=o.cache;if(a.has(s))return a.get(s);var l=e.apply(this,i);return o.cache=a.set(s,l)||a,l};return o.cache=new(Ge.Cache||Ct),o}Ge.Cache=Ct;var wa=500;function _a(e){var n=Ge(e,function(i){return o.size===wa&&o.clear(),i}),o=n.cache;return n}var ba=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ka=/\\(\\)?/g,Ya=_a(function(e){var n=[];return e.charCodeAt(0)===46&&n.push(""),e.replace(ba,function(o,i,s,a){n.push(s?a.replace(ka,"$1"):i||o)}),n});const Ua=Ya;function Va(e){return e==null?"":Wn(e)}function Ra(e,n){return Qe(e)?e:oa(e,n)?[e]:Ua(Va(e))}var Pa=1/0;function Ba(e){if(typeof e=="string"||Ie(e))return e;var n=e+"";return n=="0"&&1/e==-Pa?"-0":n}function Qa(e,n){n=Ra(n,e);for(var o=0,i=n.length;e!=null&&o<i;)e=e[Ba(n[o++])];return o&&o==i?e:void 0}function Jn(e,n,o){var i=e==null?void 0:Qa(e,n);return i===void 0?o:i}var Za=function(){return me.Date.now()};const ve=Za;var Ga="Expected a function",va=Math.max,$a=Math.min;function Wa(e,n,o){var i,s,a,l,u,m,c=0,M=!1,d=!1,g=!0;if(typeof e!="function")throw new TypeError(Ga);n=Hn(n)||0,qt(o)&&(M=!!o.leading,d="maxWait"in o,a=d?va(Hn(o.maxWait)||0,n):a,g="trailing"in o?!!o.trailing:g);function I(Y){var U=i,q=s;return i=s=void 0,c=Y,l=e.apply(q,U),l}function z(Y){return c=Y,u=setTimeout(T,n),M?I(Y):l}function L(Y){var U=Y-m,q=Y-c,jt=n-U;return d?$a(jt,a-q):jt}function f(Y){var U=Y-m,q=Y-c;return m===void 0||U>=n||U<0||d&&q>=a}function T(){var Y=ve();if(f(Y))return S(Y);u=setTimeout(T,L(Y))}function S(Y){return u=void 0,g&&i?I(Y):(i=s=void 0,l)}function A(){u!==void 0&&clearTimeout(u),c=0,i=m=s=u=void 0}function C(){return u===void 0?l:S(ve())}function Z(){var Y=ve(),U=f(Y);if(i=arguments,s=this,m=Y,U){if(u===void 0)return z(m);if(d)return clearTimeout(u),u=setTimeout(T,n),I(m)}return u===void 0&&(u=setTimeout(T,n)),l}return Z.cancel=A,Z.flush=C,Z}const au="",Fa=["data-level"],Ha=["disabled","title"],Xa=["disabled","title"],Ka=["disabled","title"],Ja=["disabled","title"],ye=x({__name:"Access",props:{collaborator:{type:Object,required:!0},type:{type:String,required:!0},readonly:{type:Boolean,default:!1}},emits:["updateAccess"],setup(e,{emit:n}){const o=e,i=n,s=a=>{o.readonly||i("updateAccess",o.collaborator,o.type,a)};return(a,l)=>(t.openBlock(),t.createElementBlock("div",{class:"access","data-level":["none","view","edit","add","remove"].indexOf(e.collaborator.access[e.type])},[t.createElementVNode("button",{small:!0,onClick:l[0]||(l[0]=u=>s(1)),class:"view",disabled:e.readonly,title:`view ${e.type}`},null,8,Ha),t.createElementVNode("button",{small:!0,onClick:l[1]||(l[1]=u=>s(2)),class:"edit",disabled:e.readonly,title:`edit ${e.type}`},null,8,Xa),t.createElementVNode("button",{small:!0,onClick:l[2]||(l[2]=u=>s(3)),class:"add",disabled:e.readonly,title:`add ${e.type}`},null,8,Ka),t.createElementVNode("button",{small:!0,onClick:l[3]||(l[3]=u=>s(4)),class:"remove",disabled:e.readonly,title:`remove ${e.type}`},null,8,Ja)],8,Fa))}},[["__scopeId","data-v-70a16ce1"]]),J=class J{constructor(n){At(this,"numericalLevel",0);const o=J.values.indexOf(n);this.numericalLevel=Math.max(0,o)}static fromInt(n){return new J(this.values[n])}toInt(){return this.numericalLevel}toString(){return J.values[this.numericalLevel]}isGreaterThan(n){return this.toInt()>n.toInt()}isGreaterThanOrEqualTo(n){return this.toInt()>=n.toInt()}isLesserThan(n){return this.toInt()<n.toInt()}isLesserThanOrEqualTo(n){return this.toInt()<=n.toInt()}isEqualTo(n){return this.toInt()===n.toInt()}};At(J,"values",["none","view","edit","add","remove"]),At(J,"NONE",new J("none")),At(J,"VIEW",new J("view")),At(J,"EDIT",new J("edit")),At(J,"ADD",new J("add")),At(J,"REMOVE",new J("remove"));let je=J;const lu="",qa={class:"wrapper"},tr=["onClick"],er={style:{position:"relative"}},nr={class:"actions"},qn=x({__name:"PureCollaborators",props:{collaborators:{type:Array,required:!0},usersFound:{type:Array,default:()=>[]}},emits:["addCollaborator","removeCollaborators","updateCollaborator","searchUsers"],setup(e,{emit:n}){const o=e,i=n,{usernameField:s}=t.inject("config"),a=Wa(g=>{i("searchUsers",g)},300),l=t.ref(null),u=(g,I)=>{l.value=I},m=(g,I)=>{i("updateCollaborator",g,G(G({},o.collaborators[g]),I))},c=(g,I,z)=>{const L=o.collaborators.indexOf(g);if(L<0)return;const f=new je(o.collaborators[L].access[I]).toInt();let T=z;f===T&&(T-=1),m(L,{access:_t(G({},o.collaborators[L].access),{[I]:je.fromInt(T).toString()})})},M=(g,I)=>{const z=o.collaborators.indexOf(g);z<0||m(z,{name:I})},d=(g,I)=>{m(I,{[s]:g[s],userID:g[s],name:g.name})};return(g,I)=>(t.openBlock(),t.createElementBlock("div",qa,[I[5]||(I[5]=t.createElementVNode("h2",null,"Access",-1)),t.createVNode(bt,{id:"access"},{default:t.withCtx(()=>[I[2]||(I[2]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"User Name"),t.createElementVNode("th",null,"Name"),t.createElementVNode("th",null,"Collaborators"),t.createElementVNode("th",null,"Annotations"),t.createElementVNode("th",null,"Files")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.collaborators,(z,L)=>(t.openBlock(),t.createElementBlock("tr",{key:z.userID,class:t.normalizeClass({selected:l.value===L}),onClick:f=>u(f,L)},[t.createElementVNode("td",er,[t.createVNode(wn,{onInput:t.unref(a),onSelect:d,items:o.usersFound,"is-async":!0,"extra-select-args":[o.collaborators.indexOf(z)],"default-value":z[t.unref(s)]||z.userID,disabled:z[t.unref(s)]==="anyone","extract-result-text":f=>f[t.unref(s)],"aria-label":"Search by username"},null,8,["onInput","items","extra-select-args","default-value","disabled","extract-result-text"])]),t.createElementVNode("td",null,[t.createVNode(pt,{modelValue:z.name,"onUpdate:modelValue":f=>z.name=f,placeholder:"User Name",disabled:z[t.unref(s)]==="anyone",onBlur:f=>M(z,f.target.value),onKeyup:t.withKeys(f=>M(z,f.target.value),["enter"])},null,8,["modelValue","onUpdate:modelValue","disabled","onBlur","onKeyup"])]),t.createElementVNode("td",null,[t.createVNode(ye,{type:"collaborators",collaborator:z,onUpdateAccess:c},null,8,["collaborator"])]),t.createElementVNode("td",null,[t.createVNode(ye,{type:"annotations",collaborator:z,onUpdateAccess:c},null,8,["collaborator"])]),t.createElementVNode("td",null,[t.createVNode(ye,{type:"files",collaborator:z,onUpdateAccess:c},null,8,["collaborator"])])],10,tr))),128))])]),_:1}),t.createElementVNode("div",nr,[t.createVNode(v,{small:!0,onClick:I[0]||(I[0]=z=>g.$emit("addCollaborator")),title:"Add collaborator"},{default:t.withCtx(()=>[...I[3]||(I[3]=[t.createTextVNode(" + ",-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:I[1]||(I[1]=z=>{g.$emit("removeCollaborators",[l.value]),l.value=null}),title:"Remove selected collaborators",disabled:l.value==null||e.collaborators[l.value].username==="anyone"||e.collaborators[l.value].userID==="anyone"},{default:t.withCtx(()=>[...I[4]||(I[4]=[t.createTextVNode(" - ",-1)])]),_:1},8,["disabled"])])]))}},[["__scopeId","data-v-4809f467"]]),fe=t.reactive([]);function or(){const{userSearchURL:e}=t.inject("config");return{usersFound:fe,fetchUsers:o=>ct(this,null,function*(){fe.splice(0,fe.length);const i=yield(yield fetch(`${e}${o}`)).json();fe.push(...i)})}}const to={__name:"Collaborators",setup(e){const{project:n,addCollaborator:o,updateCollaborator:i,removeCollaborators:s}=Lt(),{usersFound:a,fetchUsers:l}=or();return(u,m)=>t.unref(n)&&t.unref(n).collaborators?(t.openBlock(),t.createBlock(qn,{key:0,collaborators:t.unref(n).collaborators.list,"users-found":t.unref(a),onAddCollaborator:t.unref(o),onRemoveCollaborators:t.unref(s),onUpdateCollaborator:t.unref(i),onSearchUsers:t.unref(l)},null,8,["collaborators","users-found","onAddCollaborator","onRemoveCollaborators","onUpdateCollaborator","onSearchUsers"])):t.createCommentVNode("",!0)}},ir="data:image/svg+xml;base64,PHN2ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0MzguNTMzIDQzOC41MzMiIGhlaWdodD0iNDM4LjUzMyIgdmlld0JveD0iMCAwIDQzOC41MzMgNDM4LjUzMyIgd2lkdGg9IjQzOC41MzMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI2ZmZiIgdHJhbnNmb3JtPSJtYXRyaXgoLjcxMTE2MTExIDAgMCAuNzExMTYxMTEgODEuMDg2NzE2IDI1LjY3MTMwNykiPjxwYXRoIGQ9Im0xMTQuMDA2MzYgMTgzLjM5MzI5aDQ4LjExNTQ2djkxLjIwODljMCAyLjQxOTQzLjc1NjY2IDQuNDA0MTcgMi4yNTg2IDUuOTU5NjUgMS40OTU3OCAxLjU1MDk1IDMuNDE5MDggMi4zMzA1IDUuNzU1OCAyLjMzMDVoNDguMTI0MjFjMi4zMzg0OSAwIDQuMjYwODktLjc3OTU1IDUuNzY0NTktMi4zMzA1IDEuNTA0NTYtMS41NTYzOCAyLjI1NTk2LTMuNTQwMjIgMi4yNTU5Ni01Ljk1OTY1di05MS4yMDUyN2g0OC4xMjA3MWMzLjY3NDUyIDAgNi4xODE1My0xLjcyODgxIDcuNTE5MzItNS4xODEgMS4zMzc3OS0zLjI4NjExLjc0OTY2LTYuMzA0NTEtMS43NTQ3My05LjA3MTUybC04MC4xOTk0My04Mi45MTE0OTNjLTEuODM5ODctMS41NTI3NTktMy43NTk2NS0yLjMyOTU5Ni01Ljc2NDU3LTIuMzI5NTk2LTIuMDAyMyAwLTMuOTI0Ny43NzY4MzctNS43NjYzMyAyLjMyOTU5NmwtNzkuOTQ4MzggODIuNjUwMTMzYy0xLjY2OTU5IDIuMDcxODUtMi41MDI2MyA0LjE1Mjc4LTIuNTAyNjMgNi4yMTgyOSAwIDIuNDE1ODEuNzUwNTMgNC40MDQxNyAyLjI1ODYxIDUuOTYyMzcgMS41MDAxOCAxLjU1MzY3IDMuNDIyNTcgMi4zMjk1OSA1Ljc2MjgxIDIuMzI5NTl6Ii8+PHBhdGggZD0ibTM2LjIzNTI0NCAzMTkuMjQ3Mzl2ODUuMDUxNDRoMzE2LjEzMjgxNnYtODUuMDUxNDRoLTM2LjkwODkydjQ4LjE0MjUyaC0yNDIuMzE0OTcydi00OC4xNDI1MnoiLz48L2c+PC9zdmc+",sr="data:image/svg+xml;base64,PHN2ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0MzguNTMzIDQzOC41MzMiIGhlaWdodD0iNDM4LjUzMyIgdmlld0JveD0iMCAwIDQzOC41MzMgNDM4LjUzMyIgd2lkdGg9IjQzOC41MzMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTE2Mi4xNjM2MSAxNTYuMDk5OTRoMzQuMjE3ODR2LTY0Ljg2NDIzMWMwLTEuNzIwNi41MzgxMS0zLjEzMjA3IDEuNjA2MjMtNC4yMzgyNyAxLjA2Mzc0LTEuMTAyOTcgMi40MzE1MS0xLjY1NzM2IDQuMDkzMy0xLjY1NzM2aDM0LjIyNDA3YzEuNjYzMDQgMCAzLjAzMDE3LjU1NDM5IDQuMDk5NTUgMS42NTczNiAxLjA2OTk4IDEuMTA2ODQgMS42MDQzNSAyLjUxNzY3IDEuNjA0MzUgNC4yMzgyN3Y2NC44NjE2NTFoMzQuMjIxNThjMi42MTMxNyAwIDQuMzk2MDYgMS4yMjk0NiA1LjM0NzQ0IDMuNjg0NTIuOTUxMzkgMi4zMzY5Ni41MzMxMyA0LjQ4MzUyLTEuMjQ3ODkgNi40NTEzMWwtNTcuMDM0NzIgNTguOTYzNDNjLTEuMzA4NDQgMS4xMDQyNi0yLjY3MzcxIDEuNjU2NzItNC4wOTk1MyAxLjY1NjcyLTEuNDIzOTYgMC0yLjc5MTEtLjU1MjQ2LTQuMTAwNzktMS42NTY3MmwtNTYuODU2MTgtNTguNzc3NTZjLTEuMTg3MzUtMS40NzM0Mi0xLjc3OTc4LTIuOTUzMjktMS43Nzk3OC00LjQyMjIgMC0xLjcxODAzLjUzMzc1LTMuMTMyMDggMS42MDYyNC00LjI0MDIxIDEuMDY2ODctMS4xMDQ5MSAyLjQzNC0xLjY1NjcxIDQuMDk4MjktMS42NTY3MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJtMTA2Ljg1NTgxIDI1Mi43MDc2NHY2MC40ODUyN2gyMjQuODIxMzd2LTYwLjQ4NTI3aC0yNi4yNDgxOXYzNC4yMzcwOGgtMTcyLjMyNDk5di0zNC4yMzcwOHoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",Mu="",ar={class:"wrapper"},rr=["onClick"],lr=["onBlur","onKeyup"],cr={class:"actions"},eo=x({__name:"PureFiles",props:{files:{type:Array,required:!0}},emits:["addFile","removeFiles","updateFile","importCsv","downloadCsv"],setup(e,{emit:n}){const o=e,i=n,s=(c,M)=>{i("updateFile",c,G(G({},o.files[c]),M))},a=t.ref(null),l=(c,M)=>{a.value=M},u=(c,M)=>{const d=o.files.indexOf(c);d<0||s(d,{name:M})},m=(c,M)=>{const d=o.files.indexOf(c);d<0||s(d,{source:M})};return(c,M)=>(t.openBlock(),t.createElementBlock("div",ar,[M[9]||(M[9]=t.createElementVNode("h2",null,"Files",-1)),t.createVNode(bt,{id:"files"},{default:t.withCtx(()=>[M[4]||(M[4]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"URL"),t.createElementVNode("th",null,"Name")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.files,(d,g)=>(t.openBlock(),t.createElementBlock("tr",{key:d.source,class:t.normalizeClass({selected:a.value===g}),onClick:I=>l(I,g)},[t.createElementVNode("td",null,[t.createElementVNode("span",{contenteditable:"true",placeholder:"File URL",onBlur:I=>m(d,I.currentTarget.textContent),onKeyup:t.withKeys(I=>m(d,I.currentTarget.textContent),["enter"])},t.toDisplayString(d.source),41,lr)]),t.createElementVNode("td",null,[t.createVNode(pt,{modelValue:d.name,"onUpdate:modelValue":I=>d.name=I,placeholder:"File Name",onBlur:I=>u(d,I.target.value),onKeyup:t.withKeys(I=>u(d,I.target.value),["enter"])},null,8,["modelValue","onUpdate:modelValue","onBlur","onKeyup"])])],10,rr))),128))])]),_:1}),t.createElementVNode("div",cr,[t.createVNode(v,{small:!0,onClick:M[0]||(M[0]=d=>c.$emit("importCsv")),title:"Upload CSV"},{default:t.withCtx(()=>[...M[5]||(M[5]=[t.createElementVNode("img",{src:ir,alt:"Import CSV"},null,-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:M[1]||(M[1]=d=>c.$emit("downloadCsv")),title:"Download CSV"},{default:t.withCtx(()=>[...M[6]||(M[6]=[t.createElementVNode("img",{src:sr,alt:"Download CSV"},null,-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:M[2]||(M[2]=d=>c.$emit("addFile")),title:"Add file"},{default:t.withCtx(()=>[...M[7]||(M[7]=[t.createTextVNode(" + ",-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:M[3]||(M[3]=d=>c.$emit("removeFiles",[a.value])),title:"Remove selected files",disabled:a.value==null},{default:t.withCtx(()=>[...M[8]||(M[8]=[t.createTextVNode(" - ",-1)])]),_:1},8,["disabled"])])]))}},[["__scopeId","data-v-773d9ed6"]]),no={__name:"Files",setup(e){const{project:n,addFile:o,updateFile:i,removeFiles:s}=Lt(),a=t.ref(!1),l=t.ref([]),u=()=>{const M=document.createElement("input");M.type="file",M.setAttribute("id","importFilesInput"),M.style.display="none",document.querySelector("body").appendChild(M),M.onchange=function(){const[d]=this.files,g=new FileReader;g.onload=function(I){document.querySelector("body").removeChild(M);const{result:z}=I.target,L=z.split(`
|
|
1
|
+
(function(D,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(D=typeof globalThis!="undefined"?globalThis:D||self,t(D["nwl-components"]={},D.Vue))})(this,function(D,t){"use strict";var bM=Object.defineProperty,kM=Object.defineProperties;var YM=Object.getOwnPropertyDescriptors;var Ue=Object.getOwnPropertySymbols;var Ai=Object.prototype.hasOwnProperty,Li=Object.prototype.propertyIsEnumerable;var xn=(D,t,R)=>t in D?bM(D,t,{enumerable:!0,configurable:!0,writable:!0,value:R}):D[t]=R,G=(D,t)=>{for(var R in t||(t={}))Ai.call(t,R)&&xn(D,R,t[R]);if(Ue)for(var R of Ue(t))Li.call(t,R)&&xn(D,R,t[R]);return D},_t=(D,t)=>kM(D,YM(t));var hi=(D,t)=>{var R={};for(var st in D)Ai.call(D,st)&&t.indexOf(st)<0&&(R[st]=D[st]);if(D!=null&&Ue)for(var st of Ue(D))t.indexOf(st)<0&&Li.call(D,st)&&(R[st]=D[st]);return R};var At=(D,t,R)=>(xn(D,typeof t!="symbol"?t+"":t,R),R);var ct=(D,t,R)=>new Promise((st,x)=>{var On=Nt=>{try{ge(R.next(Nt))}catch(Xt){x(Xt)}},pt=Nt=>{try{ge(R.throw(Nt))}catch(Xt){x(Xt)}},ge=Nt=>Nt.done?st(Nt.value):Promise.resolve(Nt.value).then(On,pt);ge((R=R.apply(D,t)).next())});let R=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((n,o)=>(o&=63,o<36?n+=o.toString(36):o<62?n+=(o-26).toString(36).toUpperCase():o>62?n+="-":n+="_",n),"");const st="",x=(e,n)=>{const o=e.__vccOpts||e;for(const[i,s]of n)o[i]=s;return o},pt=x({__name:"TextInput",props:t.mergeModels({placeholder:{type:String,default:""},disabled:Boolean},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:t.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:n}){const o=e,i=t.useModel(e,"modelValue"),s=n,a=l=>{s("update:modelValue",l.target.value)};return(l,u)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",t.mergeProps({type:"text"},o,{onInput:a,"onUpdate:modelValue":u[0]||(u[0]=m=>i.value=m)}),null,16)),[[t.vModelText,i.value]])}},[["__scopeId","data-v-4d629f4f"]]),ge="",Nt=["aria-owns","aria-expanded"],Xt=["id"],Ci={key:0,class:"loading"},Ei=["onClick","id","aria-selected"],wn=x({__name:"Autocomplete",props:{items:{type:Array,default:()=>[]},isAsync:{type:Boolean,required:!1,default:!1},ariaLabel:{type:String,required:!0},defaultValue:{type:String,required:!1,default:""},disabled:{type:Boolean,required:!1,default:!1},extraSelectArgs:{type:Array,default:()=>[]},extractResultText:{type:Function,default:e=>e}},emits:["input","select"],setup(e,{emit:n}){const o=e,i=t.reactive({isOpen:!1,results:[],search:o.defaultValue,isLoading:!1,arrowCounter:0,activedescendant:""}),s=t.ref(null);t.watch(o.items,()=>{i.results=o.items,i.isLoading=!1});const a=n,l=()=>{i.results=i.items.filter(T=>T.toLowerCase().indexOf(i.search.toLowerCase())>-1)},u=()=>{a("input",i.search),i.isOpen=!0,o.isAsync?i.isLoading=!0:l()},m=T=>`result-item-${T}`,c=()=>{i.activedescendant=m(i.arrowCounter)},M=T=>T===i.arrowCounter,d=T=>(i.search=o.extractResultText(T),i.isOpen=!1,a("select",T,...o.extraSelectArgs),!1),g=()=>{i.isOpen&&(i.arrowCounter=(i.arrowCounter+1)%i.results.length,c())},I=()=>{i.isOpen&&(i.arrowCounter=i.arrowCounter>0?i.arrowCounter-1:i.results.length-1,c())},z=()=>{d(i.results[i.arrowCounter])},L=T=>{s.value.contains(T.target)||(i.isOpen=!1,i.arrowCounter=-1)},f=R();return t.onMounted(()=>{document.addEventListener("click",L)}),t.onUnmounted(()=>{document.removeEventListener("click",L)}),(T,S)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:s,class:"autocomplete",role:"combobox","aria-haspopup":"listbox","aria-owns":`${t.unref(f)}-autocomplete-results`,"aria-expanded":i.isOpen},[t.createVNode(pt,{onInput:u,modelValue:i.search,"onUpdate:modelValue":S[0]||(S[0]=A=>i.search=A),onKeydown:[t.withKeys(g,["down"]),t.withKeys(I,["up"]),t.withKeys(z,["enter"])],role:"searchbox","aria-autocomplete":"list","aria-controls":`${t.unref(f)}-autocomplete-results`,"aria-label":e.ariaLabel,"aria-activedescendant":i.activedescendant,disabled:o.disabled},null,8,["modelValue","aria-controls","aria-label","aria-activedescendant","disabled"]),t.withDirectives(t.createElementVNode("ul",{id:`${t.unref(f)}-autocomplete-results`,class:"autocomplete-results",role:"listbox"},[i.isLoading?(t.openBlock(),t.createElementBlock("li",Ci," Loading results... ")):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(i.results,(A,C)=>(t.openBlock(),t.createElementBlock("li",{key:C,onClick:Z=>d(A),class:t.normalizeClass(["autocomplete-result",{"is-active":M(C)}]),role:"option",id:m(C),"aria-selected":M(C)},t.toDisplayString(o.extractResultText(A)),11,Ei))),128))],8,Xt),[[t.vShow,i.isOpen]])],8,Nt))}},[["__scopeId","data-v-5d982740"]]),VM="",Si=["title","disabled"],v=x({__name:"Button",props:{className:{type:String,default:null},title:{type:String,default:null},disabled:Boolean,small:Boolean},setup(e){const n=e,o={small:n.small===!0};return n.className!==null&&(o[n.className]=!0),(i,s)=>(t.openBlock(),t.createElementBlock("button",{title:e.title,disabled:e.disabled,class:t.normalizeClass(o),tabindex:"-1"},[t.renderSlot(i.$slots,"default",{},void 0,!0)],8,Si))}},[["__scopeId","data-v-a070c49a"]]),PM="",xi=["value"],Ve=x({__name:"Select",props:{disabled:Boolean,modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,s=a=>{i("update:modelValue",a.target.value)};return(a,l)=>(t.openBlock(),t.createElementBlock("select",t.mergeProps(o,{value:e.modelValue,onInput:s}),[t.renderSlot(a.$slots,"default",{},void 0,!0)],16,xi))}},[["__scopeId","data-v-8ecfa0f7"]]),QM="",_n=x({__name:"TextArea",props:t.mergeModels({placeholder:{type:String,default:""},disabled:Boolean},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:t.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:n}){const o=e,i=t.useModel(e,"modelValue"),s=n,a=l=>{s("update:modelValue",l.target.value)};return(l,u)=>t.withDirectives((t.openBlock(),t.createElementBlock("textarea",t.mergeProps(o,{onInput:a,"onUpdate:modelValue":u[0]||(u[0]=m=>i.value=m)}),null,16)),[[t.vModelText,i.value]])}},[["__scopeId","data-v-7cd36e47"]]),GM="",Oi=["id"],bt=x({__name:"Table",props:{id:{type:String,default:null}},setup(e){const n=e;return(o,i)=>(t.openBlock(),t.createElementBlock("table",{id:n.id},[t.renderSlot(o.$slots,"default",{},void 0,!0)],8,Oi))}},[["__scopeId","data-v-233fc9dd"]]),$M="",wi=["aria-checked"],bn=x({__name:"Checkbox",props:{modelValue:Boolean},emits:["update:modelValue","change"],setup(e,{emit:n}){const o=n,i=e,s=t.ref(i.modelValue);typeof i.modelValue=="string"&&(s.value=i.modelValue==="true");const a=l=>{typeof l!="undefined"&&l!==" "||(s.value=!s.value,o("change",s.value),o("update:modelValue",s.value))};return(l,u)=>(t.openBlock(),t.createElementBlock("span",{role:"checkbox","aria-checked":s.value,onClick:u[0]||(u[0]=m=>a()),onKeydown:u[1]||(u[1]=m=>a(m.key)),tabindex:"0","aria-label":"label"},null,40,wi))}},[["__scopeId","data-v-59778f34"]]),FM="",_i={class:"tabs"},bi=["onClick"],ki=x({__name:"Tabs",setup(e){const n=t.ref(0),i=t.getCurrentInstance().vnode.children.default(),s={render:()=>i[n.value]},a=l=>{n.value=l};return(l,u)=>(t.openBlock(),t.createElementBlock("div",_i,[t.createElementVNode("ul",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i),(m,c)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[m&&m.props?(t.openBlock(),t.createElementBlock("li",{key:m.props.title,onClick:M=>a(c),class:t.normalizeClass({selected:c==n.value})},t.toDisplayString(m.props.title),11,bi)):t.createCommentVNode("",!0)],64))),256))]),t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(s,{key:n.value}))]))}},[["__scopeId","data-v-9e8a7527"]]),XM="",Yi={class:"content"},Ui=x({__name:"Tab",props:{title:{type:String,required:!0}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",Yi,[t.renderSlot(n.$slots,"default",{},void 0,!0)]))}},[["__scopeId","data-v-41512210"]]),Vi=e=>e===null||typeof e=="undefined"||e===""||Number.isNaN(e),kn=(e,{key:n,type:o="string"})=>{const i=typeof n=="function"?n(e):e==null?void 0:e[n];if(Vi(i))return null;switch(o){case"number":{const s=Number(i);return Number.isNaN(s)?null:s}case"date":{const s=(i instanceof Date?i:new Date(i)).getTime();return Number.isNaN(s)?null:s}default:return String(i)}},Yn=(e,n,o=!0)=>{const i=e||[];if(!n)return[...i];const s=o?1:-1,a=n.type||"string";return i.map(l=>({row:l,value:kn(l,n)})).sort((l,u)=>{const[m,c]=[l.value===null,u.value===null];return m||c?m-c:a==="string"?s*l.value.localeCompare(u.value,[],{numeric:!0}):s*(l.value-u.value)}).map(({row:l})=>l)},Un=({column:e,ascending:n},o)=>e===o?{column:e,ascending:!n}:{column:o,ascending:!0},Kt=e=>e==="ascending"||e==="descending"?e:"none",Re={ascending:["M12 5l0 14","M18 11l-6 -6","M6 11l6 -6"],descending:["M12 5l0 14","M18 13l-6 6","M6 13l6 6"],none:["M3 9l4 -4l4 4m-4 -4v14","M21 15l-4 4l-4 -4m4 4v-14"]},Pe={class:"nwl-sort-indicator",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"},Be=e=>{const n=Kt(e),o=Object.entries(_t(G({},Pe),{"data-state":n})).map(([s,a])=>`${s}="${a}"`).join(" "),i=Re[n].map(s=>`<path d="${s}"></path>`).join("");return`<svg ${o}>${i}</svg>`},Ri=(e,n)=>{const o=e.ownerDocument,i=o.createElement("span");i.className="nwl-sort-label",i.append(...e.childNodes);const s=o.createElement("button");return s.type="button",s.className="nwl-sort-button",s.append(i),s.insertAdjacentHTML("beforeend",Be(n)),s},Pi=(e,{direction:n="none",onSort:o}={})=>{const i=Ri(e,n);return e.classList.add("nwl-sortable"),e.setAttribute("aria-sort",Kt(n)),e.append(i),o&&i.addEventListener("click",o),{th:e,button:i,setDirection:a=>{e.setAttribute("aria-sort",Kt(a)),i.querySelector("svg.nwl-sort-indicator").remove(),i.insertAdjacentHTML("beforeend",Be(a))}}},JM="",qM="",Bi=["aria-sort"],Qi={class:"nwl-sort-label"},Zi=["data-state"],Gi=["d"],vi=x({__name:"SortableTh",props:{sort:{type:Object,required:!0},column:{type:String,required:!0}},setup(e){const n=e,o=t.computed(()=>Kt(n.sort.direction(n.column)));return(i,s)=>(t.openBlock(),t.createElementBlock("th",{class:"nwl-sortable","aria-sort":o.value},[t.createElementVNode("button",{type:"button",class:"nwl-sort-button",onClick:s[0]||(s[0]=a=>e.sort.sortBy(e.column))},[t.createElementVNode("span",Qi,[t.renderSlot(i.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(e.column),1)],!0)]),(t.openBlock(),t.createElementBlock("svg",t.mergeProps(t.unref(Pe),{"data-state":o.value}),[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Re)[o.value],a=>(t.openBlock(),t.createElementBlock("path",{key:a,d:a},null,8,Gi))),128))],16,Zi))])],8,Bi))}},[["__scopeId","data-v-92689677"]]),$i=(e,n,o={})=>{var m,c;const i=t.ref((m=o.column)!=null?m:null),s=t.ref((c=o.ascending)!=null?c:!0);return{sortedRows:t.computed(()=>{const M=t.toValue(e)||[],d=n[i.value];return d?Yn(M,d,s.value):M}),sortColumn:i,sortAscending:s,sortBy:M=>{const d=Un({column:i.value,ascending:s.value},M);i.value=d.column,s.value=d.ascending},direction:M=>i.value!==M?"none":s.value?"ascending":"descending"}},eu="",Wi={class:"dialog"},Fi={class:"contents"},Hi={class:"scrollable"},Xi=["onBlur"],Ki={class:"actions"},Vn=x({__name:"ImportFilesDialog",props:{files:{type:Array,required:!0}},emits:["import","cancel"],setup(e){const n=e,o=t.ref(n.files);return(i,s)=>(t.openBlock(),t.createElementBlock("div",Wi,[t.createElementVNode("div",Fi,[t.createElementVNode("div",Hi,[t.createElementVNode("table",null,[s[2]||(s[2]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"URL"),t.createElementVNode("th",null,"Name")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,a=>(t.openBlock(),t.createElementBlock("tr",{key:a.source},[t.createElementVNode("td",{contentEditable:"true",onBlur:l=>a.source=l.currentTarget.textContent},t.toDisplayString(a.source),41,Xi),t.createElementVNode("td",null,t.toDisplayString(a.name),1)]))),128))])])]),t.createElementVNode("div",Ki,[t.createVNode(v,{"class-name":"push-button",onClick:s[0]||(s[0]=a=>i.$emit("import",o.value))},{default:t.withCtx(()=>[...s[3]||(s[3]=[t.createTextVNode(" Import ",-1)])]),_:1}),t.createVNode(v,{"class-name":"push-button",onClick:s[1]||(s[1]=a=>i.$emit("cancel"))},{default:t.withCtx(()=>[...s[4]||(s[4]=[t.createTextVNode(" Cancel ",-1)])]),_:1})])])]))}},[["__scopeId","data-v-d3c2feaa"]]),ou="",Ji={},qi={class:"container"},ts={class:"side"},es={class:"content"};function ns(e,n){return t.openBlock(),t.createElementBlock("div",qi,[t.createElementVNode("div",ts,[t.renderSlot(e.$slots,"side",{},void 0,!0)]),t.createElementVNode("div",es,[t.renderSlot(e.$slots,"content",{},void 0,!0)])])}const Rn=x(Ji,[["render",ns],["__scopeId","data-v-4b92cc95"]]),iu="",os={class:"wrapper"},is=["onClick"],ss=["value"],as=["value"],rs={class:"actions"},Pn=x({__name:"PureAnnotations",props:{annotations:{type:Array,required:!0}},emits:["addAnnotation","removeAnnotations","updateAnnotation"],setup(e,{emit:n}){const{fetchLabelSets:o,annotationTypes:i}=t.inject("config"),s=e,a=n,l=t.reactive([]);(()=>ct(this,null,function*(){l.push(...yield o())}))();const m=t.ref(null),c=(L,f)=>{m.value=f},M=(L,f)=>{a("updateAnnotation",L,G(G({},s.annotations[L]),f))},d=(L,f)=>{const T=s.annotations.indexOf(L);T<0||M(T,{name:f})},g=(L,f)=>{const T=s.annotations.indexOf(L);if(T<0)return;const S={type:f};f==="text"?S.values="":l.every(A=>A.source!==s.annotations[T].values)&&(S.values=l[0].source),M(T,S)},I=(L,f)=>{const T=s.annotations.indexOf(L);T<0||M(T,{values:f})},z=(L,f)=>{const T=s.annotations.indexOf(L);T<0||M(T,{display:f})};return(L,f)=>(t.openBlock(),t.createElementBlock("div",os,[f[5]||(f[5]=t.createElementVNode("h2",null,"Annotations",-1)),t.createVNode(bt,{id:"annotations"},{default:t.withCtx(()=>[f[2]||(f[2]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"Name"),t.createElementVNode("th",null,"Type"),t.createElementVNode("th",null,"Value"),t.createElementVNode("th",null,"Display")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.annotations,(T,S)=>(t.openBlock(),t.createElementBlock("tr",{key:S,class:t.normalizeClass({selected:m.value===S}),onClick:A=>c(A,S)},[t.createElementVNode("td",null,[t.createVNode(pt,{modelValue:T.name,"onUpdate:modelValue":A=>T.name=A,placeholder:"Enter annotation name",onBlur:A=>d(T,A.target.value),onKeyup:t.withKeys(A=>d(T,A.target.value),["enter"])},null,8,["modelValue","onUpdate:modelValue","onBlur","onKeyup"])]),t.createElementVNode("td",null,[t.createVNode(Ve,{modelValue:T.type,"onUpdate:modelValue":A=>T.type=A,onChange:A=>g(T,A.target.value)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i),A=>(t.openBlock(),t.createElementBlock("option",{key:`${T.name}${A}`,value:A},t.toDisplayString(A),9,ss))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),t.createElementVNode("td",null,[T.type!=="text"?(t.openBlock(),t.createBlock(Ve,{key:0,modelValue:T.values,"onUpdate:modelValue":A=>T.values=A,onChange:A=>I(T,A.target.value)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l,A=>(t.openBlock(),t.createElementBlock("option",{value:A.source,key:`${T.name}${A.source}`},t.toDisplayString(A.name),9,as))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])):t.createCommentVNode("",!0)]),t.createElementVNode("td",null,[t.createVNode(bn,{modelValue:T.display,"onUpdate:modelValue":A=>T.display=A,onChange:A=>z(T,A)},null,8,["modelValue","onUpdate:modelValue","onChange"])])],10,is))),128))])]),_:1}),t.createElementVNode("div",rs,[t.createVNode(v,{small:!0,onClick:f[0]||(f[0]=T=>L.$emit("addAnnotation")),title:"Add annotation"},{default:t.withCtx(()=>[...f[3]||(f[3]=[t.createTextVNode(" + ",-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:f[1]||(f[1]=T=>L.$emit("removeAnnotations",[m.value])),title:"Remove selected annotations",disabled:m.value==null},{default:t.withCtx(()=>[...f[4]||(f[4]=[t.createTextVNode(" - ",-1)])]),_:1},8,["disabled"])])]))}},[["__scopeId","data-v-99e79309"]]);class ls{constructor(n){this.baseURL=n}transformProjectFiles(n){var i;if(!n)return n;const o=Array.isArray((i=n.files)==null?void 0:i.list)?n.files.list:[];return _t(G({},n),{files:_t(G({},n.files),{list:o.map(s=>{if(typeof s=="string"){const a=s.lastIndexOf("/");return{source:s,name:a>0?s.substring(a+1):""}}return s})})})}fetch(n){return ct(this,null,function*(){return this.transformProjectFiles(yield(yield fetch(`${this.baseURL}/project/json/${n}`)).json())})}save(n){return ct(this,null,function*(){return(yield fetch(`${this.baseURL}/project/json/${n.shortname}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({data:n})})).json()})}delete(n){return ct(this,null,function*(){return(yield fetch(`${this.baseURL}/project/json/${n}`,{method:"DELETE",headers:{"Content-Type":"application/json"}})).json()})}}const _=t.reactive({project:null,loading:!0});function Lt(){const{baseURL:e,usernameField:n}=t.inject("config"),o=new ls(e),i=T=>{_.project=o.transformProjectFiles(T)},s=T=>ct(this,null,function*(){_.loading=!0,_.project=yield o.fetch(T),_.loading=!1}),a=T=>o.save(T),l=T=>o.delete(T),u=T=>{_.project&&(_.project=G(G({},_.project),T))},m=()=>{_.project&&_.project.collaborators.list.push({[n]:"",name:"",access:{collaborators:"none",annotations:"none",files:"none"}})},c=(T,S)=>{if(!_.project)return;const A=_.project.collaborators.list[T];_.project.collaborators.list[T]=G(G({},A),S)},M=T=>{_.project&&(_.project.collaborators.list=_.project.collaborators.list.filter(S=>!T.includes(_.project.collaborators.list.indexOf(S))))},d=()=>{_.project&&_.project.annotations.list.push({type:"text",name:"",values:"",display:!0})},g=(T,S)=>{if(!_.project)return;const A=_.project.annotations.list[T];_.project.annotations.list[T]=G(G({},A),S)},I=T=>{_.project&&(_.project.annotations.list=_.project.annotations.list.filter(S=>!T.includes(_.project.annotations.list.indexOf(S))))},z=()=>{_.project&&_.project.files.list.push({source:"",name:""})},L=(T,S)=>{if(!_.project)return;const A=_.project.files.list[T];_.project.files.list[T]=G(G({},A),S)},f=T=>{_.project&&(_.project.files.list=_.project.files.list.filter(S=>!T.includes(_.project.files.list.indexOf(S))))};return _t(G({},t.toRefs(_)),{setProject:i,fetchProject:s,saveProject:a,deleteProject:l,updateProject:u,addCollaborator:m,updateCollaborator:c,removeCollaborators:M,addAnnotation:d,updateAnnotation:g,removeAnnotations:I,addFile:z,updateFile:L,removeFiles:f})}const Bn={__name:"Annotations",setup(e){const{project:n,addAnnotation:o,updateAnnotation:i,removeAnnotations:s}=Lt();return n.value&&n.value.annotations&&n.value.annotations.list&&n.value.annotations.list.length===0&&o(),(a,l)=>t.unref(n)&&t.unref(n).annotations?(t.openBlock(),t.createBlock(Pn,{key:0,annotations:t.unref(n).annotations.list,onAddAnnotation:t.unref(o),onRemoveAnnotations:t.unref(s),onUpdateAnnotation:t.unref(i)},null,8,["annotations","onAddAnnotation","onRemoveAnnotations","onUpdateAnnotation"])):t.createCommentVNode("",!0)}};var cs=typeof global=="object"&&global&&global.Object===Object&&global;const Ms=cs;var us=typeof self=="object"&&self&&self.Object===Object&&self,ds=Ms||us||Function("return this")();const me=ds;var Ns=me.Symbol;const kt=Ns;var Qn=Object.prototype,gs=Qn.hasOwnProperty,ms=Qn.toString,Jt=kt?kt.toStringTag:void 0;function Is(e){var n=gs.call(e,Jt),o=e[Jt];try{e[Jt]=void 0;var i=!0}catch(a){}var s=ms.call(e);return i&&(n?e[Jt]=o:delete e[Jt]),s}var Ts=Object.prototype,ps=Ts.toString;function ys(e){return ps.call(e)}var js="[object Null]",fs="[object Undefined]",Zn=kt?kt.toStringTag:void 0;function Gn(e){return e==null?e===void 0?fs:js:Zn&&Zn in Object(e)?Is(e):ys(e)}function zs(e){return e!=null&&typeof e=="object"}var Ds="[object Symbol]";function Ie(e){return typeof e=="symbol"||zs(e)&&Gn(e)==Ds}function As(e,n){for(var o=-1,i=e==null?0:e.length,s=Array(i);++o<i;)s[o]=n(e[o],o,e);return s}var Ls=Array.isArray;const Qe=Ls;var hs=1/0,vn=kt?kt.prototype:void 0,$n=vn?vn.toString:void 0;function Wn(e){if(typeof e=="string")return e;if(Qe(e))return As(e,Wn)+"";if(Ie(e))return $n?$n.call(e):"";var n=e+"";return n=="0"&&1/e==-hs?"-0":n}var Cs=/\s/;function Es(e){for(var n=e.length;n--&&Cs.test(e.charAt(n)););return n}var Ss=/^\s+/;function xs(e){return e&&e.slice(0,Es(e)+1).replace(Ss,"")}function qt(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var Fn=0/0,Os=/^[-+]0x[0-9a-f]+$/i,ws=/^0b[01]+$/i,_s=/^0o[0-7]+$/i,bs=parseInt;function Hn(e){if(typeof e=="number")return e;if(Ie(e))return Fn;if(qt(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=qt(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=xs(e);var o=ws.test(e);return o||_s.test(e)?bs(e.slice(2),o?2:8):Os.test(e)?Fn:+e}var ks="[object AsyncFunction]",Ys="[object Function]",Us="[object GeneratorFunction]",Vs="[object Proxy]";function Rs(e){if(!qt(e))return!1;var n=Gn(e);return n==Ys||n==Us||n==ks||n==Vs}var Ps=me["__core-js_shared__"];const Ze=Ps;var Xn=function(){var e=/[^.]+$/.exec(Ze&&Ze.keys&&Ze.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Bs(e){return!!Xn&&Xn in e}var Qs=Function.prototype,Zs=Qs.toString;function Gs(e){if(e!=null){try{return Zs.call(e)}catch(n){}try{return e+""}catch(n){}}return""}var vs=/[\\^$.*+?()[\]{}|]/g,$s=/^\[object .+?Constructor\]$/,Ws=Function.prototype,Fs=Object.prototype,Hs=Ws.toString,Xs=Fs.hasOwnProperty,Ks=RegExp("^"+Hs.call(Xs).replace(vs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Js(e){if(!qt(e)||Bs(e))return!1;var n=Rs(e)?Ks:$s;return n.test(Gs(e))}function qs(e,n){return e==null?void 0:e[n]}function Kn(e,n){var o=qs(e,n);return Js(o)?o:void 0}function ta(e,n){return e===n||e!==e&&n!==n}var ea=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,na=/^\w*$/;function oa(e,n){if(Qe(e))return!1;var o=typeof e;return o=="number"||o=="symbol"||o=="boolean"||e==null||Ie(e)?!0:na.test(e)||!ea.test(e)||n!=null&&e in Object(n)}var ia=Kn(Object,"create");const te=ia;function sa(){this.__data__=te?te(null):{},this.size=0}function aa(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}var ra="__lodash_hash_undefined__",la=Object.prototype,ca=la.hasOwnProperty;function Ma(e){var n=this.__data__;if(te){var o=n[e];return o===ra?void 0:o}return ca.call(n,e)?n[e]:void 0}var ua=Object.prototype,da=ua.hasOwnProperty;function Na(e){var n=this.__data__;return te?n[e]!==void 0:da.call(n,e)}var ga="__lodash_hash_undefined__";function ma(e,n){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=te&&n===void 0?ga:n,this}function ht(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var i=e[n];this.set(i[0],i[1])}}ht.prototype.clear=sa,ht.prototype.delete=aa,ht.prototype.get=Ma,ht.prototype.has=Na,ht.prototype.set=ma;function Ia(){this.__data__=[],this.size=0}function Te(e,n){for(var o=e.length;o--;)if(ta(e[o][0],n))return o;return-1}var Ta=Array.prototype,pa=Ta.splice;function ya(e){var n=this.__data__,o=Te(n,e);if(o<0)return!1;var i=n.length-1;return o==i?n.pop():pa.call(n,o,1),--this.size,!0}function ja(e){var n=this.__data__,o=Te(n,e);return o<0?void 0:n[o][1]}function fa(e){return Te(this.__data__,e)>-1}function za(e,n){var o=this.__data__,i=Te(o,e);return i<0?(++this.size,o.push([e,n])):o[i][1]=n,this}function Yt(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var i=e[n];this.set(i[0],i[1])}}Yt.prototype.clear=Ia,Yt.prototype.delete=ya,Yt.prototype.get=ja,Yt.prototype.has=fa,Yt.prototype.set=za;var Da=Kn(me,"Map");const Aa=Da;function La(){this.size=0,this.__data__={hash:new ht,map:new(Aa||Yt),string:new ht}}function ha(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}function pe(e,n){var o=e.__data__;return ha(n)?o[typeof n=="string"?"string":"hash"]:o.map}function Ca(e){var n=pe(this,e).delete(e);return this.size-=n?1:0,n}function Ea(e){return pe(this,e).get(e)}function Sa(e){return pe(this,e).has(e)}function xa(e,n){var o=pe(this,e),i=o.size;return o.set(e,n),this.size+=o.size==i?0:1,this}function Ct(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var i=e[n];this.set(i[0],i[1])}}Ct.prototype.clear=La,Ct.prototype.delete=Ca,Ct.prototype.get=Ea,Ct.prototype.has=Sa,Ct.prototype.set=xa;var Oa="Expected a function";function Ge(e,n){if(typeof e!="function"||n!=null&&typeof n!="function")throw new TypeError(Oa);var o=function(){var i=arguments,s=n?n.apply(this,i):i[0],a=o.cache;if(a.has(s))return a.get(s);var l=e.apply(this,i);return o.cache=a.set(s,l)||a,l};return o.cache=new(Ge.Cache||Ct),o}Ge.Cache=Ct;var wa=500;function _a(e){var n=Ge(e,function(i){return o.size===wa&&o.clear(),i}),o=n.cache;return n}var ba=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ka=/\\(\\)?/g,Ya=_a(function(e){var n=[];return e.charCodeAt(0)===46&&n.push(""),e.replace(ba,function(o,i,s,a){n.push(s?a.replace(ka,"$1"):i||o)}),n});const Ua=Ya;function Va(e){return e==null?"":Wn(e)}function Ra(e,n){return Qe(e)?e:oa(e,n)?[e]:Ua(Va(e))}var Pa=1/0;function Ba(e){if(typeof e=="string"||Ie(e))return e;var n=e+"";return n=="0"&&1/e==-Pa?"-0":n}function Qa(e,n){n=Ra(n,e);for(var o=0,i=n.length;e!=null&&o<i;)e=e[Ba(n[o++])];return o&&o==i?e:void 0}function Jn(e,n,o){var i=e==null?void 0:Qa(e,n);return i===void 0?o:i}var Za=function(){return me.Date.now()};const ve=Za;var Ga="Expected a function",va=Math.max,$a=Math.min;function Wa(e,n,o){var i,s,a,l,u,m,c=0,M=!1,d=!1,g=!0;if(typeof e!="function")throw new TypeError(Ga);n=Hn(n)||0,qt(o)&&(M=!!o.leading,d="maxWait"in o,a=d?va(Hn(o.maxWait)||0,n):a,g="trailing"in o?!!o.trailing:g);function I(Y){var U=i,q=s;return i=s=void 0,c=Y,l=e.apply(q,U),l}function z(Y){return c=Y,u=setTimeout(T,n),M?I(Y):l}function L(Y){var U=Y-m,q=Y-c,jt=n-U;return d?$a(jt,a-q):jt}function f(Y){var U=Y-m,q=Y-c;return m===void 0||U>=n||U<0||d&&q>=a}function T(){var Y=ve();if(f(Y))return S(Y);u=setTimeout(T,L(Y))}function S(Y){return u=void 0,g&&i?I(Y):(i=s=void 0,l)}function A(){u!==void 0&&clearTimeout(u),c=0,i=m=s=u=void 0}function C(){return u===void 0?l:S(ve())}function Z(){var Y=ve(),U=f(Y);if(i=arguments,s=this,m=Y,U){if(u===void 0)return z(m);if(d)return clearTimeout(u),u=setTimeout(T,n),I(m)}return u===void 0&&(u=setTimeout(T,n)),l}return Z.cancel=A,Z.flush=C,Z}const au="",Fa=["data-level"],Ha=["disabled","title"],Xa=["disabled","title"],Ka=["disabled","title"],Ja=["disabled","title"],ye=x({__name:"Access",props:{collaborator:{type:Object,required:!0},type:{type:String,required:!0},readonly:{type:Boolean,default:!1}},emits:["updateAccess"],setup(e,{emit:n}){const o=e,i=n,s=a=>{o.readonly||i("updateAccess",o.collaborator,o.type,a)};return(a,l)=>(t.openBlock(),t.createElementBlock("div",{class:"access","data-level":["none","view","edit","add","remove"].indexOf(e.collaborator.access[e.type])},[t.createElementVNode("button",{small:!0,onClick:l[0]||(l[0]=u=>s(1)),class:"view",disabled:e.readonly,title:`view ${e.type}`},null,8,Ha),t.createElementVNode("button",{small:!0,onClick:l[1]||(l[1]=u=>s(2)),class:"edit",disabled:e.readonly,title:`edit ${e.type}`},null,8,Xa),t.createElementVNode("button",{small:!0,onClick:l[2]||(l[2]=u=>s(3)),class:"add",disabled:e.readonly,title:`add ${e.type}`},null,8,Ka),t.createElementVNode("button",{small:!0,onClick:l[3]||(l[3]=u=>s(4)),class:"remove",disabled:e.readonly,title:`remove ${e.type}`},null,8,Ja)],8,Fa))}},[["__scopeId","data-v-70a16ce1"]]),J=class J{constructor(n){At(this,"numericalLevel",0);const o=J.values.indexOf(n);this.numericalLevel=Math.max(0,o)}static fromInt(n){return new J(this.values[n])}toInt(){return this.numericalLevel}toString(){return J.values[this.numericalLevel]}isGreaterThan(n){return this.toInt()>n.toInt()}isGreaterThanOrEqualTo(n){return this.toInt()>=n.toInt()}isLesserThan(n){return this.toInt()<n.toInt()}isLesserThanOrEqualTo(n){return this.toInt()<=n.toInt()}isEqualTo(n){return this.toInt()===n.toInt()}};At(J,"values",["none","view","edit","add","remove"]),At(J,"NONE",new J("none")),At(J,"VIEW",new J("view")),At(J,"EDIT",new J("edit")),At(J,"ADD",new J("add")),At(J,"REMOVE",new J("remove"));let je=J;const lu="",qa={class:"wrapper"},tr=["onClick"],er={style:{position:"relative"}},nr={class:"actions"},qn=x({__name:"PureCollaborators",props:{collaborators:{type:Array,required:!0},usersFound:{type:Array,default:()=>[]}},emits:["addCollaborator","removeCollaborators","updateCollaborator","searchUsers"],setup(e,{emit:n}){const o=e,i=n,{usernameField:s}=t.inject("config"),a=Wa(g=>{i("searchUsers",g)},300),l=t.ref(null),u=(g,I)=>{l.value=I},m=(g,I)=>{i("updateCollaborator",g,G(G({},o.collaborators[g]),I))},c=(g,I,z)=>{const L=o.collaborators.indexOf(g);if(L<0)return;const f=new je(o.collaborators[L].access[I]).toInt();let T=z;f===T&&(T-=1),m(L,{access:_t(G({},o.collaborators[L].access),{[I]:je.fromInt(T).toString()})})},M=(g,I)=>{const z=o.collaborators.indexOf(g);z<0||m(z,{name:I})},d=(g,I)=>{m(I,{[s]:g[s],userID:g[s],name:g.name})};return(g,I)=>(t.openBlock(),t.createElementBlock("div",qa,[I[5]||(I[5]=t.createElementVNode("h2",null,"Access",-1)),t.createVNode(bt,{id:"access"},{default:t.withCtx(()=>[I[2]||(I[2]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"User Name"),t.createElementVNode("th",null,"Name"),t.createElementVNode("th",null,"Collaborators"),t.createElementVNode("th",null,"Annotations"),t.createElementVNode("th",null,"Files")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.collaborators,(z,L)=>(t.openBlock(),t.createElementBlock("tr",{key:z.userID,class:t.normalizeClass({selected:l.value===L}),onClick:f=>u(f,L)},[t.createElementVNode("td",er,[t.createVNode(wn,{onInput:t.unref(a),onSelect:d,items:o.usersFound,"is-async":!0,"extra-select-args":[o.collaborators.indexOf(z)],"default-value":z[t.unref(s)]||z.userID,disabled:z[t.unref(s)]==="anyone","extract-result-text":f=>f[t.unref(s)],"aria-label":"Search by username"},null,8,["onInput","items","extra-select-args","default-value","disabled","extract-result-text"])]),t.createElementVNode("td",null,[t.createVNode(pt,{modelValue:z.name,"onUpdate:modelValue":f=>z.name=f,placeholder:"User Name",disabled:z[t.unref(s)]==="anyone",onBlur:f=>M(z,f.target.value),onKeyup:t.withKeys(f=>M(z,f.target.value),["enter"])},null,8,["modelValue","onUpdate:modelValue","disabled","onBlur","onKeyup"])]),t.createElementVNode("td",null,[t.createVNode(ye,{type:"collaborators",collaborator:z,onUpdateAccess:c},null,8,["collaborator"])]),t.createElementVNode("td",null,[t.createVNode(ye,{type:"annotations",collaborator:z,onUpdateAccess:c},null,8,["collaborator"])]),t.createElementVNode("td",null,[t.createVNode(ye,{type:"files",collaborator:z,onUpdateAccess:c},null,8,["collaborator"])])],10,tr))),128))])]),_:1}),t.createElementVNode("div",nr,[t.createVNode(v,{small:!0,onClick:I[0]||(I[0]=z=>g.$emit("addCollaborator")),title:"Add collaborator"},{default:t.withCtx(()=>[...I[3]||(I[3]=[t.createTextVNode(" + ",-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:I[1]||(I[1]=z=>{g.$emit("removeCollaborators",[l.value]),l.value=null}),title:"Remove selected collaborators",disabled:l.value==null||e.collaborators[l.value].username==="anyone"||e.collaborators[l.value].userID==="anyone"},{default:t.withCtx(()=>[...I[4]||(I[4]=[t.createTextVNode(" - ",-1)])]),_:1},8,["disabled"])])]))}},[["__scopeId","data-v-4809f467"]]),fe=t.reactive([]);function or(){const{userSearchURL:e}=t.inject("config");return{usersFound:fe,fetchUsers:o=>ct(this,null,function*(){fe.splice(0,fe.length);const i=yield(yield fetch(`${e}${o}`)).json();fe.push(...i)})}}const to={__name:"Collaborators",setup(e){const{project:n,addCollaborator:o,updateCollaborator:i,removeCollaborators:s}=Lt(),{usersFound:a,fetchUsers:l}=or();return(u,m)=>t.unref(n)&&t.unref(n).collaborators?(t.openBlock(),t.createBlock(qn,{key:0,collaborators:t.unref(n).collaborators.list,"users-found":t.unref(a),onAddCollaborator:t.unref(o),onRemoveCollaborators:t.unref(s),onUpdateCollaborator:t.unref(i),onSearchUsers:t.unref(l)},null,8,["collaborators","users-found","onAddCollaborator","onRemoveCollaborators","onUpdateCollaborator","onSearchUsers"])):t.createCommentVNode("",!0)}},ir="data:image/svg+xml;base64,PHN2ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0MzguNTMzIDQzOC41MzMiIGhlaWdodD0iNDM4LjUzMyIgdmlld0JveD0iMCAwIDQzOC41MzMgNDM4LjUzMyIgd2lkdGg9IjQzOC41MzMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI2ZmZiIgdHJhbnNmb3JtPSJtYXRyaXgoLjcxMTE2MTExIDAgMCAuNzExMTYxMTEgODEuMDg2NzE2IDI1LjY3MTMwNykiPjxwYXRoIGQ9Im0xMTQuMDA2MzYgMTgzLjM5MzI5aDQ4LjExNTQ2djkxLjIwODljMCAyLjQxOTQzLjc1NjY2IDQuNDA0MTcgMi4yNTg2IDUuOTU5NjUgMS40OTU3OCAxLjU1MDk1IDMuNDE5MDggMi4zMzA1IDUuNzU1OCAyLjMzMDVoNDguMTI0MjFjMi4zMzg0OSAwIDQuMjYwODktLjc3OTU1IDUuNzY0NTktMi4zMzA1IDEuNTA0NTYtMS41NTYzOCAyLjI1NTk2LTMuNTQwMjIgMi4yNTU5Ni01Ljk1OTY1di05MS4yMDUyN2g0OC4xMjA3MWMzLjY3NDUyIDAgNi4xODE1My0xLjcyODgxIDcuNTE5MzItNS4xODEgMS4zMzc3OS0zLjI4NjExLjc0OTY2LTYuMzA0NTEtMS43NTQ3My05LjA3MTUybC04MC4xOTk0My04Mi45MTE0OTNjLTEuODM5ODctMS41NTI3NTktMy43NTk2NS0yLjMyOTU5Ni01Ljc2NDU3LTIuMzI5NTk2LTIuMDAyMyAwLTMuOTI0Ny43NzY4MzctNS43NjYzMyAyLjMyOTU5NmwtNzkuOTQ4MzggODIuNjUwMTMzYy0xLjY2OTU5IDIuMDcxODUtMi41MDI2MyA0LjE1Mjc4LTIuNTAyNjMgNi4yMTgyOSAwIDIuNDE1ODEuNzUwNTMgNC40MDQxNyAyLjI1ODYxIDUuOTYyMzcgMS41MDAxOCAxLjU1MzY3IDMuNDIyNTcgMi4zMjk1OSA1Ljc2MjgxIDIuMzI5NTl6Ii8+PHBhdGggZD0ibTM2LjIzNTI0NCAzMTkuMjQ3Mzl2ODUuMDUxNDRoMzE2LjEzMjgxNnYtODUuMDUxNDRoLTM2LjkwODkydjQ4LjE0MjUyaC0yNDIuMzE0OTcydi00OC4xNDI1MnoiLz48L2c+PC9zdmc+",sr="data:image/svg+xml;base64,PHN2ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0MzguNTMzIDQzOC41MzMiIGhlaWdodD0iNDM4LjUzMyIgdmlld0JveD0iMCAwIDQzOC41MzMgNDM4LjUzMyIgd2lkdGg9IjQzOC41MzMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTE2Mi4xNjM2MSAxNTYuMDk5OTRoMzQuMjE3ODR2LTY0Ljg2NDIzMWMwLTEuNzIwNi41MzgxMS0zLjEzMjA3IDEuNjA2MjMtNC4yMzgyNyAxLjA2Mzc0LTEuMTAyOTcgMi40MzE1MS0xLjY1NzM2IDQuMDkzMy0xLjY1NzM2aDM0LjIyNDA3YzEuNjYzMDQgMCAzLjAzMDE3LjU1NDM5IDQuMDk5NTUgMS42NTczNiAxLjA2OTk4IDEuMTA2ODQgMS42MDQzNSAyLjUxNzY3IDEuNjA0MzUgNC4yMzgyN3Y2NC44NjE2NTFoMzQuMjIxNThjMi42MTMxNyAwIDQuMzk2MDYgMS4yMjk0NiA1LjM0NzQ0IDMuNjg0NTIuOTUxMzkgMi4zMzY5Ni41MzMxMyA0LjQ4MzUyLTEuMjQ3ODkgNi40NTEzMWwtNTcuMDM0NzIgNTguOTYzNDNjLTEuMzA4NDQgMS4xMDQyNi0yLjY3MzcxIDEuNjU2NzItNC4wOTk1MyAxLjY1NjcyLTEuNDIzOTYgMC0yLjc5MTEtLjU1MjQ2LTQuMTAwNzktMS42NTY3MmwtNTYuODU2MTgtNTguNzc3NTZjLTEuMTg3MzUtMS40NzM0Mi0xLjc3OTc4LTIuOTUzMjktMS43Nzk3OC00LjQyMjIgMC0xLjcxODAzLjUzMzc1LTMuMTMyMDggMS42MDYyNC00LjI0MDIxIDEuMDY2ODctMS4xMDQ5MSAyLjQzNC0xLjY1NjcxIDQuMDk4MjktMS42NTY3MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJtMTA2Ljg1NTgxIDI1Mi43MDc2NHY2MC40ODUyN2gyMjQuODIxMzd2LTYwLjQ4NTI3aC0yNi4yNDgxOXYzNC4yMzcwOGgtMTcyLjMyNDk5di0zNC4yMzcwOHoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",Mu="",ar={class:"wrapper"},rr=["onClick"],lr=["onBlur","onKeyup"],cr={class:"actions"},eo=x({__name:"PureFiles",props:{files:{type:Array,required:!0}},emits:["addFile","removeFiles","updateFile","importCsv","downloadCsv"],setup(e,{emit:n}){const o=e,i=n,s=(c,M)=>{i("updateFile",c,G(G({},o.files[c]),M))},a=t.ref(null),l=(c,M)=>{a.value=M},u=(c,M)=>{const d=o.files.indexOf(c);d<0||s(d,{name:M})},m=(c,M)=>{const d=o.files.indexOf(c);d<0||s(d,{source:M})};return(c,M)=>(t.openBlock(),t.createElementBlock("div",ar,[M[9]||(M[9]=t.createElementVNode("h2",null,"Files",-1)),t.createVNode(bt,{id:"files"},{default:t.withCtx(()=>[M[4]||(M[4]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"URL"),t.createElementVNode("th",null,"Name")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.files,(d,g)=>(t.openBlock(),t.createElementBlock("tr",{key:d.source,class:t.normalizeClass({selected:a.value===g}),onClick:I=>l(I,g)},[t.createElementVNode("td",null,[t.createElementVNode("span",{contenteditable:"true",placeholder:"File URL",onBlur:I=>m(d,I.currentTarget.textContent),onKeyup:t.withKeys(I=>m(d,I.currentTarget.textContent),["enter"])},t.toDisplayString(d.source),41,lr)]),t.createElementVNode("td",null,[t.createVNode(pt,{modelValue:d.name,"onUpdate:modelValue":I=>d.name=I,placeholder:"File Name",onBlur:I=>u(d,I.target.value),onKeyup:t.withKeys(I=>u(d,I.target.value),["enter"])},null,8,["modelValue","onUpdate:modelValue","onBlur","onKeyup"])])],10,rr))),128))])]),_:1}),t.createElementVNode("div",cr,[t.createVNode(v,{small:!0,onClick:M[0]||(M[0]=d=>c.$emit("importCsv")),title:"Upload CSV"},{default:t.withCtx(()=>[...M[5]||(M[5]=[t.createElementVNode("img",{src:ir,alt:"Import CSV"},null,-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:M[1]||(M[1]=d=>c.$emit("downloadCsv")),title:"Download CSV"},{default:t.withCtx(()=>[...M[6]||(M[6]=[t.createElementVNode("img",{src:sr,alt:"Download CSV"},null,-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:M[2]||(M[2]=d=>c.$emit("addFile")),title:"Add file"},{default:t.withCtx(()=>[...M[7]||(M[7]=[t.createTextVNode(" + ",-1)])]),_:1}),t.createVNode(v,{small:!0,onClick:M[3]||(M[3]=d=>c.$emit("removeFiles",[a.value])),title:"Remove selected files",disabled:a.value==null},{default:t.withCtx(()=>[...M[8]||(M[8]=[t.createTextVNode(" - ",-1)])]),_:1},8,["disabled"])])]))}},[["__scopeId","data-v-773d9ed6"]]),no={__name:"Files",setup(e){const{project:n,addFile:o,updateFile:i,removeFiles:s}=Lt(),a=t.ref(!1),l=t.ref([]),u=()=>{const M=document.createElement("input");M.type="file",M.setAttribute("id","importFilesInput"),M.style.display="none",document.querySelector("body").appendChild(M),M.onchange=function(){const[d]=this.files,g=new FileReader;g.onload=function(I){document.querySelector("body").removeChild(M);const{result:z}=I.target,L=z.split(`
|
|
2
2
|
`);l.value=L.map(f=>{const[T,S]=f.split(/[ ]*,[ ]*/);return{source:T,name:S}}),a.value=!0},g.readAsText(d)},M.click()},m=()=>{const M=prompt("File name",`${n.value.shortname}`);if(M===null)return;const d=n.value.files.list.map(z=>`${z.source},${z.name}`).join(`
|
|
3
3
|
`),g="data:text/ascii;charset=utf-8,"+encodeURIComponent(d),I=document.createElement("a");I.href=g,I.download=M+".csv",document.body.appendChild(I),I.click(),document.body.removeChild(I)},c=M=>{M.forEach(d=>{if(d.source.length<10){console.log("Too short to be an url:",d.source);return}const g=n.value.files.list.find(I=>I.source===d.source);g?g.name===""&&(g.name=d.name):n.value.files.list.push(d)}),a.value=!1};return(M,d)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[a.value?(t.openBlock(),t.createBlock(Vn,{key:0,files:l.value,onImport:c,onCancel:d[0]||(d[0]=g=>a.value=!1)},null,8,["files"])):t.createCommentVNode("",!0),t.unref(n)&&t.unref(n).files?(t.openBlock(),t.createBlock(eo,{key:1,files:t.unref(n).files.list,onAddFile:t.unref(o),onRemoveFiles:t.unref(s),onUpdateFile:t.unref(i),onImportCsv:u,onDownloadCsv:m},null,8,["files","onAddFile","onRemoveFiles","onUpdateFile"])):t.createCommentVNode("",!0)],64))}};function gt(e,n,o){return parseInt(e.substr(n,o),16)}function oo(e){return e|=0,e<0?"00":e<16?"0"+e.toString(16):e<256?e.toString(16):"ff"}function $e(e,n,o){return o=o<0?o+6:o>6?o-6:o,oo(255*(o<1?e+(n-e)*o:o<3?n:o<4?e+(n-e)*(4-o):e))}function Mr(e){if(/^#[0-9a-f]{3,8}$/i.test(e)){let n;const o=e.length;if(o<6){const i=e[1],s=e[2],a=e[3],l=e[4]||"";n="#"+i+i+s+s+a+a+l+l}return(o==7||o>8)&&(n=e),n}}function io(e){const n=gt(e,7,2);let o;if(isNaN(n))o=e;else{const i=gt(e,1,2),s=gt(e,3,2),a=gt(e,5,2);o="rgba("+i+","+s+","+a+","+(n/255).toFixed(2)+")"}return o}function ur(e,n,o){let i;if(n==0){const s=oo(o*255);i=s+s+s}else{const s=o<=.5?o*(n+1):o+n-o*n,a=o*2-s;i=$e(a,s,e*6+2)+$e(a,s,e*6)+$e(a,s,e*6-2)}return"#"+i}function ee(e,n,o){const i=[.55,.5,.5,.46,.6,.55,.55],s=i[e*6+.5|0];return o=o<.5?o*s*2:s+(o-.5)*(1-s)*2,ur(e,n,o)}const dr=typeof window!="undefined"?window:typeof self!="undefined"?self:typeof global!="undefined"?global:{},so={V:"jdenticon_config",n:"config"};var Nr={};function gr(e,n){const o=typeof e=="object"&&e||Nr[so.n]||dr[so.V]||{},i=o.lightness||{},s=o.saturation||{},a="color"in s?s.color:s,l=s.grayscale,u=o.backColor,m=o.padding;function c(d,g){let I=i[d];return I&&I.length>1||(I=g),function(z){return z=I[0]+z*(I[1]-I[0]),z<0?0:z>1?1:z}}function M(d){const g=o.hues;let I;return g&&g.length>0&&(I=g[0|.999*d*g.length]),typeof I=="number"?(I/360%1+1)%1:d}return{W:M,o:typeof a=="number"?a:.5,D:typeof l=="number"?l:0,p:c("color",[.4,.8]),F:c("grayscale",[.3,.9]),G:Mr(u),X:typeof e=="number"?e:typeof m=="number"?m:n}}class ze{constructor(n,o){this.x=n,this.y=o}}class ao{constructor(n,o,i,s){this.q=n,this.t=o,this.H=i,this.Y=s}I(n,o,i,s){const a=this.q+this.H,l=this.t+this.H,u=this.Y;return u===1?new ze(a-o-(s||0),this.t+n):u===2?new ze(a-n-(i||0),l-o-(s||0)):u===3?new ze(this.q+o,l-n-(i||0)):new ze(this.q+n,this.t+o)}}const mr=new ao(0,0,0,0);class Ir{constructor(n){this.J=n,this.u=mr}g(n,o){const i=o?-2:2,s=[];for(let a=o?n.length-2:0;a<n.length&&a>=0;a+=i)s.push(this.u.I(n[a],n[a+1]));this.J.g(s)}h(n,o,i,s){const a=this.u.I(n,o,i,i);this.J.h(a,i,s)}i(n,o,i,s,a){this.g([n,o,n+i,o,n+i,o+s,n,o+s],a)}j(n,o,i,s,a,l){const u=[n+i,o,n+i,o+s,n,o+s,n,o];u.splice((a||0)%4*2,2),this.g(u,l)}K(n,o,i,s,a){this.g([n+i/2,o,n+i,o+s/2,n+i/2,o+s,n,o+s/2],a)}}function Tr(e,n,o,i){e=e%14;let s,a,l,u,m,c;e?e==1?(l=0|o*.5,u=0|o*.8,n.j(o-l,0,l,u,2)):e==2?(l=0|o/3,n.i(l,l,o-l,o-l)):e==3?(m=o*.1,c=o<6?1:o<8?2:0|o*.25,m=m>1?0|m:m>.5?1:m,n.i(c,c,o-m-c,o-m-c)):e==4?(a=0|o*.15,l=0|o*.5,n.h(o-l-a,o-l-a,l)):e==5?(m=o*.1,c=m*4,c>3&&(c=0|c),n.i(0,0,o,o),n.g([c,c,o-m,c,c+(o-c-m)/2,o-m],!0)):e==6?n.g([0,0,o,0,o,o*.7,o*.4,o*.4,o*.7,o,0,o]):e==7?n.j(o/2,o/2,o/2,o/2,3):e==8?(n.i(0,0,o,o/2),n.i(0,o/2,o/2,o/2),n.j(o/2,o/2,o/2,o/2,1)):e==9?(m=o*.14,c=o<4?1:o<6?2:0|o*.35,m=o<8?m:0|m,n.i(0,0,o,o),n.i(c,c,o-c-m,o-c-m,!0)):e==10?(m=o*.12,c=m*3,n.i(0,0,o,o),n.h(c,c,o-m-c,!0)):e==11?n.j(o/2,o/2,o/2,o/2,3):e==12?(a=o*.25,n.i(0,0,o,o),n.K(a,a,o-a,o-a,!0)):!i&&(a=o*.4,l=o*1.2,n.h(a,a,l)):(s=o*.42,n.g([0,0,o,0,o,o-s*2,o-s,o,0,o]))}function ro(e,n,o){e=e%4;let i;e?e==1?n.j(0,o/2,o,o/2,0):e==2?n.K(0,0,o,o):(i=o/6,n.h(i,i,o-2*i)):n.j(0,0,o,o,0)}function pr(e,n){return e=n.W(e),[ee(e,n.D,n.F(0)),ee(e,n.o,n.p(.5)),ee(e,n.D,n.F(1)),ee(e,n.o,n.p(1)),ee(e,n.o,n.p(0))]}function yr(e,n,o){const i=gr(o,.08);i.G&&e.m(i.G);let s=e.k;const a=.5+s*i.X|0;s-=a*2;const l=new Ir(e),u=0|s/4,m=0|a+s/2-u*2,c=0|a+s/2-u*2;function M(f,T,S,A,C){const Z=gt(n,S,1);let Y=A?gt(n,A,1):0;e.L(g[I[f]]);for(let U=0;U<C.length;U++)l.u=new ao(m+C[U][0]*u,c+C[U][1]*u,u,Y++%4),T(Z,l,u,U);e.M()}const d=gt(n,-7)/268435455,g=pr(d,i),I=[];let z;function L(f){if(f.indexOf(z)>=0){for(let T=0;T<f.length;T++)if(I.indexOf(f[T])>=0)return!0}}for(let f=0;f<3;f++)z=gt(n,8+f,1)%g.length,(L([0,4])||L([2,3]))&&(z=1),I.push(z);M(0,ro,2,3,[[1,0],[2,0],[2,3],[1,3],[0,1],[3,1],[3,2],[0,2]]),M(1,ro,4,5,[[0,0],[3,0],[3,3],[0,3]]),M(2,Tr,1,null,[[1,1],[2,1],[2,2],[1,2]]),e.finish()}function jr(e){var i=0,s=0,a=encodeURI(e)+"%80",l=[],u,m=[],c=1732584193,M=4023233417,d=~c,g=~M,I=3285377520,z=[c,M,d,g,I],L=0,f="";function T(S,A){return S<<A|S>>>32-A}for(;i<a.length;s++)l[s>>2]=l[s>>2]|(a[i]=="%"?parseInt(a.substring(i+1,i+=3),16):a.charCodeAt(i++))<<(3-(s&3))*8;for(u=((s+7>>6)+1)*16,l[u-1]=s*8-8;L<u;L+=16){for(i=0;i<80;i++)s=T(c,5)+I+(i<20?(M&d^~M&g)+1518500249:i<40?(M^d^g)+1859775393:i<60?(M&d^M&g^d&g)+2400959708:(M^d^g)+3395469782)+(m[i]=i<16?l[L+i]|0:T(m[i-3]^m[i-8]^m[i-14]^m[i-16],1)),I=g,g=d,d=T(M,30),M=c,c=s;z[0]=c=z[0]+c|0,z[1]=M=z[1]+M|0,z[2]=d=z[2]+d|0,z[3]=g=z[3]+g|0,z[4]=I=z[4]+I|0}for(i=0;i<40;i++)f+=(z[i>>3]>>>(7-(i&7))*4&15).toString(16);return f}function lo(e){return/^[0-9a-f]{11,}$/i.test(e)&&e}function co(e){return jr(e==null?"":""+e)}class fr{constructor(n,o){const i=n.canvas,s=i.width,a=i.height;n.save(),o||(o=Math.min(s,a),n.translate((s-o)/2|0,(a-o)/2|0)),this.l=n,this.k=o,n.clearRect(0,0,o,o)}m(n){const o=this.l,i=this.k;o.fillStyle=io(n),o.fillRect(0,0,i,i)}L(n){const o=this.l;o.fillStyle=io(n),o.beginPath()}M(){this.l.fill()}g(n){const o=this.l;o.moveTo(n[0].x,n[0].y);for(let i=1;i<n.length;i++)o.lineTo(n[i].x,n[i].y);o.closePath()}h(n,o,i){const s=this.l,a=o/2;s.moveTo(n.x+a,n.y+a),s.arc(n.x+a,n.y+a,a,0,Math.PI*2,i),s.closePath()}finish(){this.l.restore()}}const Mo=1,zr=2,We={Z:"data-jdenticon-hash",N:"data-jdenticon-value"},Dr="jdenticonRendered",uo=typeof document!="undefined"&&document.querySelectorAll.bind(document);function Ar(e){if(e){const n=e.tagName;if(/^svg$/i.test(n))return Mo;if(/^canvas$/i.test(n)&&"getContext"in e)return zr}}function Ut(e){return(e*10+.5|0)/10}class Lr{constructor(){this.v=""}g(n){let o="";for(let i=0;i<n.length;i++)o+=(i?"L":"M")+Ut(n[i].x)+" "+Ut(n[i].y);this.v+=o+"Z"}h(n,o,i){const s=i?0:1,a=Ut(o/2),l=Ut(o),u="a"+a+","+a+" 0 1,"+s+" ";this.v+="M"+Ut(n.x)+" "+Ut(n.y+o/2)+u+l+",0"+u+-l+",0"}}class hr{constructor(n){this.A,this.B={},this.O=n,this.k=n.k}m(n){const o=/^(#......)(..)?/.exec(n),i=o[2]?gt(o[2],0)/255:1;this.O.m(o[1],i)}L(n){this.A=this.B[n]||(this.B[n]=new Lr)}M(){}g(n){this.A.g(n)}h(n,o,i){this.A.h(n,o,i)}finish(){const n=this.B;for(let o in n)n.hasOwnProperty(o)&&this.O.P(o,n[o].v)}}const ne={R:"http://www.w3.org/2000/svg",S:"width",T:"height"};function No(e,n,...o){const i=document.createElementNS(ne.R,n);for(let s=0;s+1<o.length;s+=2)i.setAttribute(o[s],o[s+1]);e.appendChild(i)}class Cr{constructor(n){const o=this.k=Math.min(Number(n.getAttribute(ne.S))||100,Number(n.getAttribute(ne.T))||100);for(this.U=n;n.firstChild;)n.removeChild(n.firstChild);n.setAttribute("viewBox","0 0 "+o+" "+o),n.setAttribute("preserveAspectRatio","xMidYMid meet")}m(n,o){o&&No(this.U,"rect",ne.S,"100%",ne.T,"100%","fill",n,"opacity",o)}P(n,o){No(this.U,"path","fill",n,"d",o)}}function Er(e,n,o){go(e,n,o,function(i,s){if(s)return s==Mo?new hr(new Cr(i)):new fr(i.getContext("2d"))})}function go(e,n,o,i){if(typeof e=="string"){if(uo){const l=uo(e);for(let u=0;u<l.length;u++)go(l[u],n,o,i)}return}const s=lo(n)||n!=null&&co(n)||lo(e.getAttribute(We.Z))||e.hasAttribute(We.N)&&co(e.getAttribute(We.N));if(!s)return;const a=i(e,Ar(e));a&&(yr(a,s,o),e[Dr]=!0)}function Sr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mo={exports:{}},Io={exports:{}};(function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(o,i){return o<<i|o>>>32-i},rotr:function(o,i){return o<<32-i|o>>>i},endian:function(o){if(o.constructor==Number)return n.rotl(o,8)&16711935|n.rotl(o,24)&4278255360;for(var i=0;i<o.length;i++)o[i]=n.endian(o[i]);return o},randomBytes:function(o){for(var i=[];o>0;o--)i.push(Math.floor(Math.random()*256));return i},bytesToWords:function(o){for(var i=[],s=0,a=0;s<o.length;s++,a+=8)i[a>>>5]|=o[s]<<24-a%32;return i},wordsToBytes:function(o){for(var i=[],s=0;s<o.length*32;s+=8)i.push(o[s>>>5]>>>24-s%32&255);return i},bytesToHex:function(o){for(var i=[],s=0;s<o.length;s++)i.push((o[s]>>>4).toString(16)),i.push((o[s]&15).toString(16));return i.join("")},hexToBytes:function(o){for(var i=[],s=0;s<o.length;s+=2)i.push(parseInt(o.substr(s,2),16));return i},bytesToBase64:function(o){for(var i=[],s=0;s<o.length;s+=3)for(var a=o[s]<<16|o[s+1]<<8|o[s+2],l=0;l<4;l++)s*8+l*6<=o.length*8?i.push(e.charAt(a>>>6*(3-l)&63)):i.push("=");return i.join("")},base64ToBytes:function(o){o=o.replace(/[^A-Z0-9+\/]/ig,"");for(var i=[],s=0,a=0;s<o.length;a=++s%4)a!=0&&i.push((e.indexOf(o.charAt(s-1))&Math.pow(2,-2*a+8)-1)<<a*2|e.indexOf(o.charAt(s))>>>6-a*2);return i}};Io.exports=n})();var xr=Io.exports,Fe={utf8:{stringToBytes:function(e){return Fe.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(Fe.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var n=[],o=0;o<e.length;o++)n.push(e.charCodeAt(o)&255);return n},bytesToString:function(e){for(var n=[],o=0;o<e.length;o++)n.push(String.fromCharCode(e[o]));return n.join("")}}},To=Fe;/*!
|
|
4
4
|
* Determine if an object is a Buffer
|
|
@@ -2,16 +2,16 @@ var g = Object.defineProperty, N = Object.defineProperties;
|
|
|
2
2
|
var v = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var d = Object.getOwnPropertySymbols;
|
|
4
4
|
var M = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var p = (
|
|
6
|
-
for (var n in
|
|
7
|
-
M.call(
|
|
5
|
+
var p = (e, t, n) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, m = (e, t) => {
|
|
6
|
+
for (var n in t || (t = {}))
|
|
7
|
+
M.call(t, n) && p(e, n, t[n]);
|
|
8
8
|
if (d)
|
|
9
|
-
for (var n of d(
|
|
10
|
-
S.call(
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
const T = (
|
|
14
|
-
const s = typeof
|
|
9
|
+
for (var n of d(t))
|
|
10
|
+
S.call(t, n) && p(e, n, t[n]);
|
|
11
|
+
return e;
|
|
12
|
+
}, b = (e, t) => N(e, v(t));
|
|
13
|
+
const T = (e) => e === null || typeof e == "undefined" || e === "" || Number.isNaN(e), j = (e, { key: t, type: n = "string" }) => {
|
|
14
|
+
const s = typeof t == "function" ? t(e) : e == null ? void 0 : e[t];
|
|
15
15
|
if (T(s))
|
|
16
16
|
return null;
|
|
17
17
|
switch (n) {
|
|
@@ -26,16 +26,16 @@ const T = (t) => t === null || typeof t == "undefined" || t === "" || Number.isN
|
|
|
26
26
|
default:
|
|
27
27
|
return String(s);
|
|
28
28
|
}
|
|
29
|
-
}, $ = (
|
|
30
|
-
const s =
|
|
31
|
-
if (!
|
|
29
|
+
}, $ = (e, t, n = !0) => {
|
|
30
|
+
const s = e || [];
|
|
31
|
+
if (!t)
|
|
32
32
|
return [...s];
|
|
33
|
-
const r = n ? 1 : -1, a =
|
|
34
|
-
return s.map((o) => ({ row: o, value: j(o,
|
|
33
|
+
const r = n ? 1 : -1, a = t.type || "string";
|
|
34
|
+
return s.map((o) => ({ row: o, value: j(o, t) })).sort((o, l) => {
|
|
35
35
|
const [i, u] = [o.value === null, l.value === null];
|
|
36
|
-
return i || u ? i - u : a === "string" ? r * o.value.localeCompare(l.value) : r * (o.value - l.value);
|
|
36
|
+
return i || u ? i - u : a === "string" ? r * o.value.localeCompare(l.value, [], { numeric: !0 }) : r * (o.value - l.value);
|
|
37
37
|
}).map(({ row: o }) => o);
|
|
38
|
-
}, y = ({ column:
|
|
38
|
+
}, y = ({ column: e, ascending: t }, n) => e === n ? { column: e, ascending: !t } : { column: n, ascending: !0 }, c = (e) => e === "ascending" || e === "descending" ? e : "none", w = {
|
|
39
39
|
ascending: ["M12 5l0 14", "M18 11l-6 -6", "M6 11l6 -6"],
|
|
40
40
|
descending: ["M12 5l0 14", "M18 13l-6 6", "M6 13l6 6"],
|
|
41
41
|
none: ["M3 9l4 -4l4 4m-4 -4v14", "M21 15l-4 4l-4 -4m4 4v-14"]
|
|
@@ -49,18 +49,18 @@ const T = (t) => t === null || typeof t == "undefined" || t === "" || Number.isN
|
|
|
49
49
|
"stroke-linejoin": "round",
|
|
50
50
|
"aria-hidden": "true",
|
|
51
51
|
focusable: "false"
|
|
52
|
-
}, f = (
|
|
53
|
-
const
|
|
52
|
+
}, f = (e) => {
|
|
53
|
+
const t = c(e), n = Object.entries(b(m({}, A), { "data-state": t })).map(([r, a]) => `${r}="${a}"`).join(" "), s = w[t].map((r) => `<path d="${r}"></path>`).join("");
|
|
54
54
|
return `<svg ${n}>${s}</svg>`;
|
|
55
|
-
}, D = (
|
|
56
|
-
const n =
|
|
57
|
-
s.className = "nwl-sort-label", s.append(...
|
|
55
|
+
}, D = (e, t) => {
|
|
56
|
+
const n = e.ownerDocument, s = n.createElement("span");
|
|
57
|
+
s.className = "nwl-sort-label", s.append(...e.childNodes);
|
|
58
58
|
const r = n.createElement("button");
|
|
59
|
-
return r.type = "button", r.className = "nwl-sort-button", r.append(s), r.insertAdjacentHTML("beforeend", f(
|
|
60
|
-
}, C = (
|
|
61
|
-
const s = D(
|
|
62
|
-
return
|
|
63
|
-
|
|
59
|
+
return r.type = "button", r.className = "nwl-sort-button", r.append(s), r.insertAdjacentHTML("beforeend", f(t)), r;
|
|
60
|
+
}, C = (e, { direction: t = "none", onSort: n } = {}) => {
|
|
61
|
+
const s = D(e, t);
|
|
62
|
+
return e.classList.add("nwl-sortable"), e.setAttribute("aria-sort", c(t)), e.append(s), n && s.addEventListener("click", n), { th: e, button: s, setDirection: (a) => {
|
|
63
|
+
e.setAttribute("aria-sort", c(a)), s.querySelector("svg.nwl-sort-indicator").remove(), s.insertAdjacentHTML("beforeend", f(a));
|
|
64
64
|
} };
|
|
65
65
|
};
|
|
66
66
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,
|
|
1
|
+
(function(t,r){typeof exports=="object"&&typeof module!="undefined"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(t=typeof globalThis!="undefined"?globalThis:t||self,r(t.nwlComponentsSort={}))})(this,function(t){"use strict";var y=Object.defineProperty,A=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var N=(t,r,i)=>r in t?y(t,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[r]=i,T=(t,r)=>{for(var i in r||(r={}))_.call(r,i)&&N(t,i,r[i]);if(g)for(var i of g(r))C.call(r,i)&&N(t,i,r[i]);return t},v=(t,r)=>A(t,R(r));const r=e=>e===null||typeof e=="undefined"||e===""||Number.isNaN(e),i=(e,{key:o,type:a="string"})=>{const n=typeof o=="function"?o(e):e==null?void 0:e[o];if(r(n))return null;switch(a){case"number":{const s=Number(n);return Number.isNaN(s)?null:s}case"date":{const s=(n instanceof Date?n:new Date(n)).getTime();return Number.isNaN(s)?null:s}default:return String(n)}},M=(e,o,a=!0)=>{const n=e||[];if(!o)return[...n];const s=a?1:-1,u=o.type||"string";return n.map(l=>({row:l,value:i(l,o)})).sort((l,f)=>{const[p,S]=[l.value===null,f.value===null];return p||S?p-S:u==="string"?s*l.value.localeCompare(f.value,[],{numeric:!0}):s*(l.value-f.value)}).map(({row:l})=>l)},O=({column:e,ascending:o},a)=>e===a?{column:e,ascending:!o}:{column:a,ascending:!0},c=e=>e==="ascending"||e==="descending"?e:"none",m={ascending:["M12 5l0 14","M18 11l-6 -6","M6 11l6 -6"],descending:["M12 5l0 14","M18 13l-6 6","M6 13l6 6"],none:["M3 9l4 -4l4 4m-4 -4v14","M21 15l-4 4l-4 -4m4 4v-14"]},b={class:"nwl-sort-indicator",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"},d=e=>{const o=c(e),a=Object.entries(v(T({},b),{"data-state":o})).map(([s,u])=>`${s}="${u}"`).join(" "),n=m[o].map(s=>`<path d="${s}"></path>`).join("");return`<svg ${a}>${n}</svg>`},j=(e,o)=>{const a=e.ownerDocument,n=a.createElement("span");n.className="nwl-sort-label",n.append(...e.childNodes);const s=a.createElement("button");return s.type="button",s.className="nwl-sort-button",s.append(n),s.insertAdjacentHTML("beforeend",d(o)),s},w=(e,{direction:o="none",onSort:a}={})=>{const n=j(e,o);return e.classList.add("nwl-sortable"),e.setAttribute("aria-sort",c(o)),e.append(n),a&&n.addEventListener("click",a),{th:e,button:n,setDirection:u=>{e.setAttribute("aria-sort",c(u)),n.querySelector("svg.nwl-sort-indicator").remove(),n.insertAdjacentHTML("beforeend",d(u))}}};t.SORT_ICON_ATTRS=b,t.SORT_ICON_PATHS=m,t.ariaSort=c,t.nextSort=O,t.renderSortIcon=d,t.sortRows=M,t.sortValue=i,t.sortableHeader=w,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|