(()=>{"use strict";var e,t,n,r={26436:(e,t,n)=>{var r,s=n(32981),o=n(53334),a=n(31346),i=n(63814),l=n(85168),u=n(65043),c=n(85471);!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ERROR=1]="ERROR",e[e.INDETERMINATE=2]="INDETERMINATE",e[e.INCOMPLETE_CONF=3]="INCOMPLETE_CONF",e[e.UNAUTHORIZED=4]="UNAUTHORIZED",e[e.TIMEOUT=5]="TIMEOUT",e[e.NETWORK_ERROR=6]="NETWORK_ERROR"}(r||(r={}));const d=function(e){return!(!e.status||e.status===r.SUCCESS)&&(e.userProvided||"password::global::user"===e.authMechanism)},p=function(e){if(e.type===a.pt.File)return!1;const t=e.attributes;return!(!t.scope||!t.backend||"personal"!==t.scope&&"system"!==t.scope)},g=new a.hY({id:"credentials-external-storage",displayName:()=>(0,o.Tl)("files","Enter missing credentials"),iconSvgInline:()=>'',enabled:e=>{var t;if(1!==e.length)return!1;const n=e[0];if(!p(n))return!1;const r=(null===(t=n.attributes)||void 0===t?void 0:t.config)||{};return!!d(r)},async exec(e){const{login:t,password:s}=await new Promise((e=>(0,l.Ss)((0,c.$V)((()=>Promise.all([n.e(4208),n.e(4076)]).then(n.bind(n,11695)))),{},(t=>{e(t)}))));return t&&s?await async function(e,t,n){const s=(await u.Ay.put((0,i.Jv)("apps/files_external/userglobalstorages/{id}",e.attributes),{backendOptions:{user:t,password:n}})).data;return s.status!==r.SUCCESS?((0,l.Qg)((0,o.Tl)("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:(null==s?void 0:s.statusMessage)||""})),null):((0,l.Te)((0,o.Tl)("files_external","New configuration successfully saved")),c.Ay.set(e.attributes,"config",s),!0)}(e,t,s):null},order:-1e3,default:a.m9.DEFAULT,inline:()=>!0});var f=n(85072),A=n.n(f),v=n(97825),h=n.n(v),m=n(77659),w=n.n(m),C=n(55056),b=n.n(C),x=n(10540),y=n.n(x),E=n(41113),T=n.n(E),_=n(64755),S={};S.styleTagTransform=T(),S.setAttributes=b(),S.insert=w().bind(null,"head"),S.domAPI=h(),S.insertStyleElement=y(),A()(_.A,S),_.A&&_.A.locals&&_.A.locals;var O,N=n(21777);const H="/files/".concat(null===(O=(0,N.HW)())||void 0===O?void 0:O.uid),k=e=>{var t;const n=(e.path+"/"+e.name).replace(/^\//gm,"");return new a.vd({id:e.id,source:(0,i.dC)("dav"+H+"/"+n),root:H,owner:(null===(t=(0,N.HW)())||void 0===t?void 0:t.uid)||null,permissions:e.config.status!==r.SUCCESS?a.aX.NONE:(null==e?void 0:e.permissions)||a.aX.READ,attributes:{displayName:n,...e}})},R=new a.hY({id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:e=>e.every((e=>!0===p(e))),exec:async()=>null,async renderInline(e){let t=null;try{const s=await function(e){const t=arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?"userstorages":"userglobalstorages";return u.Ay.get((0,i.Jv)("apps/files_external/".concat(t,"/").concat(e,"?testOnly=false")))}(e.attributes.id,"system"===e.attributes.scope);var n;if(t=s.data,c.Ay.set(e.attributes,"config",t),t.status!==r.SUCCESS)throw new Error((null===(n=t)||void 0===n?void 0:n.statusMessage)||(0,o.Tl)("files_external","There was an error with this external storage."));return null}catch(n){if(n.response&&!t)return(0,l.I9)((0,o.Tl)("files_external","We were unable to check the external storage {basename}",{basename:e.basename})),null;const r=d(t),s=document.createElement("span");s.classList.add("files-list__row-status--".concat(r?"warning":"error"));const a=document.createElement("span");return a.className="files-list__row-status",r||(a.innerHTML='',a.title=n.message),a.prepend(s),a}},order:10}),M=new a.hY({id:"open-in-files-external-storage",displayName:e=>{var t;return((null==e||null===(t=e[0])||void 0===t||null===(t=t.attributes)||void 0===t?void 0:t.config)||{status:r.INDETERMINATE}).status!==r.SUCCESS?(0,o.Tl)("files_external","Examine this faulty external storage configuration"):(0,o.Tl)("files","Open in Files")},iconSvgInline:()=>"",enabled:(e,t)=>"extstoragemounts"===t.id,async exec(e){const t=e.attributes.config;return(null==t?void 0:t.status)!==r.SUCCESS?(window.OC.dialogs.confirm((0,o.Tl)("files_external","There was an error with this external storage. Do you want to review this mount point config in the settings page?"),(0,o.Tl)("files_external","External mount error"),(t=>{if(!0===t){const t="personal"===e.attributes.scope?"user":"admin";window.location.href=(0,i.Jv)("/settings/".concat(t,"/externalstorages"))}})),null):(window.OCP.Files.Router.goToRoute(null,{view:"files"},{dir:e.path}),null)},order:-1e3,default:a.m9.HIDDEN}),U=(0,s.C)("files_external","allowUserMounting",!1);(0,a.bh)().register(new a.Ss({id:"extstoragemounts",name:(0,o.Tl)("files_external","External storage"),caption:(0,o.Tl)("files_external","List of external storage."),emptyCaption:U?(0,o.Tl)("files_external","There is no external storage configured. You can configure them in your Personal settings."):(0,o.Tl)("files_external","There is no external storage configured and you don't have the permission to configure them."),emptyTitle:(0,o.Tl)("files_external","No external storage"),icon:'',order:30,columns:[new a.VP({id:"storage-type",title:(0,o.Tl)("files_external","Storage type"),render(e){var t;const n=(null===(t=e.attributes)||void 0===t?void 0:t.backend)||(0,o.Tl)("files_external","Unknown"),r=document.createElement("span");return r.textContent=n,r}}),new a.VP({id:"scope",title:(0,o.Tl)("files_external","Scope"),render(e){var t;const n=document.createElement("span");let r=(0,o.Tl)("files_external","Personal");return"system"===(null===(t=e.attributes)||void 0===t?void 0:t.scope)&&(r=(0,o.Tl)("files_external","System")),n.textContent=r,n}})],getContents:async()=>{var e;const t=(await u.Ay.get((0,i.KT)("apps/files_external/api/v1/mounts"))).data.ocs.data.map(k);return{folder:new a.vd({id:0,source:(0,i.dC)("dav"+H),root:H,owner:(null===(e=(0,N.HW)())||void 0===e?void 0:e.uid)||null,permissions:a.aX.READ}),contents:t}}})),(0,a.Gg)(g),(0,a.Gg)(R),(0,a.Gg)(M)},64755:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(71354),s=n.n(r),o=n(76314),a=n.n(o)()(s());a.push([e.id,".files-list__row-status{display:flex;width:44px;justify-content:center;align-items:center;height:100%}.files-list__row-status svg{width:24px;height:24px}.files-list__row-status svg path{fill:currentColor}.files-list__row-status--error,.files-list__row-status--warning{position:absolute;display:block;top:0;left:0;right:0;bottom:0;opacity:.1;z-index:-1}.files-list__row-status--error{background:var(--color-error)}.files-list__row-status--warning{background:var(--color-warning)}","",{version:3,sources:["webpack://./apps/files_external/src/css/fileEntryStatus.scss"],names:[],mappings:"AAAA,wBACC,YAAA,CACA,UAAA,CACA,sBAAA,CACA,kBAAA,CACA,WAAA,CAEA,4BACC,UAAA,CACA,WAAA,CAEA,iCACC,iBAAA,CAIF,gEAEC,iBAAA,CACA,aAAA,CACA,KAAA,CACA,MAAA,CACA,OAAA,CACA,QAAA,CACA,UAAA,CACA,UAAA,CAGD,+BACC,6BAAA,CAGD,iCACC,+BAAA",sourcesContent:[".files-list__row-status {\n\tdisplay: flex;\n\twidth: 44px;\n\tjustify-content: center;\n\talign-items: center;\n\theight: 100%;\n\n\tsvg {\n\t\twidth: 24px;\n\t\theight: 24px;\n\n\t\tpath {\n\t\t\tfill: currentColor;\n\t\t}\n\t}\n\n\t&--error,\n\t&--warning {\n\t\tposition: absolute;\n\t\tdisplay: block;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\topacity: .1;\n\t\tz-index: -1;\n\t}\n\n\t&--error {\n\t\tbackground: var(--color-error);\n\t}\n\n\t&--warning {\n\t\tbackground: var(--color-warning);\n\t}\n}\n"],sourceRoot:""}]);const i=a}},s={};function o(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={id:e,loaded:!1,exports:{}};return r[e].call(n.exports,n,n.exports,o),n.loaded=!0,n.exports}o.m=r,e=[],o.O=(t,n,r,s)=>{if(!n){var a=1/0;for(c=0;c=s)&&Object.keys(o.O).every((e=>o.O[e](n[l])))?n.splice(l--,1):(i=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,r,s]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>e+"-"+e+".js?v="+{1902:"bce1c3eccddae835c52e",4076:"c244d3fd930f6d6bf2c5",8066:"f1f0a3884f0b92377e6a"}[e],o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="nextcloud:",o.l=(e,r,s,a)=>{if(t[e])t[e].push(r);else{var i,l;if(void 0!==s)for(var u=document.getElementsByTagName("script"),c=0;c{i.onerror=i.onload=null,clearTimeout(g);var s=t[e];if(delete t[e],i.parentNode&&i.parentNode.removeChild(i),s&&s.forEach((e=>e(r))),n)return n(r)},g=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),l&&document.head.appendChild(i)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),o.j=1873,(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{o.b=document.baseURI||self.location.href;var e={1873:0};o.f.j=(t,n)=>{var r=o.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var s=new Promise(((n,s)=>r=e[t]=[n,s]));n.push(r[2]=s);var a=o.p+o.u(t),i=new Error;o.l(a,(n=>{if(o.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+s+": "+a+")",i.name="ChunkLoadError",i.type=s,i.request=a,r[1](i)}}),"chunk-"+t,t)}},o.O.j=t=>0===e[t];var t=(t,n)=>{var r,s,a=n[0],i=n[1],l=n[2],u=0;if(a.some((t=>0!==e[t]))){for(r in i)o.o(i,r)&&(o.m[r]=i[r]);if(l)var c=l(o)}for(t&&t(n);uo(26436)));a=o.O(a)})();
//# sourceMappingURL=files_external-init.js.map?v=16d89657d0aedfdcdd6b