(function(x){typeof define=="function"&&define.amd?define(x):x()})(function(){"use strict";function x(u,e,i,t){if(e===!1||e==null||!e&&(u==="class"||u==="style"))return"";if(e===!0)return" "+(t?u:u+'="'+u+'"');var r=typeof e;return r!=="object"&&r!=="function"||typeof e.toJSON!="function"||(e=e.toJSON()),typeof e=="string"||(e=JSON.stringify(e),i||e.indexOf('"')===-1)?(i&&(e=e0(e))," "+u+'="'+e+'"'):" "+u+"='"+e.replace(/'/g,"&#39;")+"'"}function e0(u){var e=""+u,i=t0.exec(e);if(!i)return u;var t,r,F,c="";for(t=i.index,r=0;t<e.length;t++){switch(e.charCodeAt(t)){case 34:F="&quot;";break;case 38:F="&amp;";break;case 60:F="&lt;";break;case 62:F="&gt;";break;default:continue}r!==t&&(c+=e.substring(r,t)),r=t+1,c+=F}return r!==t?c+e.substring(r,t):c}var t0=/["&<>]/;function N(u,e,i,t){if(!(u instanceof Error))throw u;if(!(typeof window>"u"&&e||t))throw u.message+=" on line "+i,u;var r,F,c,l;try{t=t||require("fs").readFileSync(e,{encoding:"utf8"}),r=3,F=t.split(`
`),c=Math.max(i-r,0),l=Math.min(F.length,i+r)}catch(m){return u.message+=" - could not read from "+e+" ("+m.message+")",void N(u,null,i)}r=F.slice(c,l).map(function(m,v){var h=v+c+1;return(h==i?"  > ":"    ")+h+"| "+m}).join(`
`),u.path=e;try{u.message=(e||"Pug")+":"+i+`
`+r+`

`+u.message}catch{}throw u}function r0(u){var e="",i,t;try{var r=u||{};(function(F){t=1,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/assetstoreButtonsExtension.pug",e=e+'<div class="g-assetstore-button-container">',t=2,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/assetstoreButtonsExtension.pug",e=e+"<a"+(' class="g-view-imports btn btn-sm btn-primary"'+x("href",F,!0,!1))+">",t=3,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/assetstoreButtonsExtension.pug",e=e+'<i class="icon-link-ext"></i>',t=4,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/assetstoreButtonsExtension.pug",e=e+" View past imports</a></div>"}).call(this,"importsPageLink"in r?r.importsPageLink:typeof importsPageLink<"u"?importsPageLink:void 0)}catch(F){N(F,i,t)}return e}function o(u,e,i,t){if(e===!1||e==null||!e&&(u==="class"||u==="style"))return"";if(e===!0)return" "+(t?u:u+'="'+u+'"');var r=typeof e;return r!=="object"&&r!=="function"||typeof e.toJSON!="function"||(e=e.toJSON()),typeof e=="string"||(e=JSON.stringify(e),i||e.indexOf('"')===-1)?(i&&(e=s(e))," "+u+'="'+e+'"'):" "+u+"='"+e.replace(/'/g,"&#39;")+"'"}function s(u){var e=""+u,i=u0.exec(e);if(!i)return u;var t,r,F,c="";for(t=i.index,r=0;t<e.length;t++){switch(e.charCodeAt(t)){case 34:F="&quot;";break;case 38:F="&amp;";break;case 60:F="&lt;";break;case 62:F="&gt;";break;default:continue}r!==t&&(c+=e.substring(r,t)),r=t+1,c+=F}return r!==t?c+e.substring(r,t):c}var u0=/["&<>]/;function Y(u,e,i,t){if(!(u instanceof Error))throw u;if(!(typeof window>"u"&&e||t))throw u.message+=" on line "+i,u;var r,F,c,l;try{t=t||require("fs").readFileSync(e,{encoding:"utf8"}),r=3,F=t.split(`
`),c=Math.max(i-r,0),l=Math.min(F.length,i+r)}catch(m){return u.message+=" - could not read from "+e+" ("+m.message+")",void Y(u,null,i)}r=F.slice(c,l).map(function(m,v){var h=v+c+1;return(h==i?"  > ":"    ")+h+"| "+m}).join(`
`),u.path=e;try{u.message=(e||"Pug")+":"+i+`
`+r+`

`+u.message}catch{}throw u}function i0(u){var e="",i,t,r;try{var F=u||{};(function(c,l,C,w,E,S,Q,X,R,k,j,w0){r=1,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<div class="it-controls">',r=2,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",w0?(r=12,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",S?(r=17,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<a"+(' class="g-view-imports btn btn-sm btn-primary"'+o("href",`#assetstore/${S}/imports`,!0,!1))+">",r=18,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<i class="icon-link-ext"></i>',r=19,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"View all past Imports</a>"):(r=13,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<a class="g-view-imports btn btn-sm btn-primary" href="#assetstore/all_imports">',r=14,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<i class="icon-link-ext"></i>',r=15,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"View all past Imports</a>")):(r=3,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",S?(r=8,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<a"+(' class="g-view-imports btn btn-sm btn-primary"'+o("href",`#assetstore/${S}/unique_imports`,!0,!1))+">",r=9,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<i class="icon-link-ext"></i>',r=10,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"View unique past Imports</a>"):(r=4,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<a class="g-view-imports btn btn-sm btn-primary" href="#assetstore/all_unique_imports">',r=5,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<i class="icon-link-ext"></i>',r=6,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"View unique past Imports</a>")),e=e+"</div>",r=20,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<table class="g-imports-list-table">',r=21,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug";var E=!1,w=!1,C=!1,k=[],j=!1;r=27,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",(function(){var n=X;if(typeof n.length=="number")for(var a=0,d=n.length;a<d;a++){var p=n[a];r=28,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",(p.get("params").fileIncludeRegex||p.get("params").fileExcludeRegex)&&(r=29,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",E=l),r=30,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",p.get("params").leafFoldersAsItems&&p.get("params").leafFoldersAsItems!=="false"&&(r=31,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",w=!0),r=32,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",c.keys(p.get("params")).forEach(_=>{["importPath","destinationId","leafFoldersAsItems","progress","fileIncludeRegex","fileExcludeRegex","params"].indexOf(_)<0&&k.indexOf(_)<0&&k.push(_)}),r=33,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",p.get("_count")&&(r=34,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",j=!0),r=35,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",p.get("params").importPath&&(r=36,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",C=!0)}else{var d=0;for(var a in n){d++;var p=n[a];r=28,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",(p.get("params").fileIncludeRegex||p.get("params").fileExcludeRegex)&&(r=29,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",E=l),r=30,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",p.get("params").leafFoldersAsItems&&p.get("params").leafFoldersAsItems!=="false"&&(r=31,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",w=!0),r=32,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",c.keys(p.get("params")).forEach(g=>{["importPath","destinationId","leafFoldersAsItems","progress","fileIncludeRegex","fileExcludeRegex","params"].indexOf(g)<0&&k.indexOf(g)<0&&k.push(g)}),r=33,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",p.get("_count")&&(r=34,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",j=!0),r=35,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",p.get("params").importPath&&(r=36,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",C=!0)}}}).call(this),r=37,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<thead>",r=38,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<tr>",r=39,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=39,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"Actions</th>",r=40,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",j&&(r=41,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=41,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"Repeats</th>"),r=42,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=42,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"Started</th>",r=43,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=43,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"Ended</th>",r=44,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=44,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"Assetstore Name</th>",r=45,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",C&&(r=46,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=46,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"Import Path</th>"),r=48,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=48,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"Destination Path</th>",r=49,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",w&&(r=50,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=50,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"Leafed Folders</th>"),r=51,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",E&&(r=52,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=52,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"File Include Regex</th>",r=53,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=53,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"File Exclude Regex</th>"),r=54,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",(function(){var n=k;if(typeof n.length=="number")for(var a=0,d=n.length;a<d;a++){var p=n[a];r=55,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=55,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.replace(/([A-Z])/g," $1").replace(/^./,_=>_.toUpperCase()))==null?"":i)+"</th>"}else{var d=0;for(var a in n){d++;var p=n[a];r=55,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<th>",r=55,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.replace(/([A-Z])/g," $1").replace(/^./,g=>g.toUpperCase()))==null?"":i)+"</th>"}}}).call(this),e=e+"</tr></thead>",r=56,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<tbody>",r=57,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",(function(){var n=X;if(typeof n.length=="number")for(var a=0,d=n.length;a<d;a++){var p=n[a];r=58,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<tr>",r=59,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=60,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",Q.includes(p.get("assetstoreId"))&&(r=61,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<div class="g-imports-buttons">',r=62,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<button"+(' class="re-import-btn btn btn-sm btn-success"'+o("index",a,!0,!1)+o("disabled",p.get("_destinationPath")=="does not exist",!0,!1))+">",r=63,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<i class="icon-cw"></i>',r=64,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+" Re-Import</button>",r=65,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<button"+(' class="re-import-edit-btn btn btn-sm btn-primary"'+o("index",a,!0,!1)+' data-toggle="tooltip" title="Edit Import Parameters"')+">",r=66,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<i class="icon-pencil"></i></button></div>'),e=e+"</td>",r=67,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",j&&(r=68,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("_count"),!0,!1)+' data-toggle="tooltip"'+o("title",p.get("_count")!==1?`Imported ${p.get("_count")} times`:"Imported once",!0,!1))+">",r=69,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=69,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("_count"))==null?"":i)+"</span></td>"),r=70,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("started"),!0,!1)+' data-toggle="tooltip"'+o("title",p.get("started"),!0,!1))+">",r=71,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=71,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=R(p.get("started")).format("YYYY-MM-DD HH:mm:ss.SSS"))==null?"":i)+"</span></td>",r=72,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("ended"),!0,!1)+' data-toggle="tooltip"'+o("title",p.get("ended")||"",!0,!1))+">",r=73,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=73,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("ended")?R(p.get("ended")).format("YYYY-MM-DD HH:mm:ss.SSS"):"")==null?"":i)+"</span></td>",r=74,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("_assetstoreName"),!0,!1)+' data-toggle="tooltip"'+o("title",p.get("_assetstoreName"),!0,!1))+">",r=75,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=75,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("_assetstoreName"))==null?"":i)+"</span></td>",r=76,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",C&&(r=77,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("params").importPath,!0,!1)+' data-toggle="tooltip"'+o("title",p.get("params").importPath,!0,!1))+">",r=78,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=78,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=(p.get("params").importPath||"").replaceAll(/(?!^)\//g,"/­"))==null?"":i)+"</span></td>"),r=79,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("params").destinationId,!0,!1)+' data-toggle="tooltip"'+o("title",p.get("_destinationPath")+`
`+p.get("params").destinationId,!0,!1))+">",r=80,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=80,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=(p.get("_destinationPath")||"").replaceAll(/(?!^)\//g,"/­"))==null?"":i)+"</span></td>",r=81,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",w&&(r=82,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=83,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=83,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params").leafFoldersAsItems)==null?"":i)+"</span></td>"),r=84,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",E&&(r=85,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=86,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=86,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params").fileIncludeRegex)==null?"":i)+"</span></td>",r=87,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=88,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=88,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params").fileExcludeRegex)==null?"":i)+"</span></td>"),r=89,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",(function(){var _=k;if(typeof _.length=="number")for(var y=0,T=_.length;y<T;y++){var g=_[y];r=90,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=91,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=91,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params")[g])==null?"":i)+"</span></td>"}else{var T=0;for(var y in _){T++;var g=_[y];r=90,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=91,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=91,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params")[g])==null?"":i)+"</span></td>"}}}).call(this),e=e+"</tr>"}else{var d=0;for(var a in n){d++;var p=n[a];r=58,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<tr>",r=59,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=60,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",Q.includes(p.get("assetstoreId"))&&(r=61,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<div class="g-imports-buttons">',r=62,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<button"+(' class="re-import-btn btn btn-sm btn-success"'+o("index",a,!0,!1)+o("disabled",p.get("_destinationPath")=="does not exist",!0,!1))+">",r=63,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<i class="icon-cw"></i>',r=64,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+" Re-Import</button>",r=65,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<button"+(' class="re-import-edit-btn btn btn-sm btn-primary"'+o("index",a,!0,!1)+' data-toggle="tooltip" title="Edit Import Parameters"')+">",r=66,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<i class="icon-pencil"></i></button></div>'),e=e+"</td>",r=67,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",j&&(r=68,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("_count"),!0,!1)+' data-toggle="tooltip"'+o("title",p.get("_count")!==1?`Imported ${p.get("_count")} times`:"Imported once",!0,!1))+">",r=69,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=69,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("_count"))==null?"":i)+"</span></td>"),r=70,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("started"),!0,!1)+' data-toggle="tooltip"'+o("title",p.get("started"),!0,!1))+">",r=71,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=71,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=R(p.get("started")).format("YYYY-MM-DD HH:mm:ss.SSS"))==null?"":i)+"</span></td>",r=72,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("ended"),!0,!1)+' data-toggle="tooltip"'+o("title",p.get("ended")||"",!0,!1))+">",r=73,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=73,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("ended")?R(p.get("ended")).format("YYYY-MM-DD HH:mm:ss.SSS"):"")==null?"":i)+"</span></td>",r=74,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("_assetstoreName"),!0,!1)+' data-toggle="tooltip"'+o("title",p.get("_assetstoreName"),!0,!1))+">",r=75,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=75,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("_assetstoreName"))==null?"":i)+"</span></td>",r=76,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",C&&(r=77,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("params").importPath,!0,!1)+' data-toggle="tooltip"'+o("title",p.get("params").importPath,!0,!1))+">",r=78,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=78,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=(p.get("params").importPath||"").replaceAll(/(?!^)\//g,"/­"))==null?"":i)+"</span></td>"),r=79,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td"+(o("data-id",p.get("params").destinationId,!0,!1)+' data-toggle="tooltip"'+o("title",p.get("_destinationPath")+`
`+p.get("params").destinationId,!0,!1))+">",r=80,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=80,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=(p.get("_destinationPath")||"").replaceAll(/(?!^)\//g,"/­"))==null?"":i)+"</span></td>",r=81,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",w&&(r=82,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=83,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=83,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params").leafFoldersAsItems)==null?"":i)+"</span></td>"),r=84,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",E&&(r=85,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=86,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=86,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params").fileIncludeRegex)==null?"":i)+"</span></td>",r=87,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=88,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=88,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params").fileExcludeRegex)==null?"":i)+"</span></td>"),r=89,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",(function(){var g=k;if(typeof g.length=="number")for(var $=0,D=g.length;$<D;$++){var M=g[$];r=90,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=91,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=91,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params")[M])==null?"":i)+"</span></td>"}else{var D=0;for(var $ in g){D++;var M=g[$];r=90,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<td>",r=91,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+"<span>",r=91,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+s((i=p.get("params")[M])==null?"":i)+"</span></td>"}}}).call(this),e=e+"</tr>"}}}).call(this),e=e+"</tbody></table>",r=93,t="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/importList.pug",e=e+'<div class="g-imports-pagination"></div>'}).call(this,"Object"in F?F.Object:typeof Object<"u"?Object:void 0,"True"in F?F.True:typeof True<"u"?True:void 0,"anyImportPath"in F?F.anyImportPath:typeof anyImportPath<"u"?anyImportPath:void 0,"anyLeafed"in F?F.anyLeafed:typeof anyLeafed<"u"?anyLeafed:void 0,"anyRegex"in F?F.anyRegex:typeof anyRegex<"u"?anyRegex:void 0,"assetstoreId"in F?F.assetstoreId:typeof assetstoreId<"u"?assetstoreId:void 0,"assetstores"in F?F.assetstores:typeof assetstores<"u"?assetstores:void 0,"imports"in F?F.imports:typeof imports<"u"?imports:void 0,"moment"in F?F.moment:typeof moment<"u"?moment:void 0,"otherParams"in F?F.otherParams:typeof otherParams<"u"?otherParams:void 0,"showCount"in F?F.showCount:typeof showCount<"u"?showCount:void 0,"unique"in F?F.unique:typeof unique<"u"?unique:void 0)}catch(c){Y(c,t,r)}return e}const C0="",V=girder.$,F0=girder.views.widgets.PaginateWidget,p0=girder.collections.Collection,J=girder.models.AssetstoreModel,{SORT_DESC:c0}=girder.constants,o0=girder.moment,s0=girder.views.View,U=girder.router,{restRequest:a0}=girder.rest;var I=s0.extend({events:{"click .re-import-btn":function(u){const e=Number(V(u.currentTarget).attr("index")),i=this.imports[e];if(i===void 0)return;const t=new J({_id:i.get("assetstoreId")}),r=i.get("params").destinationType,F=i.get("params").destinationId;t.off("g:imported").on("g:imported",function(){U.navigate(r+"/"+F,{trigger:!0})},this).on("g:error",function(c){this.$(".g-validation-failed-message").text(c.responseJSON.message)},this),t.once("g:fetched",()=>{t.import(i.get("params"))}).fetch()},"click .re-import-edit-btn":function(u){const e=Number(V(u.currentTarget).attr("index")),i=this.imports[e];if(i===void 0)return;const t=(c,l)=>{new J({_id:c}).once("g:fetched",()=>{U.navigate(`assetstore/${c}/re-import/${l}`,{trigger:!0})}).fetch()},r=i.get("assetstoreId"),F=i.get("_id");t(r,F)}},initialize({id:u,unique:e}){this._unique=e,this._assetstoreId=u,this.imports=[];const i=u?`${u}/imports`:"all_imports";this.collection=new p0,this.collection.altUrl=`assetstore/${i}`,this.collection.sortField="started",this.collection.sortDir=c0,this.collection.params={unique:e||!1},this.listenTo(this.collection,"update reset",this._updateData),this.paginateWidget=new F0({collection:this.collection,parentView:this}),a0({url:"assetstore",data:{limit:0}}).done(t=>{this.assetstores=t.map(r=>r._id),this.collection.fetch({},!0)})},_updateData(){this.imports=this.collection.toArray(),this.render()},render(){return this.$el.html(i0({imports:this.imports,assetstores:this.assetstores,moment:o0,unique:this._unique,assetstoreId:this._assetstoreId})),this.$el.tooltip(),this.paginateWidget.setElement(this.$(".g-imports-pagination")).render(),this}});const l0=girder.models.AssetstoreModel,m0=girder.views.View,{AssetstoreType:P}=girder.constants,n0=girder.router,g0=girder.events,{restRequest:B}=girder.rest,A=(u,e)=>{g0.trigger("g:alert",{icon:"cancel",text:`Could not re-import: ${e}`,type:"danger"}),n0.navigate(`assetstore/${u}/import`,{trigger:!0,replace:!0})};var d0=m0.extend({initialize({assetstoreId:u,importId:e}){this.importId=e,this.assetstoreId=u,this.type="",B({url:`assetstore/import/${e}`,error:null}).done(i=>{if(!i){A(this.assetstoreId,`Unable to find import ${e}`);return}this.import=i;const t=new l0({_id:u});t.once("g:fetched",()=>{const r=t.get("type");r===P.FILESYSTEM?this.type="filesystem":r===P.S3?this.type="s3":r===P.DICOMWEB?this.type="dwas":r===P.GIRDER?this.type="gas":A(this.assetstoreId,`Unsupported assetstore type '${r}'`),this.render()}).fetch()}).fail(()=>{A(this.assetstoreId,"Unable to fetch base import information")})},render(){const u=this.import.params,e=u.destinationId,i=u.destinationType,t=u.excludeExisting?"true":"false";return this.$(`#g-${this.type}-import-path`).val(u.importPath),this.$(`#g-${this.type}-import-dest-type`).val(i),this.$(`#g-${this.type}-import-dest-id`).val(e),this.$(`#g-${this.type}-import-leaf-items`).val(u.leafFoldersAsItems),this.$(`#g-${this.type}-import-exclude-existing`).val(t),this.type==="dwas"&&(this.$(`#g-${this.type}-import-filters`).val(u.filters),this.$(`#g-${this.type}-import-limit`).val(u.limit)),B({url:`resource/${e}/path`,method:"GET",data:{type:i},error:null}).done(r=>{this.$(`#g-${this.type}-import-dest-id`).val(`${e} (${r})`)}).fail(()=>{this.$(`#g-${this.type}-import-dest-id`).val("")}),this}});function H(u,e,i,t){if(e===!1||e==null||!e&&(u==="class"||u==="style"))return"";if(e===!0)return" "+(t?u:u+'="'+u+'"');var r=typeof e;return r!=="object"&&r!=="function"||typeof e.toJSON!="function"||(e=e.toJSON()),typeof e=="string"||(e=JSON.stringify(e),i||e.indexOf('"')===-1)?(i&&(e=_0(e))," "+u+'="'+e+'"'):" "+u+"='"+e.replace(/'/g,"&#39;")+"'"}function _0(u){var e=""+u,i=h0.exec(e);if(!i)return u;var t,r,F,c="";for(t=i.index,r=0;t<e.length;t++){switch(e.charCodeAt(t)){case 34:F="&quot;";break;case 38:F="&amp;";break;case 60:F="&lt;";break;case 62:F="&gt;";break;default:continue}r!==t&&(c+=e.substring(r,t)),r=t+1,c+=F}return r!==t?c+e.substring(r,t):c}var h0=/["&<>]/;function W(u,e,i,t){if(!(u instanceof Error))throw u;if(!(typeof window>"u"&&e||t))throw u.message+=" on line "+i,u;var r,F,c,l;try{t=t||require("fs").readFileSync(e,{encoding:"utf8"}),r=3,F=t.split(`
`),c=Math.max(i-r,0),l=Math.min(F.length,i+r)}catch(m){return u.message+=" - could not read from "+e+" ("+m.message+")",void W(u,null,i)}r=F.slice(c,l).map(function(m,v){var h=v+c+1;return(h==i?"  > ":"    ")+h+"| "+m}).join(`
`),u.path=e;try{u.message=(e||"Pug")+":"+i+`
`+r+`

