, 2024\nLanguage-Team: Chinese (Taiwan) (https://app.transifex.com/nextcloud/teams/64236/zh_TW/)\nContent-Type: text/plain; charset=UTF-8\nLanguage: zh_TW\nPlural-Forms: nplurals=1; plural=0;\n"]},"{count} file conflict":{msgid:"{count} file conflict",msgid_plural:"{count} files conflict",msgstr:["{count} 個檔案衝突"]},"{count} file conflict in {dirname}":{msgid:"{count} file conflict in {dirname}",msgid_plural:"{count} file conflicts in {dirname}",msgstr:["{dirname} 中有 {count} 個檔案衝突"]},"{seconds} seconds left":{msgid:"{seconds} seconds left",msgstr:["剩餘 {seconds} 秒"]},"{time} left":{msgid:"{time} left",comments:{extracted:"TRANSLATORS time has the format 00:00:00"},msgstr:["剩餘 {time}"]},"a few seconds left":{msgid:"a few seconds left",msgstr:["還剩幾秒"]},Cancel:{msgid:"Cancel",msgstr:["取消"]},"Cancel the entire operation":{msgid:"Cancel the entire operation",msgstr:["取消整個操作"]},"Cancel uploads":{msgid:"Cancel uploads",msgstr:["取消上傳"]},Continue:{msgid:"Continue",msgstr:["繼續"]},"estimating time left":{msgid:"estimating time left",msgstr:["估計剩餘時間"]},"Existing version":{msgid:"Existing version",msgstr:["既有版本"]},"If you select both versions, the copied file will have a number added to its name.":{msgid:"If you select both versions, the copied file will have a number added to its name.",msgstr:["若您選取兩個版本,複製的檔案的名稱將會新增編號。"]},"Last modified date unknown":{msgid:"Last modified date unknown",msgstr:["最後修改日期未知"]},New:{msgid:"New",msgstr:["新增"]},"New version":{msgid:"New version",msgstr:["新版本"]},paused:{msgid:"paused",msgstr:["已暫停"]},"Preview image":{msgid:"Preview image",msgstr:["預覽圖片"]},"Select all checkboxes":{msgid:"Select all checkboxes",msgstr:["選取所有核取方塊"]},"Select all existing files":{msgid:"Select all existing files",msgstr:["選取所有既有檔案"]},"Select all new files":{msgid:"Select all new files",msgstr:["選取所有新檔案"]},"Skip this file":{msgid:"Skip this file",msgid_plural:"Skip {count} files",msgstr:["略過 {count} 檔案"]},"Unknown size":{msgid:"Unknown size",msgstr:["未知大小"]},"Upload cancelled":{msgid:"Upload cancelled",msgstr:["已取消上傳"]},"Upload files":{msgid:"Upload files",msgstr:["上傳檔案"]},"Upload progress":{msgid:"Upload progress",msgstr:["上傳進度"]},"When an incoming folder is selected, any conflicting files within it will also be overwritten.":{msgid:"When an incoming folder is selected, any conflicting files within it will also be overwritten.",msgstr:["選取傳入資料夾後,其中任何的衝突檔案都會被覆寫。"]},"Which files do you want to keep?":{msgid:"Which files do you want to keep?",msgstr:["您想保留哪些檔案?"]},"You need to select at least one version of each file to continue.":{msgid:"You need to select at least one version of each file to continue.",msgstr:["您必須為每個檔案都至少選取一個版本以繼續。"]}}}}}].map(e=>L.addTranslation(e.locale,e.json));const F=L.build(),_=F.ngettext.bind(F),N=F.gettext.bind(F);class A extends Error{constructor(e){super(N("Upload has been cancelled"),{cause:e})}}const P=(0,p.YK)().setApp("@nextcloud/upload").detectUser().build();async function z(e,s,t){const n={headers:{},onUploadProgress:()=>{},onUploadRetry:()=>{},retries:5,...t};let i;return i=s instanceof Blob?s:await s(),n.destinationFile&&(n.headers.Destination=n.destinationFile),n.headers["Content-Type"]||(n.headers["Content-Type"]="application/octet-stream"),await m.Ay.request({method:"PUT",url:e,data:i,signal:n.signal,onUploadProgress:n.onUploadProgress,headers:n.headers,"axios-retry":{retries:n.retries,retryDelay:(e,s)=>(0,f.Nv)(e,s,1e3),retryCondition:e=>507!==e.status&&(423===e.status||(0,f.Gp)(e)),onRetry:n.onUploadRetry}})}(0,f.Ay)(m.Ay,{retries:0});const j=function(e,s,t){return 0===s&&e.size<=t?Promise.resolve(new Blob([e],{type:e.type||"application/octet-stream"})):Promise.resolve(new Blob([e.slice(s,s+t)],{type:"application/octet-stream"}))},I=function(e=void 0){const s=window.OC?.appConfig?.files?.max_chunk_size;if(s<=0)return 0;if(!Number(s))return 10485760;const t=Math.max(Number(s),5242880);return void 0===e?t:Math.max(t,Math.ceil(e/1e4))};var B=(e=>(e[e.INITIALIZED=0]="INITIALIZED",e[e.UPLOADING=1]="UPLOADING",e[e.ASSEMBLING=2]="ASSEMBLING",e[e.FINISHED=3]="FINISHED",e[e.CANCELLED=4]="CANCELLED",e[e.FAILED=5]="FAILED",e))(B||{});class E{_source;_file;_isChunked;_chunks;_size;_uploaded=0;_startTime=0;_status=0;_controller;_response=null;constructor(e,s=!1,t,n){const i=Math.min(I()>0?Math.ceil(t/I()):1,1e4);this._source=e,this._isChunked=s&&I()>0&&i>1,this._chunks=this._isChunked?i:1,this._size=t,this._file=n,this._controller=new AbortController}get source(){return this._source}get file(){return this._file}get isChunked(){return this._isChunked}get chunks(){return this._chunks}get size(){return this._size}get startTime(){return this._startTime}set response(e){this._response=e}get response(){return this._response}get uploaded(){return this._uploaded}set uploaded(e){if(e>=this._size)return this._status=this._isChunked?2:3,void(this._uploaded=this._size);this._status=1,this._uploaded=e,0===this._startTime&&(this._startTime=(new Date).getTime())}get status(){return this._status}set status(e){this._status=e}get signal(){return this._controller.signal}cancel(){this._controller.abort(),this._status=4}}const W=e=>"FileSystemFileEntry"in window&&e instanceof FileSystemFileEntry,R=e=>"FileSystemEntry"in window&&e instanceof FileSystemEntry;class D extends File{_originalName;_path;_children;constructor(e){super([],(0,o.P8)(e),{type:"httpd/unix-directory",lastModified:0}),this._children=new Map,this._originalName=(0,o.P8)(e),this._path=e}get size(){return this.children.reduce((e,s)=>e+s.size,0)}get lastModified(){return this.children.reduce((e,s)=>Math.max(e,s.lastModified),0)}get originalName(){return this._originalName}get children(){return Array.from(this._children.values())}get webkitRelativePath(){return this._path}getChild(e){return this._children.get(e)??null}async addChildren(e){for(const s of e)await this.addChild(s)}async addChild(e){const s=this._path&&`${this._path}/`;if(W(e))e=await new Promise((s,t)=>e.file(s,t));else if("FileSystemDirectoryEntry"in window&&e instanceof FileSystemDirectoryEntry){const t=e.createReader(),n=await new Promise((e,s)=>t.readEntries(e,s)),i=new D(`${s}${e.name}`);return await i.addChildren(n),void this._children.set(e.name,i)}const t=e.webkitRelativePath??e.name;if(t.includes("/")){if(!t.startsWith(this._path))throw new Error(`File ${t} is not a child of ${this._path}`);const n=t.slice(s.length),i=(0,o.P8)(n);if(i===n)this._children.set(i,e);else{const t=n.slice(0,n.indexOf("/"));if(this._children.has(t))await this._children.get(t).addChild(e);else{const n=new D(`${s}${t}`);await n.addChild(e),this._children.set(t,n)}}}else this._children.set(e.name,e)}}class Y extends h.m{_done=0;_total=0;_progress=0;_status=0;_startTime=-1;_elapsedTime=0;_speed=-1;_eta=1/0;_cutoffTime=2.5;constructor(e={}){super(),e.start&&this.resume(),e.total&&this.update(0,e.total),this._cutoffTime=e.cutoffTime??2.5}add(e){this.update(this._done+e)}update(e,s){if(2!==this.status)return;s&&s>0&&(this._total=s);const t=e-this._done,n=(Date.now()-this._startTime)/1e3;this._startTime=Date.now(),this._elapsedTime+=n,this._done=e,this._progress=this._done/this._total;const i=this._cutoffTime+n;if(this._elapsedTime>i){const e=n/(n+1/this._cutoffTime),s=this._done-t+(1-e)*t;this._speed=Math.round(s/this._elapsedTime)}else if(-1===this._speed&&this._elapsedTime>n){const s=(this._total-e)/(e/this._elapsedTime);(this._eta!==1/0||s<=2*this._cutoffTime)&&(this._eta=s)}this._speed>0&&(this._eta=Math.round((this._total-this._done)/this._speed)),this.dispatchTypedEvent("update",new CustomEvent("update",{cancelable:!1}))}reset(){this._done=0,this._total=0,this._progress=0,this._elapsedTime=0,this._eta=1/0,this._speed=-1,this._startTime=-1,this._status=0,this.dispatchTypedEvent("reset",new CustomEvent("reset"))}pause(){2===this._status&&(this._status=1,this._elapsedTime+=(Date.now()-this._startTime)/1e3,this.dispatchTypedEvent("pause",new CustomEvent("pause")))}resume(){2!==this._status&&(this._startTime=Date.now(),this._status=2,this.dispatchTypedEvent("resume",new CustomEvent("resume")))}get status(){return this._status}get progress(){return Math.round(1e4*this._progress)/100}get time(){return this._eta}get timeReadable(){if(this._eta===1/0)return N("estimating time left");if(this._eta<10)return N("a few seconds left");if(this._eta<60)return _("{seconds} seconds left","{seconds} seconds left",this._eta,{seconds:this._eta});const e=String(Math.floor(this._eta/3600)).padStart(2,"0"),s=String(Math.floor(this._eta%3600/60)).padStart(2,"0"),t=String(this._eta%60).padStart(2,"0");return N("{time} left",{time:`${e}:${s}:${t}`})}get speed(){return this._speed}get speedReadable(){return this._speed>0?`${(0,a.v7)(this._speed,!0)}∕s`:""}}var O=(e=>(e[e.IDLE=0]="IDLE",e[e.UPLOADING=1]="UPLOADING",e[e.PAUSED=2]="PAUSED",e))(O||{});class M{_destinationFolder;_isPublic;_customHeaders;_uploadQueue=[];_jobQueue=new g.A({concurrency:(0,r.F)().files?.chunked_upload?.max_parallel_count??5});_queueSize=0;_queueProgress=0;_queueStatus=0;_eta=new Y;_notifiers=[];constructor(e=!1,s){if(this._isPublic=e,this._customHeaders={},!s){const t=`${a.PY}${a.lJ}`;let n;if(e)n="anonymous";else{const e=(0,i.HW)()?.uid;if(!e)throw new Error("User is not logged in");n=e}s=new a.vd({id:0,owner:n,permissions:a.aX.ALL,root:a.lJ,source:t})}this.destination=s,P.debug("Upload workspace initialized",{destination:this.destination,root:this.root,isPublic:e,maxChunksSize:I()})}get destination(){return this._destinationFolder}set destination(e){if(!e||e.type!==a.pt.Folder||!e.source)throw new Error("Invalid destination folder");P.debug("Destination set",{folder:e}),this._destinationFolder=e}get root(){return this._destinationFolder.source}get customHeaders(){return structuredClone(this._customHeaders)}setCustomHeader(e,s=""){this._customHeaders[e]=s}deleteCustomerHeader(e){delete this._customHeaders[e]}get queue(){return this._uploadQueue}reset(){this._eta.reset(),0===this._uploadQueue.length&&0===this._jobQueue.size||(this._uploadQueue.splice(0,this._uploadQueue.length),this._jobQueue.clear(),this._queueSize=0,this._queueProgress=0,this._queueStatus=0,P.debug("Uploader state reset"))}pause(){this._eta.pause(),this._jobQueue.pause(),this._queueStatus=2,this.updateStats(),P.debug("Uploader paused")}start(){this._eta.resume(),this._jobQueue.start(),this._queueStatus=1,this.updateStats(),P.debug("Uploader resumed")}get eta(){return this._eta}get info(){return{size:this._queueSize,progress:this._queueProgress,status:this._queueStatus}}updateStats(){const e=this._uploadQueue.map(e=>e.size).reduce((e,s)=>e+s,0),s=this._uploadQueue.map(e=>e.uploaded).reduce((e,s)=>e+s,0);if(this._eta.update(s,e),this._queueSize=e,this._queueProgress=s,2!==this._queueStatus){const e=this._uploadQueue.find(({status:e})=>[B.INITIALIZED,B.UPLOADING,B.ASSEMBLING].includes(e));this._jobQueue.size>0||e?this._queueStatus=1:(this.eta.reset(),this._queueStatus=0)}}addNotifier(e){this._notifiers.push(e)}_notifyAll(e){for(const s of this._notifiers)try{s(e)}catch(s){P.warn("Error in upload notifier",{error:s,source:e.source})}}batchUpload(e,s,t){return t||(t=async e=>e),new d.A(async(n,i,o)=>{const l=new D("");await l.addChildren(s);const r=`${this.root.replace(/\/$/,"")}/${e.replace(/^\//,"")}`,d=new E(r,!1,0,l);d.status=B.UPLOADING,this._uploadQueue.push(d),P.debug("Starting new batch upload",{target:r});try{const s=(0,a.H4)(this.root,this._customHeaders),i=this.uploadDirectory(e,l,t,s);o(()=>i.cancel());const r=await i;d.status=B.FINISHED,n(r)}catch(e){(0,m.FZ)(e)||e instanceof A?(P.info("Upload cancelled by user",{error:e}),d.status=B.CANCELLED,i(new A(e))):(P.error("Error in batch upload",{error:e}),d.status=B.FAILED,i(e))}finally{this._notifyAll(d),this.updateStats()}})}createDirectory(e,s,t){const n=(0,l.normalize)(`${e}/${s.name}`).replace(/\/$/,""),i=`${this.root.replace(/\/$/,"")}/${n.replace(/^\//,"")}`;if(!s.name)throw new Error("Can not create empty directory");const a=new E(i,!1,0,s);return this._uploadQueue.push(a),new d.A(async(e,i,o)=>{const l=new AbortController;o(()=>l.abort()),a.signal.addEventListener("abort",()=>i(N("Upload has been cancelled"))),await this._jobQueue.add(async()=>{a.status=B.UPLOADING;try{await t.createDirectory(n,{signal:l.signal}),e(a)}catch(t){(0,m.FZ)(t)||t instanceof A?(a.status=B.CANCELLED,i(new A(t))):t&&"object"==typeof t&&"status"in t&&405===t.status?(P.debug("Directory already exists, writing into it",{directory:s.name}),a.status=B.FINISHED,e(a)):(a.status=B.FAILED,i(t))}finally{this._notifyAll(a),this.updateStats()}})})}uploadDirectory(e,s,t,n){const i=(0,l.normalize)(`${e}/${s.name}`).replace(/\/$/,"");return new d.A(async(a,o,l)=>{const r=new AbortController;l(()=>r.abort());const m=await t(s.children,i);if(!1===m)return P.debug("Upload canceled by user",{directory:s}),void o(new A("Conflict resolution cancelled by user"));if(0===m.length&&s.children.length>0)return P.debug("Skipping directory, as all files were skipped by user",{directory:s}),void a([]);const d=[],g=[];r.signal.addEventListener("abort",()=>{d.forEach(e=>e.cancel()),g.forEach(e=>e.cancel())}),P.debug("Start directory upload",{directory:s});try{s.name&&(g.push(this.createDirectory(e,s,n)),await g.at(-1));for(const e of m)e instanceof D?d.push(this.uploadDirectory(i,e,t,n)):g.push(this.upload(`${i}/${e.name}`,e));a([await Promise.all(g),...await Promise.all(d)].flat())}catch(e){r.abort(e),o(e)}})}upload(e,s,t,a=5){const l=`${(t=t||this.root).replace(/\/$/,"")}/${e.replace(/^\//,"")}`,{origin:g}=new URL(l),c=g+(0,o.O0)(l.slice(g.length));return this.eta.resume(),P.debug(`Uploading ${s.name} to ${c}`),new d.A(async(e,t,o)=>{W(s)&&(s=await new Promise(e=>s.file(e,t)));const d=s,g=(0,r.F)().dav?.public_shares_chunking??!1,p=I("size"in d?d.size:void 0),h=this._isPublic&&!g||0===p||"size"in d&&d.size{try{w.response=await z(c,s,{signal:w.signal,onUploadProgress:({bytes:e})=>{w.uploaded+=.9*e,this.updateStats()},onUploadRetry:()=>{w.uploaded=0,this.updateStats()},headers:{...this._customHeaders,...this._mtimeHeader(d),"Content-Type":d.type}}),w.uploaded=w.size,this.updateStats(),P.debug(`Successfully uploaded ${d.name}`,{file:d,upload:w}),e(w)}catch(e){if((0,m.FZ)(e)||e instanceof A)return w.status=B.CANCELLED,void t(new A(e));e?.response&&(w.response=e.response),w.status=B.FAILED,P.error(`Failed uploading ${d.name}`,{error:e,file:d,upload:w}),t(N("Failed to upload the file"))}this._notifyAll(w)};this._jobQueue.add(n),this.updateStats()}else{P.debug("Initializing chunked upload",{file:d,upload:w});const s=await async function(e,s=5,t=!1){let a;a=t?`${(0,u.$_)()}/public.php/dav/uploads/${(0,n.G)()}`:(0,u.dC)(`dav/uploads/${(0,i.HW)()?.uid}`);const o=`${a}/web-file-upload-${[...Array(16)].map(()=>Math.floor(16*Math.random()).toString(16)).join("")}`,l=e?{Destination:e}:void 0;return await m.Ay.request({method:"MKCOL",url:o,headers:l,"axios-retry":{retries:s,retryDelay:(e,s)=>(0,f.Nv)(e,s,1e3)}}),P.debug("Created temporary upload workspace",{url:o}),o}(c,a,this._isPublic),o=[];for(let e=0;ej(d,t,p),l=()=>{let o=0;return z(`${s}/${e+1}`,i,{signal:w.signal,destinationFile:c,retries:a,onUploadProgress:({bytes:e})=>{const s=.9*e;o+=s,w.uploaded+=s,this.updateStats()},onUploadRetry:()=>{w.uploaded-=o,o=0,this.updateStats()},headers:{...this._customHeaders,...this._mtimeHeader(d),"OC-Total-Length":d.size,"Content-Type":"application/octet-stream"}}).then(()=>{w.uploaded+=n-t-o,this.updateStats()}).catch(s=>{if(507===s?.response?.status)throw P.error("Upload failed, not enough space on the server or quota exceeded. Cancelling the remaining chunks",{error:s,upload:w}),w.cancel(),w.status=B.FAILED,s;throw(0,m.FZ)(s)||(P.error(`Chunk ${e+1} ${t} - ${n} uploading failed`,{error:s,upload:w}),w.cancel(),w.status=B.FAILED),s})};o.push(this._jobQueue.add(l))}const l=async()=>{try{await Promise.all(o),w.status=B.ASSEMBLING,this.updateStats(),w.response=await m.Ay.request({method:"MOVE",url:`${s}/.file`,headers:{...this._customHeaders,...this._mtimeHeader(d),"OC-Total-Length":d.size,Destination:c}}),w.status=B.FINISHED,this.updateStats(),P.debug(`Successfully uploaded ${d.name}`,{file:d,upload:w}),e(w)}catch(e){(0,m.FZ)(e)||e instanceof A?(w.status=B.CANCELLED,t(new A(e))):(w.status=B.FAILED,t(N("Failed to assemble the chunks together"))),m.Ay.request({method:"DELETE",url:`${s}`})}finally{this._notifyAll(w)}};this._jobQueue.add(l)}return this._jobQueue.onIdle().then(()=>this.reset()),w})}_mtimeHeader(e){const s=Math.floor(e.lastModified/1e3);return s>0?{"X-OC-Mtime":s}:{}}}function H(e=(0,n.f)(),s=!1){return(s||void 0===window._nc_uploader)&&(window._nc_uploader=new M(e)),window._nc_uploader}function q(e){const s=(0,w.$V)(()=>Promise.all([t.e(4208),t.e(6590)]).then(t.bind(t,11352))),{promise:n,reject:i,resolve:o}=Promise.withResolvers();return(0,k.Ss)(s,{error:e,validateFilename:a.KT},(...e)=>{const[{skip:s,rename:t}]=e;s?o(!1):t?o(t):i()}),n}function V(e,s,t,n,i,a,o,l){var r="function"==typeof e?e.options:e;return s&&(r.render=s,r.staticRenderFns=t,r._compiled=!0),a&&(r._scopeId="data-v-"+a),{exports:e,options:r}}const K=V({name:"CancelIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon cancel-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(s){return e.$emit("click",s)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},[],0,0,null).exports,G=V({name:"FolderUploadIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon folder-upload-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(s){return e.$emit("click",s)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M20,6A2,2 0 0,1 22,8V18A2,2 0 0,1 20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4H10L12,6H20M10.75,13H14V17H16V13H19.25L15,8.75"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},[],0,0,null).exports,J=V({name:"PlusIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon plus-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(s){return e.$emit("click",s)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},[],0,0,null).exports,$=V({name:"UploadIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon upload-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(s){return e.$emit("click",s)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},[],0,0,null).exports,Q=V((0,w.pM)({name:"UploadPicker",components:{IconCancel:K,IconFolderUpload:G,IconPlus:J,IconUpload:$,NcActionButton:b.A,NcActionCaption:T.A,NcActionSeparator:x.A,NcActions:y.A,NcButton:U.A,NcIconSvgWrapper:C.A,NcProgressBar:S.A},props:{accept:{type:Array,default:null},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},noMenu:{type:Boolean,default:!1},noLabel:{type:Boolean,default:!1},primary:{type:Boolean,default:!1},destination:{type:a.vd,default:void 0},allowFolders:{type:Boolean,default:!1},content:{type:[Array,Function],default:()=>[]},forbiddenCharacters:{type:Array,default:()=>[]}},setup:()=>({t:N,progressTimeId:`nc-uploader-progress-${Math.random().toString(36).slice(7)}`}),data:()=>({newFileMenuEntries:[],openedMenu:!1,uploadManager:H()}),computed:{menuEntriesUpload(){return this.newFileMenuEntries.filter(e=>e.category===a.a7.UploadFromDevice)},menuEntriesNew(){return this.newFileMenuEntries.filter(e=>e.category===a.a7.CreateNew)},menuEntriesOther(){return this.newFileMenuEntries.filter(e=>e.category===a.a7.Other)},canUploadFolders(){return this.allowFolders&&"webkitdirectory"in document.createElement("input")},queue(){return this.uploadManager.queue},hasFailure(){return this.queue.some(e=>e.status===B.FAILED)},isAssembling(){return this.queue.some(e=>e.status===B.ASSEMBLING)},isUploading(){return this.queue.some(e=>e.status!==B.CANCELLED)},isOnlyAssembling(){return this.isAssembling&&this.queue.every(e=>0===e.size||e.status===B.ASSEMBLING||e.status===B.FINISHED)},isPaused(){return this.uploadManager.info?.status===O.PAUSED},buttonLabel(){return this.noMenu?N("Upload"):N("New")},haveMenu(){return!((this.noMenu||0===this.newFileMenuEntries.length)&&!this.canUploadFolders)}},watch:{allowFolders:{immediate:!0,handler(){"function"!=typeof this.content&&this.allowFolders&&P.error("[UploadPicker] Setting `allowFolders` is only allowed if `content` is a function")}},destination(e){this.setDestination(e)},isPaused(e){e?this.$emit("paused",this.queue):this.$emit("resumed",this.queue)}},beforeMount(){this.destination&&this.setDestination(this.destination),this.uploadManager.addNotifier(this.onUploadCompletion),(0,v.C)("u",this.onKeyDown,{stop:!0,prevent:!0,shift:!0}),(0,v.C)("Escape",this.onKeyDown,{stop:!0,prevent:!0}),P.debug("UploadPicker initialised")},methods:{etaTimeAndSpeed(){const e=this.uploadManager.eta.speedReadable;return e?`${this.uploadManager.eta.timeReadable} (${e})`:this.uploadManager.eta.timeReadable},async onClick(e){e.handler(this.destination,await this.getContent().catch(()=>[]))},onTriggerPick(e=!1){const s=this.$refs.input;this.canUploadFolders&&(s.webkitdirectory=e),this.$nextTick(()=>s.click())},async getContent(e){return Array.isArray(this.content)?this.content:await this.content(e)},async onPick(){const e=this.$refs.input,s=e.files?Array.from(e.files):[];try{await this.uploadManager.batchUpload("",s,(n=this.getContent,async(e,s)=>{try{const i=await n(s).catch(()=>[]),l=function(e,s){const t=s.map(e=>e.basename);return e.filter(e=>{const s="basename"in e?e.basename:e.name;return-1!==t.indexOf(s)})}(e,i);if(l.length>0){const{selected:n,renamed:a}=await async function(e,s,n,i){const a=(0,w.$V)(()=>Promise.all([t.e(4208),t.e(9107)]).then(t.bind(t,99107)));return new Promise((t,o)=>{const l=new w.Ay({name:"ConflictPickerRoot",render:r=>r(a,{props:{dirname:e,conflicts:s,content:n,recursiveUpload:!0===i?.recursive},on:{submit(e){t(e),l.$destroy(),l.$el?.parentNode?.removeChild(l.$el)},cancel(e){o(e??new Error("Canceled")),l.$destroy(),l.$el?.parentNode?.removeChild(l.$el)}}})});l.$mount(),document.body.appendChild(l.$el)})}(s,l,i,{recursive:!0});e=[...e.filter(e=>!l.includes(e)),...n,...a]}const r=[];for(const s of e)try{(0,a.KT)(s.name),r.push(s)}catch(t){if(!(t instanceof a.di))throw P.error(`Unexpected error while validating ${s.name}`,{error:t}),t;let n=await q(t);!1!==n&&(n=(0,a.E6)(n,e.map(e=>e.name)),Object.defineProperty(s,"name",{value:n}),r.push(s))}if(0===r.length&&e.length>0){const e=(0,o.P8)(s);(0,k.cf)(e?N('Upload of "{folder}" has been skipped',{folder:e}):N("Upload has been skipped"))}return r}catch(e){return P.debug("Upload has been cancelled",{error:e}),(0,k.I9)(N("Upload has been cancelled")),!1}}))}catch(e){P.debug("Error while uploading",{error:e})}finally{this.resetForm()}var n},resetForm(){const e=this.$refs.form;e?.reset()},onCancel(){this.uploadManager.queue.forEach(e=>{e.cancel()}),this.resetForm()},setDestination(e){this.destination?(this.uploadManager.destination=e,this.newFileMenuEntries=(0,a.m1)(e)):P.debug("Invalid destination")},onUploadCompletion(e){e.status===B.FAILED?this.$emit("failed",e):this.$emit("uploaded",e)},onKeyDown(e){if("u"===e.key){if(this.haveMenu)return void(this.openedMenu=!0);this.onTriggerPick()}"Escape"===e.key&&this.openedMenu&&(this.openedMenu=!1)}}}),function(){var e=this,s=e._self._c;return e._self._setupProxy,e.destination?s("form",{ref:"form",staticClass:"upload-picker",class:{"upload-picker--uploading":e.isUploading,"upload-picker--paused":e.isPaused},attrs:{"data-cy-upload-picker":""}},[e.haveMenu?s("NcActions",{attrs:{"aria-label":e.buttonLabel,"menu-name":e.noLabel?void 0:e.buttonLabel,open:e.openedMenu,type:e.primary?"primary":"secondary"},on:{"update:open":function(s){e.openedMenu=s}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPlus",{attrs:{size:20}})]},proxy:!0}],null,!1,1991456921)},[s("NcActionCaption",{attrs:{name:e.t("Upload from device")}}),s("NcActionButton",{attrs:{"data-cy-upload-picker-add":"","data-cy-upload-picker-menu-entry":"upload-file","close-after-click":!0},on:{click:function(s){return e.onTriggerPick()}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconUpload",{attrs:{size:20}})]},proxy:!0}],null,!1,337456192)},[e._v(" "+e._s(e.t("Upload files"))+" ")]),e.canUploadFolders?s("NcActionButton",{attrs:{"close-after-click":"","data-cy-upload-picker-add-folders":"","data-cy-upload-picker-menu-entry":"upload-folder"},on:{click:function(s){return e.onTriggerPick(!0)}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconFolderUpload",{attrs:{size:20}})]},proxy:!0}],null,!1,931184598)},[e._v(" "+e._s(e.t("Upload folders"))+" ")]):e._e(),e.noMenu?e._e():e._l(e.menuEntriesUpload,function(t){return s("NcActionButton",{key:t.id,staticClass:"upload-picker__menu-entry",attrs:{icon:t.iconClass,"close-after-click":!0,"data-cy-upload-picker-menu-entry":t.id},on:{click:function(s){return e.onClick(t)}},scopedSlots:e._u([t.iconSvgInline?{key:"icon",fn:function(){return[s("NcIconSvgWrapper",{attrs:{svg:t.iconSvgInline}})]},proxy:!0}:null],null,!0)},[e._v(" "+e._s(t.displayName)+" ")])}),!e.noMenu&&e.menuEntriesNew.length>0?[s("NcActionSeparator"),s("NcActionCaption",{attrs:{name:e.t("Create new")}}),e._l(e.menuEntriesNew,function(t){return s("NcActionButton",{key:t.id,staticClass:"upload-picker__menu-entry",attrs:{icon:t.iconClass,"close-after-click":!0,"data-cy-upload-picker-menu-entry":t.id},on:{click:function(s){return e.onClick(t)}},scopedSlots:e._u([t.iconSvgInline?{key:"icon",fn:function(){return[s("NcIconSvgWrapper",{attrs:{svg:t.iconSvgInline}})]},proxy:!0}:null],null,!0)},[e._v(" "+e._s(t.displayName)+" ")])})]:e._e(),!e.noMenu&&e.menuEntriesOther.length>0?[s("NcActionSeparator"),e._l(e.menuEntriesOther,function(t){return s("NcActionButton",{key:t.id,staticClass:"upload-picker__menu-entry",attrs:{icon:t.iconClass,"close-after-click":!0,"data-cy-upload-picker-menu-entry":t.id},on:{click:function(s){return e.onClick(t)}},scopedSlots:e._u([t.iconSvgInline?{key:"icon",fn:function(){return[s("NcIconSvgWrapper",{attrs:{svg:t.iconSvgInline}})]},proxy:!0}:null],null,!0)},[e._v(" "+e._s(t.displayName)+" ")])})]:e._e()],2):s("NcButton",{attrs:{"aria-label":e.buttonLabel,disabled:e.disabled,"data-cy-upload-picker-add":"","data-cy-upload-picker-menu-entry":"upload-file",type:e.primary?"primary":"secondary"},on:{click:function(s){return e.onTriggerPick()}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPlus",{attrs:{size:20}})]},proxy:!0},e.isUploading?null:{key:"default",fn:function(){return[e._v(" "+e._s(e.buttonLabel)+" ")]},proxy:!0}],null,!0)}),s("div",{directives:[{name:"show",rawName:"v-show",value:e.isUploading,expression:"isUploading"}],staticClass:"upload-picker__progress"},[s("NcProgressBar",{attrs:{"aria-label":e.t("Upload progress"),"aria-describedby":e.progressTimeId,"data-cy-upload-picker-progress":"",error:e.hasFailure,value:e.uploadManager.eta.progress,size:"medium"}}),s("p",{attrs:{id:e.progressTimeId,"data-cy-upload-picker-progress-label":""}},[e.isPaused?s("span",[e._v(" "+e._s(e.t("paused"))+" ")]):e.isOnlyAssembling?s("span",[e._v(" "+e._s(e.t("assembling"))+" ")]):s("span",{attrs:{title:e.etaTimeAndSpeed()}},[e._v(" "+e._s(e.uploadManager.eta.timeReadable)+" "),e.uploadManager.eta.speedReadable&&e.uploadManager.eta.time>=60?s("span",[e._v(" ("+e._s(e.uploadManager.eta.speedReadable)+") ")]):e._e()])])],1),e.isUploading&&!e.isOnlyAssembling?s("NcButton",{staticClass:"upload-picker__cancel",attrs:{type:"tertiary","aria-label":e.t("Cancel uploads"),"data-cy-upload-picker-cancel":""},on:{click:e.onCancel},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconCancel",{attrs:{size:20}})]},proxy:!0}],null,!1,3076329829)}):e._e(),s("input",{ref:"input",staticClass:"hidden-visually",attrs:{accept:e.accept?.join?.(", "),multiple:e.multiple,"data-cy-upload-picker-input":"",type:"file"},on:{change:e.onPick}})],1):e._e()},[],0,0,"a66c1264").exports}}]);
//# sourceMappingURL=3183-3183.js.map?v=c50f35f53ad73e31c102