HEX
Server: Apache/2.4.63 (Unix)
System: Linux Synopilou92 4.4.302+ #72806 SMP Mon Jul 21 23:16:00 CST 2025 x86_64
User: pilou92 (1026)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: //volume1/@appstore/Spreadsheet/ui/dist/ui.basic_app.js
(globalThis.webpackChunksynoffice_ui=globalThis.webpackChunksynoffice_ui||[]).push([["921"],{61367:function(e,t,i){"use strict";function n(e,t){let i=t.find(t=>{let[i,n]=t;return n instanceof RegExp?n.test(e):"function"==typeof n&&n(e)});return i?i[0]:null}i.r(t),i.d(t,{isBrowser:()=>a,isIPadOS:()=>m,isIOS:()=>g,getBrowser:()=>r,isNode:()=>s,isPlatform:()=>O,getPlatform:()=>h,isChrome:()=>l,isFirefox:()=>S,isOSKSupported:()=>A,isSafari:()=>f,isMobileLayout:()=>I,isAndroid:()=>v,isWindows:()=>D,getNetworkProtocol:()=>b,isOpera:()=>c,isTouchSupported:()=>P,isAndroidWebview:()=>d,isIOSFamily:()=>_,isLinux:()=>N,getNetworkConnectionParallelism:()=>Y,isMac:()=>w});let o="undefined"==typeof navigator?"node":n(navigator.userAgent,[["opera",/opera/i],["chrome",/chrome/i],["safari",/safari/i],["firefox",/gecko\/\d/i]]);function r(){return o}function a(e){return o===e}function s(){return a("node")}function c(){return a("opera")}function l(){return a("chrome")}function f(){return a("safari")}function S(){return a("firefox")}let p="undefined"!=typeof navigator&&/\bwv\b/.test(navigator.userAgent);function d(){return p}let u="undefined"==typeof navigator?null:n(navigator.userAgent,[["ios",()=>/iPhone|iPad|iPod/i.test(navigator.platform)],["ipad",()=>/MacIntel/i.test(navigator.platform)&&navigator.maxTouchPoints>1],["android",/android/i],["windows",/windows|win32/i],["linux",/linux/i],["mac",/Mac_PowerPC|Macintosh/i]]);function h(){return u}function O(e){return u===e}function m(){return O("ipad")}function g(){return O("ios")}function v(){return O("android")}function D(){return O("windows")}function N(){return O("linux")}function w(){return O("mac")}function _(){return g()||m()}let y=function(){if("undefined"==typeof performance)return null;let e=performance.getEntriesByType?.("navigation")[0]||performance.getEntries?.()[0];return e&&e.nextHopProtocol||null}();function b(){return y}function Y(){switch(y){case"http/0.9":case"http/1.0":case"http/1.1":return"limited";case"h2":case"h2c":case"h3":return"unlimited";default:return"unknown"}}let E="undefined"!=typeof navigator&&/mobile/i.test(navigator.userAgent);function I(){return E||g()||v()}function A(){return g()||m()||v()}function P(){return navigator.maxTouchPoints>0}},48233:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BaseTaskQueue",{enumerable:!0,get:function(){return r}});let n=i(5399),o=()=>{};class r{constructor(e={}){let{concurrency:t=1/0,mode:i="auto"}=e;this.concurrency=Math.max(t,0),this.mode=i,this.runningCount=0,this.processingScheduled=!1}createTaskWrapper(e,t){void 0===t&&(t={});let{priority:i=0,signal:r,arg:a}=t,s=new n.TaskWrapper(e,a,i,r);if(r){let e=()=>{this._remove(s),s.abort()};r.addEventListener("abort",e),s.wait().catch(o).finally(()=>r.removeEventListener("abort",e))}return s}enqueue(e,t){let i=this.createTaskWrapper(e,t);return this._add(i),this.consumeAuto(),i.wait()}consume(){"manual-sync"===this.mode&&this.doConsumeSync()}getRunningCount(){return this.runningCount}getTotalCount(){return this.getWaitingCount()+this.getRunningCount()}isEmpty(){return 0===this.getWaitingCount()}isFullLoad(){return this.runningCount>=this.concurrency}isIdle(){return!this.isFullLoad()&&this.isEmpty()}stat(e){return{running:this.getRunningCount(),waiting:this.getWaitingCount(),queue:e?this.statQueue(e):void 0}}consumeAuto(){"auto"===this.mode&&this.doConsumeAsync()}doConsumeAsync(){this.processingScheduled||(this.processingScheduled=!0,setImmediate(()=>{this.processingScheduled=!1,this.doConsumeSync()}))}doConsumeSync(){for(;!this.isFullLoad()&&!this.isEmpty();){let e=this._pop();this.runningCount++,(e?e.execute().catch(o):Promise.resolve()).then(()=>this._onTaskDone())}}_onTaskDone(){this.runningCount--,this.consumeAuto()}}},8626:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={HibernationController:function(){return c},HibernationTaskQueue:function(){return S}};for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:n[o]});let r=i(48233),a=i(5509),s=AbortController;class c extends s{constructor(){super(),this.signal.sleeping=!0}wake(){let e=this.signal;!e.aborted&&e.sleeping&&(e.sleeping=!1,e.dispatchEvent(new Event("wake")))}sleep(){let e=this.signal;e.aborted||e.sleeping||(e.sleeping=!0,e.dispatchEvent(new Event("sleep")))}}function l(e){return{...e,concurrency:0,mode:"disabled"}}class f extends r.BaseTaskQueue{constructor(e){super(l(e)),this.set=new Set}consume(){}clear(){this.set.clear()}getWaitingCount(){return this.set.size}statQueue(e){return Array.from(this.set).map(t=>e(t.getFn(),t.getArg()))}_add(e){this.set.add(e)}_remove(e){this.set.delete(e)}_pop(){}}class S extends r.BaseTaskQueue{constructor(e=Object.create(null)){super(l(e)),this.activeQueue=new(e.activeConstructor||a.TaskQueue)(e),this.passiveQueue=new f(e)}enqueue(e,t){void 0===t&&(t={});let{signal:i}=t;return i?this.enqueuePassive(e,t):this.activeQueue.enqueue(e,t)}enqueueActive(e,t){let i=t.signal;return i?new Promise((n,o)=>{let r=new AbortController,a=()=>{r.abort(i.reason)},s=()=>{r.abort(i.reason),n(this.enqueuePassive(e,t))};i.addEventListener("abort",a),i.addEventListener("sleep",s),this.activeQueue.enqueue(e,{...t,signal:r.signal}).finally(()=>{i.removeEventListener("abort",a),i.removeEventListener("sleep",s)}).then(n,o)}):Promise.reject(Error("No signal."))}enqueuePassive(e,t){let i=t.signal;return i?new Promise((n,o)=>{let r=new AbortController,a=()=>{r.abort(i.reason)},s=()=>{r.abort(i.reason),n(this.enqueueActive(e,t))};i.addEventListener("abort",a),i.addEventListener("wake",s),this.passiveQueue.enqueue(e,{...t,signal:r.signal}).finally(()=>{i.removeEventListener("abort",a),i.removeEventListener("wake",s)}).then(n,o)}):Promise.reject(Error("No signal."))}consume(){this.activeQueue.consume()}clear(){this.activeQueue.clear(),this.passiveQueue.clear()}getWaitingCount(){return this.activeQueue.getWaitingCount()+this.passiveQueue.getTotalCount()}getRunningCount(){return this.activeQueue.getRunningCount()}isFullLoad(){return this.activeQueue.isFullLoad()}statQueue(e){return[...this.activeQueue.stat(e).queue||[],...this.passiveQueue.stat(e).queue||[]]}_add(e){}_remove(e){}_pop(){}}},56925:function(e,t,i){"use strict";function n(e,t){return Object.keys(e).forEach(function(i){"default"===i||Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})}),e}Object.defineProperty(t,"__esModule",{value:!0}),n(i(48233),t),n(i(5509),t),n(i(57273),t),n(i(53472),t),n(i(8626),t)},53472:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PriorityTaskQueue",{enumerable:!0,get:function(){return o}});let n=i(5509);class o extends n.TaskQueue{_add(e){let t=function(e,t){let i=0,n=e.length;for(;i<n;){let o=i+n>>1;t(e[o])?i=o+1:n=o}return i}(this.queue,t=>t.getPriority()<e.getPriority());this.queue.splice(t,0,e)}_pop(){return this.queue.pop()}}},5509:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"TaskQueue",{enumerable:!0,get:function(){return o}});let n=i(48233);class o extends n.BaseTaskQueue{constructor(e){super(e),this.queue=[]}clear(){this.queue.length=0}getWaitingCount(){return this.queue.length}statQueue(e){return this.queue.map(t=>e(t.getFn(),t.getArg()))}_add(e){this.queue.push(e)}_remove(e){let t=this.queue.indexOf(e);t>=0&&this.queue.splice(t,1)}_pop(){return this.queue.shift()}}},57273:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"TaskStack",{enumerable:!0,get:function(){return o}});let n=i(5509);class o extends n.TaskQueue{_pop(){return this.queue.pop()}}},5399:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"TaskWrapper",{enumerable:!0,get:function(){return n}});let i=()=>{};class n{constructor(e,t,n,o){this.fn=e,this.arg=t,this.priority=n,this.signal=o,this.executed=!1,this.resolver=i,this.rejecter=i,this.resultPromise=new Promise((e,t)=>{this.resolver=e,this.rejecter=t})}wait(){return this.resultPromise}execute(){if(!this.executed){let e;this.executed=!0;try{e=this.fn(this.arg)}catch(t){e=Promise.reject(t)}e.then(this.resolver,this.rejecter)}return this.wait()}abort(){if(this.signal){let e=Error("aborted",{cause:this.signal.reason});e.name="AbortError",this.rejecter(e)}}getPriority(){return this.priority}getFn(){return this.fn}getArg(){return this.arg}}},14014:function(e,t,i){"use strict";let n;i.d(t,{Z:()=>w});var o=i(56925);let r=new Map;class a{constructor(e,t){this.requester=e,this.onComplete=t?.onComplete,this.requestResults=[]}reset(){this.requestResults=[]}doRequest(e){return(n??(n=new o.TaskQueue({concurrency:6}))).enqueue(this.requester.bind(null,e))}request(e){let t,{files:i}=e;if(1===i.length&&"url"===i[0].type){let n=i[0].source,o=r.get(n);o?t=o:(t=this.doRequest(e),r.set(n,t),t.catch(()=>r.delete(n)))}else t=this.doRequest(e);return this.requestResults.push(t),t}async create(e,t){if("raw"===e){if("string"==typeof t)throw Error(`The source should be a Blob. source: ${t}`);return this.request({files:[{type:e,source:"file"}],raw:{file:t}})}if("string"!=typeof t)throw Error("The source should be a string");return this.request({files:[{type:e,source:t}]})}async stat(){let e=await Promise.allSettled(this.requestResults),t=0,i=0;for(let n of e)if("fulfilled"===n.status){let{files:e,errors:o}=n.value;e&&(t+=e.length),o&&(i+=o.length)}else++i;return{total:t+i,success:t,failed:i}}async complete(){let e=this.stat();this.reset();let t=await e;this.onComplete?.(t)}static isIdle(){return!n||0===n.getTotalCount()}}var s=i(4077),c=i(45407),l=i(71783),f=i(17370),S=i(89087),p=i(32334),d=i(61431);i(32867),i(3713),i(85213);var u=i(30947),h=i.n(u),O=i(74590),m=i(61367);class g{constructor({owner:e}){this.owner=e}show(){let e=this.owner.findAppWindow();this.dlg=(0,S.QX)(SYNO.SDS.Drive.Vue.DialogRename,{title:SYNO.SDS.Office._T("template","create"),mode:"add",selectAllText:!0,label:SYNO.SDS.Office._T("template","name")+_T("common","colon"),placeholder:SYNO.SDS.Office._T("template","empty_name"),initName:SYNO.SDS.Office.Utils.parseDisplayName(SYNO.SDS.Office.Env.title),validator:this.nameValidator.bind(this),cb:t=>{this.dlg.window.setStatusBusy(void 0,_T("common","msg_waiting")),e.getAction().getThumbPromise().then(i=>{let n={title:t,encrypt:SYNO.SDS.Office.Env.isEncrypt,path:SYNO.SDS.Drive.Utils.getPathIdByLink(SYNO.SDS.Office.Env.link_id),file:{source:"raw",name:"thumb."+(i?i.ext:"png")},raw:i?i.blob:new Blob([])};i&&i.size&&(n.size=i.size),e.getWebAPI().saveTemplate({params:n,callback:(e,t)=>{if(this.dlg.window.clearStatus(),e){this.dlg.component.close(),SYNO.SDS.Office.URL.redirectLink(t.link_id);return}this.dlg.component.showMsgBox("alert","",(0,l.v2)(t))}})})}})}nameValidator(e,t,i){let n=t.trim();if(0===n.length)return i(Error(_JSLIBSTR("extlang","fieldblank")));let o="";switch(SYNO.SDS.Session.standaloneAppName){case"SYNO.SDS.Office.Sheet.Application":o=SYNO.SDS.Office.File.SHEET_EXTENSION;break;case"SYNO.SDS.Office.Doc.Application":o=SYNO.SDS.Office.File.DOC_EXTENSION;break;case"SYNO.SDS.Office.Presentation.Application":o=SYNO.SDS.Office.File.SLIDE_EXTENSION}return n.length>0&&unescape(encodeURIComponent(n)).length>=this.dlg.component.maxNameLength-o.length-1?i(Error(SYNO.SDS.Office._T("template","name_too_long"))):SYNO.SDS.Drive.Utils.checkFileName(n)?i():i(Error(SYNO.SDS.Office._T("template","reserved_name")))}}class v{constructor({owner:e,ntype:t,object_id:i,initName:n}){this.owner=e,this.ntype=t,this.object_id=i,this.initName=n}show(){let e="";switch(this.ntype){case"doc":e=SYNO.SDS.Office.File.DOC_EXTENSION;break;case"sheet":e=SYNO.SDS.Office.File.SHEET_EXTENSION;break;case"presentation":e=SYNO.SDS.Office.File.SLIDE_EXTENSION}this.ext=e,this.dlg=(0,S.QX)(SYNO.SDS.Drive.Vue.DialogRename,{selectAllText:!0,initName:this.initName,validator:this.nameValidator.bind(this),cb:e=>{this.dlg.window.setStatusBusy(void 0,_T("common","msg_waiting")),SYNO.SDS.Office.GetWebAPI().renameTemplate({params:{object_id:this.object_id,title:e},scope:this,callback:SYNO.SDS.Office.GetAction().onCreateCallBack("renametemplatedone",(e,t)=>{if(this.dlg.window.clearStatus(),e)return void this.dlg.component.close();this.dlg.component.showMsgBox("alert","",(0,l.v2)(t))},this,!1,this.owner)})}},{ownerWindow:this.owner})}nameValidator(e,t,i){let n=t.trim();return 0===n.length?i(Error(_JSLIBSTR("extlang","fieldblank"))):n.length>0&&unescape(encodeURIComponent(n)).length>=this.dlg.component.maxNameLength-this.ext.length-1?i(Error(SYNO.SDS.Office._T("template","name_too_long"))):SYNO.SDS.Drive.Utils.checkFileName(n)?i():i(Error(SYNO.SDS.Office._T("template","reserved_name")))}}let D=SYNO.SDS.Drive.Action;var N=i.n(D);Ext.ns("SYNO.SDS.Office"),Ext.ns("SYNO.SDS.Drive.Define.Info");let w=Ext.define("SYNO.SDS.Office.Action",{extend:N(),constructor:function(e){e.webapi&&(this.webapi=e.webapi),N().prototype.constructor.call(this,e),this.overrideDriveMgrAction()},overrideDriveMgrAction:function(){if(!SYNO.SDS.Office.Utils.isDrivePage())return;let e=this;SYNO.SDS.Drive.Mgr.Action.prototype.copyNode=function(t,i){if(SYNO.SDS.Drive.Mgr.FileClipboard.isEmpty())return void N().prototype.copyNode.apply(this,arguments);let n=SYNO.SDS.Drive.Mgr.FileClipboard.get();if(e.isContainNonOffice(n.recs))return void N().prototype.copyNode.apply(this,arguments);let o=(function(n,o,r){if(!n)return void this.findAppWindow().getMsgBox().alert("",(0,l.v2)(o));e.showMvcpToastMsg("copy",i,t.to_parent_folder_name,o.file_id,o.link_id,o.title)}).bind(e);e.getWebAPI().copyOfficeNode({params:t,scope:e,callback:e.onCreateBackgroundCallBack("copynodedone",o,e,n.recs)})}},findAppWindow:function(){return SYNO.SDS.Office.GetWindow()},getWebAPI:function(){return this.webapi||(this.findAppWindow().getWebAPI?this.webapi=this.findAppWindow().getWebAPI():this.webapi=new SYNO.SDS.Office.WebAPI({appWindow:this.findAppWindow()})),this.webapi},getTargets:function(){if(SYNO.SDS.Office.Utils.isDrivePage())return SYNO.SDS.Office.Action.superclass.getTargets.call(this);var e=SYNO.SDS.Office.Env;return[new Ext.data.Record({file_id:e.file_id,name:e.title,removed:e.recycle,display_path:e.display_path,parent_id:e.parent_id,encrypted:e.encrypted,permanent_link:e.link_id})]},getSelectionsAndLocation:function(){let e,t=SYNO.SDS.Office.GetAction().getTargets(),i=t[0];if(!i.get("removed")){let t=SYNO.SDS.Office.Utils.getParentDir(i.get("display_path"));if(t){let n=SYNO.SDS.Office.File.getBaseName(SYNO.SDS.Drive.Utils.parseDisplayPath(t));n&&(e={fileId:i.get("parent_id"),displayName:n})}}return{selections:t,locationInfo:e}},initEnv:function(){if(this._initToken(),this.loadOfficeConstants(),!SYNO.SDS.Drive.Utils.isAppAuthorized()){SYNO.SDS.Session.uid=SYNO.SDS.Drive.Define.AnonymousUID;return}var e=this.findAppWindow();if(this.getWebAPI().initial({callback:function(t,i){var n=function(){var n,o;if(t){n=SYNO.API.Response.GetValByAPI(i,"SYNO.Office.Info","get"),Object.assign(SYNO.SDS.Office.Define.Info,n),Ext.copyTo(SYNO.SDS.Session,n,["uid","gids"]),SYNO.SDS.Office.Define.Info.ready=!0;var r=n.version;e.appInstance.jsConfig.version=r.major+"."+r.minor+"."+r.hotfix+"-"+r.build,e.getEventMgr().fireEvent("envready",this)}else o=(0,l.v2)(SYNO.API.Response.GetFirstError(i));if(o)return void SYNO.SDS.Office.Utils.registerInitEvent(()=>{e.getEl().mask(o,"syno-ux-mask-info")})};e.rendered?n.call(e):e.mon(e,"afterlayout",n,this,{single:!0,buffer:80})},scope:e}),SYNO.SDS.Drive.Utils.isAppAuthorized()){var t=this;e.sendWebAPI({compound:{stopwhenerror:!1,params:[SYNO.SDS.Drive.WebAPIDesc.get_setting,SYNO.SDS.Drive.WebAPIDesc.info,SYNO.SDS.Drive.WebAPIDesc.get_user_setting]},callback:function(i,n){if(i&&!n.has_fail){var o,r;r=SYNO.SDS.Drive.WebAPIDesc.info,o=SYNO.API.Response.GetValByAPI(n,r.api,r.method),t.initInfoData(o),r=SYNO.SDS.Drive.WebAPIDesc.get_setting,o=SYNO.API.Response.GetValByAPI(n,r.api,r.method),t.initSettingData(o),r=SYNO.SDS.Drive.WebAPIDesc.get_user_setting,(o=SYNO.API.Response.GetValByAPI(n,r.api,r.method)).displayname_result&&(SYNO.SDS.Drive.Define.Info.displayname_result=o.displayname_result),e.getEventMgr().fireEvent("settingready",this)}},scope:e},this,1),SYNO.SDS.Office.UserSettings.init()}(0,s.$)(),(0,c.z4)(),this.initWebAPI()},initWebAPI:function(){(_F("SYNO_PRODUCT_SOFS")||_F("SYNO_PRODUCT_FSDN"))&&h().hooks.beforeRequest.use(e=>{!(!e||e.api&&e.api.startsWith("SYNO.Office."))&&"GET"===e.requestMethod&&e.params?.path&&(e.url="oo/proxy/webapi/entry.cgi/"+e.api)})},getMyDrivePath:function(){return SYNO.SDS.Drive.Define.Info.is_home?this.prepareParam({file_id:SYNO.SDS.Drive.Define.Info.drive_id}).path:void 0},getParentPath:function(){let e=SYNO.SDS.Office.Env;return e.parent_id&&SYNO.SDS.Drive.Utils.isVisibleInDrive(e.display_path)&&!SYNO.SDS.Drive.Utils.is1stSharedWithMe(e.display_path)?this.prepareParam({file_id:e.parent_id}).path:this.getMyDrivePath()},loadOfficeConstants:function(){return this._loadOfficeConstantsPromise??=h().request({api:"SYNO.Office.Info.Constants",version:1,method:"get"}).catch(e=>(console.error("Failed to get Office constants:",e),{sheet_max_cell_count:2e6,sheet_pivot_table_enabled:!1})).then(e=>{Object.assign(SYNO.SDS.Office.Define.Info,e)}),this._loadOfficeConstantsPromise},getEnvPromise:function(){var e;return this.env_promise?this.env_promise:(e=!SYNO.SDS.Drive.Utils.isAppAuthorized()||SYNO.SDS.Office.Define.Info.ready?Promise.resolve():new Promise(function(e,t){var i=SYNO.SDS.Office.GetWindow();i.mon(i.getEventMgr(),"envready",function(){e()},{single:!0})}),this.env_promise=e)},_initToken:function(){SYNO.SDS.Office.Env.isUseToken()&&SYNO.API.Request({api:"SYNO.API.Auth.Key",version:7,method:"grant",params:{allow_api:"SYNO.Office.Node.Attachment",allow_methods:["get"]},scope:this,callback:function(e,t){e&&SYNO.SDS.Office.Env.setToken(t.tid)}})},getSettingPromise:function(){return!SYNO.SDS.Drive.Utils.isAppAuthorized()||SYNO.SDS.Drive.Define.Info.settingready?Promise.resolve():this.setting_promise?this.setting_promise:this.setting_promise=new Promise(function(e,t){var i=SYNO.SDS.Office.GetWindow();i.mon(i.getEventMgr(),"settingready",function(){e()},{single:!0})})},getPersonSetting:function(){return this.getWebAPI().getPersonSetting({params:{object_id:SYNO.SDS.Office.Env.objectId}})},setPersonSetting:function(e){return this.getWebAPI().setPersonSetting({params:Ext.apply({object_id:SYNO.SDS.Office.Env.objectId},e)})},onCreateCallBack:function(e,t,i,n,o){return o=o||this.findAppWindow(),!1!==n&&o.setStatusBusy(),function(r,a,s,c,l){!1!==n&&o.clearStatusBusy(),Ext.isFunction(t)&&t.call(i||window,r,a||{},s,c,l),(r||!1===n)&&o.getEventMgr().fireEvent(e,r,a,s||{},c,e,l)}},onCreateBackgroundCallBack:function(e,t,i,n,o,r){return r=r||this.findAppWindow(),!1!==o&&r.setStatusBusy(),function(a,s,c,l,f){!1!==o&&r.clearStatusBusy(),Ext.isFunction(t)&&t.call(i||window,a,s||{},c,l,f),(a||!1===o)&&r.getEventMgr().fireEvent(e,a,s,c||{},n)}},createNode:function(e,t,i,n){return"dir"===e.ntype?void N().prototype.createNode.call(this,e,t,i):SYNO.SDS.Office.Utils.isDrivePage()?void(e=Ext.apply({path:SYNO.SDS.Office.Utils.isDrivePage()?SYNO.SDS.Drive.Utils.getPathId(this.findAppWindow().getNavigation().getLastPathId()):"/mydrive"},e||{}),this.createOfficeNode(e,t,i,n)):void this.popupSelDirDlg(function(o,r){this.createOfficeNode(Ext.apply({path:SYNO.SDS.Drive.Utils.getPathId(r)},e||{}),t,i,n),o.component.close()},this,{owner:n||this.findAppWindow(),path:this.getParentPath()})},createOfficeNode:function(e,t,i,n){if(e.password&&SYNO.SDS.Office.LocalStorage.useCookie())return void this.createOfficeNodeFirst(e,t,i);t&&(n&&n.setStatusBusy(),Ext.createSequence(function(){n&&n.clearStatusBusy()},t,i).defer(1e3));var o={fn:"requestCreateNode",params:e,session_data:{ntype:e.ntype}};SYNO.SDS.Office.LocalStorage.WindowLaunch({url:SYNO.SDS.Office.URL.getOfficeURL(),data:o})},createOfficeNodeFirst:function(e,t,i){var n=SYNO.SDS.Office.WindowHelper.WindowOpen({url:SYNO.SDS.Office.URL.getOfficeURL(),hash:{action:"creating",ntype:e.ntype}});this.getWebAPI().createOfficeNode({params:e,scope:this,callback:this.onCreateCallBack("createnodedone",Ext.createSequence(t||Ext.emptyFn,(function(e,o,r){this.handleNewNodeCallBack(e,o,r,function(){this.createOfficeNodeFirst(r,t,i)},this)&&(e?SYNO.SDS.Office.Utils.callOnEditorReady(n,(function(e){n.closed||this.handleOfficeNodeReady(o,void 0,r.password,e)}).bind(this)):(t||SYNO.SDS.Office.GetWindow().getMsgBox().alert("",(0,l.v2)(o)),(0,f.on)(n)))}).bind(this),i||window),i||window)})},requestCreateNode:function(e,t){this.beforeRequestNewNode(),this.getWebAPI().createOfficeNode({params:e,scope:this,callback:function(i,n){this.requestNewNodeCallBack(i,n,e,t,void 0,function(){this.requestCreateNode(e,t)},this)}})},rejectUnload:function(){return!1},beforeRequestNewNode:function(){SYNO.SDS.StatusNotifier.on("beforeunload",this.rejectUnload,window)},afterRequestNewNode:function(){SYNO.SDS.StatusNotifier.un("beforeunload",this.rejectUnload,window)},handleNewNodeCallBack:function(e,t,i,n,o,r){if(e||!n)return this.closeImportPassDlg(),!0;var a=(0,l.zg)(t);if(57392===a){function s(){setTimeout(()=>{t?.component.showMsgBox("alert","",(0,l.v2)(57392),()=>{setTimeout(()=>{t.component.$refs.input?.$refs?.input?.focus()},0)},!1)})}let e=(0,S.Ne)(SYNO.SDS.Drive.Vue.DialogCreate),t=(0,S.QX)(SYNO.SDS.Drive.Vue.DialogCreate,{onShow:e?void 0:s,cb:e=>{i.title=e,n.call(o,i),t?.component.close()}},{ownerWindow:r});return t&&e&&t.window.$on("show",s),!1}return 57373===a&&Ext.isArray(i.files)&&1===i.files.length?(this.requestImportPassDlg?(this.requestImportPassDlg.clearStatusBusy(),this.requestImportPassDlg.setStatusError({text:SYNO.SDS.Office._T("common","err_pass")})):this.requestImportPassDlg=new SYNO.SDS.Office.GenPasswordWindow({closable:!1,owner:r||SYNO.SDS.Office.GetWindow(),listeners:{scope:this,apply:function(e,t){i.files[0].password=t,this.requestImportPassDlg.setStatusBusy({text:SYNO.SDS.Office._T("common","importing")}),n.call(o,i)},close:function(){(0,f.on)()}}}).show(),!1):(this.closeImportPassDlg(),!0)},closeImportPassDlg:function(){this.requestImportPassDlg&&(this.requestImportPassDlg.purgeListeners(),this.requestImportPassDlg.close(),this.requestImportPassDlg=null)},requestNewNodeCallBack:function(e,t,i,n,o,r,a,s){if(this.afterRequestNewNode(),!this.handleNewNodeCallBack(e,t,i,r,a,s))return void SYNO.SDS.Office.Utils.removeLoadingPage();e?(t.file_id&&SYNO.SDS.Office.LocalStorage.fireEvent("createnodedone",t),this.handleOfficeNodeReady(t,o,i.password)):SYNO.SDS.Office.Utils.isOfficePage()&&SYNO.SDS.Office.GetWindow().onInitError?SYNO.SDS.Office.GetWindow().onInitError(t):(s||SYNO.SDS.Office.GetWindow()).getMsgBox({preventDelay:!0}).alert("",(0,l.v2)(t),function(){(0,f.on)()})},handleOfficeNodeReady:function(e,t,i,n){n=n||SYNO.SDS.Office.GetWindow(),e.encrypt&&SYNO.SDS.Office.Utils.setEncryptPassword(e.object_id,i||SYNO.SDS.Office.Env.localPass,n),n.initApp({object_id:e.object_id,encrypt:e.encrypt}),t&&t.session_data&&SYNO.SDS.Office.Env.setSessionItem("session_data",t.session_data)},renameNode:function(){if(SYNO.SDS.Office.Env.is_template)return void this.renameTemplate();N().prototype.renameNode.call(this,{name:this.findAppWindow().getTitle()})},setNodeTitle:function(e,t,i){N().prototype.setNodeTitle.call(this,Ext.apply(e,{permanent_link:SYNO.SDS.Office.Env.link_id,name:e.name}),Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("setnodetitledone",t,i)}),i)},doCreateNodeAttachment:function(e){return e=e.object_id||e.link_id?e:{object_id:SYNO.SDS.Office.Env.objectId,...e},new Promise((t,i)=>{this.findAppWindow().getWebAPI().createNodeAttachment({params:e,callback:function(e,n){return e?t(n):i(n)}})})},createAttachmentCreator:function(){return new a(this.doCreateNodeAttachment.bind(this),{onComplete:e=>{e.failed&&SYNO.SDS.Drive.Utils.showToastMsg(this.findAppWindow(),String.format((0,p.$)("task",1===e.failed?"create_single_attachment_done_toast":"create_attachments_done_toast"),e.failed),5e3,!0)}})},runAttachmentCreator:async function(e){let t=this.createAttachmentCreator(),i=e(t);return t.complete(),i},createAttachment:function(e,t){return this.runAttachmentCreator(i=>i.create(e,t))},isCreatingAttachments:function(){return!a.isIdle()},getOfficeNodeCb:function(e,t){return this.onCreateCallBack("getnodedone",Ext.createSequence(function(e,t){e&&(SYNO.SDS.Office.Env.set(t),SYNO.SDS.Office.GetWindow().getEventMgr().fireEvent("permchange"))},e||Ext.emptyFn),t||window,!1)},getOfficeNodeFirstTime:function(e,t,i){var n={};SYNO.SDS.Office.Env.isOfficeOwned||(n={basic:!0});var o=window.EarlyInit;if(o&&o.getNodePromise()){var r=this.getOfficeNodeCb(t,i);o.getNodePromise().then(function(e){r(!0,e)}).catch(function(e){r(!1,e)})}else this.getOfficeNode(Ext.apply(n,e||{}),t,i)},getOfficeNode:function(e,t,i){this.getWebAPI().getOfficeNode({params:e,scope:i,callback:this.getOfficeNodeCb(t,i)})},updateOfficeNode:function(e,t){SYNO.SDS.Office.Utils.isDrivePage()||this.getOfficeNode({basic:!0,object_id:SYNO.SDS.Office.Env.objectId},e,t)},moveNodeTo:function(){N().prototype.moveNodeTo.call(this,{path:SYNO.SDS.Drive.Utils.getPathIdByLink(SYNO.SDS.Office.Env.link_id)},function(e,t){if(!e)return void this.findAppWindow().getMsgBox().alert("",(0,l.v2)(t))},this)},setDriveAction:function(e){this.drive_action=e},callDriveAction:function(e){this.drive_action?this.drive_action[e]():SYNO.SDS.Drive.GetWindow().getAction()[e]()},isContainNonOffice:function(e){return(e||this.getTargets()).some(function(e){if("dir"===e.get("type"))return!0;var t=SYNO.SDS.Office.File.getExt(e.get("name"));return!SYNO.SDS.Office.File.isOffice(t)})},copyNodeTo:function(){if(SYNO.SDS.Office.Utils.isDrivePage()&&this.isContainNonOffice())return void this.callDriveAction("copyNodeTo");var e=new SYNO.SDS.Office.CopyTo.Dialog({initName:"",blDir:!1,owner:this.findAppWindow(),listeners:{scope:this,apply:function(e,t,i,n){this.copyOfficeNodeTo(e,i,n,function(){e.onApplyCb.apply(e,arguments)})}}});let{selections:t,locationInfo:i}=this.getSelectionsAndLocation();e.setLocationInfo(i?.fileId,i?.displayName),e.setSelections(t),e.show()},copyOfficeNodeTo:function(e,t,i,n){var o,r=(function(o,r,a){if(e.clearStatusBusy(),!o)return void(SYNO.SDS.Office.Utils.isDrivePage()||57373!==(0,l.zg)(r)?e.getMsgBox().alert("",(0,l.v2)(r)):new SYNO.SDS.Office.PasswordWindow({path:a.files[0],owner:e,listeners:{scope:this,success:function(o,r){o.close(),this.copyOfficeNodeTo(e,Ext.apply(t,{password:r}),i,n)}}}).show());this.showMvcpToastMsg("copy",i,e.getLocationName(),r.file_id,r.link_id,r.title),SYNO.SDS.Office.Utils.isDrivePage()||SYNO.SDS.Office.LocalStorage.fireEvent("copynodedone",r,t),n&&n.apply(this,arguments)}).bind(this);if(SYNO.SDS.Office.Utils.isDrivePage()){var a=this.findAppWindow().GetOneSeleted();o=this.onCreateBackgroundCallBack("copynodedone",r,this,[a])}else o=this.onCreateCallBack("copynodedone",r,this);this.getWebAPI().copyOfficeNode({params:t,scope:this,callback:o})},requestCopyNode:function(e,t){if(SYNO.SDS.Office.Utils.isDrivePage())return;let i=this.getWebAPI().getGlobalPassword();i&&(e.password=i);let n={fn:"requestCopyNode",params:e,session_data:{ntype:SYNO.SDS.Office.Env.ntype,...t}};SYNO.SDS.Office.LocalStorage.WindowLaunch({url:SYNO.SDS.Office.URL.getOfficeURL(),data:n})},copyNode:function(e,t,i){this.mvcpNode("copy",e,t,i)},moveNode:function(e,t,i){this.mvcpNode("move",e,t,i)},mvcpNode:function(e,t,i,n){if(t.files=[SYNO.SDS.Drive.Utils.getPathId(SYNO.SDS.Office.Env.file_id)],SYNO.SDS.Office.Utils.isSameParent(SYNO.SDS.Office.Env.parent_id,SYNO.SDS.Office.Utils.getParentDir(SYNO.SDS.Office.Env.display_path),t.to_parent_folder))if("move"===e)return void SYNO.SDS.Office.Utils.showAlertMsg(n||this.findAppWindow(),SYNO.SDS.Drive._T("error","parent_path_conflict"));else t.conflict_action="autorename";n&&n.close(),N().prototype.mvcpNode.call(this,e,t,SYNO.SDS.Office.Env.title)},postMvcpNode:function(e,t,i){var n=this.startBkTask.createDelegate(this,[function(n,o){if(n){var r=o.result.params;SYNO.SDS.Office.LocalStorage.fireEvent(e+"nodedone",o,t),"move"===e?this.updateOfficeNode((function(){this.showMvcpToastMsg(e,i,r.to_parent_folder_name,SYNO.SDS.Office.Env.file_id)}).bind(this)):this.showMvcpToastMsg(e,i,r.to_parent_folder_name,SYNO.SDS.Drive.Utils.getFileIdFromPathId(r.to_parent_folder))}},this],!0);"move"===e?this.findAppWindow().getWebAPI().moveNode({params:t,scope:this,callback:this.onCreateCallBack("movenodedone",n,this)}):this.findAppWindow().getWebAPI().copyNode({params:t,scope:this,callback:this.onCreateCallBack("copynodedone",n,this)})},getMvcpToastText:function(e,t,i,n,o){var r,a=String.format('<span id="{0}" class="action-text" role="button" tabIndex="0">',Ext.util.Format.htmlEncode(t)),s="</span>",c=Ext.isArray(i)?i[0]:i;return SYNO.SDS.Office.Utils.isDrivePage()||"copy"!==e?Ext.isArray(i)&&i.length>1?(r=String.format("task_{0}_multi_success_toast",e),String.format(SYNO.SDS.Drive._T("task",r),i.length,Ext.util.Format.htmlEncode(n),a,s)):(r=String.format("task_{0}_success_toast",e),String.format(SYNO.SDS.Drive._T("task",r),Ext.util.Format.htmlEncode(SYNO.SDS.Drive.Utils.parseDisplayName(c)),Ext.util.Format.htmlEncode(n),a,s)):String.format(SYNO.SDS.Office._T("task","task_copy_success_toast"),Ext.util.Format.htmlEncode(SYNO.SDS.Drive.Utils.parseDisplayName(c)),Ext.util.Format.htmlEncode(SYNO.SDS.Drive.Utils.parseDisplayName(o)),a,s)},showMvcpToastMsg:function(e,t,i,n,o,r){var a=Ext.id();SYNO.SDS.Drive.Utils.showToastMsg(this.findAppWindow(),this.getMvcpToastText(e,a,t,i||SYNO.SDS.Drive._T("category","node"),r),5e3,!0,{textActionId:a,fn:function(){SYNO.SDS.Office.Utils.isDrivePage()?SYNO.SDS.Drive.GetWindow().getAction().onGotoPath(n):"copy"===e&&o?SYNO.SDS.Office.URL.openLink(o):SYNO.SDS.Office.Utils.openDrive({file_id:n})}})},encryptOfficeNode:function(e,t,i){this.getWebAPI().encryptOfficeNode({params:this.prepareParam(e),scope:this,callback:this.onCreateCallBack("encryptnodedone",Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("encryptnodedone",t,i)}),i)})},restoreOfficeNodeTo:function(e,t,i,n,o){let r=this.findAppWindow(),a=(0,S.QX)(SYNO.SDS.Drive.Vue.DialogTree,{title:SYNO.SDS.Drive._T("action","copy_to"),findAppWindow:this.findAppWindow.bind(r),cb:(n,o)=>{a.window.setStatusBusy(void 0,_T("common","msg_waiting"));let r=(e,n,o)=>{if(a.window.clearStatus(),n=n||{},!e)return void a.component.showMsgBox("alert","",(0,l.v2)(n));a.component.close(),t&&t.call(i||window,e,n,o)};SYNO.SDS.Office.Utils.isTemplateObjectId(e.object_id||"")?(Ext.apply(e,{default_title:this.getTemplateTitle(),parent_id:SYNO.SDS.Drive.Utils.getPathId(n)}),this.getWebAPI().makeTemplate({params:e,scope:this,callback:r})):(Ext.apply(e,{to_parent_folder:SYNO.SDS.Drive.Utils.getPathId(n),permanent_link:SYNO.SDS.Office.Env.link_id}),this.restoreVersion(e,a,r,null,a))},params:{path:this.getParentPath()},createFolderCb:(e,t)=>{this.createFolderCB(a.component,e,t)}},{ownerWindow:o})},onTreeDlgGotoPath:function(e){N().prototype.onTreeDlgGotoPath.call(this,e,{permanent_link:SYNO.SDS.Office.Env.link_id})},deleteNode:function(e,t,i){if(SYNO.SDS.Office.Env.is_template)return void this.deleteTemplate();let{force:n=!1}=e||{};e={permanent:!1,permanent_link:[SYNO.SDS.Office.Env.link_id],revisions:SYNO.SDS.Office.Env.revisions,...e,force:void 0};let o=this.startBkTask.createDelegate(this,[function(e){e&&(t?t.call(i):this.findAppWindow().onReload())},this],!0);n?(e=this.prepareParam(e),this.postDeleteNode(e,o)):N().prototype.deleteNode.call(this,e,o)},postDeleteNode:function(e,t,i){N().prototype.postDeleteNode.call(this,e,Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("deletenodedone",t,i)}),i)},startBkTask:function(e,t,i,n,o,r,a){var s=this.findAppWindow();if(s.setStatusBusy(),!e){s.clearStatusBusy(),s.getMsgBox().alert("",(0,l.v2)(t),function(){r&&r.call(a,e,t)});return}this.async_task_id=t.async_task_id;var c=SYNO.SDS.Drive.WebAPIDesc.get_task,f=s.pollReg({webapi:Ext.apply({params:{task_id:this.async_task_id}},c),interval:.5,immediate:!0,status_callback:function(e,t){if(!e||"finished"===t.status){s.clearStatusBusy(),s.pollUnreg(f);var i=t;if(t.result&&Ext.isArray(t.result.errors)&&0<t.result.errors.length?(e=!1,i=t.result.errors[0]):!e&&t.result&&(i=t.result),e){if(!r)return;r.call(a,e,t)}else s.getMsgBox().alert("",(0,l.v2)(i),function(){r&&r.call(a,e,t)})}},scope:this})},parseEnvToFileInfo:function(e){var t=SYNO.SDS.Office.Env;return Ext.apply({capabilities:t.capabilities,name:t.title,shared_with:t.shared_with,adv_shared:t.adv_shared,display_path:t.display_path},e)},shareNode:function(e){if(SYNO.SDS.Office.Env.is_template)return void this.shareTemplate();e=Ext.apply({permanent_link:SYNO.SDS.Office.Env.link_id},e),SYNO.SDS.Office.Utils.isDrivePage()||Ext.apply(e,this.parseEnvToFileInfo({type:SYNO.SDS.Office.Env.ntype})),N().prototype.shareNode.call(this,e)},shareNodeWithParams:function(e){SYNO.SDS.Office.Action.superclass.shareNode.call(this,e)},openGetLinkMenu:function(e){let t=SYNO.SDS.Office.Env,i=this.prepareParam(this.parseEnvToFileInfo({file_id:t.file_id,file_type:t.ntype}));this.findAppWindow().getLeftPanel().getShareVuePanel()._$vueInst.open({findAppWindow:this.findAppWindow,anchor:e.dom,fileInfo:i})},checkNodePassword:function(e,t,i){this.getWebAPI().checkNodePassword({params:this.prepareParam(e),scope:i,callback:t})},setOfficeNode:function(e,t,i){this.getWebAPI().setOfficeNode({params:e,scope:this,callback:this.onCreateCallBack("setnodedone",t,i)})},setOfficeNodeOwner:function(e,t,i){this.getWebAPI().setOfficeNodeOwner({params:this.prepareParam(e),scope:this,callback:this.onCreateCallBack("setnodedone",t,i)})},infoNode:function(){N().prototype.infoNode.call(this,this.prepareParam(this.parseEnvToFileInfo({permanent_link:SYNO.SDS.Office.Env.link_id})))},checkAndOpenFromDrive:function(e,t){return!e.data.removed&&!!SYNO.SDS.Office.File.isImportable.call(SYNO.SDS.Office.File,SYNO.SDS.Office.File.getExt(e.get("name")))&&(this.openFromDrive(e,t),!0)},openFromDrive:function(e,t){e instanceof Ext.data.Record||(e=this.findAppWindow().GetOneSeleted());var i,n=e.get("name"),o=SYNO.SDS.Office.Utils.getNTypeByFileName(n);if(!o)return void this.findAppWindow().getMsgBox().alert("",String.format(SYNO.SDS.Office._T("common","convert_prompt"),"doc"));var r={name:n,files:[{format:"drive",path:SYNO.SDS.Drive.Utils.getPathIdByLink(e.data.permanent_link),viewonly:!0}]},a=SYNO.SDS.Drive.Sharing.GetSharingToken();a&&SYNO.SDS.Drive.Env.permanent_link?(Ext.apply(r,{sharing_token:a}),i=Ext.apply({},r),Ext.apply(i,{link:SYNO.SDS.Drive.Env.permanent_link,sharing_link:SYNO.SDS.Drive.Sharing.GetSharingLink()})):i=Ext.apply({},r);var s=SYNO.SDS.Office.Utils.getCurFolderPriv();s&&s.can_write&&Ext.apply(i,{to_parent_folder:SYNO.SDS.Drive.Utils.getPathId(e.get("parent_id"))}),t&&Ext.apply(i,{force_import:!0}),Ext.apply(i,{ntype:o});var c={fn:"requestImportNode",params:r,session_data:i};SYNO.SDS.Office.LocalStorage.WindowLaunch({url:SYNO.SDS.Office.URL.getOfficeURL(),data:c})},requestImportNode:function(e,t,i,n,o,r){this.beforeRequestNewNode(),this.importNodeByStartPromise(e,t,function(e,a){this.requestNewNodeCallBack(e,a,t,i,n,e?Ext.emptyFn:function(){this.requestImportNode(this.getImportStartPromise(t),t,i,n)},this,this.requestImportPassDlg),e&&o&&o.call(r)},this)},importNode:function(e,t,i){var n=this.findAppWindow();n.setStatusBusy(),this.importNodeByStartPromise(this.getImportStartPromise(e),e,t,i).then(function(){n.clearStatusBusy()})},importNodeByStartPromise:function(e,t,i,n){return e.then((function(e){return this.getPollImportingPromise({task_id:e.task_id},i,n)}).bind(this)).then(function(e){i&&i.call(n,!0,e.file_info[0])}).catch(function(e){i&&i.call(n,!1,e)})},getImportStartPromise:function(e){return new Promise((function(t,i){this.getWebAPI().importNode({params:e,callback:function(e,n){e?t(n):i(SYNO.API.Response.GetFirstError(n))},scope:this})}).bind(this))},getPollImportingPromise:function(e){return new Promise((function(t,i){var n=this.findAppWindow().pollReg({webapi:{api:"SYNO.Office.Import",version:1,method:"status",params:e},interval:3,immediate:!1,status_callback:function(o,r){var a=r.data;r.finish&&(this.findAppWindow().pollUnreg(n),!o||r.error?i(r.error):t(a),this.getWebAPI().importNodeDone({params:e}))},scope:this})}).bind(this))},downloadOffice:function(e,t,i){var n,o;if(SYNO.SDS.Office.Utils.isDrivePage()){var r=e;if(e instanceof Ext.data.Record&&(r=e.data),e={path:n=SYNO.SDS.Drive.Utils.getPathId(r.file_id)},t&&Ext.apply(e,{ver:t}),o=r.name,o=SYNO.SDS.Office.Utils.parseDisplayName(o)+"."+SYNO.SDS.Office.File.EXPORT_EXTENSION[SYNO.SDS.Office.File.getExt(o)],r.encrypted){let t=i||this.findAppWindow(),r=(0,d.z)(t),a=new SYNO.SDS.Office.PasswordWindow({path:n,owner:r?t.$refs.win:t,listeners:{success:(t,n)=>{e.password=n,this.exportNode(o,e,i)}}});r?t.openExtWindow(a):a.show()}else this.exportNode(o,e,i)}else{SYNO.SDS.Office.Env.isOfficeOwned||SYNO.SDS.Office.Env.is_template?e=Ext.apply({object_id:SYNO.SDS.Office.Env.objectId},e):(n=SYNO.SDS.Drive.Utils.getPathIdByLink(SYNO.SDS.Office.Env.link_id),e=Ext.apply({path:n},e));var a,s=this.findAppWindow().getTitle();if(o=SYNO.SDS.Office.Utils.parseDisplayName(s),"ms"!==e.format&&e.format)o+="."+e.format;else if(SYNO.SDS.Office.Env.isOfficeOwned||SYNO.SDS.Office.Env.is_template){switch(_S("standaloneAppName")){case"SYNO.SDS.Office.Doc.Application":a="docx";break;case"SYNO.SDS.Office.Sheet.Application":a="xlsx";break;default:a="pptx"}o+="."+a}else o+="."+SYNO.SDS.Office.File.EXPORT_EXTENSION[SYNO.SDS.Office.File.getExt(s)];this.exportNode(o,e,i)}},exportNode:function(e,t,i){if((0,m.isIOSFamily)())return this.redirectToDownload(e,t);this.getWebAPI().exportNode(e,{params:this.prepareParam(t),onError:function(n){if(57373!==(0,l.zg)(n)||t.password){var o=n?(0,l.v2)(n):SYNO.SDS.Drive._T("error","download");(i||this.findAppWindow()).getMsgBox().alert("",o)}else new SYNO.SDS.Office.PasswordWindow({path:t.path,owner:i||this.findAppWindow(),listeners:{scope:this,success:function(n,o){t.password=o,this.exportNode(e,t,i)}}}).show()},scope:this})},redirectToDownload:function(e,t){t=this.prepareParam(t);var i=this.getWebAPI().getGlobalPassword(),n=Promise.resolve();if(i){var o={password:i};n=(h().env.isSecure()?Promise.resolve(o):h().encrypt(o)).then(function(e){Object.assign(t,e)})}n.then(function(){var i=SYNO.API.GetBaseURL({api:"SYNO.Office.Export",version:1,method:"download"},!0,e),n=document.createElement("form");for(var o in n.setAttribute("name","office_dl_form"),n.setAttribute("action",i),n.setAttribute("method","POST"),t)Object.prototype.hasOwnProperty.call(t,o)&&n.appendChild(SYNO.SDS.Utils.IFrame.createHiddenInput(o,t[o]));document.body.appendChild(n),n.submit()})},restoreVersion:function(e,t,i,n){t=t||this.findAppWindow();let o=(0,d.z)(t);e=this.prepareParam(e);var r,a=SYNO.SDS.Office.Utils.isDrivePage();let s=()=>{let i=new SYNO.SDS.Office.PasswordWindow({path:e.path,owner:o?t.$refs.win:t,listeners:{success:(i,n)=>{i.close(),e.password=n,o?t.setWinStatusBusy():t.setStatusBusy(),r(e)}}});o?(t.clearWinStatus(),t.openExtWindow(i)):(t.clearStatusBusy(),i.show())};var c=this.onCreateCallBack("restorenodedone",i,n,!a);if(r=(function(e){this.getWebAPI().restoreVersion({params:e,scope:this,callback:function(e,t,i){if(a&&57373===(0,l.zg)(t)&&!i.password)return void s();c(e,t,i),e&&SYNO.SDS.Office.LocalStorage.fireEvent("restorenodedone",t,i)}})}).bind(this),a&&e.encrypted)return void s();r(e)},renameVersion:function(e,t){this.getWebAPI().renameVersion({params:e,callback:t,scope:this})},getRenameVersionPromise:function(e,t){return new Promise((t,i)=>{this.renameVersion(e,(e,n)=>{e?t(n):i(n)})}).then(e=>{t.component.close()}).catch(i=>{t.window.clearStatus(),57402===(0,l.zg)(i)?t.component.showMsgBox("confirm","",String.format((0,l.v2)(i),i.errors.ver_name),i=>{if("confirm"===i)return e.overwrite=!0,this.getRenameVersionPromise(e,t);t.component.close()}):t.component.showMsgBox("alert","",(0,l.v2)(i))})},nameCurrentVersion:function(){var e=this;let t={object_id:SYNO.SDS.Office.Env.objectId,overwrite:!1},i=(0,S.QX)(SYNO.SDS.Drive.Vue.DialogRename,{title:SYNO.SDS.Office._T("history","create_version_name"),validator:function(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];return i.component.nameBasicValidator.apply(e,n)},cb:e=>{i.window.setStatusBusy(void 0,_T("common","msg_waiting")),this.getSaveNodePromise().then(n=>(t.ver=n.snapshot_version,t.ver_name=e,this.getRenameVersionPromise(t,i)))}})},listTemplate:function(e,t,i){this.getWebAPI().listTemplate({params:e,callback:t,scope:i})},makeTemplate:function(e,t){e=e||{},t=t||this.getTemplateDlg()||this.findAppWindow(),e.encrypt?new SYNO.SDS.Office.Encrypt.Window({owner:t,ntype:"template",callback:function(i){this.prepareMakeTemplate(Ext.apply(e,{encrypt:!0,password:i}),t)},scope:this}).show():this.prepareMakeTemplate(e,t)},prepareMakeTemplate:function(e,t){if(!e.parent_id&&SYNO.SDS.Office.Utils.isDrivePage()){var i=SYNO.SDS.Office.Utils.getCurFolderPriv();i&&i.can_write&&(e.parent_id=SYNO.SDS.Drive.Utils.getPathId(this.findAppWindow().getNavigation().getLastPathId()))}e.parent_id?this.doMakeTemplate(e,t):this.popupSelDirDlg(function(i,n){this.doMakeTemplate(Ext.apply(e,{parent_id:SYNO.SDS.Drive.Utils.getPathId(n)}),t),i.component.close()},this,{owner:t||this.findAppWindow(),path:this.getMyDrivePath()})},getTemplateTitle:function(){return SYNO.SDS.Office.Define.SystemUID===SYNO.SDS.Office.Utils.getUidByObjectId(SYNO.SDS.Office.Env.objectId)?SYNO.SDS.Office.Utils.parseTemplateTitle(SYNO.SDS.Office.Env.title):SYNO.SDS.Office.Env.title},doMakeTemplate:function(e,t){if(!SYNO.SDS.Office.Utils.isDrivePage()&&(e.object_id||(e.object_id=SYNO.SDS.Office.Env.objectId),e.default_title||(e.default_title=this.getTemplateTitle()),e.link_id||(e.link_id=SYNO.SDS.Office.Env.link_id)),SYNO.SDS.Office.Utils.isDrivePage()||t instanceof SYNO.SDS.Office.Template.Dialog)if(e.password&&SYNO.SDS.Office.LocalStorage.useCookie())this.doMakeTemplateFirst(e,t);else{var i=SYNO.SDS.Office.Utils.getNTypeByObjectId(e.object_id);SYNO.SDS.Office.LocalStorage.WindowLaunch({url:SYNO.SDS.Office.URL.getOfficeURL(),data:{fn:"requestMakeTemplate",params:e,session_data:{ntype:i}}})}else{t.setStatusBusy(),this.getWebAPI().makeTemplate({params:e,scope:this,callback:function(i,n){t.clearStatusBusy(),i?(n.encrypt&&e.password&&SYNO.SDS.Office.Env.setSessionItem("password",e.password,n.object_id),SYNO.SDS.Office.URL.redirectLink(n.link_id)):this.requestNewNodeCallBack(i,n,e,void 0,void 0,function(){this.doMakeTemplate(e,t)},this,t)}});return}(function(){t instanceof SYNO.SDS.Office.Template.Dialog&&t.slideOut()}).defer(1e3)},doMakeTemplateFirst:function(e,t){var i=SYNO.SDS.Office.WindowHelper.WindowOpen({url:SYNO.SDS.Office.URL.getOfficeURL(),hash:{action:"creating",ntype:SYNO.SDS.Office.Utils.getNTypeByObjectId(e.object_id)}});this.getWebAPI().makeTemplate({params:e,scope:this,callback:this.onCreateCallBack("createnodedone",(function(e,n,o){this.handleNewNodeCallBack(e,n,o,function(){this.doMakeTemplateFirst(o,t)},this,t)&&(e?SYNO.SDS.Office.Utils.callOnEditorReady(i,(function(e){i.closed||this.handleOfficeNodeReady(n,void 0,o.password,e)}).bind(this)):(t||SYNO.SDS.Office.GetWindow()).getMsgBox().alert("",(0,l.v2)(n)))}).bind(this),window)})},requestMakeTemplate:function(e,t){this.beforeRequestNewNode(),this.getWebAPI().makeTemplate({params:e,scope:this,callback:function(i,n){this.requestNewNodeCallBack(i,n,e,t,void 0,function(){this.requestMakeTemplate(e,t)},this)}})},encryptNode:function(){var e,t,i=SYNO.SDS.Office.Utils.isDrivePage(),n=!1;if(i){var o=this.findAppWindow().GetOneSeleted();n=o.data.encrypted,t={path:SYNO.SDS.Drive.Utils.getPathId(o.id)}}else n=SYNO.SDS.Office.Env.isEncrypt,t={path:SYNO.SDS.Drive.Utils.getPathIdByLink(SYNO.SDS.Office.Env.link_id)};n?((!this.encryptModifyWin||this.encryptModifyWin.isDestroyed)&&(this.encryptModifyWin=new SYNO.SDS.Office.Encrypt.Modify.Window({owner:this.findAppWindow()}),i||this.encryptModifyWin.mon(this.encryptModifyWin,{scope:this,beforechangepwd:function(e,t,i){SYNO.SDS.Office.Env.setSessionItem("password",t)},changepwddone:function(e,t,i){t||SYNO.SDS.Office.Env.removeSessionItem("password")},changepwdsucc:function(e,t,i,n){var o=SYNO.SDS.Office.GetWindow(),r=o.getSocket();return r&&r.connected||o.onReload({keepPassword:!1}),!1},unencrypt:function(e,t,i){this.onGoToNode(t)}})),e=this.encryptModifyWin):((!this.encryptCopyWin||this.encryptCopyWin.isDestroyed)&&(this.encryptCopyWin=new SYNO.SDS.Office.Encrypt.Copy.Window({owner:this.findAppWindow(),listeners:{scope:this,encrypt:function(e,t,n,o){i||(SYNO.SDS.Office.Env.setSessionItem("password",o,t.object_id),this.onGoToNode(t))}}})),e=this.encryptCopyWin),e.setData(t),e.show()},convertOffice:function(){let e=this.getTargets(),t={},i=e[0].data.parent_id;e.forEach(n=>{let o=SYNO.SDS.Drive.Utils.getPathId(n.id);t[o]={isdir:"dir"===n.data.type,path:o,name:n.data.name},e[0].data.parent_id!==i&&(i=void 0)});let n=e=>Object.values(e).map(e=>e.name),o=Object.values(SYNO.SDS.copy(t)).map(e=>Ext.applyIf({path:e.path},{password:e.password})),r=o.some(e=>t[e.path].isdir),a=(e,i)=>{SYNO.SDS.Office.Action.superclass.convertOffice.call(this,Ext.apply(e,{files:o}),n(t),i)},s=e=>{var i={conflict_action:"autorename"};e&&Ext.apply(i,{to_parent_folder:e});let n=(e,n,o)=>{if(!e)return void a(i,o);let r=[];n?.forEach(e=>{let i=SYNO.SDS.Drive.Utils.getPathId(e);delete t[e],r.push({path:i})}),i.skipped_files=r,e&&(i.additional_passwords=e),a(i)},s=1!==o.length;r?this.checkImportOfficeByDrive(o,s,n):this.checkImportOffice(o,s,n)};var c=SYNO.SDS.Office.Utils.getCurFolderPriv();if(r||c&&c.can_write)return void s();let l=this.findAppWindow(),f=(0,S.QX)(SYNO.SDS.Drive.Vue.DialogTree,{title:SYNO.SDS.Office._T("action","convert_office_to"),findAppWindow:this.findAppWindow.bind(l),cb:(e,t)=>{f.component.close(),s(SYNO.SDS.Drive.Utils.getPathId(e))},params:i?this.prepareParam({file_id:i}):{path:this.getMyDrivePath()},createFolderCb:(e,t)=>{this.createFolderCB(f.component,e,t)}})},checkImportOfficeByDrive:function(e,t,i){this.getWebAPI().checkImportOfficeByDrive({params:{files:e},scope:this,callback:(e,n)=>{if(!e)return void i();if(n?.has_fail){let e=SYNO.API.Response.GetValByIndex(n,0);if(1e3===e.code&&Array.isArray(e.errors)&&Array.isArray(e.errors)&&e.errors[0]?.file_id)return void this.checkImportOfficeDone(e.errors,t,i)}let o=SYNO.API.Response.GetValByIndex(n,1);i(null,null,{pollingOnly:!!o,async_task_id:o?.async_task_id})}})},checkImportOffice:function(e,t,i){this.getWebAPI().checkImportOffice({params:{files:e},scope:this,callback:(e,n)=>{if(e)return void i();let o=n.errors,r=[];o?.forEach(e=>{57373===e.code&&r.push(e)}),this.checkImportOfficeDone(r,t,i)}})},checkImportOfficeDone:function(e,t,i){let n;if(!e||0===e.length)return void i();(n=1!==e.length||t?new SYNO.SDS.Office.GenMultiplePasswordWindow({owner:this.findAppWindow(),files:e,listeners:{scope:this,apply:function(e,t,n,o){o?e.getMsgBox().confirm("",SYNO.SDS.Office._T("convert_office","no_password"),o=>{"yes"===o&&(e.close(),i(t,n))}):(e.close(),i(t,n))}}}):new SYNO.SDS.Office.GenPasswordWindow({owner:this.findAppWindow(),listeners:{scope:this,apply:function(t,o){let r=e[0],a=r.file_id?SYNO.SDS.Drive.Utils.getPathId(r.file_id):r.path;this.getWebAPI().checkImportOffice({params:{path:a,password:o},scope:this,callback:function(e,t){if(e){n.close(),i([{path:a,password:o}]);return}n.setStatusError({text:(0,l.v2)(t)})}})}}})).show()},onGoToNode:function(e){SYNO.SDS.Office.URL.redirectLink(e.link_id)},restoreNode:function(){var e=[{path:SYNO.SDS.Drive.Utils.getPathIdByLink(SYNO.SDS.Office.Env.link_id)}],t=[SYNO.SDS.Office.Env.title];this.restoreFileVersion({files:e,dry_run:!0},t)},postRestoreNode:function(e,t){SYNO.SDS.Office.Action.superclass.restoreNode.call(this,e,this.startBkTask.createDelegate(this,[function(t,i){t?(SYNO.SDS.Office.LocalStorage.fireEvent("restorenodedone",i,e),this.findAppWindow().onReload()):(0,f.on)()},this],!0))},uploadImage:function(e){e=e||{};var t=SYNO.SDS.Office.Utils.isPublicShareOrImportView(),i=Ext.apply({from_upload:!0,from_drive:!t,from_nas:!t,from_url:!0,activeItem:"from_upload",viewMode:"thumbnail",filter:{extensions:SYNO.SDS.Office.Define.ImageExt},onApply:this.uploadImageHandler.createDelegate(this,e,!0)},e);Ext.isGecko&&(i.fromPCParams={accept:"image/*"}),SYNO.SDS.AppLaunch("SYNO.SDS.Drive.Upload.Application",i,!1,function(){var t=SYNO.SDS.AppMgr.getByAppName("SYNO.SDS.Drive.Upload.Application")[0];e.destroy_cb&&t.mon(t,"beforedestroy",e.destroy_cb,e.scope,{single:!0})},this)},uploadVideo:function(e){e=e||{};var t=SYNO.SDS.Office.Utils.isPublicShareOrImportView();SYNO.SDS.AppLaunch("SYNO.SDS.Drive.Upload.Application",Ext.apply({from_upload:!1,from_drive:!t,from_nas:!1,from_url:!1,from_youtube_url:!0,activeItem:"from_youtube_url",viewMode:"thumbnail",filter:{extensions:SYNO.SDS.Office.Define.VideoExt},onApply:this.uploadVideoHandler.createDelegate(this,e,!0)},e),!1,function(){var t=SYNO.SDS.AppMgr.getByAppName("SYNO.SDS.Drive.Upload.Application")[0];e.destroy_cb&&t.mon(t,"beforedestroy",e.destroy_cb,e.scope,{single:!0})},this)},uploadImageHandler:function(e,t,i){var n;let o=this.createAttachmentCreator();if("from_pc"===t[0].source){var r=[],a=!0;if(Ext.each(t,function(t){var i=t.filename;if(Ext.isEmpty(i)||!1===SYNO.SDS.Office.Utils.isSupportImage(i))return SYNO.SDS.Office.Utils.showErrorMsg(e,57377),a=!1,!1;r.push(o.create("raw",t.fileObj))},this),!a)return a;e.setStatusBusy(),n=Promise.all(r)}else{var s=[];t.forEach(function(e){var t,i;switch(e.source){case"from_drive":t="drive",i=SYNO.SDS.Drive.Utils.getPathId(e.file_id);break;case"from_url":t="url",i=e.url;break;case"from_nas":t="ds",i=e.file_id}s.push({type:t,source:i})},this),e.setStatusBusy(),n=o.request({files:s})}return o.complete(),n.then((function(t){var n;e.clearStatusBusy();let{files:o,errors:r}=(n=t,(0,O.Z)([n]).reduce((e,t)=>(e.files=e.files.concat(t.files||[]),e.errors=e.errors.concat(t.errors||[]),e),{files:[],errors:[]}));if(!Ext.isEmpty(o)&&i&&i.cb&&i.cb.call(i.scope,{files:o}),!Ext.isEmpty(r))return void SYNO.SDS.Office.Utils.showErrorMsg(e,{errors:r});e.close()}).bind(this)).catch(function(t){e.clearStatusBusy(),SYNO.SDS.Office.Utils.showErrorMsg(e,t)}),!1},uploadVideoHandler:function(e,t,i){var n=t[0].source;("from_drive"===n||"from_youtube_url"===n)&&i.cb.call(i.scope,t)},leaveNode:function(e){if(SYNO.SDS.Office.Env.is_template)return void this.leaveTemplate();var t=this.findAppWindow();e=this.prepareParam(e),t.setStatusBusy(),t.sendWebAPI({compound:{stopwhenerror:!0,params:[Ext.apply(SYNO.SDS.Drive.WebAPIDesc.share_file,{params:{path:e.path,permissions:[{action:"delete",member:{type:"user",name:e.username}}]}}),Ext.apply(SYNO.SDS.Drive.WebAPIDesc.get_file,{params:{path:e.path}})]},callback:function(e,i){if(t.clearStatusBusy(),!e||i.has_fail)return 1!==SYNO.API.Response.GetFirstErrorIndex(i)?void t.getMsgBox().alert("",(0,l.v2)(i)):void t.getMsgBox({preventDelay:!0}).alert("",SYNO.SDS.Office._T("error","leave_no_permission"),function(){(0,f.on)()},this);SYNO.SDS.Office.Env.set(SYNO.API.Response.GetValByIndex(i,1)),SYNO.SDS.Office.GetWindow().getEventMgr().fireEvent("permchange")},scope:this},this)},getTemplateDlg:function(){return SYNO.SDS.Office.GetTplDlg()},saveTemplate:function(e,t,i){new g({owner:this.findAppWindow()}).show()},openTplDialog:function(e){new SYNO.SDS.Office.Template.Dialog(Ext.apply({owner:this.findAppWindow(),defaultType:"all_tpl"},e||{})).slideIn()},openTemplate:function(e){var t,i=this.getTemplateDlg();if(!i){SYNO.SDS.Office.Env.is_template&&SYNO.SDS.Office.URL.redirectLink(SYNO.SDS.Office.Env.link_id,e);return}var n=i.GetOneSeleted();if(n){var o=n.data,r={default_title:o.title};if(i.encrypt&&(r.encrypt=!0),SYNO.SDS.Office.Utils.isDrivePage()){var a=SYNO.SDS.Office.Utils.getCurFolderPriv();a&&a.can_write&&(r.parent_id=SYNO.SDS.Drive.Utils.getPathId(this.findAppWindow().getNavigation().getLastPathId()))}e&&"edit"===e.mode||(t={session_data:r}),SYNO.SDS.Office.LocalStorage.WindowLaunch({url:SYNO.SDS.Office.URL.getOfficeURL(o.link_id),params:e,data:t})}},editTemplate:function(){this.openTemplate({mode:"edit"})},deleteTemplate:function(e){SYNO.SDS.Office.Utils.isDrivePage()||e&&e===this.getTemplateDlg()?t=(i=this.getTemplateDlg()).GetSeletionIds():(i=this.findAppWindow(),t=[SYNO.SDS.Office.Env.objectId]);var t,i,n,o=SYNO.SDS.Office._T;n=String.format(n=Ext.isArray(t)&&1!==t.length?o("file","delete_confim"):o("file","delete_confim_one"),t.length),i.getMsgBox().confirmDelete("",n,function(e){"yes"===e&&(i.setStatusBusy(),this.getWebAPI().deleteTemplate({params:{object_id:t},scope:this,callback:function(e,n,o){if(i.clearStatusBusy(),!e)return void i.getMsgBox().alert("",(0,l.v2)(n));i===this.getTemplateDlg()?i.getEventMgr().fireEvent("deletetemplatedone",e,n,o):SYNO.SDS.Office.Utils.isDrivePage()||-1===t.indexOf(SYNO.SDS.Office.Env.objectId)||(0,f.on)(window,!1)}}))},this)},renameTemplate:function(e){var t,i,n,o;if(SYNO.SDS.Office.Utils.isDrivePage()||e&&e===this.getTemplateDlg()){var r=(i=this.getTemplateDlg()).GetOneSeleted();if(!r)return;t=r.data.object_id,n=r.data.title,o=r.data.ntype}else i=this.findAppWindow(),t=SYNO.SDS.Office.Env.objectId,n=SYNO.SDS.Office.Env.title,o=SYNO.SDS.Office.Env.ntype;new v({ntype:o,initName:n,owner:i,object_id:t}).show()},shareTemplate:function(e,t){if(t&&t===this.getTemplateDlg()){var i,n,o=this.getTemplateDlg(),r=o.GetOneSeleted();if(!r)return;i=r.data.object_id}else SYNO.SDS.Office.Utils.isDrivePage()?e&&e.content&&e.content.object_id&&(o=this.findAppWindow(),i=e.content.object_id,n=e.sender.name):(o=this.findAppWindow(),i=SYNO.SDS.Office.Env.objectId,e&&e.share_user&&(n=e.share_user));new SYNO.SDS.Office.Template.Share.Window({object_id:i,owner:o,share_user:n,listeners:{scope:this,applydone:function(e,t,i){o===this.getTemplateDlg()&&this.getTemplateDlg().getEventMgr().fireEvent("settemplatepermdone",e,t,i)}}}).show()},leaveTemplate:function(e){var t,i,n=!1,o=SYNO.SDS.Office.Utils.isDrivePage();o||e&&e===this.getTemplateDlg()?(t=this.getTemplateDlg(),i=this.getTemplateDlg().GetSeletionIds()[0],o||i!==SYNO.SDS.Office.Env.objectId||(n=!0)):(n=!0,t=this.findAppWindow(),i=SYNO.SDS.Office.Env.objectId),t.setStatusBusy(),this.getWebAPI().leaveTemplate({params:{object_id:i,perm:{type:"user",op:"delete",name:_S("user")}},scope:this,callback:function(e,i,o){if(t.clearStatusBusy(),n)if(!e||i.has_fail)return 1!==SYNO.API.Response.GetFirstErrorIndex(i)?void t.getMsgBox().alert("",(0,l.v2)(i)):void t.getMsgBox({preventDelay:!0}).alert("",SYNO.SDS.Office._T("error","leave_no_permission"),function(){(0,f.on)()},this);else SYNO.SDS.Office.Env.set(SYNO.API.Response.GetValByIndex(i,1)),SYNO.SDS.Office.GetWindow().getEventMgr().fireEvent("permchange");else!e||i.has_fail?t.getMsgBox().alert("",(0,l.v2)(SYNO.API.Response.GetFirstError(i))):t.getEventMgr().fireEvent("leavetemplatedone",e,i,o)}},n)},listTemplateGroup:function(e,t){this.getWebAPI().listTemplateGroup({scope:this,callback:this.onCreateCallBack("listtplgroupdone",e,t,!1,this.getTemplateDlg())})},publishTemplate:function(){var e=this,t=this.findAppWindow();t.setStatusBusy({text:SYNO.SDS.Office._T("template","publishing")}),Promise.all([this.getThumbPromise(),this.getSaveNodePromise({mode:"publish"})]).then(function(t){return e.getPublishTemplateTaskDonePromise(t)}).catch(function(e){t.getMsgBox().alert("",(0,l.v2)(e))}).then(function(){t.clearStatusBusy()})},getPublishTemplateTaskDonePromise:function(e){var t=e[0],i=e[1],n=this;return new Promise(function(e,o){var r={object_id:SYNO.SDS.Office.Env.objectId,publish_version:i.snapshot_version,file:{source:"raw",name:"thumb."+t.ext},raw:t.blob};t.size&&(r.size=t.size),n.getWebAPI().publishTemplate({params:r,callback:function(t,i){if(t){n.findAppWindow().getEventMgr().fireEvent("publishtpldone"),e();return}o(i)}})})},popupSelDirDlg:function(e,t,i){let n=this.findAppWindow(),o=(0,S.QX)(SYNO.SDS.Drive.Vue.DialogTree,{title:i.title||SYNO.SDS.Office._T("action","create_title"),findAppWindow:this.findAppWindow.bind(n),cb:(i,n)=>{e.call(t,o,i,n)},params:{path:i.path},createFolderCb:(e,t)=>{this.createFolderCB(o.component,e,t)}},{ownerWindow:i.owner})},setNode:function(e,t,i){N().prototype.setNode.call(this,e,Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("setnodedone",t,i)}),i)},setNodePerm:function(e,t,i){N().prototype.setNodePerm.call(this,e,Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("setnodepermdone",t,i)}),i)},deleteNodePerm:function(e,t,i){N().prototype.deleteNodePerm.call(this,e,Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("deletenodepermdone",t,i)}),i)},setShortcut:function(e,t,i){N().prototype.setShortcut.call(this,e,Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("setshortcutdone",t,i)}),i)},deleteShortcut:function(e,t,i){N().prototype.deleteShortcut.call(this,e,Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("deleteshortcutdone",t,i)}),i)},createTag:function(e,t,i){N().prototype.createTag.call(this,e,Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("createtagdone",t,i)}),i)},setNodeTag:function(e,t,i,n){N().prototype.setNodeTag.call(this,e,Ext.createSequence(t||Ext.emptyFn,function(e,t,i){e&&SYNO.SDS.Office.LocalStorage.fireEvent("setnodetagdone",t,i)}),i)},getDriveInfo:function(){return this.drive_info_promise||(this.drive_info_promise=this.getWebAPI().getDriveInfo())}})},4077:function(e,t,i){"use strict";let n;i.d(t,{$:()=>c,L:()=>l});var o=i(85020),r=i(80816);async function a(){if((0,o.YM)())try{return await (0,r.B)().getSettingAsync()}catch(e){console.error(e)}}async function s(e){if((0,o.YM)())try{return await (0,r.B)().setSettingAsync({params:e})}catch(e){console.error(e)}}async function c(){return n??=a()}async function l(e){return c().then(t=>{if(t)for(let[i,n]of Object.entries(e))void 0!==n&&(t[i]=n)}),s(e)}},45407:function(e,t,i){"use strict";let n;i.d(t,{Uv:()=>s,aV:()=>S,z4:()=>f});var o=i(85020),r=i(80816),a=i(5890);function s(){return(0,o.YM)()&&!SYNO.SDS.Office.Utils.isOpenImportFile()&&!SYNO.SDS.Office.Utils.isSystemTemplate()}async function c(){if(s())try{if(function(){let e=window.EarlyInit.getAction()?.getFnName();if(!e)return!1;switch(e){case"requestCreateNode":case"requestCopyNode":case"requestMakeTemplate":case"requestImportNode":return!0}return!1}())return{};return await Promise.race([(0,r.B)().getUISetting({params:{object_id:(0,a.D)().objectId}}),new Promise(e=>{window.setTimeout(()=>e(void 0),6e3)})])??{}}catch(e){e?.code!==1002&&console.error(e)}}async function l(e){if(s())try{return await (0,r.B)().setUISetting({params:{object_id:(0,a.D)().objectId,...e}})??{}}catch(e){console.error(e)}}async function f(){return n??=c()}async function S(e){return f().then(t=>{if(t)for(let[i,n]of Object.entries(e))void 0!==n&&(t[i]=n)}),l(e)}},59014:function(){Ext.define("SYNO.SDS.Office.Env",{singleton:!0,constructor:function(){this.objectId=null,this.isEncrypt=!1,this.capabilities={},this.supported=["objectId","isEncrypt","ntype","recycle","perm","commentId","translation","link_id","title","shared_with","capabilities","labels","display_path","parent_id","revisions","is_template","acl","adv_shared","file_id"]},init:function(e){EarlyInit.getLaunchInfo()&&(e=Ext.apply(e,EarlyInit.getLaunchInfo()));var t,i=this.getHashParam(),n=Ext.urlDecode(location.search.substr(1));if(e.path&&(this.path=e.path),EarlyInit.getObjectId()?this.objectId=EarlyInit.getObjectId():e.object_id?this.objectId=e.object_id:i.id&&(this.objectId=i.id),EarlyInit.getLinkId()&&(this.link_id=EarlyInit.getLinkId()),this.objectId&&!Ext.isDefined(this.is_template)&&(this.is_template=SYNO.SDS.Office.Utils.isTemplateObjectId(this.objectId)),e.mode?this.mode=e.mode:this.is_template&&n.mode&&(this.mode=n.mode),"true"===n.ignore_version&&(this.ignore_version=!0),this.objectId&&(t=this.getSessionItem("password")),t){this.removeSessionItem("password"),this.isEncrypt=!0;var o=SYNO.SDS.Office.GetWindow();SYNO.SDS.Office.Utils.setEncryptPassword(this.objectId,t,o)}else e.encrypt?this.isEncrypt=!0===e.encrypt||"true"===e.encrypt:i.encrypt&&(this.isEncrypt="true"===i.encrypt);i.comment_id&&!this.commentId&&(this.commentId=i.comment_id),i.translation&&!this.translation&&(this.translation=i.translation),i.local_id&&(this.local_id=i.local_id),this.objectId&&(this.isOfficeOwned=SYNO.SDS.Office.Utils.isOfficeOwnerObjectId(this.objectId))},getHashParam:function(){return EarlyInit.getLocation()?Ext.urlDecode(EarlyInit.getLocation().hash.substr(1)):SYNO.SDS.Drive.Utils.getHashParam()},set:function(e,t){Ext.isObject(e)?Ext.copyTo(this,e,this.supported):-1<this.supported.indexOf(e)&&(this[e]=t)},get:function(e,t){return this.hasOwnProperty(e)?this[e]:t},_getStorageKey:function(e,t){return"string"==typeof(t=t??this.objectId)?t+"/"+e:""},_setStorageItem:function(e,t,i,n){var o=e&&this._getStorageKey(t,n);if(o)try{e.setItem(o,JSON.stringify(i))}catch(e){SYNO.Debug.error("storage.setItem() failed",o,e)}},_getStorageItem:function(e,t,i){var n=e&&this._getStorageKey(t,i),o=null;if(n){var r=e.getItem(n);if(null!==r)try{o=JSON.parse(r)}catch{}}return o},_removeStorageItem:function(e,t,i){var n=e&&this._getStorageKey(t,i);n&&e.removeItem(n)},setSessionItem:function(e,t,i){return this._setStorageItem(window.sessionStorage,e,t,i)},getSessionItem:function(e,t){return this._getStorageItem(window.sessionStorage,e,t)},removeSessionItem:function(e,t){return this._removeStorageItem(window.sessionStorage,e,t)},setLocalItem:function(e,t,i){return this._setStorageItem(window.localStorage,e,t,i)},getLocalItem:function(e,t){return this._getStorageItem(window.localStorage,e,t)},removeLocalItem:function(e,t){return this._removeStorageItem(window.localStorage,e,t)},setLocalBool:function(e,t,i,n){t!==i?this.setLocalItem(e,t,n):this.removeLocalItem(e,n)},getLocalBool:function(e,t){return this.getLocalItem(e,t)},isUseToken:function(){return SYNO.SDS.Drive.Utils.isLogined()&&!SYNO.SDS.Office.Utils.isDriveAdvSharing()},getSessionToken:function(){let e={};return this.isUseToken()&&(e.tid=this._tid),e},setToken:function(e){this._tid=e}})},1590:function(e,t,i){"use strict";i.d(t,{e:()=>s,r:()=>r});var n=i(30947),o=i.n(n);function r(){function e(e){s(e.type,a(e.reason))}window.onerror=function(e,t,i,n,o){s("error",a(o))},window.addEventListener("unhandledrejection",e),window.addEventListener("unload",function(){window.onerror=null,window.removeEventListener("unhandledrejection",e)})}function a(e){return e?.stack||""}function s(e,t){if(!SYNO.SDS.Office.Env||!t)return;let{ntype:i,objectId:n}=SYNO.SDS.Office.Env;o().request({api:"SYNO.Office.Log",method:"create",version:1,params:{event:e,ntype:i,object_id:n,msg:t}}).catch(e=>console.error("failed to report error",e))}},15149:function(e,t,i){"use strict";i.d(t,{Z:()=>s}),i(32867);var n=i(61367),o=i(13420);let r=SYNO.SDS.Drive.PermPanel;var a=i.n(r);let s=Ext.define("SYNO.SDS.Office.PermPanel",{extend:a(),hideAccessBtn:function(){this.accessBtn.hide()},getButtons:function(){var e=a().prototype.getButtons.apply(this,arguments);return(0,n.isMobileLayout)()&&!this.driveMobileAppBtn&&this.loginBtn&&(this.driveMobileAppBtn=new SYNO.ux.Button({cls:"syno-d-perm-panel-btn",btnStyle:"grey",disabled:!0,text:SYNO.SDS.Office._T("mobile","menu_open_in_app"),margins:this.loginBtn.margins,scope:this,handler:function(){window.open((0,o.mn)(),"_blank","noreferrer,noopener")}}),this.loginBtn.on("show",()=>{this.driveMobileAppBtn.show()}),this.loginBtn.on("hide",()=>{this.driveMobileAppBtn.hide()}),e.push(this.driveMobileAppBtn),SYNO.SDS.Drive.Define.Info.ds_id||setTimeout(()=>{SYNO.SDS.Office.GetAction().getDriveInfo().then(e=>{SYNO.SDS.Drive.Define.Info.ds_id=e?.drive?.ds_id}).catch(e=>SYNO.Debug.error(e)).finally(()=>{this.driveMobileAppBtn.enable()})},0)),e},onRequestAccess:function(){var e,t=SYNO.SDS.Drive.Utils.getHashParam()||{},i=this.findAppWindow();return(i.setStatusBusy(),t.import_path)?void i.getAction().requestAccess({path:t.import_path},this.onRequestAccessDone,this):(window.getOfficeObjectID?e=window.getOfficeObjectID():SYNO.SDS.Office.Env&&SYNO.SDS.Office.Env.objectId?e=SYNO.SDS.Office.Env.objectId:EarlyInit&&(e=EarlyInit.getObjectId()),SYNO.SDS.Office.Utils.isTemplateObjectId(e||""))?void i.getWebAPI().requestTemplate({params:{object_id:e},scope:this,callback:this.onRequestAccessDone}):EarlyInit.getLinkId()?void i.getAction().requestAccess({permanent_link:EarlyInit.getLinkId()},this.onRequestAccessDone,this):EarlyInit.getParentFolderPath()?void i.getAction().requestAccess({path:EarlyInit.getParentFolderPath()},this.onRequestAccessDone,this):void a().prototype.onRequestAccess.apply(this,arguments)},onRequestAccessDone:function(e,t){var i=this.findAppWindow();if(i.clearStatusBusy(),!e)return void i.getMsgBox().alert("",SYNO.SDS.Drive.Utils.getErrorStr(t));this.onUpdate("SENT")}})},17176:function(){Ext.define("SYNO.SDS.Office.EditorUtils",{singleton:!0,parentContains:function(e,t){for(;e;){if(e.classList&&e.classList.contains(t))return!0;e=e.parentNode}return!1}})},6235:function(e,t,i){"use strict";i(85213);var n=i(1590);function o(e){let t=window.localStorage;return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&t&&0!==t.length}Ext.ns("SYNO.SDS.Office"),Ext.define("SYNO.SDS.Office._LocalStorage",{extend:"Ext.util.Observable",data_timeout:18e4,constructor:function(){Ext.util.Observable.prototype.constructor.call(this),this.clean();var e=_S("standaloneAppName");SYNO.SDS.Drive.Utils.isLogined()&&"SYNO.SDS.Drive.Application"===e&&Ext.EventManager.on(window,"storage",this.onStorage,this,{normalized:!1})},isFirefoxPrivateMode:!!Ext.isGecko&&(!navigator.serviceWorker||void navigator.serviceWorker.ready.then(function(){SYNO.SDS.Office.LocalStorage.isFirefoxPrivateMode=!1}).catch(function(){SYNO.SDS.Office.LocalStorage.isFirefoxPrivateMode=!0})),allowLocalStorage:function(){var e="__synoffice_localstorage_test_key";if(!Ext.isDefined(window.localStorage))return!1;try{window.localStorage.removeItem(e),window.localStorage.setItem(e,"test"),window.localStorage.removeItem(e)}catch(e){if(!o(e))return!1}if(Ext.isSafari)try{window.openDatabase(null,null,null,null)}catch{return!1}return!0}(),useCookie:function(){if(void 0===this.cookie){if(void 0===this.isFirefoxPrivateMode)return!0;this.cookie=!this.allowLocalStorage||this.isFirefoxPrivateMode}return this.cookie},genId:function(){return"synoffice_"+new Date().getTime().toString(16)+"#"+Math.floor(1e5*Math.random()).toString(16)},set:function(e,t){var i=!0,r=!1;if(Ext.isObject(e)){var a=e;e=a.id,t=a.data,!1===a.cookie&&(i=!1),a.autodelete&&(r=!0)}if(t.__timestamp=new Date().getTime(),t=JSON.stringify(t),this.allowLocalStorage)try{window.localStorage.setItem(e,t)}catch(i){var s=function(i){let o=`${e}
${t}
${i}`;SYNO.Debug.error(`localStorage.setItem() failed ${o}`),(0,n.e)("set_localstorage",o)};if(s(i),o(i))try{window.localStorage.clear(),window.localStorage.setItem(e,t)}catch(e){s(e)}}i&&this.useCookie()&&Ext.util.Cookies.set(e,t,new Date(new Date().getTime()+this.data_timeout)),r&&this.remove.defer(1e4,this,[e])},fireEvent:function(e,t,i){switch(_S("standaloneAppName")){case"SYNO.SDS.Office.Sheet.Application":case"SYNO.SDS.Office.Doc.Application":case"SYNO.SDS.Office.Presentation.Application":if(SYNO.SDS.Office.Env.is_template||!this.allowLocalStorage||!SYNO.SDS.Drive.Utils.isLogined()||!SYNO.SDS.StatusNotifier.isAppEnabled("SYNO.SDS.Drive.Application"))return;break;default:return}this.set({id:"synoffice_event_"+e,data:{resp:t,params:i},cookie:!1,autodelete:!0})},check:function(e){return!!(this.allowLocalStorage&&window.localStorage.hasOwnProperty(e)||this.useCookie()&&Ext.util.Cookies.get(e))},_get:function(e){var t=null;try{t=JSON.parse(e),delete t.__timestamp}catch{t=!1}return t},get:function(e){if(!this.check(e))return!1;var t=null;return this.allowLocalStorage&&(t=window.localStorage.getItem(e)),null===t&&this.useCookie()&&(t=Ext.util.Cookies.get(e)),null!==t&&this._get(t)},remove:function(e){this.allowLocalStorage&&window.localStorage.removeItem(e),this.useCookie()&&this.removeCookie(e)},removeCookie:function(e){document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/"},clean:function(){var e,t=new Date().getTime(),i=this.data_timeout;this.allowLocalStorage&&Ext.iterate(window.localStorage,function(n,o){if(0===n.indexOf("synoffice_")){try{e=JSON.parse(o)}catch{window.localStorage.removeItem(n);return}Math.abs(t-e.__timestamp)>i&&window.localStorage.removeItem(n)}}),(!this.allowLocalStorage||Ext.isGecko)&&document.cookie.split(/; */).forEach(function(n){var o=n.split("="),r=o[0],a=o[1];if(0===r.indexOf("synoffice_")){try{e=JSON.parse(unescape(a))}catch{this.removeCookie(r);return}Math.abs(t-e.__timestamp)>i&&this.removeCookie(r)}})},onStorage:function(e){if(window.localStorage===e.storageArea){var t=e.key;if("__synoffice_localstorage_test_key"!==t&&0===t.indexOf("synoffice_")&&null!==e.newValue&&/^synoffice_event_/.test(t)){this.isFirefoxPrivateMode||(this.cookie=!1);var i=this._get(e.newValue),n=t.replace(/^synoffice_event_/g,"");SYNO.SDS.Office.GetWindow().getEventMgr().fireEvent(n,!0,i.resp,i.params),this.remove(t)}}},WindowLaunch:function(e){e.data&&(t=this.genId(),this.set({id:t,data:e.data}));var t,i=Ext.copyTo({},e,"className,url,params");return e.data&&(i.hash={local_id:t,syno_token:_S("SynoToken")}),SYNO.SDS.Office.WindowHelper.WindowLaunch(i),this.useCookie()&&(function(){SYNO.SDS.Office.LocalStorage.remove(t)}).defer(this.data_timeout),t}}),SYNO.SDS.Office.LocalStorage=new SYNO.SDS.Office._LocalStorage},96934:function(){Ext.define("SYNO.SDS.Office.URL",{singleton:!0,updateAppURL:function(){this._updateURL(SYNO.SDS.Config.FnMap[SYNO.SDS.Session.standaloneAppName])},_updateURL:function(e){if(e){var t,i=e.config.url.split("?",3);i.length>2&&(i[1]=i.splice(1,i.length-1).join("?")),t=i[1]?Ext.urlDecode(i[1]):{},delete t.launchParam;var n=i[0],o=Ext.urlEncode(t);e.config.url=Ext.urlAppend(n,o,!1)}},updateChatCSSlink:function(){for(var e,t=document.getElementsByTagName("link"),i=document.head||document.getElementsByTagName("head")[0],n=t.length-1;n>=0;n--){var o=t[n];if(o&&o.targetAttribute&&(e=o.targetAttribute("href"))&&-1!==e.indexOf("/Chat/")){var r=document.attributes.createElement("link");r.rel=o.rel,r.href=o.href,r.type=o.type,i.removeChild(o),i.appendChild(r)}}},getDriveAdvSharingURL:function(e,t,i,n){SYNO.SDS.JSDebug&&(i=Ext.apply(i||{},{jsDebug:SYNO.SDS.JSDebug}));var o=SYNO.SDS.Office.WindowHelper.getBaseAppPath()+"/d/s/"+e+"/"+t;return i&&(o=Ext.urlAppend(o,Ext.urlEncode(i),!1)),n&&(n=Ext.urlEncode(n))&&(o+="#"+n),o},getOfficeBaseURL:function(){return SYNO.SDS.Office.WindowHelper.getBaseAppURL()+(SYNO.SDS.Office.Env.is_template?"/oo/t/":"/oo/r/")},_isTemplateLinkId:function(e){return/\.tpl$/.test(e)},getOfficeURL:function(e,t,i){e=e||"";var n=this._isTemplateLinkId(e);SYNO.SDS.JSDebug&&(t=Ext.apply(t||{},{jsDebug:SYNO.SDS.JSDebug}));var o=SYNO.SDS.Office.WindowHelper.getBaseAppURL()+(n?"/oo/t/":"/oo/r/")+e;return t&&(o=Ext.urlAppend(o,Ext.urlEncode(t),!1)),i&&(i=Ext.urlEncode(i))&&(o+="#"+i),o},getCurURL:function(e){var t,i=SYNO.SDS.Drive.Utils.getHashParam(),n=SYNO.SDS.Office.Env.link_id;return SYNO.SDS.Office.Utils.isDriveAdvSharing()?window.location.protocol+"//"+window.location.host+this.getDriveAdvSharingURL(n,SYNO.SDS.Drive.Sharing.GetSharingLink(),e,i):this.getOfficeURL(n,e,i)},getOfficeObjURL:function(e,t){return new SYNO.SDS.WindowLauncher({className:_S("standaloneAppName"),url:SYNO.SDS.Office.WindowHelper.getStandaloneLaunchURL(_S("standaloneAppName"),{launchParam:Ext.urlEncode(Ext.apply({object_id:e},t))}),type:"standalone"}).getLaunchURL()},redirectURL:function(e){window.location.href===e?window.location.reload():window.history&&window.history.replaceState?(window.history.replaceState("",document.title,e),window.location.reload()):window.location.href=e},openURL:function(e,t,i){SYNO.SDS.Office.WindowHelper.WindowLaunch({url:e,params:t,hash:i})},redirectLink:function(e,t,i){this.redirectURL(this.getOfficeURL(e,t,i))},openLink:function(e,t,i){SYNO.SDS.Office.WindowHelper.WindowLaunch({url:this.getOfficeURL(e,t,i)})},setHash:function(e,t){void 0===t&&(t=!1),delete e.sh_tid;let i=Ext.urlEncode(e),n=i?"#"+i:"";return t?window.history.replaceState("",document.title,location.origin+location.pathname+location.search+n):location.hash=n,n}})},85213:function(e,t,i){"use strict";i(96934),i(6235);var n,o=i(96494),r=i.n(o);Ext.define("SYNO.SDS.Office.WindowHelper",{singleton:!0,getBaseAppPath:function(){var e=window.location.pathname,t=/\/oo\/r\/[A-Za-z0-9]*$/;t.test(e)&&(e=e.replace(t,""));var i=/\/oo\/sharing\/[A-Za-z0-9]+$/;i.test(e)&&(e=e.replace(i,""));var n=/\/oo\/t\/[\w.]+$/;n.test(e)&&(e=e.replace(n,""));var o=/\/d\/f\/[A-Za-z0-9]+$/;o.test(e)&&(e=e.replace(o,""));var r=/\/d\/s\/([A-Za-z0-9]+)\/([^/]+)$/;r.test(e)&&(e=e.replace(r,""));var a=/\/index.cgi$/;return a.test(e)&&(e=e.replace(a,"")),e.lastIndexOf("/")===e.length-1&&(e=e.slice(0,-1)),e},getBaseAppURL:function(){return window.location.protocol+"//"+window.location.host+this.getBaseAppPath()},getStandaloneLaunchURL:function(e,t){var i=SYNO.SDS.Config.FnMap[e];return t=Ext.apply({launchApp:e},t),SYNO.SDS.JSDebug&&!Ext.isDefined(t.jsDebug)&&(t=Ext.apply(t,{jsDebug:SYNO.SDS.JSDebug})),Ext.urlAppend(this.getBaseAppURL(),Ext.urlEncode(t),!i||!0!==i.config.allowURLNoSynoToken)},getWindow:function(e){var t=e;return t&&t.getMsgBox||(t=SYNO.SDS.Desktop),t},launchFromDS:function(e,t,i){var n=e.shared_path,o=SYNO.SDS.Office.File.getBaseName(n);if(Ext.getClassByName("SYNO.SDS.Drive.Extension.Instance.isInCloudStationFolder")&&!SYNO.SDS.Drive.Extension.Instance.isInCloudStationFolder(n))return void this.getWindow(t).getMsgBox().alert("",_TT("SYNO.SDS.Office.AppInstance","error","non_drive_folder"));if(Ext.getClassByName("SYNO.SDS.Drive.Extension.Instance.isFiltered")&&SYNO.SDS.Drive.Extension.Instance.isFiltered(o,n,e.is_dir,e.size))return void this.getWindow(t).getMsgBox().alert("",_TT("SYNO.SDS.Office.AppInstance","error","drive_exclude_folder"));var r=SYNO.SDS.Office.File.getNTypeByFileName(o);if(r){var a={fn:"openNode",params:{vol_path:e.vol_path},session_data:{ntype:r}};SYNO.SDS.Office.WindowHelper.launchURLFromDS(i||SYNO.SDS.Office.URL.getOfficeURL(),a)}},launchURLFromDS:function(e,t){var i=e.split("/").splice(0,3).join("/");window.location.origin===i?SYNO.SDS.Office.LocalStorage.WindowLaunch({url:e,data:t}):SYNO.SDS.Office.WindowHelper.WindowLaunch({url:e,hash:SYNO.API.EncodeParams({office_launchdata:t})})},getPathIdByVolPath:function(e){return String.format("/volumes{0}",e)},openFromDS:function(e,t){var i=e.shared_path,n=SYNO.SDS.Office.File.getBaseName(i),o=SYNO.SDS.Office.File.getNTypeByFileName(n);if(o){var r=[{format:"ds",path:i,to_parent_folder:this.getPathIdByVolPath(e.vol_path),viewonly:!0}];SYNO.SDS.Office.WindowHelper.launchURLFromDS(t||SYNO.SDS.Office.URL.getOfficeURL(),{fn:"requestImportNode",params:{name:n,files:r},session_data:{ntype:o,files:r}})}},openAnchorElm:((n=document.body.appendChild(document.createElement("a"))).target="_blank",n.rel="noreferrer noopener",n.id="syno_office_open_anchor",n.style.position="absolute",n.style.top="-100px",n.style.left="-100px",n.style.zIndex="0",n),openByAnchor:function(e){var t=this.openAnchorElm;try{return t.href=e,t.click(),!0}catch(e){return SYNO.Debug.error("click failed "+e),!1}},getAppURL:function(e,t,i){var n=new SYNO.SDS.WindowLauncher({className:e,url:SYNO.SDS.Office.WindowHelper.getStandaloneLaunchURL(e,t),type:"standalone"}).getLaunchURL();return i&&(n+="#"+Ext.urlEncode(i)),n},_parseURL:function(e,t,i){var n;return Ext.isObject(e)?e.url?(n=Ext.urlAppend(e.url,Ext.urlEncode(e.params),!1),e.hash&&(n+="#"+Ext.urlEncode(e.hash))):n=this.getAppURL(e.className,e.params,e.hash):n=this.getAppURL(e,t,i),n},WindowLaunch:function(e,t,i){this.openByAnchor(this._parseURL(e,t,i))},WindowOpen:function(e,t,i){return window.open(this._parseURL(e,t,i),"_blank")}}),Ext.define("SYNO.SDS.Office.File",{singleton:!0,DOC_EXTENSION:"odoc",SHEET_EXTENSION:"osheet",SLIDE_EXTENSION:"oslides",OFFICE_EXTENSIONS:[],IMPORT_DOC_EXTENSIONS:["docx","odt","rtf","doc"],IMPORT_XLS_EXTENSIONS:["xlsx","xlsm","xltx","xltm","xls","xlt","ods","ots","csv"],IMPORT_PPT_EXTENSIONS:["pptx","ppt","odp"],IMPORT_EXTENSIONS:[],IMPORT_MIME_TYPES:["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.oasis.opendocument.text,application","application/rtf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","application/vnd.oasis.opendocument.spreadsheet","application/vnd.sun.xml.calc","application/vnd.s  tardivision.calc","application/x-starcalc","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/msword","application/vnd.ms-powerpoint","application/vnd.oasis.opendocument.presentation"],EXPORT_EXTENSION:{odoc:"docx",osheet:"xlsx",oslides:"pptx"},constructor:function(){this.OFFICE_EXTENSIONS=[this.DOC_EXTENSION,this.SHEET_EXTENSION,this.SLIDE_EXTENSION],r().isAppAuthorized()&&(this.IMPORT_EXTENSIONS=this.IMPORT_EXTENSIONS.concat(this.IMPORT_DOC_EXTENSIONS).concat(this.IMPORT_XLS_EXTENSIONS).concat(this.IMPORT_PPT_EXTENSIONS))},getBaseName:function(e,t){if(!Ext.isDefined(e))return"";var i="",n=e.lastIndexOf(t||"/");return -1!==n&&(i=e.substr(n+1)),i},getExt:function(e){var t=(e=SYNO.SDS.Office.File.getBaseName(e)||e||"").lastIndexOf(".");return -1===t?"":e.substr(t+1).toLowerCase()},isImportable:function(e){return -1!==this.IMPORT_EXTENSIONS.indexOf(e)},isDocImportable:function(e){return -1!==this.IMPORT_DOC_EXTENSIONS.indexOf(e)},isSheetImportable:function(e){return -1!==this.IMPORT_XLS_EXTENSIONS.indexOf(e)},isSlideImportable:function(e){return -1!==this.IMPORT_PPT_EXTENSIONS.indexOf(e)},isAppImportable:function(e){var t=SYNO.SDS.StatusNotifier.isAppEnabled("SYNO.SDS.Drive.Application");return("SYNO.SDS.Drive.PublicApplication"!==_S("standaloneAppName")||!!r().isLogined())&&!!t&&this.isImportable(e)},isDoc:function(e){return this.DOC_EXTENSION===e},isSheet:function(e){return this.SHEET_EXTENSION===e},isSlide:function(e){return this.SLIDE_EXTENSION===e},isOffice:function(e){return -1!==this.OFFICE_EXTENSIONS.indexOf(e)},getNTypeByFileName:function(e){var t=SYNO.SDS.Office.File.getExt(e);return SYNO.SDS.Office.File.isSheetImportable(t)||SYNO.SDS.Office.File.isSheet(t)?"sheet":SYNO.SDS.Office.File.isDocImportable(t)||SYNO.SDS.Office.File.isDoc(t)?"doc":SYNO.SDS.Office.File.isSlideImportable(t)||SYNO.SDS.Office.File.isSlide(t)?"presentation":void 0}})},73032:function(){Ext.define("SYNO.SDS.Office.Define",{singleton:!0,SystemUID:1,ToolbarDefault:{text_color:"ff0000",bg_color:"fff001",font_family:"Arial"},ImageExt:["jpg","jpeg","jpe","gif","bmp","png","tif","tiff","svg","wmf","emf"],VideoExt:["3gp","mpg","mpeg","mp4","m4v","ogv","mov","webm"]}),SYNO.SDS.Office.Define.Info={}},77284:function(e,t,i){"use strict";function n(e,t){let i=new ArrayBuffer(e.length),n=new Uint8Array(i);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return new Blob([i],{type:t})}i.d(t,{P:()=>n})},13420:function(e,t,i){"use strict";i.d(t,{Dc:()=>o.Dc,G9:()=>o.G9,GI:()=>n.GI,M5:()=>n.M5,Md:()=>o.Md,mn:()=>o.mn,o0:()=>o.o0,vQ:()=>o.vQ});var n=i(27107),o=i(32867)},27107:function(e,t,i){"use strict";i.d(t,{GI:()=>c,M5:()=>S,jE:()=>s,mr:()=>l,o1:()=>f,oR:()=>p});let n=[{value:"#000000",light:0},{value:"#980000",light:0},{value:"#ff0000",light:0},{value:"#ff9000",light:0},{value:"#fff001",light:1},{value:"#1ee20f",light:0},{value:"#0078ff",light:0},{value:"#4a86e8",light:0},{value:"#643ddb",light:0},{value:"#d30e91",light:0},{value:"#2e3133",light:0},{value:"#5b0f00",light:0},{value:"#a62929",light:0},{value:"#b35900",light:0},{value:"#7f6000",light:0},{value:"#00802b",light:0},{value:"#115ba6",light:0},{value:"#1c4587",light:0},{value:"#543d99",light:0},{value:"#8c2a6c",light:0},{value:"#64696e",light:0},{value:"#85200c",light:0},{value:"#e04343",light:0},{value:"#e67300",light:0},{value:"#bf9000",light:0},{value:"#009933",light:0},{value:"#1470cc",light:0},{value:"#1155cc",light:0},{value:"#7052cc",light:0},{value:"#cc3d9c",light:0},{value:"#7b8187",light:0},{value:"#a61c00",light:0},{value:"#ed4747",light:0},{value:"#fa7d00",light:0},{value:"#f1c232",light:0},{value:"#00b23b",light:0},{value:"#177ee5",light:0},{value:"#4176cc",light:0},{value:"#7e5ce5",light:0},{value:"#e545b0",light:0},{value:"#d0d4d9",light:1},{value:"#cc4125",light:0},{value:"#fa8282",light:0},{value:"#fa9c3e",light:0},{value:"#ffd966",light:1},{value:"#4dbf73",light:0},{value:"#499df2",light:0},{value:"#6399f7",light:0},{value:"#a18ae6",light:0},{value:"#e67ec3",light:0},{value:"#e6ebf0",light:1},{value:"#dd7e6b",light:0},{value:"#ffb2b2",light:0},{value:"#ffb973",light:0},{value:"#ffe599",light:1},{value:"#70e096",light:0},{value:"#99ceff",light:0},{value:"#94b9f7",light:0},{value:"#cebfff",light:0},{value:"#ffa6e0",light:0},{value:"#ffffff",light:1},{value:"#e6b8af",light:1},{value:"#ffcccc",light:1},{value:"#ffd9b2",light:1},{value:"#fff2cc",light:1},{value:"#c4f5d4",light:1},{value:"#cce6ff",light:1},{value:"#c9daf8",light:1},{value:"#e2d9ff",light:1},{value:"#ffd9f2",light:1}],o=["#94BF13","#4CBF73","#1DBFBF","#24BFF2","#3D82D1","#FA9C3E","#A18AE5","#FA8282"],r=new Set,a=[];function s(){return SYNO.SDS.Drive.Define.ColorSelf}function c(){return n}function l(){return o[Math.floor(Math.random()*o.length)]}function f(e){let t;return o[(e.length>0?e.charCodeAt(0):0)%o.length]}function S(){return a}function p(e){for(let t of"string"==typeof e?[e]:e){let e=function(e){if("transparent"===e)return null;let t=e.startsWith("#")?e.slice(1):e;return(6===t.length||8===t.length)&&/^[0-9a-fA-F]+$/.test(t)?"#"+t.slice(0,6).toLowerCase():null}(t);!e||r.has(e)||(r.add(e),a.push(e))}}},32867:function(e,t,i){"use strict";i.d(t,{Dc:()=>c,G9:()=>l,JL:()=>h,Md:()=>p,ZQ:()=>d,mn:()=>u,o0:()=>S,vQ:()=>f}),i(59014),i(73032);var n=i(32334),o=i(71783),r=i(61431),a=i(77284),s=i(61367);function c(){if(!function(){let e=document.activeElement;for(;e&&"IFRAME"===e.tagName;)e=e.contentDocument?.activeElement??null;return!!e&&(e.isContentEditable||["INPUT","TEXTAREA"].includes(e.tagName))&&"none"!==e.inputMode}())return!1;let e=window.visualViewport.height*window.visualViewport.scale;return Ext.isSafari?e<.85*document.documentElement.clientHeight:e<window.screen.height-200}function l(e,t){if(!e?.footer)return;let i=e.getWidth(),n=e.getHeight();e.footer.setDisplayed(t),e.onResize(i,n,i,n)}function f(e,t){let{successMsg:i=SYNO.SDS.Drive._T("share","copy_url_done"),failedMsg:n=SYNO.SDS.Drive._T("error","copy_share_link"),toastDuration:o=3e3}=void 0===t?{}:t;if(""===e)return;let r=document.body,a=document.createElement("textarea");a.inputMode="none",r.appendChild(a),a.value=e,a.select();let c=document.execCommand("copy");r.removeChild(a);let l="";""!==(l=c?i??"":n??"")&&S(l,o,!1,null,(0,s.isMobileLayout)()?{offsetY:80}:{})}function S(e,t,i,n,o){o=Object.assign({offsetX:0,offsetY:10,delay:t||1500},o);let r=SYNO.SDS.Office.GetWindow(),a=SYNO.SDS.Drive.Utils.getToastBox(e,i||!1,n,o,r);return a.show(),a}function p(){return SYNO.SDS.Config.FnMap[_S("standaloneAppName")].config.version??String(Date.now())}function d(e){let t=document.querySelector(String.format('script[src*="{0}"]',e));return t?t.getAttribute("src"):""}function u(){var e=SYNO.SDS.Office.Env.link_id,t=SYNO.SDS.Drive.Define.Info.ds_id,i="https:"===location.protocol,n=_S("user"),o=location.hash.substr(1)||null,r="#";SYNO.SDS.Drive.Utils.isLogined()||(n=void 0);var a=location.host;function c(e,t){var i=[];return Object.keys(e).forEach(function(t){var n=e[t];null!=n&&i.push(t+"="+encodeURIComponent(n))}),i.join(t||"&")}var l,f=SYNO.SDS.Drive.Sharing.GetSharingToken();return(0,s.isIOSFamily)()?(l={scheme:"synodrive",permanent_link:e,ds_id:t,host:a,https:i,account:n,origin_uri:location.href,hash:o},f&&(l.sharing_token=f),r="https://driveupdate.synology.com?"+c(l)):(0,s.isAndroid)()&&(l={"S.permanent_link":e,"S.ds_id":t,"S.host":a,"B.https":i,"S.account":n,"S.origin_uri":location.href,"S.hash":o},f&&(l["S.sharing_token"]=f),r="intent://open/#Intent;scheme=synodrive;package=com.synology.dsdrive;"+c(l,";")+";end"),r}function h(){SYNO.SDS.Office.GetWindow().getMsgBox().alert("",(0,n.$)("error","packet_too_large"),()=>{window.onbeforeunload=null,location.reload()})}Ext.ns("SYNO.SDS.Office"),SYNO.SDS.Office._T=n.$,Ext.define("SYNO.SDS.Office.Utils",{statics:{isSupportImage:function(e){var t,i=SYNO.SDS.Office.Define.ImageExt;return!!Ext.isString(e)&&(t=e.split(".").pop(),!Ext.isEmpty(t)&&-1!==i.indexOf(t.toLowerCase()))},getErrorCode:function(e){(0,o.zg)(e)},initErrorStr:function(){(0,o.yj)()},getErrorStr:function(e){return(0,o.v2)(e)},showErrorMsg:function(e,t,i){this.showAlertMsg(e,(0,o.v2)(t),i)},showAlertMsg:function(e,t,i){if((0,r.z)(e))return e.showMsgBox("alert","",t,i,!1);var n=e.getMsgBox();if(!Ext.isEmpty(n))return n.alert("",t,i)},isDriveAdvSharing:function(){return!!(SYNO.SDS.Drive.Sharing&&SYNO.SDS.Drive.Sharing.GetSharingLink())},isViewerMode:function(){return this.isOpenImportFile()||this.isTemplateReadOnlyMode()||this.isIgnoreVersion()},isPublicShareOrImportView:function(){return this.isDriveAdvSharing()||this.isOpenImportFile()},isOffline:function(){return SYNO.SDS.Office.GetWindow().isOffline()},getEditorMode:function(){return this.isEditable(!0)?SYNO.SDS.Office.GetWindow().getEditorMode():this.isCommentable(!0)?"comment":"readonly"},getPermissionRole:function(e){switch(void 0===e&&(e=this.getEditorMode()),e){case"edit":default:return"editor";case"comment":return this.isReadable()?"commenter":"reviewer";case"readonly":case"view":return this.isReadable()?"viewer":"previewer"}},isPermReadOnly:function(){if(this.isOffline())return!0;var e=SYNO.SDS.Office.Env.perm;return SYNO.SDS.Office.Env.is_template?!!this.isSystemTemplate()||"rw"!==e&&"owner"!==e:SYNO.SDS.Office.Env.recycle||"rw"!==e},isReadOnly:function(){return!!this.isViewerMode()||this.isPermReadOnly()},isPreviewOnly:function(){var e=SYNO.SDS.Office.Env.capabilities;return e.can_preview&&!e.can_read},isEditable:function(e){return!this.isReadOnly()&&(e||"edit"===SYNO.SDS.Office.GetWindow().getEditorMode())},isCommentable:function(e){return!(this.isViewerMode()||SYNO.SDS.Office.Env.recycle||this.isOffline())&&SYNO.SDS.Office.Env.capabilities.can_comment&&(e||"edit"===SYNO.SDS.Office.GetWindow().getEditorMode())},isReadable:function(){return SYNO.SDS.Office.Env.capabilities.can_read},isDownloadable:function(){return!!SYNO.SDS.Office.Env.is_template||SYNO.SDS.Office.Env.capabilities.can_download},isTranslatable:function(){return SYNO.SDS.Drive.Utils.isAppAuthorized()&&!SYNO.SDS.Office.Utils.isViewerMode()&&!SYNO.SDS.Office.Utils.isDriveAdvSharing()&&!SYNO.SDS.Office.Env.is_template},isTemplateReadOnlyMode:function(){return!!SYNO.SDS.Office.Env.is_template&&"edit"!==SYNO.SDS.Office.Env.mode},isSystemTemplate:function(){return SYNO.SDS.Office.Env.is_template&&SYNO.SDS.Office.Define.SystemUID===this.getUidByObjectId(SYNO.SDS.Office.Env.objectId)},isOpenImportFile:function(){if(this.isDrivePage())return!1;if(SYNO.SDS.Office.Env.isOfficeOwned)return!0;var e=EarlyInit.getAction();return e&&"requestImportNode"===e.getFnName()},isIgnoreVersion:function(){return!this.isDrivePage()&&!0===SYNO.SDS.Office.Env.ignore_version},isWindow:function(e){return"object"==typeof e&&e.self===e},setEncryptPassword:function(e,t,i){t&&((i=i||SYNO.SDS.Office.GetWindow()).enc_pwd||(i.enc_pwd={}),i.enc_pwd[e]={password:t})},getEncryptPassword:function(e){var t=SYNO.SDS.Office.GetWindow();return(t.enc_pwd||(t.enc_pwd={}),Ext.isEmpty(t.enc_pwd[e]))?null:t.enc_pwd[e].password},canvasToDataURI:function(e,t){Ext.isObject(t)&&t.background&&this._canvasFillBackground(e);try{return e.toDataURL("image/png")}catch{}},canvasToPng:function(e,t){Ext.isObject(t)&&t.background&&this._canvasFillBackground(e);var i=this;return new Promise(function(t,n){e.toBlob?e.toBlob(t,"image/png"):t(e.msToBlob?e.msToBlob():i.dataURItoBlob(e.toDataURL("image/png")))}).catch(function(){return null})},dataURItoBlob:function(e){var t,i,n,o,r;return(t=e.match(/^data:((.*?)(;charset=.*?)?)(;base64)?,/))?(i=t[2]?t[1]:"text/plain"+(t[3]||";charset=utf-8"),n=!!t[4],o=e.slice(t[0].length),r=n?atob(o):decodeURIComponent(o),(0,a.P)(r,i)):void SYNO.Debug.error("invalid data URI",e)},saveObjectURL:function(e,t,i){var n=new XMLHttpRequest;n.onload=function(e){t.call(i,this,e)},n.open("GET",e,!0),n.responseType="blob",n.send()},UrlToPng:function(e,t,i,n){Ext.isObject(t)&&(o=t.size);var o,r=document.createElement("canvas"),a=new Image;a.src=e,a.setAttribute("crossOrigin","anonymous"),a.onload=(function(){var e=o&&o.width,s=o&&o.height;e||s?e?s||(s=e/a.width*a.height):e=s/a.height*a.width:(e=a.width,s=a.height),r.width=e,r.height=s,r.getContext("2d").drawImage(a,0,0,e,s),this.canvasToPng(r,t).then(function(e){r=null,i.call(n,e,!0)})}).bind(this),a.onerror=function(){r=null,i.call(n,null,!1)}},_canvasFillBackground:function(e){var t=e.getContext("2d");t.globalCompositeOperation="destination-over",t.fillStyle="#FFF",t.fillRect(0,0,e.width,e.height)},isQuickconnect:function(){if(Ext.isDefined(this.blQuickconnect))return this.blQuickconnect;var e=location.hostname.toLowerCase();return this.blQuickconnect=e.endsWith(".quickconnect.to")||e.endsWith(".quickconnect.cn")},isQuickconnectDirect:function(){var e=location.hostname.toLowerCase();return e.endsWith(".direct.quickconnect.to")||e.endsWith(".direct.quickconnect.cn")},getClassNameFromNType:function(e){switch(e){case"sheet":return"SYNO.SDS.Office.Sheet.Application";case"doc":return"SYNO.SDS.Office.Doc.Application";case"presentation":return"SYNO.SDS.Office.Presentation.Application"}},getClassNameFromObjectId:function(e){return this.getClassNameFromNType(this.getNTypeByObjectId(e))},is1stSharedWithMe:function(e){if(!e)return!1;var t=e.split("/",4);return 3===t.length&&"shared-with-me"===t[1]},registerInitEvent:function(e,t,i){SYNO.SDS.Office.Define.Info.init?e.defer(i||80,t):SYNO.SDS.Office.GetWindow().getEventMgr().on("init:done",e,t,{buffer:i||80,single:!0})},getInitEventPromise:function(){return new Promise(function(e,t){SYNO.SDS.Office.Utils.registerInitEvent(e)})},getCurFolderPriv:function(){var e=SYNO.SDS.Drive.GetWindow().getNavigation();return"node"!==e.getCategory()&&e.isRootPath()?{}:e.getLastPath().perm},getAccount1stName:function(e){e=e||"";try{if(window.Intl)return SYNO.SDS.Office.Utils.Segmenter||(SYNO.SDS.Office.Utils.Segmenter=new window.Intl.Segmenter),Array.from(SYNO.SDS.Office.Utils.Segmenter.segment(e))[0].segment.toUpperCase()}catch{}return e.charAt(0).toUpperCase()},isTemplateObjectId:function(e){return e&&0<e.indexOf(".tpl.")},isOfficeOwnerObjectId:function(e){return e&&0<e.indexOf(".synoffice.")},getNTypeByObjectId:function(e){var t=e.match(/\.[a-z]*$/g);if(t){var i=t[0].substring(1);switch(i){case"sh":return"sheet";case"slide":return"presentation";case"doc":return"doc";default:return i}}},getNTypeByFileName:function(e){return SYNO.SDS.Office.File.getNTypeByFileName(e)},getUidByObjectId:function(e){return parseInt(e.split("_",1)[0],10)},parseDisplayName:function(e){return!this.isDrivePage()&&SYNO.SDS.Office.Env.is_template&&SYNO.SDS.Office.Env.objectId?this.isSystemTemplate()?this.parseTemplateTitle(e):e:SYNO.SDS.Drive.Utils.parseDisplayName(e)},isDrivePage:function(){var e=_S("standaloneAppName");return"SYNO.SDS.Drive.Application"===e||"SYNO.SDS.Drive.PublicApplication"===e},isOfficePage:function(){var e=_S("standaloneAppName");return e&&"Office"===e.split(".")[2]},callOnEditorReady:function(e,t){this._pollWindowStatus(e,t)},checkSharePrivilge:function(e,t,i,n){if(!i)return!1;var o=SYNO.SDS.Drive.Define.Info||{};if(e){if(!n&&SYNO.SDS.Office.Template.Utils.isShared(t.acl))return!0;if(!o.sharing_permission||!o.sharing_permission.internal_link_sharing&&!o.sharing_permission.invite_sharing)return!1}else{if(!n&&SYNO.SDS.Drive.Utils.checkSharePrivilge(t,i))return!0;if(o.disabled_all_sharing)return!1}return!0},_pollWindowStatus:function(e,t){var i={run:function(){try{if(e.closed)return void Ext.TaskMgr.stop(i)}catch{Ext.TaskMgr.stop(i);return}e.SYNO&&e.SYNO.SDS&&e.SYNO.SDS.Office&&e.SYNO.SDS.Office.Window&&e.SYNO.SDS.Office.Window.rendered&&(Ext.TaskMgr.stop(i),t(e.SYNO.SDS.Office.Window))},interval:200};Ext.TaskMgr.start(i)},getParentDir:function(e){if(e){var t,i=e.split("/");if(e!==i[0]){switch("/"===e.charAt(0)&&i.splice(0,1),i[0]){case"recycle-bin":return;case"mydrive":t=1;break;case"shared-with-me":t=3;break;default:t=2}if(!(i.length<t))return i.splice(-1,1),"/"+i.join("/")}}},isSameParent:function(e,t,i){return"/"===i.charAt(0)?t===i:e===SYNO.SDS.Drive.Utils.getFileIdFromPathId(i)},openDrive:function(e,t){var i,n,o=e.category,r=e.file_id,a=new SYNO.SDS.WindowLauncher({className:"SYNO.SDS.Drive.Application",url:SYNO.SDS.Office.WindowHelper.getStandaloneLaunchURL("SYNO.SDS.Drive.Application"),type:"standalone"});i=a.getLaunchURL(),o?n={category:o}:r&&(n={file_id:r}),n&&(i+="#"+Ext.urlEncode(n)),!Ext.isBoolean(t)||t?a.openNewWindow(void 0,i):window.location=i},removeLoadingPage:function(){var e=document.getElementById("o-loading-page");e&&e.remove()},hasLoadingPage:function(){return!!document.getElementById("o-loading-page")},parseTemplateTitle:function(e){var t=e.split(":");return e=SYNO.SDS.UIString.GetLocalizedString(t.slice(0,2).join(":"),"SYNO.SDS.Office.AppInstance"),t.length>2&&(e=String.format.apply(String,[e].concat(t.slice(2)))),e},getAppURL:function(){let e=SYNO.SDS.Office.WindowHelper.getBaseAppPath()+"/",t={launchApp:SYNO.SDS.Session.standaloneAppName},i={};SYNO.SDS.Office.Env.link_id?i.link=SYNO.SDS.Office.Env.link_id:window.getDriveLink&&(i.link=window.getDriveLink());let n=SYNO.SDS.Drive.Sharing.GetSharingLink();return n&&(i.sharing_link=n),Object.keys(i).length&&(t=Ext.apply(t,{launchParam:Ext.urlEncode(i)})),SYNO.SDS.JSDebug&&(t=Ext.apply(t,{jsDebug:SYNO.SDS.JSDebug})),Ext.urlAppend(e,Ext.urlEncode(t),!1)+window.location.hash||""},getSnapshotVersion:function(){if(SYNO.SDS.Office.Utils.isViewerMode()){if(SYNO.SDS.Office.Utils.isIgnoreVersion())return"ignore_version";else if(SYNO.SDS.Office.Env.is_template)return"publish_version"}},isWithPureCtrlKey:function(e){let t=e instanceof Ext.EventObjectImpl?e.browserEvent:e;return(Ext.isMac?t.metaKey:t.ctrlKey)&&!e.shiftKey&&!e.altKey},downloadFile:function(e,t,i){let n=new Blob([e],{type:i||"application/octet-stream"}),o=window.URL.createObjectURL(n),r=document.createElement("a");r.style.display="none",r.href=o,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>{window.URL.revokeObjectURL(o)},100)},closeDSMSocketIO:function(){var e=SYNO.SDS.SocketInst&&SYNO.SDS.SocketInst._socket;e&&(e.on("connect",e.disconnect.bind(e)),e.disconnect())},focusEditor:function(){let e=SYNO.SDS.WindowMgr.getActive();if(!e||e instanceof SYNO.SDS.Office.FindReplace)return void SYNO.SDS.Office.GetWindow().fireEvent("focuseditor");(e instanceof SYNO.SDS.Office.BaseWindow||e instanceof SYNO.SDS.Office.History.Window)&&e.fireEvent("focuseditor")},showHelp:function(){var e,t="SYNO.SDS.Office.AppInstance",i=SYNO.SDS.Office.GetWindow().getHelpParam();Ext.isString(i)&&i.length>0&&(t+=":"+i),SYNO.SDS.Drive.Utils.openURL((e=t,SYNO.SDS.Office.WindowHelper.getStandaloneLaunchURL("SYNO.SDS.HelpBrowser.Application",e?{launchParam:"topic="+e}:null)),null,!0)}}}),SYNO.SDS.Office.GetWindow=function(){return SYNO.SDS.Office.Window||(SYNO.SDS.Office.Window=SYNO.SDS.AppMgr.getByAppName(_S("standaloneAppName"))[0].window),SYNO.SDS.Office.Window||SYNO.SDS.Drive.GetWindow()},SYNO.SDS.Office.GetAction=function(){return SYNO.SDS.Office.Drive&&SYNO.SDS.Office.Drive.getAction?SYNO.SDS.Office.Drive.getAction():SYNO.SDS.Office.GetWindow().getAction()},SYNO.SDS.Office.GetWebAPI=function(){return SYNO.SDS.Office.GetAction().webapi},SYNO.SDS.Office.GetTplDlg=function(){return(!SYNO.SDS.Office.TplDlg||SYNO.SDS.Office.TplDlg.isDestroyed)&&(SYNO.SDS.Office.TplDlg=SYNO.SDS.Office.GetWindow().modalWin[0]),SYNO.SDS.Office.TplDlg},Ext.define("SYNO.SDS.Office.UserSettings",{statics:{init:function(){return this.initPromise?this.initPromise:SYNO.SDS.initUserSettings?this.initPromise=Promise.resolve():this.initPromise=new Promise(function(e){SYNO.API.Request({api:"SYNO.Core.UserSettings",method:"get",version:1,callback:function(t,i){t&&(SYNO.SDS.UserSettings.data=i,e())}})})},get:function(e){return _S("isLogined")?this.init().then(function(){return SYNO.SDS.UserSettings.getProperty(_S("standaloneAppName"),e)}):Promise.resolve()},set:function(e,t){if(_S("isLogined"))return SYNO.SDS.UserSettings.setProperty(_S("standaloneAppName"),e,t)}}})},3713:function(e,t,i){"use strict";i.d(t,{Z:()=>s});var n=i(30947),o=i.n(n);let r=SYNO.SDS.Drive.WebAPI;var a=i.n(r);let s=Ext.define("SYNO.SDS.Office.WebAPI",{extend:a(),findAppWindow:function(){return SYNO.SDS.Office.GetWindow()},getGlobalPassword:function(){return SYNO.SDS.Office.Env&&SYNO.SDS.Office.Utils.getEncryptPassword(SYNO.SDS.Office.Env.objectId)||""},getEncryptionOpts:function(e){var t=[];if(e.password&&t.push("password"),e.new_password&&t.push("new_password"),e.passwords&&t.push("passwords"),Ext.isArray(e.files)&&e.files){let i=!1;e.files.forEach(e=>{e.password&&(i=!0)}),i&&t.push("files")}if(!Ext.isEmpty(t))return t},createPromiseWrapper:function(e){return new Promise((t,i)=>{e((e,n)=>{e?t(n):i(n)})})},initial:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Info",version:1,method:"get",callback:e.callback,scope:e.scope||window})},createOfficeNode:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node",version:1,method:"create",timeout:18e5,params:this.copyTo({commit_msg:Ext.apply({device:"desktop"},e.commit_msg)},e.params,"path,title,ctime,mtime,password,encrypt,ntype,content"),encryption:this.getEncryptionOpts(e.params),callback:e.callback,scope:e.scope||window})},encryptPasswordPromise:function(e){var t={password:JSON.stringify(e)};return o().env.isSecure()?Promise.resolve(t):o().encrypt(t)},createNodeAttachment:function(e){var t=e.params.password||this.getGlobalPassword();if(e.params.raw||e.params.files.some(e=>"raw"===e.type))return(t?this.encryptPasswordPromise(t):Promise.resolve()).then(this._createNodeAttachment.bind(this,{params:SYNO.SDS.copy(e.params),callback:e.callback,scope:e.scope}));var i=this.copyTo({password:t},e.params,["object_id","files"]);this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node.Attachment",version:1,method:"create",timeout:18e5,params:i,encryption:this.getEncryptionOpts(i),callback:e.callback,scope:e.scope||window})},_createNodeAttachment:function(e,t){var i={api:"SYNO.Office.Node.Attachment",version:1,method:"create",timeout:18e5},n=new window.FormData,o=[];n.append("object_id",JSON.stringify(e.params.object_id)),SYNO.SDS.Office.Utils.isDriveAdvSharing()&&n.append("sharing_token",JSON.stringify(SYNO.SDS.Drive.Sharing.GetSharingToken())),Ext.iterate(e.params.files,function(t){if("raw"===t.type){o.push({type:"raw",source:t.source});var i=e.params.raw[t.source];n.append(t.source,i,i.name||"image")}else o.push(t)}),n.append("files",JSON.stringify(o)),Ext.iterate(t||{},function(e,t){n.append(e,t)}),i.html5upload=!0,i.isUpload=!0,i.uploadData=n,i.callback=function(t,i){e.callback.call(e.scope||window,t,i)},i.scope=this,this.findAppWindow().sendWebAPI(i)},listNodeAttachment:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node.Attachment",version:1,method:"list",params:this.copyTo({},e.params,["object_id"]),callback:e.callback,scope:e.scope||window})},getOfficeNode:function(e,t){void 0===t&&(t=!0);var i=this.copyTo({password:t?this.getGlobalPassword():""},e.params||{},["vol_path","object_id","ver","password","field","basic","filter","path","snapshot","sharing_token"]);this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node",version:1,method:"get",params:i,encryption:this.getEncryptionOpts(i),callback:e.callback,scope:e.scope||window})},setOfficeNode:function(e){var t=e.params||{};this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node",version:1,method:"set",params:this.copyTo({commit_msg:Ext.apply({device:"desktop"},t.commit_msg)},t,["path","object_id","ver","title","ctime","mtime","password","new_password","locale"]),encryption:this.getEncryptionOpts(e.params),callback:e.callback,scope:e.scope||window})},setOfficeNodeOwner:function(e){var t=e.params||{};this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node.Owner",version:1,method:"set",params:this.copyTo({commit_msg:Ext.apply({device:"desktop"},t.commit_msg)},t,["to_parent_folder","object_id","title"]),callback:e.callback,scope:e.scope||window})},encryptOfficeNode:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node",version:1,method:"copy",params:this.copyTo({commit_msg:{device:"desktop"}},e.params||{},"path,title,ver,password,encrypt"),encryption:this.getEncryptionOpts(e.params),timeout:18e5,callback:e.callback,scope:e.scope||window})},copyOfficeNode:function(e){this.getGlobalPassword()&&(e.params.password=this.getGlobalPassword()),this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node",version:2,method:"copy",params:this.copyTo({commit_msg:{device:"desktop"}},e.params||{},"files,path,to_parent_folder,title,ver,comment,password,passwords,conflict_action,content"),encryption:this.getEncryptionOpts(e.params),callback:e.callback,scope:e.scope||window})},checkNodePassword:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node.Encrypt",version:1,method:"check",params:this.copyTo({},e.params||{},"object_id,path,password"),encryption:this.getEncryptionOpts(e.params),callback:e.callback,scope:e.scope||window})},restoreVersion:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node.Version",version:1,method:"restore",params:this.copyTo({password:this.getGlobalPassword()},e.params||{},"object_id,ver,password,path,to_parent_folder"),encryption:this.getEncryptionOpts(e.params),callback:e.callback,scope:e.scope||window})},renameVersion:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Node.Version",version:1,method:"rename",params:this.copyTo({},e.params||{},"object_id,ver,ver_name,overwrite"),callback:e.callback,scope:e.scope||window})},importNode:function(e){var t=this.copyTo({},e.params||{},"files");this.findAppWindow().sendWebAPI({api:"SYNO.Office.Import",version:1,method:"start",params:t,encryption:this.getEncryptionOpts(t),callback:e.callback,scope:e.scope||window})},importNodeDone:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Import",version:1,method:"stop",params:this.copyTo({},e.params||{},"task_id"),callback:e.callback,scope:e.scope})},checkImportOfficeByDrive:function(e){let t=this.copyTo({},e.params,"files,conflict_action,to_parent_folder"),i=[Ext.apply({params:Ext.apply({dry_run:!0},t)},SYNO.SDS.Drive.WebAPIDesc.convert_office),Ext.apply({params:t},SYNO.SDS.Drive.WebAPIDesc.convert_office)];this.findAppWindow().sendWebAPI({timeout:36e5,compound:{params:i,stopwhenerror:!0},callback:e.callback,scope:e.scope})},checkImportOffice:function(e){var t=this.copyTo({},e.params||{},"path,password,files");this.findAppWindow().sendWebAPI({api:"SYNO.Office.Import",version:1,method:"check",params:t,encryption:this.getEncryptionOpts(t),callback:e.callback,scope:e.scope})},convertOffice:function(e){var t=this.copyTo({},e.params||{},"files,conflict_action,to_parent_folder");this.findAppWindow().sendWebAPI({api:"SYNO.Office.Import",version:1,method:"convert",params:t,encryption:this.getEncryptionOpts(t),callback:e.callback,scope:e.scope||window})},exportNode:function(e,t){var i=this.copyTo({password:this.getGlobalPassword()},t.params||{},"path,object_id,password,format,ver");o().download({api:"SYNO.Office.Export",version:1,method:"download",params:i,encryption:this.getEncryptionOpts(i),filename:e,timeout:18e5,onError:t.onError.bind(t.scope)})},setUISetting:function(e){return o().request({api:"SYNO.Office.Setting.UI",method:"set",version:1,params:this.copyTo({},e.params,"object_id,zoom_level,pagination,outline,spell_check,collapsed_sections")})},getUISetting:function(e){return o().request({api:"SYNO.Office.Setting.UI",method:"get",version:1,params:this.copyTo({},e.params,"object_id")})},setPersonSetting:function(e){return o().request({api:"SYNO.Office.Setting.Person",method:"set",version:1,params:this.copyTo({},e.params,"notify_when,notify_by_overview,notify_by_email,notify_by_chat,object_id")})},getPersonSetting:function(e){return o().request({api:"SYNO.Office.Setting.Person",method:"get",version:1,params:this.copyTo({},e.params,"object_id")})},setSettingAsync:function(e){return o().request({api:"SYNO.Office.Setting",method:"set",version:1,params:this.copyTo({},e.params,"default_locale,formula_preview,ruler,formatting_marks,preference_settings,focus_mode,hide_hint,formula_panel_opened,formula_panel_expanded,ai_translator_language,ai_helper_languages,side_panel_width")})},getSettingAsync:function(){return o().request({api:"SYNO.Office.Setting",method:"get",version:1,params:{}})},listTemplate:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Template",version:1,method:"list",params:this.copyTo({},e.params,"ntype"),callback:e.callback,scope:e.scope||window})},makeTemplate:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Template",version:1,method:"make",params:this.copyTo({},e.params,"object_id,title,default_title,password,encrypt,parent_id,ver"),encryption:this.getEncryptionOpts(e.params),callback:e.callback,scope:e.scope||window})},listTheme:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Theme",version:1,method:"list",params:this.copyTo({},e.params,"ntype"),callback:e.callback,scope:e.scope||window})},applyTheme:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Theme",version:1,method:"apply",params:this.copyTo({},e.params,"ntype,object_id,password,theme_id,source_object_id,source_password,source_file_ids"),encryption:this.getEncryptionOpts(e.params),callback:e.callback,scope:e.scope||window})},renameTemplate:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Template",version:1,method:"set",params:this.copyTo({},e.params,"object_id,title"),callback:e.callback,scope:e.scope||window})},deleteTemplate:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Template",version:1,method:"delete",params:this.copyTo({},e.params,"object_id"),callback:e.callback,scope:e.scope||window})},saveTemplate:function(e){var t=this.copyTo({},e.params||{},"title,path,encrypt,file,size");Ext.iterate(t,function(e,i){t[e]=JSON.stringify(i)});var i=Promise.resolve(t);return e.params.encrypt&&(i=this.encryptPasswordPromise(e.params.password||this.getGlobalPassword()).then(function(e){return Object.assign(t,e)})),i.then(this._requestSaveTemplate.bind(this,e))},_requestSaveTemplate:function(e,t){var i=new window.FormData;Ext.iterate(t,function(e,t){i.append(e,t)}),SYNO.SDS.Office.Utils.isDriveAdvSharing()&&i.append("sharing_token",JSON.stringify(SYNO.SDS.Drive.Sharing.GetSharingToken()));var n=e.params.file,o=e.params.raw;i.append("raw",o,n.name||"image"),this.findAppWindow().sendWebAPI({api:"SYNO.Office.Template",version:1,method:"save",isUpload:!0,timeout:18e5,params:{},html5upload:!0,uploadData:i,callback:e.callback.bind(e.scope||window),scope:this})},shareTemplate:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Template.Permission",version:1,method:"set",params:this.copyTo({},e.params||{},"object_id,perm"),callback:e.callback,scope:e.scope||window})},getTemplateShardLinkAndInfo:function(e){var t=[{api:"SYNO.SynologyDrive.Sharing",version:2,method:"get_base_url"},{api:"SYNO.Office.Template",version:1,method:"get",params:this.copyTo({},e.params||{},"object_id,field")}];this.findAppWindow().sendWebAPI({compound:{params:t,stopwhenerror:!1},callback:e.callback,scope:e.scope})},leaveTemplate:function(e,t){var i=[{api:"SYNO.Office.Template.Permission",version:1,method:"set",params:this.copyTo({},e.params||{},"object_id,perm")}];t&&i.push({api:"SYNO.Office.Node",version:1,method:"get",params:this.copyTo({},e.params||{},"object_id,ver,field,basic")}),this.findAppWindow().sendWebAPI({compound:{params:i,stopwhenerror:!0},callback:e.callback,scope:e.scope})},requestTemplate:function(e){this.appWindow.sendWebAPI({api:"SYNO.Office.Template",version:1,method:"request",params:this.copyTo({},e.params||{},"object_id"),callback:e.callback,scope:e.scope||window})},listTemplateGroup:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Template.Sharing.Group",version:1,method:"list",callback:e.callback,scope:e.scope||window})},publishTemplate:function(e){var t={api:"SYNO.Office.Template",version:1,method:"publish",isUpload:!0,timeout:18e5,params:{}},i=new window.FormData,n=this.copyTo({},e.params,"object_id,publish_version,file,size");Ext.iterate(n,function(e,t){i.append(e,JSON.stringify(t))});var o=e.params.file,r=e.params.raw;i.append("raw",r,o.name||"image"),t.html5upload=!0,t.uploadData=i,t.callback=function(t,i){e.callback.call(e.scope||window,t,i)},t.scope=this,this.findAppWindow().sendWebAPI(t)},getDocOutline:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Doc.Outline",method:"get",version:1,params:e.params,callback:e.callback,scope:e.scope||window})},setDocOutline:function(e){this.findAppWindow().sendWebAPI({api:"SYNO.Office.Doc.Outline",method:"set",version:1,params:this.copyTo({},e.params||{},"object_id,outline"),callback:e.callback,scope:e.scope||window})},getFileSharingInfoPromise:function(e){return SYNO.SDS.Office.GetWindow().sendWebAPIPromise({compound:{stopwhenerror:!1,params:[Object.assign({},SYNO.SDS.Drive.WebAPIDesc.get_file,{params:{path:e}}),Object.assign({},SYNO.SDS.Drive.WebAPIDesc.get_adv_sharing,{params:{path:e}})]}})},getSharingToken:async function(e){return await o().request({api:"SYNO.SynologyDrive.AdvanceSharing.Public",method:"auth",version:1,params:{sharing_link:e}})},getMetaInfo:function(e){this.appWindow.sendWebAPI({api:"SYNO.Office.Shard.Info",version:1,method:"get",params:{additional:["Content-Security-Policy"]},callback:e.callback,scope:e.scope||window})},getDriveInfo:function(){return o().request({api:"SYNO.Office.Shard.Info",version:1,method:"get",params:{additional:["drive"]}})},statics:{getImageRelativeUrl:function(e,t,i,n,o,r,a){void 0===a&&(a=!0);var s="oo/file/"+encodeURIComponent(t)+"/"+encodeURIComponent(i);SYNO.SDS.Office.Utils.isIgnoreVersion()?s+="/ver/ignore_version":o&&(s+="/ver/"+encodeURIComponent(o)),s+="/"+encodeURIComponent(n||"img");var c={};r||(c.raw=!1),a||Ext.apply(c,SYNO.SDS.Office.Env.getSessionToken());let l=!1;return(SYNO.SDS.Office.Utils.isDriveAdvSharing()?c.sharing_token=SYNO.SDS.Drive.Sharing.GetSharingToken():l=!c.tid,s=Ext.urlAppend(s,Ext.urlEncode(SYNO.API.EncodeParams(c)),l),e)?Ext.urlAppend(s,Ext.urlEncode(SYNO.API.EncodeParams({linkId:e})),!1):s},getImageAbsoluteUrl:function(e,t,i,n,o,r){var a=SYNO.SDS.Office.WindowHelper.getBaseAppPath();return!0!==SYNO.SDS.Office.Utils.isQuickconnect()||a.startsWith("/direct/")||SYNO.SDS.Office.Utils.isQuickconnectDirect()||(a="/direct"+a),"/"!==a[a.length-1]&&(a+="/"),location.protocol+"//"+location.host+a+this.getImageRelativeUrl(e,t,i,n,o,r,!1)},getImageUrl(e,t,i,n,o,r,a){return a?this.getImageAbsoluteUrl(e,t,i,n,o,r):this.getImageRelativeUrl(e,t,i,n,o,r)},getFileRequestUrl:function(e){return SYNO.SDS.Office.WindowHelper.getBaseAppURL()+"/d/f/"+e}}})},25374:function(e,t,i){"use strict";i.d(t,{o:()=>p}),i(17176);let n=SYNO.SDS.Drive.Sharing;var o,r,a=i.n(n);_S("standaloneAppName")&&(SYNO.SDS.Utils.Logout.doRefresh=function(){var e=SYNO.SDS.Office.Utils.getAppURL();window.location.href===window.location.origin+e?window.location.reload():window.location.href=e},SYNO.SDS.Strings["SYNO.SDS.SheetStation.Sheet.Application"]=SYNO.SDS.Strings["SYNO.SDS.Office.Doc.Application"]=SYNO.SDS.Strings["SYNO.SDS.Office.Doc.MainWindow"]=SYNO.SDS.Strings["SYNO.SDS.Office.Presentation.Application"]=SYNO.SDS.Strings["SYNO.SDS.Office.Presentation.MainWindow"]=SYNO.SDS.Strings["SYNO.SDS.Office.Sheet.Application"]=SYNO.SDS.Strings["SYNO.SDS.Office.Sheet.MainWindow"]=SYNO.SDS.Strings["SYNO.SDS.Office.BasicInstance"]=SYNO.SDS.Strings["SYNO.SDS.Office.BasicApp"]=SYNO.SDS.Strings["SYNO.SDS.Office.AppInstance"],SYNO.SDS.Strings["SYNO.SDS.CSTN.Instance"]||(SYNO.SDS.Strings["SYNO.SDS.CSTN.Instance"]=SYNO.SDS.Strings["SYNO.SDS.Drive.Application"]),a().GetSharingLink()&&a().Override(),SYNO.ux.Menu.prototype.useARIA=!1,Ext.menu.Menu.prototype.initComponent=(o=Ext.menu.Menu.prototype.initComponent,function(){o.apply(this,arguments),this.floating&&Ext.EventManager.removeResizeListener(this.hide,this)}),Ext.menu.Menu.prototype.onHide=(r=Ext.menu.Menu.prototype.onHide,function(){if(r.apply(this,arguments),!this.parentMenu&&!this.allowOtherMenus){var e=document.activeElement;(e===document.body||SYNO.SDS.Office.EditorUtils.parentContains(e,"x-menu"))&&SYNO.SDS.Office.Utils.focusEditor()}}));let s=SYNO.SDS.Drive.Layout;var c=i.n(s);_S("standaloneAppName")&&c()();var l=i(46728),f=i(61367),S=i(17370);let p=Ext.define("SYNO.SDS.Office.AppInstance",{extend:"SYNO.SDS.AppInstance",skipRecord:!0,constructor:function(){SYNO.SDS.AppInstance.prototype.constructor.apply(this,arguments);var e=["syno-o-theme","syno-d-theme"];if((0,f.isMobileLayout)()){Ext.QuickTips.disable();let t=SYNO.SDS.MessageBoxV5.prototype,i=document.body.clientWidth;i<t.minWidth+70&&(t.minWidth=t.maxWidth=i-70),e.push("syno-o-mobile")}SYNO.SDS.Office.Utils.isPublicShareOrImportView()&&e.push("syno-o-public"),SYNO.SDS.Drive.Utils.isSmallScreenSize()&&e.push("syno-d-small-theme"),Ext.getBody().addClass(e)},getUserSettings:function(){if(SYNO.SDS.Drive.Utils.isAppAuthorized())return SYNO.SDS.AppInstance.prototype.getUserSettings.apply(this,arguments)},setUserSettings:function(){SYNO.SDS.Drive.Utils.isAppAuthorized()&&SYNO.SDS.AppInstance.prototype.setUserSettings.apply(this,arguments)},beforeOpen:function(){if((0,l.rp)()){var e={modal:!0,draggable:!1,renderTo:document.body};return new SYNO.SDS.MessageBoxV5(e).getWrapper({preventDelay:!0}).alert("",String.format(SYNO.SDS.Office._T("error","not_support_browser"),(0,l.qE)()),function(){(0,S.on)()}),SYNO.SDS.Office.Utils.removeLoadingPage(),!1}return!this.onCheckRedirect()},onCheckRedirect:function(){var e,t=Ext.urlDecode(window.location.search.substr(1));if(t.launchParam){var i=Ext.urlDecode(t.launchParam);if(i.link){var n=i.link,o=i.sharing_link;return delete t.launchParam,delete t.launchApp,e=o?SYNO.SDS.Office.URL.getDriveAdvSharingURL(n,o):SYNO.SDS.Office.URL.getOfficeURL(n),e=Ext.urlAppend(e,Ext.urlEncode(t),!1),window.location.hash&&(e+=window.location.hash),window.location.href=e,!0}if(i.object_id){var r=i.object_id;if(-1===r.lastIndexOf(".")){switch(SYNO.SDS.Session.standaloneAppName){case"SYNO.SDS.Office.Sheet.Application":r+=".sh";break;case"SYNO.SDS.Office.Doc.Application":r+=".doc";break;case"SYNO.SDS.Office.Presentation.Application":r+=".slide"}i.object_id=r,t.launchParam=Ext.urlEncode(i);var a=window.location.pathname;return a=a.substr(1,a.lastIndexOf("/")),e=Ext.urlAppend(window.location.protocol+"//"+window.location.host+"/"+a,Ext.urlEncode(t),!1),window.location.hash&&(e+=window.location.hash),window.location.href=e,!0}}}return!1}})},93489:function(e,t,i){"use strict";var n=i(14014),o=i(3713),r=i(15149),a=i(25374),s=i(71783);Ext.define("SYNO.SDS.Office.BasicInstance",{extend:a.o,appWindowName:"SYNO.SDS.Office.BasicApp"}),Ext.define("SYNO.SDS.Office.BasicApp",{extend:"SYNO.SDS.AppWindow",constructor:function(e){SYNO.SDS.AppWindow.prototype.constructor.call(this,this.fillConfig(e)),SYNO.SDS.Office.Utils.removeLoadingPage()},fillConfig:function(e){var t=this.getPermPanel(),i={layout:"card",deferredRender:!0,activeItem:t,items:[t]};return i.useDefualtKey=!1,Ext.apply(i,e),i},onOpen:function(e){return SYNO.SDS.AppWindow.prototype.onOpen.apply(this,arguments),this.onRequest(e)},onRequest:function(e){return this.initApp(e),SYNO.SDS.AppWindow.prototype.onRequest.apply(this,arguments)},initApp:function(e){var t,i=window.getDriveErrCode?window.getDriveErrCode():0;-1e3===i?this.getPermPanel().onUpdate("SERVICE_UNAVAILABLE","",SYNO.SDS.Office._T("error","compatibility")):57383===i?this.getPermPanel().onUpdate("NO_PERM"):0<i&&57344>i?this.getPermPanel().onUpdateByErrCode(i):(0<i&&(t=(0,s.v2)(i)),this.getPermPanel().onUpdate("SERVICE_UNAVAILABLE","",t))},getWebAPI:function(){return this.webapimgr||(this.webapimgr=new o.Z({appWindow:this}))},getAction:function(){return this.actionmgr||(this.actionmgr=new n.Z({}))},getPermPanel:function(){return this.permPanel||(this.permPanel=new r.Z({})),this.permPanel}})},85020:function(e,t,i){"use strict";function n(){return _S("majorversion")}function o(){return!!_S("isLogined")}i.d(t,{$E:()=>n,YM:()=>o})},71783:function(e,t,i){"use strict";i.d(t,{v2:()=>s,yj:()=>a,zg:()=>o});var n=i(32334);function o(e){let t;return e&&Ext.isArray(e.errors)?t=e.errors[0].code:Ext.isObject(e)?"transaction aborted"===e.statusText?e.isTimeout&&(t=106):t=e.code:t=e,t}let r=!1;function a(){if(!r){SYNO.SDS.Office.ErrorString={};let e=[(0,n.$)("error","error_error_system"),(0,n.$)("error","database"),(0,n.$)("error","database"),(0,n.$)("error","database"),(0,n.$)("error","database"),(0,n.$)("error","database"),(0,n.$)("error","error_invalid"),(0,n.$)("error","object_not_exist"),(0,n.$)("error","default_create_fail"),(0,n.$)("error","error_error_system"),(0,n.$)("error","error_error_system"),(0,n.$)("error","object_no_permission"),(0,n.$)("error","error_error_system"),(0,n.$)("error","error_synodrive"),(0,n.$)("error","error_synodrive"),(0,n.$)("error","drive_get_failed"),(0,n.$)("error","error_synodrive"),(0,n.$)("error","error_error_system"),(0,n.$)("error","default_create_fail_directory"),(0,n.$)("error","dir_not_exist"),(0,n.$)("error","no_enough_space"),(0,n.$)("error","export_op_fail"),(0,n.$)("error","import_op_fail"),(0,n.$)("error","error_error_system"),(0,n.$)("error","import_export_running"),(0,n.$)("error","import_export_not_running"),(0,n.$)("error","error_error_system"),(0,n.$)("error","error_error_system"),(0,n.$)("error","error_error_system"),(0,n.$)("common","err_pass"),(0,n.$)("common","err_pass"),(0,n.$)("common","err_pass"),(0,n.$)("error","encrypt_already"),(0,n.$)("error","invalid_image"),(0,n.$)("error","file_not_exist"),(0,n.$)("error","error_error_system"),(0,n.$)("error","error_error_system"),(0,n.$)("error","move_to_child"),(0,n.$)("error","copy_to_child"),(0,n.$)("error","permission_not_enough"),(0,n.$)("error","not_support"),(0,n.$)("error","error_error_system"),(0,n.$)("error","moving_data"),(0,n.$)("error","space_not_enough"),_S("is_admin")?(0,n.$)("error","volume_moving"):(0,n.$)("error","maintenance"),_S("is_admin")?(0,n.$)("error","backuping"):(0,n.$)("error","maintenance"),_S("is_admin")?(0,n.$)("error","backuping"):(0,n.$)("error","maintenance"),(0,n.$)("error","file_not_exist"),(0,n.$)("error","required_name"),(0,n.$)("error","url_invalid"),(0,n.$)("error","url_resolve_failed"),(0,n.$)("error","url_download_failed"),(0,n.$)("error","url_download_failed"),(0,n.$)("error","convert_format_failed"),(0,n.$)("error","encrypted_file_import_fail"),(0,n.$)("error","error_error_system"),(0,n.$)("error","error_error_system"),(0,n.$)("error","tpl_publishing"),(0,n.$)("error","version_name_existed"),(0,n.$)("error","ofile_shcema"),(0,n.$)("error","history_broken"),(0,n.$)("error","import_too_large_file"),(0,n.$)("error","invaild_character"),(0,n.$)("error","error_error_system"),(0,n.$)("error","cluster_lock"),(0,n.$)("error","cluster_lock"),(0,n.$)("error","volume_snapshotting"),(0,n.$)("error","invalid_file_format")];for(let t=0;t<e.length;++t)SYNO.SDS.Office.ErrorString[57344+t]=e[t];Object.defineProperty(SYNO.SDS.Office.ErrorString,57405,{configurable:!0,enumerable:!0,get(){let e=(0,n.$)("error","import_too_large_file"),t=SYNO.SDS.Office.Define.Info?.sheet_max_cell_count;return void 0!==t?String.format(e,t):e}}),r=!0}}function s(e){a();let t=o(e);return Ext.isNumber(t)?t<400?102===t?SYNO.SDS.Drive._T("error","office_install"):SYNO.API.Errors.common[t]||_T("error","error_error"):t in SYNO.SDS.Office.ErrorString?SYNO.SDS.Office.ErrorString[t]:t in SYNO.SDS.Drive.ErrorString?SYNO.SDS.Drive.ErrorString[t]:_T("error","error_error"):_T("error","error_unknown")}},32334:function(e,t,i){"use strict";function n(e,t,i){try{let n=_TT("SYNO.SDS.Office.AppInstance",e,t)||_TT("SYNO.SDS.Office.AdminSetting",e,t)||_TT("SYNO.SDS.Drive.Application",e,t);if(n)return n;if(void 0!==i)return i}catch{}return _T(e,t)}i.d(t,{$:()=>n})},61431:function(e,t,i){"use strict";function n(e){return e._isVue||"$"in e}i.d(t,{z:()=>n})},89087:function(e,t,i){"use strict";i.d(t,{L9:()=>p,Ne:()=>s,QX:()=>l,Xm:()=>f});var n=i(85020),o=i(61431),r=i(61232);function a(){return window.synofficeEnableVueCompatibility||"7"===(0,n.$E)()&&!_F("SYNO_PRODUCT_FSDN")}function s(e){return"function"==typeof e&&"component"in e&&"options"in e}function c(e){return e&&"object"==typeof e&&e._isVue&&!("$"in e)}function l(e,t,i){void 0===i&&(i={});let{ownerWindow:n=SYNO.SDS.Office.GetWindow()}=i;if(a()&&s(e)&&(!(0,o.z)(n)||c(n)))if((0,o.z)(n))return n.openModalWindow(e,t);else return n.openVueWindow(e,t);return s(e)||c(n)?null:(0,r.hy)(e,t,{createWindow:(e,t,i)=>{let n=SYNO.SDS.Drive._Vue;return n.config.globalProperties.$windowManager.createWindow(e,t,{...i,parentApp:n})},...i})}function f(e){return a()&&s(e.vueClass)?new SYNO.SDS.VuePanel(e):new SYNO.SDS.Office.VuePanel({vueApp:SYNO.SDS.Drive.Vue.Utils.createVueApp(e.vueClass,e.vueOptions.propsData),...e})}let S=[{install(e){e.config.globalProperties.$T=(e,t)=>{try{return _TT("SYNO.SDS.Drive.Application",e,t)||_T(e,t)||`${e}:${t}`}catch{return _T(e,t)||`${e}:${t}`}}}}];function p(){return S}},5890:function(e,t,i){"use strict";function n(){return SYNO.SDS.Office.Env}i.d(t,{D:()=>n})},17370:function(e,t,i){"use strict";function n(e,t){void 0===e&&(e=window),void 0===t&&(t=!0),r=!0;try{e.close()}catch{}try{t&&e.location.assign(SYNO.SDS.Office.WindowHelper.getBaseAppPath()||"/")}finally{r=!1}}i.d(t,{AD:()=>s,Gq:()=>c,on:()=>n,u1:()=>a});let o=[],r=!1;function a(e){o.push(e)}function s(){return!!r||o.every(e=>!!e())}function c(e){return s()?SYNO.SDS.onBeforeUnload?.():(e.preventDefault(),"unsave")}},80816:function(e,t,i){"use strict";i.d(t,{B:()=>o});var n=i(61232);function o(){return(0,n.m9)().getWebAPI()}},61232:function(e,t,i){"use strict";i.d(t,{NV:()=>s,hy:()=>a,m9:()=>r});var n=i(61431),o=i(32334);function r(){return SYNO.SDS.Office.GetWindow()}function a(e,t,i){let o;void 0===i&&(i={});let{ownerWindow:a,createWindow:s,onDestroy:c,align:l}=i,f={createWindow:s,onDestroy:c,align:l};return a?(0,n.z)(a)?o=a.openModalWindow(e,t,f):(o=r().manager.openModalWindow(e,t,f)).window.setOwner(a):o=r().manager.openModalWindow(e,t,f),o}function s(e,t){return async function(){for(var i=arguments.length,n=Array(i),r=0;r<i;r++)n[r]=arguments[r];try{return t.value?.setStatusBusy(void 0,(0,o.$)("common","msg_waiting")),await e(...n)}finally{t.value?.clearStatus()}}}},46728:function(e,t,i){"use strict";i.d(t,{Vk:()=>p,qE:()=>f,rp:()=>S});var n=navigator.userAgent.toLowerCase();function o(e){var t=n.match(e);return t?parseFloat(t[1]):void 0}function r(){return/msie|edge|edg/.test(n)}function a(){return/\bchrome\b/.test(n)}function s(){return/\bcrios\b/.test(n)}function c(){return/firefox/.test(n)}function l(){return navigator.vendor.includes("Apple")&&/safari/.test(n)}function f(){return r()?!/edg/.test(n)||110>(o(/edg\/([0-9.]+)/)||999999)?"Microsoft Edge 110":"":a()?110>(o(/chrome\/([0-9.]+)/)||999999)?"Google Chrome 110":"":s()?110>(o(/crios\/([0-9.]+)/)||999999)?"Google Chrome 110":"":c()?115>(o(/firefox\/([0-9.]+)/)||999999)?"Mozilla Firefox 115":"":l()&&16>(o(/version\/([0-9.]+)/)||999999)?/iPad|iPhone|iPod/.test(navigator.platform)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1?"iOS 16":"Safari 16":""}function S(){return!!f()}function p(){return r()?o(/edg\/([0-9.]+)/):a()?o(/chrome\/([0-9.]+)/):s()?o(/crios\/([0-9.]+)/):c()?o(/firefox\/([0-9.]+)/):l()?o(/version\/([0-9.]+)/):void 0}},96494:function(e){"use strict";e.exports=SYNO.SDS.Drive.Utils},30947:function(e){"use strict";e.exports=synowebapi.promises},28373:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=i(80651).Z.Symbol},3240:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=function(e,t){for(var i=-1,n=t.length,o=e.length;++i<n;)e[o+i]=t[i];return e}},27796:function(e,t,i){"use strict";i.d(t,{Z:()=>l});var n=i(3240),o=i(28373),r=i(75266),a=i(3073),s=o.Z?o.Z.isConcatSpreadable:void 0;let c=function(e){return(0,a.Z)(e)||(0,r.Z)(e)||!!(s&&e&&e[s])},l=function e(t,i,o,r,a){var s=-1,l=t.length;for(o||(o=c),a||(a=[]);++s<l;){var f=t[s];i>0&&o(f)?i>1?e(f,i-1,o,r,a):(0,n.Z)(a,f):r||(a[a.length]=f)}return a}},21452:function(e,t,i){"use strict";i.d(t,{Z:()=>S});var n=i(28373),o=Object.prototype,r=o.hasOwnProperty,a=o.toString,s=n.Z?n.Z.toStringTag:void 0;let c=function(e){var t=r.call(e,s),i=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=a.call(e);return n&&(t?e[s]=i:delete e[s]),o};var l=Object.prototype.toString,f=n.Z?n.Z.toStringTag:void 0;let S=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":f&&f in Object(e)?c(e):l.call(e)}},82208:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n="object"==typeof global&&global&&global.Object===Object&&global},80651:function(e,t,i){"use strict";i.d(t,{Z:()=>r});var n=i(82208),o="object"==typeof self&&self&&self.Object===Object&&self;let r=n.Z||o||Function("return this")()},74590:function(e,t,i){"use strict";i.d(t,{Z:()=>o});var n=i(27796);let o=function(e){return(null==e?0:e.length)?(0,n.Z)(e,1):[]}},75266:function(e,t,i){"use strict";i.d(t,{Z:()=>l});var n=i(21452),o=i(32398);let r=function(e){return(0,o.Z)(e)&&"[object Arguments]"==(0,n.Z)(e)};var a=Object.prototype,s=a.hasOwnProperty,c=a.propertyIsEnumerable;let l=r(function(){return arguments}())?r:function(e){return(0,o.Z)(e)&&s.call(e,"callee")&&!c.call(e,"callee")}},3073:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=Array.isArray},32398:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=function(e){return null!=e&&"object"==typeof e}}},function(e){e(e.s=93489)}]);