`+u.message}catch{}throw u}function z(u){var e="",i,t;try{var r=u||{};(function(F){t=1,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/excludeExistingInput.pug",e=e+'<div class="form-group">',t=2,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/excludeExistingInput.pug",e=e+"<label"+H("for","g-"+F+"-import-exclude-existing",!0,!1)+">",t=2,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/excludeExistingInput.pug",e=e+"Exclude Existing Files</label>",t=3,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/excludeExistingInput.pug",e=e+"<select"+(' class="form-control"'+H("id","g-"+F+"-import-exclude-existing",!0,!1))+">",t=4,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/excludeExistingInput.pug",e=e+'<option value="false">',t=4,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/excludeExistingInput.pug",e=e+"False</option>",t=5,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/excludeExistingInput.pug",e=e+'<option value="true">',t=5,i="/home/circleci/project/girder/plugins/import_tracker/girder_import_tracker/web_client/templates/excludeExistingInput.pug",e=e+"True</option></select></div>"}).call(this,"type"in r?r.type:typeof type<"u"?type:void 0)}catch(F){W(F,i,t)}return e}girder.events.on("g:appload.before",()=>{const u=girder.plugins.jobs.JobStatus,e=u.isCancelable;u.isCancelable=function(i){return["assetstore_import","folder_move"].includes(i.get("type"))?![u.CANCELED,u.SUCCESS,u.ERROR].includes(i.get("status")):e(i)}});const k0=girder.$,{AssetstoresView:G,FilesystemImportView:q,S3ImportView:O}=girder.views.body,{CollectionModel:f0,FolderModel:b0,UserModel:E0}=girder.models,{wrap:L}=girder.utilities.PluginUtils,f=girder.events,b=girder.router;L(G,"render",function(u){u.call(this),window.setTimeout(()=>{this.$el.find(".g-current-assetstores-container .g-body-title").after('<a class="g-view-imports btn btn-sm btn-primary" href="#assetstore/all_unique_imports"><i class="icon-link-ext"></i>View all past Imports</a>');const e=this.collection;this.$(".g-assetstore-import-button-container").after(function(){const i=e.get(k0(this).closest(".g-assetstore-buttons").find("[cid]").attr("cid"));return r0({importsPageLink:`#assetstore/${i.id}/unique_imports`})})},0)}),L(q,"render",function(u){u.call(this),this.$(".form-group").last().after(z({type:"filesystem"}))}),L(O,"render",function(u){u.call(this),this.$(".form-group").last().after(z({type:"s3"}))});const Z=(u,e)=>{const i=u._browserWidgetView,t=u.$(`#g-${e}-import-dest-type`).val(),F=u.$(`#g-${e}-import-dest-id`).val().trim().split(/\s/)[0],c={collection:f0,folder:b0,user:E0};if(F&&t in c){const l=new c[t]({_id:F});l.once("g:fetched",()=>{(!i.root||i.root.id!==l.id)&&(i.root=l,i._renderRootSelection())}).on("g:error",m=>{m.status===400&&f.trigger("g:alert",{icon:"cancel",text:`No ${t.toUpperCase()} with ID ${F} found.`,type:"danger",timeout:4e3})}).fetch({ignoreError:!0})}};L(q,"_openBrowser",function(u){Z(this,"filesystem"),u.call(this)}),L(O,"_openBrowser",function(u){Z(this,"s3"),u.call(this)});const K=(u,e)=>{const i=u.$(`#g-${e}-import-dest-id`).val().trim().split(/\s/)[0],t=u.$(`#g-${e}-import-dest-type`).val(),r=u.$(`#g-${e}-import-exclude-existing`).val(),F={destinationId:i,destinationType:t,excludeExisting:r,progress:!0};e==="filesystem"&&(F.leafFoldersAsItems=u.$(`#g-${e}-import-leaf-items`).val()),e==="dwas"?(F.filters=u.$(`#g-${e}-import-filters`).val().trim(),F.limit=u.$(`#g-${e}-import-limit`).val().trim()):F.importPath=u.$(`#g-${e}-import-path`).val().trim(),u.$(".g-validation-failed-message").empty(),u.$(`.g-submit-${e}-import`).addClass("disabled");let c=u.assetstore;c=c.off().on("g:imported",function(){b.navigate(t+"/"+i,{trigger:!0})},u).on("g:error",function(l){u.$(`.g-submit-${e}-import`).removeClass("disabled"),u.$(".g-validation-failed-message").html(l.responseJSON.message)},u),c.import(F)};q.prototype.events["submit .g-filesystem-import-form"]=function(u){u.preventDefault(),K(this,"filesystem")},O.prototype.events["submit .g-s3-import-form"]=function(u){u.preventDefault(),K(this,"s3")},b.route("assetstore/:id/imports","importsPage",function(u){f.trigger("g:navigateTo",I,{id:u})}),b.route("assetstore/:id/unique_imports","importsPage",function(u){f.trigger("g:navigateTo",I,{id:u,unique:!0})}),b.route("assetstore/all_imports","importsPage",function(){f.trigger("g:navigateTo",I)}),b.route("assetstore/all_unique_imports","importsPage",function(){f.trigger("g:navigateTo",I,{unique:!0})}),b.route("assetstore/:id/re-import/:prev","assetstoreImport",function(u,e){f.trigger("g:navigateTo",d0,{assetstoreId:u,importId:e}),G.import(u)})});
